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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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

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

287 {
288 }
void OverlapProblemTPAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file OverlapProblemTPAnalyzer.cc.

292 {
293 }

Member Data Documentation

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

Definition at line 85 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_etatp
private

Definition at line 75 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_llbit
private

Definition at line 81 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nassotk
private

Definition at line 79 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nhits
private

Definition at line 76 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_nrechits
private

Definition at line 77 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH2F* OverlapProblemTPAnalyzer::m_nrecvssimhits
private

Definition at line 78 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_pdgid
private

Definition at line 80 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_ptp
private

Definition at line 74 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

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

Definition at line 84 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

TH1F* OverlapProblemTPAnalyzer::m_statustp
private

Definition at line 82 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

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

Definition at line 88 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

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

Definition at line 89 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().