CMS 3D CMS Logo

HcalRealisticZS.cc
Go to the documentation of this file.
8 #include "HcalRealisticZS.h"
9 
10 #include <iostream>
11 
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  bool use1ts_ = conf.getParameter<bool>("use1ts");
27 
28  std::vector<int> tmp = conf.getParameter<std::vector<int>>("HBregion");
29 
30  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
31  edm::LogError("HcalZeroSuppression") << "ZS(HB) region error: " << tmp[0] << ":" << tmp[1];
32  tmp[0] = 0;
33  tmp[1] = 9;
34  }
35 
36  std::pair<int, int> HBsearchTS(tmp[0], tmp[1]);
37 
38  tmp = conf.getParameter<std::vector<int>>("HEregion");
39  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
40  edm::LogError("HcalZeroSuppression") << "ZS(HE) region error: " << tmp[0] << ":" << tmp[1];
41  tmp[0] = 0;
42  tmp[1] = 9;
43  }
44  std::pair<int, int> HEsearchTS(tmp[0], tmp[1]);
45 
46  tmp = conf.getParameter<std::vector<int>>("HOregion");
47  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
48  edm::LogError("HcalZeroSuppression") << "ZS(HO) region error: " << tmp[0] << ":" << tmp[1];
49  tmp[0] = 0;
50  tmp[1] = 9;
51  }
52  std::pair<int, int> HOsearchTS(tmp[0], tmp[1]);
53 
54  tmp = conf.getParameter<std::vector<int>>("HFregion");
55  if (tmp[0] < 0 || tmp[0] > 9 || tmp[1] < 0 || tmp[1] > 9 || tmp[0] > tmp[1]) {
56  edm::LogError("HcalZeroSuppression") << "ZS(HF) region error: " << tmp[0] << ":" << tmp[1];
57  tmp[0] = 0;
58  tmp[1] = 9;
59  }
60  std::pair<int, int> HFsearchTS(tmp[0], tmp[1]);
61 
62  // this constructor will be called if useConfigZSvalues is set to 1 in
63  // HcalZeroSuppressionProducers/python/hcalDigisRealistic_cfi.py
64  // which means that channel-by-channel ZS thresholds from DB will NOT be used
65  if (conf.getParameter<int>("useConfigZSvalues")) {
67  use1ts_,
68  conf.getParameter<int>("HBlevel"),
69  conf.getParameter<int>("HElevel"),
70  conf.getParameter<int>("HOlevel"),
71  conf.getParameter<int>("HFlevel"),
72  HBsearchTS,
73  HEsearchTS,
74  HOsearchTS,
75  HFsearchTS));
76 
77  } else {
78  algo_.reset(new HcalZSAlgoRealistic(markAndPass, use1ts_, HBsearchTS, HEsearchTS, HOsearchTS, HFsearchTS));
79  }
80 
81  produces<HBHEDigiCollection>();
82  produces<HODigiCollection>();
83  produces<HFDigiCollection>();
84  produces<QIE10DigiCollection>("HFQIE10DigiCollection");
85  produces<QIE11DigiCollection>("HBHEQIE11DigiCollection");
86 }
87 
88 HcalRealisticZS::~HcalRealisticZS() { algo_->clearDbService(); }
89 
96 
98  eventSetup.get<HcalDbRecord>().get(conditions);
99  algo_->setDbService(conditions.product());
100 
101  e.getByToken(tok_hbhe_, hbhe);
102 
103  // create empty output
104  std::unique_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
105 
106  e.getByToken(tok_ho_, ho);
107 
108  // create empty output
109  std::unique_ptr<HODigiCollection> zs_ho(new HODigiCollection);
110 
111  e.getByToken(tok_hf_, hf);
112 
113  // create empty output
114  std::unique_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
115 
116  e.getByToken(tok_hfQIE10_, hfQIE10);
117  e.getByToken(tok_hbheQIE11_, hbheQIE11);
118 
119  // create empty output
120  std::unique_ptr<HBHEDigiCollection> zs_hbheUpgrade(new HBHEDigiCollection);
121  std::unique_ptr<HFDigiCollection> zs_hfUpgrade(new HFDigiCollection);
122  std::unique_ptr<QIE10DigiCollection> zs_hfQIE10(new QIE10DigiCollection(hfQIE10->samples()));
123  std::unique_ptr<QIE11DigiCollection> zs_hbheQIE11(new QIE11DigiCollection(hbheQIE11->samples()));
124 
125  // run the algorithm
126  algo_->suppress(*(hbhe.product()), *zs_hbhe);
127  algo_->suppress(*(ho.product()), *zs_ho);
128  algo_->suppress(*(hf.product()), *zs_hf);
129  algo_->suppress(*(hfQIE10.product()), *zs_hfQIE10);
130  algo_->suppress(*(hbheQIE11.product()), *zs_hbheQIE11);
131 
132  edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output "
133  << zs_hbhe->size() << " digis"
134  << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
135  << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis"
136  << " (HFQIE10) input " << hfQIE10->size() << " digis, output "
137  << zs_hfQIE10->size() << " digis"
138  << " (HBHEQIE11) input " << hbheQIE11->size() << " digis, output "
139  << zs_hbheQIE11->size() << " digis";
140 
141  // return result
142  e.put(std::move(zs_hbhe));
143  e.put(std::move(zs_ho));
144  e.put(std::move(zs_hf));
145  e.put(std::move(zs_hfQIE10), "HFQIE10DigiCollection");
146  e.put(std::move(zs_hbheQIE11), "HBHEQIE11DigiCollection");
147 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Handle.h
MessageLogger.h
HcalRealisticZS::tok_hbhe_
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
Definition: HcalRealisticZS.h:29
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
HcalRealisticZS::tok_ho_
edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalRealisticZS.h:30
edm::LogInfo
Definition: MessageLogger.h:254
edm::SortedCollection
Definition: SortedCollection.h:49
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Handle
Definition: AssociativeIterator.h:50
QIE10DigiCollection
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
Definition: HcalDigiCollections.h:52
HcalDataFrameContainer::samples
int samples() const
Definition: HcalDigiCollections.h:47
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle< HcalDbService >
DigiNZS_cff.markAndPass
markAndPass
Definition: DigiNZS_cff.py:6
HcalDbRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hcalDigisRealistic_cfi.useInstanceLabels
useInstanceLabels
Definition: hcalDigisRealistic_cfi.py:12
HcalRealisticZS::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: HcalRealisticZS.cc:90
HcalRealisticZS::tok_hbheQIE11_
edm::EDGetTokenT< QIE11DigiCollection > tok_hbheQIE11_
Definition: HcalRealisticZS.h:33
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
QIE11DigiCollection
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
Definition: HcalDigiCollections.h:53
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HcalRealisticZS.h
HcalRealisticZS::inputLabel_
std::string inputLabel_
Definition: HcalRealisticZS.h:28
HcalZSAlgoRealistic
Definition: HcalZSAlgoRealistic.h:17
HcalRealisticZS::algo_
std::unique_ptr< HcalZSAlgoRealistic > algo_
Definition: HcalRealisticZS.h:27
EventSetup.h
HcalRealisticZS::HcalRealisticZS
HcalRealisticZS(const edm::ParameterSet &ps)
Definition: HcalRealisticZS.cc:12
Exception.h
HcalDbRecord
Definition: HcalDbRecord.h:30
HcalRealisticZS::~HcalRealisticZS
~HcalRealisticZS() override
Definition: HcalRealisticZS.cc:88
HcalRealisticZS::tok_hfQIE10_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
Definition: HcalRealisticZS.h:32
edm::Event
Definition: Event.h:73
HcalRealisticZS::tok_hf_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalRealisticZS.h:31
EDCollection.h
edm::InputTag
Definition: InputTag.h:15
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37