CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowersCreator.cc
Go to the documentation of this file.
7 // severity level for ECAL
10 
11 const std::vector<double>&
13 {
14  static std::vector<double> retval;
15 
16  if (retval.size() == 0)
17  {
18  retval.push_back(0.);
19  retval.push_back(10.);
20  retval.push_back(20.);
21  retval.push_back(30.);
22  retval.push_back(40.);
23  retval.push_back(50.);
24  retval.push_back(100.);
25  retval.push_back(1000.);
26  }
27 
28  return retval;
29 }
30 
31 
33  algo_(conf.getParameter<double>("EBThreshold"),
34  conf.getParameter<double>("EEThreshold"),
35 
36  conf.getParameter<bool>("UseEtEBTreshold"),
37  conf.getParameter<bool>("UseEtEETreshold"),
38  conf.getParameter<bool>("UseSymEBTreshold"),
39  conf.getParameter<bool>("UseSymEETreshold"),
40 
41 
42  conf.getParameter<double>("HcalThreshold"),
43  conf.getParameter<double>("HBThreshold"),
44  conf.getParameter<double>("HESThreshold"),
45  conf.getParameter<double>("HEDThreshold"),
46  conf.getParameter<double>("HOThreshold0"),
47  conf.getParameter<double>("HOThresholdPlus1"),
48  conf.getParameter<double>("HOThresholdMinus1"),
49  conf.getParameter<double>("HOThresholdPlus2"),
50  conf.getParameter<double>("HOThresholdMinus2"),
51  conf.getParameter<double>("HF1Threshold"),
52  conf.getParameter<double>("HF2Threshold"),
53  conf.getParameter<std::vector<double> >("EBGrid"),
54  conf.getParameter<std::vector<double> >("EBWeights"),
55  conf.getParameter<std::vector<double> >("EEGrid"),
56  conf.getParameter<std::vector<double> >("EEWeights"),
57  conf.getParameter<std::vector<double> >("HBGrid"),
58  conf.getParameter<std::vector<double> >("HBWeights"),
59  conf.getParameter<std::vector<double> >("HESGrid"),
60  conf.getParameter<std::vector<double> >("HESWeights"),
61  conf.getParameter<std::vector<double> >("HEDGrid"),
62  conf.getParameter<std::vector<double> >("HEDWeights"),
63  conf.getParameter<std::vector<double> >("HOGrid"),
64  conf.getParameter<std::vector<double> >("HOWeights"),
65  conf.getParameter<std::vector<double> >("HF1Grid"),
66  conf.getParameter<std::vector<double> >("HF1Weights"),
67  conf.getParameter<std::vector<double> >("HF2Grid"),
68  conf.getParameter<std::vector<double> >("HF2Weights"),
69  conf.getParameter<double>("EBWeight"),
70  conf.getParameter<double>("EEWeight"),
71  conf.getParameter<double>("HBWeight"),
72  conf.getParameter<double>("HESWeight"),
73  conf.getParameter<double>("HEDWeight"),
74  conf.getParameter<double>("HOWeight"),
75  conf.getParameter<double>("HF1Weight"),
76  conf.getParameter<double>("HF2Weight"),
77  conf.getParameter<double>("EcutTower"),
78  conf.getParameter<double>("EBSumThreshold"),
79  conf.getParameter<double>("EESumThreshold"),
80  conf.getParameter<bool>("UseHO"),
81  // (for momentum reconstruction algorithm)
82  conf.getParameter<int>("MomConstrMethod"),
83  conf.getParameter<double>("MomHBDepth"),
84  conf.getParameter<double>("MomHEDepth"),
85  conf.getParameter<double>("MomEBDepth"),
86  conf.getParameter<double>("MomEEDepth")
87  ),
88 
89  hbheLabel_(conf.getParameter<edm::InputTag>("hbheInput")),
90  hoLabel_(conf.getParameter<edm::InputTag>("hoInput")),
91  hfLabel_(conf.getParameter<edm::InputTag>("hfInput")),
92  ecalLabels_(conf.getParameter<std::vector<edm::InputTag> >("ecalInputs")),
93  allowMissingInputs_(conf.getParameter<bool>("AllowMissingInputs")),
94 
95  theHcalAcceptSeverityLevel_(conf.getParameter<unsigned int>("HcalAcceptSeverityLevel")),
96 
97  theRecoveredHcalHitsAreUsed_(conf.getParameter<bool>("UseHcalRecoveredHits")),
98  theRecoveredEcalHitsAreUsed_(conf.getParameter<bool>("UseEcalRecoveredHits")),
99 
100  // paramaters controlling the use of rejected hits
101 
102  useRejectedHitsOnly_(conf.getParameter<bool>("UseRejectedHitsOnly")),
103 
104  theHcalAcceptSeverityLevelForRejectedHit_(conf.getParameter<unsigned int>("HcalAcceptSeverityLevelForRejectedHit")),
105 
106 
107  useRejectedRecoveredHcalHits_(conf.getParameter<bool>("UseRejectedRecoveredHcalHits")),
108  useRejectedRecoveredEcalHits_(conf.getParameter<bool>("UseRejectedRecoveredEcalHits"))
109 
110 
111 
112 {
121 
122  // get the Ecal severities to be excluded
123  const std::vector<std::string> severitynames =
124  conf.getParameter<std::vector<std::string> >("EcalRecHitSeveritiesToBeExcluded");
125 
126  theEcalSeveritiesToBeExcluded_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynames);
127 
128  // get the Ecal severities to be used for bad towers
130  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(conf.getParameter<std::vector<std::string> >("EcalSeveritiesToBeUsedInBadTowers") );
131 
132  if (EScales.instanceLabel=="") produces<CaloTowerCollection>();
133  else produces<CaloTowerCollection>(EScales.instanceLabel);
134 }
135 
137  // get the necessary event setup objects...
141  c.get<CaloGeometryRecord>().get(pG);
142  c.get<IdealGeometryRecord>().get(htopo);
143  c.get<IdealGeometryRecord>().get(cttopo);
144 
145  // ECAL channel status map ****************************************
147  c.get<EcalChannelStatusRcd>().get( ecalChStatus );
148  const EcalChannelStatus* dbEcalChStatus = ecalChStatus.product();
149 
150  // HCAL channel status map ****************************************
151  edm::ESHandle<HcalChannelQuality> hcalChStatus;
152  c.get<HcalChannelQualityRcd>().get( hcalChStatus );
153  const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();
154 
155  if (!dbHcalChStatus->topo()) dbHcalChStatus->setTopo(htopo.product());
156 
157  // Assignment of severity levels **********************************
158  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
159  c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
160  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
161 
162  edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl;
163  c.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl);
164  const EcalSeverityLevelAlgo* ecalSevLvlAlgo = ecalSevLvlAlgoHndl.product();
165 
166 
175  algo_.setGeometry(cttopo.product(),htopo.product(),pG.product());
176 
177  // for treatment of problematic and anomalous cells
178 
179  algo_.setHcalChStatusFromDB(dbHcalChStatus);
180  algo_.setEcalChStatusFromDB(dbEcalChStatus);
181 
184 
187 
188  algo_.setHcalSevLvlComputer(hcalSevLvlComputer);
189  algo_.setEcalSevLvlAlgo(ecalSevLvlAlgo);
190 
191 
193 
196 
199 
200 
201 
202 
203 
204  algo_.begin(); // clear the internal buffer
205 
206  // can't chain these in a big OR statement, or else it'll
207  // get triggered for each of the first three events
208  bool check1 = hcalSevLevelWatcher_.check(c);
209  bool check2 = hcalChStatusWatcher_.check(c);
210  bool check3 = caloTowerConstituentsWatcher_.check(c);
211  if(check1 || check2 || check3)
212  {
214  }
215 
216  // ----------------------------------------------------------
217  // For ecal error handling need to
218  // have access to the EB and EE collections at the end of
219  // tower reconstruction.
220 
223 
224  for (std::vector<edm::InputTag>::const_iterator i=ecalLabels_.begin();
225  i!=ecalLabels_.end(); i++) {
226 
228 
229  if (! e.getByLabel(*i,ec_tmp) ) continue;
230  if (ec_tmp->size()==0) continue;
231 
232  // check if this is EB or EE
233  if ( (ec_tmp->begin()->detid()).subdetId() == EcalBarrel ) {
234  ebHandle = ec_tmp;
235  }
236  else if ((ec_tmp->begin()->detid()).subdetId() == EcalEndcap ) {
237  eeHandle = ec_tmp;
238  }
239 
240  }
241 
242  algo_.setEbHandle(ebHandle);
243  algo_.setEeHandle(eeHandle);
244 
245  //-----------------------------------------------------------
246 
247 
248 
249  bool present;
250 
251  // Step A/C: Get Inputs and process (repeatedly)
253  present=e.getByLabel(hbheLabel_,hbhe);
254  if (present || !allowMissingInputs_) algo_.process(*hbhe);
255 
257  present=e.getByLabel(hoLabel_,ho);
258  if (present || !allowMissingInputs_) algo_.process(*ho);
259 
261  present=e.getByLabel(hfLabel_,hf);
262  if (present || !allowMissingInputs_) algo_.process(*hf);
263 
264  std::vector<edm::InputTag>::const_iterator i;
265  for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) {
267  present=e.getByLabel(*i,ec);
268  if (present || !allowMissingInputs_) algo_.process(*ec);
269  }
270 
271  // Step B: Create empty output
272  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
273 
274  // Step C: Process
275  algo_.finish(*prod);
276 
277  // Step D: Put into the event
278  if (EScales.instanceLabel=="") e.put(prod);
279  else e.put(prod,EScales.instanceLabel);
280 
281 
282 }
283 
CaloTowersCreator(const edm::ParameterSet &ps)
double HF2Scale
Definition: EScales.h:18
edm::InputTag hbheLabel_
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void setEcalChStatusFromDB(const EcalChannelStatus *s)
CaloTowersCreationAlgo algo_
double EEScale
Definition: EScales.h:12
void setHcalChStatusFromDB(const HcalChannelQuality *s)
void setTopo(const HcalTopology *topo) const
void finish(CaloTowerCollection &destCollection)
void setEeHandle(const edm::Handle< EcalRecHitCollection > ee)
double HOScale
Definition: EScales.h:16
std::vector< int > theEcalSeveritiesToBeExcluded_
double HF1Scale
Definition: EScales.h:17
double HEDScale
Definition: EScales.h:15
void setEbHandle(const edm::Handle< EcalRecHitCollection > eb)
void setUseRejectedRecoveredEcalHits(bool flag)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
void setEcalSeveritiesToBeExcluded(const std::vector< int > &ecalSev)
void setHcalAcceptSeverityLevelForRejectedHit(unsigned int level)
void setHcalSevLvlComputer(const HcalSeverityLevelComputer *c)
edm::InputTag hfLabel_
virtual void produce(edm::Event &e, const edm::EventSetup &c)
edm::InputTag hoLabel_
void SetEcalSeveritiesToBeUsedInBadTowers(const std::vector< int > &ecalSev)
void setRecoveredEcalHitsAreUsed(bool flag)
double EBScale
Definition: EScales.h:11
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
double HBScale
Definition: EScales.h:13
edm::ESWatcher< HcalChannelQualityRcd > hcalChStatusWatcher_
tuple conf
Definition: dbtoconf.py:185
void process(const HBHERecHitCollection &hbhe)
std::string instanceLabel
Definition: EScales.h:19
unsigned int theHcalAcceptSeverityLevelForRejectedHit_
void setRecoveredHcalHitsAreUsed(bool flag)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void setUseRejectedHitsOnly(bool flag)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
unsigned int theHcalAcceptSeverityLevel_
edm::SortedCollection< CaloTower > CaloTowerCollection
Definition: CaloTowerFwd.h:15
void setHcalAcceptSeverityLevel(unsigned int level)
std::vector< edm::InputTag > ecalLabels_
double HESScale
Definition: EScales.h:14
edm::ESWatcher< HcalSeverityLevelComputerRcd > hcalSevLevelWatcher_
void setEcalSevLvlAlgo(const EcalSeverityLevelAlgo *a)
void setUseRejectedRecoveredHcalHits(bool flag)
edm::ESWatcher< IdealGeometryRecord > caloTowerConstituentsWatcher_
void setGeometry(const CaloTowerConstituentsMap *cttopo, const HcalTopology *htopo, const CaloGeometry *geo)
Definition: EScales.h:4
std::vector< int > theEcalSeveritiesToBeUsedInBadTowers_
static const std::vector< double > & getGridValues()
const HcalTopology * topo() const