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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

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
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecordfPDGTableToken
 
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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 36 of file HiggsValidation.h.

Constructor & Destructor Documentation

◆ HiggsValidation()

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

Definition at line 21 of file HiggsValidation.cc.

References fPDGTableToken, 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  fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
29 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitoredDecays * monitoredDecays
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > fPDGTableToken
edm::InputTag hepmcCollection_
WeightManager wmanager_
std::string particle_name

◆ ~HiggsValidation()

HiggsValidation::~HiggsValidation ( )
override

Definition at line 31 of file HiggsValidation.cc.

31 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 102 of file HiggsValidation.cc.

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

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

◆ bookHistograms()

void HiggsValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Implements DQMEDAnalyzer.

Definition at line 37 of file HiggsValidation.cc.

References HiggsValidation::MonitoredDecays::channel(), HiggsValidation::MonitoredDecays::ConvertIndex(), DeadROC_duringRun::dir, Higgs_eta, Higgs_mass, Higgs_pt, HiggsDecayChannels, HiggsDecayProd_eta, HiggsDecayProd_pt, mps_fire::i, heavyIonCSV_trainingSettings::idx, dqmiolumiharvest::j, monitoredDecays, HiggsValidation::MonitoredDecays::NDecayParticles(), nEvt, particle_name, dqm::impl::MonitorElement::setBinLabel(), HiggsValidation::MonitoredDecays::size(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ convert()

std::string HiggsValidation::convert ( int  )
private

◆ dqmBeginRun()

void HiggsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 33 of file HiggsValidation.cc.

References HltBtagPostValidation_cff::c, fPDGTable, and fPDGTableToken.

33  {
34  fPDGTable = c.getHandle(fPDGTableToken);
35 }
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > fPDGTableToken

◆ findHiggsDecayChannel()

int HiggsValidation::findHiggsDecayChannel ( const HepMC::GenParticle *  genParticle,
std::vector< HepMC::GenParticle *> &  decayprod 
)
private

Definition at line 140 of file HiggsValidation.cc.

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

Referenced by analyze().

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

Member Data Documentation

◆ fPDGTable

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

PDT table.

Definition at line 172 of file HiggsValidation.h.

Referenced by dqmBeginRun().

◆ fPDGTableToken

edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> HiggsValidation::fPDGTableToken
private

Definition at line 173 of file HiggsValidation.h.

Referenced by dqmBeginRun(), and HiggsValidation().

◆ hepmcCollection_

edm::InputTag HiggsValidation::hepmcCollection_
private

Definition at line 164 of file HiggsValidation.h.

Referenced by HiggsValidation().

◆ hepmcCollectionToken_

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

Definition at line 185 of file HiggsValidation.h.

Referenced by analyze(), and HiggsValidation().

◆ Higgs_eta

MonitorElement* HiggsValidation::Higgs_eta
private

Definition at line 179 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ Higgs_mass

MonitorElement* HiggsValidation::Higgs_mass
private

Definition at line 180 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ Higgs_pt

MonitorElement* HiggsValidation::Higgs_pt
private

Definition at line 178 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ HiggsDecayChannels

MonitorElement* HiggsValidation::HiggsDecayChannels
private

Definition at line 176 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ HiggsDecayProd_eta

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

Definition at line 183 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ HiggsDecayProd_pt

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

Definition at line 182 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ monitoredDecays

MonitoredDecays* HiggsValidation::monitoredDecays
private

Definition at line 169 of file HiggsValidation.h.

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

◆ nEvt

MonitorElement* HiggsValidation::nEvt
private

Definition at line 175 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ particle_id

int HiggsValidation::particle_id
private

Definition at line 166 of file HiggsValidation.h.

Referenced by analyze().

◆ particle_name

std::string HiggsValidation::particle_name
private

Definition at line 167 of file HiggsValidation.h.

Referenced by bookHistograms().

◆ wmanager_

WeightManager HiggsValidation::wmanager_
private

Definition at line 46 of file HiggsValidation.h.

Referenced by analyze().