CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTPInputAnalyzer Class Reference

#include <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 edm::ParameterSet::getParameter().

{
  histfile_=new TFile("histos.root","UPDATE");
  histEndc = new TH1I("AdcE","Adc-s for Endcap",100,0.,5000.);
  histBar = new TH1I("AdcB","Adc-s for Barrel",100,0.,5000.);
  ecal_parts_.push_back("Barrel");
  ecal_parts_.push_back("Endcap");

//   for (unsigned int i=0;i<2;++i) {
//     ecal_et_[i]=new TH1I(ecal_parts_[i].c_str(),"Et",255,0,255);
//     char title[30];
//     sprintf(title,"%s_ttf",ecal_parts_[i].c_str());
//     ecal_tt_[i]=new TH1I(title,"TTF",10,0,10);
//     sprintf(title,"%s_fgvb",ecal_parts_[i].c_str());
//     ecal_fgvb_[i]=new TH1I(title,"FGVB",10,0,10);
//   }
   producer_= iConfig.getParameter<std::string>("Producer");
   ebLabel_= iConfig.getParameter<std::string>("EBLabel");
   eeLabel_= iConfig.getParameter<std::string>("EELabel");
}
EcalTPInputAnalyzer::~EcalTPInputAnalyzer ( )

Definition at line 62 of file EcalTPInputAnalyzer.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

  histfile_->Write();
  histfile_->Close();

}

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().

{
  using namespace edm;
  using namespace std;

  bool barrel=true;
  edm::Handle<EBDigiCollection> ebDigis;
  edm::Handle<EEDigiCollection> eeDigis;
  if (!iEvent.getByLabel(producer_,ebLabel_,ebDigis)) {
    barrel=false;
    edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with Producer:"<<producer_<<" and label: "<<ebLabel_;
  }
  bool endcap=true;
  if (!iEvent.getByLabel(producer_,eeLabel_,eeDigis)) {
    endcap=false;
    edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with Producer:"<<producer_<<" and label: "<<eeLabel_;
  }
  //barrel
  if (barrel) {
    const EBDigiCollection *ebdb=ebDigis.product();
    for (unsigned int i=0;i<ebDigis->size();++i) {
      EBDataFrame ebdf=(*ebdb)[i];
      int nrSamples=ebdf.size();
      //unsigned int nrSamples=(ebDigis.product())[i].size();
      for (int is=0;is<nrSamples;++is) {
        //      EcalMGPASample sam=((ebDigis.product())[i])[is];
        EcalMGPASample sam=ebdf[is];
        histBar->Fill(sam.adc());
      }
    }
  }
  //endcap
  if (endcap) {
    const EEDigiCollection *eedb=eeDigis.product();
    for (unsigned int i=0;i<eeDigis->size();++i) {
      EEDataFrame eedf=(*eedb)[i];
      int nrSamples=eedf.size();
      for (int is=0;is<nrSamples;++is) {
        EcalMGPASample sam=eedf[is];
        histEndc->Fill(sam.adc());
      }
    }
  }
//   // Get input
//   edm::Handle<EcalTrigPrimDigiCollection> tp;
//   iEvent.getByLabel(label_,producer_,tp);
//   for (unsigned int i=0;i<tp.product()->size();i++) {
//     EcalTriggerPrimitiveDigi d=(*(tp.product()))[i];
//     int subdet=d.id().subDet()-1;
//       ecal_et_[subdet]->Fill(d.compressedEt());
//       ecal_tt_[subdet]->Fill(d.ttFlag());
//       ecal_fgvb_[subdet]->Fill(d.fineGrain());
//   }
}
void EcalTPInputAnalyzer::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file EcalTPInputAnalyzer.cc.

                           {
  histEndc ->Write();
  histBar  ->Write();
}

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.

Definition at line 53 of file EcalTPInputAnalyzer.h.

Definition at line 54 of file EcalTPInputAnalyzer.h.

std::string EcalTPInputAnalyzer::producer_ [private]

Definition at line 58 of file EcalTPInputAnalyzer.h.