CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HiggsValidation Class Reference

#include <HiggsValidation.h>

Inheritance diagram for HiggsValidation:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  MonitoredDecays
 

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
 HiggsValidation (const edm::ParameterSet &)
 
 ~HiggsValidation () 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
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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

std::string convert (int)
 
int findHiggsDecayChannel (const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
 

Private Attributes

edm::ESHandle< HepPDT::ParticleDataTablefPDGTable
 PDT table. More...
 
edm::InputTag hepmcCollection_
 
edm::EDGetTokenT< edm::HepMCProducthepmcCollectionToken_
 
MonitorElementHiggs_eta
 
MonitorElementHiggs_mass
 
MonitorElementHiggs_pt
 
MonitorElementHiggsDecayChannels
 
std::vector< MonitorElement * > HiggsDecayProd_eta
 
std::vector< MonitorElement * > HiggsDecayProd_pt
 
MonitoredDecaysmonitoredDecays
 
MonitorElementnEvt
 
int particle_id
 
std::string particle_name
 
WeightManager wmanager_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 36 of file HiggsValidation.h.

Constructor & Destructor Documentation

HiggsValidation::HiggsValidation ( const edm::ParameterSet iPSet)
explicit

Definition at line 21 of file HiggsValidation.cc.

References hepmcCollection_, hepmcCollectionToken_, and monitoredDecays.

22  : wmanager_(iPSet, consumesCollector()),
23  hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
24  particle_id(iPSet.getParameter<int>("pdg_id")),
25  particle_name(iPSet.getParameter<std::string>("particleName")) {
26  monitoredDecays = new MonitoredDecays(iPSet);
27  hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
28 }
T getParameter(std::string const &) const
MonitoredDecays * monitoredDecays
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
edm::InputTag hepmcCollection_
WeightManager wmanager_
std::string particle_name
HiggsValidation::~HiggsValidation ( )
override

Definition at line 30 of file HiggsValidation.cc.

30 {}

Member Function Documentation

void HiggsValidation::analyze ( edm::Event const &  ,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 99 of file HiggsValidation.cc.

References funct::abs(), dqm::impl::MonitorElement::Fill(), findHiggsDecayChannel(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), hepmcCollectionToken_, Higgs_eta, Higgs_mass, Higgs_pt, HiggsDecayChannels, HiggsDecayProd_eta, HiggsDecayProd_pt, mps_fire::i, training_settings::idx, HiggsValidation::MonitoredDecays::isDecayParticle(), monitoredDecays, nEvt, particle_id, WeightManager::weight(), mps_merge::weight, and wmanager_.

99  {
100  double weight = wmanager_.weight(iEvent);
101  nEvt->Fill(0.5, weight);
102 
103  //Gathering the HepMCProduct information
105  iEvent.getByToken(hepmcCollectionToken_, evt);
106 
107  //Get EVENT
108  HepMC::GenEvent* myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
109 
110  // loop over all particles
111  bool filled = false;
112  for (HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin();
113  iter != myGenEvent->particles_end() && !filled;
114  ++iter) {
115  if (particle_id == std::abs((*iter)->pdg_id())) {
116  std::vector<HepMC::GenParticle*> decayprod;
117  int channel = findHiggsDecayChannel(*iter, decayprod);
118  HiggsDecayChannels->Fill(channel, weight);
119  Higgs_pt->Fill((*iter)->momentum().perp(), weight);
120  Higgs_eta->Fill((*iter)->momentum().eta(), weight);
121  Higgs_mass->Fill((*iter)->momentum().m(), weight);
122  for (unsigned int i = 0; i < decayprod.size(); i++) {
123  int idx = monitoredDecays->isDecayParticle(decayprod.at(i)->pdg_id());
124  if (0 <= idx && idx <= (int)HiggsDecayProd_pt.size()) {
125  HiggsDecayProd_pt.at(idx)->Fill(decayprod.at(i)->momentum().perp(), weight);
126  HiggsDecayProd_eta.at(idx)->Fill(decayprod.at(i)->momentum().eta(), weight);
127  }
128  }
129  filled = true;
130  }
131  }
132 
133  delete myGenEvent;
134 
135 } //analyze
std::vector< MonitorElement * > HiggsDecayProd_pt
MonitorElement * Higgs_eta
std::vector< MonitorElement * > HiggsDecayProd_eta
Definition: weight.py:1
MonitorElement * nEvt
MonitoredDecays * monitoredDecays
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
int findHiggsDecayChannel(const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * Higgs_pt
MonitorElement * HiggsDecayChannels
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
WeightManager wmanager_
double weight(const edm::Event &)
MonitorElement * Higgs_mass
void HiggsValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Implements DQMEDAnalyzer.

Definition at line 34 of file HiggsValidation.cc.

References DQMHelper::book1dHisto(), HiggsValidation::MonitoredDecays::channel(), HiggsValidation::MonitoredDecays::ConvertIndex(), DeadROC_duringRun::dir, Higgs_eta, Higgs_mass, Higgs_pt, HiggsDecayChannels, HiggsDecayProd_eta, HiggsDecayProd_pt, training_settings::idx, dqmiolumiharvest::j, monitoredDecays, HiggsValidation::MonitoredDecays::NDecayParticles(), nEvt, particle_name, dqm::impl::MonitorElement::setBinLabel(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), HiggsValidation::MonitoredDecays::size(), and AlCaHLTBitMon_QueryRunRegistry::string.

34  {
36  std::string dir = "Generator/";
37  dir += particle_name;
38  DQMHelper dqm(&i);
39  i.setCurrentFolder(dir);
40 
41  // Number of analyzed events
42  nEvt = dqm.book1dHisto("nEvt", "n analyzed Events", 1, 0., 1., "bin", "Number of Events");
43 
44  //decay type
45 
46  std::string channel = particle_name + "_DecayChannels";
47  HiggsDecayChannels = dqm.book1dHisto(channel,
48  particle_name + " decay channels",
50  0,
52  "Decay Channels",
53  "Number of Events");
54 
55  for (size_t j = 0; j < monitoredDecays->size(); ++j) {
57  }
58 
59  //Kinematics
60  Higgs_pt = dqm.book1dHisto((particle_name + "_pt"),
61  (particle_name + " p_{t}"),
62  50,
63  0,
64  250,
65  "P_{t}^{" + particle_name + "} (GeV)",
66  "Number of Events");
67  Higgs_eta = dqm.book1dHisto((particle_name + "_eta"),
68  (particle_name + " #eta"),
69  50,
70  -5,
71  5,
72  "#eta^{" + particle_name + "}",
73  "Number of Events");
74  Higgs_mass = dqm.book1dHisto(
75  (particle_name + "_m"), (particle_name + " M"), 500, 0, 500, "M^{" + particle_name + "}", "Number of Events");
76 
77  int idx = 0;
78  for (unsigned int j = 0; j < monitoredDecays->NDecayParticles(); j++) {
79  HiggsDecayProd_pt.push_back(dqm.book1dHisto((monitoredDecays->ConvertIndex(idx) + "_pt"),
80  (monitoredDecays->ConvertIndex(idx) + " p_{t}"),
81  50,
82  0,
83  250,
84  "P_{t}^{" + monitoredDecays->ConvertIndex(idx) + "} (GeV)",
85  "Number of Events"));
86  HiggsDecayProd_eta.push_back(dqm.book1dHisto((monitoredDecays->ConvertIndex(idx) + "_eta"),
87  (monitoredDecays->ConvertIndex(idx) + " #eta"),
88  50,
89  -5,
90  5,
91  "#eta^{" + monitoredDecays->ConvertIndex(idx) + "}",
92  "Number of Events"));
93  idx++;
94  }
95 
96  return;
97 }
std::vector< MonitorElement * > HiggsDecayProd_pt
MonitorElement * Higgs_eta
std::vector< MonitorElement * > HiggsDecayProd_eta
MonitorElement * nEvt
MonitoredDecays * monitoredDecays
MonitorElement * Higgs_pt
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 * HiggsDecayChannels
std::string ConvertIndex(int index)
std::string channel(size_t i)
std::string particle_name
MonitorElement * Higgs_mass
std::string HiggsValidation::convert ( int  )
private
void HiggsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 32 of file HiggsValidation.cc.

References fPDGTable, and edm::EventSetup::getData().

32 { c.getData(fPDGTable); }
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
bool getData(T &iHolder) const
Definition: EventSetup.h:113
int HiggsValidation::findHiggsDecayChannel ( const HepMC::GenParticle *  genParticle,
std::vector< HepMC::GenParticle * > &  decayprod 
)
private

Definition at line 137 of file HiggsValidation.cc.

References class-composition::children, monitoredDecays, parents, HiggsValidation::MonitoredDecays::position(), HiggsValidation::MonitoredDecays::stable(), and HiggsValidation::MonitoredDecays::undetermined().

Referenced by analyze().

138  {
139  if (genParticle->status() == 1)
140  return monitoredDecays->stable();
141  std::vector<int> children;
142  if (genParticle->end_vertex()) {
143  HepMC::GenVertex::particle_iterator des;
144  for (des = genParticle->end_vertex()->particles_begin(HepMC::descendants);
145  des != genParticle->end_vertex()->particles_end(HepMC::descendants);
146  ++des) {
147  if ((*des)->pdg_id() == genParticle->pdg_id())
148  continue;
149 
150  HepMC::GenVertex::particle_iterator mother = (*des)->production_vertex()->particles_begin(HepMC::parents);
151  if ((*mother)->pdg_id() == genParticle->pdg_id()) {
152  children.push_back((*des)->pdg_id());
153  decayprod.push_back((*des));
154  }
155  }
156  }
157 
158  if (children.size() == 2 && children.at(0) != 0 && children.at(1) != 0) {
159  return monitoredDecays->position(children.at(0), children.at(1));
160  }
161  return monitoredDecays->undetermined();
162 }
TPRegexp parents
Definition: eve_filter.cc:21
size_t position(int pid1, int pid2)
MonitoredDecays * monitoredDecays

Member Data Documentation

edm::ESHandle<HepPDT::ParticleDataTable> HiggsValidation::fPDGTable
private

PDT table.

Definition at line 172 of file HiggsValidation.h.

Referenced by dqmBeginRun().

edm::InputTag HiggsValidation::hepmcCollection_
private

Definition at line 164 of file HiggsValidation.h.

Referenced by HiggsValidation().

edm::EDGetTokenT<edm::HepMCProduct> HiggsValidation::hepmcCollectionToken_
private

Definition at line 184 of file HiggsValidation.h.

Referenced by analyze(), and HiggsValidation().

MonitorElement* HiggsValidation::Higgs_eta
private

Definition at line 178 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::Higgs_mass
private

Definition at line 179 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::Higgs_pt
private

Definition at line 177 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::HiggsDecayChannels
private

Definition at line 175 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HiggsValidation::HiggsDecayProd_eta
private

Definition at line 182 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HiggsValidation::HiggsDecayProd_pt
private

Definition at line 181 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitoredDecays* HiggsValidation::monitoredDecays
private

Definition at line 169 of file HiggsValidation.h.

Referenced by analyze(), bookHistograms(), findHiggsDecayChannel(), and HiggsValidation().

MonitorElement* HiggsValidation::nEvt
private

Definition at line 174 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

int HiggsValidation::particle_id
private

Definition at line 166 of file HiggsValidation.h.

Referenced by analyze().

std::string HiggsValidation::particle_name
private

Definition at line 167 of file HiggsValidation.h.

Referenced by bookHistograms().

WeightManager HiggsValidation::wmanager_
private

Definition at line 46 of file HiggsValidation.h.

Referenced by analyze().