CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< reco::TrackToTrackingParticleAssociator
m_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
< TrackingParticleCollection
m_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 &)
 
- 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 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 61 of file OverlapProblemTPAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 103 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(), mergeVDriftHistosByStation::name, relativeConstraints::ring, and indexGen::title.

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

Definition at line 147 of file OverlapProblemTPAnalyzer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 162 of file OverlapProblemTPAnalyzer.cc.

References funct::abs(), edm::Event::getByToken(), i, cmsHarvester::index, 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 HI_PhotonSkim_cff::rechits.

163 {
164  using namespace edm;
165 
166  // reco track Handle
167 
168  // Handle<reco::TrackCollection> trkcoll;
170  iEvent.getByToken(m_trkcollToken,trkcoll);
171 
173  iEvent.getByToken(m_tpcollToken,tpcoll);
174 
176  iEvent.getByToken(m_associatorToken,tahandle);
177 
178  // associate reco to sim tracks
179 
180  reco::SimToRecoCollection srcoll = tahandle->associateSimToReco(trkcoll,tpcoll);
181 
182  // loop on Handle with index and use find
183 
184  for(unsigned int index=0 ; index != tpcoll->size() ; ++index) {
185 
186  // get TrackingParticleRef
187 
188  const TrackingParticleRef tp(tpcoll,index);
189 
190  if(std::abs(tp->pdgId())!=13) continue;
191 
192  // get the SimHIt from tracker only
193 
194  // Commented since the new TP's do not have this method
195  // std::vector<PSimHit> tksimhits = tp->trackPSimHit(DetId::Tracker);
196 
197 
198  m_ptp->Fill(tp->p());
199  m_etatp->Fill(tp->eta());
200  // m_nhits->Fill(tp->matchedHit());
201  // With the new Tracking Particles I have to use a different method
202  // m_nhits->Fill(tksimhits.size());
203  m_nhits->Fill(tp->numberOfTrackerHits());
204 
205 
206  m_pdgid->Fill(tp->pdgId());
207  m_llbit->Fill(tp->longLived());
208  m_statustp->Fill(tp->status());
209 
210  // prepare a vector of TrackingRecHit from the associated reco tracks
211 
212  std::vector<DetId> rechits;
213 
214  // look at associated tracks
215 
216  if(srcoll.find(tp) != srcoll.end()) {
217  reco::SimToRecoCollection::result_type trks = srcoll[tp];
218  m_nassotk->Fill(trks.size());
219 
220  // loop on associated tracks and fill TrackingRecHit vector
221  for(reco::SimToRecoCollection::result_type::const_iterator trk = trks.begin();trk!=trks.end();++trk) {
222  for(trackingRecHit_iterator rh = trk->first->recHitsBegin() ; rh!=trk->first->recHitsEnd() ; ++rh) {
223  rechits.push_back((*rh)->geographicalId());
224  }
225 
226  }
227 
228  }
229  else {
230  m_nassotk->Fill(0.);
231  edm::LogInfo("NoAssociatedRecoTrack") << "No associated reco track for TP with p = " << tp->p()
232  << " and eta = " << tp->eta() ;
233  }
234 
235  m_nrechits->Fill(rechits.size());
236  // new method used to be compliant with the new TP's
237  m_nrecvssimhits->Fill(tp->numberOfTrackerHits(),rechits.size());
238 
239  LogDebug("RecHitDetId") << "List of " << rechits.size() << " rechits detid from muon with p = " << tp->p()
240  << "and eta = " << tp->eta();
241  for(unsigned int i=0;i<rechits.size();++i) {
242  LogTrace("RecHitDetId") << rechits[i].rawId();
243  }
244 
245 
246  // loop on sim hits
247 
248 
249  LogDebug("SimHitDetId") << "List of " << tp->numberOfTrackerHits() << " simhits detid from muon with p = " << tp->p()
250  << "and eta = " << tp->eta();
251 
252  // commented since with the new TP's I don't know how to loop on PSimHits
253 
254  /*
255  for( std::vector<PSimHit>::const_iterator sh = tksimhits.begin(); sh!= tksimhits.end(); ++sh) {
256 
257  // check if the SimHit is Tracker and TEC
258 
259  LogTrace("SimHitDetId") << sh->detUnitId();
260 
261  TECDetId det(sh->detUnitId());
262  if(det.subDetector() == SiStripDetId::TEC) {
263 
264  unsigned int iring = det.ring() - 1;
265  m_simhitytecr[iring]->Fill(sh->entryPoint().y());
266 
267  // check if there is a TrackingRecHit in the same detid and if this is the case fill the histos
268 
269  for(std::vector<DetId>::const_iterator rhdet = rechits.begin(); rhdet!= rechits.end() ; ++rhdet) {
270  if(det==*rhdet) {
271  m_assosimhitytecr[iring]->Fill(sh->entryPoint().y());
272  break;
273  }
274  }
275 
276  }
277  }
278  */
279  }
280 
281 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
void OverlapProblemTPAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 284 of file OverlapProblemTPAnalyzer.cc.

285 {
286 }
void OverlapProblemTPAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 289 of file OverlapProblemTPAnalyzer.cc.

290 {
291 }

Member Data Documentation

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

Definition at line 89 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

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

Definition at line 84 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_etatp
private

Definition at line 74 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_llbit
private

Definition at line 80 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nassotk
private

Definition at line 78 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nhits
private

Definition at line 75 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nrechits
private

Definition at line 76 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH2F* OverlapProblemTPAnalyzer::m_nrecvssimhits
private

Definition at line 77 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_pdgid
private

Definition at line 79 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_ptp
private

Definition at line 73 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

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

Definition at line 83 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_statustp
private

Definition at line 81 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

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

Definition at line 87 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

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

Definition at line 88 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().