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 Member Functions | Private Attributes
TPGCheck Class Reference

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

Inheritance diagram for TPGCheck:
edm::EDAnalyzer

Public Member Functions

 TPGCheck (const edm::ParameterSet &)
 
 ~TPGCheck ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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_
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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 matplotRender::t.

73 {
74  //now do what ever initialization is needed
75 
76  ecal_parts_.push_back("Barrel");
77  ecal_parts_.push_back("Endcap");
78 
79  histFile_=new TFile("histos.root","RECREATE");
80  for (unsigned int i=0;i<2;++i) {
81  // Energy
82  char t[30];
83  sprintf(t,"%s_energy",ecal_parts_[i].c_str());
84  ecal_et_[i]=new TH1I(t,"Et",255,0,255);
85 
86  // Trigger Tower flag
87  char titleTTF[30];
88  sprintf(titleTTF,"%s_ttf",ecal_parts_[i].c_str());
89  ecal_tt_[i]=new TH1I(titleTTF,"TTF",10,0,10);
90 
91  // Fain Grain
92  char titleFG[30];
93  sprintf(titleFG,"%s_fgvb",ecal_parts_[i].c_str());
94  ecal_fgvb_[i]=new TH1I(titleFG,"FGVB",10,0,10);
95  }
96 
97  label_= iConfig.getParameter<std::string>("Label");
98  producer_= iConfig.getParameter<std::string>("Producer");
99 
100 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::string label_
Definition: TPGCheck.cc:64
TFile * histFile_
Definition: TPGCheck.cc:63
TH1I * ecal_tt_[2]
Definition: TPGCheck.cc:60
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:61
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:59
std::vector< std::string > ecal_parts_
Definition: TPGCheck.cc:66
std::string producer_
Definition: TPGCheck.cc:65
TPGCheck::~TPGCheck ( )

Definition at line 103 of file TPGCheck.cc.

104 {
105 
106  // do anything here that needs to be done at desctruction time
107  // (e.g. close files, deallocate resources etc.)
108 
109  histFile_->Write();
110  histFile_->Close();
111 
112 }
TFile * histFile_
Definition: TPGCheck.cc:63

Member Function Documentation

void TPGCheck::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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

122 {
123 
124  // Get input
126  iEvent.getByLabel(label_,producer_,tp);
127  for (unsigned int i=0;i<tp.product()->size();i++) {
128  EcalTriggerPrimitiveDigi d=(*(tp.product()))[i];
129  int subdet=d.id().subDet()-1;
130  // for endcap, regroup double TP-s that are generated for the 2 interior rings
131  if (subdet==0) {
132  ecal_et_[subdet]->Fill(d.compressedEt());
133  }
134  else {
135  if (d.id().ietaAbs()==27 || d.id().ietaAbs()==28) {
136  if (i%2) ecal_et_[subdet]->Fill(d.compressedEt()*2.);
137  }
138  else ecal_et_[subdet]->Fill(d.compressedEt());
139  }
140  ecal_tt_[subdet]->Fill(d.ttFlag());
141  ecal_fgvb_[subdet]->Fill(d.fineGrain());
142  }
143 }
int i
Definition: DBlmapReader.cc:9
std::string label_
Definition: TPGCheck.cc:64
TH1I * ecal_tt_[2]
Definition: TPGCheck.cc:60
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:61
int compressedEt() const
get the encoded/compressed Et of interesting sample
int ietaAbs() const
get the absolute value of the tower ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const EcalTrigTowerDetId & id() const
T const * product() const
Definition: Handle.h:74
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:59
bool fineGrain() const
get the fine-grain bit of interesting sample
std::string producer_
Definition: TPGCheck.cc:65
int ttFlag() const
get the Trigger tower Flag of interesting sample
void TPGCheck::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file TPGCheck.cc.

149 {
150 }
void TPGCheck::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file TPGCheck.cc.

References i.

154  {
155  for (unsigned int i=0;i<2;++i) {
156  ecal_et_[i]->Write();
157  ecal_tt_[i]->Write();
158  ecal_fgvb_[i]->Write();
159  }
160 }
int i
Definition: DBlmapReader.cc:9
TH1I * ecal_tt_[2]
Definition: TPGCheck.cc:60
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:61
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:59

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
std::string TPGCheck::producer_
private

Definition at line 65 of file TPGCheck.cc.