54 ecal_parts_.push_back(
"Barrel");
55 ecal_parts_.push_back(
"Endcap");
57 histfile_=
new TFile(
"histos.root",
"RECREATE");
58 tree_ =
new TTree(
"TPGtree",
"TPGtree");
59 tree_->Branch(
"iphi",&iphi_,
"iphi/I");
60 tree_->Branch(
"ieta",&ieta_,
"ieta/I");
61 tree_->Branch(
"eRec",&eRec_,
"eRec/F");
62 tree_->Branch(
"tpgADC",&tpgADC_,
"tpgADC/I");
63 tree_->Branch(
"tpgGeV",&tpgGeV_,
"tpgGeV/F");
64 tree_->Branch(
"ttf",&ttf_,
"ttf/I");
65 tree_->Branch(
"fg",&fg_,
"fg/I");
66 for (
unsigned int i=0;
i<2;++
i) {
67 ecal_et_[
i]=
new TH1I(ecal_parts_[
i].c_str(),
"Et",255,0,255);
69 sprintf(title,
"%s_ttf",ecal_parts_[
i].c_str());
70 ecal_tt_[
i]=
new TH1I(title,
"TTF",10,0,10);
71 sprintf(title,
"%s_fgvb",ecal_parts_[
i].c_str());
72 ecal_fgvb_[
i]=
new TH1I(title,
"FGVB",10,0,10);
78 hTPvsRechit_=
new TH2F(
"TP_vs_RecHit",
"TP vs rechit",256,-1,255,255,0,255);
79 hTPoverRechit_=
new TH1F(
"TP_over_RecHit",
"TP over rechit",500,0,4);
124 ecal_tt_[subdet]->Fill(d.
ttFlag());
128 if (!recHits_)
return;
132 iEvent.
getByLabel(rechits_labelEB_,rechit_EB_col);
135 iEvent.
getByLabel(rechits_labelEE_,rechit_EE_col);
146 theEndcapGeometry = &(*theEndcapGeometry_handle);
147 theBarrelGeometry = &(*theBarrelGeometry_handle);
151 map<EcalTrigTowerDetId, float> mapTow_Et;
158 float Etsum=((*rechit_EB_col.
product())[
i].energy())*
sin(theta);
159 bool test_alreadyin=
false;
160 map<EcalTrigTowerDetId, float>::iterator ittest= mapTow_Et.find(towid1);
161 if (ittest!= mapTow_Et.end()) test_alreadyin=
true;
162 if (test_alreadyin)
continue;
165 unsigned int count=0;
166 while( j<rechit_EB_col.
product()->
size() && !loopend){
170 if( towid1==towid2 ) {
172 Etsum += (*rechit_EB_col.
product())[j].energy()*
sin(theta);
175 if (count>1800) loopend=
true;
177 mapTow_Et.insert(pair<EcalTrigTowerDetId,float>(towid1, Etsum));
185 float Etsum=(*rechit_EE_col.
product())[
i].energy()*
sin(theta);
186 bool test_alreadyin=
false;
187 map<EcalTrigTowerDetId, float>::iterator ittest= mapTow_Et.find(towid1);
188 if (ittest!= mapTow_Et.end()) test_alreadyin=
true;
189 if (test_alreadyin)
continue;
192 unsigned int count=0;
193 while( j<rechit_EE_col.
product()->
size() && !loopend){
196 if( towid1==towid2 ) {
198 Etsum += (*rechit_EE_col.
product())[j].energy()*
sin(theta);
202 if (count>500) loopend=
true;
205 mapTow_Et.insert(pair<EcalTrigTowerDetId,float>(towid1, Etsum));
214 map<EcalTrigTowerDetId, float>::iterator it= mapTow_Et.find(TPtowid);
217 iphi_ = TPtowid.
iphi() ;
218 ieta_ = TPtowid.
ieta() ;
223 if (it!= mapTow_Et.end()) {
224 hTPvsRechit_->Fill(it->second,Et);
225 hTPoverRechit_->Fill(Et/it->second);
235 for (
unsigned int i=0;
i<2;++
i) {
236 ecal_et_[
i]->Write();
237 ecal_tt_[
i]->Write();
238 ecal_fgvb_[
i]->Write();
241 hTPvsRechit_->Write();
242 hTPoverRechit_->Write();
T getParameter(std::string const &) const
void setEventSetup(const edm::EventSetup &evtSetup)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
int ieta() const
get the tower ieta
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
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
int compressedEt() const
get the encoded/compressed Et of interesting sample
int ietaAbs() const
get the absolute value of the tower ieta
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
virtual void endJob() override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
EcalTrigPrimAnalyzer(const edm::ParameterSet &)
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
T const * product() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
bool fineGrain() const
get the fine-grain bit of interesting sample
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
int ttFlag() const
get the Trigger tower Flag of interesting sample