CMS 3D CMS Logo

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

#include <TrackingTruthValid.h>

Inheritance diagram for TrackingTruthValid:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Types

typedef std::vector< TrackingParticleTrackingParticleCollection
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es) override
 
 TrackingTruthValid (const edm::ParameterSet &conf)
 
 ~TrackingTruthValid () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

DQMStoredbe_
 
MonitorElementmeTPAllHits
 
MonitorElementmeTPCharge
 
MonitorElementmeTPEta
 
MonitorElementmeTPId
 
MonitorElementmeTPlip
 
MonitorElementmeTPMass
 
MonitorElementmeTPMatchedHits
 
MonitorElementmeTPPhi
 
MonitorElementmeTPProc
 
MonitorElementmeTPPt
 
MonitorElementmeTPtip
 
MonitorElementmeTPVtxX
 
MonitorElementmeTPVtxY
 
MonitorElementmeTPVtxZ
 
std::string outputFile
 
bool runStandalone
 
edm::EDGetTokenT< TrackingParticleCollectionvec_TrackingParticle_Token_
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 14 of file TrackingTruthValid.h.

Member Typedef Documentation

◆ TrackingParticleCollection

Definition at line 16 of file TrackingTruthValid.h.

Constructor & Destructor Documentation

◆ TrackingTruthValid()

TrackingTruthValid::TrackingTruthValid ( const edm::ParameterSet conf)
explicit

Definition at line 29 of file TrackingTruthValid.cc.

30  : runStandalone(conf.getParameter<bool>("runStandalone")),
31  outputFile(conf.getParameter<std::string>("outputFile")),
32  dbe_(nullptr),
33  vec_TrackingParticle_Token_(consumes<TrackingParticleCollection>(conf.getParameter<edm::InputTag>("src"))) {}

◆ ~TrackingTruthValid()

TrackingTruthValid::~TrackingTruthValid ( )
inlineoverride

Definition at line 20 of file TrackingTruthValid.h.

20 {};

Member Function Documentation

◆ analyze()

void TrackingTruthValid::analyze ( const edm::Event event,
const edm::EventSetup c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 77 of file TrackingTruthValid.cc.

77  {
78  edm::Handle<TrackingParticleCollection> TruthTrackContainer;
79  // edm::Handle<TrackingVertexCollection> TruthVertexContainer;
80 
81  event.getByToken(vec_TrackingParticle_Token_, TruthTrackContainer);
82 
83  const TrackingParticleCollection *tPC = TruthTrackContainer.product();
84 
85  // Loop over TrackingParticle's
86  for (TrackingParticleCollection::const_iterator t = tPC->begin(); t != tPC->end(); ++t) {
87  // if(t -> trackerPSimHit().size() ==0) cout << " Track with 0 SimHit " <<
88  // endl;
89 
90  meTPMass->Fill(t->mass());
91  meTPCharge->Fill(t->charge());
92  meTPId->Fill(t->pdgId());
93  meTPPt->Fill(sqrt(t->momentum().perp2()));
94  meTPEta->Fill(t->momentum().eta());
95  meTPPhi->Fill(t->momentum().Phi());
96  //#warning "This file has been modified just to get it to compile without
97  // any regard as to whether it still functions as intended" #ifdef
98  // REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
99  // std::vector<PSimHit> trackerPSimHit( t->trackPSimHit(DetId::Tracker)
100  // );
101  //#endif
102  meTPAllHits->Fill(t->numberOfTrackerHits());
103  // get the process of the first hit
104  //#warning "This file has been modified just to get it to compile without
105  // any regard as to whether it still functions as intended" #ifdef
106  // REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
107  // if(trackerPSimHit.size() !=0) meTPProc->Fill(
108  // trackerPSimHit.front().processType());
109  //#endif
110 
111  // there is no more the PSimHits collection !!! how to deal w/ the
112  // processType ?
113  // if(t->numberOfTrackerHits() !=0) meTPProc->Fill(
114  // trackerPSimHit.front().processType());
115 
116  meTPMatchedHits->Fill(t->numberOfTrackerLayers());
117  meTPVtxX->Fill(t->vx());
118  meTPVtxY->Fill(t->vy());
119  meTPVtxZ->Fill(t->vz());
120  meTPtip->Fill(sqrt(t->vertex().perp2()));
121  meTPlip->Fill(t->vz());
122 
123  /*
124  // Compare momenta from sources
125  cout << "T.P. Track mass, Momentum, q , ID, & Event # "
126  << t -> mass() << " "
127  << t -> p4() << " " << t -> charge() << " "
128  << t -> pdgId() << " "
129  << t -> eventId().bunchCrossing() << "." << t -> eventId().event() <<
130  endl;
131 
132  if(t->mass() < 0) cout << "======= WARNING, this particle has negative mass: "
133  << t->mass()
134  << " and pdgId: " << t->pdgId() << endl;
135  if(t->pdgId() == 0) cout << "======= WARNING, this particle has pdgId = 0: "
136  << t->pdgId() << endl; cout << " Hits for this track: " << t ->
137  trackerPSimHit().size() << endl;
138  */
139 
140  /*
141  std::cout << std::endl << "### Tracking Particle ###" << std::endl;
142  std::cout << (*t) << std::endl;
143  std::cout << "\t Tracker: " << t->trackerPSimHit().size() << std::endl;
144  std::cout << "\t Muon: " << t->muonPSimHit().size() << std::endl;
145  std::cout << (*t) << std::endl;
146  */
147  } // End loop over TrackingParticle
148 
149  // Loop over TrackingVertex's
150  /*
151  cout << "Dumping sample vertex info" << endl;
152  for (TrackingVertexCollection::const_iterator v = tVC -> begin(); v != tVC ->
153  end(); ++v) { cout << " Vertex Position & Event #" << v -> position() << " "
154  << v -> eventId().bunchCrossing() << "." << v -> eventId().event() << endl;
155  cout << " Associated with " << v -> daughterTracks().size() << " tracks" <<
156  endl;
157  // Get Geant and HepMC positions
158  for (genv_iterator genV = v -> genVertices_begin(); genV != v ->
159  genVertices_end(); ++genV) { cout << " HepMC vertex position " <<
160  (*(*genV)).position() << endl;
161  }
162  for (g4v_iterator g4V = v -> g4Vertices_begin(); g4V != v ->
163  g4Vertices_end(); ++g4V) { cout << " Geant vertex position " <<
164  (*g4V).position() << endl;
165  // Probably empty all the time, currently
166  }
167 
168  // Loop over daughter track(s)
169  for (tp_iterator iTP = v -> daughterTracks_begin(); iTP != v ->
170  daughterTracks_end(); ++iTP) { cout << " Daughter starts: " <<
171  (*(*iTP)).vertex(); for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T !=
172  (*(*iTP)).g4Track_end(); ++g4T) { cout << " p " << g4T->momentum();
173  }
174  cout << endl;
175  }
176 
177  // Loop over source track(s) (can be multiple since vertices are collapsed)
178  for (tp_iterator iTP = v -> sourceTracks_begin(); iTP != v ->
179  sourceTracks_end(); ++iTP) { cout << " Source starts: " <<
180  (*(*iTP)).vertex(); for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T !=
181  (*iTP)->g4Track_end(); ++g4T) { cout << ", p " << g4T ->momentum();
182  }
183  cout << endl;
184  }
185  } // End loop over TrackingVertex
186  */
187 }

References dqm::impl::MonitorElement::Fill(), meTPAllHits, meTPCharge, meTPEta, meTPId, meTPlip, meTPMass, meTPMatchedHits, meTPPhi, meTPPt, meTPtip, meTPVtxX, meTPVtxY, meTPVtxZ, edm::Handle< T >::product(), mathSSE::sqrt(), submitPVValidationJobs::t, and vec_TrackingParticle_Token_.

◆ bookHistograms()

void TrackingTruthValid::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 35 of file TrackingTruthValid.cc.

35  {
36  dbe_ = edm::Service<DQMStore>().operator->();
37  ibooker.setCurrentFolder("Tracking/TrackingMCTruth/TrackingParticle");
38 
39  meTPMass = ibooker.book1D("TPMass", "Tracking Particle Mass", 100, -1, +5.);
40  meTPCharge = ibooker.book1D("TPCharge", "Tracking Particle Charge", 10, -5, 5);
41  meTPId = ibooker.book1D("TPId", "Tracking Particle Id", 500, -5000, 5000);
42  meTPProc = ibooker.book1D("TPProc", "Tracking Particle Proc", 20, -0.5, 19.5);
43  meTPAllHits = ibooker.book1D("TPAllHits", "Tracking Particle All Hits", 200, -0.5, 199.5);
44  meTPMatchedHits = ibooker.book1D("TPMatchedHits", "Tracking Particle Matched Hits", 100, -0.5, 99.5);
45  meTPPt = ibooker.book1D("TPPt", "Tracking Particle Pt", 100, 0, 100.);
46  meTPEta = ibooker.book1D("TPEta", "Tracking Particle Eta", 100, -7., 7.);
47  meTPPhi = ibooker.book1D("TPPhi", "Tracking Particle Phi", 100, -4., 4);
48  meTPVtxX = ibooker.book1D("TPVtxX", "Tracking Particle VtxX", 100, -100, 100.);
49  meTPVtxY = ibooker.book1D("TPVtxY", "Tracking Particle VtxY", 100, -100, 100.);
50  meTPVtxZ = ibooker.book1D("TPVtxZ", "Tracking Particle VtxZ", 100, -100, 100.);
51  meTPtip = ibooker.book1D("TPtip", "Tracking Particle tip", 100, 0, 1000.);
52  meTPlip = ibooker.book1D("TPlip", "Tracking Particle lip", 100, 0, 100.);
53 
54  // Prepare Axes Labels for Processes
55  meTPProc->setBinLabel(1, "Undefined"); // value = 0
56  meTPProc->setBinLabel(2, "Unknown"); // value = 1
57  meTPProc->setBinLabel(3, "Primary"); // value = 2
58  meTPProc->setBinLabel(4, "Hadronic"); // value = 3
59  meTPProc->setBinLabel(5, "Decay"); // value = 4
60  meTPProc->setBinLabel(6, "Compton"); // value = 5
61  meTPProc->setBinLabel(7, "Annihilation"); // value = 6
62  meTPProc->setBinLabel(8, "EIoni"); // value = 7
63  meTPProc->setBinLabel(9, "HIoni"); // value = 8
64  meTPProc->setBinLabel(10, "MuIoni"); // value = 9
65  meTPProc->setBinLabel(11, "Photon"); // value = 10
66  meTPProc->setBinLabel(12, "MuPairProd"); // value = 11
67  meTPProc->setBinLabel(13, "Conversions"); // value = 12
68  meTPProc->setBinLabel(14, "EBrem"); // value = 13
69  meTPProc->setBinLabel(15, "SynchrotronRadiation"); // value = 14
70  meTPProc->setBinLabel(16, "MuBrem"); // value = 15
71  meTPProc->setBinLabel(17, "MuNucl"); // value = 16
72  meTPProc->setBinLabel(18, "");
73  meTPProc->setBinLabel(19, "");
74  meTPProc->setBinLabel(20, "");
75 }

References dqm::implementation::IBooker::book1D(), dbe_, meTPAllHits, meTPCharge, meTPEta, meTPId, meTPlip, meTPMass, meTPMatchedHits, meTPPhi, meTPProc, meTPPt, meTPtip, meTPVtxX, meTPVtxY, meTPVtxZ, dqm::impl::MonitorElement::setBinLabel(), and dqm::implementation::NavigatorBase::setCurrentFolder().

Member Data Documentation

◆ dbe_

DQMStore* TrackingTruthValid::dbe_
private

Definition at line 30 of file TrackingTruthValid.h.

Referenced by bookHistograms().

◆ meTPAllHits

MonitorElement* TrackingTruthValid::meTPAllHits
private

Definition at line 35 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPCharge

MonitorElement* TrackingTruthValid::meTPCharge
private

Definition at line 32 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPEta

MonitorElement* TrackingTruthValid::meTPEta
private

Definition at line 38 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPId

MonitorElement* TrackingTruthValid::meTPId
private

Definition at line 33 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPlip

MonitorElement* TrackingTruthValid::meTPlip
private

Definition at line 44 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPMass

MonitorElement* TrackingTruthValid::meTPMass
private

Definition at line 31 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPMatchedHits

MonitorElement* TrackingTruthValid::meTPMatchedHits
private

Definition at line 36 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPPhi

MonitorElement* TrackingTruthValid::meTPPhi
private

Definition at line 39 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPProc

MonitorElement* TrackingTruthValid::meTPProc
private

Definition at line 34 of file TrackingTruthValid.h.

Referenced by bookHistograms().

◆ meTPPt

MonitorElement* TrackingTruthValid::meTPPt
private

Definition at line 37 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPtip

MonitorElement* TrackingTruthValid::meTPtip
private

Definition at line 43 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxX

MonitorElement* TrackingTruthValid::meTPVtxX
private

Definition at line 40 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxY

MonitorElement* TrackingTruthValid::meTPVtxY
private

Definition at line 41 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxZ

MonitorElement* TrackingTruthValid::meTPVtxZ
private

Definition at line 42 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ outputFile

std::string TrackingTruthValid::outputFile
private

Definition at line 28 of file TrackingTruthValid.h.

◆ runStandalone

bool TrackingTruthValid::runStandalone
private

Definition at line 27 of file TrackingTruthValid.h.

◆ vec_TrackingParticle_Token_

edm::EDGetTokenT<TrackingParticleCollection> TrackingTruthValid::vec_TrackingParticle_Token_
private

Definition at line 46 of file TrackingTruthValid.h.

Referenced by analyze().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
TrackingTruthValid::meTPAllHits
MonitorElement * meTPAllHits
Definition: TrackingTruthValid.h:35
TrackingTruthValid::meTPMass
MonitorElement * meTPMass
Definition: TrackingTruthValid.h:31
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
TrackingTruthValid::vec_TrackingParticle_Token_
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
Definition: TrackingTruthValid.h:46
edm::Handle< TrackingParticleCollection >
TrackingTruthValid::outputFile
std::string outputFile
Definition: TrackingTruthValid.h:28
TrackingTruthValid::meTPProc
MonitorElement * meTPProc
Definition: TrackingTruthValid.h:34
TrackingTruthValid::meTPlip
MonitorElement * meTPlip
Definition: TrackingTruthValid.h:44
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackingTruthValid::meTPEta
MonitorElement * meTPEta
Definition: TrackingTruthValid.h:38
edm::Service
Definition: Service.h:30
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
TrackingTruthValid::dbe_
DQMStore * dbe_
Definition: TrackingTruthValid.h:30
TrackingTruthValid::meTPPhi
MonitorElement * meTPPhi
Definition: TrackingTruthValid.h:39
TrackingTruthValid::meTPCharge
MonitorElement * meTPCharge
Definition: TrackingTruthValid.h:32
TrackingTruthValid::meTPId
MonitorElement * meTPId
Definition: TrackingTruthValid.h:33
TrackingTruthValid::runStandalone
bool runStandalone
Definition: TrackingTruthValid.h:27
TrackingTruthValid::meTPMatchedHits
MonitorElement * meTPMatchedHits
Definition: TrackingTruthValid.h:36
TrackingTruthValid::meTPVtxY
MonitorElement * meTPVtxY
Definition: TrackingTruthValid.h:41
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:9
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackingTruthValid::meTPPt
MonitorElement * meTPPt
Definition: TrackingTruthValid.h:37
TrackingTruthValid::meTPVtxX
MonitorElement * meTPVtxX
Definition: TrackingTruthValid.h:40
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TrackingTruthValid::meTPVtxZ
MonitorElement * meTPVtxZ
Definition: TrackingTruthValid.h:42
TrackingTruthValid::meTPtip
MonitorElement * meTPtip
Definition: TrackingTruthValid.h:43
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98