From 3eb2eb0adefdb4942ce906268fda31cb7f1d76ca Mon Sep 17 00:00:00 2001 From: David Date: Tue, 17 Sep 2013 01:41:34 +0200 Subject: [PATCH 1/3] round one of migration --- .../plugins/PrimaryVertexValidation.h | 4 - .../interface/SiStripElectronSeedGenerator.h | 3 - .../TkSeedingLayers/src/HitExtractorSTRP.cc | 27 +++--- .../plugins/TrackingTruthAccumulator.cc | 84 ++++--------------- 4 files changed, 33 insertions(+), 85 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.h b/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.h index 37c1aafcbbfc0..b3fa048a059df 100644 --- a/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.h +++ b/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.h @@ -25,10 +25,6 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" diff --git a/RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronSeedGenerator.h b/RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronSeedGenerator.h index 2860fe7e20984..9cdbf6351c081 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronSeedGenerator.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronSeedGenerator.h @@ -29,9 +29,6 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h" diff --git a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc index 4701738ae31a9..3679d2aa84b8a 100644 --- a/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc +++ b/RecoTracker/TkSeedingLayers/src/HitExtractorSTRP.cc @@ -12,13 +12,12 @@ #include "DataFormats/Common/interface/ContainerMask.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" - #include "TrackingTools/TransientTrackingRecHit/interface/TrackingRecHitProjector.h" #include "RecoTracker/TransientTrackingRecHit/interface/ProjectedRecHit2D.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "FWCore/Framework/interface/ESHandle.h" + using namespace ctfseeding; using namespace std; @@ -130,6 +129,12 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev TrackerLayerIdAccessor accessor; theSLayer=&sl; unsigned int cleanFrom=0; + + //Retrieve tracker topology from geometry + edm::ESHandle tTopoHandle; + es.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + // // TIB // @@ -176,7 +181,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second); for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tidRing( it->detId() ); if (!ringRange(ring)) continue; for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } @@ -190,7 +195,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tidRing( it->detId() ); if (!ringRange(ring)) continue; if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue; // this is a brutal "cleaning". Add something smarter in the future for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); @@ -205,7 +210,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tidRing( it->detId() ); if (!ringRange(ring)) continue; for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } @@ -259,7 +264,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second); for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tecRing( it->detId() ); if (!ringRange(ring)) continue; for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } @@ -273,7 +278,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tecRing( it->detId() ); if (!ringRange(ring)) continue; if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue; // this is a brutal "cleaning". Add something smarter in the future for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); @@ -289,7 +294,7 @@ HitExtractor::Hits HitExtractorSTRP::hits(const SeedingLayer & sl, const edm::Ev std::pair getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { - int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; + int ring = tTopo->tecRing( it->detId() ); if (!ringRange(ring)) continue; for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } diff --git a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc index 9a81aff7bfefb..0e022becfd3de 100644 --- a/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc +++ b/SimGeneral/TrackingAnalysis/plugins/TrackingTruthAccumulator.cc @@ -38,13 +38,10 @@ #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" -#include "DataFormats/SiPixelDetId/interface/PXFDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "FWCore/Framework/interface/ESHandle.h" @@ -142,7 +139,7 @@ namespace TrackingParticleFactory( const ::DecayChain& decayChain, const edm::Handle< std::vector >& hGenParticles, const edm::Handle< std::vector >& hHepMCGenParticleIndices, const std::vector& simHits, double volumeRadius, double volumeZ, bool allowDifferentProcessTypes ); - TrackingParticle createTrackingParticle( const DecayChainTrack* pTrack ) const; + TrackingParticle createTrackingParticle( const DecayChainTrack* pTrack, const TrackerTopology *tTopo ) const; TrackingVertex createTrackingVertex( const DecayChainVertex* pVertex ) const; bool vectorIsInsideVolume( const math::XYZTLorentzVectorD& vector ) const; private: @@ -181,10 +178,6 @@ namespace std::vector trackingVertexIndices_; }; - /** @brief Utility function copied verbatim from TrackinTruthProducer. - */ - int LayerFromDetid( const DetId& detid ); - /** @brief Adds the supplied TrackingParticle and its parent TrackingVertex to the output collection. Checks to make sure they don't already exist first. * @author Mark Grimes (mark.grimes@bristol.ac.uk) * @date 12/Nov/2012 @@ -195,7 +188,7 @@ namespace * @author Mark Grimes (mark.grimes@bristol.ac.uk) * @date 05/Nov/2012 */ - void addTrack( ::DecayChainTrack* pDecayChainTrack, const TrackingParticleSelector* pSelector, ::OutputCollectionWrapper* pUnmergedOutput, ::OutputCollectionWrapper* pMergedOutput, const ::TrackingParticleFactory& objectFactory, bool addAncestors ); + void addTrack( ::DecayChainTrack* pDecayChainTrack, const TrackingParticleSelector* pSelector, ::OutputCollectionWrapper* pUnmergedOutput, ::OutputCollectionWrapper* pMergedOutput, const ::TrackingParticleFactory& objectFactory, bool addAncestors, const TrackerTopology *tTopo ); } // end of the unnamed namespace @@ -375,6 +368,12 @@ template void TrackingTruthAccumulator::accumulateEvent( const T& event // } + //Retrieve tracker topology from geometry + edm::ESHandle tTopoHandle; + setup.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + + // Run through the collections and work out the decay chain of each track/vertex. The // information in SimTrack and SimVertex only allows traversing upwards, but this will // allow traversal in both directions. This is required for things like grouping electrons @@ -428,7 +427,7 @@ template void TrackingTruthAccumulator::accumulateEvent( const T& event // This function creates the TrackinParticle and adds it to the collection if it // passes the selection criteria specified in the configuration. If the config // specifies adding ancestors, the function is called recursively to do that. - ::addTrack( pDecayTrack, pSelector, pUnmergedCollectionWrapper.get(), pMergedCollectionWrapper.get(), objectFactory, addAncestors_ ); + ::addTrack( pDecayTrack, pSelector, pUnmergedCollectionWrapper.get(), pMergedCollectionWrapper.get(), objectFactory, addAncestors_, tTopo ); } } @@ -511,7 +510,7 @@ namespace // Unnamed namespace for things only used in this file } } - TrackingParticle TrackingParticleFactory::createTrackingParticle( const ::DecayChainTrack* pChainTrack ) const + TrackingParticle TrackingParticleFactory::createTrackingParticle( const ::DecayChainTrack* pChainTrack, const TrackerTopology *tTopo ) const { typedef math::XYZTLorentzVectorD LorentzVector; typedef math::XYZPoint Vector; @@ -591,7 +590,7 @@ namespace // Unnamed namespace for things only used in this file if( newDetector.det() == DetId::Tracker ) ++numberOfTrackerHits; oldLayer=newLayer; - newLayer=LayerFromDetid( newDetector ); + newLayer=tTopo->layer( newDetector ); // Count hits using layers for glued detectors // newlayer !=0 excludes Muon layers set to 0 by LayerFromDetid @@ -993,55 +992,6 @@ namespace // Unnamed namespace for things only used in this file } - - //--------------------------------------------------------------------------------- - //--------------------------------------------------------------------------------- - //---- Functions in the unnamed namespace ------------------------------------- - //--------------------------------------------------------------------------------- - //--------------------------------------------------------------------------------- - - int LayerFromDetid( const DetId& detId ) - { - if( detId.det()!=DetId::Tracker ) return 0; - - int layerNumber=0; - unsigned int subdetId=static_cast( detId.subdetId() ); - - if( subdetId==StripSubdetector::TIB ) - { - TIBDetId tibid( detId.rawId() ); - layerNumber=tibid.layer(); - } - else if( subdetId==StripSubdetector::TOB ) - { - TOBDetId tobid( detId.rawId() ); - layerNumber=tobid.layer(); - } - else if( subdetId==StripSubdetector::TID ) - { - TIDDetId tidid( detId.rawId() ); - layerNumber=tidid.wheel(); - } - else if( subdetId==StripSubdetector::TEC ) - { - TECDetId tecid( detId.rawId() ); - layerNumber=tecid.wheel(); - } - else if( subdetId==PixelSubdetector::PixelBarrel ) - { - PXBDetId pxbid( detId.rawId() ); - layerNumber=pxbid.layer(); - } - else if( subdetId==PixelSubdetector::PixelEndcap ) - { - PXFDetId pxfid( detId.rawId() ); - layerNumber=pxfid.disk(); - } - else edm::LogVerbatim( "TrackingTruthAccumulator" )<<"Unknown subdetid: "<pParentVertex->pParentTrack, NULL, pUnmergedOutput, pMergedOutput, objectFactory, addAncestors ); + if( addAncestors ) addTrack( pDecayChainTrack->pParentVertex->pParentTrack, NULL, pUnmergedOutput, pMergedOutput, objectFactory, addAncestors, tTopo ); // If creation of the unmerged collection has been turned off in the config this pointer // will be null. From eeed3e1702c4d547ac192405490ec34bcf17283d Mon Sep 17 00:00:00 2001 From: David Date: Tue, 17 Sep 2013 19:33:19 +0200 Subject: [PATCH 2/3] migration test/NavigationSchoolAnalyzer.cc --- RecoTracker/TkNavigation/test/BuildFile.xml | 3 + .../test/NavigationSchoolAnalyzer.cc | 64 +++++++++++-------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/RecoTracker/TkNavigation/test/BuildFile.xml b/RecoTracker/TkNavigation/test/BuildFile.xml index 882d580de9da3..0443f3ee7f55e 100644 --- a/RecoTracker/TkNavigation/test/BuildFile.xml +++ b/RecoTracker/TkNavigation/test/BuildFile.xml @@ -3,6 +3,9 @@ + + + diff --git a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc index 2c907d3cf5385..571ceb082e4fc 100644 --- a/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc +++ b/RecoTracker/TkNavigation/test/NavigationSchoolAnalyzer.cc @@ -34,12 +34,8 @@ #include -#include "DataFormats/SiStripDetId/interface/TECDetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" -#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" -#include "DataFormats/SiPixelDetId/interface/PXFDetId.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" @@ -62,13 +58,18 @@ class NavigationSchoolAnalyzer : public edm::EDAnalyzer { virtual void endJob() ; std::string theNavigationSchoolName; + const TrackerTopology *tTopo; + void print(std::ostream& os,const DetLayer* dl); + void print(std::ostream&os, const NavigationSchool::StateType & layers); + void print(std::ostream&os, const NavigationSchool *nav); + }; //navigation printouts -std::ostream& operator<<(std::ostream& os,const DetLayer* dl){ +void NavigationSchoolAnalyzer::print(std::ostream& os,const DetLayer* dl){ const std::vector& bComponents = dl->basicComponents(); - if (bComponents.empty()){/* t'es pas dans la merde */;return os;} + if (bComponents.empty()){/* t'es pas dans la merde */;return;} const GeomDet* tag = bComponents.front(); unsigned int LorW=0; @@ -76,11 +77,11 @@ std::ostream& operator<<(std::ostream& os,const DetLayer* dl){ switch (dl->subDetector()){ case GeomDetEnumerators::PixelBarrel : - LorW = PXBDetId(tag->geographicalId()).layer(); break; + LorW = tTopo->pxbLayer(tag->geographicalId()); break; case GeomDetEnumerators::TIB : - LorW = TIBDetId(tag->geographicalId()).layer(); break; + LorW = tTopo->tibLayer(tag->geographicalId()); break; case GeomDetEnumerators::TOB : - LorW = TOBDetId(tag->geographicalId()).layer(); break; + LorW = tTopo->tobLayer(tag->geographicalId()); break; case GeomDetEnumerators::DT : LorW = DTChamberId(tag->geographicalId().rawId()).station(); break; case GeomDetEnumerators::RPCEndcap : @@ -89,14 +90,14 @@ std::ostream& operator<<(std::ostream& os,const DetLayer* dl){ LorW = RPCDetId(tag->geographicalId().rawId()).station(); break; case GeomDetEnumerators::PixelEndcap : - LorW = PXFDetId(tag->geographicalId()).disk(); - side = PXFDetId(tag->geographicalId()).side();break; + LorW = tTopo->pxfDisk(tag->geographicalId()); + side = tTopo->pxfSide(tag->geographicalId());break; case GeomDetEnumerators::TID : - LorW = TIDDetId(tag->geographicalId()).wheel(); - side = TIDDetId(tag->geographicalId()).side();break; + LorW = tTopo->tidWheel(tag->geographicalId()); + side = tTopo->tidSide(tag->geographicalId());break; case GeomDetEnumerators::TEC : - LorW = TECDetId(tag->geographicalId()).wheel(); - side = TECDetId(tag->geographicalId()).side(); break; + LorW = tTopo->tecWheel(tag->geographicalId()); + side = tTopo->tecSide(tag->geographicalId()); break; case GeomDetEnumerators::CSC : LorW = CSCDetId(tag->geographicalId().rawId()).layer(); side = CSCDetId(tag->geographicalId().rawId()).endcap(); break; @@ -121,17 +122,17 @@ std::ostream& operator<<(std::ostream& os,const DetLayer* dl){ break; } os<< (void*)dl <<"\n"; - return os; + return; } -std::ostream& operator<<(std::ostream&os, const NavigationSchool::StateType & layers){ +void NavigationSchoolAnalyzer::print(std::ostream&os, const NavigationSchool::StateType & layers){ for (NavigationSchool::StateType::const_iterator l = layers.begin(); l!=layers.end();++l) { std::vector displayThose; os<<"####################\n" - <<"Layer: \n" - <<(*l)->detLayer(); + <<"Layer: \n"; + print(os,(*l)->detLayer()); displayThose= (*l)->nextLayers(insideOut); if (displayThose.empty()) @@ -139,7 +140,7 @@ std::ostream& operator<<(std::ostream&os, const NavigationSchool::StateType & la else{ os<<"*** INsideOUT CONNECTED TO ***\n"; for(std::vector::iterator nl =displayThose.begin();nl!=displayThose.end();++nl) - {os<<(*nl)<<"-----------------\n";}} + {print(os,*nl); os<<"-----------------\n";}} displayThose = (*l)->nextLayers(outsideIn); if (displayThose.empty()) @@ -147,16 +148,18 @@ std::ostream& operator<<(std::ostream&os, const NavigationSchool::StateType & la else{ os<<"*** OUTsideIN CONNECTED TO ***\n"; for(std::vector::iterator nl =displayThose.begin();nl!=displayThose.end();++nl) - {os<<(*nl)<<"-----------------\n";}} + {print(os,*nl); os<<"-----------------\n";}} } - return os<<"\n"; + os<<"\n"; + return; } -std::ostream& operator<<(std::ostream&os, const NavigationSchool *nav){ +void NavigationSchoolAnalyzer::print(std::ostream&os, const NavigationSchool *nav){ NavigationSchool::StateType layer=nav->navigableLayers(); - os< tTopoHandle; + iSetup.get().get(tTopoHandle); + tTopo = tTopoHandle.product(); + //get the navigation school edm::ESHandle nav; iSetup.get().get(theNavigationSchoolName, nav); edm::LogInfo("NavigationSchoolAnalyzer")<<"hello"; - edm::LogInfo("NavigationSchoolAnalyzer")<<"NavigationSchool display of: "< Date: Mon, 7 Oct 2013 23:57:24 +0200 Subject: [PATCH 3/3] gaelles changes for detid and pyrelval --- .../python/MatrixInjector.py | 90 +++++++++---------- .../plugins/tracking/SiStripFineDelayHit.cc | 52 ++++++----- .../plugins/tracking/SiStripFineDelayHit.h | 7 +- .../plugins/SiStripHistoryDQMService.cc | 16 ++-- .../plugins/SiStripHistoryDQMService.h | 3 +- ...iTrackerGaussianSmearingRecHitConverter.cc | 68 +++++++------- ...SiTrackerGaussianSmearingRecHitConverter.h | 5 +- 7 files changed, 123 insertions(+), 118 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index b7690e18c29dd..1288c42e6f8bd 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -60,7 +60,7 @@ def __init__(self,opt,mode='init',options=''): self.dqmgui="https://cmsweb.cern.ch/dqm/relval" #couch stuff self.couch = 'https://'+self.wmagent+'/couchdb' -# self.couchDB = 'reqmgr_config_cache' +# self.couchDB = 'reqmgr_config_cache' self.couchCache={} # so that we do not upload like crazy, and recyle cfgs self.user = os.getenv('USER') self.group = 'ppd' @@ -79,24 +79,22 @@ def __init__(self,opt,mode='init',options=''): print '\n\tFound wmclient\n' self.defaultChain={ - "RequestType" : "TaskChain", #this is how we handle relvals - "AcquisitionEra": {}, #Acq Era - "ProcessingString": {}, # processing string to label the dataset - "Requestor": self.user, #Person responsible - "Group": self.group, #group for the request - "CMSSWVersion": os.getenv('CMSSW_VERSION'), #CMSSW Version (used for all tasks in chain) - "Campaign": os.getenv('CMSSW_VERSION'), # only for wmstat purpose - "ScramArch": os.getenv('SCRAM_ARCH'), #Scram Arch (used for all tasks in chain) - "ProcessingVersion": self.version, #Processing Version (used for all tasks in chain) - "GlobalTag": None, #Global Tag (overridden per task) - "CouchURL": self.couch, #URL of CouchDB containing Config Cache - "ConfigCacheURL": self.couch, #URL of CouchDB containing Config Cache + "RequestType" : "TaskChain", #this is how we handle relvals + "Requestor": self.user, #Person responsible + "Group": self.group, #group for the request + "CMSSWVersion": os.getenv('CMSSW_VERSION'), #CMSSW Version (used for all tasks in chain) + "Campaign": os.getenv('CMSSW_VERSION'), # only for wmstat purpose + "ScramArch": os.getenv('SCRAM_ARCH'), #Scram Arch (used for all tasks in chain) + "ProcessingVersion": self.version, #Processing Version (used for all tasks in chain) + "GlobalTag": None, #Global Tag (overridden per task) + "CouchURL": self.couch, #URL of CouchDB containing Config Cache + "ConfigCacheURL": self.couch, #URL of CouchDB containing Config Cache "DbsUrl": "http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet", - #"CouchDBName": self.couchDB, #Name of Couch Database containing config cache + #"CouchDBName": self.couchDB, #Name of Couch Database containing config cache #- Will contain all configs for all Tasks - "SiteWhitelist" : ["T2_CH_CERN", "T1_US_FNAL"], #Site whitelist - "TaskChain" : None, #Define number of tasks in chain. - "nowmTasklist" : [], #a list of tasks as we put them in + #"SiteWhitelist" : ["T2_CH_CERN", "T1_US_FNAL"], #Site whitelist + "TaskChain" : None, #Define number of tasks in chain. + "nowmTasklist" : [], #a list of tasks as we put them in "unmergedLFNBase" : "/store/unmerged", "mergedLFNBase" : "/store/relval", "dashboardActivity" : "relval", @@ -106,41 +104,41 @@ def __init__(self,opt,mode='init',options=''): } self.defaultHarvest={ - "EnableDQMHarvest" : 1, + "EnableHarvesting" : "True", "DQMUploadUrl" : self.dqmgui, "DQMConfigCacheID" : None } self.defaultScratch={ - "TaskName" : None, #Task Name - "ConfigCacheID" : None, #Generator Config id + "TaskName" : None, #Task Name + "ConfigCacheID" : None, #Generator Config id "GlobalTag": None, - "SplittingAlgorithm" : "EventBased", #Splitting Algorithm - "SplittingArguments" : {"events_per_job" : None}, #Size of jobs in terms of splitting algorithm - "RequestNumEvents" : None, #Total number of events to generate - "Seeding" : "AutomaticSeeding", #Random seeding method - "PrimaryDataset" : None, #Primary Dataset to be created + "SplittingAlgo" : "EventBased", #Splitting Algorithm + "EventsPerJob" : None, #Size of jobs in terms of splitting algorithm + "RequestNumEvents" : None, #Total number of events to generate + "Seeding" : "AutomaticSeeding", #Random seeding method + "PrimaryDataset" : None, #Primary Dataset to be created "nowmIO": {}, "KeepOutput" : False } self.defaultInput={ - "TaskName" : "DigiHLT", #Task Name - "ConfigCacheID" : None, #Processing Config id + "TaskName" : "DigiHLT", #Task Name + "ConfigCacheID" : None, #Processing Config id "GlobalTag": None, - "InputDataset" : None, #Input Dataset to be processed - "SplittingAlgorithm" : "LumiBased", #Splitting Algorithm - "SplittingArguments" : {"lumis_per_job" : 10}, #Size of jobs in terms of splitting algorithm + "InputDataset" : None, #Input Dataset to be processed + "SplittingAlgo" : "LumiBased", #Splitting Algorithm + "LumisPerJob" : 10, #Size of jobs in terms of splitting algorithm "nowmIO": {}, "KeepOutput" : False } self.defaultTask={ - "TaskName" : None, #Task Name - "InputTask" : None, #Input Task Name (Task Name field of a previous Task entry) - "InputFromOutputModule" : None, #OutputModule name in the input task that will provide files to process - "ConfigCacheID" : None, #Processing Config id + "TaskName" : None, #Task Name + "InputTask" : None, #Input Task Name (Task Name field of a previous Task entry) + "InputFromOutputModule" : None, #OutputModule name in the input task that will provide files to process + "ConfigCacheID" : None, #Processing Config id "GlobalTag": None, - "SplittingAlgorithm" : "LumiBased", #Splitting Algorithm - "SplittingArguments" : {"lumis_per_job" : 10}, #Size of jobs in terms of splitting algorithm + "SplittingAlgo" : "LumiBased", #Splitting Algorithm + "LumisPerJob" : 10, #Size of jobs in terms of splitting algorithm "nowmIO": {}, "KeepOutput" : False } @@ -155,7 +153,7 @@ def prepare(self,mReader, directories, mode='init'): wmsplit['DIGIHI']=5 wmsplit['RECOHI']=5 wmsplit['HLTD']=5 - wmsplit['RECODreHLT']=2 + wmsplit['RECODreHLT']=2 wmsplit['DIGIPU']=4 wmsplit['DIGIPU1']=4 wmsplit['RECOPU1']=1 @@ -169,7 +167,7 @@ def prepare(self,mReader, directories, mode='init'): wmsplit['TTbarFS_ID']=1 #import pprint - #pprint.pprint(wmsplit) + #pprint.pprint(wmsplit) except: print "Not set up for step splitting" wmsplit={} @@ -214,7 +212,7 @@ def prepare(self,mReader, directories, mode='init'): arg=s[2][index].split() ns=map(int,arg[arg.index('--relval')+1].split(',')) chainDict['nowmTasklist'][-1]['RequestNumEvents'] = ns[0] - chainDict['nowmTasklist'][-1]['SplittingArguments']['events_per_job'] = ns[1] + chainDict['nowmTasklist'][-1]['EventsPerJob'] = ns[1] if 'FASTSIM' in s[2][index] or '--fast' in s[2][index]: thisLabel+='_FastSim' @@ -227,9 +225,9 @@ def prepare(self,mReader, directories, mode='init'): return -15 chainDict['nowmTasklist'][-1]['InputDataset']=nextHasDSInput.dataSet splitForThisWf=nextHasDSInput.split - chainDict['nowmTasklist'][-1]['SplittingArguments']['lumis_per_job']=splitForThisWf + chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf if step in wmsplit: - chainDict['nowmTasklist'][-1]['SplittingArguments']['lumis_per_job']=wmsplit[step] + chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step] # get the run numbers or #events if len(nextHasDSInput.run): chainDict['nowmTasklist'][-1]['RunWhitelist']=nextHasDSInput.run @@ -252,9 +250,9 @@ def prepare(self,mReader, directories, mode='init'): print "Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created" return -15 if splitForThisWf: - chainDict['nowmTasklist'][-1]['SplittingArguments']['lumis_per_job']=splitForThisWf + chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf if step in wmsplit: - chainDict['nowmTasklist'][-1]['SplittingArguments']['lumis_per_job']=wmsplit[step] + chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step] #print step chainDict['nowmTasklist'][-1]['TaskName']=step @@ -314,7 +312,7 @@ def prepare(self,mReader, directories, mode='init'): ## there is in fact only one acquisition era #if len(set(chainDict['AcquisitionEra'].values()))==1: - # print "setting only one acq" + # print "setting only one acq" if acqEra: chainDict['AcquisitionEra'] = chainDict['AcquisitionEra'].values()[0] @@ -336,7 +334,7 @@ def prepare(self,mReader, directories, mode='init'): chainDict['Task%d'%(itask)]=t - ## + ## ## provide the number of tasks @@ -421,5 +419,3 @@ def submit(self): print "...........",n,"submitted" random_sleep() - - diff --git a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc index c5940ea683468..d5d192360e2d0 100644 --- a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc +++ b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc @@ -40,10 +40,8 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" @@ -116,51 +114,51 @@ SiStripFineDelayHit::~SiStripFineDelayHit() // // member functions // -std::pair SiStripFineDelayHit::deviceMask(const StripSubdetector::SubDetector subdet,const int substructure) +std::pair SiStripFineDelayHit::deviceMask(const StripSubdetector::SubDetector subdet,const int substructure, const TrackerTopology *tTopo) { uint32_t rootDetId = 0; uint32_t maskDetId = 0; switch(subdet){ case (int)StripSubdetector::TIB : { - rootDetId = TIBDetId(substructure,0,0,0,0,0).rawId(); - maskDetId = TIBDetId(15,0,0,0,0,0).rawId(); + rootDetId = tTopo->tibDetId(substructure,0,0,0,0,0).rawId(); + maskDetId = tTopo->tibDetId(15,0,0,0,0,0).rawId(); break; } case (int)StripSubdetector::TID : { - rootDetId = TIDDetId(substructure>0 ? 2 : 1,abs(substructure),0,0,0,0).rawId(); - maskDetId = TIDDetId(3,15,0,0,0,0).rawId(); + rootDetId = tTopo->tidDetId(substructure>0 ? 2 : 1,abs(substructure),0,0,0,0).rawId(); + maskDetId = tTopo->tidDetId(3,15,0,0,0,0).rawId(); break; } case (int)StripSubdetector::TOB : { - rootDetId = TOBDetId(substructure,0,0,0,0).rawId(); - maskDetId = TOBDetId(15,0,0,0,0).rawId(); + rootDetId = tTopo->tobDetId(substructure,0,0,0,0).rawId(); + maskDetId = tTopo->tobDetId(15,0,0,0,0).rawId(); break; } case (int)StripSubdetector::TEC : { - rootDetId = TECDetId(substructure>0 ? 2 : 1,abs(substructure),0,0,0,0,0).rawId(); - maskDetId = TECDetId(3,15,0,0,0,0,0).rawId(); + rootDetId = tTopo->tecDetId(substructure>0 ? 2 : 1,abs(substructure),0,0,0,0,0).rawId(); + maskDetId = tTopo->tecDetId(3,15,0,0,0,0,0).rawId(); break; } } return std::make_pair(maskDetId,rootDetId); } -std::vector< std::pair > > SiStripFineDelayHit::detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const StripSubdetector::SubDetector subdet,const int substructure) +std::vector< std::pair > > SiStripFineDelayHit::detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const TrackerTopology *tTopo, const StripSubdetector::SubDetector subdet,const int substructure) { - if(substructure==0xff) return detId(tracker,tk,trajVec,0,0); + if(substructure==0xff) return detId(tracker,tk,trajVec,0,0,tTopo); // first determine the root detId we are looking for - std::pair mask = deviceMask(subdet,substructure); + std::pair mask = deviceMask(subdet,substructure,tTopo); // then call the method that loops on recHits - return detId(tracker,tk,trajVec,mask.first,mask.second); + return detId(tracker,tk,trajVec,mask.first,mask.second,tTopo); } -std::vector< std::pair > > SiStripFineDelayHit::detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const uint32_t& maskDetId, const uint32_t& rootDetId) +std::vector< std::pair > > SiStripFineDelayHit::detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const uint32_t& maskDetId, const uint32_t& rootDetId, const TrackerTopology *tTopo) { - bool onDisk = ((maskDetId==TIDDetId(3,15,0,0,0,0).rawId())||(maskDetId==TECDetId(3,15,0,0,0,0,0).rawId())) ; + bool onDisk = ((maskDetId==tTopo->tidDetId(3,15,0,0,0,0).rawId())||(maskDetId==tTopo->tecDetId(3,15,0,0,0,0,0).rawId())) ; std::vector< std::pair > > result; std::vector usedDetids; // now loop on recHits to find the right detId plus the track local angle @@ -349,6 +347,11 @@ void SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; + //Retrieve tracker topology from geometry + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + // Retrieve commissioning information from "event summary" edm::Handle runsummary; iEvent.getByLabel( inputModuleLabel_, runsummary ); @@ -409,10 +412,10 @@ SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) else if(((layerCode>>6)&0x3)==2) subdet = StripSubdetector::TID; else if(((layerCode>>6)&0x3)==3) subdet = StripSubdetector::TEC; int32_t layerIdx = (layerCode&0xF)*(((layerCode>>4)&0x3) ? -1 : 1); - intersections = detId(*tracker,&(*itrack),trajVec,subdet,layerIdx); + intersections = detId(*tracker,&(*itrack),trajVec,tTopo,subdet,layerIdx); } else { // for latency scans, no layer is specified -> no cut on detid - intersections = detId(*tracker,&(*itrack),trajVec); + intersections = detId(*tracker,&(*itrack),trajVec,tTopo); } LogDebug("produce") << " Found " << intersections.size() << " interesting intersections." << std::endl; for(std::vector< std::pair > >::iterator it = intersections.begin();it tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + event_ = &iEvent; // container for the selected hits std::vector< edm::DetSet > output; @@ -494,7 +502,7 @@ SiStripFineDelayHit::produceNoTracking(edm::Event& iEvent, const edm::EventSetup else if(((layerCode>>6)&0x3)==2) subdet = StripSubdetector::TID; else if(((layerCode>>6)&0x3)==3) subdet = StripSubdetector::TEC; int32_t layerIdx = (layerCode&0xF)*(((layerCode>>4)&0x3) ? -1 : 1); - std::pair mask = deviceMask(subdet,layerIdx); + std::pair mask = deviceMask(subdet,layerIdx,tTopo); // look at the clusters edm::Handle > clusters; iEvent.getByLabel(clusterLabel_,clusters); diff --git a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.h b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.h index 8368059170bcf..b4f40c3b1af4c 100644 --- a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.h +++ b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.h @@ -23,6 +23,7 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include #include "DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTLA.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" // // class decleration @@ -37,9 +38,9 @@ class SiStripFineDelayHit : public edm::EDProducer { virtual void beginRun(const edm::Run &, const edm::EventSetup &) override; virtual void produce(edm::Event&, const edm::EventSetup&) override; virtual void produceNoTracking(edm::Event&, const edm::EventSetup&); - std::pair deviceMask(const StripSubdetector::SubDetector subdet,const int substructure); - std::vector< std::pair > > detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const StripSubdetector::SubDetector subdet = StripSubdetector::TIB,const int substructure=0xff); - std::vector< std::pair > > detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const uint32_t& maskDetId, const uint32_t& rootDetId); + std::pair deviceMask(const StripSubdetector::SubDetector subdet,const int substructure,const TrackerTopology *tTopo); + std::vector< std::pair > > detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const TrackerTopology *tTopo, const StripSubdetector::SubDetector subdet = StripSubdetector::TIB, const int substructure=0xff); + std::vector< std::pair > > detId(const TrackerGeometry& tracker,const reco::Track* tk, const std::vector& trajVec, const uint32_t& maskDetId, const uint32_t& rootDetId, const TrackerTopology *tTopo); std::pair closestCluster(const TrackerGeometry& tracker, const reco::Track* tk,const uint32_t& detId, diff --git a/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.cc b/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.cc index fa4d59c3a44e5..fb3e820c42470 100644 --- a/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.cc +++ b/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.cc @@ -2,10 +2,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DQMServices/Core/interface/MonitorElement.h" #include "DQMServices/Diagnostic/interface/HDQMfitUtilities.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" SiStripHistoryDQMService::SiStripHistoryDQMService(const edm::ParameterSet& iConfig,const edm::ActivityRegistry& aReg) @@ -20,7 +18,7 @@ SiStripHistoryDQMService::~SiStripHistoryDQMService() { } -uint32_t SiStripHistoryDQMService::returnDetComponent(const MonitorElement* ME){ +uint32_t SiStripHistoryDQMService::returnDetComponent(const MonitorElement* ME, const TrackerTopology *tTopo){ LogTrace("SiStripHistoryDQMService") << "[SiStripHistoryDQMService::returnDetComponent]"; std::string str=ME->getName(); size_t __key_length__=7; @@ -35,13 +33,13 @@ uint32_t SiStripHistoryDQMService::returnDetComponent(const MonitorElement* ME){ else if(str.find("TIB")!= std::string::npos){ if (str.find("layer")!= std::string::npos) layer=atoi(str.substr(str.find("layer__")+__key_length__,1).c_str()); - return TIBDetId(layer,0,0,0,0,0).rawId(); + return tTopo->tibDetId(layer,0,0,0,0,0).rawId(); } //TOB else if(str.find("TOB")!= std::string::npos){ if (str.find("layer")!= std::string::npos) layer=atoi(str.substr(str.find("layer__")+__key_length__,1).c_str()); - return TOBDetId(layer,0,0,0,0).rawId(); + return tTopo->tobDetId(layer,0,0,0,0).rawId(); } //TID else if(str.find("TID")!= std::string::npos){ @@ -51,7 +49,7 @@ uint32_t SiStripHistoryDQMService::returnDetComponent(const MonitorElement* ME){ layer=atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str()); } } - return TIDDetId(side,layer,0,0,0,0).rawId(); + return tTopo->tidDetId(side,layer,0,0,0,0).rawId(); } //TEC else if(str.find("TEC")!= std::string::npos){ @@ -61,7 +59,7 @@ uint32_t SiStripHistoryDQMService::returnDetComponent(const MonitorElement* ME){ layer=atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str()); } } - return TECDetId(side,layer,0,0,0,0,0).rawId(); + return tTopo->tecDetId(side,layer,0,0,0,0,0).rawId(); } else return SiStripDetId(DetId::Tracker,0).rawId(); //Full Tracker diff --git a/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.h b/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.h index 0ab7fe935c8f7..94c5fe1043f69 100644 --- a/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.h +++ b/DQM/SiStripHistoricInfoClient/plugins/SiStripHistoryDQMService.h @@ -2,6 +2,7 @@ #define DQM_SiStripHistoricInfoClient_SiStripHistoryDQMService_H #include "DQMServices/Diagnostic/interface/DQMHistoryServiceBase.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" /** @author D. Giordano, A.-C. Le Bihan @@ -16,7 +17,7 @@ class SiStripHistoryDQMService : public DQMHistoryServiceBase { private: //Methods to be specified by each subdet - uint32_t returnDetComponent(const MonitorElement* ME); + uint32_t returnDetComponent(const MonitorElement* ME, const TrackerTopology *tTopo); //bool setDBLabelsForUser (std::string& keyName, std::vector& userDBContent); //bool setDBValuesForUser(std::vector::const_iterator iterMes, HDQMSummary::InputVector& values ); bool setDBLabelsForUser (std::string& keyName, std::vector& userDBContent, std::string& quantity); diff --git a/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.cc b/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.cc index f81593c20f226..ae2a50f3a732d 100644 --- a/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.cc +++ b/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.cc @@ -42,12 +42,8 @@ #include "FWCore/Utilities/interface/Exception.h" // Numbering scheme -#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" -#include "DataFormats/SiPixelDetId/interface/PXFDetId.h" -#include "DataFormats/SiStripDetId/interface/TIBDetId.h" -#include "DataFormats/SiStripDetId/interface/TIDDetId.h" -#include "DataFormats/SiStripDetId/interface/TOBDetId.h" -#include "DataFormats/SiStripDetId/interface/TECDetId.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h" #include "DataFormats/TrackingRecHit/interface/AlignmentPositionError.h" @@ -637,7 +633,11 @@ SiTrackerGaussianSmearingRecHitConverter::beginRun(edm::Run & run, const edm::Ev void SiTrackerGaussianSmearingRecHitConverter::produce(edm::Event& e, const edm::EventSetup& es) { - + //Retrieve tracker topology from geometry + edm::ESHandle tTopoHandle; + es.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + // Step 0: Declare Ref and RefProd FastTrackerClusterRefProd = e.getRefBeforePut("TrackerClusters"); @@ -657,7 +657,7 @@ void SiTrackerGaussianSmearingRecHitConverter::produce(edm::Event& e, const edm: std::map > theClusters ; - smearHits( *allTrackerHits, temporaryRecHits, theClusters); + smearHits( *allTrackerHits, temporaryRecHits, theClusters,tTopo); // Step C: match rechits on stereo layers std::map > temporaryMatchedRecHits ; @@ -696,7 +696,7 @@ void SiTrackerGaussianSmearingRecHitConverter::produce(edm::Event& e, const edm: void SiTrackerGaussianSmearingRecHitConverter::smearHits(MixCollection& input, std::map >& temporaryRecHits, - std::map >& theClusters) + std::map >& theClusters, const TrackerTopology *tTopo) { int numberOfPSimHits = 0; @@ -729,8 +729,8 @@ void SiTrackerGaussianSmearingRecHitConverter::smearHits(MixCollection& #ifdef FAMOS_DEBUG unsigned int subdetId = det.subdetId(); - //unsigned int disk = PXFDetId(det).disk(); - //unsigned int side = PXFDetId(det).side(); + //unsigned int disk = tTopo->pxfDisk(det); + //unsigned int side = tTopo->pxfSide(det); std::cout << " SubDetector = " << subdetId << std::endl; @@ -739,14 +739,14 @@ void SiTrackerGaussianSmearingRecHitConverter::smearHits(MixCollection& else if(subdetId==3|| subdetId==4 || subdetId==5 || subdetId == 6) std::cout<<" Strip GSRecHits "<pxbLayer(det); std::cout << "\tPixel Barrel Layer " << theLayer << std::endl; } if(subdetId==2){ - PXFDetId module(det); - unsigned int theDisk = module.disk(); + + unsigned int theDisk = tTopo->pxfDisk(det); std::cout << "\tPixel Forward Disk " << theDisk << std::endl; } #endif @@ -782,7 +782,7 @@ void SiTrackerGaussianSmearingRecHitConverter::smearHits(MixCollection& // gaussian smearing unsigned int alphaMult = 0; unsigned int betaMult = 0; - bool isCreated = gaussianSmearing(*isim, position, error, alphaMult, betaMult); + bool isCreated = gaussianSmearing(*isim, position, error, alphaMult, betaMult,tTopo); #ifdef FAMOS_DEBUG std::cout << "Error as simulated " << error.xx() << " " << error.xy() << " " << error.yy() << std::endl; @@ -900,10 +900,10 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s Local3DPoint& position , LocalError& error, unsigned& alphaMult, - unsigned& betaMult) + unsigned& betaMult, const TrackerTopology *tTopo) { - // A few caracteritics of the module which the SimHit belongs to. + // A few caracteritics of the module the SimHit belongs to. unsigned int subdet = DetId(simHit.detUnitId()).subdetId(); unsigned int detid = DetId(simHit.detUnitId()).rawId(); const GeomDetUnit* theDetUnit = geometry->idToDetUnit((DetId)simHit.detUnitId()); @@ -937,16 +937,16 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s //split the errors per layer if(subdet == 1){ //Pixel Barrel (now includes tracker) - PXBDetId module(detid); - unsigned int theLayer = module.layer(); + + unsigned int theLayer = tTopo->pxbLayer(detid); position = Local3DPoint(random->gaussShoot((double)simHit.localPosition().x(), localPositionResolutionBar_x[theLayer]),(double)simHit.localPosition().y(),localPositionResolutionBar_y[theLayer]); //position = Local3DPoint(random->gaussShoot((double)simHit.localPosition().x(), localPositionResolutionBar_x[theLayer]),(double)simHit.localPosition().y(),0.); error = LocalError( localPositionResolutionBar_x[theLayer] * localPositionResolutionBar_x[theLayer], 0.0, localPositionResolutionBar_y[theLayer] * localPositionResolutionBar_y[theLayer] ); } else if(subdet == 2) { - PXFDetId module(detid); - unsigned int theDisk = module.disk(); + + unsigned int theDisk = tTopo->pxfDisk(detid); position = Local3DPoint(random->gaussShoot((double)simHit.localPosition().x(), localPositionResolutionFwd_x[theDisk]), (double)simHit.localPosition().y(),localPositionResolutionFwd_y[theDisk]); // position = Local3DPoint(random->gaussShoot((double)simHit.localPosition().x(), localPositionResolutionFwd_x[theDisk]),(double)simHit.localPosition().y(),0.); error = LocalError( localPositionResolutionFwd_x[theDisk] * localPositionResolutionFwd_x[theDisk], @@ -995,8 +995,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s case 1: { #ifdef FAMOS_DEBUG - PXBDetId module(detid); - unsigned int theLayer = module.layer(); + + unsigned int theLayer = tTopo->pxfLayer(detid); std::cout << "\tPixel Barrel Layer " << theLayer << std::endl; #endif if( hitFindingProbability > theHitFindingProbability_PXB ) return false; @@ -1014,8 +1014,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s case 2: { #ifdef FAMOS_DEBUG - PXFDetId module(detid); - unsigned int theDisk = module.disk(); + + unsigned int theDisk = tTopo->pxfDisk(detid); std::cout << "\tPixel Forward Disk " << theDisk << std::endl; #endif if( hitFindingProbability > theHitFindingProbability_PXF ) return false; @@ -1032,8 +1032,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s // TIB case 3: { - TIBDetId module(detid); - unsigned int theLayer = module.layer(); + + unsigned int theLayer = tTopo->tibLayer(detid); #ifdef FAMOS_DEBUG std::cout << "\tTIB Layer " << theLayer << std::endl; #endif @@ -1092,8 +1092,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s // TID case 4: { - TIDDetId module(detid); - unsigned int theRing = module.ring(); + + unsigned int theRing = tTopo->tidRing(detid); double resolutionFactorY = 1. - simHit.localPosition().y() / theDetPlane.position().perp(); @@ -1148,8 +1148,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s // TOB case 5: { - TOBDetId module(detid); - unsigned int theLayer = module.layer(); + + unsigned int theLayer = tTopo->tibLayer(detid); #ifdef FAMOS_DEBUG std::cout << "\tTOB Layer " << theLayer << std::endl; #endif @@ -1219,8 +1219,8 @@ bool SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(const PSimHit& s // TEC case 6: { - TECDetId module(detid); - unsigned int theRing = module.ring(); + + unsigned int theRing = tTopo->tecRing(detid); double resolutionFactorY = 1. - simHit.localPosition().y() / theDetPlane.position().perp(); diff --git a/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.h b/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.h index 97b9a6800e0e8..a4656d537acd8 100644 --- a/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.h +++ b/FastSimulation/TrackingRecHitProducer/src/SiTrackerGaussianSmearingRecHitConverter.h @@ -33,6 +33,7 @@ #include #include #include +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" class TFile; class TH1F; @@ -63,7 +64,7 @@ class SiTrackerGaussianSmearingRecHitConverter : public edm::EDProducer void smearHits(MixCollection& input, std::map >& theRecHits, - std::map >& theClusters); + std::map >& theClusters, const TrackerTopology *tTopo); void matchHits( std::map >& theRecHits, std::map >& matchedMap, @@ -84,7 +85,7 @@ class SiTrackerGaussianSmearingRecHitConverter : public edm::EDProducer Local3DPoint& position , LocalError& error, unsigned& alphaMult, - unsigned& betaMult); + unsigned& betaMult, const TrackerTopology *tTopo); // void loadPixelData(); //