CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BasicHepMCHeavyIonValidation.cc
Go to the documentation of this file.
1 /*class BasicHepMCHeavyIonValidation
2  *
3  * Class to fill dqm monitor elements from existing EDM file
4  * Quan Wang - 04/2013
5  */
6 
8 
9 #include "CLHEP/Units/defs.h"
10 #include "CLHEP/Units/PhysicalConstants.h"
11 
12 using namespace edm;
13 
15  _wmanager(iPSet),
16  hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection"))
17 {
18  dbe = 0;
20  QWdebug_ = iPSet.getUntrackedParameter<bool>("QWdebug",false);
21 }
22 
24 
26 {
27  if(dbe){
29  dbe->setCurrentFolder("Generator/HeavyIon");
30 
31  // Number of analyzed events
32  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
33 
35  Ncoll_hard = dbe->book1D("Ncoll_hard", "Ncoll_hard", 700, 0, 700);
36  Npart_proj = dbe->book1D("Npart_proj", "Npart_proj", 250, 0, 250);
37  Npart_targ = dbe->book1D("Npart_targ", "Npart_targ", 250, 0, 250);
38  Ncoll = dbe->book1D("Ncoll", "Ncoll", 700, 0, 700);
39  N_Nwounded_collisions = dbe->book1D("N_Nwounded_collisions", "N_Nwounded_collisions", 250, 0, 250);
40  Nwounded_N_collisions = dbe->book1D("Nwounded_N_collisions", "Nwounded_N_collisions", 250, 0, 250);
41  Nwounded_Nwounded_collisions = dbe->book1D("Nwounded_Nwounded_collisions", "Nwounded_Nwounded_collisions", 250, 0, 250);
42  spectator_neutrons = dbe->book1D("spectator_neutrons", "spectator_neutrons", 250, 0, 250);
43  spectator_protons = dbe->book1D("spectator_protons", "spectator_protons", 250, 0, 250);
44  impact_parameter = dbe->book1D("impact_parameter", "impact_parameter", 50, 0, 50);
45  event_plane_angle = dbe->book1D("event_plane_angle", "event_plane_angle", 200, -CLHEP::pi, CLHEP::pi);
46  eccentricity = dbe->book1D("eccentricity", "eccentricity", 200, 0, 1.0);
47  sigma_inel_NN = dbe->book1D("sigma_inel_NN", "sigma_inel_NN", 200, 0, 10.0);
48 
49  }
50  return;
51 }
52 
55 {
57  //iSetup.getData( fPDGTable );
58  return;
59 }
60 void BasicHepMCHeavyIonValidation::endRun(const edm::Run& iRun,const edm::EventSetup& iSetup){return;}
62 {
64 
67  iEvent.getByLabel(hepmcCollection_, evt);
68 
69  //Get EVENT
70  //HepMC::GenEvent *myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
71 
72 
73 
74  const HepMC::HeavyIon* ion = evt->GetEvent()->heavy_ion();
75 
76  if (!ion) {
77  if ( QWdebug_ ) std::cout << "!!QW!! HeavyIon == null" << std::endl;
78  return;
79  }
80 
81  double weight = _wmanager.weight(iEvent);
82  nEvt->Fill(0.5,weight);
83 
84  Ncoll_hard->Fill(ion->Ncoll_hard(), weight);
85  Npart_proj->Fill(ion->Npart_proj(), weight);
86  Npart_targ->Fill(ion->Npart_targ(), weight);
87  Ncoll->Fill(ion->Ncoll(), weight);
88  N_Nwounded_collisions->Fill(ion->N_Nwounded_collisions(), weight);
89  Nwounded_N_collisions->Fill(ion->Nwounded_N_collisions(), weight);
90  Nwounded_Nwounded_collisions->Fill(ion->Nwounded_Nwounded_collisions(), weight);
91  spectator_neutrons->Fill(ion->spectator_neutrons(), weight);
92  spectator_protons->Fill(ion->spectator_protons(), weight);
93  impact_parameter->Fill(ion->impact_parameter(), weight);
94  event_plane_angle->Fill(ion->event_plane_angle(), weight);
95  eccentricity->Fill(ion->eccentricity(), weight);
96  sigma_inel_NN->Fill(ion->sigma_inel_NN(), weight);
97 
98 
99  //delete myGenEvent;
100 }//analyze
virtual void endRun(const edm::Run &, const edm::EventSetup &)
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
void Fill(long long x)
const Double_t pi
int iEvent
Definition: GenABIO.cc:243
virtual void analyze(const edm::Event &, const edm::EventSetup &)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
BasicHepMCHeavyIonValidation(const edm::ParameterSet &)
tuple cout
Definition: gather_cfg.py:121
double weight(const edm::Event &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33