CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
RecAnalyzerMinbias Class Reference
Inheritance diagram for RecAnalyzerMinbias:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  myInfo
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob ()
 
virtual void beginRun (edm::Run const &iRun, edm::EventSetup const &iSetup)
 
virtual void endJob ()
 
 RecAnalyzerMinbias (const edm::ParameterSet &)
 
 ~RecAnalyzerMinbias ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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

void analyzeHcal (const HBHERecHitCollection &, const HFRecHitCollection &, int, bool)
 

Private Attributes

int cells
 
std::map< DetId, double > corrFactor_
 
int depth
 
double eHighHB_
 
double eHighHE_
 
double eHighHF_
 
double eLowHB_
 
double eLowHE_
 
double eLowHF_
 
bool fillHist_
 
edm::Service< TFileServicefs_
 
TH1D * h_ [4]
 
std::vector< unsigned int > hcalID_
 
std::map< HcalDetId, TH1D * > histHC_
 
std::vector< TH1D * > histo_
 
int ieta
 
bool ignoreL1_
 
bool init_
 
int iphi
 
float mom0_MB
 
float mom1_MB
 
float mom2_MB
 
float mom3_MB
 
float mom4_MB
 
std::map< std::pair< int,
HcalDetId >, myInfo
myMap_
 
int mysubd
 
TTree * myTree_
 
bool Noise_
 
double rnnum_
 
double rnnumber
 
bool runNZS_
 
bool theRecalib_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbherecoMB_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hfrecoMB_
 
edm::EDGetTokenT
< L1GlobalTriggerObjectMapRecord
tok_hltL1GtMap_
 
int trigbit
 
std::vector< int > trigbit_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 40 of file RecAnalyzerMinbias.cc.

Constructor & Destructor Documentation

RecAnalyzerMinbias::RecAnalyzerMinbias ( const edm::ParameterSet iConfig)
explicit

Definition at line 83 of file RecAnalyzerMinbias.cc.

References funct::abs(), corrFactor_, depth, eHighHB_, eHighHE_, eHighHF_, eLowHB_, eLowHE_, eLowHF_, fillHist_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HcalBarrel, HcalEndcap, HcalForward, hcalID_, HcalOuter, ieta, ignoreL1_, timingPdfMaker::infile, HLT_25ns10e33_v2_cff::InputTag, iphi, relval_2017::k, Noise_, runNZS_, AlCaHLTBitMon_QueryRunRegistry::string, theRecalib_, tok_hbherecoMB_, tok_hfrecoMB_, tok_hltL1GtMap_, and trigbit_.

83  :
84  init_(false) {
85 
86  // get name of output file with histogramms
87  runNZS_ = iConfig.getParameter<bool>("RunNZS");
88  Noise_ = iConfig.getParameter<bool>("Noise");
89  eLowHB_ = iConfig.getParameter<double>("ELowHB");
90  eHighHB_ = iConfig.getParameter<double>("EHighHB");
91  eLowHE_ = iConfig.getParameter<double>("ELowHE");
92  eHighHE_ = iConfig.getParameter<double>("EHighHE");
93  eLowHF_ = iConfig.getParameter<double>("ELowHF");
94  eHighHF_ = iConfig.getParameter<double>("EHighHF");
95  trigbit_ = iConfig.getUntrackedParameter<std::vector<int>>("TriggerBits");
96  ignoreL1_ = iConfig.getUntrackedParameter<bool>("IgnoreL1",false);
97  std::string cfile= iConfig.getUntrackedParameter<std::string>("CorrFile");
98  fillHist_ = iConfig.getUntrackedParameter<bool>("FillHisto",false);
99  std::vector<int> ieta = iConfig.getUntrackedParameter<std::vector<int>>("HcalIeta");
100  std::vector<int> iphi = iConfig.getUntrackedParameter<std::vector<int>>("HcalIphi");
101  std::vector<int> depth= iConfig.getUntrackedParameter<std::vector<int>>("HcalDepth");
102 
103  // get token names of modules, producing object collections
104  tok_hbherecoMB_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputMB"));
105  tok_hfrecoMB_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputMB"));
106  tok_hltL1GtMap_ = consumes<L1GlobalTriggerObjectMapRecord>(edm::InputTag("hltL1GtObjectMap"));
107 
108  // Read correction factors
109  std::ifstream infile(cfile.c_str());
110  if (!infile.is_open()) {
111  theRecalib_ = false;
112  edm::LogInfo("AnalyzerMB") << "Cannot open '" << cfile
113  << "' for the correction file";
114  } else {
115  unsigned int ndets(0), nrec(0);
116  while(1) {
117  unsigned int id;
118  double cfac;
119  infile >> id >> cfac;
120  if (!infile.good()) break;
121  HcalDetId detId(id);
122  nrec++;
123  std::map<DetId,double>::iterator itr = corrFactor_.find(detId);
124  if (itr == corrFactor_.end()) {
125  corrFactor_[detId] = cfac;
126  ndets++;
127  }
128  }
129  infile.close();
130  edm::LogInfo("AnalyzerMB") << "Reads " << nrec << " correction factors for "
131  << ndets << " detIds";
132  theRecalib_ = (ndets>0);
133  }
134 
135  edm::LogInfo("AnalyzerMB") << " Flags (ReCalib): " << theRecalib_
136  << " (IgnoreL1): " << ignoreL1_ << " (NZS) "
137  << runNZS_ << " and with " << ieta.size()
138  << " detId for full histogram";
139  edm::LogInfo("AnalyzerMB") << "Thresholds for HB " << eLowHB_ << ":"
140  << eHighHB_ << " for HE " << eLowHE_ << ":"
141  << eHighHE_ << " for HF " << eLowHF_ << ":"
142  << eHighHF_;
143  for (unsigned int k=0; k<ieta.size(); ++k) {
144  HcalSubdetector subd = ((std::abs(ieta[k]) > 29) ? HcalForward :
145  (std::abs(ieta[k]) > 16) ? HcalEndcap :
146  ((std::abs(ieta[k]) == 16) && (depth[k] == 3)) ? HcalEndcap :
147  (depth[k] == 4) ? HcalOuter : HcalBarrel);
148  unsigned int id = (HcalDetId(subd,ieta[k],iphi[k],depth[k])).rawId();
149  hcalID_.push_back(id);
150  edm::LogInfo("AnalyzerMB") << "DetId[" << k << "] " << HcalDetId(id);
151  }
152  edm::LogInfo("AnalyzerMB") << "Select on " << trigbit_.size()
153  << " L1 Trigger selection";
154  for (unsigned int k=0; k<trigbit_.size(); ++k)
155  edm::LogInfo("AnalyzerMB") << "Bit[" << k << "] " << trigbit_[k];
156 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > trigbit_
std::map< DetId, double > corrFactor_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< unsigned int > hcalID_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
RecAnalyzerMinbias::~RecAnalyzerMinbias ( )

Definition at line 158 of file RecAnalyzerMinbias.cc.

158 {}

Member Function Documentation

void RecAnalyzerMinbias::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 325 of file RecAnalyzerMinbias.cc.

References analyzeHcal(), spr::find(), edm::Event::getByToken(), ignoreL1_, edm::HandleBase::isValid(), convertSQLiteXML::ok, edm::Handle< T >::product(), reco::return(), rnnum_, edm::Event::run(), runNZS_, benchmark_cfg::select, edm::SortedCollection< T, SORT >::size(), tok_hbherecoMB_, tok_hfrecoMB_, tok_hltL1GtMap_, and trigbit_.

325  {
326 
327  rnnum_ = (float)iEvent.run();
329  iEvent.getByToken(tok_hbherecoMB_, hbheMB);
330  if (!hbheMB.isValid()) {
331  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbhe product!";
332  return ;
333  }
334  const HBHERecHitCollection HithbheMB = *(hbheMB.product());
335  edm::LogInfo("AnalyzerMB") << "HBHE MB size of collection "<<HithbheMB.size();
336  if (HithbheMB.size() < 5100 && runNZS_) {
337  edm::LogWarning("AnalyzerMB") << "HBHE problem " << rnnum_ << " size "
338  << HithbheMB.size();
339  }
340 
342  iEvent.getByToken(tok_hfrecoMB_, hfMB);
343  if (!hfMB.isValid()) {
344  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf product!";
345  return;
346  }
347  const HFRecHitCollection HithfMB = *(hfMB.product());
348  edm::LogInfo("AnalyzerMB") << "HF MB size of collection " << HithfMB.size();
349  if (HithfMB.size() < 1700 && runNZS_) {
350  edm::LogWarning("AnalyzerMB") << "HF problem " << rnnum_ << " size "
351  << HithfMB.size();
352  }
353 
354  bool select(false);
355  if (trigbit_.size() > 0) {
357  iEvent.getByToken(tok_hltL1GtMap_, gtObjectMapRecord);
358  if (gtObjectMapRecord.isValid()) {
359  const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
360  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
361  itMap != objMapVec.end(); ++itMap) {
362  bool resultGt = (*itMap).algoGtlResult();
363  if (resultGt) {
364  int algoBit = (*itMap).algoBitNumber();
365  if (std::find(trigbit_.begin(),trigbit_.end(),algoBit) !=
366  trigbit_.end()) {
367  select = true;
368  break;
369  }
370  }
371  }
372  }
373  }
374 
375  if (ignoreL1_ || ((trigbit_.size() > 0) && select)) {
376  analyzeHcal(HithbheMB, HithfMB, 1, true);
377  } else if ((!ignoreL1_) && (trigbit_.size() == 0)) {
379  iEvent.getByToken(tok_hltL1GtMap_, gtObjectMapRecord);
380  if (gtObjectMapRecord.isValid()) {
381  const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
382  bool ok(false);
383  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
384  itMap != objMapVec.end(); ++itMap) {
385  bool resultGt = (*itMap).algoGtlResult();
386  if (resultGt) {
387  int algoBit = (*itMap).algoBitNumber();
388  analyzeHcal(HithbheMB, HithfMB, algoBit, (!ok));
389  ok = true;
390  }
391  }
392  if (!ok) {
393  edm::LogInfo("AnalyzerMB") << "No passed L1 Trigger found";
394  }
395  }
396  }
397 }
std::vector< int > trigbit_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void analyzeHcal(const HBHERecHitCollection &, const HFRecHitCollection &, int, bool)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
RunNumber_t run() const
Definition: Event.h:93
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
return(e1-e2)*(e1-e2)+dp *dp
size_type size() const
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
void RecAnalyzerMinbias::analyzeHcal ( const HBHERecHitCollection HithbheMB,
const HFRecHitCollection HithfMB,
int  algoBit,
bool  fill 
)
private

Definition at line 399 of file RecAnalyzerMinbias.cc.

References edm::SortedCollection< T, SORT >::begin(), corrFactor_, eHighHB_, eHighHE_, eHighHF_, eLowHB_, eLowHE_, eLowHF_, edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), fillHist_, h_, HcalEndcap, hcalID_, histHC_, histo_, i, info(), myMap_, Noise_, DetId::rawId(), rnnum_, runNZS_, HcalDetId::subdet(), and theRecalib_.

Referenced by analyze().

401  {
402  // Signal part for HB HE
403  for (HBHERecHitCollection::const_iterator hbheItr=HithbheMB.begin();
404  hbheItr!=HithbheMB.end(); hbheItr++) {
405  // Recalibration of energy
406  DetId mydetid = hbheItr->id().rawId();
407  double icalconst(1.);
408  if (theRecalib_) {
409  std::map<DetId,double>::iterator itr = corrFactor_.find(mydetid);
410  if (itr != corrFactor_.end()) icalconst = itr->second;
411  }
412  HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
413  double energyhit = aHit.energy();
414  DetId id = (*hbheItr).detid();
415  HcalDetId hid = HcalDetId(id);
416  double eLow = (hid.subdet() == HcalEndcap) ? eLowHE_ : eLowHB_;
417  double eHigh = (hid.subdet() == HcalEndcap) ? eHighHE_ : eHighHB_;
418  if (fill) {
419  for (unsigned int i = 0; i < hcalID_.size(); i++) {
420  if (hcalID_[i] == id.rawId()) {
421  histo_[i]->Fill(energyhit);
422  break;
423  }
424  }
425  if (fillHist_) {
426  std::map<HcalDetId,TH1D*>::iterator itr1 = histHC_.find(hid);
427  if (itr1 != histHC_.end()) itr1->second->Fill(energyhit);
428  }
429  h_[hid.subdet()-1]->Fill(energyhit);
430  }
431  if (!fillHist_) {
432  if (Noise_ || runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
433  std::map<std::pair<int,HcalDetId>,myInfo>::iterator itr1 = myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
434  if (itr1 == myMap_.end()) {
435  myInfo info;
436  myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
437  itr1 = myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
438  }
439  itr1->second.theMB0++;
440  itr1->second.theMB1 += energyhit;
441  itr1->second.theMB2 += (energyhit*energyhit);
442  itr1->second.theMB3 += (energyhit*energyhit*energyhit);
443  itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
444  itr1->second.runcheck = rnnum_;
445  }
446  }
447  } // HBHE_MB
448 
449  // Signal part for HF
450  for (HFRecHitCollection::const_iterator hfItr=HithfMB.begin();
451  hfItr!=HithfMB.end(); hfItr++) {
452  // Recalibration of energy
453  DetId mydetid = hfItr->id().rawId();
454  double icalconst(1.);
455  if (theRecalib_) {
456  std::map<DetId,double>::iterator itr = corrFactor_.find(mydetid);
457  if (itr != corrFactor_.end()) icalconst = itr->second;
458  }
459  HFRecHit aHit(hfItr->id(),hfItr->energy()*icalconst,hfItr->time());
460 
461  double energyhit = aHit.energy();
462  DetId id = (*hfItr).detid();
463  HcalDetId hid = HcalDetId(id);
464  if (fill) {
465  for (unsigned int i = 0; i < hcalID_.size(); i++) {
466  if (hcalID_[i] == id.rawId()) {
467  histo_[i]->Fill(energyhit);
468  break;
469  }
470  }
471  if (fillHist_) {
472  std::map<HcalDetId,TH1D*>::iterator itr1 = histHC_.find(hid);
473  if (itr1 != histHC_.end()) itr1->second->Fill(energyhit);
474  }
475  h_[hid.subdet()-1]->Fill(energyhit);
476  }
477 
478  //
479  // Remove PMT hits
480  //
481  if (!fillHist_) {
482  if (((Noise_ || runNZS_) && fabs(energyhit) <= 40.) ||
483  (energyhit >= eLowHF_ && energyhit <= eHighHF_)) {
484  std::map<std::pair<int,HcalDetId>,myInfo>::iterator itr1 = myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
485  if (itr1 == myMap_.end()) {
486  myInfo info;
487  myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
488  itr1 = myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
489  }
490  itr1->second.theMB0++;
491  itr1->second.theMB1 += energyhit;
492  itr1->second.theMB2 += (energyhit*energyhit);
493  itr1->second.theMB3 += (energyhit*energyhit*energyhit);
494  itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
495  itr1->second.runcheck = rnnum_;
496  }
497  }
498  }
499 }
int i
Definition: DBlmapReader.cc:9
static const TGPicture * info(bool iBackgroundIsBlack)
string fill
Definition: lumiContext.py:319
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
std::map< HcalDetId, TH1D * > histHC_
std::vector< HBHERecHit >::const_iterator const_iterator
std::map< DetId, double > corrFactor_
std::vector< TH1D * > histo_
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
float energy() const
Definition: CaloRecHit.h:17
const_iterator end() const
Definition: DetId.h:18
std::vector< unsigned int > hcalID_
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
const_iterator begin() const
void RecAnalyzerMinbias::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file RecAnalyzerMinbias.cc.

References cells, depth, fillHist_, fs_, h_, AnalysisDataFormats_SUSYBSMObjects::hc, hcalID_, histo_, i, ieta, iphi, TFileService::make(), mom0_MB, mom1_MB, mom2_MB, mom4_MB, myMap_, mysubd, myTree_, mergeVDriftHistosByStation::name, rnnumber, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, trigbit, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

160  {
161 
162  std::string hc[5] = {"Empty", "HB", "HE", "HO", "HF"};
163  char name[700], title[700];
164  for(int idet=1; idet<=4; idet++){
165  sprintf(name, "%s", hc[idet].c_str());
166  sprintf (title, "Noise distribution for %s", hc[idet].c_str());
167  h_[idet-1] = fs_->make<TH1D>(name,title,48,-6., 6.);
168  }
169 
170  for (unsigned int i=0; i<hcalID_.size(); i++) {
171  HcalDetId id = HcalDetId(hcalID_[i]);
172  int subdet = id.subdetId();
173  sprintf (name, "%s%d_%d_%d", hc[subdet].c_str(), id.ieta(), id.iphi(), id.depth());
174  sprintf (title, "Energy Distribution for %s ieta %d iphi %d depth %d", hc[subdet].c_str(), id.ieta(), id.iphi(), id.depth());
175  double xmin = (subdet == 4) ? -10 : -1;
176  double xmax = (subdet == 4) ? 90 : 9;
177  TH1D* hh = fs_->make<TH1D>(name, title, 50, xmin, xmax);
178  histo_.push_back(hh);
179  };
180 
181  if (!fillHist_) {
182  myTree_ = fs_->make<TTree>("RecJet","RecJet Tree");
183  myTree_->Branch("cells", &cells, "cells/I");
184  myTree_->Branch("mysubd", &mysubd, "mysubd/I");
185  myTree_->Branch("depth", &depth, "depth/I");
186  myTree_->Branch("ieta", &ieta, "ieta/I");
187  myTree_->Branch("iphi", &iphi, "iphi/I");
188  myTree_->Branch("mom0_MB", &mom0_MB, "mom0_MB/F");
189  myTree_->Branch("mom1_MB", &mom1_MB, "mom1_MB/F");
190  myTree_->Branch("mom2_MB", &mom2_MB, "mom2_MB/F");
191  myTree_->Branch("mom3_MB", &mom2_MB, "mom3_MB/F");
192  myTree_->Branch("mom4_MB", &mom4_MB, "mom4_MB/F");
193  myTree_->Branch("trigbit", &trigbit, "trigbit/I");
194  myTree_->Branch("rnnumber", &rnnumber, "rnnumber/D");
195  }
196  myMap_.clear();
197 }
int i
Definition: DBlmapReader.cc:9
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< TH1D * > histo_
edm::Service< TFileService > fs_
std::vector< unsigned int > hcalID_
susybsm::HSCParticleCollection hc
Definition: classes.h:25
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
void RecAnalyzerMinbias::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 200 of file RecAnalyzerMinbias.cc.

References depth, eHighHB_, eHighHE_, eHighHF_, eta, fillHist_, fs_, edm::EventSetup::get(), h, HcalBarrel, HcalEndcap, HcalForward, histHC_, init_, edm::ESHandleBase::isValid(), TFileService::make(), HcalTopology::maxDepthHB(), HcalTopology::maxDepthHE(), mergeVDriftHistosByStation::name, Noise_, phi, edm::ESHandle< class >::product(), indexGen::title, and HcalTopology::valid().

200  {
201 
202  if (!init_) {
203  init_ = true;
204  if (fillHist_) {
206  iS.get<IdealGeometryRecord>().get(htopo);
207  if (htopo.isValid()) {
208  const HcalTopology* hcaltopology = htopo.product();
209 
210  char name[700], title[700];
211  // For HB
212  int maxDepthHB = hcaltopology->maxDepthHB();
213  int nbinHB = (Noise_) ? 18 : int(2000*eHighHB_);
214  double x_min = (Noise_) ? -3. : 0.;
215  double x_max = (Noise_) ? 3. : 2.*eHighHB_;
216  for (int eta = -50; eta < 50; eta++) {
217  for (int phi = 0; phi < 100; phi++) {
218  for (int depth = 1; depth <= maxDepthHB; depth++) {
219  HcalDetId cell (HcalBarrel, eta, phi, depth);
220  if (hcaltopology->valid(cell)) {
221  sprintf (name, "HBeta%dphi%ddep%d", eta, phi, depth);
222  sprintf (title,"HB #eta %d #phi %d depth %d", eta, phi, depth);
223  TH1D* h = fs_->make<TH1D>(name, title, nbinHB, x_min, x_max);
224  histHC_[cell] = h;
225  }
226  }
227  }
228  }
229  // For HE
230  int maxDepthHE = hcaltopology->maxDepthHE();
231  int nbinHE = (Noise_) ? 18 : int(2000*eHighHE_);
232  x_min = (Noise_) ? -3. : 0.;
233  x_max = (Noise_) ? 3. : 2.*eHighHE_;
234  for (int eta = -50; eta < 50; eta++) {
235  for (int phi = 0; phi < 100; phi++) {
236  for (int depth = 1; depth <= maxDepthHE; depth++) {
237  HcalDetId cell (HcalEndcap, eta, phi, depth);
238  if (hcaltopology->valid(cell)) {
239  sprintf (name, "HEeta%dphi%ddep%d", eta, phi, depth);
240  sprintf (title,"HE #eta %d #phi %d depth %d", eta, phi, depth);
241  TH1D* h = fs_->make<TH1D>(name, title, nbinHE, x_min, x_max);
242  histHC_[cell] = h;
243  }
244  }
245  }
246  }
247  // For HF
248  int maxDepthHF = 4;
249  int nbinHF = (Noise_) ? 200 : int(2000*eHighHF_);
250  x_min = (Noise_) ? -10. : 0.;
251  x_max = (Noise_) ? 10. : 2.*eHighHF_;
252  for (int eta = -50; eta < 50; eta++) {
253  for (int phi = 0; phi < 100; phi++) {
254  for (int depth = 1; depth <= maxDepthHF; depth++) {
255  HcalDetId cell (HcalForward, eta, phi, depth);
256  if (hcaltopology->valid(cell)) {
257  sprintf (name, "HFeta%dphi%ddep%d", eta, phi, depth);
258  sprintf (title,"Energy (HF #eta %d #phi %d depth %d)", eta, phi, depth);
259  TH1D* h = fs_->make<TH1D>(name, title, nbinHF, x_min, x_max);
260  histHC_[cell] = h;
261  }
262  }
263  }
264  }
265  }
266  }
267  }
268 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::map< HcalDetId, TH1D * > histHC_
int maxDepthHE() const
Definition: HcalTopology.h:129
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs_
T const * product() const
Definition: ESHandle.h:86
virtual bool valid(const DetId &id) const
int maxDepthHB() const
Definition: HcalTopology.h:128
bool isValid() const
Definition: ESHandle.h:47
void RecAnalyzerMinbias::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 272 of file RecAnalyzerMinbias.cc.

References cells, gather_cfg::cout, depth, fillHist_, ieta, info(), iphi, mom0_MB, mom1_MB, mom2_MB, mom3_MB, mom4_MB, myMap_, mysubd, myTree_, rnnumber, RecAnalyzerMinbias::myInfo::runcheck, RecAnalyzerMinbias::myInfo::theMB0, RecAnalyzerMinbias::myInfo::theMB1, RecAnalyzerMinbias::myInfo::theMB2, RecAnalyzerMinbias::myInfo::theMB3, RecAnalyzerMinbias::myInfo::theMB4, and trigbit.

Referenced by o2o.O2ORunMgr::executeJob().

272  {
273 
274  if (!fillHist_) {
275  cells = 0;
276  for (std::map<std::pair<int,HcalDetId>,myInfo>::const_iterator itr=myMap_.begin(); itr != myMap_.end(); ++itr) {
277  edm::LogInfo("AnalyzerMB") << "Fired trigger bit number "<<itr->first.first;
278 #ifdef DebugLog
279  std::cout << "Fired trigger bit number "<<itr->first.first << std::endl;
280 #endif
281  myInfo info = itr->second;
282  if (info.theMB0 > 0) {
283  mom0_MB = info.theMB0;
284  mom1_MB = info.theMB1;
285  mom2_MB = info.theMB2;
286  mom3_MB = info.theMB3;
287  mom4_MB = info.theMB4;
288  rnnumber = info.runcheck;
289  trigbit = itr->first.first;
290  mysubd = itr->first.second.subdet();
291  depth = itr->first.second.depth();
292  iphi = itr->first.second.iphi();
293  ieta = itr->first.second.ieta();
294  edm::LogInfo("AnalyzerMB") << " Result= " << trigbit << " " << mysubd
295  << " " << ieta << " " << iphi << " mom0 "
296  << mom0_MB << " mom1 " << mom1_MB << " mom2 "
297  << mom2_MB << " mom3 " << mom3_MB << " mom4 "
298  << mom4_MB;
299 #ifdef DebugLog
300  std::cout << " Result= " << trigbit << " " << mysubd
301  << " " << ieta << " " << iphi << " mom0 "
302  << mom0_MB << " mom1 " << mom1_MB << " mom2 "
303  << mom2_MB << " mom3 " << mom3_MB << " mom4 "
304  << mom4_MB << std::endl;
305 #endif
306  myTree_->Fill();
307  cells++;
308  }
309  }
310  edm::LogInfo("AnalyzerMB") << "cells" << " " << cells;
311 #ifdef DebugLog
312  std::cout << "cells" << " " << cells << std::endl;
313 #endif
314  }
315 #ifdef DebugLog
316  std::cout << "Exiting from RecAnalyzerMinbias::endjob" << std::endl;
317 #endif
318 }
static const TGPicture * info(bool iBackgroundIsBlack)
tuple cout
Definition: gather_cfg.py:145
std::map< std::pair< int, HcalDetId >, myInfo > myMap_

Member Data Documentation

int RecAnalyzerMinbias::cells
private

Definition at line 74 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

std::map<DetId,double> RecAnalyzerMinbias::corrFactor_
private

Definition at line 58 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and RecAnalyzerMinbias().

int RecAnalyzerMinbias::depth
private
double RecAnalyzerMinbias::eHighHB_
private

Definition at line 56 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginRun(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::eHighHE_
private

Definition at line 56 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginRun(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::eHighHF_
private

Definition at line 57 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginRun(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::eLowHB_
private

Definition at line 56 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::eLowHE_
private

Definition at line 56 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::eLowHF_
private

Definition at line 57 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and RecAnalyzerMinbias().

bool RecAnalyzerMinbias::fillHist_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginJob(), beginRun(), endJob(), and RecAnalyzerMinbias().

edm::Service<TFileService> RecAnalyzerMinbias::fs_
private

Definition at line 54 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and beginRun().

TH1D* RecAnalyzerMinbias::h_[4]
private

Definition at line 61 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and beginJob().

std::vector<unsigned int> RecAnalyzerMinbias::hcalID_
private

Definition at line 59 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginJob(), and RecAnalyzerMinbias().

std::map<HcalDetId,TH1D*> RecAnalyzerMinbias::histHC_
private

Definition at line 63 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and beginRun().

std::vector<TH1D*> RecAnalyzerMinbias::histo_
private

Definition at line 62 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and beginJob().

int RecAnalyzerMinbias::ieta
private

Definition at line 74 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), endJob(), and RecAnalyzerMinbias().

bool RecAnalyzerMinbias::ignoreL1_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and RecAnalyzerMinbias().

bool RecAnalyzerMinbias::init_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by beginRun().

int RecAnalyzerMinbias::iphi
private

Definition at line 74 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), endJob(), and RecAnalyzerMinbias().

float RecAnalyzerMinbias::mom0_MB
private

Definition at line 75 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float RecAnalyzerMinbias::mom1_MB
private

Definition at line 75 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float RecAnalyzerMinbias::mom2_MB
private

Definition at line 75 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float RecAnalyzerMinbias::mom3_MB
private

Definition at line 75 of file RecAnalyzerMinbias.cc.

Referenced by endJob().

float RecAnalyzerMinbias::mom4_MB
private

Definition at line 75 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

std::map<std::pair<int,HcalDetId>,myInfo> RecAnalyzerMinbias::myMap_
private

Definition at line 76 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginJob(), and endJob().

int RecAnalyzerMinbias::mysubd
private

Definition at line 74 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

TTree* RecAnalyzerMinbias::myTree_
private

Definition at line 60 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

bool RecAnalyzerMinbias::Noise_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), beginRun(), and RecAnalyzerMinbias().

double RecAnalyzerMinbias::rnnum_
private

Definition at line 65 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and analyzeHcal().

double RecAnalyzerMinbias::rnnumber
private

Definition at line 73 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

bool RecAnalyzerMinbias::runNZS_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), analyzeHcal(), and RecAnalyzerMinbias().

bool RecAnalyzerMinbias::theRecalib_
private

Definition at line 55 of file RecAnalyzerMinbias.cc.

Referenced by analyzeHcal(), and RecAnalyzerMinbias().

edm::EDGetTokenT<HBHERecHitCollection> RecAnalyzerMinbias::tok_hbherecoMB_
private

Definition at line 77 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and RecAnalyzerMinbias().

edm::EDGetTokenT<HFRecHitCollection> RecAnalyzerMinbias::tok_hfrecoMB_
private

Definition at line 78 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and RecAnalyzerMinbias().

edm::EDGetTokenT<L1GlobalTriggerObjectMapRecord> RecAnalyzerMinbias::tok_hltL1GtMap_
private

Definition at line 79 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and RecAnalyzerMinbias().

int RecAnalyzerMinbias::trigbit
private

Definition at line 74 of file RecAnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

std::vector<int> RecAnalyzerMinbias::trigbit_
private

Definition at line 64 of file RecAnalyzerMinbias.cc.

Referenced by analyze(), and RecAnalyzerMinbias().