Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Phase2TrackerClusterizer validation code #14225

Merged
merged 2 commits into from
Apr 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions RecoLocalTracker/SiPhase2Clusterizer/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<use name="root"/>
<use name="classlib"/>
<use name="clhep"/>
<use name="SimTracker/SiPhase2Digitizer"/>
<use name="SimDataFormats/TrackingHit"/>
<use name="SimDataFormats/TrackerDigiSimLink"/>
<use name="SimDataFormats/CrossingFrame"/>
Expand Down
22 changes: 7 additions & 15 deletions RecoLocalTracker/SiPhase2Clusterizer/test/ClustersValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"

#include "SimTracker/SiPhase2Digitizer/interface/Phase2TrackerDigiCommon.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move non-sim code to some other place.
Reco* subsystem should depend on the Sim minimally.

It's OK for validation code, but for the Phase2TrackerDigiCommon it doesn't seem justifiable, since the code just deals with TrackerTopology and DetId
SimTracker/SiPhase2Digitizer/src/Phase2TrackerDigiCommon.cc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that your comment is related to the file in SimTracker and not the ClusterValidation file ? If so, I cannot move this file but can copy/paste the code locally (which might not be the best solution).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomaslenzi
Yes, the comment was about somewhat improper location of Phase2TrackerDigiCommon.
If you are not the main developer there, please pass this along.
It doesn't have to be addressed with this PR, but better be, eventually.


#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "CommonTools/Utils/interface/TFileDirectory.h"

Expand Down Expand Up @@ -81,7 +83,6 @@ class Phase2TrackerClusterizerValidation : public edm::EDAnalyzer {
private:

std::map< unsigned int, ClusterHistos >::iterator createLayerHistograms(unsigned int);
unsigned int getLayerNumber(const DetId&, const TrackerTopology*);
unsigned int getSimTrackId(const edm::Handle< edm::DetSetVector< PixelDigiSimLink > >&, const DetId&, unsigned int);

edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > tokenClusters_;
Expand Down Expand Up @@ -150,11 +151,11 @@ void Phase2TrackerClusterizerValidation::analyze(const edm::Event& event, const

// Get the geometry
edm::ESHandle< TrackerGeometry > geomHandle;
eventSetup.get< TrackerDigiGeometryRecord >().get(geomHandle);
eventSetup.get< TrackerDigiGeometryRecord >().get("idealForDigi", geomHandle);
const TrackerGeometry* tkGeom = &(*geomHandle);

edm::ESHandle< TrackerTopology > tTopoHandle;
eventSetup.get< IdealGeometryRecord >().get(tTopoHandle);
eventSetup.get< TrackerTopologyRcd >().get(tTopoHandle);
const TrackerTopology* tTopo = tTopoHandle.product();

/*
Expand Down Expand Up @@ -198,10 +199,10 @@ void Phase2TrackerClusterizerValidation::analyze(const edm::Event& event, const
// Get the detector unit's id
unsigned int rawid(DSViter->detId());
DetId detId(rawid);
unsigned int layer(getLayerNumber(detId, tTopo));
unsigned int layer(phase2trackerdigi::getLayerNumber(rawid, tTopo));

// Get the geometry of the tracker
const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
const TrackerGeomDet* geomDetUnit(tkGeom->idToDetUnit(detId));
const PixelGeomDetUnit* theGeomDet = dynamic_cast< const PixelGeomDetUnit* >(geomDetUnit);
const PixelTopology& topol = theGeomDet->specificTopology();

Expand Down Expand Up @@ -257,7 +258,7 @@ void Phase2TrackerClusterizerValidation::analyze(const edm::Event& event, const

// Get all the simTracks that form the cluster
for (unsigned int i(0); i < clustIt->size(); ++i) {
unsigned int channel(PixelDigi::pixelToChannel(clustIt->firstRow() + i, clustIt->column())); // Here we have to use the old pixelToChannel function (not Phase2TrackerDigi but PixelDigi), change this when using new Digis
unsigned int channel(Phase2TrackerDigi::pixelToChannel(clustIt->firstRow() + i, clustIt->column()));
unsigned int simTrackId(getSimTrackId(pixelSimLinks, detId, channel));
clusterSimTrackIds.push_back(simTrackId);
}
Expand Down Expand Up @@ -476,15 +477,6 @@ std::map< unsigned int, ClusterHistos >::iterator Phase2TrackerClusterizerValida
return insertedIt.first;
}

unsigned int Phase2TrackerClusterizerValidation::getLayerNumber(const DetId& detid, const TrackerTopology* topo) {
if (detid.det() == DetId::Tracker) {
if (detid.subdetId() == PixelSubdetector::PixelBarrel) return (topo->pxbLayer(detid));
else if (detid.subdetId() == PixelSubdetector::PixelEndcap) return (100 * topo->pxfSide(detid) + topo->pxfDisk(detid));
else return 999;
}
return 999;
}

unsigned int Phase2TrackerClusterizerValidation::getSimTrackId(const edm::Handle< edm::DetSetVector< PixelDigiSimLink > >& pixelSimLinks, const DetId& detId, unsigned int channel) {
edm::DetSetVector< PixelDigiSimLink >::const_iterator DSViter(pixelSimLinks->find(detId));
if (DSViter == pixelSimLinks->end()) return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Imports
import FWCore.ParameterSet.Config as cms

# Create a new CMS process
process = cms.Process('cluTest')

# Import all the necessary files
process.load('Configuration.StandardSequences.Services_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Configuration.Geometry.GeometryExtended2023LRecoReco_cff')

# Number of events (-1 = all)
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)

# Input file
process.source = cms.Source('PoolSource',
fileNames = cms.untracked.vstring('file:step3.root')
)

# TAG
from Configuration.AlCa.GlobalTag import GlobalTag
#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')

# Output
process.TFileService = cms.Service('TFileService',
fileName = cms.string('file:cluster_validation.root')
)

# DEBUG
process.MessageLogger = cms.Service('MessageLogger',
debugModules = cms.untracked.vstring('siPhase2Clusters'),
destinations = cms.untracked.vstring('cout'),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('ERROR')
)
)

# Analyzer
process.analysis = cms.EDAnalyzer('Phase2TrackerClusterizerValidation',
src = cms.InputTag("siPhase2Clusters"),
links = cms.InputTag("simSiPixelDigis", "Tracker")
)

# Processes to run
process.p = cms.Path(process.analysis)


#from SLHCUpgradeSimulations.Configuration.phase2TkFlat import *
#customise(process)

# Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2023LReco

#call to customisation function cust_2023dev imported from SLHCUpgradeSimulations.Configuration.combinedCustoms
process = cust_2023LReco(process)
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@

# Import all the necessary files
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2023Dev_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff')
process.load('Configuration.StandardSequences.RawToDigi_cff')
process.load('Configuration.StandardSequences.L1Reco_cff')
process.load('Configuration.StandardSequences.Reconstruction_cff')
process.load('Configuration.StandardSequences.Validation_cff')
process.load('DQMOffline.Configuration.DQMOfflineMC_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Configuration.Geometry.GeometryExtended2023devReco_cff')

# Number of events (-1 = all)
process.maxEvents = cms.untracked.PSet(
Expand All @@ -31,7 +24,8 @@

# TAG
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')
#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')

# Output
process.TFileService = cms.Service('TFileService',
Expand All @@ -50,8 +44,18 @@
# Analyzer
process.analysis = cms.EDAnalyzer('Phase2TrackerClusterizerValidation',
src = cms.InputTag("siPhase2Clusters"),
links = cms.InputTag("simSiPixelDigis")
links = cms.InputTag("simSiPixelDigis", "Tracker")
)

# Processes to run
process.p = cms.Path(process.analysis)


#from SLHCUpgradeSimulations.Configuration.phase2TkFlat import *
#customise(process)

# Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2023dev

#call to customisation function cust_2023dev imported from SLHCUpgradeSimulations.Configuration.combinedCustoms
process = cust_2023dev(process)