15 #include <g4hough/SvtxVertexMap.h>
16 #include <g4hough/SvtxVertex.h>
17 #include <g4hough/SvtxTrackMap.h>
18 #include <g4hough/SvtxTrack.h>
26 #include <calobase/RawTowerGeomContainer.h>
27 #include <calobase/RawTowerContainer.h>
28 #include <calobase/RawTower.h>
29 #include <calobase/RawCluster.h>
30 #include <calobase/RawClusterContainer.h>
37 #include <TProfile2D.h>
48 cout <<
"SimpleTrackingAnalysis class constructor called " << endl;
70 cout <<
"SimpleTrackingAnalysis::Init called" << endl;
84 _recopt_quality =
new TH2D(
"recopt_quality",
"", 20,0.0,10.0, 100,0.0,5.0);
98 _truept_dca =
new TH2D(
"truept_dca",
"", 20,0.0,10.0, 200,-0.1,0.1);
234 _dx_vertex =
new TH1D(
"dx_vertex",
"dx_vertex", 200,-0.03,0.03);
235 _dy_vertex =
new TH1D(
"dy_vertex",
"dy_vertex", 200,-0.03,0.03);
236 _dz_vertex =
new TH1D(
"dz_vertex",
"dz_vertex", 200,-0.03,0.03);
241 hmult =
new TH1D(
"hmult",
"",5000,-0.5,4999.5);
242 hmult_vertex =
new TH1D(
"hmult_vertex",
"",5000,-0.5,4999.5);
264 cout <<
"------------------------------------------------------------------------------------" << endl;
265 cout <<
"Now processing event number " <<
nevents << endl;
278 cerr <<
PHWHERE <<
" ERROR: Can't find G4TruthInfo" << endl;
283 SvtxTrackMap* trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
286 cerr <<
PHWHERE <<
" ERROR: Can't find SvtxTrackMap" << endl;
291 SvtxVertexMap* vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
294 cerr <<
PHWHERE <<
" ERROR: Can't find SvtxVertexMap" << endl;
309 if (
verbosity > 0 ) cout <<
"Now going to loop over truth partcles..." << endl;
319 int particleID = g4particle->
get_pid();
321 if ( trutheval->
get_embed(g4particle) <= 0 && fabs(particleID) == 11 &&
verbosity > 0 )
323 cout <<
"NON EMBEDDED ELECTRON!!! WHEE!!! " << particleID <<
" " << iter->first << endl;
326 if ( trutheval->
get_embed(g4particle) <= 0 )
continue;
327 bool iselectron = fabs(particleID) == 11;
328 bool ispion = fabs(particleID) == 211;
329 if (
verbosity > 0 ) cout <<
"embedded particle ID is " << particleID <<
" ispion " << ispion <<
" iselectron " << iselectron <<
" " << iter->first << endl;
334 float truept = sqrt(pow(g4particle->
get_px(),2)+pow(g4particle->
get_py(),2));
335 float true_energy = g4particle->
get_e();
339 if (!track)
continue;
340 float recopt = track->
get_pt();
341 float recop = track->
get_p();
345 cout <<
"truept is " << truept << endl;
346 cout <<
"recopt is " << recopt << endl;
347 cout <<
"true energy is " << true_energy << endl;
357 cout <<
"emc_energy_track is " << emc_energy_track << endl;
358 cout <<
"hci_energy_track is " << hci_energy_track << endl;
359 cout <<
"hco_energy_track is " << hco_energy_track << endl;
373 float assoc_dphi = 0.1;
374 float assoc_deta = 0.1;
375 bool good_emc_assoc = fabs(emc_dphi_track) < assoc_dphi && fabs(emc_deta_track) < assoc_deta;
376 bool good_hci_assoc = fabs(hci_dphi_track) < assoc_dphi && fabs(hci_deta_track) < assoc_deta;
377 bool good_hco_assoc = fabs(hco_dphi_track) < assoc_dphi && fabs(hco_deta_track) < assoc_deta;
382 float hct_energy_track = 0;
383 if ( hci_energy_track >= 0 ) hct_energy_track += hci_energy_track;
384 if ( hco_energy_track >= 0 ) hct_energy_track += hco_energy_track;
386 float total_energy_dumb = 0;
387 if ( emc_energy_track >= 0 ) total_energy_dumb += emc_energy_track;
388 if ( hci_energy_track >= 0 ) total_energy_dumb += hci_energy_track;
389 if ( hco_energy_track >= 0 ) total_energy_dumb += hco_energy_track;
391 float total_energy_smart = 0;
392 if ( good_emc_assoc ) total_energy_smart += emc_energy_track;
393 if ( good_hci_assoc ) total_energy_smart += hci_energy_track;
394 if ( good_hco_assoc ) total_energy_smart += hco_energy_track;
411 unsigned int ndiff = abs((
int)nfromtruth-(
int)
nlayers);
416 float diff = fabs(recopt-truept)/truept;
425 double good_energy = total_energy_dumb - 3.14;
428 double eoverp = good_energy/recop;
429 double sigmapt = 0.011 + 0.0008*recopt;
455 float recopt = track->
get_pt();
456 float recop = track->
get_p();
460 float truept = sqrt(pow(g4particle->
get_px(),2)+pow(g4particle->
get_py(),2));
461 int particleID = g4particle->
get_pid();
462 if (
verbosity > 5 ) cout <<
"particle ID is " << particleID << endl;
463 bool iselectron = fabs(particleID) == 11;
464 bool ispion = fabs(particleID) == 211;
475 float total_energy = 0;
476 if ( emc_energy_track > 0 ) total_energy += emc_energy_track;
477 if ( hci_energy_track > 0 ) total_energy += hci_energy_track;
478 if ( hco_energy_track > 0 ) total_energy += hco_energy_track;
480 if (
verbosity > 2 ) cout <<
"total calo energy is " << total_energy << endl;
482 if (trutheval->
get_embed(g4particle) > 0)
488 if (
verbosity > 0 ) cout <<
"embedded particle ID is " << particleID <<
" ispion " << ispion <<
" iselectron " << iselectron << endl;
501 unsigned int ndiff = abs((
int)nfromtruth-(
int)
nlayers);
506 float diff = fabs(recopt-truept)/truept;
520 double good_energy = total_energy - 3.14;
522 double eoverp = good_energy/recop;
523 double sigmapt = 0.011 + 0.0008*recopt;
543 hmult->Fill(ntracks);
547 unsigned int maxtracks = 0;
559 cerr <<
PHWHERE <<
" ERROR: cannot get reconstructed vertex (event number " <<
nevents <<
")" << endl;
568 cerr <<
PHWHERE <<
" ERROR: cannot get truth vertex (event number " <<
nevents <<
")" << endl;
588 cout <<
"End called, " <<
nevents <<
" events processed with " <<
nerrors <<
" errors and " <<
nwarnings <<
" warnings." << endl;