#include <Validation/HcalHits/interface/HcalSimHitStudy.h>
Definition at line 28 of file HcalSimHitStudy.h.
HcalSimHitStudy::HcalSimHitStudy | ( | const edm::ParameterSet & | ps | ) |
Definition at line 6 of file HcalSimHitStudy.cc.
References checkHit_, dbe_, g4Label, edm::ParameterSet::getUntrackedParameter(), hcalHits, outFile_, DQMStore::setVerbose(), DQMStore::showDirStructure(), and verbose_.
00006 { 00007 00008 g4Label = ps.getUntrackedParameter<std::string>("moduleLabel","g4SimHits"); 00009 hcalHits = ps.getUntrackedParameter<std::string>("HitCollection","HcalHits"); 00010 outFile_ = ps.getUntrackedParameter<std::string>("outputFile", "hcHit.root"); 00011 verbose_ = ps.getUntrackedParameter<bool>("Verbose", false); 00012 checkHit_= true; 00013 00014 edm::LogInfo("HcalSim") << "Module Label: " << g4Label << " Hits: " 00015 << hcalHits << " / "<< checkHit_ 00016 << " Output: " << outFile_; 00017 00018 dbe_ = edm::Service<DQMStore>().operator->(); 00019 if (dbe_) { 00020 if (verbose_) { 00021 dbe_->setVerbose(1); 00022 sleep (3); 00023 dbe_->showDirStructure(); 00024 } else { 00025 dbe_->setVerbose(0); 00026 } 00027 } 00028 }
HcalSimHitStudy::~HcalSimHitStudy | ( | ) |
void HcalSimHitStudy::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 95 of file HcalSimHitStudy.cc.
References analyzeHits(), checkHit_, g4Label, edm::Event::getByLabel(), hcalHits, edm::Event::id(), edm::Handle< T >::isValid(), and LogDebug.
00095 { 00096 00097 LogDebug("HcalSim") << "Run = " << e.id().run() << " Event = " 00098 << e.id().event(); 00099 00100 std::vector<PCaloHit> caloHits; 00101 edm::Handle<edm::PCaloHitContainer> hitsHcal; 00102 00103 bool getHits = false; 00104 if (checkHit_) { 00105 e.getByLabel(g4Label,hcalHits,hitsHcal); 00106 if (hitsHcal.isValid()) getHits = true; 00107 } 00108 00109 LogDebug("HcalSim") << "HcalValidation: Input flags Hits " << getHits; 00110 00111 if (getHits) { 00112 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end()); 00113 LogDebug("HcalSim") << "HcalValidation: Hit buffer " 00114 << caloHits.size(); 00115 analyzeHits (caloHits); 00116 } 00117 }
Definition at line 119 of file HcalSimHitStudy.cc.
References dbe_, relval_parameters_module::energy, eta, MonitorElement::Fill(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, int, LogDebug, meAllNHit_, meBadDetHit_, meBadIdHit_, meBadSubHit_, meDepthHit_, meDetectHit_, meEnergyHit_, meEtaHit_, meHBDepHit_, meHBEneHit2_, meHBEneHit_, meHBEtaHit_, meHBL10Ene_, meHBL10EneP_, meHBNHit_, meHBPhiHit_, meHBTimHit_, meHEDepHit_, meHEEneHit2_, meHEEneHit_, meHEEtaHit_, meHEL10Ene_, meHEL10EneP_, meHENHit_, meHEPhiHit_, meHETimHit_, meHFDepHit_, meHFEneHit2_, meHFEneHit_, meHFEtaHit_, meHFL10Ene_, meHFL10EneP_, meHFNHit_, meHFPhiHit_, meHFTimHit_, meHODepHit_, meHOEneHit2_, meHOEneHit_, meHOEtaHit_, meHOL10Ene_, meHOL10EneP_, meHONHit_, meHOPhiHit_, meHOTimHit_, mePhiHit_, meSubdetHit_, meTimeHit_, meTimeWHit_, and phi.
Referenced by analyze().
00119 { 00120 00121 int nHit = hits.size(); 00122 int nHB=0, nHE=0, nHO=0, nHF=0, nBad1=0, nBad2=0, nBad=0; 00123 std::vector<double> encontHB(140, 0.); 00124 std::vector<double> encontHE(140, 0.); 00125 std::vector<double> encontHF(140, 0.); 00126 std::vector<double> encontHO(140, 0.); 00127 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0; 00128 00129 for (int i=0; i<nHit; i++) { 00130 double energy = hits[i].energy(); 00131 double log10en = log10(energy); 00132 int log10i = int( (log10en+10.)*10. ); 00133 double time = hits[i].time(); 00134 unsigned int id_ = hits[i].id(); 00135 HcalDetId id = HcalDetId(id_); 00136 int det = id.det(); 00137 int subdet = id.subdet(); 00138 int depth = id.depth(); 00139 int eta = id.ieta(); 00140 int phi = id.iphi(); 00141 LogDebug("HcalSim") << "Hit[" << i << "] ID " << std::hex << id_ 00142 << std::dec << " Det " << det << " Sub " 00143 << subdet << " depth " << depth << " Eta " << eta 00144 << " Phi " << phi << " E " << energy << " time " 00145 << time; 00146 if (det == 4) { // Check DetId.h 00147 if (subdet == static_cast<int>(HcalBarrel)) nHB++; 00148 else if (subdet == static_cast<int>(HcalEndcap)) nHE++; 00149 else if (subdet == static_cast<int>(HcalOuter)) nHO++; 00150 else if (subdet == static_cast<int>(HcalForward)) nHF++; 00151 else { nBad++; nBad2++;} 00152 } else { nBad++; nBad1++;} 00153 if (dbe_) { 00154 meDetectHit_->Fill(double(det)); 00155 if (det == 4) { 00156 meSubdetHit_->Fill(double(subdet)); 00157 meDepthHit_->Fill(double(depth)); 00158 meEtaHit_->Fill(double(eta)); 00159 mePhiHit_->Fill(double(phi)); 00160 meEnergyHit_->Fill(energy); 00161 meTimeHit_->Fill(time); 00162 meTimeWHit_->Fill(double(time),energy); 00163 if (subdet == static_cast<int>(HcalBarrel)) { 00164 meHBDepHit_->Fill(double(depth)); 00165 meHBEtaHit_->Fill(double(eta)); 00166 meHBPhiHit_->Fill(double(phi)); 00167 meHBEneHit_->Fill(energy); 00168 meHBEneHit2_->Fill(energy); 00169 meHBTimHit_->Fill(time); 00170 meHBL10Ene_->Fill(log10en); 00171 if( log10i >=0 && log10i < 140 ) encontHB[log10i] += energy; 00172 entotHB += energy; 00173 } else if (subdet == static_cast<int>(HcalEndcap)) { 00174 meHEDepHit_->Fill(double(depth)); 00175 meHEEtaHit_->Fill(double(eta)); 00176 meHEPhiHit_->Fill(double(phi)); 00177 meHEEneHit_->Fill(energy); 00178 meHEEneHit2_->Fill(energy); 00179 meHETimHit_->Fill(time); 00180 meHEL10Ene_->Fill(log10en); 00181 if( log10i >=0 && log10i < 140 ) encontHE[log10i] += energy; 00182 entotHE += energy; 00183 } else if (subdet == static_cast<int>(HcalOuter)) { 00184 meHODepHit_->Fill(double(depth)); 00185 meHOEtaHit_->Fill(double(eta)); 00186 meHOPhiHit_->Fill(double(phi)); 00187 meHOEneHit_->Fill(energy); 00188 meHOEneHit2_->Fill(energy); 00189 meHOTimHit_->Fill(time); 00190 meHOL10Ene_->Fill(log10en); 00191 if( log10i >=0 && log10i < 140 ) encontHO[log10i] += energy; 00192 entotHO += energy; 00193 } else if (subdet == static_cast<int>(HcalForward)) { 00194 meHFDepHit_->Fill(double(depth)); 00195 meHFEtaHit_->Fill(double(eta)); 00196 meHFPhiHit_->Fill(double(phi)); 00197 meHFEneHit_->Fill(energy); 00198 meHFEneHit2_->Fill(energy); 00199 meHFTimHit_->Fill(time); 00200 meHFL10Ene_->Fill(log10en); 00201 if( log10i >=0 && log10i < 140 ) encontHF[log10i] += energy; 00202 entotHF += energy; 00203 } 00204 } 00205 } 00206 } 00207 if( entotHB != 0 ) for( int i=0; i<140; i++ ) meHBL10EneP_->Fill( -10.+(float(i)+0.5)/10., encontHB[i]/entotHB ); 00208 if( entotHE != 0 ) for( int i=0; i<140; i++ ) meHEL10EneP_->Fill( -10.+(float(i)+0.5)/10., encontHE[i]/entotHE ); 00209 if( entotHF != 0 ) for( int i=0; i<140; i++ ) meHFL10EneP_->Fill( -10.+(float(i)+0.5)/10., encontHF[i]/entotHF ); 00210 if( entotHO != 0 ) for( int i=0; i<140; i++ ) meHOL10EneP_->Fill( -10.+(float(i)+0.5)/10., encontHO[i]/entotHO ); 00211 00212 if (dbe_) { 00213 meAllNHit_->Fill(double(nHit)); 00214 meBadDetHit_->Fill(double(nBad1)); 00215 meBadSubHit_->Fill(double(nBad2)); 00216 meBadIdHit_->Fill(double(nBad)); 00217 meHBNHit_->Fill(double(nHB)); 00218 meHENHit_->Fill(double(nHE)); 00219 meHONHit_->Fill(double(nHO)); 00220 meHFNHit_->Fill(double(nHF)); 00221 } 00222 LogDebug("HcalSim") << "HcalSimHitStudy::analyzeHits: HB " << nHB 00223 << " HE " << nHE << " HO " << nHO << " HF " << nHF 00224 << " Bad " << nBad << " All " << nHit; 00225 00226 }
void HcalSimHitStudy::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 34 of file HcalSimHitStudy.cc.
References DQMStore::book1D(), DQMStore::bookProfile(), checkHit_, dbe_, meAllNHit_, meBadDetHit_, meBadIdHit_, meBadSubHit_, meDepthHit_, meDetectHit_, meEnergyHit_, meEtaHit_, meHBDepHit_, meHBEneHit2_, meHBEneHit_, meHBEtaHit_, meHBL10Ene_, meHBL10EneP_, meHBNHit_, meHBPhiHit_, meHBTimHit_, meHEDepHit_, meHEEneHit2_, meHEEneHit_, meHEEtaHit_, meHEL10Ene_, meHEL10EneP_, meHENHit_, meHEPhiHit_, meHETimHit_, meHFDepHit_, meHFEneHit2_, meHFEneHit_, meHFEtaHit_, meHFL10Ene_, meHFL10EneP_, meHFNHit_, meHFPhiHit_, meHFTimHit_, meHODepHit_, meHOEneHit2_, meHOEneHit_, meHOEtaHit_, meHOL10Ene_, meHOL10EneP_, meHONHit_, meHOPhiHit_, meHOTimHit_, mePhiHit_, meSubdetHit_, meTimeHit_, meTimeWHit_, and DQMStore::setCurrentFolder().
00034 { 00035 00036 if (dbe_) { 00037 dbe_->setCurrentFolder("HcalHitsV/HcalSimHitsTask"); 00038 00039 //Histograms for Hits 00040 if (checkHit_) { 00041 meAllNHit_ = dbe_->book1D("Hit01","Number of Hits in HCal",1000,0.,1000.); 00042 meBadDetHit_= dbe_->book1D("Hit02","Hits with wrong Det", 100,0.,100.); 00043 meBadSubHit_= dbe_->book1D("Hit03","Hits with wrong Subdet",100,0.,100.); 00044 meBadIdHit_ = dbe_->book1D("Hit04","Hits with wrong ID", 100,0.,100.); 00045 meHBNHit_ = dbe_->book1D("Hit05","Number of Hits in HB",1000,0.,1000.); 00046 meHENHit_ = dbe_->book1D("Hit06","Number of Hits in HE",1000,0.,1000.); 00047 meHONHit_ = dbe_->book1D("Hit07","Number of Hits in HO",1000,0.,1000.); 00048 meHFNHit_ = dbe_->book1D("Hit08","Number of Hits in HF",1000,0.,1000.); 00049 meDetectHit_= dbe_->book1D("Hit09","Detector ID", 50,0.,50.); 00050 meSubdetHit_= dbe_->book1D("Hit10","Subdetectors in HCal", 50,0.,50.); 00051 meDepthHit_ = dbe_->book1D("Hit11","Depths in HCal", 20,0.,20.); 00052 meEtaHit_ = dbe_->book1D("Hit12","Eta in HCal", 100,-50.,50.); 00053 mePhiHit_ = dbe_->book1D("Hit13","Phi in HCal", 100,0.,100.); 00054 meEnergyHit_= dbe_->book1D("Hit14","Energy in HCal", 100,0.,1.); 00055 meTimeHit_ = dbe_->book1D("Hit15","Time in HCal", 100,0.,400.); 00056 meTimeWHit_ = dbe_->book1D("Hit16","Time in HCal (E wtd)", 100,0.,400.); 00057 meHBDepHit_ = dbe_->book1D("Hit17","Depths in HB", 20,0.,20.); 00058 meHEDepHit_ = dbe_->book1D("Hit18","Depths in HE", 20,0.,20.); 00059 meHODepHit_ = dbe_->book1D("Hit19","Depths in HO", 20,0.,20.); 00060 meHFDepHit_ = dbe_->book1D("Hit20","Depths in HF", 20,0.,20.); 00061 meHBEtaHit_ = dbe_->book1D("Hit21","Eta in HB", 100,-50.,50.); 00062 meHEEtaHit_ = dbe_->book1D("Hit22","Eta in HE", 100,-50.,50.); 00063 meHOEtaHit_ = dbe_->book1D("Hit23","Eta in HO", 100,-50.,50.); 00064 meHFEtaHit_ = dbe_->book1D("Hit24","Eta in HF", 100,-50.,50.); 00065 meHBPhiHit_ = dbe_->book1D("Hit25","Phi in HB", 100,0.,100.); 00066 meHEPhiHit_ = dbe_->book1D("Hit26","Phi in HE", 100,0.,100.); 00067 meHOPhiHit_ = dbe_->book1D("Hit27","Phi in HO", 100,0.,100.); 00068 meHFPhiHit_ = dbe_->book1D("Hit28","Phi in HF", 100,0.,100.); 00069 meHBEneHit_ = dbe_->book1D("Hit29","Energy in HB", 100,0.,1.); 00070 meHEEneHit_ = dbe_->book1D("Hit30","Energy in HE", 100,0.,1.); 00071 meHOEneHit_ = dbe_->book1D("Hit31","Energy in HO", 100,0.,1.); 00072 meHFEneHit_ = dbe_->book1D("Hit32","Energy in HF", 100,0.,100.); 00073 meHBTimHit_ = dbe_->book1D("Hit33","Time in HB", 100,0.,400.); 00074 meHETimHit_ = dbe_->book1D("Hit34","Time in HE", 100,0.,400.); 00075 meHOTimHit_ = dbe_->book1D("Hit35","Time in HO", 100,0.,400.); 00076 meHFTimHit_ = dbe_->book1D("Hit36","Time in HF", 100,0.,400.); 00077 meHBEneHit2_ = dbe_->book1D("Hit37","Energy in HB 2", 100,0.,0.0001); 00078 meHEEneHit2_ = dbe_->book1D("Hit38","Energy in HE 2", 100,0.,0.0001); 00079 meHOEneHit2_ = dbe_->book1D("Hit39","Energy in HO 2", 100,0.,0.0001); 00080 meHFEneHit2_ = dbe_->book1D("Hit40","Energy in HF 2", 100,0.,0.0001); 00081 meHBL10Ene_ = dbe_->book1D("Hit41","Log10Energy in HB", 140, -10., 4. ); 00082 meHEL10Ene_ = dbe_->book1D("Hit42","Log10Energy in HE", 140, -10., 4. ); 00083 meHFL10Ene_ = dbe_->book1D("Hit43","Log10Energy in HF", 140, -10., 4. ); 00084 meHOL10Ene_ = dbe_->book1D("Hit44","Log10Energy in HO", 140, -10., 4. ); 00085 meHBL10EneP_ = dbe_->bookProfile("Hit45","Log10Energy in HB vs Hit contribution", 140, -10., 4., 100, 0., 1. ); 00086 meHEL10EneP_ = dbe_->bookProfile("Hit46","Log10Energy in HE vs Hit contribution", 140, -10., 4., 100, 0., 1. ); 00087 meHFL10EneP_ = dbe_->bookProfile("Hit47","Log10Energy in HF vs Hit contribution", 140, -10., 4., 100, 0., 1. ); 00088 meHOL10EneP_ = dbe_->bookProfile("Hit48","Log10Energy in HO vs Hit contribution", 140, -10., 4., 100, 0., 1. ); 00089 } 00090 } 00091 }
bool HcalSimHitStudy::checkHit_ [private] |
Definition at line 45 of file HcalSimHitStudy.h.
Referenced by analyze(), beginJob(), and HcalSimHitStudy().
DQMStore* HcalSimHitStudy::dbe_ [private] |
Definition at line 46 of file HcalSimHitStudy.h.
Referenced by analyzeHits(), beginJob(), HcalSimHitStudy(), and ~HcalSimHitStudy().
std::string HcalSimHitStudy::g4Label [private] |
std::string HcalSimHitStudy::hcalHits [private] |
MonitorElement* HcalSimHitStudy::meAllNHit_ [private] |
MonitorElement * HcalSimHitStudy::meBadDetHit_ [private] |
MonitorElement * HcalSimHitStudy::meBadIdHit_ [private] |
MonitorElement * HcalSimHitStudy::meBadSubHit_ [private] |
MonitorElement * HcalSimHitStudy::meDepthHit_ [private] |
MonitorElement* HcalSimHitStudy::meDetectHit_ [private] |
MonitorElement * HcalSimHitStudy::meEnergyHit_ [private] |
MonitorElement * HcalSimHitStudy::meEtaHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBDepHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBEneHit2_ [private] |
MonitorElement* HcalSimHitStudy::meHBEneHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBEtaHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBL10Ene_ [private] |
MonitorElement* HcalSimHitStudy::meHBL10EneP_ [private] |
MonitorElement* HcalSimHitStudy::meHBNHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBPhiHit_ [private] |
MonitorElement* HcalSimHitStudy::meHBTimHit_ [private] |
MonitorElement * HcalSimHitStudy::meHEDepHit_ [private] |
MonitorElement * HcalSimHitStudy::meHEEneHit2_ [private] |
MonitorElement * HcalSimHitStudy::meHEEneHit_ [private] |
MonitorElement * HcalSimHitStudy::meHEEtaHit_ [private] |
MonitorElement * HcalSimHitStudy::meHEL10Ene_ [private] |
MonitorElement * HcalSimHitStudy::meHEL10EneP_ [private] |
MonitorElement * HcalSimHitStudy::meHENHit_ [private] |
MonitorElement * HcalSimHitStudy::meHEPhiHit_ [private] |
MonitorElement * HcalSimHitStudy::meHETimHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFDepHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFEneHit2_ [private] |
MonitorElement * HcalSimHitStudy::meHFEneHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFEtaHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFL10Ene_ [private] |
MonitorElement * HcalSimHitStudy::meHFL10EneP_ [private] |
MonitorElement * HcalSimHitStudy::meHFNHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFPhiHit_ [private] |
MonitorElement * HcalSimHitStudy::meHFTimHit_ [private] |
MonitorElement * HcalSimHitStudy::meHODepHit_ [private] |
MonitorElement * HcalSimHitStudy::meHOEneHit2_ [private] |
MonitorElement * HcalSimHitStudy::meHOEneHit_ [private] |
MonitorElement * HcalSimHitStudy::meHOEtaHit_ [private] |
MonitorElement * HcalSimHitStudy::meHOL10Ene_ [private] |
MonitorElement * HcalSimHitStudy::meHOL10EneP_ [private] |
MonitorElement * HcalSimHitStudy::meHONHit_ [private] |
MonitorElement * HcalSimHitStudy::meHOPhiHit_ [private] |
MonitorElement * HcalSimHitStudy::meHOTimHit_ [private] |
MonitorElement* HcalSimHitStudy::mePhiHit_ [private] |
MonitorElement * HcalSimHitStudy::meSubdetHit_ [private] |
MonitorElement * HcalSimHitStudy::meTimeHit_ [private] |
MonitorElement * HcalSimHitStudy::meTimeWHit_ [private] |
std::string HcalSimHitStudy::outFile_ [private] |
Definition at line 44 of file HcalSimHitStudy.h.
Referenced by HcalSimHitStudy(), and ~HcalSimHitStudy().
bool HcalSimHitStudy::verbose_ [private] |