38 ecal_parts_.push_back(
"Barrel");
40 histfile_=
new TFile(
"histos.root",
"RECREATE");
41 tree_ =
new TTree(
"TPGtree",
"TPGtree");
42 tree_->Branch(
"tpIphi",&tpIphi_,
"tpIphi/I");
43 tree_->Branch(
"tpIeta",&tpIeta_,
"tpIeta/I");
44 tree_->Branch(
"rhIphi",&rhIphi_,
"rhIphi/I");
45 tree_->Branch(
"rhIeta",&rhIeta_,
"rhIeta/I");
46 tree_->Branch(
"eRec",&eRec_,
"eRec/F");
47 tree_->Branch(
"tpgADC",&tpgADC_,
"tpgADC/I");
48 tree_->Branch(
"tpgGeV",&tpgGeV_,
"tpgGeV/F");
49 tree_->Branch(
"ttf",&ttf_,
"ttf/I");
50 tree_->Branch(
"fg",&fg_,
"fg/I");
51 for (
unsigned int i=0;
i<ecal_parts_.size();++
i) {
53 sprintf(title,
"%s_Et",ecal_parts_[
i].c_str());
54 ecal_et_[
i]=
new TH1I(title,
"Et",255,0,255);
55 sprintf(title,
"%s_ttf",ecal_parts_[
i].c_str());
56 ecal_tt_[
i]=
new TH1I(title,
"TTF",10,0,10);
57 sprintf(title,
"%s_fgvb",ecal_parts_[
i].c_str());
58 ecal_fgvb_[
i]=
new TH1I(title,
"FGVB",10,0,10);
68 hTPvsTow_eta_=
new TH2F(
"TP_vs_Tow_eta",
"TP vs Tow eta ; #eta(tow); #eta(tp)",50,-2.5,2.5,50,-2.5,2.5);
69 hAllTPperEvt_ =
new TH1F(
"AllTPperEvt",
"TP per Event; N_{TP}; ", 100, 0., 20000.);
70 hTPperEvt_ =
new TH1F(
"TPperEvt",
"N_{TP} per Event; N_{TP}; ", 100, 0., 500.);
71 hTP_iphiVsieta_=
new TH2F(
"TP_iphiVsieta",
"TP i#phi vs i#eta ; i#eta(tp); i#phi(tp)",10,70,80,10,340,350);
72 hTP_iphiVsieta_fullrange_=
new TH2F(
"TP_iphiVsieta_fullrange",
"TP i#phi vs i#eta ; i#eta(tp); i#phi(tp)",200,-100,100,350,0,350);
75 hTPvsTow_ieta_=
new TH2F(
"TP_vs_Tow_ieta",
"TP vs Tow ieta ; i#eta(tow); i#eta(tp)",200,-100,100,200,-100,100);
77 hTPvsRechit_=
new TH2F(
"TP_vs_RecHit",
"TP vs rechit Et;E_{T}(rh) (GeV);E_{T}(tp) (GeV)",100,0,50,100,0,50);
78 hDeltaEt_ =
new TH1F(
"DeltaEt",
"[Et(rh)-Et(TP)]/Et(rh); [E_{T}(rh)-E_{T}(tp)]/E_{T}(rh); Counts",200,-1,1);
79 hTPoverRechit_=
new TH1F(
"TP_over_RecHit",
"Et(TP/rechit); E_{T}(tp)/E_{T}(rh); Counts",200,0,2);
80 hRechitEt_=
new TH1F(
"RecHitEt",
"E_{T};E_{T}(rh) (GeV);Counts",100,0,50);
81 hTPEt_=
new TH1F(
"TPEt",
"E_{T}{tp);E_{T}(rh) (GeV);Count",100,0,50);
82 hRatioEt_ =
new TH1F(
"RatioTPoverRH",
"Et",100,0,50);
83 hAllRechitEt_=
new TH1F(
"AllRecHit",
"Et",100,0,50);
85 hRH_iphiVsieta_=
new TH2F(
"RH_iphiVsieta",
"RH i#phi vs i#eta ; i#eta(rh); i#phi(rh)",10,70,80,10,340,350);
86 hRH_iphiVsieta_fullrange_=
new TH2F(
"RH_iphiVsieta_fullrange",
"RH i#phi vs i#eta ; i#eta(rh); i#phi(rh)",200,-100,100,350,0,350);
120 if ( nEvents_==1) this->
init(iSetup);
149 iEvent.
getByToken(rechits_labelEB_,rechit_EB_col);
156 if (debug_) {
std::cout <<
" TP analyzer =================> Treating event "<<iEvent.
id() <<
" Number of TPs " << tp.
product()->
size() << std::endl;
157 if ( recHits_ )
std::cout <<
" Number of EB rechits "<< rechit_EB_col.
product()->
size() << std::endl;
186 if ( Et<= 5 )
continue;
191 for (
int iBx=0;iBx<d.
size();iBx++) {
203 tpIphi_ = TPid.
iphi() ;
204 tpIeta_ = TPid.
ieta() ;
208 hTP_iphiVsieta_->Fill(TPid.
ieta(), TPid.
iphi(), Et);
209 hTP_iphiVsieta_fullrange_->Fill(TPid.
ieta(), TPid.
iphi(), Et);
213 for (
unsigned int j=0;j<rechit_EB_col.
product()->
size();j++) {
216 float rhEt=((*rechit_EB_col.
product())[j].energy())*
sin(theta);
217 if ( myid1 == TPid ) {
218 if (debug_)
std::cout <<
" Analyzer same cristal " << myid1 <<
" " << TPid << std::endl;
230 rhIphi_ = myid1.
iphi() ;
231 rhIeta_ = myid1.
ieta() ;
232 hRH_iphiVsieta_->Fill(myid1.
ieta(), myid1.
iphi(), rhEt);
233 hRH_iphiVsieta_fullrange_->Fill(myid1.
ieta(), myid1.
iphi(), rhEt);
235 hTPvsRechit_->Fill(rhEt,Et);
236 hTPoverRechit_->Fill(Et/rhEt);
237 hDeltaEt_ ->Fill ((rhEt-Et)/rhEt);
238 if (debug_)
std::cout <<
" TP compressed et " << d.
encodedEt() <<
" Et in GeV " << Et <<
" RH Et " << rhEt <<
" Et/rhEt " << Et/rhEt << std::endl;
239 hRechitEt_->Fill(rhEt);
241 if ( rhEt < 1000000) eRec_ = rhEt;
252 hTPperEvt_->Fill(
float(nTP));
255 hRatioEt_->Divide( hTPEt_, hRechitEt_);
256 for (
unsigned int j=0;j<rechit_EB_col.
product()->
size();j++) {
259 float rhEt=((*rechit_EB_col.
product())[j].energy())*
sin(theta);
261 hAllRechitEt_ ->Fill(rhEt);
270 for (
unsigned int i=0;
i<ecal_parts_.size();++
i) {
271 ecal_et_[
i]->Write();
272 ecal_tt_[
i]->Write();
273 ecal_fgvb_[
i]->Write();
277 hAllTPperEvt_->Write();
281 hTPvsTow_ieta_->Write();
282 hTPvsTow_eta_->Write();
283 hTPvsRechit_->Write();
284 hTPoverRechit_->Write();
285 hAllRechitEt_->Write();
290 hTP_iphiVsieta_->Write();
291 hRH_iphiVsieta_->Write();
292 hTP_iphiVsieta_fullrange_->Write();
293 hRH_iphiVsieta_fullrange_->Write();
T getParameter(std::string const &) const
void setEventSetup(const edm::EventSetup &evtSetup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
int iphi() const
get the crystal iphi
const EBDetId & id() const
~EcalEBTrigPrimAnalyzer() override
const EcalEBTriggerPrimitiveSample & sample(int i) const
int encodedEt() const
get the 10 bits Et of interesting sample
int ieta() const
get the crystal ieta
EcalEBTrigPrimAnalyzer(const edm::ParameterSet &)
T const * product() const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void analyze(const edm::Event &, const edm::EventSetup &) override
void init(const edm::EventSetup &)
T const * product() const