CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
EcalTPGAnalyzer Class Reference

#include <EcalTPGAnalyzer.h>

Inheritance diagram for EcalTPGAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  EcalTPGVariables
 

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 EcalTPGAnalyzer (const edm::ParameterSet &)
 
 ~EcalTPGAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool allowTP_
 
edm::InputTag digiCollectionEB_
 
edm::InputTag digiCollectionEE_
 
edm::ESHandle< EcalTrigTowerConstituentsMapeTTmap_
 
TFile * file_
 
std::string gtRecordCollectionTag_
 
bool print_
 
const CaloSubdetectorGeometrytheBarrelGeometry_
 
const CaloSubdetectorGeometrytheEndcapGeometry_
 
edm::InputTag tpCollection_
 
edm::InputTag tpEmulatorCollection_
 
TTree * tree_
 
EcalTPGVariables treeVariables_
 
bool useEE_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 35 of file EcalTPGAnalyzer.h.

Constructor & Destructor Documentation

EcalTPGAnalyzer::EcalTPGAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 50 of file EcalTPGAnalyzer.cc.

References edm::ParameterSet::getParameter(), edm::hash_detail::print_(), and AlCaHLTBitMon_QueryRunRegistry::string.

50  {
51  tpCollection_ = iConfig.getParameter<edm::InputTag>("TPCollection");
52  tpEmulatorCollection_ = iConfig.getParameter<edm::InputTag>("TPEmulatorCollection");
53  digiCollectionEB_ = iConfig.getParameter<edm::InputTag>("DigiCollectionEB");
54  digiCollectionEE_ = iConfig.getParameter<edm::InputTag>("DigiCollectionEE");
55  gtRecordCollectionTag_ = iConfig.getParameter<std::string>("GTRecordCollection");
56 
57  allowTP_ = iConfig.getParameter<bool>("ReadTriggerPrimitives");
58  useEE_ = iConfig.getParameter<bool>("UseEndCap");
59  print_ = iConfig.getParameter<bool>("Print");
60 
61  // file
62  file_ = new TFile("ECALTPGtree.root", "RECREATE");
63  file_->cd();
64 
65  // tree
66  tree_ = new TTree("EcalTPGAnalysis", "EcalTPGAnalysis");
67 
68  tree_->Branch("runNb", &treeVariables_.runNb, "runNb/i"); //
69  tree_->Branch("evtNb", &treeVariables_.evtNb, "evtNb/i"); //
70  tree_->Branch("bxNb", &treeVariables_.bxNb, "bxNb/i"); //
71  tree_->Branch("orbitNb", &treeVariables_.orbitNb, "orbitNb/i"); //
72  tree_->Branch("nbOfActiveTriggers", &treeVariables_.nbOfActiveTriggers, "nbOfActiveTriggers/i"); //
73  tree_->Branch("activeTriggers", treeVariables_.activeTriggers, "activeTriggers[nbOfActiveTriggers]/I"); //
74 
75  tree_->Branch("nbOfTowers", &treeVariables_.nbOfTowers, "nbOfTowers/i"); //
76  tree_->Branch("ieta", treeVariables_.ieta, "ieta[nbOfTowers]/I"); //
77  tree_->Branch("iphi", treeVariables_.iphi, "iphi[nbOfTowers]/I"); //
78  tree_->Branch("nbOfXtals", treeVariables_.nbOfXtals, "nbOfXtals[nbOfTowers]/I"); //
79  tree_->Branch("rawTPData", treeVariables_.rawTPData, "rawTPData[nbOfTowers]/I"); //
80  tree_->Branch("rawTPEmul1", treeVariables_.rawTPEmul1, "rawTPEmul1[nbOfTowers]/I"); //
81  tree_->Branch("rawTPEmul2", treeVariables_.rawTPEmul2, "rawTPEmul2[nbOfTowers]/I"); //
82  tree_->Branch("rawTPEmul3", treeVariables_.rawTPEmul3, "rawTPEmul3[nbOfTowers]/I"); //
83  tree_->Branch("rawTPEmul4", treeVariables_.rawTPEmul4, "rawTPEmul4[nbOfTowers]/I"); //
84  tree_->Branch("rawTPEmul5", treeVariables_.rawTPEmul5, "rawTPEmul5[nbOfTowers]/I"); //
85  tree_->Branch("eRec", treeVariables_.eRec, "eRec[nbOfTowers]/F"); //
86 }
std::string gtRecordCollectionTag_
T getParameter(std::string const &) const
EcalTPGVariables treeVariables_
edm::InputTag digiCollectionEB_
edm::InputTag tpEmulatorCollection_
edm::InputTag tpCollection_
edm::InputTag digiCollectionEE_
EcalTPGAnalyzer::~EcalTPGAnalyzer ( )
override

Definition at line 88 of file EcalTPGAnalyzer.cc.

88  {
89  file_->cd();
90  tree_->Write();
91  file_->Close();
92 }

Member Function Documentation

void EcalTPGAnalyzer::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 108 of file EcalTPGAnalyzer.cc.

References edm::EventBase::bunchCrossing(), gather_cfg::cout, edmIntegrityCheck::d, L1GlobalTriggerReadoutRecord::decisionWord(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), L1GtTriggerMask::gtTriggerMask(), mps_fire::i, EEDataFrame::id(), EBDataFrame::id(), EcalTriggerPrimitiveDigi::id(), edm::EventBase::id(), EcalTrigTowerDetId::ieta(), towerEner::ieta_, EcalTrigTowerDetId::iphi(), towerEner::iphi_, edm::EventBase::orbitNumber(), edm::hash_detail::print_(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::EventID::run(), edm::SortedCollection< T, SORT >::size(), edm::DataFrameContainer::size(), and towerEner::tpgADC_.

108  {
109  using namespace edm;
110  using namespace std;
111 
112  if (print_)
113  std::cout << "===========" << iEvent.id() << std::endl;
114 
115  map<EcalTrigTowerDetId, towerEner> mapTower;
116  map<EcalTrigTowerDetId, towerEner>::iterator itTT;
117 
119  // get Evts info
121 
122  treeVariables_.runNb = iEvent.id().run();
123  treeVariables_.evtNb = iEvent.id().event();
124  treeVariables_.bxNb = iEvent.bunchCrossing();
125  treeVariables_.orbitNb = iEvent.orbitNumber();
126 
128  // get L1 info
130 
132  iEvent.getByLabel(edm::InputTag(gtRecordCollectionTag_), gtRecord);
133  DecisionWord dWord = gtRecord->decisionWord(); // this will get the decision word *before* masking disabled bits
134 
136  iSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
137  std::vector<unsigned int> triggerMaskAlgoTrig = l1GtTmAlgo.product()->gtTriggerMask();
138 
139  // apply masks on algo
140  int iDaq = 0;
141  int iBit = -1;
143  for (std::vector<bool>::iterator itBit = dWord.begin(); itBit != dWord.end(); ++itBit) {
144  iBit++;
145  int maskBit = triggerMaskAlgoTrig[iBit] & (1 << iDaq);
146  if (maskBit)
147  *itBit = false;
148  if (*itBit) {
151  }
152  }
153 
155  // Get TP data
157 
159  iEvent.getByLabel(tpCollection_, tp);
160  if (print_)
161  std::cout << "TP collection size=" << tp.product()->size() << std::endl;
162 
163  for (unsigned int i = 0; i < tp.product()->size(); i++) {
164  EcalTriggerPrimitiveDigi d = (*(tp.product()))[i];
165  const EcalTrigTowerDetId TPtowid = d.id();
166  towerEner tE;
167  tE.iphi_ = TPtowid.iphi();
168  tE.ieta_ = TPtowid.ieta();
169  tE.tpgADC_ = d[0].raw();
170  mapTower[TPtowid] = tE;
171  }
172 
174  // Get Emulators TP
176 
178  iEvent.getByLabel(tpEmulatorCollection_, tpEmul);
179  if (print_)
180  std::cout << "TPEmulator collection size=" << tpEmul.product()->size() << std::endl;
181 
182  for (unsigned int i = 0; i < tpEmul.product()->size(); i++) {
183  EcalTriggerPrimitiveDigi d = (*(tpEmul.product()))[i];
184  const EcalTrigTowerDetId TPtowid = d.id();
185  itTT = mapTower.find(TPtowid);
186  if (itTT != mapTower.end())
187  for (int j = 0; j < 5; j++)
188  (itTT->second).tpgEmul_[j] = d[j].raw();
189  }
190 
192  // Get nb of crystals read out
194 
195  // Get EB xtal digi inputs
197  iEvent.getByLabel(digiCollectionEB_, digiEB);
198 
199  for (unsigned int i = 0; i < digiEB.product()->size(); i++) {
200  const EBDataFrame& df = (*(digiEB.product()))[i];
201  const EBDetId& id = df.id();
202  const EcalTrigTowerDetId towid = id.tower();
203  itTT = mapTower.find(towid);
204  if (itTT != mapTower.end())
205  (itTT->second).nbXtal_++;
206  }
207 
208  if (useEE_) {
209  // Get EE xtal digi inputs
211  iEvent.getByLabel(digiCollectionEE_, digiEE);
212  for (unsigned int i = 0; i < digiEE.product()->size(); i++) {
213  const EEDataFrame& df = (*(digiEE.product()))[i];
214  const EEDetId& id = df.id();
215  const EcalTrigTowerDetId towid = (*eTTmap_).towerOf(id);
216  itTT = mapTower.find(towid);
217  if (itTT != mapTower.end())
218  (itTT->second).nbXtal_++;
219  }
220  }
221 
223  // Get rechits
225 
226  //... to be completed
227 
229  // fill tree
231 
232  treeVariables_.nbOfTowers = mapTower.size();
233  int towerNb = 0;
234  for (itTT = mapTower.begin(); itTT != mapTower.end(); ++itTT) {
235  treeVariables_.ieta[towerNb] = (itTT->second).ieta_;
236  treeVariables_.iphi[towerNb] = (itTT->second).iphi_;
237  treeVariables_.nbOfXtals[towerNb] = (itTT->second).nbXtal_;
238  treeVariables_.rawTPData[towerNb] = (itTT->second).tpgADC_;
239  treeVariables_.rawTPEmul1[towerNb] = (itTT->second).tpgEmul_[0];
240  treeVariables_.rawTPEmul2[towerNb] = (itTT->second).tpgEmul_[1];
241  treeVariables_.rawTPEmul3[towerNb] = (itTT->second).tpgEmul_[2];
242  treeVariables_.rawTPEmul4[towerNb] = (itTT->second).tpgEmul_[3];
243  treeVariables_.rawTPEmul5[towerNb] = (itTT->second).tpgEmul_[4];
244  treeVariables_.eRec[towerNb] = (itTT->second).eRec_;
245  towerNb++;
246  }
247 
248  tree_->Fill();
249 }
std::string gtRecordCollectionTag_
key_type id() const
Definition: EBDataFrame.h:31
int ieta() const
get the tower ieta
int iEvent
Definition: GenABIO.cc:224
EcalTPGVariables treeVariables_
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
edm::InputTag digiCollectionEB_
std::vector< bool > DecisionWord
typedefs
edm::InputTag tpEmulatorCollection_
edm::InputTag tpCollection_
const DecisionWord & decisionWord(int bxInEventValue) const
key_type id() const
Definition: EEDataFrame.h:28
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
T const * product() const
Definition: Handle.h:74
HLT enums.
size_type size() const
T const * product() const
Definition: ESHandle.h:86
edm::InputTag digiCollectionEE_
void EcalTPGAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &  evtSetup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file EcalTPGAnalyzer.cc.

References edm::EventSetup::get().

94  {
95  // geometry
96  ESHandle<CaloGeometry> theGeometry;
97  ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
98 
99  evtSetup.get<CaloGeometryRecord>().get(theGeometry);
100  evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap", theEndcapGeometry_handle);
101  evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel", theBarrelGeometry_handle);
102 
103  evtSetup.get<IdealGeometryRecord>().get(eTTmap_);
104  theEndcapGeometry_ = &(*theEndcapGeometry_handle);
105  theBarrelGeometry_ = &(*theBarrelGeometry_handle);
106 }
const CaloSubdetectorGeometry * theEndcapGeometry_
edm::ESHandle< EcalTrigTowerConstituentsMap > eTTmap_
const CaloSubdetectorGeometry * theBarrelGeometry_

Member Data Documentation

bool EcalTPGAnalyzer::allowTP_
private

Definition at line 77 of file EcalTPGAnalyzer.h.

edm::InputTag EcalTPGAnalyzer::digiCollectionEB_
private

Definition at line 73 of file EcalTPGAnalyzer.h.

edm::InputTag EcalTPGAnalyzer::digiCollectionEE_
private

Definition at line 74 of file EcalTPGAnalyzer.h.

edm::ESHandle<EcalTrigTowerConstituentsMap> EcalTPGAnalyzer::eTTmap_
private

Definition at line 83 of file EcalTPGAnalyzer.h.

TFile* EcalTPGAnalyzer::file_
private

Definition at line 67 of file EcalTPGAnalyzer.h.

std::string EcalTPGAnalyzer::gtRecordCollectionTag_
private

Definition at line 75 of file EcalTPGAnalyzer.h.

bool EcalTPGAnalyzer::print_
private

Definition at line 79 of file EcalTPGAnalyzer.h.

const CaloSubdetectorGeometry* EcalTPGAnalyzer::theBarrelGeometry_
private

Definition at line 82 of file EcalTPGAnalyzer.h.

const CaloSubdetectorGeometry* EcalTPGAnalyzer::theEndcapGeometry_
private

Definition at line 81 of file EcalTPGAnalyzer.h.

edm::InputTag EcalTPGAnalyzer::tpCollection_
private

Definition at line 71 of file EcalTPGAnalyzer.h.

edm::InputTag EcalTPGAnalyzer::tpEmulatorCollection_
private

Definition at line 72 of file EcalTPGAnalyzer.h.

TTree* EcalTPGAnalyzer::tree_
private

Definition at line 68 of file EcalTPGAnalyzer.h.

EcalTPGVariables EcalTPGAnalyzer::treeVariables_
private

Definition at line 69 of file EcalTPGAnalyzer.h.

bool EcalTPGAnalyzer::useEE_
private

Definition at line 78 of file EcalTPGAnalyzer.h.