CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
AnalyzerMinbias Class Reference
Inheritance diagram for AnalyzerMinbias:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  myInfo
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 AnalyzerMinbias (const edm::ParameterSet &)
 
void beginJob () override
 
void endJob () override
 
 ~AnalyzerMinbias () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyzeHcal (const HcalRespCorrs *myRecalib, const HBHERecHitCollection &HithbheNS, const HBHERecHitCollection &HithbheMB, const HFRecHitCollection &HithfNS, const HFRecHitCollection &HithfMB, int algoBit, bool fill)
 

Private Attributes

int cells
 
int depth
 
float eta
 
std::string fOutputFileName
 
TH1D * h_Noise [4]
 
TH1D * h_Signal [4]
 
std::string hcalfile_
 
TFile * hOutputFile
 
int ieta
 
bool ignoreL1_
 
int iphi
 
float mom0_Diff
 
float mom0_MB
 
float mom0_Noise
 
float mom1_Diff
 
float mom1_MB
 
float mom1_Noise
 
float mom2_Diff
 
float mom2_MB
 
float mom2_Noise
 
float mom3_Diff
 
float mom3_MB
 
float mom3_Noise
 
float mom4_Diff
 
float mom4_MB
 
float mom4_Noise
 
int mydet
 
std::map< std::pair< int,
HcalDetId >, myInfo
myMap_
 
std::ofstream * myout_hcal
 
int mysubd
 
TTree * myTree
 
float occup
 
float phi
 
double rnnum
 
double rnnumber
 
bool runNZS_
 
bool theRecalib_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbheNormal_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbherecoMB_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbherecoNoise_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hfrecoMB_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hfrecoNoise_
 
edm::EDGetTokenT
< L1GlobalTriggerObjectMapRecord
tok_hltL1GtMap_
 
edm::EDGetTokenT
< HORecHitCollection
tok_horecoMB_
 
edm::EDGetTokenT
< HORecHitCollection
tok_horecoNoise_
 
edm::ESGetToken< HcalRespCorrs,
HcalRespCorrsRcd
tok_respCorr_
 
int trigbit
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 62 of file AnalyzerMinbias.cc.

Constructor & Destructor Documentation

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

Definition at line 117 of file AnalyzerMinbias.cc.

References fOutputFileName, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ignoreL1_, HLT_FULL_cff::InputTag, TFileService::kSharedResource, runNZS_, AlCaHLTBitMon_QueryRunRegistry::string, theRecalib_, tok_hbheNormal_, tok_hbherecoMB_, tok_hbherecoNoise_, tok_hfrecoMB_, tok_hfrecoNoise_, tok_hltL1GtMap_, tok_horecoMB_, tok_horecoNoise_, and tok_respCorr_.

117  {
118  usesResource(TFileService::kSharedResource);
119  // get name of output file with histogramms
120  fOutputFileName = iConfig.getUntrackedParameter<std::string>("HistOutFile");
121 
122  // get token names of modules, producing object collections
123  tok_hbherecoMB_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputMB"));
124  tok_horecoMB_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputMB"));
125  tok_hfrecoMB_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputMB"));
126 
127  tok_hbherecoNoise_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputNoise"));
128  tok_horecoNoise_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputNoise"));
129  tok_hfrecoNoise_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputNoise"));
130 
131  theRecalib_ = iConfig.getParameter<bool>("Recalib");
132  ignoreL1_ = iConfig.getUntrackedParameter<bool>("IgnoreL1", true);
133  runNZS_ = iConfig.getUntrackedParameter<bool>("RunNZS", true);
134 
135  tok_hbheNormal_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
136  tok_hltL1GtMap_ = consumes<L1GlobalTriggerObjectMapRecord>(edm::InputTag("hltL1GtObjectMap"));
137 
138  tok_respCorr_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
139 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNormal_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoNoise_
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respCorr_
edm::EDGetTokenT< HORecHitCollection > tok_horecoNoise_
std::string fOutputFileName
edm::EDGetTokenT< HORecHitCollection > tok_horecoMB_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoNoise_
AnalyzerMinbias::~AnalyzerMinbias ( )
override

Definition at line 141 of file AnalyzerMinbias.cc.

141 {}

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 247 of file AnalyzerMinbias.cc.

References analyzeHcal(), PVValHelper::fill(), edm::Event::getByToken(), edm::EventSetup::getData(), ignoreL1_, cuy::ii, edm::HandleBase::isValid(), convertSQLiteXML::ok, edm::Handle< T >::product(), rnnum, edm::Event::run(), runNZS_, edm::SortedCollection< T, SORT >::size(), AlCaHLTBitMon_QueryRunRegistry::string, theRecalib_, tok_hbheNormal_, tok_hbherecoMB_, tok_hbherecoNoise_, tok_hfrecoMB_, tok_hfrecoNoise_, tok_hltL1GtMap_, and tok_respCorr_.

247  {
248  rnnum = (float)iEvent.run();
249  const HcalRespCorrs* myRecalib = nullptr;
250  if (theRecalib_) {
251  myRecalib = &iSetup.getData(tok_respCorr_);
252  } // theRecalib
253 
255  iEvent.getByToken(tok_hbheNormal_, hbheNormal);
256  if (!hbheNormal.isValid()) {
257  edm::LogVerbatim("AnalyzerMB") << " hbheNormal failed";
258  } else {
259  edm::LogVerbatim("AnalyzerMB") << " The size of the normal collection " << hbheNormal->size();
260  }
261 
263  iEvent.getByToken(tok_hbherecoNoise_, hbheNS);
264  if (!hbheNS.isValid()) {
265  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbheNoise product!";
266  return;
267  }
268  const HBHERecHitCollection HithbheNS = *(hbheNS.product());
269  edm::LogVerbatim("AnalyzerMB") << "HBHE NS size of collection " << HithbheNS.size();
270  if (runNZS_ && HithbheNS.size() != 5184) {
271  edm::LogWarning("AnalyzerMB") << "HBHE NS problem " << rnnum << " size " << HithbheNS.size();
272  return;
273  }
274 
276  iEvent.getByToken(tok_hbherecoMB_, hbheMB);
277  if (!hbheMB.isValid()) {
278  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbhe product!";
279  return;
280  }
281  const HBHERecHitCollection HithbheMB = *(hbheMB.product());
282  edm::LogVerbatim("AnalyzerMB") << "HBHE MB size of collection " << HithbheMB.size();
283  if (runNZS_ && HithbheMB.size() != 5184) {
284  edm::LogWarning("AnalyzerMB") << "HBHE problem " << rnnum << " size " << HithbheMB.size();
285  return;
286  }
287 
289  iEvent.getByToken(tok_hfrecoNoise_, hfNS);
290  if (!hfNS.isValid()) {
291  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hfNoise product!";
292  return;
293  }
294  const HFRecHitCollection HithfNS = *(hfNS.product());
295  edm::LogVerbatim("AnalyzerMB") << "HF NS size of collection " << HithfNS.size();
296  if (runNZS_ && HithfNS.size() != 1728) {
297  edm::LogWarning("AnalyzerMB") << "HF NS problem " << rnnum << " size " << HithfNS.size();
298  return;
299  }
300 
302  iEvent.getByToken(tok_hfrecoMB_, hfMB);
303  if (!hfMB.isValid()) {
304  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf product!";
305  return;
306  }
307  const HFRecHitCollection HithfMB = *(hfMB.product());
308  edm::LogVerbatim("AnalyzerMB") << "HF MB size of collection " << HithfMB.size();
309  if (runNZS_ && HithfMB.size() != 1728) {
310  edm::LogWarning("AnalyzerMB") << "HF problem " << rnnum << " size " << HithfMB.size();
311  return;
312  }
313 
314  if (ignoreL1_) {
315  analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, 1, true);
316  } else {
318  iEvent.getByToken(tok_hltL1GtMap_, gtObjectMapRecord);
319  if (gtObjectMapRecord.isValid()) {
320  const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
321  int ii(0);
322  bool ok(false), fill(true);
323  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
324  ++itMap, ++ii) {
325  bool resultGt = (*itMap).algoGtlResult();
326  if (resultGt == 1) {
327  ok = true;
328  int algoBit = (*itMap).algoBitNumber();
329  analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, algoBit, fill);
330  fill = false;
331  std::string algoNameStr = (*itMap).algoName();
332 #ifdef EDM_ML_DEBUG
333  edm::LogVerbatim("AnalyzerMB") << "Trigger[" << ii << "] " << algoNameStr << " bit " << algoBit << " entered";
334 #endif
335  }
336  }
337  if (!ok)
338  edm::LogVerbatim("AnalyzerMB") << "No passed L1 Triggers";
339  }
340  }
341 }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNormal_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoNoise_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respCorr_
int ii
Definition: cuy.py:589
bool getData(T &iHolder) const
Definition: EventSetup.h:128
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
RunNumber_t run() const
Definition: Event.h:109
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
T const * product() const
Definition: Handle.h:70
size_type size() const
Log< level::Warning, false > LogWarning
void analyzeHcal(const HcalRespCorrs *myRecalib, const HBHERecHitCollection &HithbheNS, const HBHERecHitCollection &HithbheMB, const HFRecHitCollection &HithfNS, const HFRecHitCollection &HithfMB, int algoBit, bool fill)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoNoise_
void AnalyzerMinbias::analyzeHcal ( const HcalRespCorrs myRecalib,
const HBHERecHitCollection HithbheNS,
const HBHERecHitCollection HithbheMB,
const HFRecHitCollection HithfNS,
const HFRecHitCollection HithfMB,
int  algoBit,
bool  fill 
)
private

Definition at line 343 of file AnalyzerMinbias.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), HcalRespCorr::getValue(), HcalCondObjectContainer< Item >::getValues(), h_Noise, h_Signal, info(), myMap_, DetId::rawId(), rnnum, HcalDetId::subdet(), AnalyzerMinbias::myInfo::theNS0, and theRecalib_.

Referenced by analyze().

349  {
350  // Noise part for HB HE
351  std::map<std::pair<int, HcalDetId>, myInfo> tmpMap;
352  tmpMap.clear();
353 
354  for (HBHERecHitCollection::const_iterator hbheItr = HithbheNS.begin(); hbheItr != HithbheNS.end(); hbheItr++) {
355  // Recalibration of energy
356  float icalconst = 1.;
357  DetId mydetid = hbheItr->id().rawId();
358  if (theRecalib_)
359  icalconst = myRecalib->getValues(mydetid)->getValue();
360 
361  HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
362  double energyhit = aHit.energy();
363 
364  DetId id = (*hbheItr).detid();
365  HcalDetId hid = HcalDetId(id);
366  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
367  if (itr1 == myMap_.end()) {
368  myInfo info;
369  myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
370  itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
371  }
372  itr1->second.theNS0++;
373  itr1->second.theNS1 += energyhit;
374  itr1->second.theNS2 += (energyhit * energyhit);
375  itr1->second.theNS3 += (energyhit * energyhit * energyhit);
376  itr1->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
377  itr1->second.runcheck = rnnum;
378  if (fill)
379  h_Noise[hid.subdet() - 1]->Fill(energyhit);
380 
381  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
382  if (itr2 == tmpMap.end()) {
383  myInfo info;
384  tmpMap[std::pair<int, HcalDetId>(algoBit, hid)] = info;
385  itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
386  }
387  itr2->second.theNS0++;
388  itr2->second.theNS1 += energyhit;
389  itr2->second.theNS2 += (energyhit * energyhit);
390  itr2->second.theNS3 += (energyhit * energyhit * energyhit);
391  itr2->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
392  itr2->second.runcheck = rnnum;
393 
394  } // HBHE_NS
395 
396  // Signal part for HB HE
397 
398  for (HBHERecHitCollection::const_iterator hbheItr = HithbheMB.begin(); hbheItr != HithbheMB.end(); hbheItr++) {
399  // Recalibration of energy
400  float icalconst = 1.;
401  DetId mydetid = hbheItr->id().rawId();
402  if (theRecalib_)
403  icalconst = myRecalib->getValues(mydetid)->getValue();
404 
405  HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
406  double energyhit = aHit.energy();
407 
408  DetId id = (*hbheItr).detid();
409  HcalDetId hid = HcalDetId(id);
410 
411  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
412  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
413 
414  if (itr1 == myMap_.end()) {
415  myInfo info;
416  myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
417  itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
418  }
419  itr1->second.theMB0++;
420  itr1->second.theDif0 = 0;
421  itr1->second.theMB1 += energyhit;
422  itr1->second.theMB2 += (energyhit * energyhit);
423  itr1->second.theMB3 += (energyhit * energyhit * energyhit);
424  itr1->second.theMB4 += (energyhit * energyhit * energyhit * energyhit);
425  itr1->second.runcheck = rnnum;
426  float mydiff = 0.0;
427  if (itr2 != tmpMap.end()) {
428  mydiff = energyhit - (itr2->second.theNS1);
429  itr1->second.theDif0++;
430  itr1->second.theDif1 += mydiff;
431  itr1->second.theDif2 += (mydiff * mydiff);
432  if (fill)
433  h_Signal[hid.subdet() - 1]->Fill(mydiff);
434  }
435  } // HBHE_MB
436 
437  // HF
438 
439  for (HFRecHitCollection::const_iterator hbheItr = HithfNS.begin(); hbheItr != HithfNS.end(); hbheItr++) {
440  // Recalibration of energy
441  float icalconst = 1.;
442  DetId mydetid = hbheItr->id().rawId();
443  if (theRecalib_)
444  icalconst = myRecalib->getValues(mydetid)->getValue();
445 
446  HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
447  double energyhit = aHit.energy();
448  // Remove PMT hits
449  if (fabs(energyhit) > 40.)
450  continue;
451  DetId id = (*hbheItr).detid();
452  HcalDetId hid = HcalDetId(id);
453 
454  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
455 
456  if (itr1 == myMap_.end()) {
457  myInfo info;
458  myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
459  itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
460  }
461  itr1->second.theNS0++;
462  itr1->second.theNS1 += energyhit;
463  itr1->second.theNS2 += (energyhit * energyhit);
464  itr1->second.theNS3 += (energyhit * energyhit * energyhit);
465  itr1->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
466  itr1->second.runcheck = rnnum;
467  if (fill)
468  h_Noise[hid.subdet() - 1]->Fill(energyhit);
469 
470  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
471  if (itr2 == tmpMap.end()) {
472  myInfo info;
473  tmpMap[std::pair<int, HcalDetId>(algoBit, hid)] = info;
474  itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
475  }
476  itr2->second.theNS0++;
477  itr2->second.theNS1 += energyhit;
478  itr2->second.theNS2 += (energyhit * energyhit);
479  itr2->second.theNS3 += (energyhit * energyhit * energyhit);
480  itr2->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
481  itr2->second.runcheck = rnnum;
482 
483  } // HF_NS
484 
485  // Signal part for HF
486 
487  for (HFRecHitCollection::const_iterator hbheItr = HithfMB.begin(); hbheItr != HithfMB.end(); hbheItr++) {
488  // Recalibration of energy
489  float icalconst = 1.;
490  DetId mydetid = hbheItr->id().rawId();
491  if (theRecalib_)
492  icalconst = myRecalib->getValues(mydetid)->getValue();
493  HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
494 
495  double energyhit = aHit.energy();
496  // Remove PMT hits
497  if (fabs(energyhit) > 40.)
498  continue;
499 
500  DetId id = (*hbheItr).detid();
501  HcalDetId hid = HcalDetId(id);
502 
503  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
504  std::map<std::pair<int, HcalDetId>, myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
505 
506  if (itr1 == myMap_.end()) {
507  myInfo info;
508  myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
509  itr1 = myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
510  }
511  itr1->second.theMB0++;
512  itr1->second.theDif0 = 0;
513  itr1->second.theMB1 += energyhit;
514  itr1->second.theMB2 += (energyhit * energyhit);
515  itr1->second.theMB3 += (energyhit * energyhit * energyhit);
516  itr1->second.theMB4 += (energyhit * energyhit * energyhit * energyhit);
517  itr1->second.runcheck = rnnum;
518  float mydiff = 0.0;
519  if (itr2 != tmpMap.end()) {
520  mydiff = energyhit - (itr2->second.theNS1);
521  itr1->second.theDif0++;
522  itr1->second.theDif1 += mydiff;
523  itr1->second.theDif2 += (mydiff * mydiff);
524  if (fill)
525  h_Signal[hid.subdet() - 1]->Fill(mydiff);
526  }
527  }
528 }
constexpr float energy() const
Definition: CaloRecHit.h:29
static const TGPicture * info(bool iBackgroundIsBlack)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< T >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
const_iterator end() const
Definition: DetId.h:17
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
float getValue() const
Definition: HcalRespCorr.h:19
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
const_iterator begin() const
void AnalyzerMinbias::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 143 of file AnalyzerMinbias.cc.

References cells, depth, eta, fOutputFileName, h_Noise, h_Signal, hOutputFile, ieta, iphi, TFileService::make(), mom0_Diff, mom0_MB, mom0_Noise, mom1_Diff, mom1_MB, mom1_Noise, mom2_Diff, mom2_MB, mom2_Noise, mom3_MB, mom3_Noise, mom4_MB, mom4_Noise, mydet, myMap_, mysubd, myTree, mergeVDriftHistosByStation::name, occup, phi, rnnumber, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and trigbit.

143  {
144  std::string det[4] = {"HB", "HE", "HO", "HF"};
145  char name[80], title[80];
146  for (int subd = 0; subd < 4; ++subd) {
147  sprintf(name, "Noise_%s", det[subd].c_str());
148  sprintf(title, "Energy Distribution for Noise in %s", det[subd].c_str());
149  h_Noise[subd] = new TH1D(name, title, 100, -10., 10.);
150  sprintf(name, "Signal_%s", det[subd].c_str());
151  sprintf(title, "Energy Distribution for Signal in %s", det[subd].c_str());
152  h_Signal[subd] = new TH1D(name, title, 100, -10., 10.);
153  }
154 
156  hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE");
157  myTree = fs->make<TTree>("RecJet", "RecJet Tree");
158  myTree->Branch("mydet", &mydet, "mydet/I");
159  myTree->Branch("mysubd", &mysubd, "mysubd/I");
160  myTree->Branch("cells", &cells, "cells");
161  myTree->Branch("depth", &depth, "depth/I");
162  myTree->Branch("ieta", &ieta, "ieta/I");
163  myTree->Branch("iphi", &iphi, "iphi/I");
164  myTree->Branch("eta", &eta, "eta/F");
165  myTree->Branch("phi", &phi, "phi/F");
166  myTree->Branch("mom0_MB", &mom0_MB, "mom0_MB/F");
167  myTree->Branch("mom1_MB", &mom1_MB, "mom1_MB/F");
168  myTree->Branch("mom2_MB", &mom2_MB, "mom2_MB/F");
169  myTree->Branch("mom3_MB", &mom3_MB, "mom3_MB/F");
170  myTree->Branch("mom4_MB", &mom4_MB, "mom4_MB/F");
171  myTree->Branch("mom0_Noise", &mom0_Noise, "mom0_Noise/F");
172  myTree->Branch("mom1_Noise", &mom1_Noise, "mom1_Noise/F");
173  myTree->Branch("mom2_Noise", &mom2_Noise, "mom2_Noise/F");
174  myTree->Branch("mom3_Noise", &mom3_Noise, "mom3_Noise/F");
175  myTree->Branch("mom4_Noise", &mom4_Noise, "mom4_Noise/F");
176  myTree->Branch("mom0_Diff", &mom0_Diff, "mom0_Diff/F");
177  myTree->Branch("mom1_Diff", &mom1_Diff, "mom1_Diff/F");
178  myTree->Branch("mom2_Diff", &mom2_Diff, "mom2_Diff/F");
179  myTree->Branch("occup", &occup, "occup/F");
180  myTree->Branch("trigbit", &trigbit, "trigbit/I");
181  myTree->Branch("rnnumber", &rnnumber, "rnnumber/D");
182 
183  myMap_.clear();
184 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::string fOutputFileName
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
void AnalyzerMinbias::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 188 of file AnalyzerMinbias.cc.

References cells, depth, h_Noise, h_Signal, hOutputFile, mps_fire::i, ieta, cuy::ii, info(), iphi, mom0_Diff, mom0_MB, mom0_Noise, mom1_Diff, mom1_MB, mom1_Noise, mom2_Diff, mom2_MB, mom2_Noise, mom3_MB, mom3_Noise, mom4_MB, mom4_Noise, myMap_, mysubd, myTree, rnnumber, AnalyzerMinbias::myInfo::runcheck, AnalyzerMinbias::myInfo::theDif0, AnalyzerMinbias::myInfo::theDif1, AnalyzerMinbias::myInfo::theDif2, AnalyzerMinbias::myInfo::theMB0, AnalyzerMinbias::myInfo::theMB1, AnalyzerMinbias::myInfo::theMB2, AnalyzerMinbias::myInfo::theMB3, AnalyzerMinbias::myInfo::theMB4, AnalyzerMinbias::myInfo::theNS0, AnalyzerMinbias::myInfo::theNS1, AnalyzerMinbias::myInfo::theNS2, AnalyzerMinbias::myInfo::theNS3, AnalyzerMinbias::myInfo::theNS4, and trigbit.

Referenced by o2olib.O2ORunMgr::executeJob().

188  {
189  int ii = 0;
190  for (std::map<std::pair<int, HcalDetId>, myInfo>::const_iterator itr = myMap_.begin(); itr != myMap_.end(); ++itr) {
191 #ifdef EDM_ML_DEBUG
192  edm::LogVerbatim("AnalyzerMB") << "Fired trigger bit number " << itr->first.first;
193 #endif
194  myInfo info = itr->second;
195  if (info.theMB0 > 0) {
196  mom0_MB = info.theMB0;
197  mom1_MB = info.theMB1;
198  mom2_MB = info.theMB2;
199  mom3_MB = info.theMB3;
200  mom4_MB = info.theMB4;
201  mom0_Noise = info.theNS0;
202  mom1_Noise = info.theNS1;
203  mom2_Noise = info.theNS2;
204  mom3_Noise = info.theNS3;
205  mom4_Noise = info.theNS4;
206  mom0_Diff = info.theDif0;
207  mom1_Diff = info.theDif1;
208  mom2_Diff = info.theDif2;
209  rnnumber = info.runcheck;
210  trigbit = itr->first.first;
211  mysubd = itr->first.second.subdet();
212  depth = itr->first.second.depth();
213  ieta = itr->first.second.ieta();
214  iphi = itr->first.second.iphi();
215 #ifdef EDM_ML_DEBUG
216  edm::LogVerbatim("AnalyzerMB") << " Result= " << trigbit << " " << mysubd << " " << ieta << " " << iphi
217  << " mom0 " << mom0_MB << " mom1 " << mom1_MB << " mom2 " << mom2_MB << " mom3 "
218  << mom3_MB << " mom4 " << mom4_MB << " mom0_Noise " << mom0_Noise << " mom1_Noise "
219  << mom1_Noise << " mom2_Noise " << mom2_Noise << " mom3_Noise " << mom3_Noise
220  << " mom4_Noise " << mom4_Noise << " mom0_Diff " << mom0_Diff << " mom1_Diff "
221  << mom1_Diff << " mom2_Diff " << mom2_Diff;
222 #endif
223  myTree->Fill();
224  ii++;
225  }
226  }
227  cells = ii;
228 #ifdef EDM_ML_DEBUG
229  edm::LogVerbatim("AnalyzerMB") << "cells " << cells;
230 #endif
231  hOutputFile->Write();
232  hOutputFile->cd();
233  myTree->Write();
234  for (int i = 0; i < 4; i++) {
235  h_Noise[i]->Write();
236  h_Signal[i]->Write();
237  }
238  hOutputFile->Close();
239 }
Log< level::Info, true > LogVerbatim
static const TGPicture * info(bool iBackgroundIsBlack)
int ii
Definition: cuy.py:589
std::map< std::pair< int, HcalDetId >, myInfo > myMap_

Member Data Documentation

int AnalyzerMinbias::cells
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

int AnalyzerMinbias::depth
private
float AnalyzerMinbias::eta
private
std::string AnalyzerMinbias::fOutputFileName
private

Definition at line 92 of file AnalyzerMinbias.cc.

Referenced by AnalyzerMinbias(), and beginJob().

TH1D* AnalyzerMinbias::h_Noise[4]
private

Definition at line 96 of file AnalyzerMinbias.cc.

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

TH1D * AnalyzerMinbias::h_Signal[4]
private

Definition at line 96 of file AnalyzerMinbias.cc.

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

std::string AnalyzerMinbias::hcalfile_
private

Definition at line 92 of file AnalyzerMinbias.cc.

TFile* AnalyzerMinbias::hOutputFile
private

Definition at line 94 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

int AnalyzerMinbias::ieta
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

bool AnalyzerMinbias::ignoreL1_
private

Definition at line 97 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

int AnalyzerMinbias::iphi
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom0_Diff
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom0_MB
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom0_Noise
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom1_Diff
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom1_MB
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom1_Noise
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom2_Diff
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom2_MB
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom2_Noise
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom3_Diff
private

Definition at line 106 of file AnalyzerMinbias.cc.

float AnalyzerMinbias::mom3_MB
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom3_Noise
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom4_Diff
private

Definition at line 106 of file AnalyzerMinbias.cc.

float AnalyzerMinbias::mom4_MB
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::mom4_Noise
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

int AnalyzerMinbias::mydet
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob().

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

Definition at line 108 of file AnalyzerMinbias.cc.

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

std::ofstream* AnalyzerMinbias::myout_hcal
private

Definition at line 93 of file AnalyzerMinbias.cc.

int AnalyzerMinbias::mysubd
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

TTree* AnalyzerMinbias::myTree
private

Definition at line 95 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

float AnalyzerMinbias::occup
private

Definition at line 104 of file AnalyzerMinbias.cc.

Referenced by beginJob().

float AnalyzerMinbias::phi
private
double AnalyzerMinbias::rnnum
private

Definition at line 98 of file AnalyzerMinbias.cc.

Referenced by analyze(), and analyzeHcal().

double AnalyzerMinbias::rnnumber
private

Definition at line 101 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

bool AnalyzerMinbias::runNZS_
private

Definition at line 97 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

bool AnalyzerMinbias::theRecalib_
private

Definition at line 97 of file AnalyzerMinbias.cc.

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

edm::EDGetTokenT<HBHERecHitCollection> AnalyzerMinbias::tok_hbheNormal_
private

Definition at line 112 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

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

Definition at line 109 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

edm::EDGetTokenT<HBHERecHitCollection> AnalyzerMinbias::tok_hbherecoNoise_
private

Definition at line 109 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

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

Definition at line 110 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

edm::EDGetTokenT<HFRecHitCollection> AnalyzerMinbias::tok_hfrecoNoise_
private

Definition at line 110 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

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

Definition at line 113 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

edm::EDGetTokenT<HORecHitCollection> AnalyzerMinbias::tok_horecoMB_
private

Definition at line 111 of file AnalyzerMinbias.cc.

Referenced by AnalyzerMinbias().

edm::EDGetTokenT<HORecHitCollection> AnalyzerMinbias::tok_horecoNoise_
private

Definition at line 111 of file AnalyzerMinbias.cc.

Referenced by AnalyzerMinbias().

edm::ESGetToken<HcalRespCorrs, HcalRespCorrsRcd> AnalyzerMinbias::tok_respCorr_
private

Definition at line 114 of file AnalyzerMinbias.cc.

Referenced by analyze(), and AnalyzerMinbias().

int AnalyzerMinbias::trigbit
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().