CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
OverlapProblemTPAnalyzer Class Reference

#include <DebugTools/OverlapProblem/plugins/OverlapProblemTPAnalyzer.cc>

Inheritance diagram for OverlapProblemTPAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 OverlapProblemTPAnalyzer (const edm::ParameterSet &)
 
 ~OverlapProblemTPAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorm_associatorToken
 
std::vector< TH1F * > m_assosimhitytecr
 
TH1F * m_etatp
 
TH1F * m_llbit
 
TH1F * m_nassotk
 
TH1F * m_nhits
 
TH1F * m_nrechits
 
TH2F * m_nrecvssimhits
 
TH1F * m_pdgid
 
TH1F * m_ptp
 
std::vector< TH1F * > m_simhitytecr
 
TH1F * m_statustp
 
edm::EDGetTokenT< TrackingParticleCollectionm_tpcollToken
 
edm::EDGetTokenT< edm::View< reco::Track > > m_trkcollToken
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 60 of file OverlapProblemTPAnalyzer.cc.

Constructor & Destructor Documentation

OverlapProblemTPAnalyzer::OverlapProblemTPAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 102 of file OverlapProblemTPAnalyzer.cc.

References m_assosimhitytecr, m_etatp, m_llbit, m_nassotk, m_nhits, m_nrechits, m_nrecvssimhits, m_pdgid, m_ptp, m_simhitytecr, m_statustp, TFileService::make(), dataset::name, relativeConstraints::ring, and runGCPTkAlMap::title.

102  :
104  m_tpcollToken(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticlesCollection"))),
106  m_associatorToken(consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag("trackAssociatorByHits")))
107 {
108  //now do what ever initialization is needed
109 
110 
111 
113 
114  m_ptp = tfserv->make<TH1F>("tpmomentum","Tracking Particle momentum",100,0.,200.);
115  m_etatp = tfserv->make<TH1F>("tpeta","Tracking Particle pseudorapidity",100,-4.,4.);
116  m_nhits = tfserv->make<TH1F>("nhits","Tracking Particle associated hits",100,-0.5,99.5);
117  m_nrechits = tfserv->make<TH1F>("nrechits","Tracking Particle associated rec hits",100,-0.5,99.5);
118  m_nrecvssimhits = tfserv->make<TH2F>("nrecvssimhits","Tracking Particle associated rec hits vs sim hits",
119  100,-0.5,99.5,100,-0.5,99.5);
120  m_nassotk = tfserv->make<TH1F>("nassotk","Number of assocated reco tracks",10,-0.5,9.5);
121 
122  m_pdgid = tfserv->make<TH1F>("pdgid","Tracking Particle PDG id",1000,-500.5,499.5);
123  m_llbit = tfserv->make<TH1F>("llbit","Tracking Particle LongLived bit",2,-0.5,1.5);
124  m_statustp = tfserv->make<TH1F>("statustp","Tracking Particle status",2000,-1000.5,999.5);
125 
126  for(unsigned int ring=0;ring<7;++ring) {
127 
128  char name[100];
129  char title[100];
130 
131  sprintf(name,"simytecr_%d",ring+1);
132  sprintf(title,"SimHit local Y TEC ring %d",ring+1);
133 
134  m_simhitytecr.push_back(tfserv->make<TH1F>(name,title,200,-20.,20.));
135 
136  sprintf(name,"assosimytecr_%d",ring+1);
137  sprintf(title,"SimHit local Y TEC ring %d with associated RecHit",ring+1);
138 
139  m_assosimhitytecr.push_back(tfserv->make<TH1F>(name,title,200,-20.,20.));
140 
141  }
142 
143 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< TrackingParticleCollection > m_tpcollToken
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::Track > > m_trkcollToken
std::vector< TH1F * > m_simhitytecr
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > m_associatorToken
std::vector< TH1F * > m_assosimhitytecr
OverlapProblemTPAnalyzer::~OverlapProblemTPAnalyzer ( )
override

Definition at line 146 of file OverlapProblemTPAnalyzer.cc.

147 {
148 
149  // do anything here that needs to be done at desctruction time
150  // (e.g. close files, deallocate resources etc.)
151 
152 }

Member Function Documentation

void OverlapProblemTPAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 161 of file OverlapProblemTPAnalyzer.cc.

References funct::abs(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), edm::Event::getByToken(), mps_fire::i, LogDebug, LogTrace, m_associatorToken, m_etatp, m_llbit, m_nassotk, m_nhits, m_nrechits, m_nrecvssimhits, m_pdgid, m_ptp, m_statustp, m_tpcollToken, m_trkcollToken, and TrackInfoProducer_cfi::rechits.

162 {
163  using namespace edm;
164 
165  // reco track Handle
166 
167  // Handle<reco::TrackCollection> trkcoll;
169  iEvent.getByToken(m_trkcollToken,trkcoll);
170 
172  iEvent.getByToken(m_tpcollToken,tpcoll);
173 
175  iEvent.getByToken(m_associatorToken,tahandle);
176 
177  // associate reco to sim tracks
178 
179  reco::SimToRecoCollection srcoll = tahandle->associateSimToReco(trkcoll,tpcoll);
180 
181  // loop on Handle with index and use find
182 
183  for(unsigned int index=0 ; index != tpcoll->size() ; ++index) {
184 
185  // get TrackingParticleRef
186 
187  const TrackingParticleRef tp(tpcoll,index);
188 
189  if(std::abs(tp->pdgId())!=13) continue;
190 
191  // get the SimHIt from tracker only
192 
193  // Commented since the new TP's do not have this method
194  // std::vector<PSimHit> tksimhits = tp->trackPSimHit(DetId::Tracker);
195 
196 
197  m_ptp->Fill(tp->p());
198  m_etatp->Fill(tp->eta());
199  // m_nhits->Fill(tp->matchedHit());
200  // With the new Tracking Particles I have to use a different method
201  // m_nhits->Fill(tksimhits.size());
202  m_nhits->Fill(tp->numberOfTrackerHits());
203 
204 
205  m_pdgid->Fill(tp->pdgId());
206  m_llbit->Fill(tp->longLived());
207  m_statustp->Fill(tp->status());
208 
209  // prepare a vector of TrackingRecHit from the associated reco tracks
210 
211  std::vector<DetId> rechits;
212 
213  // look at associated tracks
214 
215  if(srcoll.find(tp) != srcoll.end()) {
216  reco::SimToRecoCollection::result_type trks = srcoll[tp];
217  m_nassotk->Fill(trks.size());
218 
219  // loop on associated tracks and fill TrackingRecHit vector
220  for(reco::SimToRecoCollection::result_type::const_iterator trk = trks.begin();trk!=trks.end();++trk) {
221  for(trackingRecHit_iterator rh = trk->first->recHitsBegin() ; rh!=trk->first->recHitsEnd() ; ++rh) {
222  rechits.push_back((*rh)->geographicalId());
223  }
224 
225  }
226 
227  }
228  else {
229  m_nassotk->Fill(0.);
230  edm::LogInfo("NoAssociatedRecoTrack") << "No associated reco track for TP with p = " << tp->p()
231  << " and eta = " << tp->eta() ;
232  }
233 
234  m_nrechits->Fill(rechits.size());
235  // new method used to be compliant with the new TP's
236  m_nrecvssimhits->Fill(tp->numberOfTrackerHits(),rechits.size());
237 
238  LogDebug("RecHitDetId") << "List of " << rechits.size() << " rechits detid from muon with p = " << tp->p()
239  << "and eta = " << tp->eta();
240  for(unsigned int i=0;i<rechits.size();++i) {
241  LogTrace("RecHitDetId") << rechits[i].rawId();
242  }
243 
244 
245  // loop on sim hits
246 
247 
248  LogDebug("SimHitDetId") << "List of " << tp->numberOfTrackerHits() << " simhits detid from muon with p = " << tp->p()
249  << "and eta = " << tp->eta();
250 
251  }
252 
253 }
#define LogDebug(id)
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const_iterator find(const key_type &k) const
find element with specified reference key
edm::EDGetTokenT< TrackingParticleCollection > m_tpcollToken
edm::EDGetTokenT< edm::View< reco::Track > > m_trkcollToken
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > m_associatorToken
HLT enums.
void OverlapProblemTPAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 256 of file OverlapProblemTPAnalyzer.cc.

257 {
258 }
void OverlapProblemTPAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 261 of file OverlapProblemTPAnalyzer.cc.

References DEFINE_FWK_MODULE.

262 {
263 }

Member Data Documentation

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> OverlapProblemTPAnalyzer::m_associatorToken
private

Definition at line 88 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

std::vector<TH1F*> OverlapProblemTPAnalyzer::m_assosimhitytecr
private

Definition at line 83 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_etatp
private

Definition at line 73 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_llbit
private

Definition at line 79 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nassotk
private

Definition at line 77 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nhits
private

Definition at line 74 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nrechits
private

Definition at line 75 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH2F* OverlapProblemTPAnalyzer::m_nrecvssimhits
private

Definition at line 76 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_pdgid
private

Definition at line 78 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_ptp
private

Definition at line 72 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

std::vector<TH1F*> OverlapProblemTPAnalyzer::m_simhitytecr
private

Definition at line 82 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_statustp
private

Definition at line 80 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

edm::EDGetTokenT<TrackingParticleCollection> OverlapProblemTPAnalyzer::m_tpcollToken
private

Definition at line 86 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::View<reco::Track> > OverlapProblemTPAnalyzer::m_trkcollToken
private

Definition at line 87 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().