15 #include <phparameter/PHParameters.h>
24 #include <calobase/RawTowerContainer.h>
25 #include <calobase/RawTowerGeomContainer.h>
26 #include <calobase/RawTower.h>
46 outfile =
new TFile(
"out_calib.root",
"RECREATE");
53 string detnames[] = {
"HCALIN",
"HCALOUT"};
54 for(
int seg=0; seg<2; seg++)
60 auto twr_range = towers->getTowers();
61 for (
auto twr_iter = twr_range.first; twr_iter != twr_range.second; ++twr_iter)
66 int key =
genkey(seg, etabin, phibin);
70 string hname=detnames[seg]+
"_Tower_Energy_ieta_"+
to_string(etabin)+
"_iphi_"+
to_string(phibin);
71 TH1F *
h =
new TH1F(hname.c_str(),hname.c_str(),500,0,50);
148 for (
auto cell_iter = cell_range.first; cell_iter != cell_range.second; ++cell_iter)
153 int key =
genkey(seg, etabin, phibin);
157 string hname=detnames[seg]+
"_Slat_Energy_ieta_"+
to_string(etabin)+
"_iphi_"+
to_string(phibin);
158 TH1F *
h =
new TH1F(hname.c_str(),hname.c_str(),500,0,50);
171 for (
auto cell_iter = cell_range.first; cell_iter != cell_range.second; ++cell_iter)
176 int key =
genkey(seg, etabin, phibin);
180 string hname=detnames[seg]+
"_Slat_Energy_ieta_"+
to_string(etabin)+
"_iphi_"+
to_string(phibin);
181 TH1F *
h =
new TH1F(hname.c_str(),hname.c_str(),500,0,50);
202 if(
it.second->GetEntries()>0)
208 if(
it.second->GetEntries()>0)
218 static int ncalls = 0;
220 string towernode =
"TOWER_SIM_" + det;
221 towers = findNode::getClass<RawTowerContainer>(
topNode,towernode.c_str());
223 if(ncalls<5) cerr <<
PHWHERE <<
" ERROR: Can't find " << towernode << endl;
230 slats = findNode::getClass<PHG4CellContainer>(
topNode, cellnodename);
233 if(ncalls<5) cerr <<
PHWHERE <<
" Node missing " << cellnodename << endl;
239 proto_slats = findNode::getClass<PHG4ScintillatorSlatContainer>(
topNode, cellnodename);
242 if(ncalls<5) cerr <<
PHWHERE <<
" Prototype Node missing " << cellnodename << endl;
252 return 30000*detid + 500*etabin + phibin;