CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
28 
30 //#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
31 
33 #include "TLorentzVector.h"
34 
36 
38  public:
39  explicit HiggsValidation(const edm::ParameterSet&);
40  virtual ~HiggsValidation();
41 
42  virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
43  virtual void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
44  virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
45 
46  private:
48 
50  public:
51 
53  fillMap();
54  std::vector<std::string> input = iConfig.getParameter<std::vector<std::string> >("monitorDecays");
55  for(std::vector<std::string>::const_iterator i = input.begin(); i!= input.end(); ++i){
56  fill(*i);
57  }
58  }
59 
61 
62  size_t position(int pid1,int pid2){
63  if(abs(pid1) == 14 || abs(pid1) == 16) pid1 = 12;
64  if(abs(pid2) == 14 || abs(pid2) == 16) 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))) return i+1;
68  }
69  return undetermined();//channels.size()+1;
70  }
71 
72  size_t size(){return channels.size() + 2;}
73  size_t undetermined(){return 0;}
74  size_t stable(){return size();}
75  std::string channel(size_t i){
76  if(i == 0) return "?";
77  if(i == channels.size()+1) return "Stable";
78  return convert(channels[i-1].first)+convert(channels[i-1].second);
79  }
80 
82  if( namePidMap.count(s)){
83  return namePidMap[s];
84  }
85  return 0;
86  }
87 
89  pid = abs(pid);
90  if(pid == 14 || pid == 16) pid = 12;
91  for(std::map<std::string,int>::const_iterator i = namePidMap.begin(); i!= namePidMap.end(); ++i) {
92  if(i->second == pid) return i->first;
93  }
94  return "not found";
95  }
96 
97  unsigned int NDecayParticles(){return nparticles_;}
98 
99  int isDecayParticle(int pid){
100  int idx=0;
101  for(std::map<std::string,int>::const_iterator i = namePidMap.begin(); i!= namePidMap.end(); ++i) {
102  if(i->second == pid) return idx;
103  idx++;
104  }
105  return -1;
106  }
107 
109  int idx=0;
110  for(std::map<std::string,int>::const_iterator i = namePidMap.begin(); i!= namePidMap.end(); ++i) {
111  if(idx==index) return i->first;
112  idx++;
113  }
114  return "unknown";
115  }
116 
117  private:
119  size_t pos = s.find("+");
120  std::string particle1 = s.substr(0,pos);
121  std::string particle2 = s.substr(pos+1,s.length()-pos);
122  std::pair<int,int> decay;
123  decay.first = convert(particle1);
124  decay.second = convert(particle2);
125  channels.push_back(decay);
126  }
127 
128  void fillMap(){
129  namePidMap["d"] = 1;
130  namePidMap["u"] = 2;
131  namePidMap["s"] = 3;
132  namePidMap["c"] = 4;
133  namePidMap["b"] = 5;
134  namePidMap["t"] = 6;
135  namePidMap["e"] = 11;
136  namePidMap["nu"] = 12;
137  namePidMap["mu"] = 13;
138  namePidMap["tau"] = 15;
139  namePidMap["gamma"] = 22;
140  namePidMap["Z"] = 23;
141  namePidMap["W"] = 24;
142  nparticles_=0;
143  for(std::map<std::string,int>::const_iterator i = namePidMap.begin(); i!= namePidMap.end(); ++i){
144  nparticles_++;
145  }
146  }
147 
148  std::map<std::string,int> namePidMap;
149 
150  std::vector<std::pair<int,int> > channels;
151  unsigned int nparticles_;
152 
153  };
154 
155  int findHiggsDecayChannel(const HepMC::GenParticle*,std::vector<HepMC::GenParticle*> &decayprod);
156  std::string convert(int);
157 
159 
162 
164 
167 
170 
174 
175  std::vector<MonitorElement*> HiggsDecayProd_pt;
176  std::vector<MonitorElement*> HiggsDecayProd_eta;
177 
179 
180 };
181 
182 #endif
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * Higgs_eta
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * nEvt
std::vector< MonitorElement * > HiggsDecayProd_pt
size_t position(int pid1, int pid2)
MonitoredDecays * monitoredDecays
virtual ~HiggsValidation()
static std::string const input
Definition: EdmProvDump.cc:44
HiggsValidation(const edm::ParameterSet &)
U second(std::pair< T, U > const &p)
std::vector< std::pair< int, int > > channels
MonitoredDecays(const edm::ParameterSet &iConfig)
int findHiggsDecayChannel(const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > HiggsDecayProd_eta
std::map< std::string, int > namePidMap
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * Higgs_pt
bool first
Definition: L1TdeRCT.cc:75
MonitorElement * HiggsDecayChannels
std::string convert(int)
virtual void analyze(edm::Event const &, edm::EventSetup const &) override
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::InputTag hepmcCollection_
tuple pid
Definition: sysUtil.py:22
std::string ConvertIndex(int index)
WeightManager wmanager_
std::string channel(size_t i)
std::string particle_name
Definition: Run.h:41
MonitorElement * Higgs_mass