#include <EcalTrigPrimAnalyzer.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
EcalTrigPrimAnalyzer (const edm::ParameterSet &) | |
virtual void | endJob () |
~EcalTrigPrimAnalyzer () | |
Private Attributes | |
TH1I * | ecal_et_ [2] |
TH1I * | ecal_fgvb_ [2] |
std::vector< std::string > | ecal_parts_ |
TH1I * | ecal_tt_ [2] |
float | eRec_ |
int | fg_ |
TH1I * | histBar |
TH1I * | histEndc |
TFile * | histfile_ |
TH1F * | hTPoverRechit_ |
TH2F * | hTPvsRechit_ |
int | ieta_ |
int | iphi_ |
edm::InputTag | label_ |
bool | recHits_ |
edm::InputTag | rechits_labelEB_ |
edm::InputTag | rechits_labelEE_ |
int | tpgADC_ |
float | tpgGeV_ |
TTree * | tree_ |
int | ttf_ |
Description: test of the output of EcalTrigPrimProducer
Description: rereads the result of the EcalTrigPrimProducer
Definition at line 39 of file EcalTrigPrimAnalyzer.h.
EcalTrigPrimAnalyzer::EcalTrigPrimAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 52 of file EcalTrigPrimAnalyzer.cc.
References edm::ParameterSet::getParameter(), i, and indexGen::title.
{ ecal_parts_.push_back("Barrel"); ecal_parts_.push_back("Endcap"); histfile_=new TFile("histos.root","RECREATE"); tree_ = new TTree("TPGtree","TPGtree"); tree_->Branch("iphi",&iphi_,"iphi/I"); tree_->Branch("ieta",&ieta_,"ieta/I"); tree_->Branch("eRec",&eRec_,"eRec/F"); tree_->Branch("tpgADC",&tpgADC_,"tpgADC/I"); tree_->Branch("tpgGeV",&tpgGeV_,"tpgGeV/F"); tree_->Branch("ttf",&ttf_,"ttf/I"); tree_->Branch("fg",&fg_,"fg/I"); for (unsigned int i=0;i<2;++i) { ecal_et_[i]=new TH1I(ecal_parts_[i].c_str(),"Et",255,0,255); char title[30]; sprintf(title,"%s_ttf",ecal_parts_[i].c_str()); ecal_tt_[i]=new TH1I(title,"TTF",10,0,10); sprintf(title,"%s_fgvb",ecal_parts_[i].c_str()); ecal_fgvb_[i]=new TH1I(title,"FGVB",10,0,10); } recHits_= iConfig.getParameter<bool>("AnalyzeRecHits"); label_=iConfig.getParameter<edm::InputTag>("inputTP"); if (recHits_) { hTPvsRechit_= new TH2F("TP_vs_RecHit","TP vs rechit",256,-1,255,255,0,255); hTPoverRechit_= new TH1F("TP_over_RecHit","TP over rechit",500,0,4); rechits_labelEB_=iConfig.getParameter<edm::InputTag>("inputRecHitsEB"); rechits_labelEE_=iConfig.getParameter<edm::InputTag>("inputRecHitsEE"); } }
EcalTrigPrimAnalyzer::~EcalTrigPrimAnalyzer | ( | ) |
Definition at line 87 of file EcalTrigPrimAnalyzer.cc.
void EcalTrigPrimAnalyzer::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 105 of file EcalTrigPrimAnalyzer.cc.
References EcalTriggerPrimitiveDigi::compressedEt(), prof2calltree::count, relval_parameters_module::energy, EcalTriggerPrimitiveDigi::fineGrain(), edm::EventSetup::get(), edm::Event::getByLabel(), i, EcalTriggerPrimitiveDigi::id(), EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::ietaAbs(), EcalTrigTowerDetId::iphi(), j, EcalTPGScale::setEventSetup(), funct::sin(), EcalTrigTowerDetId::subDet(), theta(), EBDetId::tower(), and EcalTriggerPrimitiveDigi::ttFlag().
{ using namespace edm; using namespace std; // Get input edm::Handle<EcalTrigPrimDigiCollection> tp; iEvent.getByLabel(label_,tp); for (unsigned int i=0;i<tp.product()->size();i++) { EcalTriggerPrimitiveDigi d=(*(tp.product()))[i]; int subdet=d.id().subDet()-1; 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()); } if (!recHits_) return; // comparison with RecHits edm::Handle<EcalRecHitCollection> rechit_EB_col; iEvent.getByLabel(rechits_labelEB_,rechit_EB_col); edm::Handle<EcalRecHitCollection> rechit_EE_col; iEvent.getByLabel(rechits_labelEE_,rechit_EE_col); edm::ESHandle<CaloGeometry> theGeometry; edm::ESHandle<CaloSubdetectorGeometry> theBarrelGeometry_handle; edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle; iSetup.get<CaloGeometryRecord>().get( theGeometry ); iSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle); iSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle); const CaloSubdetectorGeometry *theEndcapGeometry,*theBarrelGeometry; theEndcapGeometry = &(*theEndcapGeometry_handle); theBarrelGeometry = &(*theBarrelGeometry_handle); edm::ESHandle<EcalTrigTowerConstituentsMap> eTTmap_; iSetup.get<IdealGeometryRecord>().get(eTTmap_); map<EcalTrigTowerDetId, float> mapTow_Et; for (unsigned int i=0;i<rechit_EB_col.product()->size();i++) { const EBDetId & myid1=(*rechit_EB_col.product())[i].id(); EcalTrigTowerDetId towid1= myid1.tower(); float theta = theBarrelGeometry->getGeometry(myid1)->getPosition().theta(); float Etsum=((*rechit_EB_col.product())[i].energy())*sin(theta); bool test_alreadyin= false; map<EcalTrigTowerDetId, float>::iterator ittest= mapTow_Et.find(towid1); if (ittest!= mapTow_Et.end()) test_alreadyin=true; if (test_alreadyin) continue; unsigned int j=i+1; bool loopend=false; unsigned int count=0; while( j<rechit_EB_col.product()->size() && !loopend){ count++; const EBDetId & myid2=(*rechit_EB_col.product())[j].id(); EcalTrigTowerDetId towid2= myid2.tower(); if( towid1==towid2 ) { float theta=theBarrelGeometry->getGeometry(myid2)->getPosition().theta(); Etsum += (*rechit_EB_col.product())[j].energy()*sin(theta); } j++; if (count>1800) loopend=true; } mapTow_Et.insert(pair<EcalTrigTowerDetId,float>(towid1, Etsum)); } for (unsigned int i=0;i<rechit_EE_col.product()->size();i++) { const EEDetId & myid1=(*rechit_EE_col.product())[i].id(); EcalTrigTowerDetId towid1= (*eTTmap_).towerOf(myid1); float theta=theEndcapGeometry->getGeometry(myid1)->getPosition().theta(); float Etsum=(*rechit_EE_col.product())[i].energy()*sin(theta); bool test_alreadyin= false; map<EcalTrigTowerDetId, float>::iterator ittest= mapTow_Et.find(towid1); if (ittest!= mapTow_Et.end()) test_alreadyin=true; if (test_alreadyin) continue; unsigned int j=i+1; bool loopend=false; unsigned int count=0; while( j<rechit_EE_col.product()->size() && !loopend){ const EEDetId & myid2=(*rechit_EE_col.product())[j].id(); EcalTrigTowerDetId towid2= (*eTTmap_).towerOf(myid2); if( towid1==towid2 ) { float theta=theEndcapGeometry->getGeometry(myid2)->getPosition().theta(); Etsum += (*rechit_EE_col.product())[j].energy()*sin(theta); } // else loopend=true; j++; if (count>500) loopend=true; } // alreadyin_EE.push_back(towid1); mapTow_Et.insert(pair<EcalTrigTowerDetId,float>(towid1, Etsum)); } EcalTPGScale ecalScale ; ecalScale.setEventSetup(iSetup) ; for (unsigned int i=0;i<tp.product()->size();i++) { EcalTriggerPrimitiveDigi d=(*(tp.product()))[i]; const EcalTrigTowerDetId TPtowid= d.id(); map<EcalTrigTowerDetId, float>::iterator it= mapTow_Et.find(TPtowid); float Et = ecalScale.getTPGInGeV(d.compressedEt(), TPtowid) ; if (d.id().ietaAbs()==27 || d.id().ietaAbs()==28) Et*=2; iphi_ = TPtowid.iphi() ; ieta_ = TPtowid.ieta() ; tpgADC_ = d.compressedEt() ; tpgGeV_ = Et ; ttf_ = d.ttFlag() ; fg_ = d.fineGrain() ; if (it!= mapTow_Et.end()) { hTPvsRechit_->Fill(it->second,Et); hTPoverRechit_->Fill(Et/it->second); eRec_ = it->second ; } tree_->Fill() ; } }
void EcalTrigPrimAnalyzer::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 235 of file EcalTrigPrimAnalyzer.cc.
References i.
{ for (unsigned int i=0;i<2;++i) { ecal_et_[i]->Write(); ecal_tt_[i]->Write(); ecal_fgvb_[i]->Write(); } if (recHits_) { hTPvsRechit_->Write(); hTPoverRechit_->Write(); } }
TH1I* EcalTrigPrimAnalyzer::ecal_et_[2] [private] |
Definition at line 51 of file EcalTrigPrimAnalyzer.h.
TH1I* EcalTrigPrimAnalyzer::ecal_fgvb_[2] [private] |
Definition at line 53 of file EcalTrigPrimAnalyzer.h.
std::vector<std::string> EcalTrigPrimAnalyzer::ecal_parts_ [private] |
Definition at line 50 of file EcalTrigPrimAnalyzer.h.
TH1I* EcalTrigPrimAnalyzer::ecal_tt_[2] [private] |
Definition at line 52 of file EcalTrigPrimAnalyzer.h.
float EcalTrigPrimAnalyzer::eRec_ [private] |
Definition at line 61 of file EcalTrigPrimAnalyzer.h.
int EcalTrigPrimAnalyzer::fg_ [private] |
Definition at line 60 of file EcalTrigPrimAnalyzer.h.
TH1I * EcalTrigPrimAnalyzer::histBar [private] |
Definition at line 54 of file EcalTrigPrimAnalyzer.h.
TH1I* EcalTrigPrimAnalyzer::histEndc [private] |
Definition at line 54 of file EcalTrigPrimAnalyzer.h.
TFile* EcalTrigPrimAnalyzer::histfile_ [private] |
Definition at line 55 of file EcalTrigPrimAnalyzer.h.
TH1F* EcalTrigPrimAnalyzer::hTPoverRechit_ [private] |
Definition at line 57 of file EcalTrigPrimAnalyzer.h.
TH2F* EcalTrigPrimAnalyzer::hTPvsRechit_ [private] |
Definition at line 56 of file EcalTrigPrimAnalyzer.h.
int EcalTrigPrimAnalyzer::ieta_ [private] |
Definition at line 60 of file EcalTrigPrimAnalyzer.h.
int EcalTrigPrimAnalyzer::iphi_ [private] |
Definition at line 60 of file EcalTrigPrimAnalyzer.h.
edm::InputTag EcalTrigPrimAnalyzer::label_ [private] |
Definition at line 63 of file EcalTrigPrimAnalyzer.h.
bool EcalTrigPrimAnalyzer::recHits_ [private] |
Definition at line 68 of file EcalTrigPrimAnalyzer.h.
Definition at line 65 of file EcalTrigPrimAnalyzer.h.
Definition at line 66 of file EcalTrigPrimAnalyzer.h.
int EcalTrigPrimAnalyzer::tpgADC_ [private] |
Definition at line 60 of file EcalTrigPrimAnalyzer.h.
float EcalTrigPrimAnalyzer::tpgGeV_ [private] |
Definition at line 61 of file EcalTrigPrimAnalyzer.h.
TTree* EcalTrigPrimAnalyzer::tree_ [private] |
Definition at line 58 of file EcalTrigPrimAnalyzer.h.
int EcalTrigPrimAnalyzer::ttf_ [private] |
Definition at line 60 of file EcalTrigPrimAnalyzer.h.