test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
TrackingTruthValid Class Reference

#include <TrackingTruthValid.h>

Inheritance diagram for TrackingTruthValid:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Types

typedef std::vector
< TrackingParticle
TrackingParticleCollection
 
- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob (const edm::ParameterSet &conf)
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es)
 
void endJob ()
 
 TrackingTruthValid (const edm::ParameterSet &conf)
 
 ~TrackingTruthValid ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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 Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 15 of file TrackingTruthValid.h.

Member Typedef Documentation

Definition at line 17 of file TrackingTruthValid.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file TrackingTruthValid.cc.

35  : runStandalone( conf.getParameter<bool>("runStandalone") )
36  , outputFile( conf.getParameter<std::string>( "outputFile" ) )
37  , dbe_( NULL )
38  , vec_TrackingParticle_Token_( consumes<TrackingParticleCollection>( conf.getParameter<edm::InputTag>( "src" ) ) ) {}
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
TrackingTruthValid::~TrackingTruthValid ( )
inline

Definition at line 21 of file TrackingTruthValid.h.

21 {} ;

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 84 of file TrackingTruthValid.cc.

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

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

Definition at line 32 of file TrackingTruthValid.cc.

32 {}
void TrackingTruthValid::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup es 
)
virtual

Implements DQMEDAnalyzer.

Definition at line 40 of file TrackingTruthValid.cc.

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

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

Definition at line 185 of file TrackingTruthValid.cc.

References dbe_, outputFile, runStandalone, and DQMStore::save().

185  {
186  //Only in standalone mode save local root file
187  if (runStandalone && outputFile.size() != 0 && dbe_ ){dbe_->save(outputFile);}
188 
189 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540

Member Data Documentation

DQMStore* TrackingTruthValid::dbe_
private

Definition at line 33 of file TrackingTruthValid.h.

Referenced by bookHistograms(), and endJob().

MonitorElement* TrackingTruthValid::meTPAllHits
private

Definition at line 38 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPCharge
private

Definition at line 35 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPEta
private

Definition at line 41 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPId
private

Definition at line 36 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPlip
private

Definition at line 47 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPMass
private

Definition at line 34 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPMatchedHits
private

Definition at line 39 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPPhi
private

Definition at line 42 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPProc
private

Definition at line 37 of file TrackingTruthValid.h.

Referenced by bookHistograms().

MonitorElement* TrackingTruthValid::meTPPt
private

Definition at line 40 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPtip
private

Definition at line 46 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPVtxX
private

Definition at line 43 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPVtxY
private

Definition at line 44 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TrackingTruthValid::meTPVtxZ
private

Definition at line 45 of file TrackingTruthValid.h.

Referenced by analyze(), and bookHistograms().

std::string TrackingTruthValid::outputFile
private

Definition at line 31 of file TrackingTruthValid.h.

Referenced by endJob().

bool TrackingTruthValid::runStandalone
private

Definition at line 30 of file TrackingTruthValid.h.

Referenced by endJob().

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

Definition at line 49 of file TrackingTruthValid.h.

Referenced by analyze().