CMS 3D CMS Logo

EcalTPInputAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Class: EcalTPInputAnalyzer
4 //
10 //
11 //
12 // Original Author: Ursula Berthon
13 // Created: Thu Jul 4 11:38:38 CEST 2005
14 //
15 //
16 
17 // system include files
18 #include <memory>
19 #include <utility>
20 
21 // user include files
24 
27 
30 
33 #include "EcalTPInputAnalyzer.h"
34 
35 using namespace edm;
36 
38 
39 {
40  histfile_ = new TFile("histos.root", "UPDATE");
41  histEndc = new TH1I("AdcE", "Adc-s for Endcap", 100, 0., 5000.);
42  histBar = new TH1I("AdcB", "Adc-s for Barrel", 100, 0., 5000.);
43  ecal_parts_.push_back("Barrel");
44  ecal_parts_.push_back("Endcap");
45 
46  // for (unsigned int i=0;i<2;++i) {
47  // ecal_et_[i]=new TH1I(ecal_parts_[i].c_str(),"Et",255,0,255);
48  // char title[30];
49  // sprintf(title,"%s_ttf",ecal_parts_[i].c_str());
50  // ecal_tt_[i]=new TH1I(title,"TTF",10,0,10);
51  // sprintf(title,"%s_fgvb",ecal_parts_[i].c_str());
52  // ecal_fgvb_[i]=new TH1I(title,"FGVB",10,0,10);
53  // }
54  producer_ = iConfig.getParameter<std::string>("Producer");
55  ebLabel_ = iConfig.getParameter<std::string>("EBLabel");
56  eeLabel_ = iConfig.getParameter<std::string>("EELabel");
57 }
58 
60  // do anything here that needs to be done at desctruction time
61  // (e.g. close files, deallocate resources etc.)
62 
63  histfile_->Write();
64  histfile_->Close();
65 }
66 
67 //
68 // member functions
69 //
70 
71 // ------------ method called to analyze the data ------------
73  using namespace edm;
74  using namespace std;
75 
76  bool barrel = true;
79  if (!iEvent.getByLabel(producer_, ebLabel_, ebDigis)) {
80  barrel = false;
81  edm::LogWarning("EcalTPG") << " Couldnt find Barrel dataframes with Producer:" << producer_
82  << " and label: " << ebLabel_;
83  }
84  bool endcap = true;
85  if (!iEvent.getByLabel(producer_, eeLabel_, eeDigis)) {
86  endcap = false;
87  edm::LogWarning("EcalTPG") << " Couldnt find Endcap dataframes with Producer:" << producer_
88  << " and label: " << eeLabel_;
89  }
90  // barrel
91  if (barrel) {
92  const EBDigiCollection *ebdb = ebDigis.product();
93  for (unsigned int i = 0; i < ebDigis->size(); ++i) {
94  EBDataFrame ebdf = (*ebdb)[i];
95  int nrSamples = ebdf.size();
96  // unsigned int nrSamples=(ebDigis.product())[i].size();
97  for (int is = 0; is < nrSamples; ++is) {
98  // EcalMGPASample sam=((ebDigis.product())[i])[is];
99  EcalMGPASample sam = ebdf[is];
100  histBar->Fill(sam.adc());
101  }
102  }
103  }
104  // endcap
105  if (endcap) {
106  const EEDigiCollection *eedb = eeDigis.product();
107  for (unsigned int i = 0; i < eeDigis->size(); ++i) {
108  EEDataFrame eedf = (*eedb)[i];
109  int nrSamples = eedf.size();
110  for (int is = 0; is < nrSamples; ++is) {
111  EcalMGPASample sam = eedf[is];
112  histEndc->Fill(sam.adc());
113  }
114  }
115  }
116  // // Get input
117  // edm::Handle<EcalTrigPrimDigiCollection> tp;
118  // iEvent.getByLabel(label_,producer_,tp);
119  // for (unsigned int i=0;i<tp.product()->size();i++) {
120  // EcalTriggerPrimitiveDigi d=(*(tp.product()))[i];
121  // int subdet=d.id().subDet()-1;
122  // ecal_et_[subdet]->Fill(d.compressedEt());
123  // ecal_tt_[subdet]->Fill(d.ttFlag());
124  // ecal_fgvb_[subdet]->Fill(d.fineGrain());
125  // }
126 }
127 
129  histEndc->Write();
130  histBar->Write();
131 }
mps_fire.i
i
Definition: mps_fire.py:428
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
EBDataFrame
Definition: EBDataFrame.h:11
EDAnalyzer.h
EcalTPInputAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EcalTPInputAnalyzer.cc:72
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
EcalTPInputAnalyzer::endJob
void endJob() override
Definition: EcalTPInputAnalyzer.cc:128
edm::Handle< EBDigiCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EcalTriggerPrimitiveDigi.h
MakerMacros.h
EcalMGPASample::adc
int adc() const
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:31
EcalDigiCollections.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EBDigiCollection
Definition: EcalDigiCollections.h:56
EEDigiCollection
Definition: EcalDigiCollections.h:69
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
EcalMGPASample
Definition: EcalMGPASample.h:22
EcalTPInputAnalyzer::~EcalTPInputAnalyzer
~EcalTPInputAnalyzer() override
Definition: EcalTPInputAnalyzer.cc:59
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
EcalTPInputAnalyzer::EcalTPInputAnalyzer
EcalTPInputAnalyzer(const edm::ParameterSet &)
Definition: EcalTPInputAnalyzer.cc:37
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalDataFrame::size
int size() const
Definition: EcalDataFrame.h:26
ParameterSet.h
EcalTPInputAnalyzer.h
EEDataFrame
Definition: EEDataFrame.h:12
edm::Event
Definition: Event.h:73
SimL1EmulatorDM_cff.eeDigis
eeDigis
Definition: SimL1EmulatorDM_cff.py:18
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162