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 edm::EDConsumerBase

Public Member Functions

 TPGCheck (const edm::ParameterSet &)
 
 ~TPGCheck ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 45 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, AlCaHLTBitMon_QueryRunRegistry::string, and edmStreamStallGrapher::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  ecal_tp_token_ = consumes<EcalTrigPrimDigiCollection> (edm::InputTag(label_,producer_));
100 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::string label_
Definition: TPGCheck.cc:62
TFile * histFile_
Definition: TPGCheck.cc:61
TH1I * ecal_tt_[2]
Definition: TPGCheck.cc:58
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:59
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecal_tp_token_
Definition: TPGCheck.cc:66
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:57
std::vector< std::string > ecal_parts_
Definition: TPGCheck.cc:64
std::string producer_
Definition: TPGCheck.cc:63
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:61

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 121 of file TPGCheck.cc.

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

122 {
123 
124  // Get input
126  iEvent.getByToken(ecal_tp_token_,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
TH1I * ecal_tt_[2]
Definition: TPGCheck.cc:58
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:59
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecal_tp_token_
Definition: TPGCheck.cc:66
int compressedEt() const
get the encoded/compressed Et of interesting sample
int ietaAbs() const
get the absolute value of the tower ieta
const EcalTrigTowerDetId & id() const
T const * product() const
Definition: Handle.h:81
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:57
bool fineGrain() const
get the fine-grain bit of interesting sample
int ttFlag() const
get the Trigger tower Flag of interesting sample
void TPGCheck::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file TPGCheck.cc.

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

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:58
TH1I * ecal_fgvb_[2]
Definition: TPGCheck.cc:59
TH1I * ecal_et_[2]
Definition: TPGCheck.cc:57

Member Data Documentation

TH1I* TPGCheck::ecal_et_[2]
private

Definition at line 57 of file TPGCheck.cc.

TH1I* TPGCheck::ecal_fgvb_[2]
private

Definition at line 59 of file TPGCheck.cc.

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

Definition at line 64 of file TPGCheck.cc.

edm::EDGetTokenT<EcalTrigPrimDigiCollection> TPGCheck::ecal_tp_token_
private

Definition at line 66 of file TPGCheck.cc.

TH1I* TPGCheck::ecal_tt_[2]
private

Definition at line 58 of file TPGCheck.cc.

TFile* TPGCheck::histFile_
private

Definition at line 61 of file TPGCheck.cc.

std::string TPGCheck::label_
private
std::string TPGCheck::producer_
private

Definition at line 63 of file TPGCheck.cc.