20 #include <gsl/gsl_rng.h>
38 cout <<
Name() <<
" random seed: " <<
seed << endl;
54 ostringstream hname, htit;
57 ntups =
new TNtuple(
"sz",
" Shower size",
"rad:em:hi:ho:mag:bh");
58 ntupe =
new TNtuple(
"truth",
"The Absolute Truth",
"phi:theta");
59 ntup =
new TNtuple(
"de",
"Change in Angles",
"ID:dphi:dtheta:dtotal:edep");
66 float ntvars[5][2] = {0};
68 for (
int i=0;
i<5;
i++)
76 tupvars[0] = ntvars[
i][0];
77 tupvars[1] = ntvars[
i][1];
88 string nodename[2] = {
"G4HIT_CEMC",
"G4HIT_ABSORBER_CEMC"};
89 for (
int j=0;
j<2;
j++)
91 hits = findNode::getClass<PHG4HitContainer>(topNode,nodename[
j]);
100 double phi = atan2(hit_iter->second->get_avg_y(),hit_iter->second->get_avg_x());
101 double theta = atan(sqrt(hit_iter->second->get_avg_x() * hit_iter->second->get_avg_x() +
102 hit_iter->second->get_avg_y() * hit_iter->second->get_avg_y()) /
103 hit_iter->second->get_avg_z());
106 for (
int i = 0;
i<5;
i++)
108 double diffphi = phi-ntvars[
i][0];
113 else if (diffphi < - M_PI)
122 double difftheta = theta-ntvars[
i][1];
124 double deltasqrt = sqrt(diffphi*diffphi+difftheta*difftheta);
129 double edep = hit_iter->second->get_edep();
133 detid[2] = difftheta;
134 detid[3] = deltasqrt;
137 for (
int i=0;
i<10;
i++)
139 if (deltasqrt < (
i+1)*0.025)
148 nodename[0] = {
"G4HIT_HCALIN"};
149 nodename[1] = {
"G4HIT_ABSORBER_HCALIN"};
150 for (
int j=0;
j<2;
j++)
152 hits = findNode::getClass<PHG4HitContainer>(topNode,nodename[
j]);
161 double phi = atan2(hit_iter->second->get_avg_y(),hit_iter->second->get_avg_x());
162 double theta = atan(sqrt(hit_iter->second->get_avg_x() * hit_iter->second->get_avg_x() +
163 hit_iter->second->get_avg_y() * hit_iter->second->get_avg_y()) /
164 hit_iter->second->get_avg_z());
166 for (
int i=0;
i<5;
i++)
168 double diffphi = phi-ntvars[
i][0];
173 else if (diffphi < - M_PI)
182 double difftheta = theta-ntvars[
i][1];
184 double deltasqrt = sqrt(diffphi*diffphi+difftheta*difftheta);
189 double edep = hit_iter->second->get_edep();
193 detid[2] = difftheta;
194 detid[3] = deltasqrt;
197 for (
int i=0;
i<10;
i++)
199 if (deltasqrt < (
i+1)*0.025)
208 nodename[0] = {
"G4HIT_HCALOUT"};
209 nodename[1] = {
"G4HIT_ABSORBER_HCALOUT"};
210 for (
int j=0;
j<2;
j++)
212 hits = findNode::getClass<PHG4HitContainer>(topNode,nodename[
j]);
221 double phi = atan2(hit_iter->second->get_avg_y(),hit_iter->second->get_avg_x());
222 double theta = atan(sqrt(hit_iter->second->get_avg_x() * hit_iter->second->get_avg_x() +
223 hit_iter->second->get_avg_y() * hit_iter->second->get_avg_y()) /
224 hit_iter->second->get_avg_z());
226 for (
int i=0;
i<5;
i++)
228 double diffphi = phi-ntvars[
i][0];
233 else if (diffphi < - M_PI)
242 double difftheta = theta-ntvars[
i][1];
244 double deltasqrt = sqrt(diffphi*diffphi+difftheta*difftheta);
249 double edep = hit_iter->second->get_edep();
253 detid[2] = difftheta;
254 detid[3] = deltasqrt;
257 for (
int i=0;
i<10;
i++)
259 if (deltasqrt < (
i+1)*0.025)
268 hits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_MAGNET");
277 double phi = atan2(hit_iter->second->get_avg_y(),hit_iter->second->get_avg_x());
278 double theta = atan(sqrt(hit_iter->second->get_avg_x() * hit_iter->second->get_avg_x() +
279 hit_iter->second->get_avg_y() * hit_iter->second->get_avg_y()) /
280 hit_iter->second->get_avg_z());
282 for (
int i=0;
i<5;
i++)
284 double diffphi = phi-ntvars[
i][0];
289 else if (diffphi < - M_PI)
298 double difftheta = theta-ntvars[
i][1];
300 double deltasqrt = sqrt(diffphi*diffphi+difftheta*difftheta);
305 double edep = hit_iter->second->get_edep();
309 detid[2] = difftheta;
310 detid[3] = deltasqrt;
313 for (
int i=0;
i<10;
i++)
315 if (deltasqrt < (
i+1)*0.025)
323 hits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_BH_1");
332 double phi = atan2(hit_iter->second->get_avg_y(),hit_iter->second->get_avg_x());
333 double theta = atan(sqrt(hit_iter->second->get_avg_x() * hit_iter->second->get_avg_x() +
334 hit_iter->second->get_avg_y() * hit_iter->second->get_avg_y()) /
335 hit_iter->second->get_avg_z());
337 for (
int i=0;
i<5;
i++)
339 double diffphi = phi-ntvars[
i][0];
344 else if (diffphi < - M_PI)
353 double difftheta = theta-ntvars[
i][1];
355 double deltasqrt = sqrt(diffphi*diffphi+difftheta*difftheta);
360 double edep = hit_iter->second->get_edep();
364 detid[2] = difftheta;
365 detid[3] = deltasqrt;
368 for (
int i=0;
i<10;
i++)
370 if (deltasqrt < (
i+1)*0.025)
378 for (
int i=0;
i<10;
i++)