CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalSimHitsValidation Class Reference

#include <HcalSimHitsValidation.h>

Inheritance diagram for HcalSimHitsValidation:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (edm::Event const &ev, edm::EventSetup const &c)
 
virtual void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
 HcalSimHitsValidation (edm::ParameterSet const &conf)
 
 ~HcalSimHitsValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

double dPhiWsign (double phi1, double phi2)
 
double dR (double eta1, double phi1, double eta2, double phi2)
 
double phi12 (double phi1, double en1, double phi2, double en2)
 

Private Attributes

MonitorElementemean_vs_ieta_HB1
 
MonitorElementemean_vs_ieta_HB2
 
MonitorElementemean_vs_ieta_HE1
 
MonitorElementemean_vs_ieta_HE2
 
MonitorElementemean_vs_ieta_HE3
 
MonitorElementemean_vs_ieta_HF1
 
MonitorElementemean_vs_ieta_HF2
 
MonitorElementemean_vs_ieta_HO
 
edm::ESHandle< CaloGeometrygeometry
 
MonitorElementmeEnConeEtaProfile
 
MonitorElementmeEnConeEtaProfile_E
 
MonitorElementmeEnConeEtaProfile_EH
 
MonitorElementmeSimHitsEnergyHB
 
MonitorElementmeSimHitsEnergyHE
 
MonitorElementmeSimHitsEnergyHF
 
MonitorElementmeSimHitsEnergyHO
 
int nevtot
 
MonitorElementNhb
 
MonitorElementNhe
 
MonitorElementNhf
 
MonitorElementNho
 
MonitorElementoccupancy_vs_ieta_HB1
 
MonitorElementoccupancy_vs_ieta_HB2
 
MonitorElementoccupancy_vs_ieta_HE1
 
MonitorElementoccupancy_vs_ieta_HE2
 
MonitorElementoccupancy_vs_ieta_HE3
 
MonitorElementoccupancy_vs_ieta_HF1
 
MonitorElementoccupancy_vs_ieta_HF2
 
MonitorElementoccupancy_vs_ieta_HO
 
std::string outputFile_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_ecalEB_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_ecalEE_
 
edm::EDGetTokenT
< edm::HepMCProduct
tok_evt_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_hcal_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 42 of file HcalSimHitsValidation.h.

Constructor & Destructor Documentation

HcalSimHitsValidation::HcalSimHitsValidation ( edm::ParameterSet const &  conf)

Definition at line 5 of file HcalSimHitsValidation.cc.

References edm::ParameterSet::getUntrackedParameter(), HLT_25ns10e33_v2_cff::InputTag, nevtot, outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, tok_ecalEB_, tok_ecalEE_, tok_evt_, and tok_hcal_.

5  {
6  // DQM ROOT output
7  outputFile_ = conf.getUntrackedParameter<std::string>("outputFile", "myfile.root");
8 
9  // register for data access
10  tok_evt_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
11  tok_hcal_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","HcalHits"));
12  tok_ecalEB_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","EcalHitsEB"));
13  tok_ecalEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","EcalHitsEE"));
14 
15  if ( outputFile_.size() != 0 ) { edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
16  } else {
17  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will NOT be saved";
18  }
19 
20  nevtot = 0;
21 
22 
23 }
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
HcalSimHitsValidation::~HcalSimHitsValidation ( )

Definition at line 26 of file HcalSimHitsValidation.cc.

26 { }

Member Function Documentation

void HcalSimHitsValidation::analyze ( edm::Event const &  ev,
edm::EventSetup const &  c 
)
virtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 164 of file HcalSimHitsValidation.cc.

References gather_cfg::cout, HLT_25ns10e33_v2_cff::depth, dR(), emean_vs_ieta_HB1, emean_vs_ieta_HB2, emean_vs_ieta_HE1, emean_vs_ieta_HE2, emean_vs_ieta_HE3, emean_vs_ieta_HF1, emean_vs_ieta_HF2, emean_vs_ieta_HO, HLT_25ns10e33_v2_cff::etaMax, MonitorElement::Fill(), geometry, edm::EventSetup::get(), edm::Event::getByToken(), meEnConeEtaProfile, meEnConeEtaProfile_E, meEnConeEtaProfile_EH, meSimHitsEnergyHB, meSimHitsEnergyHE, meSimHitsEnergyHF, meSimHitsEnergyHO, nevtot, npart, occupancy_vs_ieta_HB1, occupancy_vs_ieta_HB2, occupancy_vs_ieta_HE1, occupancy_vs_ieta_HE2, occupancy_vs_ieta_HE3, occupancy_vs_ieta_HF1, occupancy_vs_ieta_HF2, occupancy_vs_ieta_HO, AlCaHLTBitMon_ParallelJobs::p, EnergyCorrector::pt, alignCSCRings::r, tok_ecalEB_, tok_ecalEE_, tok_evt_, and tok_hcal_.

164  {
165 
166  using namespace edm;
167  using namespace std;
168 
169  //===========================================================================
170  // Getting SimHits
171  //===========================================================================
172 
173  double phi_MC = -999.; // phi of initial particle from HepMC
174  double eta_MC = -999.; // eta of initial particle from HepMC
175 
177  ev.getByToken(tok_evt_,evtMC); // generator in late 310_preX
178  if (!evtMC.isValid()) {
179  std::cout << "no HepMCProduct found" << std::endl;
180  }
181 
182  // MC particle with highest pt is taken as a direction reference
183  double maxPt = -99999.;
184  int npart = 0;
185 
186  const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
187  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
188  p != myGenEvent->particles_end(); ++p ) {
189  double phip = (*p)->momentum().phi();
190  double etap = (*p)->momentum().eta();
191  double pt = (*p)->momentum().perp();
192  if(pt > maxPt) {npart++; maxPt = pt; phi_MC = phip; eta_MC = etap; }
193  }
194 
195  double partR = 0.3;
196 
197 
198  //Hcal SimHits
199 
200  //Approximate calibration constants
201  const float calib_HB = 120.;
202  const float calib_HE = 190.;
203  const float calib_HF1 = 1.0/0.383;
204  const float calib_HF2 = 1.0/0.368;
205 
207  ev.getByToken(tok_hcal_,hcalHits);
208  const PCaloHitContainer * SimHitResult = hcalHits.product () ;
209 
210  float eta_diff;
211  float etaMax = 9999;
212  int ietaMax = 0;
213 
214  double HcalCone = 0;
215 
216  c.get<CaloGeometryRecord>().get (geometry);
217 
218  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
219  HcalDetId cell(SimHits->id());
220  const CaloCellGeometry* cellGeometry = geometry->getSubdetectorGeometry (cell)->getGeometry (cell);
221  double etaS = cellGeometry->getPosition().eta () ;
222  double phiS = cellGeometry->getPosition().phi () ;
223  double en = SimHits->energy();
224 
225  int sub = cell.subdet();
226  int depth = cell.depth();
227  double ieta = cell.ieta();
228 
229  //Energy in Cone
230  double r = dR(eta_MC, phi_MC, etaS, phiS);
231 
232  if (r < partR){
233  eta_diff = fabs(eta_MC - etaS);
234  if(eta_diff < etaMax) {
235  etaMax = eta_diff;
236  ietaMax = cell.ieta();
237  }
238  //Approximation of calibration
239  if (sub == 1) HcalCone += en*calib_HB;
240  else if (sub == 2) HcalCone += en*calib_HE;
241  else if (sub == 4 && depth == 1) HcalCone += en*calib_HF1;
242  else if (sub == 4 && depth == 2) HcalCone += en*calib_HF2;
243  }
244 
245  //Account for lack of ieta = 0
246  if (ieta > 0) ieta--;
247 
248  //HB
249  if (sub == 1){
250  meSimHitsEnergyHB->Fill(en);
251  if (depth == 1){
252  emean_vs_ieta_HB1->Fill(double(ieta), en);
253  occupancy_vs_ieta_HB1->Fill(double(ieta));
254  }
255  if (depth == 2){
256  emean_vs_ieta_HB2->Fill(double(ieta), en);
257  occupancy_vs_ieta_HB2->Fill(double(ieta));
258  }
259  }
260  //HE
261  if (sub == 2){
262  meSimHitsEnergyHE->Fill(en);
263  if (depth == 1){
264  emean_vs_ieta_HE1->Fill(double(ieta), en);
265  occupancy_vs_ieta_HE1->Fill(double(ieta));
266  }
267  if (depth == 2){
268  emean_vs_ieta_HE2->Fill(double(ieta), en);
269  occupancy_vs_ieta_HE2->Fill(double(ieta));
270  }
271  if (depth == 3){
272  emean_vs_ieta_HE3->Fill(double(ieta), en);
273  occupancy_vs_ieta_HE3->Fill(double(ieta));
274  }
275  }
276  //HO
277  if (sub == 3){
278  meSimHitsEnergyHO->Fill(en);
279  emean_vs_ieta_HO->Fill(double(ieta), en);
280  occupancy_vs_ieta_HO->Fill(double(ieta));
281  }
282  //HF
283  if (sub == 4){
284  meSimHitsEnergyHF->Fill(en);
285  if (depth == 1){
286  emean_vs_ieta_HF1->Fill(double(ieta), en);
287  occupancy_vs_ieta_HF1->Fill(double(ieta));
288  }
289  if (depth == 2){
290  emean_vs_ieta_HF2->Fill(double(ieta), en);
291  occupancy_vs_ieta_HF2->Fill(double(ieta));
292  }
293  }
294  }
295 
296  //Ecal EB SimHits
298  ev.getByToken(tok_ecalEB_,ecalEBHits);
299  const PCaloHitContainer * SimHitResultEB = ecalEBHits.product () ;
300 
301  double EcalCone = 0;
302 
303  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
304 
305  EBDetId EBid = EBDetId(SimHits->id());
306 
307  const CaloCellGeometry* cellGeometry = geometry->getSubdetectorGeometry (EBid)->getGeometry (EBid) ;
308  double etaS = cellGeometry->getPosition().eta () ;
309  double phiS = cellGeometry->getPosition().phi () ;
310  double en = SimHits->energy();
311 
312  double r = dR(eta_MC, phi_MC, etaS, phiS);
313 
314  if (r < partR) EcalCone += en;
315  }
316 
317  //Ecal EE SimHits
319  ev.getByToken(tok_ecalEE_,ecalEEHits);
320  const PCaloHitContainer * SimHitResultEE = ecalEEHits.product () ;
321 
322  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
323 
324  EEDetId EEid = EEDetId(SimHits->id());
325 
326  const CaloCellGeometry* cellGeometry = geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
327  double etaS = cellGeometry->getPosition().eta () ;
328  double phiS = cellGeometry->getPosition().phi () ;
329  double en = SimHits->energy();
330 
331  double r = dR(eta_MC, phi_MC, etaS, phiS);
332 
333  if (r < partR) EcalCone += en;
334  }
335 
336  if (ietaMax != 0){ //If ietaMax == 0, there were no good HCAL SimHits
337  if (ietaMax > 0) ietaMax--; //Account for lack of ieta = 0
338 
339  meEnConeEtaProfile ->Fill(double(ietaMax), HcalCone);
340  meEnConeEtaProfile_E ->Fill(double(ietaMax), EcalCone);
341  meEnConeEtaProfile_EH ->Fill(double(ietaMax), HcalCone+EcalCone);
342  }
343 
344  nevtot++;
345 }
MonitorElement * meEnConeEtaProfile
MonitorElement * meSimHitsEnergyHE
std::vector< PCaloHit > PCaloHitContainer
double dR(double eta1, double phi1, double eta2, double phi2)
MonitorElement * meSimHitsEnergyHO
double npart
Definition: HydjetWrapper.h:49
bool ev
MonitorElement * emean_vs_ieta_HE1
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
void Fill(long long x)
MonitorElement * meEnConeEtaProfile_E
MonitorElement * occupancy_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HE2
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * meSimHitsEnergyHF
MonitorElement * emean_vs_ieta_HO
MonitorElement * occupancy_vs_ieta_HE3
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
MonitorElement * emean_vs_ieta_HE2
MonitorElement * emean_vs_ieta_HE3
MonitorElement * emean_vs_ieta_HF1
MonitorElement * occupancy_vs_ieta_HB1
MonitorElement * emean_vs_ieta_HF2
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * emean_vs_ieta_HB1
MonitorElement * occupancy_vs_ieta_HF2
MonitorElement * occupancy_vs_ieta_HO
edm::ESHandle< CaloGeometry > geometry
tuple cout
Definition: gather_cfg.py:145
MonitorElement * meSimHitsEnergyHB
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
MonitorElement * emean_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HF1
MonitorElement * occupancy_vs_ieta_HE1
void HcalSimHitsValidation::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  run,
edm::EventSetup const &  es 
)
virtual

Implements DQMEDAnalyzer.

Definition at line 29 of file HcalSimHitsValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), emean_vs_ieta_HB1, emean_vs_ieta_HB2, emean_vs_ieta_HE1, emean_vs_ieta_HE2, emean_vs_ieta_HE3, emean_vs_ieta_HF1, emean_vs_ieta_HF2, emean_vs_ieta_HO, timingPdfMaker::histo, meEnConeEtaProfile, meEnConeEtaProfile_E, meEnConeEtaProfile_EH, meSimHitsEnergyHB, meSimHitsEnergyHE, meSimHitsEnergyHF, meSimHitsEnergyHO, Nhb, Nhe, Nhf, Nho, occupancy_vs_ieta_HB1, occupancy_vs_ieta_HB2, occupancy_vs_ieta_HE1, occupancy_vs_ieta_HE2, occupancy_vs_ieta_HE3, occupancy_vs_ieta_HF1, occupancy_vs_ieta_HF2, occupancy_vs_ieta_HO, and DQMStore::IBooker::setCurrentFolder().

30 {
31  Char_t histo[200];
32 
33  ib.setCurrentFolder("HcalSimHitsV/HcalSimHitTask");
34 
35  // General counters
36  sprintf (histo, "N_HB" );
37  Nhb = ib.book1D(histo, histo, 2600,0.,2600.);
38  sprintf (histo, "N_HE" );
39  Nhe = ib.book1D(histo, histo, 2600,0.,2600.);
40  sprintf (histo, "N_HO" );
41  Nho = ib.book1D(histo, histo, 2200,0.,2200.);
42  sprintf (histo, "N_HF" );
43  Nhf = ib.book1D(histo, histo, 1800,0., 1800.);
44 
45  //Mean energy vs iEta TProfiles
46  sprintf (histo, "emean_vs_ieta_HB1" );
47  emean_vs_ieta_HB1 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
48  sprintf (histo, "emean_vs_ieta_HB2" );
49  emean_vs_ieta_HB2 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
50  sprintf (histo, "emean_vs_ieta_HE1" );
51  emean_vs_ieta_HE1 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10. ,2000., "s" );
52  sprintf (histo, "emean_vs_ieta_HE2" );
53  emean_vs_ieta_HE2 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s");
54  sprintf (histo, "emean_vs_ieta_HE3" );
55  emean_vs_ieta_HE3 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
56  sprintf (histo, "emean_vs_ieta_HO" );
57  emean_vs_ieta_HO = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
58  sprintf (histo, "emean_vs_ieta_HF1" );
59  emean_vs_ieta_HF1 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
60  sprintf (histo, "emean_vs_ieta_HF2" );
61  emean_vs_ieta_HF2 = ib.bookProfile(histo, histo, 82, -41., 41., 2010, -10., 2000., "s" );
62 
63  //Occupancy vs. iEta TH1Fs
64  sprintf (histo, "occupancy_vs_ieta_HB1" );
65  occupancy_vs_ieta_HB1 = ib.book1D(histo, histo, 82, -41., 41.);
66  sprintf (histo, "occupancy_vs_ieta_HB2" );
67  occupancy_vs_ieta_HB2 = ib.book1D(histo, histo, 82, -41., 41.);
68  sprintf (histo, "occupancy_vs_ieta_HE1" );
69  occupancy_vs_ieta_HE1 = ib.book1D(histo, histo, 82, -41., 41.);
70  sprintf (histo, "occupancy_vs_ieta_HE2" );
71  occupancy_vs_ieta_HE2 = ib.book1D(histo, histo, 82, -41., 41.);
72  sprintf (histo, "occupancy_vs_ieta_HE3" );
73  occupancy_vs_ieta_HE3 = ib.book1D(histo, histo, 82, -41., 41.);
74  sprintf (histo, "occupancy_vs_ieta_HO" );
75  occupancy_vs_ieta_HO = ib.book1D(histo, histo, 82, -41., 41.);
76  sprintf (histo, "occupancy_vs_ieta_HF1" );
77  occupancy_vs_ieta_HF1 = ib.book1D(histo, histo, 82, -41., 41.);
78  sprintf (histo, "occupancy_vs_ieta_HF2" );
79  occupancy_vs_ieta_HF2 = ib.book1D(histo, histo, 82, -41., 41.);
80 
81  //Energy spectra
82  sprintf (histo, "HcalSimHitTask_energy_of_simhits_HB" ) ;
83  meSimHitsEnergyHB = ib.book1D(histo, histo, 510 , -0.1 , 5.);
84 
85  sprintf (histo, "HcalSimHitTask_energy_of_simhits_HE" ) ;
86  meSimHitsEnergyHE = ib.book1D(histo, histo, 510, -0.02, 2.);
87 
88  sprintf (histo, "HcalSimHitTask_energy_of_simhits_HO" ) ;
89  meSimHitsEnergyHO = ib.book1D(histo, histo, 510 , -0.1 , 5.);
90 
91  sprintf (histo, "HcalSimHitTask_energy_of_simhits_HF" ) ;
92  meSimHitsEnergyHF = ib.book1D(histo, histo, 1010 , -5. , 500.);
93 
94  //Energy in Cone
95  sprintf (histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
96  meEnConeEtaProfile = ib.bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
97 
98  sprintf (histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
99  meEnConeEtaProfile_E = ib.bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
100 
101  sprintf (histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
102  meEnConeEtaProfile_EH = ib.bookProfile(histo, histo, 82, -41., 41., 210, -10., 200.);
103 
104 
105 }
MonitorElement * meEnConeEtaProfile
MonitorElement * meSimHitsEnergyHE
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MonitorElement * meSimHitsEnergyHO
MonitorElement * emean_vs_ieta_HE1
MonitorElement * meEnConeEtaProfile_E
MonitorElement * occupancy_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HE2
MonitorElement * meSimHitsEnergyHF
MonitorElement * emean_vs_ieta_HO
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * occupancy_vs_ieta_HE3
MonitorElement * emean_vs_ieta_HE2
MonitorElement * emean_vs_ieta_HE3
MonitorElement * emean_vs_ieta_HF1
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * occupancy_vs_ieta_HB1
MonitorElement * emean_vs_ieta_HF2
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * emean_vs_ieta_HB1
MonitorElement * occupancy_vs_ieta_HF2
MonitorElement * occupancy_vs_ieta_HO
MonitorElement * meSimHitsEnergyHB
MonitorElement * emean_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HF1
MonitorElement * occupancy_vs_ieta_HE1
double HcalSimHitsValidation::dPhiWsign ( double  phi1,
double  phi2 
)
private

Definition at line 374 of file HcalSimHitsValidation.cc.

References PI, and tmp.

374  {
375  // clockwise phi2 w.r.t phi1 means "+" phi distance
376  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
377 
378  double PI = 3.1415926535898;
379  double a1 = phi1; double a2 = phi2;
380  double tmp = a2 - a1;
381  if( a1*a2 < 0.) {
382  if(a1 > 0.5 * PI) tmp += 2.*PI;
383  if(a2 > 0.5 * PI) tmp -= 2.*PI;
384  }
385  return tmp;
386 
387 }
#define PI
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double HcalSimHitsValidation::dR ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
private

Definition at line 348 of file HcalSimHitsValidation.cc.

References PI, mathSSE::sqrt(), and tmp.

Referenced by analyze().

348  {
349  double PI = 3.1415926535898;
350  double deltaphi= phi1 - phi2;
351  if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
352  if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
353  double deltaeta = eta2 - eta1;
354  double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
355  return tmp;
356 }
#define PI
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void HcalSimHitsValidation::endJob ( void  )
virtual

Definition at line 108 of file HcalSimHitsValidation.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), i, nevtot, occupancy_vs_ieta_HB1, occupancy_vs_ieta_HB2, occupancy_vs_ieta_HE1, occupancy_vs_ieta_HE2, occupancy_vs_ieta_HE3, occupancy_vs_ieta_HF1, occupancy_vs_ieta_HF2, occupancy_vs_ieta_HO, and MonitorElement::setBinContent().

108  {
109  //before check that histos are there....
110 
111  // let's see if this breaks anything
112  // check if ME still there (and not killed by MEtoEDM for memory saving)
113  /*if( dbe_ )
114  {
115  // check existence of first histo in the list
116  if (! dbe_->get("HcalSimHitsV/HcalSimHitTask/N_HB")) return;
117  }
118  else
119  return;*/
120 
121  //======================================
122 
123  for (int i = 1; i <= occupancy_vs_ieta_HB1->getNbinsX(); i++){
124 
125  int ieta = i - 42; // -41 -1, 0 40
126  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
127 
128  float phi_factor;
129 
130  if (fabs(ieta) <= 20) phi_factor = 72.;
131  else if (fabs(ieta) < 40) phi_factor = 36.;
132  else phi_factor = 18.;
133 
134  float cnorm;
135 
136  //Occupancy vs. iEta TH1Fs
137  cnorm = occupancy_vs_ieta_HB1->getBinContent(i) / (phi_factor * nevtot);
139  cnorm = occupancy_vs_ieta_HB2->getBinContent(i) / (phi_factor * nevtot);
141 
142  cnorm = occupancy_vs_ieta_HE1->getBinContent(i) / (phi_factor * nevtot);
144  cnorm = occupancy_vs_ieta_HE2->getBinContent(i) / (phi_factor * nevtot);
146  cnorm = occupancy_vs_ieta_HE3->getBinContent(i) / (phi_factor * nevtot);
148 
149  cnorm = occupancy_vs_ieta_HO->getBinContent(i) / (phi_factor * nevtot);
151 
152  cnorm = occupancy_vs_ieta_HF1->getBinContent(i) / (phi_factor * nevtot);
154  cnorm = occupancy_vs_ieta_HF2->getBinContent(i) / (phi_factor * nevtot);
156  }
157 
158 
159  // let's see if this breaks anything
160  //if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
161 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * occupancy_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HE2
MonitorElement * occupancy_vs_ieta_HE3
MonitorElement * occupancy_vs_ieta_HB1
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * occupancy_vs_ieta_HF2
MonitorElement * occupancy_vs_ieta_HO
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * occupancy_vs_ieta_HF1
MonitorElement * occupancy_vs_ieta_HE1
double HcalSimHitsValidation::phi12 ( double  phi1,
double  en1,
double  phi2,
double  en2 
)
private

Definition at line 358 of file HcalSimHitsValidation.cc.

References PI, and tmp.

358  {
359  // weighted mean value of phi1 and phi2
360 
361  double tmp;
362  double PI = 3.1415926535898;
363  double a1 = phi1; double a2 = phi2;
364 
365  if( a1 > 0.5*PI && a2 < 0.) a2 += 2*PI;
366  if( a2 > 0.5*PI && a1 < 0.) a1 += 2*PI;
367  tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
368  if(tmp > PI) tmp -= 2.*PI;
369 
370  return tmp;
371 
372 }
#define PI
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HB1
private

Definition at line 78 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HB2
private

Definition at line 79 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HE1
private

Definition at line 80 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HE2
private

Definition at line 81 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HE3
private

Definition at line 82 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HF1
private

Definition at line 84 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HF2
private

Definition at line 85 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HO
private

Definition at line 83 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

edm::ESHandle<CaloGeometry> HcalSimHitsValidation::geometry
private
MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile
private

Definition at line 97 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_E
private

Definition at line 98 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_EH
private

Definition at line 99 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHB
private

Definition at line 102 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHE
private

Definition at line 103 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHF
private

Definition at line 105 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHO
private

Definition at line 104 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

int HcalSimHitsValidation::nevtot
private

Definition at line 110 of file HcalSimHitsValidation.h.

Referenced by analyze(), endJob(), and HcalSimHitsValidation().

MonitorElement* HcalSimHitsValidation::Nhb
private

Definition at line 68 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nhe
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nhf
private

Definition at line 71 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nho
private

Definition at line 70 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HB1
private

Definition at line 87 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HB2
private

Definition at line 88 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HE1
private

Definition at line 89 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HE2
private

Definition at line 90 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HE3
private

Definition at line 91 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HF1
private

Definition at line 93 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HF2
private

Definition at line 94 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HO
private

Definition at line 92 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

std::string HcalSimHitsValidation::outputFile_
private

Definition at line 59 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_ecalEB_
private

Definition at line 63 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_ecalEE_
private

Definition at line 64 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::HepMCProduct> HcalSimHitsValidation::tok_evt_
private

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_hcal_
private

Definition at line 62 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().