CMS 3D CMS Logo

EcalTPInputAnalyzer Class Reference

Description: test of the input of EcalTrigPrimProducer. More...

#include <SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPInputAnalyzer.h>

Inheritance diagram for EcalTPInputAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 EcalTPInputAnalyzer (const edm::ParameterSet &)
void endJob ()
 ~EcalTPInputAnalyzer ()

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_


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 ebLabel_, ecal_parts_, eeLabel_, edm::ParameterSet::getParameter(), histBar, histEndc, histfile_, and producer_.

00041 {
00042   histfile_=new TFile("histos.root","UPDATE");
00043   histEndc = new TH1I("AdcE","Adc-s for Endcap",100,0.,5000.);
00044   histBar = new TH1I("AdcB","Adc-s for Barrel",100,0.,5000.);
00045   ecal_parts_.push_back("Barrel");
00046   ecal_parts_.push_back("Endcap");
00047 
00048 //   for (unsigned int i=0;i<2;++i) {
00049 //     ecal_et_[i]=new TH1I(ecal_parts_[i].c_str(),"Et",255,0,255);
00050 //     char title[30];
00051 //     sprintf(title,"%s_ttf",ecal_parts_[i].c_str());
00052 //     ecal_tt_[i]=new TH1I(title,"TTF",10,0,10);
00053 //     sprintf(title,"%s_fgvb",ecal_parts_[i].c_str());
00054 //     ecal_fgvb_[i]=new TH1I(title,"FGVB",10,0,10);
00055 //   }
00056    producer_= iConfig.getParameter<std::string>("Producer");
00057    ebLabel_= iConfig.getParameter<std::string>("EBLabel");
00058    eeLabel_= iConfig.getParameter<std::string>("EELabel");
00059 }

EcalTPInputAnalyzer::~EcalTPInputAnalyzer (  ) 

Definition at line 62 of file EcalTPInputAnalyzer.cc.

References histfile_.

00063 {
00064  
00065    // do anything here that needs to be done at desctruction time
00066    // (e.g. close files, deallocate resources etc.)
00067 
00068   histfile_->Write();
00069   histfile_->Close();
00070 
00071 }


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(), GeomDetEnumerators::barrel, ebLabel_, eeLabel_, GeomDetEnumerators::endcap, edm::Event::getByLabel(), histBar, histEndc, i, producer_, edm::Handle< T >::product(), EcalDataFrame::size(), and std.

00081 {
00082   using namespace edm;
00083   using namespace std;
00084 
00085   bool barrel=true;
00086   edm::Handle<EBDigiCollection> ebDigis;
00087   edm::Handle<EEDigiCollection> eeDigis;
00088   if (!iEvent.getByLabel(producer_,ebLabel_,ebDigis)) {
00089     barrel=false;
00090     edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with Producer:"<<producer_<<" and label: "<<ebLabel_;
00091   }
00092   bool endcap=true;
00093   if (!iEvent.getByLabel(producer_,eeLabel_,eeDigis)) {
00094     endcap=false;
00095     edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with Producer:"<<producer_<<" and label: "<<eeLabel_;
00096   }
00097   //barrel
00098   if (barrel) {
00099     const EBDigiCollection *ebdb=ebDigis.product();
00100     for (unsigned int i=0;i<ebDigis->size();++i) {
00101       EBDataFrame ebdf=(*ebdb)[i];
00102       int nrSamples=ebdf.size();
00103       //unsigned int nrSamples=(ebDigis.product())[i].size();
00104       for (int is=0;is<nrSamples;++is) {
00105         //      EcalMGPASample sam=((ebDigis.product())[i])[is];
00106         EcalMGPASample sam=ebdf[is];
00107         histBar->Fill(sam.adc());
00108       }
00109     }
00110   }
00111   //endcap
00112   if (endcap) {
00113     const EEDigiCollection *eedb=eeDigis.product();
00114     for (unsigned int i=0;i<eeDigis->size();++i) {
00115       EEDataFrame eedf=(*eedb)[i];
00116       int nrSamples=eedf.size();
00117       for (int is=0;is<nrSamples;++is) {
00118         EcalMGPASample sam=eedf[is];
00119         histEndc->Fill(sam.adc());
00120       }
00121     }
00122   }
00123 //   // Get input
00124 //   edm::Handle<EcalTrigPrimDigiCollection> tp;
00125 //   iEvent.getByLabel(label_,producer_,tp);
00126 //   for (unsigned int i=0;i<tp.product()->size();i++) {
00127 //     EcalTriggerPrimitiveDigi d=(*(tp.product()))[i];
00128 //     int subdet=d.id().subDet()-1;
00129 //       ecal_et_[subdet]->Fill(d.compressedEt());
00130 //       ecal_tt_[subdet]->Fill(d.ttFlag());
00131 //       ecal_fgvb_[subdet]->Fill(d.fineGrain());
00132 //   }
00133 }

void EcalTPInputAnalyzer::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file EcalTPInputAnalyzer.cc.

References histBar, and histEndc.

00136                            {
00137   histEndc ->Write();
00138   histBar  ->Write();
00139 }


Member Data Documentation

std::string EcalTPInputAnalyzer::ebLabel_ [private]

Definition at line 56 of file EcalTPInputAnalyzer.h.

Referenced by analyze(), and EcalTPInputAnalyzer().

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.

Referenced by EcalTPInputAnalyzer().

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.

Referenced by analyze(), and EcalTPInputAnalyzer().

TH1I * EcalTPInputAnalyzer::histBar [private]

Definition at line 53 of file EcalTPInputAnalyzer.h.

Referenced by analyze(), EcalTPInputAnalyzer(), and endJob().

TH1I* EcalTPInputAnalyzer::histEndc [private]

Definition at line 53 of file EcalTPInputAnalyzer.h.

Referenced by analyze(), EcalTPInputAnalyzer(), and endJob().

TFile* EcalTPInputAnalyzer::histfile_ [private]

Definition at line 54 of file EcalTPInputAnalyzer.h.

Referenced by EcalTPInputAnalyzer(), and ~EcalTPInputAnalyzer().

std::string EcalTPInputAnalyzer::producer_ [private]

Definition at line 58 of file EcalTPInputAnalyzer.h.

Referenced by analyze(), and EcalTPInputAnalyzer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:00 2009 for CMSSW by  doxygen 1.5.4