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 >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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 13 of file TrackingTruthValid.h.

Member Typedef Documentation

◆ TrackingParticleCollection

Definition at line 15 of file TrackingTruthValid.h.

Constructor & Destructor Documentation

◆ TrackingTruthValid()

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

Definition at line 24 of file TrackingTruthValid.cc.

25  : runStandalone(conf.getParameter<bool>("runStandalone")),
26  outputFile(conf.getParameter<std::string>("outputFile")),
27  dbe_(nullptr),
28  vec_TrackingParticle_Token_(consumes<TrackingParticleCollection>(conf.getParameter<edm::InputTag>("src"))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_

◆ ~TrackingTruthValid()

TrackingTruthValid::~TrackingTruthValid ( )
inlineoverride

Definition at line 19 of file TrackingTruthValid.h.

19 {};

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 72 of file TrackingTruthValid.cc.

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_.

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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 30 of file TrackingTruthValid.cc.

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

30  {
32  ibooker.setCurrentFolder("Tracking/TrackingMCTruth/TrackingParticle");
33 
34  meTPMass = ibooker.book1D("TPMass", "Tracking Particle Mass", 100, -1, +5.);
35  meTPCharge = ibooker.book1D("TPCharge", "Tracking Particle Charge", 10, -5, 5);
36  meTPId = ibooker.book1D("TPId", "Tracking Particle Id", 500, -5000, 5000);
37  meTPProc = ibooker.book1D("TPProc", "Tracking Particle Proc", 20, -0.5, 19.5);
38  meTPAllHits = ibooker.book1D("TPAllHits", "Tracking Particle All Hits", 200, -0.5, 199.5);
39  meTPMatchedHits = ibooker.book1D("TPMatchedHits", "Tracking Particle Matched Hits", 100, -0.5, 99.5);
40  meTPPt = ibooker.book1D("TPPt", "Tracking Particle Pt", 100, 0, 100.);
41  meTPEta = ibooker.book1D("TPEta", "Tracking Particle Eta", 100, -7., 7.);
42  meTPPhi = ibooker.book1D("TPPhi", "Tracking Particle Phi", 100, -4., 4);
43  meTPVtxX = ibooker.book1D("TPVtxX", "Tracking Particle VtxX", 100, -100, 100.);
44  meTPVtxY = ibooker.book1D("TPVtxY", "Tracking Particle VtxY", 100, -100, 100.);
45  meTPVtxZ = ibooker.book1D("TPVtxZ", "Tracking Particle VtxZ", 100, -100, 100.);
46  meTPtip = ibooker.book1D("TPtip", "Tracking Particle tip", 100, 0, 1000.);
47  meTPlip = ibooker.book1D("TPlip", "Tracking Particle lip", 100, 0, 100.);
48 
49  // Prepare Axes Labels for Processes
50  meTPProc->setBinLabel(1, "Undefined"); // value = 0
51  meTPProc->setBinLabel(2, "Unknown"); // value = 1
52  meTPProc->setBinLabel(3, "Primary"); // value = 2
53  meTPProc->setBinLabel(4, "Hadronic"); // value = 3
54  meTPProc->setBinLabel(5, "Decay"); // value = 4
55  meTPProc->setBinLabel(6, "Compton"); // value = 5
56  meTPProc->setBinLabel(7, "Annihilation"); // value = 6
57  meTPProc->setBinLabel(8, "EIoni"); // value = 7
58  meTPProc->setBinLabel(9, "HIoni"); // value = 8
59  meTPProc->setBinLabel(10, "MuIoni"); // value = 9
60  meTPProc->setBinLabel(11, "Photon"); // value = 10
61  meTPProc->setBinLabel(12, "MuPairProd"); // value = 11
62  meTPProc->setBinLabel(13, "Conversions"); // value = 12
63  meTPProc->setBinLabel(14, "EBrem"); // value = 13
64  meTPProc->setBinLabel(15, "SynchrotronRadiation"); // value = 14
65  meTPProc->setBinLabel(16, "MuBrem"); // value = 15
66  meTPProc->setBinLabel(17, "MuNucl"); // value = 16
67  meTPProc->setBinLabel(18, "");
68  meTPProc->setBinLabel(19, "");
69  meTPProc->setBinLabel(20, "");
70 }
MonitorElement * meTPAllHits
MonitorElement * meTPVtxX
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * meTPtip
MonitorElement * meTPPhi
MonitorElement * meTPVtxZ
MonitorElement * meTPVtxY
MonitorElement * meTPEta
MonitorElement * meTPProc
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)
MonitorElement * meTPMatchedHits
MonitorElement * meTPCharge
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * meTPMass
MonitorElement * meTPlip
MonitorElement * meTPPt
MonitorElement * meTPId

Member Data Documentation

◆ dbe_

DQMStore* TrackingTruthValid::dbe_
private

Definition at line 29 of file TrackingTruthValid.h.

Referenced by bookHistograms().

◆ meTPAllHits

MonitorElement* TrackingTruthValid::meTPAllHits
private

Definition at line 34 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPCharge

MonitorElement* TrackingTruthValid::meTPCharge
private

Definition at line 31 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPEta

MonitorElement* TrackingTruthValid::meTPEta
private

Definition at line 37 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPId

MonitorElement* TrackingTruthValid::meTPId
private

Definition at line 32 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPlip

MonitorElement* TrackingTruthValid::meTPlip
private

Definition at line 43 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPMass

MonitorElement* TrackingTruthValid::meTPMass
private

Definition at line 30 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPMatchedHits

MonitorElement* TrackingTruthValid::meTPMatchedHits
private

Definition at line 35 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPPhi

MonitorElement* TrackingTruthValid::meTPPhi
private

Definition at line 38 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPProc

MonitorElement* TrackingTruthValid::meTPProc
private

Definition at line 33 of file TrackingTruthValid.h.

Referenced by bookHistograms().

◆ meTPPt

MonitorElement* TrackingTruthValid::meTPPt
private

Definition at line 36 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPtip

MonitorElement* TrackingTruthValid::meTPtip
private

Definition at line 42 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxX

MonitorElement* TrackingTruthValid::meTPVtxX
private

Definition at line 39 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxY

MonitorElement* TrackingTruthValid::meTPVtxY
private

Definition at line 40 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ meTPVtxZ

MonitorElement* TrackingTruthValid::meTPVtxZ
private

Definition at line 41 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

◆ outputFile

std::string TrackingTruthValid::outputFile
private

Definition at line 27 of file TrackingTruthValid.h.

◆ runStandalone

bool TrackingTruthValid::runStandalone
private

Definition at line 26 of file TrackingTruthValid.h.

◆ vec_TrackingParticle_Token_

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

Definition at line 45 of file TrackingTruthValid.h.

Referenced by analyze().