CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
muonAssociatorByHitsDiagnostics::InputDumper Class Reference

Public Member Functions

void dump (const TrackHitsCollection &, const TrackingParticleCollection &, const edm::Event &) const
 
 InputDumper (const edm::ParameterSet &conf)
 
 InputDumper (const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
 

Private Attributes

bool const crossingframe
 
edm::InputTag const simtracksTag
 
edm::EDGetTokenT< edm::SimTrackContainersimtracksToken_
 
edm::InputTag const simtracksXFTag
 
edm::EDGetTokenT< CrossingFrame< SimTrack > > simtracksXFToken_
 
edm::EDGetTokenT< edm::SimVertexContainersimvertexToken_
 
edm::EDGetTokenT< CrossingFrame< SimVertex > > simvertexXFToken_
 

Detailed Description

Definition at line 25 of file MuonAssociatorByHits.cc.

Constructor & Destructor Documentation

◆ InputDumper() [1/2]

muonAssociatorByHitsDiagnostics::InputDumper::InputDumper ( const edm::ParameterSet conf)
inline

Definition at line 27 of file MuonAssociatorByHits.cc.

28  : simtracksTag(conf.getParameter<edm::InputTag>("simtracksTag")),
29  simtracksXFTag(conf.getParameter<edm::InputTag>("simtracksXFTag")),
30  crossingframe(conf.getParameter<bool>("crossingframe")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ InputDumper() [2/2]

muonAssociatorByHitsDiagnostics::InputDumper::InputDumper ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 32 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHits_cfi::crossingframe, MuonAssociatorByHits_cfi::simtracksTag, and MuonAssociatorByHits_cfi::simtracksXFTag.

32  : InputDumper(conf) {
33  if (crossingframe) {
36  } else {
39  }
40  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CrossingFrame< SimVertex > > simvertexXFToken_
std::vector< SimVertex > SimVertexContainer
edm::EDGetTokenT< edm::SimTrackContainer > simtracksToken_
edm::EDGetTokenT< edm::SimVertexContainer > simvertexToken_
std::vector< SimTrack > SimTrackContainer
edm::EDGetTokenT< CrossingFrame< SimTrack > > simtracksXFToken_

Member Function Documentation

◆ dump()

void muonAssociatorByHitsDiagnostics::InputDumper::dump ( const TrackHitsCollection tC,
const TrackingParticleCollection tPC,
const edm::Event event 
) const

Definition at line 54 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHits_cfi::crossingframe, dqmiolumiharvest::j, dqmdumpme::k, caloTruthProducer_cfi::simTrackCollection, MuonAssociatorByHits_cfi::simtracksTag, MuonAssociatorByHits_cfi::simtracksXFTag, and caloTruthProducer_cfi::simVertexCollection.

56  {
57  // reco::Track collection
58  edm::LogVerbatim("MuonAssociatorByHits") << "\n"
59  << "reco::Track collection --- size = " << tC.size();
60 
61  // TrackingParticle collection
62  edm::LogVerbatim("MuonAssociatorByHits") << "\n"
63  << "TrackingParticle collection --- size = " << tPC.size();
64  int j = 0;
65  for (TrackingParticleCollection::const_iterator ITER = tPC.begin(); ITER != tPC.end(); ITER++, j++) {
66  edm::LogVerbatim("MuonAssociatorByHits")
67  << "TrackingParticle " << j << ", q = " << ITER->charge() << ", p = " << ITER->p() << ", pT = " << ITER->pt()
68  << ", eta = " << ITER->eta() << ", phi = " << ITER->phi();
69 
70  edm::LogVerbatim("MuonAssociatorByHits")
71  << "\t pdg code = " << ITER->pdgId() << ", made of " << ITER->numberOfHits() << " PSimHit"
72  << " (in " << ITER->numberOfTrackerLayers() << " layers)"
73  << " from " << ITER->g4Tracks().size() << " SimTrack:";
74  for (TrackingParticle::g4t_iterator g4T = ITER->g4Track_begin(); g4T != ITER->g4Track_end(); g4T++) {
75  edm::LogVerbatim("MuonAssociatorByHits") << "\t\t Id:" << g4T->trackId() << "/Evt:(" << g4T->eventId().event()
76  << "," << g4T->eventId().bunchCrossing() << ")";
77  }
78  }
79 
80  if (crossingframe) {
81  const auto &cf_simtracks = event.getHandle(simtracksXFToken_);
82  unique_ptr<MixCollection<SimTrack>> SimTk(new MixCollection<SimTrack>(cf_simtracks.product()));
83  edm::LogVerbatim("MuonAssociatorByHits")
84  << "\n"
85  << "CrossingFrame<SimTrack> collection with InputTag = " << simtracksXFTag << " has size = " << SimTk->size();
86  int k = 0;
87  for (MixCollection<SimTrack>::MixItr ITER = SimTk->begin(); ITER != SimTk->end(); ITER++, k++) {
88  edm::LogVerbatim("MuonAssociatorByHits")
89  << "SimTrack " << k << " - Id:" << ITER->trackId() << "/Evt:(" << ITER->eventId().event() << ","
90  << ITER->eventId().bunchCrossing() << ")"
91  << " pdgId = " << ITER->type() << ", q = " << ITER->charge() << ", p = " << ITER->momentum().P()
92  << ", pT = " << ITER->momentum().Pt() << ", eta = " << ITER->momentum().Eta()
93  << ", phi = " << ITER->momentum().Phi() << "\n * " << *ITER << endl;
94  }
95  const auto &cf_simvertices = event.getHandle(simvertexXFToken_);
96  unique_ptr<MixCollection<SimVertex>> SimVtx(new MixCollection<SimVertex>(cf_simvertices.product()));
97  edm::LogVerbatim("MuonAssociatorByHits")
98  << "\n"
99  << "CrossingFrame<SimVertex> collection with InputTag = " << simtracksXFTag
100  << " has size = " << SimVtx->size();
101  int kv = 0;
102  for (MixCollection<SimVertex>::MixItr VITER = SimVtx->begin(); VITER != SimVtx->end(); VITER++, kv++) {
103  edm::LogVerbatim("MuonAssociatorByHits") << "SimVertex " << kv << " : " << *VITER << endl;
104  }
105  } else {
106  const auto &simTrackCollection = event.getHandle(simtracksToken_);
107  const edm::SimTrackContainer simTC = *(simTrackCollection.product());
108  edm::LogVerbatim("MuonAssociatorByHits")
109  << "\n"
110  << "SimTrack collection with InputTag = " << simtracksTag << " has size = " << simTC.size() << endl;
111  int k = 0;
112  for (edm::SimTrackContainer::const_iterator ITER = simTC.begin(); ITER != simTC.end(); ITER++, k++) {
113  edm::LogVerbatim("MuonAssociatorByHits")
114  << "SimTrack " << k << " - Id:" << ITER->trackId() << "/Evt:(" << ITER->eventId().event() << ","
115  << ITER->eventId().bunchCrossing() << ")"
116  << " pdgId = " << ITER->type() << ", q = " << ITER->charge() << ", p = " << ITER->momentum().P()
117  << ", pT = " << ITER->momentum().Pt() << ", eta = " << ITER->momentum().Eta()
118  << ", phi = " << ITER->momentum().Phi() << "\n * " << *ITER << endl;
119  }
120  const auto &simVertexCollection = event.getHandle(simvertexToken_);
121  const edm::SimVertexContainer simVC = *(simVertexCollection.product());
122  edm::LogVerbatim("MuonAssociatorByHits") << "\n"
123  << "SimVertex collection with InputTag = "
124  << "g4SimHits"
125  << " has size = " << simVC.size() << endl;
126  int kv = 0;
127  for (edm::SimVertexContainer::const_iterator VITER = simVC.begin(); VITER != simVC.end(); VITER++, kv++) {
128  edm::LogVerbatim("MuonAssociatorByHits") << "SimVertex " << kv << " : " << *VITER << endl;
129  }
130  }
131  }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< CrossingFrame< SimVertex > > simvertexXFToken_
std::vector< SimTrack >::const_iterator g4t_iterator
std::vector< SimVertex > SimVertexContainer
edm::EDGetTokenT< edm::SimTrackContainer > simtracksToken_
edm::EDGetTokenT< edm::SimVertexContainer > simvertexToken_
std::vector< SimTrack > SimTrackContainer
edm::EDGetTokenT< CrossingFrame< SimTrack > > simtracksXFToken_

Member Data Documentation

◆ crossingframe

bool const muonAssociatorByHitsDiagnostics::InputDumper::crossingframe
private

Definition at line 47 of file MuonAssociatorByHits.cc.

◆ simtracksTag

edm::InputTag const muonAssociatorByHitsDiagnostics::InputDumper::simtracksTag
private

Definition at line 45 of file MuonAssociatorByHits.cc.

◆ simtracksToken_

edm::EDGetTokenT<edm::SimTrackContainer> muonAssociatorByHitsDiagnostics::InputDumper::simtracksToken_
private

Definition at line 50 of file MuonAssociatorByHits.cc.

◆ simtracksXFTag

edm::InputTag const muonAssociatorByHitsDiagnostics::InputDumper::simtracksXFTag
private

Definition at line 46 of file MuonAssociatorByHits.cc.

◆ simtracksXFToken_

edm::EDGetTokenT<CrossingFrame<SimTrack> > muonAssociatorByHitsDiagnostics::InputDumper::simtracksXFToken_
private

Definition at line 48 of file MuonAssociatorByHits.cc.

◆ simvertexToken_

edm::EDGetTokenT<edm::SimVertexContainer> muonAssociatorByHitsDiagnostics::InputDumper::simvertexToken_
private

Definition at line 51 of file MuonAssociatorByHits.cc.

◆ simvertexXFToken_

edm::EDGetTokenT<CrossingFrame<SimVertex> > muonAssociatorByHitsDiagnostics::InputDumper::simvertexXFToken_
private

Definition at line 49 of file MuonAssociatorByHits.cc.