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
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  virtual ~HiggsValidation();
40  virtual void beginJob();
41  virtual void endJob();
42  virtual void analyze(const edm::Event&, const edm::EventSetup&);
43  virtual void beginRun(const edm::Run&, const edm::EventSetup&);
44  virtual void endRun(const edm::Run&, const edm::EventSetup&);
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();}
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 
173 
177 
178  std::vector<MonitorElement*> HiggsDecayProd_pt;
179  std::vector<MonitorElement*> HiggsDecayProd_eta;
180 
182 
183 };
184 
185 #endif
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
T getParameter(std::string const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int i
Definition: DBlmapReader.cc:9
MonitorElement * Higgs_eta
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
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)
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:79
MonitorElement * HiggsDecayChannels
std::string convert(int)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::InputTag hepmcCollection_
tuple pid
Definition: sysUtil.py:22
DQMStore * dbe
ME&#39;s &quot;container&quot;.
virtual void beginJob()
std::string ConvertIndex(int index)
WeightManager wmanager_
std::string channel(size_t i)
virtual void endJob()
std::string particle_name
Definition: Run.h:41
MonitorElement * Higgs_mass