CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
VertexHistoryAnalyzer Class Reference
Inheritance diagram for VertexHistoryAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 VertexHistoryAnalyzer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
std::string particleString (int) const
 
std::string vertexString (const TrackingParticleRefVector &, const TrackingParticleRefVector &) const
 
std::string vertexString (HepMC::GenVertex::particles_in_const_iterator, HepMC::GenVertex::particles_in_const_iterator, HepMC::GenVertex::particles_out_const_iterator, HepMC::GenVertex::particles_out_const_iterator) const
 

Private Attributes

VertexClassifier classifier_
 
edm::ESHandle< ParticleDataTablepdt_
 
edm::InputTag vertexProducer_
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file VertexHistoryAnalyzer.cc.

Constructor & Destructor Documentation

◆ VertexHistoryAnalyzer()

VertexHistoryAnalyzer::VertexHistoryAnalyzer ( const edm::ParameterSet config)
explicit

Definition at line 61 of file VertexHistoryAnalyzer.cc.

63  vertexProducer_ = config.getUntrackedParameter<edm::InputTag>("vertexProducer");
64  consumes<edm::View<reco::Vertex>>(vertexProducer_);
65 }

References vertexProducer_.

Member Function Documentation

◆ analyze()

void VertexHistoryAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 67 of file VertexHistoryAnalyzer.cc.

67  {
68  // Set the classifier for a new event
70 
71  // Vertex collection
73  event.getByLabel(vertexProducer_, vertexCollection);
74 
75  // Get a constant reference to the track history associated to the classifier
76  VertexHistory const &tracer = classifier_.history();
77 
78  // Loop over the track collection.
79  for (std::size_t index = 0; index < vertexCollection->size(); index++) {
80  std::cout << std::endl << "History for vertex #" << index << " : " << std::endl;
81 
82  // Classify the track and detect for fakes
84  // Get the list of TrackingParticles associated to
86 
87  // Loop over all simParticles
88  for (std::size_t hindex = 0; hindex < simParticles.size(); hindex++) {
89  std::cout << " simParticles [" << hindex << "] : " << particleString(simParticles[hindex]->pdgId())
90  << std::endl;
91  }
92 
93  // Get the list of TrackingVertexes associated to
94  VertexHistory::SimVertexTrail simVertexes(tracer.simVertexTrail());
95 
96  // Loop over all simVertexes
97  if (!simVertexes.empty()) {
98  for (std::size_t hindex = 0; hindex < simVertexes.size(); hindex++) {
99  std::cout << " simVertex [" << hindex << "] : "
100  << vertexString(simVertexes[hindex]->sourceTracks(), simVertexes[hindex]->daughterTracks())
101  << std::endl;
102  }
103  } else
104  std::cout << " simVertex no found" << std::endl;
105 
106  // Get the list of GenParticles associated to
108 
109  // Loop over all genParticles
110  for (std::size_t hindex = 0; hindex < genParticles.size(); hindex++) {
111  std::cout << " genParticles [" << hindex << "] : " << particleString(genParticles[hindex]->pdg_id())
112  << std::endl;
113  }
114 
115  // Get the list of TrackingVertexes associated to
116  VertexHistory::GenVertexTrail genVertexes(tracer.genVertexTrail());
117 
118  // Loop over all simVertexes
119  if (!genVertexes.empty()) {
120  for (std::size_t hindex = 0; hindex < genVertexes.size(); hindex++) {
121  std::cout << " genVertex [" << hindex << "] : "
122  << vertexString(genVertexes[hindex]->particles_in_const_begin(),
123  genVertexes[hindex]->particles_in_const_end(),
124  genVertexes[hindex]->particles_out_const_begin(),
125  genVertexes[hindex]->particles_out_const_end())
126  << std::endl;
127  }
128  } else
129  std::cout << " genVertex no found" << std::endl;
130  } else
131  std::cout << " fake vertex" << std::endl;
132 
133  std::cout << " vertex categories : " << classifier_;
134  std::cout << std::endl;
135  }
136 }

References classifier_, gather_cfg::cout, VertexClassifier::evaluate(), VertexCategories::Fake, genParticles2HepMC_cfi::genParticles, HistoryBase::genParticleTrail(), HistoryBase::genVertexTrail(), VertexClassifier::history(), VertexCategories::is(), VertexClassifier::newEvent(), particleString(), HiggsValidation_cfi::pdg_id, EgammaValidation_cff::pdgId, singleTopDQM_cfi::setup, HistoryBase::simParticleTrail(), HistoryBase::simVertexTrail(), spclusmultinvestigator_cfi::vertexCollection, vertexProducer_, and vertexString().

◆ beginJob()

void VertexHistoryAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 143 of file VertexHistoryAnalyzer.cc.

143 {}

◆ beginRun()

void VertexHistoryAnalyzer::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
privatevirtual

Definition at line 138 of file VertexHistoryAnalyzer.cc.

138  {
139  // Get the particles table.
140  setup.getData(pdt_);
141 }

References pdt_, and singleTopDQM_cfi::setup.

◆ particleString()

std::string VertexHistoryAnalyzer::particleString ( int  pdgId) const
private

Definition at line 145 of file VertexHistoryAnalyzer.cc.

145  {
146  ParticleData const *pid;
147 
148  std::ostringstream vDescription;
149 
151 
152  if (particleType.isValid()) {
153  pid = pdt_->particle(particleType);
154  if (pid)
155  vDescription << pid->name();
156  else
157  vDescription << pdgId;
158  } else
159  vDescription << pdgId;
160 
161  return vDescription.str();
162 }

References LHEGenericFilter_cfi::ParticleID, PbPb_ZMuSkimMuonDPG_cff::particleType, EgammaValidation_cff::pdgId, and pdt_.

Referenced by analyze().

◆ vertexString() [1/2]

std::string VertexHistoryAnalyzer::vertexString ( const TrackingParticleRefVector in,
const TrackingParticleRefVector out 
) const
private

Definition at line 164 of file VertexHistoryAnalyzer.cc.

165  {
166  ParticleData const *pid;
167 
168  std::ostringstream vDescription;
169 
170  for (std::size_t j = 0; j < in.size(); j++) {
171  if (!j)
172  vDescription << "(";
173 
175 
176  if (particleType.isValid()) {
177  pid = pdt_->particle(particleType);
178  if (pid)
179  vDescription << pid->name();
180  else
181  vDescription << in[j]->pdgId();
182  } else
183  vDescription << in[j]->pdgId();
184 
185  if (j == in.size() - 1)
186  vDescription << ")";
187  else
188  vDescription << ",";
189  }
190 
191  vDescription << "->";
192 
193  for (std::size_t j = 0; j < out.size(); j++) {
194  if (!j)
195  vDescription << "(";
196 
198 
199  if (particleType.isValid()) {
200  pid = pdt_->particle(particleType);
201  if (pid)
202  vDescription << pid->name();
203  else
204  vDescription << out[j]->pdgId();
205  } else
206  vDescription << out[j]->pdgId();
207 
208  if (j == out.size() - 1)
209  vDescription << ")";
210  else
211  vDescription << ",";
212  }
213 
214  return vDescription.str();
215 }

References recoMuon::in, dqmiolumiharvest::j, MillePedeFileConverter_cfg::out, LHEGenericFilter_cfi::ParticleID, PbPb_ZMuSkimMuonDPG_cff::particleType, EgammaValidation_cff::pdgId, and pdt_.

Referenced by analyze().

◆ vertexString() [2/2]

std::string VertexHistoryAnalyzer::vertexString ( HepMC::GenVertex::particles_in_const_iterator  in_begin,
HepMC::GenVertex::particles_in_const_iterator  in_end,
HepMC::GenVertex::particles_out_const_iterator  out_begin,
HepMC::GenVertex::particles_out_const_iterator  out_end 
) const
private

Definition at line 217 of file VertexHistoryAnalyzer.cc.

220  {
221  ParticleData const *pid;
222 
223  std::ostringstream vDescription;
224 
225  std::size_t j = 0;
226 
227  HepMC::GenVertex::particles_in_const_iterator in, itmp;
228 
229  for (in = in_begin; in != in_end; in++, j++) {
230  if (!j)
231  vDescription << "(";
232 
233  HepPDT::ParticleID particleType((*in)->pdg_id());
234 
235  if (particleType.isValid()) {
236  pid = pdt_->particle(particleType);
237  if (pid)
238  vDescription << pid->name();
239  else
240  vDescription << (*in)->pdg_id();
241  } else
242  vDescription << (*in)->pdg_id();
243 
244  itmp = in;
245 
246  if (++itmp == in_end)
247  vDescription << ")";
248  else
249  vDescription << ",";
250  }
251 
252  vDescription << "->";
253  j = 0;
254 
255  HepMC::GenVertex::particles_out_const_iterator out, otmp;
256 
257  for (out = out_begin; out != out_end; out++, j++) {
258  if (!j)
259  vDescription << "(";
260 
261  HepPDT::ParticleID particleType((*out)->pdg_id());
262 
263  if (particleType.isValid()) {
264  pid = pdt_->particle(particleType);
265  if (pid)
266  vDescription << pid->name();
267  else
268  vDescription << (*out)->pdg_id();
269  } else
270  vDescription << (*out)->pdg_id();
271 
272  otmp = out;
273 
274  if (++otmp == out_end)
275  vDescription << ")";
276  else
277  vDescription << ",";
278  }
279 
280  return vDescription.str();
281 }

References recoMuon::in, dqmiolumiharvest::j, MillePedeFileConverter_cfg::out, LHEGenericFilter_cfi::ParticleID, PbPb_ZMuSkimMuonDPG_cff::particleType, and pdt_.

Member Data Documentation

◆ classifier_

VertexClassifier VertexHistoryAnalyzer::classifier_
private

Definition at line 45 of file VertexHistoryAnalyzer.cc.

Referenced by analyze().

◆ pdt_

edm::ESHandle<ParticleDataTable> VertexHistoryAnalyzer::pdt_
private

Definition at line 49 of file VertexHistoryAnalyzer.cc.

Referenced by beginRun(), particleString(), and vertexString().

◆ vertexProducer_

edm::InputTag VertexHistoryAnalyzer::vertexProducer_
private

Definition at line 47 of file VertexHistoryAnalyzer.cc.

Referenced by analyze(), and VertexHistoryAnalyzer().

HiggsValidation_cfi.pdg_id
pdg_id
Definition: HiggsValidation_cfi.py:6
VertexCategories::is
bool is(Category category) const
Returns track flag for a given category.
Definition: VertexCategories.h:61
HistoryBase::SimParticleTrail
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.
Definition: HistoryBase.h:30
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HistoryBase::GenParticleTrail
std::vector< const HepMC::GenParticle * > GenParticleTrail
HepMC::GenParticle trail type.
Definition: HistoryBase.h:15
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
config
Definition: config.py:1
HistoryBase::simVertexTrail
const SimVertexTrail & simVertexTrail() const
Return all the simulated vertices in the history.
Definition: HistoryBase.h:52
HistoryBase::GenVertexTrail
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
Definition: HistoryBase.h:24
VertexClassifier::newEvent
virtual void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
Definition: VertexClassifier.cc:33
HistoryBase::genParticleTrail
const GenParticleTrail & genParticleTrail() const
Return all generated particle (HepMC::GenParticle) in the history.
Definition: HistoryBase.h:61
HistoryBase::genVertexTrail
const GenVertexTrail & genVertexTrail() const
Return all generated vertex in the history.
Definition: HistoryBase.h:58
VertexHistory
This class traces the simulated and generated history of a given track.
Definition: VertexHistory.h:18
recoMuon::in
Definition: RecoMuonEnumerators.h:6
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:117
VertexHistoryAnalyzer::particleString
std::string particleString(int) const
Definition: VertexHistoryAnalyzer.cc:145
VertexHistoryAnalyzer::vertexProducer_
edm::InputTag vertexProducer_
Definition: VertexHistoryAnalyzer.cc:47
HistoryBase::simParticleTrail
const SimParticleTrail & simParticleTrail() const
Return all the simulated particle in the history.
Definition: HistoryBase.h:55
VertexHistoryAnalyzer::vertexString
std::string vertexString(const TrackingParticleRefVector &, const TrackingParticleRefVector &) const
Definition: VertexHistoryAnalyzer.cc:164
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
VertexClassifier::evaluate
const VertexClassifier & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
Definition: VertexClassifier.cc:47
edm::RefToBase< reco::Vertex >
VertexClassifier::history
const VertexHistory & history() const
Returns a reference to the vertex history used in the classification.
Definition: VertexClassifier.h:41
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
VertexCategories::Fake
Definition: VertexCategories.h:12
PbPb_ZMuSkimMuonDPG_cff.particleType
particleType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:27
VertexHistoryAnalyzer::classifier_
VertexClassifier classifier_
Definition: VertexHistoryAnalyzer.cc:45
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
VertexHistoryAnalyzer::pdt_
edm::ESHandle< ParticleDataTable > pdt_
Definition: VertexHistoryAnalyzer.cc:49
LHEGenericFilter_cfi.ParticleID
ParticleID
Definition: LHEGenericFilter_cfi.py:6
edm::InputTag
Definition: InputTag.h:15
HistoryBase::SimVertexTrail
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Definition: HistoryBase.h:33