CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Validation/EventGenerator/plugins/BasicHepMCHeavyIonValidation.cc

Go to the documentation of this file.
00001 /*class BasicHepMCHeavyIonValidation
00002  *  
00003  *  Class to fill dqm monitor elements from existing EDM file
00004  *  Quan Wang - 04/2013
00005  */
00006 
00007 #include "Validation/EventGenerator/interface/BasicHepMCHeavyIonValidation.h"
00008 
00009 #include "CLHEP/Units/defs.h"
00010 #include "CLHEP/Units/PhysicalConstants.h"
00011 
00012 using namespace edm;
00013 
00014 BasicHepMCHeavyIonValidation::BasicHepMCHeavyIonValidation(const edm::ParameterSet& iPSet): 
00015         _wmanager(iPSet),
00016         hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection"))
00017 {    
00018         dbe = 0;
00019         dbe = edm::Service<DQMStore>().operator->();
00020         QWdebug_ = iPSet.getUntrackedParameter<bool>("QWdebug",false);
00021 }
00022 
00023 BasicHepMCHeavyIonValidation::~BasicHepMCHeavyIonValidation() {}
00024 
00025 void BasicHepMCHeavyIonValidation::beginJob()
00026 {
00027         if(dbe){
00029                 dbe->setCurrentFolder("Generator/HeavyIon");
00030 
00031                 // Number of analyzed events
00032                 nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
00033 
00035                 Ncoll_hard = dbe->book1D("Ncoll_hard", "Ncoll_hard", 700, 0, 700);
00036                 Npart_proj = dbe->book1D("Npart_proj", "Npart_proj", 250, 0, 250);
00037                 Npart_targ = dbe->book1D("Npart_targ", "Npart_targ", 250, 0, 250);
00038                 Ncoll = dbe->book1D("Ncoll", "Ncoll", 700, 0, 700);
00039                 N_Nwounded_collisions = dbe->book1D("N_Nwounded_collisions", "N_Nwounded_collisions", 250, 0, 250);
00040                 Nwounded_N_collisions = dbe->book1D("Nwounded_N_collisions", "Nwounded_N_collisions", 250, 0, 250);
00041                 Nwounded_Nwounded_collisions = dbe->book1D("Nwounded_Nwounded_collisions", "Nwounded_Nwounded_collisions", 250, 0, 250);
00042                 spectator_neutrons = dbe->book1D("spectator_neutrons", "spectator_neutrons", 250, 0, 250);
00043                 spectator_protons = dbe->book1D("spectator_protons", "spectator_protons", 250, 0, 250);
00044                 impact_parameter = dbe->book1D("impact_parameter", "impact_parameter", 50, 0, 50);
00045                 event_plane_angle = dbe->book1D("event_plane_angle", "event_plane_angle", 200, -CLHEP::pi, CLHEP::pi);
00046                 eccentricity = dbe->book1D("eccentricity", "eccentricity", 200, 0, 1.0);
00047                 sigma_inel_NN = dbe->book1D("sigma_inel_NN", "sigma_inel_NN", 200, 0, 10.0);
00048 
00049         }
00050         return;
00051 }
00052 
00053 void BasicHepMCHeavyIonValidation::endJob(){return;}
00054 void BasicHepMCHeavyIonValidation::beginRun(const edm::Run& iRun,const edm::EventSetup& iSetup)
00055 {
00057         //iSetup.getData( fPDGTable );
00058         return;
00059 }
00060 void BasicHepMCHeavyIonValidation::endRun(const edm::Run& iRun,const edm::EventSetup& iSetup){return;}
00061 void BasicHepMCHeavyIonValidation::analyze(const edm::Event& iEvent,const edm::EventSetup& iSetup)
00062 { 
00064 
00066         edm::Handle<HepMCProduct> evt;
00067         iEvent.getByLabel(hepmcCollection_, evt);
00068 
00069         //Get EVENT
00070         //HepMC::GenEvent *myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
00071 
00072 
00073 
00074         const HepMC::HeavyIon* ion = evt->GetEvent()->heavy_ion();
00075 
00076         if (!ion) {
00077                 if ( QWdebug_ ) std::cout << "!!QW!! HeavyIon == null" << std::endl;
00078                 return;
00079         }
00080 
00081         double weight = _wmanager.weight(iEvent);
00082         nEvt->Fill(0.5,weight);
00083 
00084         Ncoll_hard->Fill(ion->Ncoll_hard(), weight);
00085         Npart_proj->Fill(ion->Npart_proj(), weight);
00086         Npart_targ->Fill(ion->Npart_targ(), weight);
00087         Ncoll->Fill(ion->Ncoll(), weight);
00088         N_Nwounded_collisions->Fill(ion->N_Nwounded_collisions(), weight);
00089         Nwounded_N_collisions->Fill(ion->Nwounded_N_collisions(), weight);
00090         Nwounded_Nwounded_collisions->Fill(ion->Nwounded_Nwounded_collisions(), weight);
00091         spectator_neutrons->Fill(ion->spectator_neutrons(), weight);
00092         spectator_protons->Fill(ion->spectator_protons(), weight);
00093         impact_parameter->Fill(ion->impact_parameter(), weight);
00094         event_plane_angle->Fill(ion->event_plane_angle(), weight);
00095         eccentricity->Fill(ion->eccentricity(), weight);
00096         sigma_inel_NN->Fill(ion->sigma_inel_NN(), weight);
00097 
00098 
00099         //delete myGenEvent;
00100 }//analyze