21 : g4InfoLabel(ps.getParameter<std::
string>(
"moduleLabelG4")),
36 ib.
setScope(MonitorElementData::Scope::RUN);
41 histo =
"EcalSimHitsValidation Gun Eta";
44 histo =
"EcalSimHitsValidation Gun Phi";
47 histo =
"EcalSimHitsValidation Barrel fraction of energy";
50 histo =
"EcalSimHitsValidation Endcap fraction of energy";
53 histo =
"EcalSimHitsValidation Preshower fraction of energy";
60 std::vector<PCaloHit> theEBCaloHits;
61 std::vector<PCaloHit> theEECaloHits;
62 std::vector<PCaloHit> theESCaloHits;
74 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->GetEvent()->particles_begin();
75 p != MCEvt->GetEvent()->particles_end();
77 double htheta = (*p)->momentum().theta();
78 double heta = -99999.;
79 if (
tan(htheta * 0.5) > 0) {
80 heta = -
log(
tan(htheta * 0.5));
82 double hphi = (*p)->momentum().phi();
83 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
84 hphi = hphi /
M_PI * 180.;
86 LogDebug(
"EventInfo") <<
"Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n"
87 <<
"Energy = " << (*p)->momentum().e() <<
" Eta = " << heta <<
" Phi = " << hphi;
94 double EBEnergy_ = 0.;
96 theEBCaloHits.insert(theEBCaloHits.end(), EcalHitsEB->begin(), EcalHitsEB->end());
97 for (std::vector<PCaloHit>::iterator isim = theEBCaloHits.begin(); isim != theEBCaloHits.end(); ++isim) {
98 EBEnergy_ += isim->energy();
102 double EEEnergy_ = 0.;
104 theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
105 for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
106 EEEnergy_ += isim->energy();
110 double ESEnergy_ = 0.;
112 theESCaloHits.insert(theESCaloHits.end(), EcalHitsES->begin(), EcalHitsES->end());
113 for (std::vector<PCaloHit>::iterator isim = theESCaloHits.begin(); isim != theESCaloHits.end(); ++isim) {
114 ESEnergy_ += isim->energy();
118 double etot = EBEnergy_ + EEEnergy_ + ESEnergy_;
124 fracEB = EBEnergy_ / etot;
125 fracEE = EEEnergy_ / etot;
126 fracES = ESEnergy_ / etot;
MonitorElement * meEBEnergyFraction_
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
static std::vector< std::string > checklist log
const edm::EventSetup & c
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void bookHistograms(DQMStore::IBooker &ib, edm::Run const &, edm::EventSetup const &c) override
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
edm::EDGetTokenT< edm::PCaloHitContainer > EBHitsCollectionToken
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken
MonitorElement * meGunEnergy_
MonitorElement * meGunEta_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsCollectionToken
EcalSimHitsValidation(const edm::ParameterSet &ps)
Constructor.
edm::EDGetTokenT< edm::PCaloHitContainer > ESHitsCollectionToken
Log< level::Info, false > LogInfo
MonitorElement * meEEEnergyFraction_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
T getParameter(std::string const &) const
MonitorElement * meESEnergyFraction_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meGunPhi_