CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ParticleDecayDrawer Class Reference
Inheritance diagram for ParticleDecayDrawer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ParticleDecayDrawer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool accept (const reco::Candidate &, const std::list< const reco::Candidate * > &) const
 accept candidate More...
 
void analyze (const edm::Event &, const edm::EventSetup &) override
 
std::string decay (const reco::Candidate &, std::list< const reco::Candidate * > &) const
 
bool hasValidDaughters (const reco::Candidate &) const
 has valid daughters in the chain More...
 
std::string printP4 (const reco::Candidate &) const
 print 4 momenta More...
 
bool select (const reco::Candidate &) const
 select candidate More...
 

Private Attributes

edm::ESHandle< ParticleDataTablepdt_
 
bool printP4_
 print parameters More...
 
bool printPtEtaPhi_
 
bool printVertex_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 12 of file ParticleDecayDrawer.cc.

Constructor & Destructor Documentation

◆ ParticleDecayDrawer()

ParticleDecayDrawer::ParticleDecayDrawer ( const edm::ParameterSet cfg)

Definition at line 45 of file ParticleDecayDrawer.cc.

46  : srcToken_(consumes<edm::View<reco::Candidate> >(cfg.getParameter<InputTag>("src"))),
47  printP4_(cfg.getUntrackedParameter<bool>("printP4", false)),
48  printPtEtaPhi_(cfg.getUntrackedParameter<bool>("printPtEtaPhi", false)),
49  printVertex_(cfg.getUntrackedParameter<bool>("printVertex", false)) {}

Member Function Documentation

◆ accept()

bool ParticleDecayDrawer::accept ( const reco::Candidate ,
const std::list< const reco::Candidate * > &   
) const
private

accept candidate

Definition at line 51 of file ParticleDecayDrawer.cc.

51  {
52  if (find(skip.begin(), skip.end(), &c) != skip.end())
53  return false;
54  return select(c);
55 }

References HltBtagPostValidation_cff::c, spr::find(), select(), and optionsL1T::skip.

Referenced by decay(), and esMonitoring.FDJsonServer::handle_accept().

◆ analyze()

void ParticleDecayDrawer::analyze ( const edm::Event event,
const edm::EventSetup es 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 67 of file ParticleDecayDrawer.cc.

67  {
68  es.getData(pdt_);
70  event.getByToken(srcToken_, particles);
71  list<const Candidate *> skip;
72  vector<const Candidate *> nodes, moms;
73  for (View<Candidate>::const_iterator p = particles->begin(); p != particles->end(); ++p) {
74  if (p->numberOfMothers() > 1) {
75  if (select(*p)) {
76  skip.push_back(&*p);
77  nodes.push_back(&*p);
78  for (size_t j = 0; j < p->numberOfMothers(); ++j) {
79  const Candidate *mom = p->mother(j);
80  const Candidate *grandMom;
81  while ((grandMom = mom->mother()) != nullptr)
82  mom = grandMom;
83  if (select(*mom)) {
84  moms.push_back(mom);
85  }
86  }
87  }
88  }
89  }
90  cout << "-- decay: --" << endl;
91  if (!moms.empty()) {
92  if (moms.size() > 1)
93  for (size_t m = 0; m < moms.size(); ++m) {
94  string dec = decay(*moms[m], skip);
95  if (!dec.empty())
96  cout << "{ " << dec << " } ";
97  }
98  else
99  cout << decay(*moms[0], skip);
100  }
101  if (!nodes.empty()) {
102  cout << "-> ";
103  if (nodes.size() > 1) {
104  for (size_t n = 0; n < nodes.size(); ++n) {
105  skip.remove(nodes[n]);
106  string dec = decay(*nodes[n], skip);
107  if (!dec.empty()) {
108  if (dec.find("->", 0) != string::npos)
109  cout << " ( " << dec << " )";
110  else
111  cout << " " << dec;
112  }
113  }
114  } else {
115  skip.remove(nodes[0]);
116  cout << decay(*nodes[0], skip);
117  }
118  }
119  cout << endl;
120 }

References gather_cfg::cout, TauDecayModes::dec, decay(), edm::EventSetup::getData(), dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, reco::Candidate::mother(), dqmiodumpmetadata::n, class-composition::nodes, AlCaHLTBitMon_ParallelJobs::p, ecalTrigSettings_cff::particles, pdt_, select(), optionsL1T::skip, and srcToken_.

◆ decay()

string ParticleDecayDrawer::decay ( const reco::Candidate ,
std::list< const reco::Candidate * > &   
) const
private

Definition at line 133 of file ParticleDecayDrawer.cc.

133  {
134  string out;
135  if (find(skip.begin(), skip.end(), &c) != skip.end())
136  return out;
137  skip.push_back(&c);
138 
139  int id = c.pdgId();
140  const ParticleData *pd = pdt_->particle(id);
141  assert(pd != nullptr);
142  out += (pd->name() + printP4(c));
143 
144  size_t validDau = 0, ndau = c.numberOfDaughters();
145  for (size_t i = 0; i < ndau; ++i)
146  if (accept(*c.daughter(i), skip))
147  ++validDau;
148  if (validDau == 0)
149  return out;
150 
151  out += " ->";
152 
153  for (size_t i = 0; i < ndau; ++i) {
154  const Candidate *d = c.daughter(i);
155  if (accept(*d, skip)) {
156  string dec = decay(*d, skip);
157  if (dec.find("->", 0) != string::npos)
158  out += (" ( " + dec + " )");
159  else
160  out += (" " + dec);
161  }
162  }
163  return out;
164 }

References accept(), cms::cuda::assert(), HltBtagPostValidation_cff::c, ztail::d, TauDecayModes::dec, spr::find(), mps_fire::i, MillePedeFileConverter_cfg::out, pdt_, printP4(), and optionsL1T::skip.

Referenced by analyze().

◆ hasValidDaughters()

bool ParticleDecayDrawer::hasValidDaughters ( const reco::Candidate c) const
private

has valid daughters in the chain

Definition at line 59 of file ParticleDecayDrawer.cc.

59  {
60  size_t ndau = c.numberOfDaughters();
61  for (size_t i = 0; i < ndau; ++i)
62  if (select(*c.daughter(i)))
63  return true;
64  return false;
65 }

References HltBtagPostValidation_cff::c, mps_fire::i, and select().

◆ printP4()

string ParticleDecayDrawer::printP4 ( const reco::Candidate c) const
private

print 4 momenta

Definition at line 122 of file ParticleDecayDrawer.cc.

122  {
123  ostringstream cout;
124  if (printP4_)
125  cout << " (" << c.px() << ", " << c.py() << ", " << c.pz() << "; " << c.energy() << ")";
126  if (printPtEtaPhi_)
127  cout << " [" << c.pt() << ": " << c.eta() << ", " << c.phi() << "]";
128  if (printVertex_)
129  cout << " {" << c.vx() << ", " << c.vy() << ", " << c.vz() << "}";
130  return cout.str();
131 }

References HltBtagPostValidation_cff::c, gather_cfg::cout, printP4_, printPtEtaPhi_, and printVertex_.

Referenced by decay().

◆ select()

bool ParticleDecayDrawer::select ( const reco::Candidate c) const
private

select candidate

Definition at line 57 of file ParticleDecayDrawer.cc.

57 { return c.status() == 3; }

References HltBtagPostValidation_cff::c.

Referenced by accept(), analyze(), and hasValidDaughters().

Member Data Documentation

◆ pdt_

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

Definition at line 20 of file ParticleDecayDrawer.cc.

Referenced by analyze(), and decay().

◆ printP4_

bool ParticleDecayDrawer::printP4_
private

print parameters

Definition at line 22 of file ParticleDecayDrawer.cc.

Referenced by printP4().

◆ printPtEtaPhi_

bool ParticleDecayDrawer::printPtEtaPhi_
private

Definition at line 22 of file ParticleDecayDrawer.cc.

Referenced by printP4().

◆ printVertex_

bool ParticleDecayDrawer::printVertex_
private

Definition at line 22 of file ParticleDecayDrawer.cc.

Referenced by printP4().

◆ srcToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > ParticleDecayDrawer::srcToken_
private

Definition at line 18 of file ParticleDecayDrawer.cc.

Referenced by analyze().

ParticleDecayDrawer::printP4_
bool printP4_
print parameters
Definition: ParticleDecayDrawer.cc:22
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
ParticleDecayDrawer::printVertex_
bool printVertex_
Definition: ParticleDecayDrawer.cc:22
ParticleDecayDrawer::select
bool select(const reco::Candidate &) const
select candidate
Definition: ParticleDecayDrawer.cc:57
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ParticleDecayDrawer::pdt_
edm::ESHandle< ParticleDataTable > pdt_
Definition: ParticleDecayDrawer.cc:20
cms::cuda::assert
assert(be >=bs)
ParticleDecayDrawer::srcToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
Definition: ParticleDecayDrawer.cc:18
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reco::Candidate::mother
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
edm::Handle
Definition: AssociativeIterator.h:50
ecalTrigSettings_cff.particles
particles
Definition: ecalTrigSettings_cff.py:11
ParticleDecayDrawer::accept
bool accept(const reco::Candidate &, const std::list< const reco::Candidate * > &) const
accept candidate
Definition: ParticleDecayDrawer.cc:51
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
optionsL1T.skip
skip
Definition: optionsL1T.py:30
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
class-composition.nodes
nodes
Definition: class-composition.py:75
edm::View
Definition: CaloClusterFwd.h:14
ParticleDecayDrawer::printPtEtaPhi_
bool printPtEtaPhi_
Definition: ParticleDecayDrawer.cc:22
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
ParticleDecayDrawer::printP4
std::string printP4(const reco::Candidate &) const
print 4 momenta
Definition: ParticleDecayDrawer.cc:122
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ztail.d
d
Definition: ztail.py:151
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
ParticleDecayDrawer::decay
std::string decay(const reco::Candidate &, std::list< const reco::Candidate * > &) const
Definition: ParticleDecayDrawer.cc:133
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15