CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalQLPlotAnal.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalQLPlotAnal
4 // Class: HcalQLPlotAnal
5 //
13 //
14 // Original Author: Phillip R. Dudero
15 // Created: Tue Jan 16 21:11:37 CST 2007
16 // $Id: HcalQLPlotAnal.cc,v 1.5 2007/12/31 18:43:18 ratnik Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
37 #include <string>
38 //
39 // class declaration
40 //
41 
43  public:
44  explicit HcalQLPlotAnal(const edm::ParameterSet&);
46 
47 
48  private:
49  virtual void analyze(const edm::Event&, const edm::EventSetup&);
50  virtual void endJob() ;
51 
52  // ----------member data ---------------------------
55  bool doCalib_;
56  double calibFC2GeV_;
58 
59 };
60 
61 //
62 // constants, enums and typedefs
63 //
64 
65 //
66 // static data member definitions
67 //
68 
69 //
70 // constructors and destructor
71 //
73  hbheRHLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hbheRHtag")),
74  hoRHLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hoRHtag")),
75  hfRHLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hfRHtag")),
76  hcalDigiLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hcalDigiTag")),
77  hcalTrigLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hcalTrigTag")),
78  doCalib_(iConfig.getUntrackedParameter<bool>("doCalib",false)),
79  calibFC2GeV_(iConfig.getUntrackedParameter<double>("calibFC2GeV",0.2))
80 {
81  algo_ = new
82  HcalQLPlotAnalAlgos(iConfig.getUntrackedParameter<std::string>("outputFilename").c_str(),
83  iConfig.getParameter<edm::ParameterSet>("HistoParameters"));
84 }
85 
86 
88 {
89  // do anything here that needs to be done at destruction time
90  // (e.g. close files, deallocate resources etc.)
91 }
92 
93 
94 //
95 // member functions
96 //
97 
98 // ------------ method called to for each event ------------
99 void
101 {
102  // Step A/C: Get Inputs and process (repeatedly)
104  iEvent.getByLabel(hcalTrigLabel_,trig);
105  if (!trig.isValid()) {
106  edm::LogError("HcalQLPlotAnal::analyze") << "No Trigger Data found, skip event";
107  return;
108  } else {
109  algo_->SetEventType(*trig);
110  }
112  iEvent.getByLabel(hcalDigiLabel_,hbhedg);
113  if (!hbhedg.isValid()) {
114  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
115  } else {
116  algo_->processDigi(*hbhedg);
117  }
119  iEvent.getByLabel(hbheRHLabel_,hbherh);
120  if (!hbherh.isValid()) {
121  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
122  } else {
123  algo_->processRH(*hbherh,*hbhedg);
124  }
125 
127  iEvent.getByLabel(hcalDigiLabel_,hodg);
128  if (!hodg.isValid()) {
129  // can't find it!
130  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
131  } else {
132  algo_->processDigi(*hodg);
133  }
135  iEvent.getByLabel(hoRHLabel_,horh);
136  if (!horh.isValid()) {
137  // can't find it!
138  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
139  } else {
140  algo_->processRH(*horh,*hodg);
141  }
142 
144  iEvent.getByLabel(hcalDigiLabel_,hfdg);
145 
146  if (!hfdg.isValid()) {
147  // can't find it!
148  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
149  } else {
150  algo_->processDigi(*hfdg);
151  }
152 
154  iEvent.getByLabel(hfRHLabel_,hfrh);
155  if (!hfrh.isValid()) {
156  // can't find it!
157  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
158  } else {
159  algo_->processRH(*hfrh,*hfdg);
160  }
161 
162  if (doCalib_) {
163  // No rechits as of yet...
165  iEvent.getByLabel(hcalDigiLabel_,calibdg);
166  if (!calibdg.isValid()) {
167  edm::LogWarning("HcalQLPlotAnal::analyze") << "Hcal Calib Digis not found";
168  } else {
169  algo_->processDigi(*calibdg,calibFC2GeV_);
170  }
171  }
172 
173 }
174 
175 
176 // ------------ method called once each job just after ending the event loop ------------
177 void
179 {
180  algo_->end();
181 }
182 
183 //define this as a plug-in
edm::InputTag hbheRHLabel_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag hcalTrigLabel_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void processDigi(const HBHEDigiCollection &hbhedigic)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
HcalQLPlotAnal(const edm::ParameterSet &)
edm::InputTag hfRHLabel_
int iEvent
Definition: GenABIO.cc:243
edm::InputTag hoRHLabel_
virtual void endJob()
void processRH(const HBHERecHitCollection &hbherhc, const HBHEDigiCollection &hbhedgc)
bool isValid() const
Definition: HandleBase.h:76
void SetEventType(const HcalTBTriggerData &trigd)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
HcalQLPlotAnalAlgos * algo_
edm::InputTag hcalDigiLabel_