CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalTPInputAnalyzer Class Reference

#include <EcalTPInputAnalyzer.h>

Inheritance diagram for EcalTPInputAnalyzer:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 EcalTPInputAnalyzer (const edm::ParameterSet &)
 
void endJob ()
 
 ~EcalTPInputAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

std::string ebLabel_
 
TH1I * ecal_et_ [2]
 
TH1I * ecal_fgvb_ [2]
 
std::vector< std::string > ecal_parts_
 
TH1I * ecal_tt_ [2]
 
std::string eeLabel_
 
TH1I * histBar
 
TH1I * histEndc
 
TFile * histfile_
 
std::string producer_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: test of the input of EcalTrigPrimProducer

Definition at line 38 of file EcalTPInputAnalyzer.h.

Constructor & Destructor Documentation

EcalTPInputAnalyzer::EcalTPInputAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 39 of file EcalTPInputAnalyzer.cc.

References edm::ParameterSet::getParameter().

41 {
42  histfile_=new TFile("histos.root","UPDATE");
43  histEndc = new TH1I("AdcE","Adc-s for Endcap",100,0.,5000.);
44  histBar = new TH1I("AdcB","Adc-s for Barrel",100,0.,5000.);
45  ecal_parts_.push_back("Barrel");
46  ecal_parts_.push_back("Endcap");
47 
48 // for (unsigned int i=0;i<2;++i) {
49 // ecal_et_[i]=new TH1I(ecal_parts_[i].c_str(),"Et",255,0,255);
50 // char title[30];
51 // sprintf(title,"%s_ttf",ecal_parts_[i].c_str());
52 // ecal_tt_[i]=new TH1I(title,"TTF",10,0,10);
53 // sprintf(title,"%s_fgvb",ecal_parts_[i].c_str());
54 // ecal_fgvb_[i]=new TH1I(title,"FGVB",10,0,10);
55 // }
56  producer_= iConfig.getParameter<std::string>("Producer");
57  ebLabel_= iConfig.getParameter<std::string>("EBLabel");
58  eeLabel_= iConfig.getParameter<std::string>("EELabel");
59 }
T getParameter(std::string const &) const
std::vector< std::string > ecal_parts_
EcalTPInputAnalyzer::~EcalTPInputAnalyzer ( )

Definition at line 62 of file EcalTPInputAnalyzer.cc.

63 {
64 
65  // do anything here that needs to be done at desctruction time
66  // (e.g. close files, deallocate resources etc.)
67 
68  histfile_->Write();
69  histfile_->Close();
70 
71 }

Member Function Documentation

void EcalTPInputAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 80 of file EcalTPInputAnalyzer.cc.

References EcalMGPASample::adc(), Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, edm::Event::getByLabel(), i, and EcalDataFrame::size().

81 {
82  using namespace edm;
83  using namespace std;
84 
85  bool barrel=true;
88  if (!iEvent.getByLabel(producer_,ebLabel_,ebDigis)) {
89  barrel=false;
90  edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with Producer:"<<producer_<<" and label: "<<ebLabel_;
91  }
92  bool endcap=true;
93  if (!iEvent.getByLabel(producer_,eeLabel_,eeDigis)) {
94  endcap=false;
95  edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with Producer:"<<producer_<<" and label: "<<eeLabel_;
96  }
97  //barrel
98  if (barrel) {
99  const EBDigiCollection *ebdb=ebDigis.product();
100  for (unsigned int i=0;i<ebDigis->size();++i) {
101  EBDataFrame ebdf=(*ebdb)[i];
102  int nrSamples=ebdf.size();
103  //unsigned int nrSamples=(ebDigis.product())[i].size();
104  for (int is=0;is<nrSamples;++is) {
105  // EcalMGPASample sam=((ebDigis.product())[i])[is];
106  EcalMGPASample sam=ebdf[is];
107  histBar->Fill(sam.adc());
108  }
109  }
110  }
111  //endcap
112  if (endcap) {
113  const EEDigiCollection *eedb=eeDigis.product();
114  for (unsigned int i=0;i<eeDigis->size();++i) {
115  EEDataFrame eedf=(*eedb)[i];
116  int nrSamples=eedf.size();
117  for (int is=0;is<nrSamples;++is) {
118  EcalMGPASample sam=eedf[is];
119  histEndc->Fill(sam.adc());
120  }
121  }
122  }
123 // // Get input
124 // edm::Handle<EcalTrigPrimDigiCollection> tp;
125 // iEvent.getByLabel(label_,producer_,tp);
126 // for (unsigned int i=0;i<tp.product()->size();i++) {
127 // EcalTriggerPrimitiveDigi d=(*(tp.product()))[i];
128 // int subdet=d.id().subDet()-1;
129 // ecal_et_[subdet]->Fill(d.compressedEt());
130 // ecal_tt_[subdet]->Fill(d.ttFlag());
131 // ecal_fgvb_[subdet]->Fill(d.fineGrain());
132 // }
133 }
int i
Definition: DBlmapReader.cc:9
int size() const
Definition: EcalDataFrame.h:27
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int adc() const
get the ADC sample (12 bits)
void EcalTPInputAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file EcalTPInputAnalyzer.cc.

136  {
137  histEndc ->Write();
138  histBar ->Write();
139 }

Member Data Documentation

std::string EcalTPInputAnalyzer::ebLabel_
private

Definition at line 56 of file EcalTPInputAnalyzer.h.

TH1I* EcalTPInputAnalyzer::ecal_et_[2]
private

Definition at line 50 of file EcalTPInputAnalyzer.h.

TH1I* EcalTPInputAnalyzer::ecal_fgvb_[2]
private

Definition at line 52 of file EcalTPInputAnalyzer.h.

std::vector<std::string> EcalTPInputAnalyzer::ecal_parts_
private

Definition at line 49 of file EcalTPInputAnalyzer.h.

TH1I* EcalTPInputAnalyzer::ecal_tt_[2]
private

Definition at line 51 of file EcalTPInputAnalyzer.h.

std::string EcalTPInputAnalyzer::eeLabel_
private

Definition at line 57 of file EcalTPInputAnalyzer.h.

TH1I * EcalTPInputAnalyzer::histBar
private

Definition at line 53 of file EcalTPInputAnalyzer.h.

TH1I* EcalTPInputAnalyzer::histEndc
private

Definition at line 53 of file EcalTPInputAnalyzer.h.

TFile* EcalTPInputAnalyzer::histfile_
private

Definition at line 54 of file EcalTPInputAnalyzer.h.

std::string EcalTPInputAnalyzer::producer_
private

Definition at line 58 of file EcalTPInputAnalyzer.h.