21 : g4InfoLabel(ps.getParameter<
std::
string>(
"moduleLabelG4")),
33 if (!outputFile_.empty()) {
34 edm::LogInfo(
"OutputInfo") <<
" Ecal SimHits Task histograms will be saved to " << outputFile_.c_str();
36 edm::LogInfo(
"OutputInfo") <<
" Ecal SimHits Task histograms will NOT be saved";
50 dbe_->showDirStructure();
63 dbe_->setCurrentFolder(
"EcalHitsV/EcalSimHitsValidation");
65 sprintf(histo,
"EcalSimHitsValidation Gun Momentum");
66 meGunEnergy_ = dbe_->book1D(histo, histo, 100, 0., 1000.);
68 sprintf(histo,
"EcalSimHitsValidation Gun Eta");
69 meGunEta_ = dbe_->book1D(histo, histo, 700, -3.5, 3.5);
71 sprintf(histo,
"EcalSimHitsValidation Gun Phi");
72 meGunPhi_ = dbe_->book1D(histo, histo, 360, 0., 360.);
74 sprintf(histo,
"EcalSimHitsValidation Barrel fraction of energy");
77 sprintf(histo,
"EcalSimHitsValidation Endcap fraction of energy");
80 sprintf(histo,
"EcalSimHitsValidation Preshower fraction of energy");
97 std::vector<PCaloHit> theEBCaloHits;
98 std::vector<PCaloHit> theEECaloHits;
99 std::vector<PCaloHit> theESCaloHits;
111 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
114 double htheta = (*p)->momentum().theta();
115 double heta = -99999.;
116 if (
tan(htheta * 0.5) > 0) {
117 heta = -
log(
tan(htheta * 0.5));
119 double hphi = (*p)->momentum().phi();
120 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
121 hphi = hphi /
M_PI * 180.;
123 LogDebug(
"EventInfo") <<
"Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n" 124 <<
"Energy = " << (*p)->momentum().e() <<
" Eta = " << heta <<
" Phi = " << hphi;
134 double EBEnergy_ = 0.;
136 theEBCaloHits.insert(theEBCaloHits.end(), EcalHitsEB->begin(), EcalHitsEB->end());
137 for (std::vector<PCaloHit>::iterator isim = theEBCaloHits.begin(); isim != theEBCaloHits.end(); ++isim) {
138 EBEnergy_ += isim->energy();
142 double EEEnergy_ = 0.;
144 theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
145 for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
146 EEEnergy_ += isim->energy();
150 double ESEnergy_ = 0.;
152 theESCaloHits.insert(theESCaloHits.end(), EcalHitsES->begin(), EcalHitsES->end());
153 for (std::vector<PCaloHit>::iterator isim = theESCaloHits.begin(); isim != theESCaloHits.end(); ++isim) {
154 ESEnergy_ += isim->energy();
158 double etot = EBEnergy_ + EEEnergy_ + ESEnergy_;
164 fracEB = EBEnergy_ / etot;
165 fracEE = EEEnergy_ / etot;
166 fracES = ESEnergy_ / etot;
MonitorElement * meEBEnergyFraction_
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~EcalSimHitsValidation() override
Destructor.
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.
Namespace of DDCMS conversion namespace.
edm::EDGetTokenT< edm::PCaloHitContainer > ESHitsCollectionToken
const HepMC::GenEvent * GetEvent() const
MonitorElement * meEEEnergyFraction_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * meESEnergyFraction_
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
void endJob(void) override
MonitorElement * meGunPhi_