53 ecal_parts_.push_back(
"Barrel");
54 ecal_parts_.push_back(
"Endcap");
56 histfile_ =
new TFile(
"histos.root",
"RECREATE");
57 tree_ =
new TTree(
"TPGtree",
"TPGtree");
58 tree_->Branch(
"iphi", &iphi_,
"iphi/I");
59 tree_->Branch(
"ieta", &ieta_,
"ieta/I");
60 tree_->Branch(
"eRec", &eRec_,
"eRec/F");
61 tree_->Branch(
"tpgADC", &tpgADC_,
"tpgADC/I");
62 tree_->Branch(
"tpgGeV", &tpgGeV_,
"tpgGeV/F");
63 tree_->Branch(
"ttf", &ttf_,
"ttf/I");
64 tree_->Branch(
"fg", &fg_,
"fg/I");
65 for (
unsigned int i = 0;
i < 2; ++
i) {
66 ecal_et_[
i] =
new TH1I(ecal_parts_[
i].c_str(),
"Et", 255, 0, 255);
68 sprintf(
title,
"%s_ttf", ecal_parts_[
i].c_str());
69 ecal_tt_[
i] =
new TH1I(
title,
"TTF", 10, 0, 10);
70 sprintf(
title,
"%s_fgvb", ecal_parts_[
i].c_str());
71 ecal_fgvb_[
i] =
new TH1I(
title,
"FGVB", 10, 0, 10);
77 hTPvsRechit_ =
new TH2F(
"TP_vs_RecHit",
"TP vs rechit", 256, -1, 255, 255, 0, 255);
78 hTPoverRechit_ =
new TH1F(
"TP_over_RecHit",
"TP over rechit", 500, 0, 4);
104 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
106 int subdet =
d.id().subDet() - 1;
108 ecal_et_[subdet]->Fill(
d.compressedEt());
110 if (
d.id().ietaAbs() == 27 ||
d.id().ietaAbs() == 28) {
112 ecal_et_[subdet]->Fill(
d.compressedEt() * 2.);
114 ecal_et_[subdet]->Fill(
d.compressedEt());
116 ecal_tt_[subdet]->Fill(
d.ttFlag());
117 ecal_fgvb_[subdet]->Fill(
d.fineGrain());
124 iEvent.getByLabel(rechits_labelEB_, rechit_EB_col);
127 iEvent.getByLabel(rechits_labelEE_, rechit_EE_col);
141 map<EcalTrigTowerDetId, float> mapTow_Et;
143 for (
unsigned int i = 0;
i < rechit_EB_col.
product()->
size();
i++) {
148 bool test_alreadyin =
false;
149 map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
150 if (ittest != mapTow_Et.end())
151 test_alreadyin =
true;
154 unsigned int j =
i + 1;
155 bool loopend =
false;
156 unsigned int count = 0;
157 while (
j < rechit_EB_col.
product()->
size() && !loopend) {
161 if (towid1 == towid2) {
169 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
172 for (
unsigned int i = 0;
i < rechit_EE_col.
product()->
size();
i++) {
177 bool test_alreadyin =
false;
178 map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
179 if (ittest != mapTow_Et.end())
180 test_alreadyin =
true;
183 unsigned int j =
i + 1;
184 bool loopend =
false;
185 unsigned int count = 0;
186 while (
j < rechit_EE_col.
product()->
size() && !loopend) {
189 if (towid1 == towid2) {
199 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
204 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
207 map<EcalTrigTowerDetId, float>::iterator it = mapTow_Et.find(TPtowid);
208 float Et = ecalScale.
getTPGInGeV(
d.compressedEt(), TPtowid);
209 if (
d.id().ietaAbs() == 27 ||
d.id().ietaAbs() == 28)
211 iphi_ = TPtowid.
iphi();
212 ieta_ = TPtowid.
ieta();
213 tpgADC_ =
d.compressedEt();
217 if (it != mapTow_Et.end()) {
218 hTPvsRechit_->Fill(it->second, Et);
219 hTPoverRechit_->Fill(Et / it->second);
227 for (
unsigned int i = 0;
i < 2; ++
i) {
228 ecal_et_[
i]->Write();
229 ecal_tt_[
i]->Write();
230 ecal_fgvb_[
i]->Write();
233 hTPvsRechit_->Write();
234 hTPoverRechit_->Write();