4 #include "TGeomInfo.hxx"
5 #include "TPrincipal.h"
6 #include "TRealDatum.hxx"
7 #include "TShowerTruthInfo.hxx"
8 #include "TrackTruthInfo.hxx"
21 #ifdef TTRACKERECALRECONMODULE_USE_EXP
22 ClassImp(ND::TTrackerECALReconModule::TECALReconHit);
32 $Id: eventAnalysis TTrackerECALReconModule.cxx,2024/03/20:09:46:11,Alexander_J_Finch,lapw.lancs.ac.uk $"
35 std::ostream& operator<<(std::ostream& os,
const TVector3& tv3) {
36 return os <<
"[" << tv3[0] <<
", " << tv3[1] <<
", " << tv3[2] <<
"]";
38 std::ostream& operator<<(std::ostream& os,
const TLorentzVector& tlv) {
39 return os <<
"[" << tlv[0] <<
", " << tlv[1] <<
", " << tlv[2] <<
", "
43 #ifdef TTRACKERECALRECONMODULE_USE_EXP
45 const int MAXHITSTOSAVE = 1000;
48 inline std::ostream& operator<<(
49 std::ostream& os,
const ND::TTrackerECALReconModule::TECALReconHit& hit) {
50 return os <<
"{ Pos: " << hit.Position <<
", Charge: " << hit.ChargeDeposit
51 <<
", GID: " << hit.GeomId <<
", IsXYZ: " << hit.IsXYZ
52 <<
" UsedBy: " << hit.UsedByNObjs <<
" objects }";
59 namespace TTrackerECALReconModule {
75 new TClonesArray(
"ND::TTrackerECALReconModule::TECALReconObject", 200);
77 "ND::TTrackerECALReconModule::TECALReconUnmatchedObject", 200);
79 "ND::TTrackerECALReconModule::TECALReconVertexCluster", 200);
80 #ifdef TTRACKERECALRECONMODULE_USE_EXP
81 fDoSaveHitInfo =
false;
82 fUsedHits =
new TClonesArray(
"ND::TTrackerECALReconModule::TECALReconHit",
87 "ND::TTrackerECALReconModule::TECALReconVertexCandidate", 100);
89 "ND::TTrackerECALReconModule::TECALReconVertexTrack", 100);
95 #ifdef TTRACKERECALRECONMODULE_USE_EXP
96 if (option ==
"SaveHitInfo") {
97 fDoSaveHitInfo =
true;
98 ND280NamedLog(
"TTrackerECALReconModule",
"Will save hit info");
102 if (option ==
"RunVertexing") {
104 ND280NamedLog(
"TTrackerECALReconModule",
105 "Will re-run vertexing code reconstruction.");
108 if (option ==
"SaveTheHoff") {
110 ND280NamedLog(
"TTrackerECALReconModule",
111 "Will save raw Hough transform results for this run.");
114 if (option ==
"SaveVertexCandy") {
116 ND280NamedLog(
"TTrackerECALReconModule",
117 "Will save reconstructed vertex "
125 #ifdef TTRACKERECALRECONMODULE_USE_EXP
126 if (fDoSaveHitInfo) {
127 ND280NamedLog(
"TTrackerECALReconModule",
"Saving Hit Info for this run.");
131 ND280NamedLog(
"TTrackerECALReconModule",
132 "Saving reconstructed vertex "
133 "candidates for this run.");
136 ND280NamedLog(
"TTrackerECALReconModule",
137 "Saving raw Hough transform results for this run.");
140 ND280NamedLog(
"TTrackerECALReconModule",
"Running ECal-iso vertexing");
157 ->SetTitle(
" Number of TECALRecon Objects");
161 ->SetTitle(
"Number of TrackLike objects ");
165 ->SetTitle(
"Number of ShowerLike objects ");
169 ->SetTitle(
"Number of Unmatched Objects ");
173 ->SetTitle(
" The TECALRecon Objects");
177 ->SetTitle(
"The Unmatched Objects ");
186 ->SetTitle(
"The Reconstructed Vertices ");
190 #ifdef TTRACKERECALRECONMODULE_USE_EXP
208 ND::THandle<ND::TAlgorithmResult> ecalFinalResult,
209 ND::THandle<ND::TG4TrajectoryContainer> trajectories)
211 ND::THandle<ND::TReconObjectContainer> vertices_container =
212 ecalFinalResult->GetResultsContainer(
"ECalHoughResults");
213 if (!vertices_container) {
214 ND280NamedInfo(
"TTrackerECALReconModule",
"No vertex recon container.");
217 for (ND::TReconObjectContainer::iterator vertIt = vertices_container->begin();
218 vertIt != vertices_container->end(); vertIt++) {
219 ND::THandle<ND::TReconVertex> top_vertex = (*vertIt);
224 ND280NamedInfo(
"TTrackerECALReconModule",
225 "============================================");
226 ND280NamedInfo(
"TTrackerECALReconModule",
227 "======Processing Hough Vertex Cluster("
228 << top_vertex->GetUniqueID() <<
")=======");
229 ND280NamedInfo(
"TTrackerECALReconModule",
230 "============================================");
240 for (UInt_t trki = 0; trki < vd.NTracks(); ++trki) {
241 ND::THandle<ND::TReconPID> trk = vd.Tracks_at(trki);
253 "TTrackerECALReconModule",
254 "Saved track constituent of vertex candidate with ID: "
255 << trk->GetUniqueID());
260 for (std::vector<TECALReconVertex>::iterator rv_it =
261 vd.SecondaryVertices_begin();
262 rv_it != vd.SecondaryVertices_end(); ++rv_it) {
264 (*rv_it), top_vertex,
fIsMC,
267 for (UInt_t trki = 0; trki < (*rv_it).NTracks(); ++trki) {
268 ND::THandle<ND::TReconPID> trk = (*rv_it).Tracks_at(trki);
279 ND280NamedVerbose(
"TTrackerECALReconModule",
280 "Saved track constituent of secondary vertex "
281 "candidate with ID: "
282 << trk->GetUniqueID());
294 ND::THandle<ND::TReconObjectContainer> constituents =
295 top_vertex->GetConstituents();
296 double ClusterTotalCharge = 0;
297 for (ND::THitSelection::iterator hitIt = top_vertex->GetHits()->begin();
298 hitIt != top_vertex->GetHits()->end(); hitIt++) {
299 ClusterTotalCharge += (*hitIt)->GetCharge();
306 ND::THandle<ND::TReconObjectContainer> tracks(
307 new ND::TReconObjectContainer(
"vertexRecon_tracks"));
308 ND::THandle<ND::TReconObjectContainer> crossings(
309 new ND::TReconObjectContainer(
"vertexRecon_crossings"));
310 for (ND::TReconObjectContainer::iterator rocIt = constituents->begin();
311 rocIt != constituents->end(); rocIt++) {
312 ND::THandle<ND::TReconPID> track = (*rocIt);
313 ND::THandle<ND::TReconVertex> vertex = (*rocIt);
315 tracks->push_back(track);
317 crossings->push_back(vertex);
319 ND280NamedError(
"TTrackerECALReconModule",
320 "Found a VertexCluster "
321 "constituent that is not a track or vertex :(");
331 vertex_cluster->
UniqueID = top_vertex->GetUniqueID();
332 vertex_cluster->
NHits = top_vertex->GetHits()->size();
335 for (ND::THitSelection::iterator hitIt = top_vertex->GetHits()->begin();
336 hitIt != top_vertex->GetHits()->end(); hitIt++) {
337 #ifdef TTRACKERECALRECONMODULE_USE_EXP
338 SaveUsedHit(*hitIt, top_vertex->GetUniqueID());
341 vertex_cluster->
Position = top_vertex->GetPosition();
342 vertex_cluster->
Module = ND::TGeomInfo::Get()
344 .GetModule(top_vertex->GetHits()->front())
347 top_vertex->Get<ND::TIntegerDatum>(
"N2DProngsMax")->GetValue();
349 top_vertex->Get<ND::TIntegerDatum>(
"N2DProngsMin")->GetValue();
352 std::set<Int_t> layer_numbers, para_bar_numbers, perp_bar_numbers;
355 ND::TECALGeom* ecal_geom = &(ND::TGeomInfo::Get().ECAL());
356 for (ND::THitSelection::iterator hitIt = top_vertex->GetHits()->begin();
357 hitIt != top_vertex->GetHits()->end(); hitIt++) {
358 ND::THandle<ND::THit> hit = (*hitIt);
359 Int_t layer_number = ecal_geom->GetLayerNumber(hit);
360 Int_t bar_number = ecal_geom->GetBarNumber(hit);
363 layer_numbers.insert(layer_number);
366 perp_bar_numbers.insert(bar_number);
368 para_bar_numbers.insert(bar_number);
372 if (layer_numbers.size() == 0) {
376 std::set<Int_t>::iterator setIt = layer_numbers.begin();
378 setIt = layer_numbers.end();
382 if (perp_bar_numbers.size() == 0) {
386 std::set<Int_t>::iterator setIt = perp_bar_numbers.begin();
388 setIt = perp_bar_numbers.end();
392 if (para_bar_numbers.size() == 0) {
396 std::set<Int_t>::iterator setIt = para_bar_numbers.begin();
398 setIt = para_bar_numbers.end();
404 ND::TShowerTruthInfo shower_truth(top_vertex->GetHits(),
405 ND::TShowerTruthInfo::kXYZ, 1, 1, 1);
407 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
408 shower_truth.GetSingleTrajectories();
409 if (results.size() > 0) {
410 vertex_cluster->
G4IDSingle = results[0].ParticleID;
419 results = shower_truth.GetPrimaryTrajectories();
420 if (results.size() > 0) {
421 vertex_cluster->
G4IDPrimary = results[0].ParticleID;
430 results = shower_truth.GetRecursiveTrajectories();
431 if (results.size() > 0) {
448 for (ND::TReconObjectContainer::iterator crossIt = crossings->begin();
449 crossIt != crossings->end(); crossIt++) {
450 ND::THandle<ND::TReconVertex> input_crossing = (*crossIt);
455 vertex_crossing->
UniqueID = input_crossing->GetUniqueID();
456 Int_t NHits = input_crossing->GetHits()->size();
457 vertex_crossing->
NHits = NHits;
458 vertex_crossing->
HitCharges =
new Float_t[NHits];
462 vertex_crossing->
HitTimes =
new Float_t[NHits];
466 for (ND::THitSelection::iterator hitIt =
467 input_crossing->GetHits()->begin();
468 hitIt != input_crossing->GetHits()->end(); hitIt++) {
469 int index = std::distance(input_crossing->GetHits()->begin(), hitIt);
470 vertex_crossing->
HitCharges[index] = (*hitIt)->GetCharge();
471 TVector3 hit_position = (*hitIt)->GetPosition();
476 vertex_crossing->
HitTimes[index] = (*hitIt)->GetTime();
478 ecal_geom->GetLayerNumber((*hitIt));
480 ecal_geom->GetBarNumber((*hitIt));
483 vertex_crossing->
NTracks = input_crossing->GetConstituents()->size();
486 for (ND::TReconObjectContainer::iterator trackIt =
487 input_crossing->GetConstituents()->begin();
488 trackIt != input_crossing->GetConstituents()->end(); trackIt++) {
489 int index = std::distance(
490 input_crossing->GetConstituents()->begin(), trackIt);
491 vertex_crossing->
TrackIDs[index] = (*trackIt)->GetUniqueID();
494 vertex_crossing->
Position = input_crossing->GetPosition();
495 vertex_crossing->
DOCA =
496 input_crossing->Get<ND::TRealDatum>(
"distance_of_closest_approach")
503 double sumAllTracksCharge = 0;
505 for (ND::TReconObjectContainer::iterator trackIt = tracks->begin();
506 trackIt != tracks->end(); trackIt++) {
507 ND::THandle<ND::TReconPID> input_track = (*trackIt);
519 ND280NamedVerbose(
"TTrackerECALReconModule",
520 "Saved track constituent of vertex "
522 << input_track->GetUniqueID());
532 static_cast<ND::TTrackerECALReconModule::
560 #ifdef USE_FULL_VERTEX_TRACK_INFO
562 std::vector<int> tempIDs;
564 for (ND::TReconObjectContainer::iterator crossIt = crossings->begin();
565 crossIt != crossings->end(); crossIt++) {
566 ND::THandle<ND::TReconVertex> crossing = (*crossIt);
568 for (ND::TReconObjectContainer::iterator trackIt =
569 crossing->GetConstituents()->begin();
570 trackIt != crossing->GetConstituents()->end(); trackIt++) {
571 ND::THandle<ND::TReconPID> track = (*trackIt);
574 if (track->GetUniqueID() == vertex_track->
UniqueID) {
575 tempIDs.push_back(crossing->GetUniqueID());
584 vertex_track->NCrossings = tempIDs.size();
585 vertex_track->CrossingIDs =
new UInt_t[vertex_track->NCrossings];
586 for (
unsigned int i = 0; i < tempIDs.size(); i++) {
587 vertex_track->CrossingIDs[i] = tempIDs[i];
591 if (sumAllTracksCharge >= vertex_cluster->
TotalCharge) {
593 "TTrackerECALReconModule",
594 "Vertex cluster charge: " << vertex_cluster->
TotalCharge
595 <<
", is less than the sum of the "
596 "constituent track charge: "
597 << sumAllTracksCharge);
603 for (std::map<UInt_t, int>::iterator ts_it = vd.tracksStatus.begin();
604 ts_it != vd.tracksStatus.end(); ++ts_it) {
605 std::pair<UInt_t, int>
const& trkSt = (*ts_it);
609 if (trkSt.second == TECalVertexing::kReMergedTr) {
620 ND280NamedVerbose(
"TTrackerECALReconModule",
621 "Assigning saved track status: " << trkSt.second);
625 "TTrackerECALReconModule",
626 "Failed to find vertex track with ID: " << trkSt.first);
636 int const& defaultValue) {
637 if (!trb->Get<ND::TIntegerDatum>(name)) {
638 ND280NamedWarn(
"TTrackerECALReconModule",
639 "Could not retrieve TIntegerDatum: \"" << name <<
"\".");
642 return trb->Get<ND::TIntegerDatum>(name)->GetValue();
646 ND::THandle<ND::TAlgorithmResult> ecalFinalResult,
647 ND::THandle<ND::TG4TrajectoryContainer> trajectories) {
648 ND::THandle<ND::TReconObjectContainer> ECalVertices =
649 ecalFinalResult->GetResultsContainer(
"ECalVertexingResults");
651 if ((!ECalVertices) || (!ECalVertices->size())) {
655 for (
size_t vd_it = 0; vd_it < ECalVertices->size(); ++vd_it) {
656 ND::THandle<ND::TReconVertex> ECalVtx = ECalVertices->at(vd_it);
658 if (!ECalVtx->GetConstituents() || !ECalVtx->GetConstituents()->size()) {
667 for (UInt_t const_it = 0; const_it < ECalVtx->GetConstituents()->size();
669 ND::THandle<ND::TReconPID> trk = ECalVtx->GetConstituents()->at(const_it);
678 "TTrackerECALReconModule",
679 "Saved track constituent of vertex candidate with ID: "
680 << trk->GetUniqueID());
684 ND::THandle<ND::TReconVertex> vtx =
685 ECalVtx->GetConstituents()->at(const_it);
690 for (UInt_t const_it = 0; const_it < ECalVtx->GetConstituents()->size();
692 ND::THandle<ND::TReconPID> trk =
693 ECalVtx->GetConstituents()->at(const_it);
703 "TTrackerECALReconModule",
704 "Saved track constituent of vertex candidate with ID: "
705 << trk->GetUniqueID());
715 ND::THandle<ND::TAlgorithmResult> ecalFinalResult,
716 ND::THandle<ND::TG4TrajectoryContainer> trajectories) {
726 ND::THandle<ND::TReconCluster> cluster,
bool IsMC,
void* pos) {
728 ND280NamedWarn(
"TTrackerECALReconModule",
729 "Attempting to fill "
730 "TECALReconUnmatchedObject from bad TReconCluster.");
743 ND::TShowerTruthInfo showerTruth(cluster);
745 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
746 showerTruth.GetPrimaryTrajectories();
747 if (results.size()) {
751 results = showerTruth.GetRecursiveTrajectories();
752 if (results.size()) {
756 results = showerTruth.GetSingleTrajectories();
757 if (results.size()) {
758 unmatchedObject->
G4ID_Single = results[0].ParticleID;
761 return unmatchedObject;
765 ND::THandle<ND::TReconObjectContainer> other) {
767 ND280NamedWarn(
"TTrackerECALReconModule",
768 "Recieved bad \"other\" container.");
772 for (ND::TReconObjectContainer::iterator cl_it = other->begin();
773 cl_it != other->end(); ++cl_it) {
774 ND::THandle<ND::TReconCluster> clust = (*cl_it);
777 ND280NamedWarn(
"TTrackerECALReconModule",
779 "TReconCluster in the \"other\" container.");
783 if (clust->GetHits() && clust->GetHits()->size()) {
791 ND::THandle<ND::TReconPID> pid,
792 bool IsMC,
void* pos,
bool Allocate) {
793 ND280NamedInfo(
"TTrackerECALReconModule",
794 "Found " << track->GetConstituents()->size()
795 <<
" PID-track-constituent cluster constituent(s).");
809 obj->FilledAsShower =
false;
814 int NReconClusters = 0;
815 for (ND::TReconObjectContainer::iterator constit_clus_tit =
816 track->GetConstituents()->begin();
817 constit_clus_tit != track->GetConstituents()->end();
818 ++constit_clus_tit) {
819 ND::THandle<ND::TReconCluster> cluster = (*constit_clus_tit);
821 ND280NamedWarn(
"TTrackerECALReconModule",
822 "PID-track-constituent cluster constituent was bad.");
825 obj->Cluster.NDOF = cluster->GetNDOF();
826 obj->Cluster.Position = cluster->GetPosition();
827 obj->Cluster.PositionVar = cluster->GetPositionVariance();
828 obj->Cluster.EDeposit = cluster->GetEDeposit();
838 obj->UniqueID = pid->GetUniqueID();
841 TVector3 Pointing(-9999, -9999, -9999);
842 if (track->GetHits()) {
843 ND::THandle<ND::THitSelection> hitsel = track->GetHits();
848 obj->G4ID = TrackTruthInfo::GetG4TrajIDHits(*hitsel);
852 ND::TShowerTruthInfo showerTruth(pid);
854 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
855 showerTruth.GetPrimaryTrajectories();
856 if (results.size() > 0) {
857 obj->G4ID_Primary = results[0].ParticleID;
858 obj->Completeness_Primary = results[0].Completeness_NumHits;
859 obj->Cleanliness_Primary = results[0].Cleanliness_NumHits;
862 results = showerTruth.GetRecursiveTrajectories();
863 if (results.size() > 0) {
864 obj->G4ID_Recursive = results[0].ParticleID;
865 obj->Completeness_Recursive = results[0].Completeness_NumHits;
866 obj->Cleanliness_Recursive = results[0].Cleanliness_NumHits;
868 if (results.size() > 1) {
869 obj->G4ID_Recursive2 = results[1].ParticleID;
871 if (results.size() > 2) {
872 obj->G4ID_Recursive3 = results[2].ParticleID;
874 if (results.size() > 3) {
875 obj->G4ID_Recursive4 = results[3].ParticleID;
878 results = showerTruth.GetSingleTrajectories();
879 if (results.size() > 0) {
880 obj->G4ID_Single = results[0].ParticleID;
881 obj->Completeness_Single = results[0].Completeness_NumHits;
882 obj->Cleanliness_Single = results[0].Cleanliness_NumHits;
886 obj->Pointing = Pointing;
889 obj->Track.Direction = track->GetDirection();
890 obj->Track.EDeposit = track->GetEDeposit();
891 obj->Track.Position = track->GetPosition();
892 obj->Track.PositionVar = track->GetPositionVariance();
893 obj->Track.BackPosition =
895 obj->Track.Width = track->GetWidth();
903 ND280NamedInfo(
"TTrackerECALReconModule",
"Track PID had "
904 << pid->GetAlternates().size()
906 for (ND::TReconObjectContainer::const_iterator altIter =
907 pid->GetAlternates().begin();
908 altIter != pid->GetAlternates().end(); ++altIter) {
909 ND::THandle<ND::TReconPID> altPID = (*altIter);
911 ND280NamedWarn(
"TTrackerECALReconModule",
"Alternate PID is invalid.");
915 if (!altPID->GetConstituents() || !altPID->GetConstituents()->size()) {
916 ND280NamedWarn(
"TTrackerECALReconModule",
917 "Alternate Shower PID has no constituents.");
921 for (ND::TReconObjectContainer::iterator alt_constit_it =
922 altPID->GetConstituents()->begin();
923 alt_constit_it != altPID->GetConstituents()->end(); ++alt_constit_it) {
924 ND::THandle<ND::TReconShower> shower_alt = (*alt_constit_it);
925 if (!shower_alt || !shower_alt->GetEDeposit()) {
929 obj->Shower.ConeAngle = shower_alt->GetConeAngle();
930 obj->Shower.Direction = shower_alt->GetDirection();
931 obj->Shower.EDeposit = shower_alt->GetEDeposit();
932 obj->Shower.Position = shower_alt->GetPosition();
933 obj->Shower.PositionVar = shower_alt->GetPositionVariance();
934 obj->Shower.BackPosition =
942 ND::THandle<ND::TReconPID> pid,
943 bool IsMC,
void* pos,
bool Allocate) {
944 ND280NamedInfo(
"TTrackerECALReconModule",
945 "Found " << shower->GetConstituents()->size()
946 <<
" PID-shower-constituent cluster constituent(s).");
960 obj->FilledAsShower =
true;
965 int NReconClusters = 0;
966 for (ND::TReconObjectContainer::iterator constit_clus_tit =
967 shower->GetConstituents()->begin();
968 constit_clus_tit != shower->GetConstituents()->end();
969 ++constit_clus_tit) {
970 ND::THandle<ND::TReconCluster> cluster = (*constit_clus_tit);
972 ND280NamedWarn(
"TTrackerECALReconModule",
973 "PID-shower-constituent cluster constituent was bad.");
976 obj->Cluster.NDOF = cluster->GetNDOF();
977 obj->Cluster.Position = cluster->GetPosition();
978 obj->Cluster.PositionVar = cluster->GetPositionVariance();
979 obj->Cluster.EDeposit = cluster->GetEDeposit();
989 obj->UniqueID = pid->GetUniqueID();
992 TVector3 Pointing(-9999, -9999, -9999);
994 if (shower->GetHits()) {
995 ND::THandle<ND::THitSelection> hitsel = shower->GetHits();
1000 obj->G4ID = TrackTruthInfo::GetG4TrajIDHits(*hitsel);
1004 ND::TShowerTruthInfo showerTruth(pid);
1006 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
1007 showerTruth.GetPrimaryTrajectories();
1008 if (results.size() > 0) {
1009 obj->G4ID_Primary = results[0].ParticleID;
1010 obj->Completeness_Primary = results[0].Completeness_NumHits;
1011 obj->Cleanliness_Primary = results[0].Cleanliness_NumHits;
1013 results = showerTruth.GetRecursiveTrajectories();
1014 if (results.size() > 0) {
1015 obj->G4ID_Recursive = results[0].ParticleID;
1016 obj->Completeness_Recursive = results[0].Completeness_NumHits;
1017 obj->Cleanliness_Recursive = results[0].Cleanliness_NumHits;
1019 if (results.size() > 1) {
1020 obj->G4ID_Recursive2 = results[1].ParticleID;
1022 if (results.size() > 2) {
1023 obj->G4ID_Recursive3 = results[2].ParticleID;
1025 if (results.size() > 3) {
1026 obj->G4ID_Recursive4 = results[3].ParticleID;
1028 results = showerTruth.GetSingleTrajectories();
1029 if (results.size() > 0) {
1030 obj->G4ID_Single = results[0].ParticleID;
1031 obj->Completeness_Single = results[0].Completeness_NumHits;
1032 obj->Cleanliness_Single = results[0].Cleanliness_NumHits;
1037 obj->Pointing = Pointing;
1038 obj->Shower.ConeAngle = shower->GetConeAngle();
1039 obj->Shower.Direction = shower->GetDirection();
1040 obj->Shower.EDeposit = shower->GetEDeposit();
1041 obj->Shower.Position = shower->GetPosition();
1042 obj->Shower.PositionVar = shower->GetPositionVariance();
1043 obj->Shower.BackPosition =
1051 ND280NamedInfo(
"TTrackerECALReconModule",
"Shower PID had "
1052 << pid->GetAlternates().size()
1054 for (ND::TReconObjectContainer::const_iterator altIter =
1055 pid->GetAlternates().begin();
1056 altIter != pid->GetAlternates().end(); ++altIter) {
1057 ND::THandle<ND::TReconPID> altPID = (*altIter);
1059 ND280NamedWarn(
"TTrackerECALReconModule",
"Alternate PID is invalid.");
1063 if (!altPID->GetConstituents() || !altPID->GetConstituents()->size()) {
1064 ND280NamedWarn(
"TTrackerECALReconModule",
1065 "Alternate Track PID has no constituents.");
1069 for (ND::TReconObjectContainer::iterator alt_constit_it =
1070 altPID->GetConstituents()->begin();
1071 alt_constit_it != altPID->GetConstituents()->end(); ++alt_constit_it) {
1072 ND::THandle<ND::TReconTrack> track_alt = (*alt_constit_it);
1073 if (!track_alt || !track_alt->GetEDeposit()) {
1077 obj->Track.Direction = track_alt->GetDirection();
1078 obj->Track.EDeposit = track_alt->GetEDeposit();
1079 obj->Track.Position = track_alt->GetPosition();
1080 obj->Track.PositionVar = track_alt->GetPositionVariance();
1081 obj->Track.BackPosition =
1083 obj->Track.Width = track_alt->GetWidth();
1090 ND::THandle<ND::TReconObjectContainer>
final) {
1092 ND280NamedWarn(
"TTrackerECALReconModule",
1093 "Recieved bad \"final\" container.");
1098 for (ND::TReconObjectContainer::iterator pid_it = final->begin();
1099 pid_it !=
final->end(); ++pid_it) {
1100 ND::THandle<ND::TReconPID> pid = (*pid_it);
1103 ND280NamedWarn(
"TTrackerECALReconModule",
1104 "Found bad PID in the "
1105 "\"final\" container.");
1108 if (!pid->GetConstituents() || !pid->GetConstituents()->size()) {
1109 ND280NamedWarn(
"TTrackerECALReconModule",
"PID has no constituents.");
1112 ND280NamedInfo(
"TTrackerECALReconModule",
1113 "PID has " << pid->GetConstituents()->size()
1114 <<
" constituents.");
1116 for (ND::TReconObjectContainer::iterator constit_it =
1117 pid->GetConstituents()->begin();
1118 constit_it != pid->GetConstituents()->end(); ++constit_it) {
1119 ND::THandle<ND::TReconTrack> track_constit = (*constit_it);
1120 ND::THandle<ND::TReconShower> shower_constit = (*constit_it);
1124 if (track_constit) {
1125 if (!track_constit->GetEDeposit()) {
1126 ND280NamedWarn(
"TTrackerECALReconModule",
1127 "PID-constituent track deposited no energy.");
1136 ND280NamedInfo(
"TTrackerECALReconModule",
1137 "Added information about a Track PID constituent.");
1138 }
else if (shower_constit) {
1139 if (!shower_constit->GetEDeposit()) {
1140 ND280NamedWarn(
"TTrackerECALReconModule",
1141 "PID-constituent shower deposited no energy.");
1150 ND280NamedInfo(
"TTrackerECALReconModule",
1151 "Added information about a Shower PID constituent.");
1164 #ifdef TTRACKERECALRECONMODULE_USE_EXP
1166 fSavedHitMap.clear();
1177 ND280NamedInfo(
"TTrackerECALReconModule",
"===============================");
1178 ND280NamedInfo(
"TTrackerECALReconModule",
"=========Clearing Event========");
1179 ND280NamedInfo(
"TTrackerECALReconModule",
"===============================");
1183 ND280NamedInfo(
"TTrackerECALReconModule",
1184 "Processing event: " << event.GetContext().GetEvent());
1188 ND::THandle<ND::TAlgorithmResult> ecalReconResult =
event.GetFit(
"ecalRecon");
1190 if (!ecalReconResult) {
1191 ND280NamedWarn(
"TTrackerECALReconModule",
1192 "Couldn't find the ecalRecon algorithm result.");
1195 ND::THandle<ND::TReconObjectContainer> ecalFinal =
1196 ecalReconResult->GetResultsContainer(
"final");
1199 ND280NamedWarn(
"TTrackerECALReconModule",
1200 "Couldn't find a valid ecalRecon \"final\" container");
1204 ND::THandle<ND::TReconObjectContainer> ecalOther =
1205 ecalReconResult->GetResultsContainer(
"other");
1207 ND280NamedWarn(
"TTrackerECALReconModule",
1208 "Couldn't find a valid ecalRecon \"other\" container");
1213 ND::THandle<ND::TG4TrajectoryContainer> trajectories(NULL);
1216 event.Get<ND::TG4TrajectoryContainer>(
"truth/G4Trajectories");
1254 bool layer[36] = {
false};
1255 std::vector<TVector3> layerHitPos(36);
1256 std::vector<double> layerCharge(36, 0.0);
1259 std::vector<int> layerhits;
1260 layerhits.reserve(hitsel->size());
1261 double HitCharge = -1;
1264 for (ND::THitSelection::iterator hit_it = hitsel->begin();
1265 hit_it != hitsel->end(); ++hit_it) {
1266 ND::THandle<ND::TReconHit> reconHit = (*hit_it);
1269 ND280NamedWarn(
"TTrackerECALReconModule",
"TReconHit is invalid.");
1273 TVector3 HitPos = reconHit->GetContributor(0)->GetPosition();
1274 ND::TGeometryId HitGID = reconHit->GetContributor(0)->GetGeomId();
1276 Int_t layerHit = ND::TGeomInfo::Get().ECAL().GetLayerNumber(HitGID);
1277 Int_t barHit = ND::TGeomInfo::Get().ECAL().GetBarNumber(HitGID);
1279 layerhits.push_back(layerHit);
1281 if (hit_it == hitsel->begin()) {
1282 module = ND::TGeomInfo::Get().ECAL().GetModule(HitGID).GetName();
1289 TVector3 chargePos = reconHit->GetPosition() * reconHit->GetCharge();
1290 layerHitPos[layerHit] += chargePos;
1291 layerCharge[layerHit] += reconHit->GetCharge();
1294 if (!layer[layerHit]) {
1295 layer[layerHit] =
true;
1299 if (reconHit->GetContributor(0)->IsXHit()) {
1302 if (reconHit->GetContributor(0)->IsYHit()) {
1305 if (reconHit->GetContributor(0)->IsZHit()) {
1309 if (barHit < obj->MinBarHit) {
1313 (!reconHit->GetContributor(0)->IsZHit())) {
1317 reconHit->GetContributor(0)->IsZHit()) {
1321 if (layerHit < obj->MostUpStreamLayerHit) {
1330 obj->
AverageHitTime += (reconHit->GetTime() * reconHit->GetCharge());
1332 if (reconHit->GetCharge() > HitCharge) {
1333 HitCharge = reconHit->GetCharge();
1343 for (
int i = 0; i < 36; ++i) {
1344 if (layerCharge[i] != 0.0) {
1345 layerHitPos[i] *= (1 / layerCharge[i]);
1355 sort(layerhits.begin(), layerhits.end());
1362 int doublelayer = -1;
1365 int doublelayersec = -1;
1367 int layertwohits = -1;
1369 int lastlayermanyhits = -1;
1376 int NLayers2Hits = -1;
1378 int NLayers3Hits = -1;
1383 for (
unsigned int i = 0; i < layerhits.size(); i++) {
1384 int layer = layerhits.at(i);
1387 if (layer > layerA) {
1396 lastlayermanyhits = layer;
1399 if (layer > layerB) {
1402 if (doublelayersec == 0) {
1403 layertwohits = layer;
1408 if (seclayer > maxhits) {
1413 if (seclayer == 0) {
1415 }
else if (seclayer == 1) {
1431 double const& defaultValue) {
1432 if (!trb->Get<ND::TRealDatum>(name)) {
1433 ND280NamedWarn(
"TTrackerECALReconModule",
1434 "Could not retrieve TRealDatum: \"" << name <<
"\".");
1435 return defaultValue;
1437 return trb->Get<ND::TRealDatum>(name)->GetValue();
1442 ND280NamedWarn(
"TTrackerECALReconModule",
1443 "TReconBase was invalid in FillDatumInfo.");
1467 if (trb->Get<ND::TRealDatum>(
"FrontBackRatio")) {
1469 trb->Get<ND::TRealDatum>(
"FrontBackRatio")->GetValue();
1471 ND::THandle<ND::THitSelection> hits = trb->Get<ND::THitSelection>(
"hits");
1472 double FrontBackRatio = -1;
1494 ND280NamedInfo(
"TTrackerECALReconModule",
1495 "TReconBase has " << trb->GetConstituents()->size()
1496 <<
" constituents.");
1497 for (ND::TReconObjectContainer::iterator trb_it =
1498 trb->GetConstituents()->begin();
1499 trb_it != trb->GetConstituents()->end(); ++trb_it) {
1500 ND::THandle<ND::TReconCluster> cluster_constit = (*trb_it);
1501 if (!cluster_constit) {
1502 ND280NamedWarn(
"TTrackerECALReconModule",
1503 "TReconBase cluster constituent"
1512 if (cluster_constit->Get<ND::TIntegerDatum>(
"3DSeedType")) {
1514 cluster_constit->Get<ND::TIntegerDatum>(
"3DSeedType")->GetValue();
1523 if (cluster_constit->Get<ND::TRealDatum>(
"EMEnergyFitResult_Corrected")) {
1525 (*cluster_constit->Get<ND::TRealDatum>(
"EMEnergyFitResult_Corrected")
1535 ND::THandle<ND::TRealDatum> emefl =
1536 cluster_constit->Get<ND::TRealDatum>(
"EMEnergyFitLikelihood");
1537 if (emefl && (emefl->size() >= 3)) {
1548 ND::THandle<ND::TRealDatum> emefp =
1549 cluster_constit->Get<ND::TRealDatum>(
"EMEnergyFitParameters");
1550 if (emefp && (emefp->size() >= 5)) {
1566 ND::THandle<ND::TRealDatum> thrustVect =
1567 cluster_constit->Get<ND::TRealDatum>(
"Thrust");
1568 if (thrustVect && (thrustVect->size() >= 7)) {
1569 obj->
Thrust = thrustVect->at(0);
1570 obj->
ThrustOrigin.SetXYZ(thrustVect->at(1), thrustVect->at(2),
1572 obj->
ThrustAxis.SetXYZ(thrustVect->at(4), thrustVect->at(5),
1587 int MostDownStreamLayerHit) {
1589 double totalCharge(0);
1592 for (ND::THitSelection::iterator hit_it = hits->begin();
1593 hit_it != hits->end(); ++hit_it) {
1595 ND::TGeomInfo::Get().ECAL().GetLayerNumber((*hit_it)->GetGeomId());
1597 if (layer == MostDownStreamLayerHit) {
1598 totalCharge += (*hit_it)->GetCharge();
1603 for (ND::THitSelection::iterator hit_it = hits->begin();
1604 hit_it != hits->end(); ++hit_it) {
1606 ND::TGeomInfo::Get().ECAL().GetLayerNumber((*hit_it)->GetGeomId());
1608 if (layer == MostDownStreamLayerHit) {
1609 TLorentzVector temp((*hit_it)->GetPosition(), (*hit_it)->GetTime());
1610 temp *= ((*hit_it)->GetCharge() / totalCharge);
1618 TPrincipal pca(3,
"ND");
1621 for (ND::THitSelection::iterator hit_it = hits->begin();
1622 hit_it != hits->end(); ++hit_it) {
1623 double row[3] = {(*hit_it)->GetPosition().X(), (*hit_it)->GetPosition().Y(),
1624 (*hit_it)->GetPosition().Z()};
1625 for (
double q = 0; q < (*hit_it)->GetCharge(); q += 1.0) {
1631 pca.MakePrincipals();
1644 double posP[] = {0., 0., 0.};
1646 pca.P2X(posP, posX, 3);
1648 pcaCentre.SetXYZ(posX[0], posX[1], posX[2]);
1652 pcaAxis.SetXYZ((*pca.GetEigenVectors())[0][0], (*pca.GetEigenVectors())[1][0],
1653 (*pca.GetEigenVectors())[2][0]);
1656 double sumcharge = 0;
1657 double numerator = 0;
1658 for (ND::THitSelection::iterator hit = hits->begin(); hit != hits->end();
1660 sumcharge += (*hit)->GetCharge();
1662 ((*hit)->GetCharge() * pcaAxis.Dot((*hit)->GetPosition() - pcaCentre));
1666 pointing = ((numerator / sumcharge) * pcaAxis);
1678 ND::THandle<ND::THitSelection> hits) {
1687 obj->
NHits = hits->size();
1693 for (ND::THitSelection::iterator hit_it = hits->begin();
1694 hit_it != hits->end(); ++hit_it) {
1696 ND::TGeomInfo::Get().ECAL().GetLayerNumber((*hit_it)->GetGeomId());
1698 if (layer < MinLayer) {
1701 if (layer > MaxLayer) {
1706 obj->
AverageHitTime += ((*hit_it)->GetTime() * (*hit_it)->GetCharge());
1716 double MinLayerCharge(0.0);
1717 double MaxLayerCharge(0.0);
1720 for (ND::THitSelection::iterator hit_it = hits->begin();
1721 hit_it != hits->end(); ++hit_it) {
1722 TVector3 hitPos = (*hit_it)->GetPosition();
1724 ND::TGeomInfo::Get().ECAL().GetLayerNumber((*hit_it)->GetGeomId());
1726 if (layer == MinLayer) {
1728 MinLayerCharge += (*hit_it)->GetCharge();
1730 if (layer == MaxLayer) {
1731 obj->
BackPosition += (hitPos * (*hit_it)->GetCharge());
1732 MaxLayerCharge += (*hit_it)->GetCharge();
1739 if (!(MinLayer % 2)) {
1745 obj->
G4ID = TrackTruthInfo::GetG4TrajIDHits(*hits);
1750 std::vector<std::pair<TVector3, double> > positionAndCharge;
1751 double FrontBackRatio = 0;
1752 if (hits && hits->size()) {
1754 TPrincipal pca(3,
"");
1756 for (ND::THitSelection::iterator hit_it = hits->begin();
1757 hit_it != hits->end(); ++hit_it) {
1758 const TVector3& pos = (*hit_it)->GetPosition();
1759 double charge = (*hit_it)->GetCharge();
1760 int repeatEntries =
static_cast<int>(charge / 0.1);
1761 for (
int i = 0; i < repeatEntries; ++i) {
1762 double row[3] = {pos.X(), pos.Y(), pos.Z()};
1766 pca.MakePrincipals();
1769 for (ND::THitSelection::iterator hit_it = hits->begin();
1770 hit_it != hits->end(); ++hit_it) {
1771 TVector3 position = (*hit_it)->GetPosition();
1772 ND::THandle<ND::THit> h = *hit_it;
1773 double charge = h->GetCharge();
1775 double x[3] = {position.X(), position.Y(), position.Z()};
1780 position.SetZ(p[0]);
1781 position.SetY(p[1]);
1782 position.SetX(p[2]);
1784 std::pair<TVector3, double> p_c(position, charge);
1785 positionAndCharge.push_back(p_c);
1794 int size = positionAndCharge.size();
1796 double zmin = positionAndCharge.at(0).first.Z();
1797 double zmax = positionAndCharge.at(0).first.Z();
1801 for (
int i(0); i < size; i++) {
1802 if (positionAndCharge.at(i).first.Z() > zmax) {
1803 zmax = positionAndCharge.at(i).first.Z();
1805 if (positionAndCharge.at(i).first.Z() < zmin) {
1806 zmin = positionAndCharge.at(i).first.Z();
1811 double length = zmax - zmin;
1815 for (
int i = 0; i < size; i++) {
1816 if ((positionAndCharge.at(i).first.Z() - zmin) > (3 * length / 4)) {
1817 fourth += positionAndCharge.at(i).second;
1818 }
else if ((positionAndCharge.at(i).first.z() - zmin) > (length / 2)) {
1819 third += positionAndCharge.at(i).second;
1820 }
else if ((positionAndCharge.at(i).first.z() - zmin) > (length / 4)) {
1821 second += positionAndCharge.at(i).second;
1823 first += positionAndCharge.at(i).second;
1828 if (first != 0 && fourth != 0) {
1829 FrontBackRatio = fourth / first;
1832 return FrontBackRatio;
1839 Position(0, 0, 0, 0),
1850 CompletenessSingle(0),
1851 CleanlinessSingle(0),
1853 CompletenessPrimary(0),
1854 CleanlinessPrimary(0),
1856 CompletenessRecursive(0),
1857 CleanlinessRecursive(0) {
1860 Tracks =
new TClonesArray(
1861 "ND::TTrackerECALReconModule::TECALReconVertexTrack", 50);
1863 "ND::TTrackerECALReconModule::TECALReconVertexCrossing", 200);
1870 MatchingLikelihood(0),
1871 FrontPosition(0, 0, 0, 0),
1872 FrontDirection(0, 0, 0),
1873 FrontLayerNumber(0),
1874 BackPosition(0, 0, 0, 0),
1875 BackDirection(0, 0, 0),
1880 #ifdef USE_FULL_VERTEX_TRACK_INFO
1881 CompletenessSingle(0),
1882 CleanlinessSingle(0),
1883 Single_FrontPosition(0, 0, 0),
1884 Single_FrontDirection(0, 0, 0),
1885 Single_FrontG4PointDist(0),
1886 Single_BackPosition(0, 0, 0),
1887 Single_BackDirection(0, 0, 0),
1888 Single_BackG4PointDist(0),
1890 CompletenessPrimary(0),
1891 CleanlinessPrimary(0),
1893 CompletenessRecursive(0),
1894 CleanlinessRecursive(0),
1896 PID_LLR_MIP_HIP(-9999),
1897 PID_LLR_MIP_HIP_VACut(-9999) {
1898 #ifdef USE_FULL_VERTEX_TRACK_INFO
1899 SubTrack_UniqueID[0] = 0;
1900 SubTrack_UniqueID[1] = 0;
1901 SubTrack_NHits[0] = 0;
1902 SubTrack_NHits[1] = 0;
1903 SubTrack_Angle[0] = 0;
1904 SubTrack_Angle[1] = 0;
1905 SubTrack_FrontLayerNumber[0] = 0;
1906 SubTrack_FrontLayerNumber[1] = 0;
1907 SubTrack_BackLayerNumber[0] = 0;
1908 SubTrack_BackLayerNumber[1] = 0;
1909 SubTrack_DOCA[0] = 0;
1910 SubTrack_DOCA[1] = 0;
1911 SubTrack_TotalCharge[0] = 0;
1912 SubTrack_TotalCharge[1] = 0;
1913 SubTrack_G4IDSingle[0] = 0;
1914 SubTrack_G4IDSingle[1] = 0;
1915 SubTrack_CompletenessSingle[0] = 0;
1916 SubTrack_CompletenessSingle[1] = 0;
1917 SubTrack_CleanlinessSingle[0] = 0;
1918 SubTrack_CleanlinessSingle[1] = 0;
1919 SubTrack_G4IDPrimary[0] = 0;
1920 SubTrack_G4IDPrimary[1] = 0;
1921 SubTrack_CompletenessPrimary[0] = 0;
1922 SubTrack_CompletenessPrimary[1] = 0;
1923 SubTrack_CleanlinessPrimary[0] = 0;
1924 SubTrack_CleanlinessPrimary[1] = 0;
1925 SubTrack_G4IDRecursive[0] = 0;
1926 SubTrack_G4IDRecursive[1] = 0;
1927 SubTrack_CompletenessRecursive[0] = 0;
1928 SubTrack_CompletenessRecursive[1] = 0;
1929 SubTrack_CleanlinessRecursive[0] = 0;
1930 SubTrack_CleanlinessRecursive[1] = 0;
1938 Status(other.Status),
1939 UniqueID(other.UniqueID),
1941 MatchingLikelihood(other.MatchingLikelihood),
1942 FrontPosition(other.FrontPosition),
1943 FrontDirection(other.FrontDirection),
1944 FrontLayerNumber(other.FrontLayerNumber),
1945 BackPosition(other.BackPosition),
1946 BackDirection(other.BackDirection),
1947 BackLayerNumber(other.BackLayerNumber),
1948 TotalCharge(other.TotalCharge),
1949 AverageHitTime(other.AverageHitTime),
1950 G4IDSingle(other.G4IDSingle),
1951 #ifdef USE_FULL_VERTEX_TRACK_INFO
1952 CompletenessSingle(other.CompletenessSingle),
1953 CleanlinessSingle(other.CleanlinessSingle),
1954 Single_FrontPosition(other.Single_FrontPosition),
1955 Single_FrontDirection(other.Single_FrontDirection),
1956 Single_FrontG4PointDist(other.Single_FrontG4PointDist),
1957 Single_BackPosition(other.Single_BackPosition),
1958 Single_BackDirection(other.Single_BackDirection),
1959 Single_BackG4PointDist(other.Single_BackG4PointDist),
1960 G4IDPrimary(other.G4IDPrimary),
1961 CompletenessPrimary(other.CompletenessPrimary),
1962 CleanlinessPrimary(other.CleanlinessPrimary),
1963 G4IDRecursive(other.G4IDRecursive),
1964 CompletenessRecursive(other.CompletenessRecursive),
1965 CleanlinessRecursive(other.CleanlinessRecursive),
1967 PID_LLR_MIP_HIP(other.PID_LLR_MIP_HIP),
1968 PID_LLR_MIP_HIP_VACut(other.PID_LLR_MIP_HIP_VACut) {
1969 #ifdef USE_FULL_VERTEX_TRACK_INFO
1970 SubTrack_UniqueID[0] = other.SubTrack_UniqueID[0];
1971 SubTrack_UniqueID[1] = other.SubTrack_UniqueID[1];
1972 SubTrack_NHits[0] = other.SubTrack_NHits[0];
1973 SubTrack_NHits[1] = other.SubTrack_NHits[1];
1974 SubTrack_Angle[0] = other.SubTrack_Angle[0];
1975 SubTrack_Angle[1] = other.SubTrack_Angle[1];
1976 SubTrack_FrontLayerNumber[0] = other.SubTrack_FrontLayerNumber[0];
1977 SubTrack_FrontLayerNumber[1] = other.SubTrack_FrontLayerNumber[1];
1978 SubTrack_BackLayerNumber[0] = other.SubTrack_BackLayerNumber[0];
1979 SubTrack_BackLayerNumber[1] = other.SubTrack_BackLayerNumber[1];
1980 SubTrack_DOCA[0] = other.SubTrack_DOCA[0];
1981 SubTrack_DOCA[1] = other.SubTrack_DOCA[1];
1982 SubTrack_TotalCharge[0] = other.SubTrack_TotalCharge[0];
1983 SubTrack_TotalCharge[1] = other.SubTrack_TotalCharge[1];
1984 SubTrack_G4IDSingle[0] = other.SubTrack_G4IDSingle[0];
1985 SubTrack_G4IDSingle[1] = other.SubTrack_G4IDSingle[1];
1986 SubTrack_CompletenessSingle[0] = other.SubTrack_CompletenessSingle[0];
1987 SubTrack_CompletenessSingle[1] = other.SubTrack_CompletenessSingle[1];
1988 SubTrack_CleanlinessSingle[0] = other.SubTrack_CleanlinessSingle[0];
1989 SubTrack_CleanlinessSingle[1] = other.SubTrack_CleanlinessSingle[1];
1990 SubTrack_G4IDPrimary[0] = other.SubTrack_G4IDPrimary[0];
1991 SubTrack_G4IDPrimary[1] = other.SubTrack_G4IDPrimary[1];
1992 SubTrack_CompletenessPrimary[0] = other.SubTrack_CompletenessPrimary[0];
1993 SubTrack_CompletenessPrimary[1] = other.SubTrack_CompletenessPrimary[1];
1994 SubTrack_CleanlinessPrimary[0] = other.SubTrack_CleanlinessPrimary[0];
1995 SubTrack_CleanlinessPrimary[1] = other.SubTrack_CleanlinessPrimary[1];
1996 SubTrack_G4IDRecursive[0] = other.SubTrack_G4IDRecursive[0];
1997 SubTrack_G4IDRecursive[1] = other.SubTrack_G4IDRecursive[1];
1998 SubTrack_CompletenessRecursive[0] = other.SubTrack_CompletenessRecursive[0];
1999 SubTrack_CompletenessRecursive[1] = other.SubTrack_CompletenessRecursive[1];
2000 SubTrack_CleanlinessRecursive[0] = other.SubTrack_CleanlinessRecursive[0];
2001 SubTrack_CleanlinessRecursive[1] = other.SubTrack_CleanlinessRecursive[1];
2002 NCrossings = other.NCrossings;
2004 CrossingIDs =
new UInt_t[NCrossings];
2005 for (Int_t c_it = 0; c_it < NCrossings; ++c_it) {
2006 CrossingIDs[c_it] = other.CrossingIDs[c_it];
2015 ND::THandle<ND::TReconPID> trk,
bool IsMC,
void* pos,
2016 ND::THandle<ND::TG4TrajectoryContainer> trajectories,
bool Allocate) {
2028 obj->
UniqueID = trk->GetUniqueID();
2029 obj->
NHits = trk->GetHits()->size();
2035 ND::THandle<ND::TPIDState> front_state = trk->GetNodes().front()->GetState();
2039 trk->GetNodes().front()->GetObject()->GetHits()->front());
2042 ND::THandle<ND::TPIDState> back_state = trk->GetNodes().back()->GetState();
2046 trk->GetNodes().back()->GetObject()->GetHits()->front());
2051 for (ND::THitSelection::iterator hitIt = trk->GetHits()->begin();
2052 hitIt != trk->GetHits()->end(); hitIt++) {
2054 obj->
AverageHitTime += ((*hitIt)->GetTime() * (*hitIt)->GetCharge());
2062 TLorentzVector LastPos;
2063 for (ND::TReconNodeContainer::iterator n_it = trk->GetNodes().begin();
2064 n_it != trk->GetNodes().end(); ++n_it) {
2065 if (n_it != trk->GetNodes().begin()) {
2068 ND::THandle<ND::TPIDState>((*n_it)->GetState())->GetPosition())
2072 LastPos = ND::THandle<ND::TPIDState>((*n_it)->GetState())->GetPosition();
2083 #ifdef USE_FULL_VERTEX_TRACK_INFO
2084 for (ND::TReconObjectContainer::iterator rocIt =
2085 trk->GetConstituents()->begin();
2086 rocIt != trk->GetConstituents()->end(); rocIt++) {
2088 int index = std::distance(trk->GetConstituents()->begin(), rocIt);
2096 ND::THandle<ND::TReconCluster> input_constituent = (*rocIt);
2100 if (!input_constituent) {
2104 obj->SubTrack_UniqueID[index] = input_constituent->GetUniqueID();
2105 obj->SubTrack_NHits[index] = input_constituent->GetHits()->size();
2106 obj->SubTrack_Angle[index] =
2107 input_constituent->Get<ND::TIntegerDatum>(
"hough_angle")->GetValue();
2108 obj->SubTrack_DOCA[index] =
2109 input_constituent->Get<ND::TIntegerDatum>(
"hough_distance")->GetValue();
2110 obj->SubTrack_TotalCharge[index] = 0;
2111 obj->SubTrack_FrontLayerNumber[index] = 9999;
2112 obj->SubTrack_BackLayerNumber[index] = -9999;
2113 for (ND::THitSelection::iterator hitIt =
2114 input_constituent->GetHits()->begin();
2115 hitIt != input_constituent->GetHits()->end(); hitIt++) {
2117 obj->SubTrack_TotalCharge[index] += (*hitIt)->GetCharge();
2119 int Hit_LayerNumber = ND::TGeomInfo::Get().ECAL().GetLayerNumber(*hitIt);
2120 if (Hit_LayerNumber < obj->SubTrack_FrontLayerNumber[index]) {
2121 obj->SubTrack_FrontLayerNumber[index] = Hit_LayerNumber;
2123 if (Hit_LayerNumber > obj->SubTrack_BackLayerNumber[index]) {
2124 obj->SubTrack_BackLayerNumber[index] = Hit_LayerNumber;
2132 ND::TShowerTruthInfo showerTruth(input_constituent);
2134 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
2135 showerTruth.GetSingleTrajectories();
2136 if (results.size() > 0) {
2137 obj->SubTrack_G4IDSingle[index] = results[0].ParticleID;
2138 obj->SubTrack_CompletenessSingle[index] = results[0].Completeness_NumHits;
2139 obj->SubTrack_CleanlinessSingle[index] = results[0].Cleanliness_NumHits;
2142 obj->SubTrack_G4IDSingle[index] = -1;
2143 obj->SubTrack_CompletenessSingle[index] = -1.;
2144 obj->SubTrack_CleanlinessSingle[index] = -1.;
2147 results = showerTruth.GetPrimaryTrajectories();
2148 if (results.size() > 0) {
2149 obj->SubTrack_G4IDPrimary[index] = results[0].ParticleID;
2150 obj->SubTrack_CompletenessPrimary[index] =
2151 results[0].Completeness_NumHits;
2152 obj->SubTrack_CleanlinessPrimary[index] = results[0].Cleanliness_NumHits;
2154 obj->SubTrack_G4IDPrimary[index] = -1;
2155 obj->SubTrack_CompletenessPrimary[index] = -1.;
2156 obj->SubTrack_CleanlinessPrimary[index] = -1.;
2159 results = showerTruth.GetRecursiveTrajectories();
2160 if (results.size() > 0) {
2161 obj->SubTrack_G4IDRecursive[index] = results[0].ParticleID;
2162 obj->SubTrack_CompletenessRecursive[index] =
2163 results[0].Completeness_NumHits;
2164 obj->SubTrack_CleanlinessRecursive[index] =
2165 results[0].Cleanliness_NumHits;
2167 obj->SubTrack_G4IDRecursive[index] = -1;
2168 obj->SubTrack_CompletenessRecursive[index] = -1.;
2169 obj->SubTrack_CleanlinessRecursive[index] = -1.;
2174 obj->NCrossings = 0;
2175 obj->CrossingIDs = 0;
2194 ND::TShowerTruthInfo showerTruth(trk);
2196 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
2197 showerTruth.GetSingleTrajectories();
2198 if (results.size() > 0) {
2201 #ifdef USE_FULL_VERTEX_TRACK_INFO
2202 obj->CompletenessSingle = results[0].Completeness_NumHits;
2203 obj->CleanlinessSingle = results[0].Cleanliness_NumHits;
2206 ND::THandle<ND::TG4Trajectory> traj =
2207 trajectories->GetTrajectory(results[0].ParticleID);
2210 ND::TG4TrajectoryPoint
const& g4pointF =
2211 TrackTruthInfo::GetCloserG4Point(traj, &Scratch,
2212 obj->Single_FrontG4PointDist);
2213 obj->Single_FrontPosition = g4pointF.GetPosition().Vect();
2214 obj->Single_FrontDirection = g4pointF.GetMomentum().Unit();
2217 ND::TG4TrajectoryPoint
const& g4pointB =
2218 TrackTruthInfo::GetCloserG4Point(traj, &Scratch,
2219 obj->Single_BackG4PointDist);
2220 obj->Single_BackPosition = g4pointB.GetPosition().Vect();
2221 obj->Single_BackDirection = g4pointB.GetMomentum().Unit();
2227 #ifdef USE_FULL_VERTEX_TRACK_INFO
2228 obj->CompletenessSingle = -1.;
2229 obj->CleanlinessSingle = -1.;
2232 #ifdef USE_FULL_VERTEX_TRACK_INFO
2234 results = showerTruth.GetPrimaryTrajectories();
2235 if (results.size() > 0) {
2236 obj->G4IDPrimary = results[0].ParticleID;
2237 obj->CompletenessPrimary = results[0].Completeness_NumHits;
2238 obj->CleanlinessPrimary = results[0].Cleanliness_NumHits;
2240 obj->G4IDPrimary = -1;
2241 obj->CompletenessPrimary = -1.;
2242 obj->CleanlinessPrimary = -1.;
2245 results = showerTruth.GetRecursiveTrajectories();
2246 if (results.size() > 0) {
2247 obj->G4IDRecursive = results[0].ParticleID;
2248 obj->CompletenessRecursive = results[0].Completeness_NumHits;
2249 obj->CleanlinessRecursive = results[0].Cleanliness_NumHits;
2251 obj->G4IDRecursive = -1;
2252 obj->CompletenessRecursive = -1.;
2253 obj->CleanlinessRecursive = -1.;
2263 HitPositionsX(NULL),
2264 HitPositionsY(NULL),
2265 HitPositionsZ(NULL),
2267 HitLayerNumbers(NULL),
2268 HitBarNumbers(NULL),
2269 Position(0, 0, 0, 0),
2274 #ifdef TTRACKERECALRECONMODULE_USE_EXP
2276 void OutputManager::SaveUsedHit(ND::THandle<ND::THit> hit,
unsigned int UID,
2277 bool overwritePrevious) {
2278 if (!fDoSaveHitInfo) {
2281 if (fNUsedHits == MAXHITSTOSAVE) {
2282 ND280NamedWarn(
"TTrackerECALReconModule",
"Recieved too many ecalHits...");
2285 unsigned long hitHash = TECALHitHasher(hit);
2286 ND280NamedInfo(
"TTrackerECALReconModule",
"HH: " << hitHash);
2288 TECALReconHit* trHit = 0;
2289 if (fSavedHitMap.count(hitHash)) {
2290 trHit =
static_cast<TECALReconHit*
>(fUsedHits->At(fSavedHitMap[hitHash]));
2295 if (trHit && (!overwritePrevious)) {
2296 ND280NamedDebug(
"TTrackerECALReconModule",
2297 "Already have Hit info (Hash:"
2298 << hitHash <<
" ), Adding this association: " << UID);
2299 trHit->AddAssocUID(UID);
2300 ND280NamedInfo(
"TTrackerECALReconModule",
"\t" << trHit->Position <<
", "
2301 << trHit->ChargeDeposit);
2306 trHit =
new ((*fUsedHits)[fNUsedHits++]) TECALReconHit();
2307 fSavedHitMap.insert(std::make_pair(hitHash, fNUsedHits - 1));
2308 trHit->GeomId = hit->GetGeomId().AsInt();
2310 ((hit->IsXHit()) | (hit->IsYHit() << 1) | (hit->IsZHit() << 2));
2312 ND280NamedInfo(
"TTrackerECALReconModule",
"overwriting hit: " << (*trHit));
2316 trHit->AddAssocUID(UID);
2317 trHit->Position = TLorentzVector(hit->GetPosition(), hit->GetTime());
2318 trHit->PosUncertainty = hit->GetUncertainty();
2319 trHit->ChargeDeposit = hit->GetCharge();
2321 ((hit->IsXHit()) | (hit->IsYHit() << 1) | (hit->IsZHit() << 2));
2323 ND280NamedInfo(
"TTrackerECALReconModule",
2324 "Adding hit info Hit(#" << (fNUsedHits - 1) <<
"), "
2325 << (*trHit) <<
" to UID: " << UID);
2326 ND280NamedDebug(
"TTrackerECALReconModule",
"\tHitHash (" << hitHash <<
")");
2329 TECALReconHit::TECALReconHit()
2333 Position(0, 0, 0, 0),
2334 PosUncertainty(0, 0, 0),
2337 ObjUIDs =
new UInt_t[TECALReconHit::MaxAssocs];
2340 TECALReconHit::~TECALReconHit() {
2346 void TECALReconHit::AddAssocUID(
unsigned int tuid) {
2347 if (UsedByNObjs == MaxAssocs) {
2348 ND280NamedWarn(
"TTrackerECALReconModule",
2349 "Attempting to add more object"
2350 " associations than we have space for: "
2351 << MaxAssocs <<
".");
2354 if (UsedByNObjs == 2) {
2356 "TTrackerECALReconModule",
2357 "This hit is already in use"
2358 " by two objects, likely one VertexCluster and one VertexTrack.");
2359 ND280NamedWarn(
"TTrackerECALReconModule",
2360 "+Attempting to add associat"
2363 for (
int it = 0; it < UsedByNObjs; ++it) {
2364 ND280NamedWarn(
"TTrackerECALReconModule",
"Used By: " << ObjUIDs[it]);
2367 ObjUIDs[UsedByNObjs++] = tuid;
2374 Position = TLorentzVector(0, 0, 0, 0);
2390 const TECALReconVertex& rv, ND::THandle<ND::TReconVertex> top_vertex,
2391 bool IsMC,
void* pos) {
2392 UInt_t VCUID = top_vertex->GetUniqueID();
2393 ND280NamedInfo(
"TTrackerECALReconModule",
2394 "Adding vertex candidate info:"
2396 << VCUID <<
", Pos: " << rv.GetPosition() <<
", uses "
2397 << rv.NTracks() <<
" tracks.");
2403 ND280NamedWarn(
"TTrackerECALReconModule",
2404 "TECALVertexCandidateFactory making new "
2405 "TECALReconVertexCandidate instance with non-positional new "
2410 obj->
NHits = rv.VertCandyHits->size();
2411 obj->ECalModule = ND::TGeomInfo::Get()
2413 .GetModule(rv.VertCandyHits->front())
2416 obj->NTracks = rv.NTracks();
2417 obj->TrackUIDs =
new UInt_t[obj->NTracks];
2420 for (std::vector<ND::THandle<ND::TReconPID> >::const_iterator
2421 trk_it = rv.Tracks_cbegin();
2422 trk_it != rv.Tracks_cend(); ++trk_it, ++tctr) {
2423 obj->TrackUIDs[tctr] = (*trk_it)->GetUniqueID();
2426 obj->Position = rv.GetPosition();
2427 obj->VertexClusterUID = VCUID;
2436 ND::TShowerTruthInfo shower_truth(rv.VertCandyHits,
2437 ND::TShowerTruthInfo::kXYZ, 1, 1, 1);
2439 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
2440 shower_truth.GetSingleTrajectories();
2441 if (results.size()) {
2442 obj->G4IDSingle = results[0].ParticleID;
2443 obj->CompletenessSingle = results[0].Completeness_NumHits;
2444 obj->CleanlinessSingle = results[0].Cleanliness_NumHits;
2446 obj->G4IDSingle = -1;
2447 obj->CompletenessSingle = -1;
2448 obj->CleanlinessSingle = -1;
2451 results = shower_truth.GetPrimaryTrajectories();
2452 if (results.size()) {
2453 obj->G4IDPrimary = results[0].ParticleID;
2454 obj->CompletenessPrimary = results[0].Completeness_NumHits;
2455 obj->CleanlinessPrimary = results[0].Cleanliness_NumHits;
2457 obj->G4IDPrimary = -1;
2458 obj->CompletenessPrimary = -1;
2459 obj->CleanlinessPrimary = -1;
2462 results = shower_truth.GetRecursiveTrajectories();
2463 if (results.size()) {
2464 obj->G4IDRecursive = results[0].ParticleID;
2465 obj->CompletenessRecursive = results[0].Completeness_NumHits;
2466 obj->CleanlinessRecursive = results[0].Cleanliness_NumHits;
2468 obj->G4IDRecursive = -1;
2469 obj->CompletenessRecursive = -1;
2470 obj->CleanlinessRecursive = -1;
2476 ND::THandle<ND::TReconVertex> ECalVtx, UInt_t VCUID,
bool IsMC,
void* pos) {
2477 ND280NamedInfo(
"TTrackerECALReconModule",
2478 "Adding vertex candidate info:"
2480 << VCUID <<
", Pos: " << ECalVtx->GetPosition());
2486 ND280NamedWarn(
"TTrackerECALReconModule",
2487 "TECALVertexCandidateFactory making new "
2488 "TECALReconVertexCandidate instance with non-positional new "
2493 obj->
NHits = ECalVtx->GetHits()->size();
2494 obj->ECalModule = ND::TGeomInfo::Get()
2496 .GetModule(ECalVtx->GetHits()->front())
2500 for (UInt_t const_it = 0; const_it < ECalVtx->GetConstituents()->size();
2502 ND::THandle<ND::TReconPID> trk = ECalVtx->GetConstituents()->at(const_it);
2507 obj->TrackUIDs =
new UInt_t[obj->NTracks];
2509 for (UInt_t const_it = 0; const_it < ECalVtx->GetConstituents()->size();
2511 ND::THandle<ND::TReconPID> trk = ECalVtx->GetConstituents()->at(const_it);
2513 obj->TrackUIDs[tit++] = trk->GetUniqueID();
2517 obj->Position = ECalVtx->GetPosition();
2518 obj->VertexClusterUID = VCUID;
2526 ND::TShowerTruthInfo shower_truth(ECalVtx->GetHits(),
2527 ND::TShowerTruthInfo::kXYZ, 1, 1, 1);
2529 std::vector<ND::TShowerTruthInfo::TruthInfo> results =
2530 shower_truth.GetSingleTrajectories();
2531 if (results.size()) {
2532 obj->G4IDSingle = results[0].ParticleID;
2533 obj->CompletenessSingle = results[0].Completeness_NumHits;
2534 obj->CleanlinessSingle = results[0].Cleanliness_NumHits;
2536 obj->G4IDSingle = -1;
2537 obj->CompletenessSingle = -1;
2538 obj->CleanlinessSingle = -1;
2541 results = shower_truth.GetPrimaryTrajectories();
2542 if (results.size()) {
2543 obj->G4IDPrimary = results[0].ParticleID;
2544 obj->CompletenessPrimary = results[0].Completeness_NumHits;
2545 obj->CleanlinessPrimary = results[0].Cleanliness_NumHits;
2547 obj->G4IDPrimary = -1;
2548 obj->CompletenessPrimary = -1;
2549 obj->CleanlinessPrimary = -1;
2552 results = shower_truth.GetRecursiveTrajectories();
2553 if (results.size()) {
2554 obj->G4IDRecursive = results[0].ParticleID;
2555 obj->CompletenessRecursive = results[0].Completeness_NumHits;
2556 obj->CleanlinessRecursive = results[0].Cleanliness_NumHits;
2558 obj->G4IDRecursive = -1;
2559 obj->CompletenessRecursive = -1;
2560 obj->CleanlinessRecursive = -1;
double PID_FrontBackRatio
The ratio of the charge in equal length blocks at each end of the track.
Int_t NCrossings
Number of track crossings.
Int_t MinPerpBarHit
The minimum bar number hit perpendicular to the beam axis.
void FillHitInfo(TECALReconObject *obj, ND::THandle< ND::THitSelection > hitsel)
Method to fill hit info is seperate to help keep things tidy.
double EMEnergyFit_Likelihood_energyGrad
Energy fit experts please fill this in.
double EMEnergyFit_Para_QSum
The summed charge present in the cluster in units of MIPs.
Int_t G4IDPrimary
The G4ID of the primary contributor to the cluster.
double EMEnergyFit_Likelihood_qsum_like
Energy fit experts please fill this in.
void FillHoughTransformInformation(ND::THandle< ND::TAlgorithmResult > ecalFinalResult, ND::THandle< ND::TG4TrajectoryContainer > trajectories)
Handles saving of the results of the ecalRecon Hough transform.
Float_t CleanlinessRecursive
The cleanliness (hit purity) of the recursive contributor to the cluster.
double PID_Circularity
Pid Variables, For more info on the Pid variable see the documentation in ecalRecon or the technical ...
Int_t G4ID_Single
The single true particle that contributed most hits to this object. Should be the same as G4ID in mos...
void FillVertexingInformation(ND::THandle< ND::TAlgorithmResult > ecalFinalResult, ND::THandle< ND::TG4TrajectoryContainer > trajectories)
TClonesArray * fUnmatchedObjects
The Unmatched Objects.
int NLayersTwoHits
The number of layers which have at least 2 hits.
Int_t G4IDRecursive
The G4ID of the recursive contributor to the cluster.
virtual ~TECALReconTrack()
Double_t Completeness_Primary
Truth-matching completeness for G4ID_Primary.
The main object that contains ECAL shower information.
double PID_ShowerAngle
The angle from the start of an object to its width at its charge centre.
Int_t NTracks
The number of tracks that contributed to the fitted position.
int FirstLayerManyHits
The number of the first layer in which there are at least 2 hits.
double EMEnergyFit_Uncertainty
The uncertainty of the EM energy fit to the cluster.
Int_t MinLayerHit
The minimum layer number hit.
virtual ~TECALReconUnmatchedObject()
TECalVertexing * fVertexRecon
Helper object which performs vertex candidate reconstruction.
double PID_LLR_MIP_EM_LowMomentum
A combined discriminator for separating MIPs from EM showers. This is similar to LLR_MIP_EM but train...
UInt_t VertexClusterUID
The UID of the associated TECALReconVertexCluster.
TVector3 FrontPosition
Position of the end of the cluster closest to the tracker.
virtual Bool_t ProcessFirstEvent(ND::TND280Event &event)
Is called after the first event is loaded in.
Double_t Completeness_Recursive
Truth-matching completeness for G4ID_Recursive.
Double_t Cleanliness_Single
Truth-matching cleanliness for G4ID_Single.
double MatchingLikelihood
The matching likelihood.
virtual void InitializeBranches()
Initialize Branches. Don't do anything else in this function.
Int_t G4ID_Primary
G4ID of the primary particle associated with this object. See TShowerTruthInfo in oaUtility for detai...
Double_t TotalHitCharge
Sum of charges of the consitituent hits in reconstructed object.
void ProcessOtherContainer(ND::THandle< ND::TReconObjectContainer > other)
Processes any results in the ecalRecon other container.
TVector3 CalculatePointing(ND::THandle< ND::THitSelection > hits)
Calculates the pointing vector.
Int_t G4ID
Truth-matched particle ID.
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
Int_t NHits
Number of hits directly associated with the crossing.
bool fDoSaveVertexCandidates
Whether to calcluate and save the reconstructed vertx candidaties. [false].
Double_t ObjectLength
Recon object length in mm.
double EMEnergyFit_Result
The result from the EM energy fit to the cluster.
Float_t CleanlinessPrimary
The cleanliness (hit purity) of the primary contributor to the cluster.
std::string fDescription
A longish descrition of the analysis.
void ProcessFinalContainer(ND::THandle< ND::TReconObjectContainer > final)
Processes any results in the ecalRecon final container.
double TotalHitCharge
Summed hit charge in the cluster in units of MIPs.
std::string Module
Name of ECal module the cluster is reconstructed in.
Float_t CompletenessRecursive
The Completeness of the Recursive contributor to the cluster.
Int_t Clustering_3DSeedType
The 3D seed type from the 3D clustering algorithm (-1 means was not created by 3D clustering...
double PID_TruncatedMaxRatio
A truncated Max Ratio. See ecalRecon docs for the full definition.
TClonesArray * fReconObjects
The TECALRecon Objects.
OutputManager(const char *name="TrackerECal", const char *title="Tracker ECal Recon Module")
Int_t MaxLayerHit
The maximum layer number hit.
The main object that contains ECAL recon information.
Int_t MostDownStreamLayerHit
The layer furthest from the tracker that was hit by the object. This is layer number 30 (the 31st lay...
Int_t G4ID_Single
The single true particle that contributed most hits to this object. Should be the same as G4ID in mos...
Int_t fNReconObjects
Tree Entries.
Int_t N2DTracksMin
The minimum number of 2D tracks found in a view.
double EMEnergyFit_Likelihood_energy_qsumGrad
Energy fit experts please fill this in.
Double_t AverageHitTime
Average time of hits in reconstructed object.
Int_t NTracks
Number of reconstructed tracks.
int MaxHitChargeLayer
The layer which received the highest hit charge.
Int_t NHits
The number of hits that were included in fitted tracks or were closer to this vertex candidate than a...
TLorentzVector Position
The reconstruction position of the crossing.
Object containing information about 2D unmatched clusters from the ECALs.
double AverageHitTime
Average time of the cluster in ns.
Int_t G4IDSingle
The G4ID of the single biggest contributor to the cluster.
bool fDoVertexing
Whether to re-run the vertexing (N.B.
void FillDatumInfo(TECALReconObject *obj, ND::THandle< ND::TReconBase > trb)
Method to add information in RealDatums stored in the tracks or showers.
Int_t G4ID_Recursive
G4ID of the highest-level parent particle that enters the ECal module, and which had a daughter that ...
TClonesArray * Tracks
The constituent tracks TClonesArray.
double AverageZPosition
Unweighted average Z position of object-constituent hits.
double PID_LLR_Quality
A quality flag for the likelihood PID variables. Good quality = 0, Bad quality != 0...
int MostDownStreamLayerHit
The layer furthest from the tracker that was hit by the cluster.
UInt_t UniqueID
Unique ID of the crossing.
UInt_t UniqueID
UniqueID of the cluster.
TLorentzVector Position
The fitted position of the vertex candidate.
virtual ~TECALReconCluster()
Double_t Cleanliness_Recursive
Truth-matching cleanliness for G4ID_Recursive.
virtual ~TECALReconShower()
Int_t G4IDRecursive
The G4ID of the Recursive contributor to the cluster.
Int_t MinBarHit
The minimum bar number hit in a cluster The minimum value of this is 0 for all ECals.
Int_t fBufferSize
Buffer Size for TBranch.
double PID_LLR_EM_HIP
A combined discriminator for separating protons from electrons.
double EMEnergyFit_Para_QRMS
The RMS of the hit charges for the cluster in units of MIPs.
Int_t NLayersHit
Number of layers hit by this object.
TECALReconUnmatchedObject * TECALReconUnmatchedObjectFactory(ND::THandle< ND::TReconCluster > cluster, bool IsMC, void *pos)
Method that fills the data members from the unmatched cluster hits.
double PID_Angle
The zenith angle with respect to each detector.
Float_t CleanlinessSingle
The cleanliness (hit purity) of the single biggest contributor to the cluster.
Float_t TotalCharge
The total charge of the cluster.
TECALReconUnmatchedObject()
Float_t DOCA
The distance of closest approach of the two lines.
Float_t CleanlinessPrimary
The cleanliness (hit purity) of the primary contributor to the cluster.
std::string fCVSID
Defined if an official tagged version.
double EMEnergyFit_Para_QSkew
The skew of hit charges for the cluster in units of MIPs.
Bool_t Configure(std::string &option)
Provides CLI for enabling fDoSaveHitInfo and fDoSaveVertexCandidates.
Int_t NHits
Number of hits in this object.
Int_t N2DTracksMax
The maximum number of 2D tracks found in a view.
virtual void InitializeModule()
Initialize Module, override if necessary.
The main object that contains ECAL cluster information.
double GetTRealDatumValue(ND::THandle< ND::TReconBase > trb, char const *name, double const &defaultValue)
double PID_LLR_MIP_Pion
Discriminator for tagging showering pions in a sample of MIP-like tracks.
double PID_TransverseChargeRatio
A variable sensitive to the charge distribution in the plane transverse to a shower/track direction...
virtual bool IsFullEventWorthSaving(ND::TND280Event &event)
Returns true if there is at least one Recon object in the Tracker ECals.
bool FilledAsTrack
Was filled by a Track-like TReconPID.
void SetNameTitle(char const *name, char const *title)
TECALReconObject * TECALReconObjectFactory(ND::THandle< ND::TReconTrack > track, ND::THandle< ND::TReconPID > pid, bool IsMC, void *pos, bool Allocate)
Handles Filling from a PID's track hypothesis constituent.
Int_t NIsZHits
Number of hits with precise Z information in the object.
int NHits
Number of hits in the cluster.
TECALReconVertexCandidate()
double PID_LLR_MIP_EM
A combined discriminator for separating MIPs from EM showers.
virtual ~TECALReconObject()
void FillECalIsoVertexingInformation(ND::THandle< ND::TAlgorithmResult > ecalFinalResult, ND::THandle< ND::TG4TrajectoryContainer > trajectories)
Just saves the final ECal-iso vertexing results.
Float_t CompletenessPrimary
The Completeness of the primary contributor to the cluster.
Float_t CompletenessRecursive
The Completeness of the recursive contributor to the cluster.
TClonesArray * fReconVertexClusters
The Reconstructed Vertices.
TVector3 BackPosition
Position in end of the cluster furthest from the tracker.
Reconstructed ECal vertex candidate, contains fitted position and associated track UIDs...
Int_t fNReconVertexClusters
TClonesArray * Crossings
The constituent crossings TClonesArray.
Int_t G4ID_Primary
G4ID of the primary particle associated with this object.
The main object that contains ECAL track information.
Int_t fNVertexCandidateTracks
int MostUpStreamLayerHit
The layer closest to the tracker that was hit by the cluster.
TClonesArray * fVertexCandidates
The reconstructed vertex candidates.
std::string ECalModule
The ECalModule that this vertex was reconstructed in.
Float_t CompletenessSingle
The Completeness of the single biggest contributor to the cluster.
TClonesArray * fVertexCandidateTracks
The tracks associated with the reconstructed vertex candidates.
TLorentzVector Position
Position of cluster.
Int_t NHits
Number of hits in cluster.
Int_t fSplitLevel
Split Level for TBranch.
Int_t G4ID_Recursive
G4ID of the highest-level parent particle that enters the ECal module, and which had a daughter that ...
double Containment
Containment: contained = 1.0, not-contained = 0.0, default = -1.0. An object is classed as contained ...
Int_t MaxParaBarHit
The maximum bar number hit in a cluster, for layers parallel to the beam axis.
Float_t CompletenessSingle
The Completeness of the single biggest contributor to the cluster.
TECALReconVertexCrossing()
TECALReconVertexCandidate * TECALVertexCandidateFactory(const TECALReconVertex &rv, ND::THandle< ND::TReconVertex > top_vertex, bool IsMC, void *pos)
Int_t MaxParaBarHit
The maximum bar number hit parallel to the beam axis.
Int_t MaxPerpBarHit
\ The maximum bar number hit in a cluster, for layers perpendicular to the beam axis ...
std::string fCVSTagName
Defined if an official tagged version.
Int_t G4IDPrimary
The G4ID of the primary contributor to the cluster.
Int_t MinParaBarHit
The minimum bar number hit parallel to the beam axis.
TECALReconVertexCluster()
double EMEnergyFit_Para_QMax
The maximum hit charge in units of MIPs.
Double_t Cleanliness_Primary
Truth-matching cleanliness for G4ID_Primary.
void PerEvReset()
Handles clearing and resetting of event level variables/arrays.
Int_t G4IDSingle
The G4ID of the single biggest contributor to the cluster.
virtual bool FillTree(ND::TND280Event &)
Fill all the stuff that goes in the output tree.
bool fDoSaveHoughResults
Whether to output the bare Hough transform results.
Float_t CleanlinessSingle
The cleanliness (hit purity) of the single biggest contributor to the cluster.
Float_t CleanlinessRecursive
The cleanliness (hit purity) of the Recursive contributor to the cluster.
std::string Module
Name of ECAL module in which object was reconstructed.
int View
View of the cluster. View 0 - Y measuring (odd) Layers and View 1 - X measuring (even) layers...
Int_t NTracks
The number of tracks which created this crossing.
int NLayersThreeHits
The number of layers which have at least 3 hits.
int NHitsAtLayersWithManyHits
The number of hits in a layer when there are at least 2 hits.
int MaxHitsInALayer
The layer which received the maximum number of hits.
int GetTIntegerDatumValue(ND::THandle< ND::TReconBase > trb, char const *name, int const &defaultValue)
Int_t MostUpStreamLayerHit
The layer closest to the tracker that was hit by the object. 0 indexed.
Int_t NIsXHits
Number of hits with precise X information in the object.
std::map< UInt_t, Int_t > fSavedVertexTrackIds
Which tracks have already been saved.
Int_t NIsYHits
Number of hits with precise Y information in the object.
Double_t Completeness_Single
Truth-matching completeness for G4ID_Single.
TECALReconVertexTrack * TECALReconVertexTrackFactory(ND::THandle< ND::TReconPID > trk, bool IsMC, void *pos, ND::THandle< ND::TG4TrajectoryContainer > trajectories, bool Allocate)
TLorentzVector FindBackPosition(ND::THandle< ND::THitSelection > hits, int MostDownStreamLayerHit)
Method to calculate the position in the last layer reached by the particle.
double PID_Asymmetry
Ratio of the big width of an object by its small width.
int LastLayerManyHits
The last layer in which there are at least 2 hits.
double EMEnergyFit_Para_QMean
The mean charge of hits in the cluster in units of MIPs.
Float_t CompletenessPrimary
The Completeness of the primary contributor to the cluster.
double CalculateFrontBackRatio(ND::THandle< ND::THitSelection > hits)
Method to calculate the FrontBackRatio variable.
Int_t MaxPerpBarHit
The maximum bar number hit perpendicular to the beam axis.