60 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will be saved to '" <<
outputFile_.c_str() <<
"'";
62 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will NOT be saved";
130 histo =
"EcalRecHitsTask Gun Momentum";
133 histo =
"EcalRecHitsTask Gun Eta";
136 histo =
"EcalRecHitsTask Gun Phi";
139 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio";
142 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio gt 3p5 GeV";
145 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio";
148 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=10 11";
151 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=12";
154 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=13";
157 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio gt 3p5 GeV";
160 histo =
"EcalRecHitsTask Barrel Rec E5x5";
163 histo =
"EcalRecHitsTask Barrel Rec E5x5 over Sim E5x5";
166 histo =
"EcalRecHitsTask Barrel Rec E5x5 over gun energy";
170 ibooker.
book1D(
"EcalRecHitsTask Barrel Log10 Energy",
"EcalRecHitsTask Barrel Log10 Energy", 90, -5., 4.);
172 "EcalRecHits Barrel Log10En vs Hit Contribution",
180 "EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
188 histo =
"EB Occupancy Flag=5 6";
190 histo =
"EB Occupancy Flag=8 9";
193 histo =
"EcalRecHitsTask Barrel Reco Flags";
195 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio vs SimHit Flag=5 6";
197 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=6";
199 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=7";
201 histo =
"EcalRecHitsTask Barrel 5x5 RecSimHit Ratio vs SimHit Flag=8";
205 histo =
"EcalRecHitsTask Preshower RecSimHit Ratio";
208 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio";
211 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio gt 3p5 GeV";
214 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio";
217 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=10 11";
220 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=12";
223 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=13";
226 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio gt 3p5 GeV";
229 histo =
"EcalRecHitsTask Endcap Rec E5x5";
232 histo =
"EcalRecHitsTask Endcap Rec E5x5 over Sim E5x5";
235 histo =
"EcalRecHitsTask Endcap Rec E5x5 over gun energy";
239 ibooker.
book1D(
"EcalRecHitsTask Endcap Log10 Energy",
"EcalRecHitsTask Endcap Log10 Energy", 90, -5., 4.);
241 ibooker.
book1D(
"EcalRecHitsTask Preshower Log10 Energy",
"EcalRecHitsTask Preshower Log10 Energy", 90, -5., 4.);
244 "EcalRecHits Endcap Log10En vs Hit Contribution",
252 "EcalRecHits Preshower Log10En vs Hit Contribution",
261 "EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
269 histo =
"EE+ Occupancy Flag=5 6";
271 histo =
"EE- Occupancy Flag=5 6";
273 histo =
"EE+ Occupancy Flag=8 9";
275 histo =
"EE- Occupancy Flag=8 9";
278 histo =
"EcalRecHitsTask Endcap Reco Flags";
281 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio vs SimHit Flag=5 6";
284 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=6";
287 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=7";
295 LogInfo(
"EcalRecHitsTask, EventInfo: ") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
299 const double barrelADCtoGeV_ = agc->
getEBValue();
300 const double endcapADCtoGeV_ = agc->
getEEValue();
311 bool skipBarrel =
false;
315 if (EcalUncalibRecHitEB.
isValid()) {
321 bool skipEndcap =
false;
326 if (EcalUncalibRecHitEE.
isValid()) {
354 bool skipPreshower =
false;
360 ESRecHit = EcalRecHitES.
product();
362 skipPreshower =
true;
365 skipPreshower =
true;
371 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
374 double htheta = (*p)->momentum().theta();
375 double heta = -99999.;
376 if (
tan(htheta * 0.5) > 0) {
377 heta = -
log(
tan(htheta * 0.5));
379 double hphi = (*p)->momentum().phi();
380 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
381 hphi = hphi /
M_PI * 180.;
383 LogDebug(
"EventInfo") <<
"EcalRecHitsTask: Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n" 384 <<
"Energy = " << (*p)->momentum().e() <<
"\n" 385 <<
"Eta = " << heta <<
"\n" 388 if ((*p)->momentum().e() > eGun)
389 eGun = (*p)->momentum().e();
410 const int ebcSize = 90;
411 double ebcontr[ebcSize];
412 double ebcontr25[ebcSize];
413 for (
int i = 0;
i < ebcSize;
i++) {
422 LogDebug(
"SimHitInfo, barrel") <<
"CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 423 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 424 <<
"EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi();
426 uint32_t crystid = ebid.
rawId();
427 ebSimMap[crystid] += iHit.energy();
440 ebRecMap[EBid.
rawId()] += myRecHit->energy();
443 ebtotal += myRecHit->energy();
444 if (myRecHit->energy() > 0) {
447 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
448 if (log10i >= 0 and log10i < ebcSize)
449 ebcontr[log10i] += myRecHit->energy();
453 if (ebSimMap[EBid.
rawId()] != 0.) {
454 double uncEnergy = uncalibRecHit->amplitude() * barrelADCtoGeV_;
464 if (ebSimMap[EBid.
rawId()] != 0.) {
479 if (ecs !=
nullptr) {
482 if (csmi != ecs->
end())
484 sc =
csc.getStatusCode();
496 if (pttMap.isValid())
498 double ttSimEnergy = 0;
499 if (ttMap !=
nullptr) {
502 for (std::vector<DetId>::const_iterator dit =
vid.begin(); dit !=
vid.end(); dit++) {
504 ttSimEnergy += ebSimMap[ttEBid.
rawId()];
507 ttSimEnergy = ttSimEnergy /
vid.size();
512 int flag = myRecHit->recoFlag();
539 int by = myEBid.
iphi();
540 int bz = myEBid.
zside();
549 if (log10i25 >= 0 && log10i25 < ebcSize)
562 for (
int i = 0;
i < ebcSize;
i++) {
568 for (
int i = 0;
i < ebcSize;
i++) {
584 const int eecSize = 90;
585 double eecontr[eecSize];
586 double eecontr25[eecSize];
587 for (
int i = 0;
i < eecSize;
i++) {
596 LogDebug(
"Endcap, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 597 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 598 <<
"EEDetId side " << eeid.zside() <<
" = " << eeid.ix() <<
" " << eeid.iy();
600 uint32_t crystid = eeid.rawId();
601 eeSimMap[crystid] += iHit.energy();
614 eeRecMap[EEid.
rawId()] += myRecHit->energy();
617 eetotal += myRecHit->energy();
618 if (myRecHit->energy() > 0) {
621 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
622 if (log10i >= 0 and log10i < eecSize)
623 eecontr[log10i] += myRecHit->energy();
627 if (eeSimMap[EEid.
rawId()] != 0.) {
628 double uncEnergy = uncalibRecHit->amplitude() * endcapADCtoGeV_;
638 if (eeSimMap[EEid.
rawId()] != 0.) {
650 if (ecs !=
nullptr) {
653 if (csmi != ecs->
end())
655 uint16_t sc =
csc.getStatusCode();
667 int flag = myRecHit->recoFlag();
678 if (EEid.
zside() > 0) {
686 if (EEid.
zside() < 0) {
702 int bx = myEEid.
ix();
703 int by = myEEid.
iy();
704 int bz = myEEid.
zside();
713 if (log10i25 >= 0 && log10i25 < eecSize)
726 for (
int i = 0;
i < eecSize;
i++) {
732 for (
int i = 0;
i < eecSize;
i++) {
741 if (!skipPreshower) {
747 const int escSize = 90;
748 double escontr[escSize];
749 for (
int i = 0;
i < escSize;
i++) {
756 LogDebug(
"Preshower, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 757 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 758 <<
"ESDetId strip " << esid.strip() <<
" = " << esid.six() <<
" " << esid.siy();
760 uint32_t crystid = esid.rawId();
761 esSimMap[crystid] += iHit.energy();
767 if (esSimMap[ESid.
rawId()] != 0.) {
769 estotal +=
recHit->energy();
770 if (
recHit->energy() > 0) {
773 int log10i =
int((log10(
recHit->energy()) + 5.) * 10.);
774 if (log10i >= 0 and log10i < escSize)
775 escontr[log10i] +=
recHit->energy();
786 for (
int i = 0;
i < escSize;
i++) {
795 uint32_t unitWithMaxEnergy = 0;
798 MapType::iterator iter;
799 for (iter = themap.begin(); iter != themap.end(); iter++) {
802 unitWithMaxEnergy = (*iter).first;
806 return unitWithMaxEnergy;
810 int nCellInEta,
int nCellInPhi,
int CentralEta,
int CentralPhi,
int CentralZ,
MapType &themap) {
811 int goBackInEta = nCellInEta / 2;
812 int goBackInPhi = nCellInPhi / 2;
813 int matrixSize = nCellInEta * nCellInPhi;
817 int startEta = CentralZ * CentralEta - goBackInEta;
818 int startPhi = CentralPhi - goBackInPhi;
821 for (
int ieta = startEta;
ieta < startEta + nCellInEta;
ieta++) {
822 for (
int iphi = startPhi;
iphi < startPhi + nCellInPhi;
iphi++) {
829 }
else if (
iphi > 360) {
840 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &themap) {
841 int goBackInX = nCellInX / 2;
842 int goBackInY = nCellInY / 2;
845 int startX = CentralX - goBackInX;
846 int startY = CentralY - goBackInY;
848 for (
int ix = startX; ix < startX + nCellInX; ix++) {
849 for (
int iy = startY; iy < startY + nCellInY; iy++) {
MonitorElement * meEERecHitsOccupancyPlusFlag5_6_
MonitorElement * meEBRecHitSimHitRatio13_
edm::InputTag ESrechitCollection_
T getParameter(std::string const &) const
MonitorElement * meEBRecHitLog10Energy5x5Contr_
int ietaAbs() const
get the absolute value of the crystal ieta
MonitorElement * meEBRecHitSimHitRatio1011_
MonitorElement * meEBRecHitSimHitFlag7_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * meEBRecHitSimHitRatio12_
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
virtual void setCurrentFolder(std::string const &fullpath)
EcalRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
int iphi() const
get the crystal iphi
MonitorElement * meEERecHitSimHitRatio12_
T const * product() const
std::vector< T >::const_iterator const_iterator
MonitorElement * meEERecHitsOccupancyMinusFlag5_6_
edm::EDGetTokenT< ESRecHitCollection > ESrechitCollection_Token_
MonitorElement * meEERecHitSimHitRatio13_
MonitorElement * meEBe5x5OverSimHits_
uint32_t getUnitWithMaxEnergy(MapType &themap)
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > pttMapToken
MonitorElement * meEBRecHitSimHitFlag6_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
MonitorElement * meEB5x5RecHitSimHitvsSimHitFlag8_
edm::EDGetTokenT< EERecHitCollection > EErechitCollection_Token_
int ieta() const
get the crystal ieta
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag EBuncalibrechitCollection_
std::map< uint32_t, float, std::less< uint32_t > > MapType
~EcalRecHitsValidation() override
Destructor.
MonitorElement * meEBUnRecHitSimHitRatio_
MonitorElement * meEBRecHitLog10EnergyContr_
void findEndcapMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap)
MonitorElement * meEBRecHitsOccupancyFlag8_9_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * meGunPhi_
MonitorElement * meEERecHitLog10EnergyContr_
MonitorElement * meGunEnergy_
MonitorElement * meEERecHitsOccupancyMinusFlag8_9_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
MonitorElement * meEERecHitFlags_
const_iterator begin() const
int zside() const
get the z-side of the crystal (1/-1)
MonitorElement * meEERecHitSimHitFlag6_
MonitorElement * meEEUnRecHitSimHitRatioGt35_
MonitorElement * meEEUnRecHitSimHitRatio_
const HepMC::GenEvent * GetEvent() const
const_iterator find(uint32_t rawId) const
MonitorElement * meEERecHitSimHitRatioGt35_
edm::InputTag EEuncalibrechitCollection_
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEERecHitSimHitFlag7_
Namespace of DDCMS conversion namespace.
const_iterator end() const
MonitorElement * meEBRecHitSimHitRatioGt35_
edm::EDGetTokenT< EEUncalibratedRecHitCollection > EEuncalibrechitCollection_Token_
Log< level::Info, false > LogInfo
edm::EDGetTokenT< EBRecHitCollection > EBrechitCollection_Token_
MonitorElement * meESRecHitLog10Energy_
edm::InputTag EBrechitCollection_
constexpr uint32_t rawId() const
get the raw id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
MonitorElement * meEBRecHitSimHitvsSimHitFlag5_6_
std::string hitsProducer_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > pEcsToken
std::vector< Item >::const_iterator const_iterator
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * meEERecHitSimHitvsSimHitFlag5_6_
MonitorElement * meEBRecHitFlags_
MonitorElement * meEEe5x5_
MonitorElement * meEERecHitLog10Energy_
MonitorElement * meEBRecHitLog10Energy_
edm::EDGetTokenT< EBUncalibratedRecHitCollection > EBuncalibrechitCollection_Token_
MonitorElement * meEBe5x5_
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
MonitorElement * meEBUnRecHitSimHitRatioGt35_
void findBarrelMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &themap)
std::vector< uint32_t > crystalMatrix
MonitorElement * meEERecHitLog10Energy5x5Contr_
MonitorElement * meGunEta_
MonitorElement * meESRecHitLog10EnergyContr_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
const_iterator end() const
MonitorElement * meEERecHitsOccupancyPlusFlag8_9_
MonitorElement * meESRecHitSimHitRatio_
MonitorElement * meEBRecHitSimHitRatio_
edm::InputTag EErechitCollection_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meEBRecHitsOccupancyFlag5_6_
MonitorElement * meEEe5x5OverGun_
MonitorElement * meEERecHitSimHitRatio1011_
MonitorElement * meEEe5x5OverSimHits_
edm::EDGetTokenT< edm::HepMCProduct > HepMCLabel_Token_
MonitorElement * meEBe5x5OverGun_
MonitorElement * meEERecHitSimHitRatio_