CMS 3D CMS Logo

HiggsValidation.h
Go to the documentation of this file.
1 #ifndef HiggsValidation_H
2 #define HiggsValidation_H
3 
4 /*class HiggsValidation
5  *
6  * Class to fill Event Generator dqm monitor elements; works on HepMCProduct
7  *
8  *
9  */
10 #include <iostream>
11 
12 // framework & common header files
13 
17 
22 
23 //DQM services
27 
29 //#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
30 
32 #include "TLorentzVector.h"
33 
35 
37 public:
38  explicit HiggsValidation(const edm::ParameterSet &);
39  ~HiggsValidation() override;
40 
41  void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
42  void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override;
43  void analyze(edm::Event const &, edm::EventSetup const &) override;
44 
45 private:
47 
49  public:
51  fillMap();
52  std::vector<std::string> input = iConfig.getParameter<std::vector<std::string> >("monitorDecays");
53  for (std::vector<std::string>::const_iterator i = input.begin(); i != input.end(); ++i) {
54  fill(*i);
55  }
56  }
57 
59 
60  size_t position(int pid1, int pid2) {
61  if (abs(pid1) == 14 || abs(pid1) == 16)
62  pid1 = 12;
63  if (abs(pid2) == 14 || abs(pid2) == 16)
64  pid2 = 12;
65  for (size_t i = 0; i < channels.size(); ++i) {
66  if ((channels[i].first == abs(pid1) && channels[i].second == abs(pid2)) ||
67  (channels[i].first == abs(pid2) && channels[i].second == abs(pid1)))
68  return i + 1;
69  }
70  return undetermined(); //channels.size()+1;
71  }
72 
73  size_t size() { return channels.size() + 2; }
74  size_t undetermined() { return 0; }
75  size_t stable() { return size(); }
76  std::string channel(size_t i) {
77  if (i == 0)
78  return "?";
79  if (i == channels.size() + 1)
80  return "Stable";
81  return convert(channels[i - 1].first) + convert(channels[i - 1].second);
82  }
83 
85  if (namePidMap.count(s)) {
86  return namePidMap[s];
87  }
88  return 0;
89  }
90 
91  std::string convert(int pid) {
92  pid = abs(pid);
93  if (pid == 14 || pid == 16)
94  pid = 12;
95  for (std::map<std::string, int>::const_iterator i = namePidMap.begin(); i != namePidMap.end(); ++i) {
96  if (i->second == pid)
97  return i->first;
98  }
99  return "not found";
100  }
101 
102  unsigned int NDecayParticles() { return nparticles_; }
103 
104  int isDecayParticle(int pid) {
105  int idx = 0;
106  for (std::map<std::string, int>::const_iterator i = namePidMap.begin(); i != namePidMap.end(); ++i) {
107  if (i->second == pid)
108  return idx;
109  idx++;
110  }
111  return -1;
112  }
113 
115  int idx = 0;
116  for (std::map<std::string, int>::const_iterator i = namePidMap.begin(); i != namePidMap.end(); ++i) {
117  if (idx == index)
118  return i->first;
119  idx++;
120  }
121  return "unknown";
122  }
123 
124  private:
126  size_t pos = s.find("+");
127  std::string particle1 = s.substr(0, pos);
128  std::string particle2 = s.substr(pos + 1, s.length() - pos);
129  std::pair<int, int> decay;
130  decay.first = convert(particle1);
131  decay.second = convert(particle2);
132  channels.push_back(decay);
133  }
134 
135  void fillMap() {
136  namePidMap["d"] = 1;
137  namePidMap["u"] = 2;
138  namePidMap["s"] = 3;
139  namePidMap["c"] = 4;
140  namePidMap["b"] = 5;
141  namePidMap["t"] = 6;
142  namePidMap["e"] = 11;
143  namePidMap["nu"] = 12;
144  namePidMap["mu"] = 13;
145  namePidMap["tau"] = 15;
146  namePidMap["gamma"] = 22;
147  namePidMap["Z"] = 23;
148  namePidMap["W"] = 24;
149  nparticles_ = 0;
150  for (std::map<std::string, int>::const_iterator i = namePidMap.begin(); i != namePidMap.end(); ++i) {
151  nparticles_++;
152  }
153  }
154 
155  std::map<std::string, int> namePidMap;
156 
157  std::vector<std::pair<int, int> > channels;
158  unsigned int nparticles_;
159  };
160 
161  int findHiggsDecayChannel(const HepMC::GenParticle *, std::vector<HepMC::GenParticle *> &decayprod);
162  std::string convert(int);
163 
165 
168 
170 
173 
176 
180 
181  std::vector<MonitorElement *> HiggsDecayProd_pt;
182  std::vector<MonitorElement *> HiggsDecayProd_eta;
183 
185 };
186 
187 #endif
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
HiggsValidation::findHiggsDecayChannel
int findHiggsDecayChannel(const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
Definition: HiggsValidation.cc:137
HiggsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: HiggsValidation.cc:34
HiggsValidation::monitoredDecays
MonitoredDecays * monitoredDecays
Definition: HiggsValidation.h:169
ESHandle.h
edm::Run
Definition: Run.h:45
HiggsValidation
Definition: HiggsValidation.h:36
HiggsValidation::MonitoredDecays::ConvertIndex
std::string ConvertIndex(int index)
Definition: HiggsValidation.h:114
edm::EDGetTokenT< edm::HepMCProduct >
HiggsValidation::MonitoredDecays::nparticles_
unsigned int nparticles_
Definition: HiggsValidation.h:158
HiggsValidation::hepmcCollectionToken_
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
Definition: HiggsValidation.h:184
pos
Definition: PixelAliasList.h:18
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DQMStore.h
HiggsValidation::MonitoredDecays::isDecayParticle
int isDecayParticle(int pid)
Definition: HiggsValidation.h:104
HiggsValidation::MonitoredDecays::stable
size_t stable()
Definition: HiggsValidation.h:75
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HiggsValidation::HiggsValidation
HiggsValidation(const edm::ParameterSet &)
Definition: HiggsValidation.cc:21
HiggsValidation::wmanager_
WeightManager wmanager_
Definition: HiggsValidation.h:46
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
HiggsValidation::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: HiggsValidation.cc:99
HiggsValidation::MonitoredDecays::namePidMap
std::map< std::string, int > namePidMap
Definition: HiggsValidation.h:155
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HiggsValidation::convert
std::string convert(int)
HiggsValidation::HiggsDecayProd_eta
std::vector< MonitorElement * > HiggsDecayProd_eta
Definition: HiggsValidation.h:182
Service.h
Run.h
edm::ESHandle< HepPDT::ParticleDataTable >
HiggsValidation::MonitoredDecays::undetermined
size_t undetermined()
Definition: HiggsValidation.h:74
HiggsValidation::MonitoredDecays::size
size_t size()
Definition: HiggsValidation.h:73
DQMEDAnalyzer.h
HiggsValidation::fPDGTable
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
Definition: HiggsValidation.h:172
HiggsValidation::~HiggsValidation
~HiggsValidation() override
Definition: HiggsValidation.cc:30
HiggsValidation::MonitoredDecays::convert
int convert(std::string s)
Definition: HiggsValidation.h:84
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
WeightManager.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HiggsValidation::MonitoredDecays::channel
std::string channel(size_t i)
Definition: HiggsValidation.h:76
ParticleDataTable.h
HiggsValidation::MonitoredDecays
Definition: HiggsValidation.h:48
WeightManager
Definition: WeightManager.h:20
HiggsValidation::Higgs_pt
MonitorElement * Higgs_pt
Definition: HiggsValidation.h:177
HiggsValidation::MonitoredDecays::fill
void fill(std::string s)
Definition: HiggsValidation.h:125
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HiggsValidation::particle_name
std::string particle_name
Definition: HiggsValidation.h:167
InputTag.h
alignCSCRings.r
r
Definition: alignCSCRings.py:93
PA_ZEESkim_cff.decay
decay
Definition: PA_ZEESkim_cff.py:26
HiggsValidation::dqmBeginRun
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: HiggsValidation.cc:32
HiggsValidation::nEvt
MonitorElement * nEvt
Definition: HiggsValidation.h:174
HiggsValidation::MonitoredDecays::convert
std::string convert(int pid)
Definition: HiggsValidation.h:91
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
HiggsValidation::MonitoredDecays::MonitoredDecays
MonitoredDecays(const edm::ParameterSet &iConfig)
Definition: HiggsValidation.h:50
HiggsValidation::Higgs_mass
MonitorElement * Higgs_mass
Definition: HiggsValidation.h:179
HiggsValidation::MonitoredDecays::fillMap
void fillMap()
Definition: HiggsValidation.h:135
HiggsValidation::MonitoredDecays::channels
std::vector< std::pair< int, int > > channels
Definition: HiggsValidation.h:157
HiggsValidation::HiggsDecayChannels
MonitorElement * HiggsDecayChannels
Definition: HiggsValidation.h:175
HiggsValidation::HiggsDecayProd_pt
std::vector< MonitorElement * > HiggsDecayProd_pt
Definition: HiggsValidation.h:181
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HiggsValidation::Higgs_eta
MonitorElement * Higgs_eta
Definition: HiggsValidation.h:178
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
HepMCProduct.h
HiggsValidation::MonitoredDecays::NDecayParticles
unsigned int NDecayParticles()
Definition: HiggsValidation.h:102
HiggsValidation::MonitoredDecays::~MonitoredDecays
~MonitoredDecays()
Definition: HiggsValidation.h:58
HiggsValidation::hepmcCollection_
edm::InputTag hepmcCollection_
Definition: HiggsValidation.h:164
edm::Event
Definition: Event.h:73
HiggsValidation::MonitoredDecays::position
size_t position(int pid1, int pid2)
Definition: HiggsValidation.h:60
edm::InputTag
Definition: InputTag.h:15
HiggsValidation::particle_id
int particle_id
Definition: HiggsValidation.h:166