CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 // system include files
20 #include <memory>
21 
22 // user include files
34 #include <string>
35 //
36 // class declaration
37 //
38 
40 public:
41  explicit HcalQLPlotAnal(const edm::ParameterSet&);
42  ~HcalQLPlotAnal() override = default;
43 
44 private:
45  void analyze(const edm::Event&, const edm::EventSetup&) override;
46  void endJob() override;
47 
48  // ----------member data ---------------------------
58  bool doCalib_;
59  double calibFC2GeV_;
61 };
62 
63 //
64 // constants, enums and typedefs
65 //
66 
67 //
68 // static data member definitions
69 //
70 
71 //
72 // constructors and destructor
73 //
75  : hcalDigiLabel_(iConfig.getUntrackedParameter<edm::InputTag>("hcalDigiTag")),
76  doCalib_(iConfig.getUntrackedParameter<bool>("doCalib", false)),
77  calibFC2GeV_(iConfig.getUntrackedParameter<double>("calibFC2GeV", 0.2)) {
78  algo_ = new HcalQLPlotAnalAlgos(iConfig.getUntrackedParameter<std::string>("outputFilename").c_str(),
79  iConfig.getParameter<edm::ParameterSet>("HistoParameters"));
80 
81  tok_hbherec_ = consumes<HBHERecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hbheRHtag"));
82  tok_horec_ = consumes<HORecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hoRHtag"));
83  tok_hfrec_ = consumes<HFRecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("hfRHtag"));
84  tok_hbhe_ = consumes<HBHEDigiCollection>(hcalDigiLabel_);
85  tok_ho_ = consumes<HODigiCollection>(hcalDigiLabel_);
86  tok_hf_ = consumes<HFDigiCollection>(hcalDigiLabel_);
87  tok_calib_ = consumes<HcalCalibDigiCollection>(hcalDigiLabel_);
88  tok_tb_ = consumes<HcalTBTriggerData>(iConfig.getUntrackedParameter<edm::InputTag>("hcalTrigTag"));
89 }
90 
91 //
92 // member functions
93 //
94 
95 // ------------ method called to for each event ------------
97  // Step A/C: Get Inputs and process (repeatedly)
99  iEvent.getByToken(tok_tb_, trig);
100  if (!trig.isValid()) {
101  edm::LogError("HcalQLPlotAnal::analyze") << "No Trigger Data found, skip event";
102  return;
103  } else {
104  algo_->SetEventType(*trig);
105  }
107  iEvent.getByToken(tok_hbhe_, hbhedg);
108  if (!hbhedg.isValid()) {
109  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
110  } else {
111  algo_->processDigi(*hbhedg);
112  }
114  iEvent.getByToken(tok_hbherec_, hbherh);
115  if (!hbherh.isValid()) {
116  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found";
117  } else {
118  algo_->processRH(*hbherh, *hbhedg);
119  }
120 
122  iEvent.getByToken(tok_ho_, hodg);
123  if (!hodg.isValid()) {
124  // can't find it!
125  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
126  } else {
127  algo_->processDigi(*hodg);
128  }
130  iEvent.getByToken(tok_horec_, horh);
131  if (!horh.isValid()) {
132  // can't find it!
133  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found";
134  } else {
135  algo_->processRH(*horh, *hodg);
136  }
137 
139  iEvent.getByToken(tok_hf_, hfdg);
140 
141  if (!hfdg.isValid()) {
142  // can't find it!
143  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
144  } else {
145  algo_->processDigi(*hfdg);
146  }
147 
149  iEvent.getByToken(tok_hfrec_, hfrh);
150  if (!hfrh.isValid()) {
151  // can't find it!
152  edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found";
153  } else {
154  algo_->processRH(*hfrh, *hfdg);
155  }
156 
157  if (doCalib_) {
158  // No rechits as of yet...
160  iEvent.getByToken(tok_calib_, calibdg);
161  if (!calibdg.isValid()) {
162  edm::LogWarning("HcalQLPlotAnal::analyze") << "Hcal Calib Digis not found";
163  } else {
164  algo_->processDigi(*calibdg, calibFC2GeV_);
165  }
166  }
167 }
168 
169 // ------------ method called once each job just after ending the event loop ------------
171 
172 //define this as a plug-in
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
T getUntrackedParameter(std::string const &, T const &) const
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:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void processDigi(const HBHEDigiCollection &hbhedigic)
Log< level::Error, false > LogError
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalQLPlotAnal(const edm::ParameterSet &)
edm::EDGetTokenT< HORecHitCollection > tok_horec_
int iEvent
Definition: GenABIO.cc:224
void processRH(const HBHERecHitCollection &hbherhc, const HBHEDigiCollection &hbhedgc)
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
bool isValid() const
Definition: HandleBase.h:70
void SetEventType(const HcalTBTriggerData &trigd)
void endJob() override
edm::EDGetTokenT< HFRecHitCollection > tok_hfrec_
edm::EDGetTokenT< HODigiCollection > tok_ho_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
~HcalQLPlotAnal() override=default
Log< level::Warning, false > LogWarning
HcalQLPlotAnalAlgos * algo_
edm::InputTag hcalDigiLabel_