CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalRealisticZS Class Reference

#include <HcalRealisticZS.h>

Inheritance diagram for HcalRealisticZS:
edm::stream::EDProducer<>

Public Member Functions

 HcalRealisticZS (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~HcalRealisticZS () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::unique_ptr< HcalZSAlgoRealisticalgo_
 
std::string inputLabel_
 
edm::EDGetTokenT< HBHEDigiCollectiontok_hbhe_
 
edm::EDGetTokenT< QIE11DigiCollectiontok_hbheQIE11_
 
edm::EDGetTokenT< HFDigiCollectiontok_hf_
 
edm::EDGetTokenT< QIE10DigiCollectiontok_hfQIE10_
 
edm::EDGetTokenT< HODigiCollectiontok_ho_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 20 of file HcalRealisticZS.h.

Constructor & Destructor Documentation

HcalRealisticZS::HcalRealisticZS ( const edm::ParameterSet ps)
explicit

Definition at line 12 of file HcalRealisticZS.cc.

References algo_, edm::ParameterSet::getParameter(), inputLabel_, HLT_2018_cff::InputTag, DigiNZS_cff::markAndPass, createJobs::tmp, tok_hbhe_, tok_hbheQIE11_, tok_hf_, tok_hfQIE10_, tok_ho_, and hcalDigisRealistic_cfi::useInstanceLabels.

13  : inputLabel_(conf.getParameter<std::string>("digiLabel")) {
14  bool markAndPass = conf.getParameter<bool>("markAndPass");
15  bool useInstanceLabels = conf.getParameter<bool>("useInstanceLabels");
16 
17  // register for data access
18  tok_hbhe_ = consumes<HBHEDigiCollection>(edm::InputTag(inputLabel_));
19  tok_ho_ = consumes<HODigiCollection>(edm::InputTag(inputLabel_));
20  tok_hf_ = consumes<HFDigiCollection>(edm::InputTag(inputLabel_));
21  tok_hfQIE10_ =
22  consumes<QIE10DigiCollection>(edm::InputTag(inputLabel_, useInstanceLabels ? "HFQIE10DigiCollection" : ""));
24  consumes<QIE11DigiCollection>(edm::InputTag(inputLabel_, useInstanceLabels ? "HBHEQIE11DigiCollection" : ""));
25 
26  std::vector<int> tmp = conf.getParameter<std::vector<int>>("HBregion");
27 
28  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
29  edm::LogError("HcalZeroSuppression") << "ZS(HB) region error: " << tmp[0] << ":" << tmp[1];
30  tmp[0] = 0;
31  tmp[1] = 9;
32  }
33 
34  std::pair<int, int> HBsearchTS(tmp[0], tmp[1]);
35 
36  tmp = conf.getParameter<std::vector<int>>("HEregion");
37  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
38  edm::LogError("HcalZeroSuppression") << "ZS(HE) region error: " << tmp[0] << ":" << tmp[1];
39  tmp[0] = 0;
40  tmp[1] = 9;
41  }
42  std::pair<int, int> HEsearchTS(tmp[0], tmp[1]);
43 
44  tmp = conf.getParameter<std::vector<int>>("HOregion");
45  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
46  edm::LogError("HcalZeroSuppression") << "ZS(HO) region error: " << tmp[0] << ":" << tmp[1];
47  tmp[0] = 0;
48  tmp[1] = 9;
49  }
50  std::pair<int, int> HOsearchTS(tmp[0], tmp[1]);
51 
52  tmp = conf.getParameter<std::vector<int>>("HFregion");
53  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
54  edm::LogError("HcalZeroSuppression") << "ZS(HF) region error: " << tmp[0] << ":" << tmp[1];
55  tmp[0] = 0;
56  tmp[1] = 9;
57  }
58  std::pair<int, int> HFsearchTS(tmp[0], tmp[1]);
59 
60  // this constructor will be called if useConfigZSvalues is set to 1 in
61  // HcalZeroSuppressionProducers/python/hcalDigisRealistic_cfi.py
62  // which means that channel-by-channel ZS thresholds from DB will NOT be used
63  if (conf.getParameter<int>("useConfigZSvalues")) {
64  algo_.reset(new HcalZSAlgoRealistic(markAndPass,
65  conf.getParameter<int>("HBlevel"),
66  conf.getParameter<int>("HElevel"),
67  conf.getParameter<int>("HOlevel"),
68  conf.getParameter<int>("HFlevel"),
69  HBsearchTS,
70  HEsearchTS,
71  HOsearchTS,
72  HFsearchTS));
73 
74  } else {
75  algo_.reset(new HcalZSAlgoRealistic(markAndPass, HBsearchTS, HEsearchTS, HOsearchTS, HFsearchTS));
76  }
77 
78  produces<HBHEDigiCollection>();
79  produces<HODigiCollection>();
80  produces<HFDigiCollection>();
81  produces<QIE10DigiCollection>("HFQIE10DigiCollection");
82  produces<QIE11DigiCollection>("HBHEQIE11DigiCollection");
83 }
edm::EDGetTokenT< HODigiCollection > tok_ho_
std::unique_ptr< HcalZSAlgoRealistic > algo_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
std::string inputLabel_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< QIE11DigiCollection > tok_hbheQIE11_
tmp
align.sh
Definition: createJobs.py:716
HcalRealisticZS::~HcalRealisticZS ( )
override

Definition at line 85 of file HcalRealisticZS.cc.

References algo_.

85 { algo_->clearDbService(); }
std::unique_ptr< HcalZSAlgoRealistic > algo_

Member Function Documentation

void HcalRealisticZS::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 87 of file HcalRealisticZS.cc.

References algo_, edm::EventSetup::get(), edm::Event::getByToken(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), HcalDataFrameContainer< Digi >::samples(), edm::SortedCollection< T, SORT >::size(), edm::DataFrameContainer::size(), tok_hbhe_, tok_hbheQIE11_, tok_hf_, tok_hfQIE10_, and tok_ho_.

87  {
93 
95  eventSetup.get<HcalDbRecord>().get(conditions);
96  algo_->setDbService(conditions.product());
97 
98  e.getByToken(tok_hbhe_, hbhe);
99 
100  // create empty output
101  std::unique_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
102 
103  e.getByToken(tok_ho_, ho);
104 
105  // create empty output
106  std::unique_ptr<HODigiCollection> zs_ho(new HODigiCollection);
107 
108  e.getByToken(tok_hf_, hf);
109 
110  // create empty output
111  std::unique_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
112 
113  e.getByToken(tok_hfQIE10_, hfQIE10);
114  e.getByToken(tok_hbheQIE11_, hbheQIE11);
115 
116  // create empty output
117  std::unique_ptr<HBHEDigiCollection> zs_hbheUpgrade(new HBHEDigiCollection);
118  std::unique_ptr<HFDigiCollection> zs_hfUpgrade(new HFDigiCollection);
119  std::unique_ptr<QIE10DigiCollection> zs_hfQIE10(new QIE10DigiCollection(hfQIE10->samples()));
120  std::unique_ptr<QIE11DigiCollection> zs_hbheQIE11(new QIE11DigiCollection(hbheQIE11->samples()));
121 
122  // run the algorithm
123  algo_->suppress(*(hbhe.product()), *zs_hbhe);
124  algo_->suppress(*(ho.product()), *zs_ho);
125  algo_->suppress(*(hf.product()), *zs_hf);
126  algo_->suppress(*(hfQIE10.product()), *zs_hfQIE10);
127  algo_->suppress(*(hbheQIE11.product()), *zs_hbheQIE11);
128 
129  edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output "
130  << zs_hbhe->size() << " digis"
131  << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
132  << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis"
133  << " (HFQIE10) input " << hfQIE10->size() << " digis, output "
134  << zs_hfQIE10->size() << " digis"
135  << " (HBHEQIE11) input " << hbheQIE11->size() << " digis, output "
136  << zs_hbheQIE11->size() << " digis";
137 
138  // return result
139  e.put(std::move(zs_hbhe));
140  e.put(std::move(zs_ho));
141  e.put(std::move(zs_hf));
142  e.put(std::move(zs_hfQIE10), "HFQIE10DigiCollection");
143  e.put(std::move(zs_hbheQIE11), "HBHEQIE11DigiCollection");
144 }
edm::EDGetTokenT< HODigiCollection > tok_ho_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::unique_ptr< HcalZSAlgoRealistic > algo_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
T const * product() const
Definition: Handle.h:69
size_type size() const
edm::EDGetTokenT< QIE11DigiCollection > tok_hbheQIE11_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::unique_ptr<HcalZSAlgoRealistic> HcalRealisticZS::algo_
private

Definition at line 27 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), produce(), and ~HcalRealisticZS().

std::string HcalRealisticZS::inputLabel_
private

Definition at line 28 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS().

edm::EDGetTokenT<HBHEDigiCollection> HcalRealisticZS::tok_hbhe_
private

Definition at line 29 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<QIE11DigiCollection> HcalRealisticZS::tok_hbheQIE11_
private

Definition at line 33 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<HFDigiCollection> HcalRealisticZS::tok_hf_
private

Definition at line 31 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<QIE10DigiCollection> HcalRealisticZS::tok_hfQIE10_
private

Definition at line 32 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<HODigiCollection> HcalRealisticZS::tok_ho_
private

Definition at line 30 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().