CMS 3D CMS Logo

ZdcTBAnalyzer.cc
Go to the documentation of this file.
1 
2 
9 
16 #include "TFile.h"
17 #include "TTree.h"
18 #include "TH1.h"
19 #include <iostream>
20 #include <memory>
21 
22 
24 
25  public:
26  explicit ZdcTBAnalyzer(const edm::ParameterSet&);
28  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
29  virtual void endJob() override;
30 
31 private:
39 
45 };
46 
48 
49  tok_zdc_ = consumes<ZDCRecHitCollection>(iConfig.getParameter<edm::InputTag>("zdcRecHitCollectionTag"));
50  tok_tb_ = consumes<HcalTBTriggerData>(iConfig.getParameter<edm::InputTag>("hcalTBTriggerDataTag"));
51  tok_timing_ = consumes<HcalTBTiming>(iConfig.getParameter<edm::InputTag>("hcalTBTimingTag"));
52  tok_bc_ = consumes<HcalTBBeamCounters>(iConfig.getParameter<edm::InputTag>("hcalTBBeamCountersTag"));
53  tok_pos_ = consumes<HcalTBEventPosition>(iConfig.getParameter<edm::InputTag>("hcalTBEventPositionTag"));
54 
55  std::cout<<"**************** ZdcTBAnalizer Start**************************"<<std::endl;
56  edm::ParameterSet para = iConfig.getParameter<edm::ParameterSet>("ZdcTBAnalyzer");
57 
58  beamDetectorsADCInfo = para.getParameter<bool>("beamDetectorsADCInfoFlag");
59  beamDetectorsTDCInfo = para.getParameter<bool>("beamDetectorsTDCInfoFlag");
60  wireChambersInfo = para.getParameter<bool>("wireChambersInfoFlag");
61  triggerInfo = para.getParameter<bool>("triggerInfoFlag");
62  outputFileName = para.getParameter<std::string>("ntupleOutputFileName");
63  zdcTBAnalysis.setup(outputFileName);
64 }
65 
67 
69  using namespace edm;
75 
76  e.getByToken(tok_zdc_, zdcRecHits);
77  if(triggerInfo){
78  e.getByToken(tok_tb_, triggers);
79  zdcTBAnalysis.analyze(*triggers);
80  }
82  e.getByToken(tok_timing_, times); // e.getByLabel("tbunpacker2",times);
83  zdcTBAnalysis.analyze(*times);
84  }
86  e.getByToken(tok_bc_, bc);
88  }
89  if(wireChambersInfo){
90  e.getByToken(tok_pos_, chpos);
91  zdcTBAnalysis.analyze(*chpos);
92  }
93  zdcTBAnalysis.analyze(*zdcRecHits);
95 }
96 
99 std::cout<<"****************ZdcTBAnalizer End**************************"<<std::endl;
100 }
101 
102 //define this as a plug-in
virtual void endJob() override
T getParameter(std::string const &) const
std::string inputFileName
bool beamDetectorsTDCInfo
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::string outputFileName
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< HcalTBBeamCounters > tok_bc_
void analyze(const ZDCRecHitCollection &hf)
void setup(const std::string &histoFileName)
Definition: ZdcTBAnalysis.cc:8
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
bool beamDetectorsADCInfo
edm::EDGetTokenT< HcalTBEventPosition > tok_pos_
ZdcTBAnalysis zdcTBAnalysis
HLT enums.
edm::EDGetTokenT< ZDCRecHitCollection > tok_zdc_
edm::EDGetTokenT< HcalTBTiming > tok_timing_
ZdcTBAnalyzer(const edm::ParameterSet &)