CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalRealisticZS.cc
Go to the documentation of this file.
11 
12 using namespace std;
13 
14 #include <iostream>
15 
17  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
18 {
19  bool markAndPass=conf.getParameter<bool>("markAndPass");
20 
21 
22  std::vector<int> tmp = conf.getParameter<std::vector<int> >("HBregion");
23 
24  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
25  edm::LogError("HcalZeroSuppression") << "ZS(HB) region error: "
26  << tmp[0] << ":" <<tmp[1];
27  tmp[0]=0; tmp[1]=9;
28  }
29 
30  std::pair<int,int> HBsearchTS (tmp[0],tmp[1]);
31 
32  tmp = conf.getParameter<std::vector<int> >("HEregion");
33  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
34  edm::LogError("HcalZeroSuppression") << "ZS(HE) region error: "
35  << tmp[0] << ":" <<tmp[1];
36  tmp[0]=0; tmp[1]=9;
37  }
38  std::pair<int,int> HEsearchTS (tmp[0],tmp[1]);
39 
40  tmp = conf.getParameter<std::vector<int> >("HOregion");
41  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
42  edm::LogError("HcalZeroSuppression") << "ZS(HO) region error: "
43  << tmp[0] << ":" <<tmp[1];
44  tmp[0]=0; tmp[1]=9;
45  }
46  std::pair<int,int> HOsearchTS (tmp[0],tmp[1]);
47 
48  tmp = conf.getParameter<std::vector<int> >("HFregion");
49  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
50  edm::LogError("HcalZeroSuppression") << "ZS(HF) region error: "
51  << tmp[0] << ":" <<tmp[1];
52  tmp[0]=0; tmp[1]=9;
53  }
54  std::pair<int,int> HFsearchTS (tmp[0],tmp[1]);
55 
56 
57  //this constructor will be called if useConfigZSvalues is set to 1 in
58  //HcalZeroSuppressionProducers/python/hcalDigisRealistic_cfi.py
59  //which means that channel-by-channel ZS thresholds from DB will NOT be used
60  if ( conf.getParameter<int>("useConfigZSvalues") ) {
61 
62  algo_=std::auto_ptr<HcalZSAlgoRealistic>
63  (new HcalZSAlgoRealistic (markAndPass,
64  conf.getParameter<int>("HBlevel"),
65  conf.getParameter<int>("HElevel"),
66  conf.getParameter<int>("HOlevel"),
67  conf.getParameter<int>("HFlevel"),
68  HBsearchTS,
69  HEsearchTS,
70  HOsearchTS,
71  HFsearchTS
72  ));
73 
74  }
75  else {
76 
77  algo_=std::auto_ptr<HcalZSAlgoRealistic>
78  (new HcalZSAlgoRealistic(markAndPass,
79  HBsearchTS,
80  HEsearchTS,
81  HOsearchTS,
82  HFsearchTS));
83  }
84 
85  produces<HBHEDigiCollection>();
86  produces<HODigiCollection>();
87  produces<HFDigiCollection>();
88 
89 }
90 
92  algo_->clearDbService();
93 }
94 
96 {
97 
101 
102  edm::ESHandle<HcalDbService> conditions;
103  eventSetup.get<HcalDbRecord>().get(conditions);
104  algo_->setDbService(conditions.product());
105 
106  e.getByLabel(inputLabel_,hbhe);
107 
108  // create empty output
109  std::auto_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
110 
111  e.getByLabel(inputLabel_,ho);
112 
113  // create empty output
114  std::auto_ptr<HODigiCollection> zs_ho(new HODigiCollection);
115 
116  e.getByLabel(inputLabel_,hf);
117 
118  // create empty output
119  std::auto_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
120 
121  //run the algorithm
122 
123  algo_->suppress(*(hbhe.product()),*zs_hbhe);
124  algo_->suppress(*(ho.product()),*zs_ho);
125  algo_->suppress(*(hf.product()),*zs_hf);
126 
127 
128  edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output " << zs_hbhe->size() << " digis"
129  << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
130  << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis";
131 
132 
133  // return result
134  e.put(zs_hbhe);
135  e.put(zs_ho);
136  e.put(zs_hf);
137 
138 }
T getParameter(std::string const &) const
std::auto_ptr< HcalZSAlgoRealistic > algo_
virtual ~HcalRealisticZS()
edm::InputTag inputLabel_
virtual void produce(edm::Event &e, const edm::EventSetup &c)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple conf
Definition: dbtoconf.py:185
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HcalRealisticZS(const edm::ParameterSet &ps)