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  // Assignment of severity levels **********************************
156  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
157  c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
158  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
159 
160  edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl;
161  c.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl);
162  const EcalSeverityLevelAlgo* ecalSevLvlAlgo = ecalSevLvlAlgoHndl.product();
163 
164 
173  algo_.setGeometry(cttopo.product(),htopo.product(),pG.product());
174 
175  // for treatment of problematic and anomalous cells
176 
177  algo_.setHcalChStatusFromDB(dbHcalChStatus);
178  algo_.setEcalChStatusFromDB(dbEcalChStatus);
179 
182 
185 
186  algo_.setHcalSevLvlComputer(hcalSevLvlComputer);
187  algo_.setEcalSevLvlAlgo(ecalSevLvlAlgo);
188 
189 
191 
194 
197 
198 
199 
200 
201 
202  algo_.begin(); // clear the internal buffer
203 
204  // can't chain these in a big OR statement, or else it'll
205  // get triggered for each of the first three events
206  bool check1 = hcalSevLevelWatcher_.check(c);
207  bool check2 = hcalChStatusWatcher_.check(c);
208  bool check3 = caloTowerConstituentsWatcher_.check(c);
209  if(check1 || check2 || check3)
210  {
212  }
213 
214  // ----------------------------------------------------------
215  // For ecal error handling need to
216  // have access to the EB and EE collections at the end of
217  // tower reconstruction.
218 
221 
222  for (std::vector<edm::InputTag>::const_iterator i=ecalLabels_.begin();
223  i!=ecalLabels_.end(); i++) {
224 
226 
227  if (! e.getByLabel(*i,ec_tmp) ) continue;
228  if (ec_tmp->size()==0) continue;
229 
230  // check if this is EB or EE
231  if ( (ec_tmp->begin()->detid()).subdetId() == EcalBarrel ) {
232  ebHandle = ec_tmp;
233  }
234  else if ((ec_tmp->begin()->detid()).subdetId() == EcalEndcap ) {
235  eeHandle = ec_tmp;
236  }
237 
238  }
239 
240  algo_.setEbHandle(ebHandle);
241  algo_.setEeHandle(eeHandle);
242 
243  //-----------------------------------------------------------
244 
245 
246 
247  bool present;
248 
249  // Step A/C: Get Inputs and process (repeatedly)
251  present=e.getByLabel(hbheLabel_,hbhe);
252  if (present || !allowMissingInputs_) algo_.process(*hbhe);
253 
255  present=e.getByLabel(hoLabel_,ho);
256  if (present || !allowMissingInputs_) algo_.process(*ho);
257 
259  present=e.getByLabel(hfLabel_,hf);
260  if (present || !allowMissingInputs_) algo_.process(*hf);
261 
262  std::vector<edm::InputTag>::const_iterator i;
263  for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) {
265  present=e.getByLabel(*i,ec);
266  if (present || !allowMissingInputs_) algo_.process(*ec);
267  }
268 
269  // Step B: Create empty output
270  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
271 
272  // Step C: Process
273  algo_.finish(*prod);
274 
275  // Step D: Put into the event
276  if (EScales.instanceLabel=="") e.put(prod);
277  else e.put(prod,EScales.instanceLabel);
278 
279 
280 }
281 
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 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:85
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:356
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()