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);
155 theBarrelGeometry = &(*theBarrelGeometry_handle);
157 if (debug_) {
std::cout <<
" TP analyzer =================> Treating event "<<iEvent.
id() <<
" Number of TPs " << tp.
product()->
size() << std::endl;
158 if ( recHits_ )
std::cout <<
" Number of EB rechits "<< rechit_EB_col.
product()->
size() << std::endl;
187 if ( Et<= 5 )
continue;
192 for (
int iBx=0;iBx<d.
size();iBx++) {
204 tpIphi_ = TPid.
iphi() ;
205 tpIeta_ = TPid.
ieta() ;
209 hTP_iphiVsieta_->Fill(TPid.
ieta(), TPid.
iphi(), Et);
210 hTP_iphiVsieta_fullrange_->Fill(TPid.
ieta(), TPid.
iphi(), Et);
214 for (
unsigned int j=0;j<rechit_EB_col.
product()->
size();j++) {
217 float rhEt=((*rechit_EB_col.
product())[j].energy())*
sin(theta);
218 if ( myid1 == TPid ) {
219 if (debug_)
std::cout <<
" Analyzer same cristal " << myid1 <<
" " << TPid << std::endl;
231 rhIphi_ = myid1.
iphi() ;
232 rhIeta_ = myid1.
ieta() ;
233 hRH_iphiVsieta_->Fill(myid1.
ieta(), myid1.
iphi(), rhEt);
234 hRH_iphiVsieta_fullrange_->Fill(myid1.
ieta(), myid1.
iphi(), rhEt);
236 hTPvsRechit_->Fill(rhEt,Et);
237 hTPoverRechit_->Fill(Et/rhEt);
238 hDeltaEt_ ->Fill ((rhEt-Et)/rhEt);
239 if (debug_)
std::cout <<
" TP compressed et " << d.
encodedEt() <<
" Et in GeV " << Et <<
" RH Et " << rhEt <<
" Et/rhEt " << Et/rhEt << std::endl;
240 hRechitEt_->Fill(rhEt);
242 if ( rhEt < 1000000) eRec_ = rhEt;
253 hTPperEvt_->Fill(
float(nTP));
256 hRatioEt_->Divide( hTPEt_, hRechitEt_);
257 for (
unsigned int j=0;j<rechit_EB_col.
product()->
size();j++) {
260 float rhEt=((*rechit_EB_col.
product())[j].energy())*
sin(theta);
262 hAllRechitEt_ ->Fill(rhEt);
271 for (
unsigned int i=0;
i<ecal_parts_.size();++
i) {
272 ecal_et_[
i]->Write();
273 ecal_tt_[
i]->Write();
274 ecal_fgvb_[
i]->Write();
278 hAllTPperEvt_->Write();
282 hTPvsTow_ieta_->Write();
283 hTPvsTow_eta_->Write();
284 hTPvsRechit_->Write();
285 hTPoverRechit_->Write();
286 hAllRechitEt_->Write();
291 hTP_iphiVsieta_->Write();
292 hRH_iphiVsieta_->Write();
293 hTP_iphiVsieta_fullrange_->Write();
294 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
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Geom::Theta< T > theta() const
int iphi() const
get the crystal iphi
const EBDetId & id() const
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 void analyze(const edm::Event &, const edm::EventSetup &) override
void init(const edm::EventSetup &)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
~EcalEBTrigPrimAnalyzer()