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