CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TPGCheck Class Reference

#include <Validation/TPGSimulation/src/TPGCheck.cc>

Inheritance diagram for TPGCheck:
edm::EDAnalyzer

List of all members.

Public Member Functions

 TPGCheck (const edm::ParameterSet &)
 ~TPGCheck ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()

Private Attributes

TH1I * ecal_et_ [2]
TH1I * ecal_fgvb_ [2]
std::vector< std::string > ecal_parts_
TH1I * ecal_tt_ [2]
TFile * histFile_
std::string label_
std::string producer_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 47 of file TPGCheck.cc.


Constructor & Destructor Documentation

TPGCheck::TPGCheck ( const edm::ParameterSet iConfig) [explicit]

Definition at line 72 of file TPGCheck.cc.

References edm::ParameterSet::getParameter(), i, and lumiQTWidget::t.

{
   //now do what ever initialization is needed
   
  ecal_parts_.push_back("Barrel");
  ecal_parts_.push_back("Endcap");

  histFile_=new TFile("histos.root","RECREATE");
  for (unsigned int i=0;i<2;++i) {
    // Energy
    char t[30];
    sprintf(t,"%s_energy",ecal_parts_[i].c_str());  
    ecal_et_[i]=new TH1I(t,"Et",255,0,255);
    
    // Trigger Tower flag
    char titleTTF[30];
    sprintf(titleTTF,"%s_ttf",ecal_parts_[i].c_str());
    ecal_tt_[i]=new TH1I(titleTTF,"TTF",10,0,10);
    
    // Fain Grain
    char titleFG[30];
    sprintf(titleFG,"%s_fgvb",ecal_parts_[i].c_str());
    ecal_fgvb_[i]=new TH1I(titleFG,"FGVB",10,0,10);
  }
  
  label_= iConfig.getParameter<std::string>("Label");
  producer_= iConfig.getParameter<std::string>("Producer");
  
}
TPGCheck::~TPGCheck ( )

Definition at line 103 of file TPGCheck.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 TPGCheck::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 121 of file TPGCheck.cc.

References EcalTriggerPrimitiveDigi::compressedEt(), EcalTriggerPrimitiveDigi::fineGrain(), edm::Event::getByLabel(), i, EcalTriggerPrimitiveDigi::id(), EcalTrigTowerDetId::ietaAbs(), edm::Handle< T >::product(), EcalTrigTowerDetId::subDet(), and EcalTriggerPrimitiveDigi::ttFlag().

{
  
  // 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;
    // for endcap, regroup double TP-s that are generated for the 2 interior rings
    if (subdet==0) {
      ecal_et_[subdet]->Fill(d.compressedEt());
    }
    else {
      if (d.id().ietaAbs()==27 || d.id().ietaAbs()==28) {
        if (i%2) ecal_et_[subdet]->Fill(d.compressedEt()*2.);
      }
      else ecal_et_[subdet]->Fill(d.compressedEt());
    }
    ecal_tt_[subdet]->Fill(d.ttFlag());
    ecal_fgvb_[subdet]->Fill(d.fineGrain());
  }
}
void TPGCheck::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file TPGCheck.cc.

{
}
void TPGCheck::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file TPGCheck.cc.

References i.

                 {
   for (unsigned int i=0;i<2;++i) {
    ecal_et_[i]->Write();
    ecal_tt_[i]->Write();
    ecal_fgvb_[i]->Write();
  }
}

Member Data Documentation

TH1I* TPGCheck::ecal_et_[2] [private]

Definition at line 59 of file TPGCheck.cc.

TH1I* TPGCheck::ecal_fgvb_[2] [private]

Definition at line 61 of file TPGCheck.cc.

std::vector<std::string> TPGCheck::ecal_parts_ [private]

Definition at line 66 of file TPGCheck.cc.

TH1I* TPGCheck::ecal_tt_[2] [private]

Definition at line 60 of file TPGCheck.cc.

TFile* TPGCheck::histFile_ [private]

Definition at line 63 of file TPGCheck.cc.

std::string TPGCheck::label_ [private]

Definition at line 64 of file TPGCheck.cc.

std::string TPGCheck::producer_ [private]

Definition at line 65 of file TPGCheck.cc.