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 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
36 #include <string>
37 //
38 // class declaration
39 //
40 
42  public:
43  explicit HcalQLPlotAnal(const edm::ParameterSet&);
45 
46 
47  private:
48  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
49  virtual void endJob() override ;
50 
51  // ----------member data ---------------------------
61  bool doCalib_;
62  double calibFC2GeV_;
64 
65 };
66 
67 //
68 // constants, enums and typedefs
69 //
70 
71 //
72 // static data member definitions
73 //
74 
75 //
76 // constructors and destructor
77 //
79  hcalDigiLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hcalDigiTag")),
80  doCalib_(iConfig.getUntrackedParameter<bool>("doCalib",false)),
81  calibFC2GeV_(iConfig.getUntrackedParameter<double>("calibFC2GeV",0.2))
82 {
83  algo_ = new
84  HcalQLPlotAnalAlgos(iConfig.getUntrackedParameter<std::string>("outputFilename").c_str(),
85  iConfig.getParameter<edm::ParameterSet>("HistoParameters"));
86 
87  tok_hbherec_ = consumes<HBHERecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hbheRHtag"));
88  tok_horec_ = consumes<HORecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hoRHtag"));
89  tok_hfrec_ = consumes<HFRecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hfRHtag"));
90  tok_hbhe_ = consumes<HBHEDigiCollection>(hcalDigiLabel_);
91  tok_ho_ = consumes<HODigiCollection>(hcalDigiLabel_);
92  tok_hf_ = consumes<HFDigiCollection>(hcalDigiLabel_);
93  tok_calib_ = consumes<HcalCalibDigiCollection>(hcalDigiLabel_);
94  tok_tb_ = consumes<HcalTBTriggerData>(iConfig.getUntrackedParameter<edm::InputTag>("hcalTrigTag"));
95 
96 }
97 
98 
100 {
101  // do anything here that needs to be done at destruction time
102  // (e.g. close files, deallocate resources etc.)
103 }
104 
105 
106 //
107 // member functions
108 //
109 
110 // ------------ method called to for each event ------------
111 void
113 {
114  // Step A/C: Get Inputs and process (repeatedly)
116  iEvent.getByToken(tok_tb_,trig);
117  if (!trig.isValid()) {
118  edm::LogError("HcalQLPlotAnal::analyze") << "No Trigger Data found, skip event";
119  return;
120  } else {
121  algo_->SetEventType(*trig);
122  }
124  iEvent.getByToken(tok_hbhe_,hbhedg);
125  if (!hbhedg.isValid()) {
126  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
127  } else {
128  algo_->processDigi(*hbhedg);
129  }
131  iEvent.getByToken(tok_hbherec_,hbherh);
132  if (!hbherh.isValid()) {
133  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
134  } else {
135  algo_->processRH(*hbherh,*hbhedg);
136  }
137 
139  iEvent.getByToken(tok_ho_,hodg);
140  if (!hodg.isValid()) {
141  // can't find it!
142  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
143  } else {
144  algo_->processDigi(*hodg);
145  }
147  iEvent.getByToken(tok_horec_,horh);
148  if (!horh.isValid()) {
149  // can't find it!
150  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
151  } else {
152  algo_->processRH(*horh,*hodg);
153  }
154 
156  iEvent.getByToken(tok_hf_,hfdg);
157 
158  if (!hfdg.isValid()) {
159  // can't find it!
160  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
161  } else {
162  algo_->processDigi(*hfdg);
163  }
164 
166  iEvent.getByToken(tok_hfrec_,hfrh);
167  if (!hfrh.isValid()) {
168  // can't find it!
169  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
170  } else {
171  algo_->processRH(*hfrh,*hfdg);
172  }
173 
174  if (doCalib_) {
175  // No rechits as of yet...
177  iEvent.getByToken(tok_calib_,calibdg);
178  if (!calibdg.isValid()) {
179  edm::LogWarning("HcalQLPlotAnal::analyze") << "Hcal Calib Digis not found";
180  } else {
181  algo_->processDigi(*calibdg,calibFC2GeV_);
182  }
183  }
184 
185 }
186 
187 
188 // ------------ method called once each job just after ending the event loop ------------
189 void
191 {
192  algo_->end();
193 }
194 
195 //define this as a plug-in
T getParameter(std::string const &) const
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherec_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void processDigi(const HBHEDigiCollection &hbhedigic)
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalQLPlotAnal(const edm::ParameterSet &)
edm::EDGetTokenT< HORecHitCollection > tok_horec_
int iEvent
Definition: GenABIO.cc:230
void processRH(const HBHERecHitCollection &hbherhc, const HBHEDigiCollection &hbhedgc)
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
bool isValid() const
Definition: HandleBase.h:75
void SetEventType(const HcalTBTriggerData &trigd)
virtual void endJob() override
edm::EDGetTokenT< HFRecHitCollection > tok_hfrec_
edm::EDGetTokenT< HODigiCollection > tok_ho_
volatile std::atomic< bool > shutdown_flag false
HcalQLPlotAnalAlgos * algo_
edm::InputTag hcalDigiLabel_