#include <EcalTPGAnalyzer.h>
Classes | |
struct | EcalTPGVariables |
Public Member Functions | |
virtual void | analyze (edm::Event const &, edm::EventSetup const &) |
virtual void | beginRun (edm::Run const &, edm::EventSetup const &) |
EcalTPGAnalyzer (const edm::ParameterSet &) | |
~EcalTPGAnalyzer () | |
Private Attributes | |
bool | allowTP_ |
edm::InputTag | digiCollectionEB_ |
edm::InputTag | digiCollectionEE_ |
edm::ESHandle < EcalTrigTowerConstituentsMap > | eTTmap_ |
TFile * | file_ |
std::string | gtRecordCollectionTag_ |
bool | print_ |
const CaloSubdetectorGeometry * | theBarrelGeometry_ |
const CaloSubdetectorGeometry * | theEndcapGeometry_ |
edm::InputTag | tpCollection_ |
edm::InputTag | tpEmulatorCollection_ |
TTree * | tree_ |
EcalTPGVariables | treeVariables_ |
bool | useEE_ |
Definition at line 39 of file EcalTPGAnalyzer.h.
EcalTPGAnalyzer::EcalTPGAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 51 of file EcalTPGAnalyzer.cc.
References edm::ParameterSet::getParameter(), edm::hash_detail::print_(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ tpCollection_ = iConfig.getParameter<edm::InputTag>("TPCollection") ; tpEmulatorCollection_ = iConfig.getParameter<edm::InputTag>("TPEmulatorCollection") ; digiCollectionEB_ = iConfig.getParameter<edm::InputTag>("DigiCollectionEB") ; digiCollectionEE_ = iConfig.getParameter<edm::InputTag>("DigiCollectionEE") ; gtRecordCollectionTag_ = iConfig.getParameter<std::string>("GTRecordCollection") ; allowTP_ = iConfig.getParameter<bool>("ReadTriggerPrimitives"); useEE_ = iConfig.getParameter<bool>("UseEndCap"); print_ = iConfig.getParameter<bool>("Print"); // file file_ = new TFile("ECALTPGtree.root","RECREATE"); file_->cd() ; // tree tree_ = new TTree( "EcalTPGAnalysis","EcalTPGAnalysis" ); tree_->Branch("runNb",&treeVariables_.runNb,"runNb/i"); // tree_->Branch("evtNb",&treeVariables_.evtNb,"evtNb/i"); // tree_->Branch("bxNb",&treeVariables_.bxNb,"bxNb/i"); // tree_->Branch("orbitNb",&treeVariables_.orbitNb,"orbitNb/i"); // tree_->Branch("nbOfActiveTriggers",&treeVariables_.nbOfActiveTriggers,"nbOfActiveTriggers/i"); // tree_->Branch("activeTriggers",treeVariables_.activeTriggers,"activeTriggers[nbOfActiveTriggers]/I"); // tree_->Branch("nbOfTowers",&treeVariables_.nbOfTowers,"nbOfTowers/i"); // tree_->Branch("ieta", treeVariables_.ieta,"ieta[nbOfTowers]/I");// tree_->Branch("iphi", treeVariables_.iphi,"iphi[nbOfTowers]/I");// tree_->Branch("nbOfXtals", treeVariables_.nbOfXtals,"nbOfXtals[nbOfTowers]/I");// tree_->Branch("rawTPData", treeVariables_.rawTPData,"rawTPData[nbOfTowers]/I");// tree_->Branch("rawTPEmul1", treeVariables_.rawTPEmul1,"rawTPEmul1[nbOfTowers]/I");// tree_->Branch("rawTPEmul2", treeVariables_.rawTPEmul2,"rawTPEmul2[nbOfTowers]/I");// tree_->Branch("rawTPEmul3", treeVariables_.rawTPEmul3,"rawTPEmul3[nbOfTowers]/I");// tree_->Branch("rawTPEmul4", treeVariables_.rawTPEmul4,"rawTPEmul4[nbOfTowers]/I");// tree_->Branch("rawTPEmul5", treeVariables_.rawTPEmul5,"rawTPEmul5[nbOfTowers]/I");// tree_->Branch("eRec", treeVariables_.eRec,"eRec[nbOfTowers]/F");// }
EcalTPGAnalyzer::~EcalTPGAnalyzer | ( | ) |
Definition at line 91 of file EcalTPGAnalyzer.cc.
void EcalTPGAnalyzer::analyze | ( | edm::Event const & | iEvent, |
edm::EventSetup const & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 114 of file EcalTPGAnalyzer.cc.
References edm::EventBase::bunchCrossing(), gather_cfg::cout, edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), i, EBDataFrame::id(), EcalTriggerPrimitiveDigi::id(), edm::EventBase::id(), EEDataFrame::id(), EcalTrigTowerDetId::ieta(), towerEner::ieta_, EcalTrigTowerDetId::iphi(), towerEner::iphi_, j, edm::EventBase::orbitNumber(), edm::hash_detail::print_(), edm::Handle< T >::product(), edm::EventID::run(), and towerEner::tpgADC_.
{ using namespace edm; using namespace std; if (print_) std::cout<<"==========="<<iEvent.id()<<std::endl ; map<EcalTrigTowerDetId, towerEner> mapTower ; map<EcalTrigTowerDetId, towerEner>::iterator itTT ; // get Evts info treeVariables_.runNb = iEvent.id().run() ; treeVariables_.evtNb = iEvent.id().event() ; treeVariables_.bxNb = iEvent.bunchCrossing() ; treeVariables_.orbitNb = iEvent.orbitNumber() ; // get L1 info edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord; iEvent.getByLabel( edm::InputTag(gtRecordCollectionTag_), gtRecord); DecisionWord dWord = gtRecord->decisionWord(); // this will get the decision word *before* masking disabled bits edm::ESHandle< L1GtTriggerMask > l1GtTmAlgo; iSetup.get< L1GtTriggerMaskAlgoTrigRcd >().get( l1GtTmAlgo ); std::vector<unsigned int> triggerMaskAlgoTrig = l1GtTmAlgo.product()->gtTriggerMask(); // apply masks on algo int iDaq = 0; int iBit = -1; treeVariables_.nbOfActiveTriggers = 0 ; for (std::vector<bool>::iterator itBit = dWord.begin(); itBit != dWord.end(); ++itBit) { iBit++; int maskBit = triggerMaskAlgoTrig[iBit] & (1 << iDaq); if (maskBit) *itBit = false; if (*itBit) { treeVariables_.activeTriggers[treeVariables_.nbOfActiveTriggers] = iBit ; treeVariables_.nbOfActiveTriggers++ ; } } // Get TP data edm::Handle<EcalTrigPrimDigiCollection> tp; iEvent.getByLabel(tpCollection_,tp); if (print_) std::cout<<"TP collection size="<<tp.product()->size()<<std::endl ; for (unsigned int i=0;i<tp.product()->size();i++) { EcalTriggerPrimitiveDigi d = (*(tp.product()))[i]; const EcalTrigTowerDetId TPtowid= d.id(); towerEner tE ; tE.iphi_ = TPtowid.iphi() ; tE.ieta_ = TPtowid.ieta() ; tE.tpgADC_ = d[0].raw() ; mapTower[TPtowid] = tE ; } // Get Emulators TP edm::Handle<EcalTrigPrimDigiCollection> tpEmul ; iEvent.getByLabel(tpEmulatorCollection_, tpEmul); if (print_) std::cout<<"TPEmulator collection size="<<tpEmul.product()->size()<<std::endl ; for (unsigned int i=0;i<tpEmul.product()->size();i++) { EcalTriggerPrimitiveDigi d = (*(tpEmul.product()))[i]; const EcalTrigTowerDetId TPtowid= d.id(); itTT = mapTower.find(TPtowid) ; if (itTT != mapTower.end()) for (int j=0 ; j<5 ; j++) (itTT->second).tpgEmul_[j] = d[j].raw() ; } // Get nb of crystals read out // Get EB xtal digi inputs edm::Handle<EBDigiCollection> digiEB; iEvent.getByLabel(digiCollectionEB_, digiEB); for (unsigned int i=0;i<digiEB.product()->size();i++) { const EBDataFrame & df = (*(digiEB.product()))[i]; const EBDetId & id = df.id(); const EcalTrigTowerDetId towid = id.tower(); itTT = mapTower.find(towid) ; if (itTT != mapTower.end()) (itTT->second).nbXtal_++ ; } if (useEE_) { // Get EE xtal digi inputs edm::Handle<EEDigiCollection> digiEE; iEvent.getByLabel(digiCollectionEE_, digiEE); for (unsigned int i=0;i<digiEE.product()->size();i++) { const EEDataFrame & df = (*(digiEE.product()))[i]; const EEDetId & id = df.id(); const EcalTrigTowerDetId towid = (*eTTmap_).towerOf(id); itTT = mapTower.find(towid) ; if (itTT != mapTower.end()) (itTT->second).nbXtal_++ ; } } // Get rechits //... to be completed // fill tree treeVariables_.nbOfTowers = mapTower.size() ; int towerNb = 0 ; for (itTT = mapTower.begin() ; itTT != mapTower.end() ; ++itTT) { treeVariables_.ieta[towerNb] = (itTT->second).ieta_ ; treeVariables_.iphi[towerNb] = (itTT->second).iphi_ ; treeVariables_.nbOfXtals[towerNb] = (itTT->second).nbXtal_ ; treeVariables_.rawTPData[towerNb] = (itTT->second).tpgADC_ ; treeVariables_.rawTPEmul1[towerNb] = (itTT->second).tpgEmul_[0] ; treeVariables_.rawTPEmul2[towerNb] = (itTT->second).tpgEmul_[1] ; treeVariables_.rawTPEmul3[towerNb] = (itTT->second).tpgEmul_[2] ; treeVariables_.rawTPEmul4[towerNb] = (itTT->second).tpgEmul_[3] ; treeVariables_.rawTPEmul5[towerNb] = (itTT->second).tpgEmul_[4] ; treeVariables_.eRec[towerNb] = (itTT->second).eRec_ ; towerNb++ ; } tree_->Fill() ; }
void EcalTPGAnalyzer::beginRun | ( | edm::Run const & | , |
edm::EventSetup const & | evtSetup | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 98 of file EcalTPGAnalyzer.cc.
References edm::EventSetup::get().
{ // geometry ESHandle<CaloGeometry> theGeometry; ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle; evtSetup.get<CaloGeometryRecord>().get( theGeometry ); evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle); evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle); evtSetup.get<IdealGeometryRecord>().get(eTTmap_); theEndcapGeometry_ = &(*theEndcapGeometry_handle); theBarrelGeometry_ = &(*theBarrelGeometry_handle); }
bool EcalTPGAnalyzer::allowTP_ [private] |
Definition at line 82 of file EcalTPGAnalyzer.h.
Definition at line 78 of file EcalTPGAnalyzer.h.
Definition at line 79 of file EcalTPGAnalyzer.h.
Definition at line 88 of file EcalTPGAnalyzer.h.
TFile* EcalTPGAnalyzer::file_ [private] |
Definition at line 72 of file EcalTPGAnalyzer.h.
std::string EcalTPGAnalyzer::gtRecordCollectionTag_ [private] |
Definition at line 80 of file EcalTPGAnalyzer.h.
bool EcalTPGAnalyzer::print_ [private] |
Definition at line 84 of file EcalTPGAnalyzer.h.
const CaloSubdetectorGeometry* EcalTPGAnalyzer::theBarrelGeometry_ [private] |
Definition at line 87 of file EcalTPGAnalyzer.h.
const CaloSubdetectorGeometry* EcalTPGAnalyzer::theEndcapGeometry_ [private] |
Definition at line 86 of file EcalTPGAnalyzer.h.
edm::InputTag EcalTPGAnalyzer::tpCollection_ [private] |
Definition at line 76 of file EcalTPGAnalyzer.h.
Definition at line 77 of file EcalTPGAnalyzer.h.
TTree* EcalTPGAnalyzer::tree_ [private] |
Definition at line 73 of file EcalTPGAnalyzer.h.
Definition at line 74 of file EcalTPGAnalyzer.h.
bool EcalTPGAnalyzer::useEE_ [private] |
Definition at line 83 of file EcalTPGAnalyzer.h.