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::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 OverlapProblemTPAnalyzer (const edm::ParameterSet &)
 
 ~OverlapProblemTPAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

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

Definition at line 58 of file OverlapProblemTPAnalyzer.cc.

Constructor & Destructor Documentation

◆ OverlapProblemTPAnalyzer()

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

Definition at line 99 of file OverlapProblemTPAnalyzer.cc.

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

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

◆ ~OverlapProblemTPAnalyzer()

OverlapProblemTPAnalyzer::~OverlapProblemTPAnalyzer ( )
override

Definition at line 140 of file OverlapProblemTPAnalyzer.cc.

140  {
141  // do anything here that needs to be done at desctruction time
142  // (e.g. close files, deallocate resources etc.)
143 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 150 of file OverlapProblemTPAnalyzer.cc.

References funct::abs(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), mps_fire::i, iEvent, 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, HI_PhotonSkim_cff::rechits, cmsswSequenceInfo::tp, and hltEgammaHLTExtra_cfi::trks.

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

◆ beginRun()

void OverlapProblemTPAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 235 of file OverlapProblemTPAnalyzer.cc.

235 {}

◆ endRun()

void OverlapProblemTPAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 237 of file OverlapProblemTPAnalyzer.cc.

237 {}

Member Data Documentation

◆ m_associatorToken

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

Definition at line 85 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

◆ m_assosimhitytecr

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

Definition at line 81 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

◆ m_etatp

TH1F* OverlapProblemTPAnalyzer::m_etatp
private

Definition at line 71 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_llbit

TH1F* OverlapProblemTPAnalyzer::m_llbit
private

Definition at line 77 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_nassotk

TH1F* OverlapProblemTPAnalyzer::m_nassotk
private

Definition at line 75 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_nhits

TH1F* OverlapProblemTPAnalyzer::m_nhits
private

Definition at line 72 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_nrechits

TH1F* OverlapProblemTPAnalyzer::m_nrechits
private

Definition at line 73 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_nrecvssimhits

TH2F* OverlapProblemTPAnalyzer::m_nrecvssimhits
private

Definition at line 74 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_pdgid

TH1F* OverlapProblemTPAnalyzer::m_pdgid
private

Definition at line 76 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_ptp

TH1F* OverlapProblemTPAnalyzer::m_ptp
private

Definition at line 70 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_simhitytecr

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

Definition at line 80 of file OverlapProblemTPAnalyzer.cc.

Referenced by OverlapProblemTPAnalyzer().

◆ m_statustp

TH1F* OverlapProblemTPAnalyzer::m_statustp
private

Definition at line 78 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze(), and OverlapProblemTPAnalyzer().

◆ m_tpcollToken

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

Definition at line 83 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().

◆ m_trkcollToken

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

Definition at line 84 of file OverlapProblemTPAnalyzer.cc.

Referenced by analyze().