CMS 3D CMS Logo

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=default
 
- 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
 
const std::string fOutputFileName
 
TH1D * h_Noise [4]
 
TH1D * h_Signal [4]
 
std::string hcalfile_
 
TFile * hOutputFile_
 
int ieta
 
const 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 >, myInfomyMap_
 
std::ofstream * myout_hcal
 
int mysubd
 
TTree * myTree_
 
float occup
 
float phi
 
double rnnum_
 
double rnnumber
 
const bool runNZS_
 
const bool theRecalib_
 
const edm::EDGetTokenT< HBHERecHitCollectiontok_hbheNormal_
 
const edm::EDGetTokenT< HBHERecHitCollectiontok_hbherecoMB_
 
const edm::EDGetTokenT< HBHERecHitCollectiontok_hbherecoNoise_
 
const edm::EDGetTokenT< HFRecHitCollectiontok_hfrecoMB_
 
const edm::EDGetTokenT< HFRecHitCollectiontok_hfrecoNoise_
 
const edm::EDGetTokenT< L1GlobalTriggerObjectMapRecordtok_hltL1GtMap_
 
const edm::EDGetTokenT< HORecHitCollectiontok_horecoMB_
 
const edm::EDGetTokenT< HORecHitCollectiontok_horecoNoise_
 
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcdtok_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< Bconsumes (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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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::AnalyzerMinbias ( const edm::ParameterSet iConfig)
explicit

Definition at line 118 of file AnalyzerMinbias.cc.

References TFileService::kSharedResource.

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

◆ ~AnalyzerMinbias()

AnalyzerMinbias::~AnalyzerMinbias ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 241 of file AnalyzerMinbias.cc.

References analyzeHcal(), ntuplemaker::fill, dqmMemoryStats::float, edm::EventSetup::getData(), L1GlobalTriggerObjectMapRecord::gtObjectMap(), iEvent, ignoreL1_, cuy::ii, edm::HandleBase::isValid(), convertSQLiteXML::ok, edm::Handle< T >::product(), rnnum_, 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_.

241  {
242  rnnum_ = (float)iEvent.run();
243  const HcalRespCorrs* myRecalib = nullptr;
244  if (theRecalib_) {
245  myRecalib = &iSetup.getData(tok_respCorr_);
246  } // theRecalib
247 
248  const edm::Handle<HBHERecHitCollection> hbheNormal = iEvent.getHandle(tok_hbheNormal_);
249  if (!hbheNormal.isValid()) {
250  edm::LogVerbatim("AnalyzerMinimumBias") << " hbheNormal failed";
251  } else {
252  edm::LogVerbatim("AnalyzerMinimumBias") << " The size of the normal collection " << hbheNormal->size();
253  }
254 
256  if (!hbheNS.isValid()) {
257  edm::LogWarning("AnalyzerMinimumBias") << "HcalCalibAlgos: Error! can't get hbheNoise product!";
258  return;
259  }
260  const HBHERecHitCollection HithbheNS = *(hbheNS.product());
261  edm::LogVerbatim("AnalyzerMinimumBias") << "HBHE NS size of collection " << HithbheNS.size();
262  if (runNZS_ && HithbheNS.size() != 5184) {
263  edm::LogWarning("AnalyzerMinimumBias") << "HBHE NS problem " << rnnum_ << " size " << HithbheNS.size();
264  return;
265  }
266 
267  const edm::Handle<HBHERecHitCollection> hbheMB = iEvent.getHandle(tok_hbherecoMB_);
268  if (!hbheMB.isValid()) {
269  edm::LogWarning("AnalyzerMinimumBias") << "HcalCalibAlgos: Error! can't get hbhe product!";
270  return;
271  }
272  const HBHERecHitCollection HithbheMB = *(hbheMB.product());
273  edm::LogVerbatim("AnalyzerMinimumBias") << "HBHE MB size of collection " << HithbheMB.size();
274  if (runNZS_ && HithbheMB.size() != 5184) {
275  edm::LogWarning("AnalyzerMinimumBias") << "HBHE problem " << rnnum_ << " size " << HithbheMB.size();
276  return;
277  }
278 
280  if (!hfNS.isValid()) {
281  edm::LogWarning("AnalyzerMinimumBias") << "HcalCalibAlgos: Error! can't get hfNoise product!";
282  return;
283  }
284  const HFRecHitCollection HithfNS = *(hfNS.product());
285  edm::LogVerbatim("AnalyzerMinimumBias") << "HF NS size of collection " << HithfNS.size();
286  if (runNZS_ && HithfNS.size() != 1728) {
287  edm::LogWarning("AnalyzerMinimumBias") << "HF NS problem " << rnnum_ << " size " << HithfNS.size();
288  return;
289  }
290 
291  const edm::Handle<HFRecHitCollection> hfMB = iEvent.getHandle(tok_hfrecoMB_);
292  if (!hfMB.isValid()) {
293  edm::LogWarning("AnalyzerMinimumBias") << "HcalCalibAlgos: Error! can't get hf product!";
294  return;
295  }
296  const HFRecHitCollection HithfMB = *(hfMB.product());
297  edm::LogVerbatim("AnalyzerMinimumBias") << "HF MB size of collection " << HithfMB.size();
298  if (runNZS_ && HithfMB.size() != 1728) {
299  edm::LogWarning("AnalyzerMinimumBias") << "HF problem " << rnnum_ << " size " << HithfMB.size();
300  return;
301  }
302 
303  if (ignoreL1_) {
304  analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, 1, true);
305  } else {
306  const edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord = iEvent.getHandle(tok_hltL1GtMap_);
307  if (gtObjectMapRecord.isValid()) {
308  const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
309  int ii(0);
310  bool ok(false), fill(true);
311  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
312  ++itMap, ++ii) {
313  bool resultGt = (*itMap).algoGtlResult();
314  if (resultGt == 1) {
315  ok = true;
316  int algoBit = (*itMap).algoBitNumber();
317  analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, algoBit, fill);
318  fill = false;
319  std::string algoNameStr = (*itMap).algoName();
320 #ifdef EDM_ML_DEBUG
321  edm::LogVerbatim("AnalyzerMinimumBias")
322  << "Trigger[" << ii << "] " << algoNameStr << " bit " << algoBit << " entered";
323 #endif
324  }
325  }
326  if (!ok)
327  edm::LogVerbatim("AnalyzerMinimumBias") << "No passed L1 Triggers";
328  }
329  }
330 }
Log< level::Info, true > LogVerbatim
size_type size() const
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoNoise_
const edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNormal_
const edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoNoise_
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respCorr_
ii
Definition: cuy.py:589
bool isValid() const
Definition: HandleBase.h:70
const bool theRecalib_
const bool ignoreL1_
const bool runNZS_
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)

◆ analyzeHcal()

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 332 of file AnalyzerMinbias.cc.

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

Referenced by analyze().

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

◆ beginJob()

void AnalyzerMinbias::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 137 of file AnalyzerMinbias.cc.

References cells, depth, eta, fOutputFileName, compareTotals::fs, h_Noise, h_Signal, hOutputFile_, ieta, 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, mydet, myMap_, mysubd, myTree_, Skims_PA_cff::name, occup, phi, rnnumber, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and trigbit.

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

◆ endJob()

void AnalyzerMinbias::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 182 of file AnalyzerMinbias.cc.

References cells, depth, h_Noise, h_Signal, hOutputFile_, mps_fire::i, ieta, cuy::ii, info(), iphi, genParticles_cff::map, 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, and trigbit.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Member Data Documentation

◆ cells

int AnalyzerMinbias::cells
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ depth

int AnalyzerMinbias::depth
private

◆ eta

float AnalyzerMinbias::eta
private

◆ fOutputFileName

const std::string AnalyzerMinbias::fOutputFileName
private

Definition at line 92 of file AnalyzerMinbias.cc.

Referenced by beginJob().

◆ h_Noise

TH1D* AnalyzerMinbias::h_Noise[4]
private

Definition at line 98 of file AnalyzerMinbias.cc.

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

◆ h_Signal

TH1D * AnalyzerMinbias::h_Signal[4]
private

Definition at line 98 of file AnalyzerMinbias.cc.

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

◆ hcalfile_

std::string AnalyzerMinbias::hcalfile_
private

Definition at line 94 of file AnalyzerMinbias.cc.

◆ hOutputFile_

TFile* AnalyzerMinbias::hOutputFile_
private

Definition at line 96 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ ieta

int AnalyzerMinbias::ieta
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ ignoreL1_

const bool AnalyzerMinbias::ignoreL1_
private

Definition at line 93 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ iphi

int AnalyzerMinbias::iphi
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom0_Diff

float AnalyzerMinbias::mom0_Diff
private

Definition at line 107 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom0_MB

float AnalyzerMinbias::mom0_MB
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom0_Noise

float AnalyzerMinbias::mom0_Noise
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom1_Diff

float AnalyzerMinbias::mom1_Diff
private

Definition at line 107 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom1_MB

float AnalyzerMinbias::mom1_MB
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom1_Noise

float AnalyzerMinbias::mom1_Noise
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom2_Diff

float AnalyzerMinbias::mom2_Diff
private

Definition at line 107 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom2_MB

float AnalyzerMinbias::mom2_MB
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom2_Noise

float AnalyzerMinbias::mom2_Noise
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom3_Diff

float AnalyzerMinbias::mom3_Diff
private

Definition at line 107 of file AnalyzerMinbias.cc.

◆ mom3_MB

float AnalyzerMinbias::mom3_MB
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom3_Noise

float AnalyzerMinbias::mom3_Noise
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom4_Diff

float AnalyzerMinbias::mom4_Diff
private

Definition at line 107 of file AnalyzerMinbias.cc.

◆ mom4_MB

float AnalyzerMinbias::mom4_MB
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mom4_Noise

float AnalyzerMinbias::mom4_Noise
private

Definition at line 106 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ mydet

int AnalyzerMinbias::mydet
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob().

◆ myMap_

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

Definition at line 109 of file AnalyzerMinbias.cc.

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

◆ myout_hcal

std::ofstream* AnalyzerMinbias::myout_hcal
private

Definition at line 95 of file AnalyzerMinbias.cc.

◆ mysubd

int AnalyzerMinbias::mysubd
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ myTree_

TTree* AnalyzerMinbias::myTree_
private

Definition at line 97 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ occup

float AnalyzerMinbias::occup
private

Definition at line 105 of file AnalyzerMinbias.cc.

Referenced by beginJob().

◆ phi

float AnalyzerMinbias::phi
private

◆ rnnum_

double AnalyzerMinbias::rnnum_
private

Definition at line 99 of file AnalyzerMinbias.cc.

Referenced by analyze(), and analyzeHcal().

◆ rnnumber

double AnalyzerMinbias::rnnumber
private

Definition at line 102 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().

◆ runNZS_

const bool AnalyzerMinbias::runNZS_
private

Definition at line 93 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ theRecalib_

const bool AnalyzerMinbias::theRecalib_
private

Definition at line 93 of file AnalyzerMinbias.cc.

Referenced by analyze(), and analyzeHcal().

◆ tok_hbheNormal_

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

Definition at line 113 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_hbherecoMB_

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

Definition at line 110 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_hbherecoNoise_

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

Definition at line 110 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_hfrecoMB_

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

Definition at line 112 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_hfrecoNoise_

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

Definition at line 112 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_hltL1GtMap_

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

Definition at line 114 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ tok_horecoMB_

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

Definition at line 111 of file AnalyzerMinbias.cc.

◆ tok_horecoNoise_

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

Definition at line 111 of file AnalyzerMinbias.cc.

◆ tok_respCorr_

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

Definition at line 115 of file AnalyzerMinbias.cc.

Referenced by analyze().

◆ trigbit

int AnalyzerMinbias::trigbit
private

Definition at line 103 of file AnalyzerMinbias.cc.

Referenced by beginJob(), and endJob().