6 #include <retrieveHitTruthInfo.hxx> 
    7 #include <TG4Trajectory.hxx> 
   10 #include "TRealDatum.hxx" 
   11 #include "TReconNode.hxx" 
   12 #include "TReconShower.hxx" 
   13 #include "TReconTrack.hxx" 
   15 #include "TGeomInfo.hxx" 
   17 #include "TComboHit.hxx" 
   18 #include "TG4HitSegment.hxx" 
   19 #include "TReconHit.hxx" 
   20 #include "TTPCmcDigit.hxx" 
   22 #include "TEventFolder.hxx" 
   23 #include "TRecPackManager.hxx" 
   24 #include "TValidationUtils.hxx" 
   26 #include "ReconObjectUtils.hxx" 
   27 #include "ReconPrintout.hxx" 
   28 #include "TIntegerDatum.hxx" 
   29 #include "TrackTruthInfo.hxx" 
   30 #include "TrackingUtils.hxx" 
   31 #include "fgdUtils.hxx" 
   32 #include "pidUtils.hxx" 
   34 #include "TReconStateUtilities.hxx" 
   35 #include "TTrackerReconUtils.hxx" 
   71     Alternates = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalPIDAlternate",
 
   73     ECAL = 
new TClonesArray(
"ND::TGlobalReconModule::TECALObject", 
NMAXECAL);
 
   75     new TClonesArray(
"ND::TGlobalReconModule::TECALObject", 
NMAXP0DECAL);
 
   76     TPC = 
new TClonesArray(
"ND::TGlobalReconModule::TTPCObject", 
NMAXTPC);
 
   77     FGD = 
new TClonesArray(
"ND::TGlobalReconModule::TFGDObject", 
NMAXFGD);
 
   78     SFG = 
new TClonesArray(
"ND::TGlobalReconModule::TSFGObject", 
NMAXSFG);
 
   79     P0D = 
new TClonesArray(
"ND::TGlobalReconModule::TP0DObject", 
NMAXP0D);
 
   80     SMRD = 
new TClonesArray(
"ND::TGlobalReconModule::TSMRDObject", 
NMAXSMRD);
 
   82     new TClonesArray(
"ND::TGlobalReconModule::TTrackerObject", 
NMAXTRACKER);
 
   83     HitsSaved = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalHit", 4);
 
   87     ND::TND280Log::SetLogLevel(
"eventUnpack", ND::TND280Log::QuietLevel);
 
  128     Constituents = 
new TClonesArray(
"ND::TGlobalReconModule::TVertexConstituent",
 
  130     TrueVertices = 
new TClonesArray(
"ND::TTrueVertex", 
NCONSTITUENTS);
 
  132     Constituents->Clear();
 
  134     TrueVertices->Clear();
 
  168     FGD1Unused = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalHit", 20);
 
  169     FGD2Unused = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalHit", 20);
 
  179     SFGUnused = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalHit", 20);
 
  194     const ND::THandle<ND::THit>& h2) 
 
  196     return h1->GetPosition().X() < h2->GetPosition().X();
 
  199     const ND::THandle<ND::THit>& h2) 
 
  201     return h1->GetPosition().Y() < h2->GetPosition().Y();
 
  204     const ND::THandle<ND::THit>& h2) 
 
  206     return h1->GetPosition().Z() < h2->GetPosition().Z();
 
  210     const ND::THandle<ND::TReconNode>& n2) 
 
  212     return TrackingUtils::GetPosition(n1->GetState()).X() <
 
  213     TrackingUtils::GetPosition(n2->GetState()).X();
 
  216     const ND::THandle<ND::TReconNode>& n2) 
 
  218     return TrackingUtils::GetPosition(n1->GetState()).Y() <
 
  219     TrackingUtils::GetPosition(n2->GetState()).Y();
 
  222     const ND::THandle<ND::TReconNode>& n2)
 
  224     return TrackingUtils::GetPosition(n1->GetState()).Z() <
 
  225     TrackingUtils::GetPosition(n2->GetState()).Z();
 
  228     const ND::THandle<ND::TReconNode>& n2) 
 
  231     return TrackingUtils::GetPosition(n1->GetState()).X() >=
 
  232     TrackingUtils::GetPosition(n2->GetState()).X();
 
  235     const ND::THandle<ND::TReconNode>& n2) 
 
  237     return TrackingUtils::GetPosition(n1->GetState()).Y() >=
 
  238     TrackingUtils::GetPosition(n2->GetState()).Y();
 
  241     const ND::THandle<ND::TReconNode>& n2) 
 
  243     return TrackingUtils::GetPosition(n1->GetState()).Z() >=
 
  244     TrackingUtils::GetPosition(n2->GetState()).Z();
 
  246 #include "../cvstags/TGlobalReconModule.cxx" 
  268     fPIDs = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalPID", 20);
 
  272     new TClonesArray(
"ND::TGlobalReconModule::TTPCOtherObject", 
NMAXTPCOTHER);
 
  275     fVertices = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalVertex", 20);
 
  280     fFgdTimeBins = 
new TClonesArray(
"ND::TGlobalReconModule::TFgdTimeBin", 20);
 
  283     fSfgTimeBins = 
new TClonesArray(
"ND::TGlobalReconModule::TSfgTimeBin", 20);
 
  285     fSMRDUnused = 
new TClonesArray(
"ND::TGlobalReconModule::TSMRDHit", 100);
 
  287     fP0DUnused = 
new TClonesArray(
"ND::TGlobalReconModule::TGlobalHit", 100);
 
  291         fTPCPIDs = 
new TClonesArray(
"ND::TGlobalReconModule::TTpcPID", 20);
 
  304             "TGlobalReconModule",
 
  306             << 
" has already written the config tree this run.");
 
  320     if (opt == 
"UseECalVertices") {
 
  354     ->SetTitle(
"The number of added primary vertices. ");
 
  358     ->SetTitle(
"The TGlobalVertex vector of vertices. ");
 
  363     ->SetTitle(
"  Number of hit time bins in the FGD as determined by fgdRecon. ");
 
  365     ->SetTitle(
" Information for each hit time bin (TFgdTimeBins). ");
 
  369     ->SetTitle(
"  Number of hit time bins in the SFG as determined by sfgRecon. ");
 
  371     ->SetTitle(
" Information for each hit time bin (TSfgTimeBins). ");
 
  374     ->SetTitle(
" The number of global objects.");
 
  377     ->SetTitle(
" The vector of TGlobalPID.");
 
  380     ->SetTitle(
"The number of TPC other objects. ");
 
  384     ->SetTitle(
"The vector of TPC other objects (TTPCOtherObject). ");
 
  387     ->SetTitle(
" Number of hits unused in FGD1");
 
  389     ->SetTitle(
" Number of hits unused in FGD2");
 
  391     ->SetTitle(
" Number of hits unused in SFG");
 
  393     ->SetTitle(
"  Number of hits unused in the P0D");
 
  396     ->SetTitle(
"The vector unused hits in the P0D (TGlobalHit). ");
 
  399     ->SetTitle(
" The vector unused hits in the SMRD (TSMRDHit). ");
 
  402     ->SetTitle(
"  Number of all hits unused in the SMRD"); 
 
  405     ->SetTitle(
" Number of hits unused in the SMRDTop ");
 
  408     ->SetTitle(
" Number of hits unused in the SMRDBottom.");
 
  411     ->SetTitle(
"Number of hits unused in the SMRDLeft. ");
 
  414     ->SetTitle(
"  Number of hits unused in the SMRDRight.");
 
  417     ->SetTitle(
" Number of hits unused in the TPC. ");
 
  422     ->SetTitle(
"Outermost hits in the P0D. ");
 
  426     ->SetTitle(
"  Median hit time of the earliest track. ");
 
  429     ->SetTitle(
"Number of objects containing the DsECAL. "); 
 
  431     ->SetTitle(
"  Number of objects containing the TrECAL."); 
 
  433     ->SetTitle(
" Number of objects containing the P0DECAL. "); 
 
  435     ->SetTitle(
"  Number of objects containing the TPC.");
 
  437     ->SetTitle(
"  Number of objects containing the FGD.");
 
  439     ->SetTitle(
"  Number of objects containing the SFG.");
 
  441     ->SetTitle(
" Number of objects containing the P0D.");
 
  443     ->SetTitle(
"   Number of objects containing the SMRD.");
 
  445     ->SetTitle(
"Number of objects in the DsECAL only. "); 
 
  447     ->SetTitle(
" Number of objects in the TrECAL only. ");
 
  450     ->SetTitle(
"  Number of objects in the P0DECAL only.");
 
  452     ->SetTitle(
" Number of objects in the TPC only. ");
 
  454     ->SetTitle(
" Number of objects in the FGD only. ");
 
  456     ->SetTitle(
" Number of objects in the SFG only. ");
 
  458     ->SetTitle(
" Number of objects in the P0D only.");
 
  460     ->SetTitle(
"Number on objects in the SMRD only. ");                 
 
  470         ND::tman().add_manager(
"globalAnalysis");
 
  471         ND::tman().select_manager(
"globalAnalysis");
 
  474         ND::rpman(
"globalAnalysis")
 
  476         .navigator(RP::particle_helix)
 
  477         .set_unique_surface(
true);
 
  480         ND::rpman(
"globalAnalysis")
 
  482         .enable_correction(RP::particle_helix, RP::eloss, 
true);
 
  485         ND::rpman(
"globalAnalysis")
 
  487         .enable_noiser(RP::particle_helix, RP::ms, 
true);
 
  491         .model(RP::particle_helix)
 
  492         .retrieve_tool<HelixEquation>(
"equation");
 
  495             ND::tman(
"globalAnalysis").SetVerbosity(0, 2, 0, 0);
 
  496             ND::rpman(
"globalAnalysis")
 
  498             .model(RP::particle_helix)
 
  499             .tool(
"correction/eloss")
 
  500             .set_verbosity(Messenger::VVERBOSE);
 
  501             ND::rpman(
"globalAnalysis")
 
  503             .navigator(RP::particle_helix)
 
  505             .set_verbosity(Messenger::VVERBOSE);
 
  506             ND::rpman(
"globalAnalysis")
 
  509             .set_verbosity(Messenger::VVERBOSE);
 
  577     ND::THandle<ND::TAlgorithmResult> globalRecon = 
event.GetFit(
"oaRecon");
 
  584     ND::THandle<ND::TReconObjectContainer> allObjects =
 
  585     globalRecon->GetResultsContainer(
"final");
 
  587     if (!allObjects) 
return true;
 
  592         ND::THandle<ND::TAlgorithmResult> tpcRecon = 
event.GetFit(
"tpcRecon");
 
  596             ND::THandle<ND::TReconObjectContainer> tpcObjects =
 
  597             tpcRecon->GetResultsContainer(
"TPCPids");
 
  602                 for (ND::TReconObjectContainer::iterator tt = tpcObjects->begin();
 
  603                     tt != tpcObjects->end(); tt++)
 
  605                     ND::THandle<ND::TReconBase> 
object = *tt;
 
  617     for (ND::TReconObjectContainer::iterator tt = allObjects->begin();
 
  618          tt != allObjects->end(); tt++)
 
  620         ND::THandle<ND::TReconBase> 
object = *tt;
 
  621         if (!
object) 
continue;
 
  645     double p0d_charge_cut = 7;
 
  646     ND::THandle<ND::THitSelection> p0dHits = 
event.GetHitSelection(
"p0d");
 
  658     ND::TND280Event& event, ND::THandle<ND::TReconBase> 
object)
 
  662   if (
debug_pids) std::cout << 
"Fill Global PID: " << 
object << std::endl;
 
  669   if (object->UsesDetector(ND::TReconBase::kDSECal)) 
 
  674   if (object->UsesDetector(ND::TReconBase::kECal)) 
 
  679   if (object->UsesDetector(ND::TReconBase::kPECal))
 
  684   if (object->UsesDetector(ND::TReconBase::kFGD)) 
 
  694   if (object->UsesDetector(ND::TReconBase::kTPC))
 
  716     ND::THandle<ND::TReconState> tstate = 
object->GetState();
 
  717   } 
catch (ND::EReconObject 
const& e)
 
  719     std::cout << 
"TReconBase with no state. Skip object !!" << std::endl;
 
  730   globalObject->
UniqueID = 
object->GetUniqueID();
 
  742   globalObject->
isForward = (TrackingUtils::GetDirection(
object).Z() > 0);
 
  743   globalObject->
SenseOK = TrackingUtils::GetSenseOK(*
object);
 
  744   globalObject->
IsCurvBack = TrackingUtils::GetCurvBackTrack(*
object);
 
  745   globalObject->
Charge = TrackingUtils::GetCharge(
object);
 
  746   globalObject->
EDeposit = TrackingUtils::GetEDeposit(
object);
 
  747   globalObject->
Width =
 
  748   TrackingUtils::GetWidth(
object).X();  
 
  749   globalObject->
Cone = TrackingUtils::GetCone(
object);
 
  753   globalObject->
Status = 
object->CheckStatus(object->kSuccess);
 
  754   globalObject->
Chi2 = 
object->GetQuality();
 
  755   globalObject->
NDOF = 
object->GetNDOF();
 
  758     globalObject->
NNodes = 
object->GetNodes().size();
 
  759   } 
catch (ND::EReconObject 
const& e)
 
  765   if (object->GetHits()) globalObject->
NHits = object->GetHits()->size();
 
  770   if (object->GetConstituents()) 
 
  772     globalObject->
NConstituents = 
object->GetConstituents()->size();
 
  774     ND::TReconObjectContainer t1const =
 
  775     ReconObjectUtils::GetConstituentsRecursive(
object, 
true);
 
  777     if (t1const.size() > 0) 
 
  779       ND::TReconObjectContainer::const_iterator it1;
 
  781       for (it1 = t1const.begin(); it1 != t1const.end(); it1++)
 
  783         ND::THandle<ND::TReconBase> obj = *it1;
 
  786           if (obj->GetAlgorithmName() == 
"FgdECalIncremental") 
 
  797   if (object->GetHits()) 
 
  800 #ifdef FILL_ALL_GLOBAL_HITS 
  809   const ND::TReconNodeContainer& nodes = 
object->GetNodes();
 
  810   ND::TReconNodeContainer::const_iterator it;
 
  811   for(it = nodes.begin(); it != nodes.end(); it++){
 
  812     ND::THandle<ND::TReconState> nodeState = (*it)->GetState();
 
  813     if(!nodeState) 
continue;
 
  815     TLorentzVector node_pos = ND::TReconStateUtilities::GetPosition(nodeState);
 
  821   const ND::THandle<ND::THitSelection> hits = 
object->GetHits();
 
  822   ND::THitSelection::const_iterator it_h;
 
  823   for(it_h = hits->begin(); it_h != hits->end(); it_h++){
 
  824     ND::THandle<ND::THit> hit = *it_h;
 
  827     TVector3 hit_pos = hit->GetPosition();
 
  828     TLorentzVector pos_temp(hit_pos.X(),hit_pos.Y(),hit_pos.Z(),
 
  843     const ND::TReconNodeContainer& tnodes = 
object->GetNodes();
 
  844     unsigned long det_prev = 0;
 
  849     ND::TReconNodeContainer::const_iterator in;
 
  850     for (in = tnodes.begin(); in != tnodes.end(); in++)
 
  852       ND::THandle<ND::TReconBase> nodeObject = (*in)->GetObject();
 
  853       if (!nodeObject) 
continue;
 
  855       ND::THandle<ND::TReconState> nodeState = (*in)->GetState();
 
  856       if (!nodeState) 
continue;
 
  860       double nodeTime = TrackingUtils::GetPosition(nodeState).T();
 
  862       if (det_current != det_prev){ 
 
  865             std::make_pair(det_prev, TVector2(first_time, last_time)));
 
  869         det_prev = det_current;
 
  870         first_time = nodeTime;
 
  871         last_time = nodeTime;
 
  873         last_time = nodeTime;
 
  880         std::make_pair(det_prev, TVector2(first_time, last_time)));
 
  886   ND::THandle<ND::TG4Trajectory> G4track = 
GetG4Trajectory(*
object, pur, eff);
 
  899   ND::THandle<ND::TReconState> firstState, lastState;
 
  901   ND::tman().GetFirstAndLastStates(
object, firstState, lastState);
 
  947   ND::THandle<ND::TReconPID> PID = object;
 
  949     globalObject->
PIDWeights.push_back(PID->GetPIDWeight());
 
  952     ND::TReconObjectContainer::const_iterator it;
 
  953     for (it = PID->GetAlternates().begin(); it != PID->GetAlternates().end();
 
  955       ND::THandle<ND::TReconPID> alter = *it;
 
  963         globalObject->
PIDWeights.push_back(alter->GetPIDWeight());
 
  979   ReconObjectUtils::GetTRExPatternIDs(
object, IDs, kGas);
 
  982   std::copy(IDs.begin(), IDs.end(),
 
  987   ReconObjectUtils::GetTRExPathIDs(
object, IDs, kGas);
 
  990   std::copy(IDs.begin(), IDs.end(),
 
  995   ReconObjectUtils::GetTRExJunctionIDs(
object, IDs, kGas);
 
  998   std::copy(IDs.begin(), IDs.end(),
 
 1008   if (ND::TGeomInfo::Get().FGD().IsInFGD1(globalObject->
FrontPosition.Vect()) ||
 
 1009       ND::TGeomInfo::Get().FGD().IsInFGD2(globalObject->
FrontPosition.Vect()))
 
 1013   if (ND::TGeomInfo::Get().FGD().IsInFGD1(globalObject->
BackPosition.Vect()) ||
 
 1014       ND::TGeomInfo::Get().FGD().IsInFGD2(globalObject->
BackPosition.Vect()))
 
 1020   TVector3 fFGD1ActiveMin;
 
 1021   TVector3 fFGD1ActiveMax;
 
 1022   TVector3 fFGD2ActiveMin;
 
 1023   TVector3 fFGD2ActiveMax;
 
 1024   fFGD1ActiveMin.SetXYZ(-932.17, -877.17, 116.045);
 
 1025   fFGD1ActiveMax.SetXYZ(932.17, 987.17, 446.955);
 
 1026   fFGD2ActiveMin.SetXYZ(-932.17, -877.17, 1474.04);
 
 1027   fFGD2ActiveMax.SetXYZ(932.17, 987.17, 1806.96);
 
 1031   if (ND::TGeomInfo::Get().FGD().IsInFGD1(
 
 1034     if (ND::TGeomInfo::Get().FGD().IsInFGD1(
 
 1037     } 
else if (ND::TGeomInfo::Get().FGD().IsInFGD2(
 
 1041           TLorentzVector ExitPosFGD1;
 
 1051           TLorentzVector EntrancePosFGD2;
 
 1063           TLorentzVector ExitPosFGD1;
 
 1077         TLorentzVector EntrancePosFGD2;
 
 1081         TLorentzVector ExitPosFGD2;
 
 1101   else if (ND::TGeomInfo::Get().FGD().IsInFGD2(
 
 1103     if (ND::TGeomInfo::Get().FGD().IsInFGD2(
 
 1106     } 
else if (ND::TGeomInfo::Get().FGD().IsInFGD1(
 
 1111         TLorentzVector ExitPosFGD2;
 
 1122         TLorentzVector EntrancePosFGD1;
 
 1134         TLorentzVector ExitPosFGD2;
 
 1147         TLorentzVector EntrancePosFGD1;
 
 1154         TLorentzVector ExitPosFGD1;
 
 1172         TLorentzVector EntrancePosFGD1;
 
 1183       TLorentzVector ExitPosFGD1;
 
 1194       TLorentzVector EntrancePosFGD2;
 
 1205       TLorentzVector ExitPosFGD2;
 
 1230   if (det_count == 1 && globalObject->
NECALs == 1) {
 
 1238   else if (det_count == 1 && globalObject->
NP0Ds == 1) {
 
 1249     TVector3 fFGDActiveMin,
 
 1250     TVector3 fFGDActiveMax) 
 
 1255     dist.SetXYZ(0.0, 0.0, 0.0);
 
 1256     if (FGDPos.X() < fFGDActiveMin.X()) {
 
 1257         dist.SetX(fFGDActiveMin.X() - FGDPos.X());
 
 1258         if (dist.X() != 0.0 && abs(dist.X()) < 2.0)
 
 1259             FGDPos.SetX(fFGDActiveMin.X() + 0.1);
 
 1261     if (FGDPos.X() > fFGDActiveMax.X()) {
 
 1262         dist.SetX(fFGDActiveMax.X() - FGDPos.X());
 
 1263         if (dist.X() != 0.0 && abs(dist.X()) < 2.0)
 
 1264             FGDPos.SetX(fFGDActiveMax.X() - 0.1);
 
 1266     if (FGDPos.Y() < fFGDActiveMin.Y()) {
 
 1267         dist.SetY(fFGDActiveMin.Y() - FGDPos.Y());
 
 1268         if (dist.Y() != 0.0 && abs(dist.Y()) < 2.0)
 
 1269             FGDPos.SetY(fFGDActiveMin.Y() + 0.1);
 
 1271     if (FGDPos.Y() > fFGDActiveMax.Y()) {
 
 1272         dist.SetY(fFGDActiveMax.Y() - FGDPos.Y());
 
 1273         if (dist.Y() != 0.0 && abs(dist.Y()) < 2.0)
 
 1274             FGDPos.SetY(fFGDActiveMax.Y() - 0.1);
 
 1276     if (FGDPos.Z() < fFGDActiveMin.Z()) {
 
 1277         dist.SetZ(fFGDActiveMin.Z() - FGDPos.Z());
 
 1278         if (dist.Z() != 0.0 && abs(dist.Z()) < 2.0)
 
 1279             FGDPos.SetZ(fFGDActiveMin.Z() + 0.1);
 
 1281     if (FGDPos.Z() > fFGDActiveMax.Z()) {
 
 1282         dist.SetZ(fFGDActiveMax.Z() - FGDPos.Z());
 
 1283         if (dist.Z() != 0.0 && abs(dist.Z()) < 2.0)
 
 1284             FGDPos.SetZ(fFGDActiveMax.Z() - 0.1);
 
 1296     if (PID->GetParticleId() == ND::TReconPID::kElectron)
 
 1298     else if (PID->GetParticleId() == ND::TReconPID::kMuon)
 
 1300     else if (PID->GetParticleId() == ND::TReconPID::kProton)
 
 1308     TLorentzVector& pos, TVector3& dir,
 
 1309     double& mom, 
double& momErr,
 
 1311     double (&cov)[7][7]) 
 
 1316         pos = TrackingUtils::GetPosition(state);
 
 1317         dir = TrackingUtils::GetDirection(state);
 
 1318         mom = TrackingUtils::GetMomentum(state);
 
 1319         momErr = TrackingUtils::GetMomentumError(state);
 
 1320         charge = TrackingUtils::GetCharge(state);
 
 1324         bool ok = ND::converter().TReconState_to_State(*state, rp_state);
 
 1328             RP::rep().convert(rp_state, RP::pos_dir_curv);
 
 1329             dim = rp_state.vector().num_row();
 
 1334             const EMatrix& C = rp_state.matrix();
 
 1336             for (
size_t i = 0; i < 7; i++)
 
 1337                 for (
size_t j = 0; j < 7; j++) cov[i][j] = C[i][j];
 
 1340             std::fill(&cov[0][0], &cov[0][0] + 7 * 7, 
DEFAULT_MAX);
 
 1351         std::fill(&cov[0][0], &cov[0][0] + 7 * 7, 
DEFAULT_MAX);
 
 1355         std::cout << 
"position:  " << pos.X() << 
" " << pos.Y() << 
" " << pos.Z()
 
 1357         std::cout << 
"direction: " << dir.X() << 
" " << dir.Y() << 
" " << dir.Z()
 
 1359         std::cout << 
"momentum:  " << mom << 
" " << momErr << std::endl;
 
 1365     TLorentzVector& pos,
 
 1366     TLorentzVector& posVar,
 
 1367     TVector3& dir, TVector3& dirVar,
 
 1368     double& mom, 
double& momErr)
 
 1373         pos = TrackingUtils::GetPosition(state);
 
 1374         posVar = TrackingUtils::GetPositionVariance(state);
 
 1375         dir = TrackingUtils::GetDirection(state);
 
 1376         dirVar = TrackingUtils::GetDirectionVariance(state);
 
 1377         mom = TrackingUtils::GetMomentum(state);
 
 1378         momErr = TrackingUtils::GetMomentumError(state);
 
 1389         std::cout << 
"position:  " << pos.X() << 
" " << pos.Y() << 
" " << pos.Z()
 
 1391         std::cout << 
"direction: " << dir.X() << 
" " << dir.Y() << 
" " << dir.Z()
 
 1393         std::cout << 
"momentum:  " << mom << 
" " << momErr << std::endl;
 
 1399     ND::THandle<ND::TG4Trajectory> G4track, ND::THandle<ND::TReconBase> 
object,
 
 1400     TLorentzVector& pos, TVector3& dir, 
double& mom, 
double& momErr,
 
 1401     double& charge, 
double (&cov)[7][7]) 
 
 1408     ND::THandle<ND::TReconState> tstate = 
object->GetState();
 
 1410     ND::THandle<ND::TReconState> newstate = ND::THandle<ND::TReconState>();
 
 1414     if (tstate && G4track && (object->UsesDetector(ND::TReconBase::kTPC) ||
 
 1415           object->UsesDetector(ND::TReconBase::kFGD) ||
 
 1419       double dir_max = -100;
 
 1421       TVector3 dirS = TrackingUtils::GetDirection(
object);
 
 1422       for (
int i = 0; i < 3; i++) {
 
 1423         if (fabs(dirS(i)) > dir_max) {
 
 1424             dir_max = fabs(dirS(i));
 
 1429         snorm = TVector3(1, 0, 0);
 
 1430       else if (idir_max == 1)
 
 1431         snorm = TVector3(0, 1, 0);
 
 1432       else if (idir_max == 2)
 
 1433         snorm = TVector3(0, 0, 1);
 
 1436         std::cout << 
"Extrapolation to true vertex: dir = (" << dirS.X() << 
", " 
 1437                   << dirS.Y() << 
", " << dirS.Z() << 
")" << std::endl;
 
 1440         ND::tman(
"globalAnalysis").SetVerbosity(0, 6, 0, 0);
 
 1442       newstate = ND::THandle<ND::TReconState>(
new ND::TTrackState);
 
 1443       ND::tman(
"globalAnalysis").PropagateToSurface(
 
 1444           *tstate, G4track->GetInitialPosition().Vect(),
 
 1448           ND::tman(
"globalAnalysis").SetVerbosity(0, 0, 0, 0);
 
 1455     ND::THandle<ND::TG4Trajectory> G4track, ND::THandle<ND::TReconBase> 
object,
 
 1456     TLorentzVector& pos, TLorentzVector& posVar, TVector3& dir,
 
 1457     TVector3& dirVar, 
double& mom, 
double& momErr) 
 
 1464     ND::THandle<ND::TReconState> tstate = 
object->GetState();
 
 1466     ND::THandle<ND::TReconState> newstate = ND::THandle<ND::TReconState>();
 
 1470     if (tstate && G4track && (object->UsesDetector(ND::TReconBase::kTPC) ||
 
 1471           object->UsesDetector(ND::TReconBase::kFGD) ||
 
 1476     double dir_max = -100;
 
 1478     TVector3 dirS = TrackingUtils::GetDirection(
object);
 
 1479     for (
int i = 0; i < 3; i++) {
 
 1480         if (fabs(dirS(i)) > dir_max) {
 
 1481             dir_max = fabs(dirS(i));
 
 1486         snorm = TVector3(1, 0, 0);
 
 1487     else if (idir_max == 1)
 
 1488         snorm = TVector3(0, 1, 0);
 
 1489     else if (idir_max == 2)
 
 1490         snorm = TVector3(0, 0, 1);
 
 1493         std::cout << 
"Extrapolation to true vertex: dir = (" << dirS.X() << 
", " 
 1494     << dirS.Y() << 
", " << dirS.Z() << 
")" << std::endl;
 
 1497         ND::tman(
"globalAnalysis").SetVerbosity(0, 6, 0, 0);
 
 1499     newstate = ND::THandle<ND::TReconState>(
new ND::TTrackState);
 
 1500     ND::tman(
"globalAnalysis")
 
 1501     .PropagateToSurface(*tstate, G4track->GetInitialPosition().Vect(),
 
 1505         ND::tman(
"globalAnalysis").SetVerbosity(0, 0, 0, 0);
 
 1513     ND::THandle<ND::TG4Trajectory> G4track, ND::THandle<ND::TReconBase> 
object,
 
 1522     ND::THandle<ND::TReconPID> pid = object;
 
 1525     if (!(object->UsesDetector(ND::TReconBase::kTPC)) ||
 
 1526         object->CheckStatus(ND::TReconBase::kLikelihoodFit))
 
 1536     if (TrackingUtils::GetCurvBackTrack(*
object)) 
return;
 
 1538     const ND::TReconObjectContainer& alter = pid->GetAlternates();
 
 1539     ND::TReconObjectContainer::const_iterator it;
 
 1540     for (it = alter.begin(); it != alter.end(); it++) {
 
 1551     ND::THandle<ND::TG4Trajectory> G4track, ND::THandle<ND::TReconBase> 
object,
 
 1561         ND::THandle<ND::TReconState> tstate = 
object->GetState();
 
 1562     } 
catch (ND::EReconObject e) {
 
 1563         std::cout << 
"TReconBase with no state. Skip object !!" << std::endl;
 
 1573     PIDAlternate.
Status = 
object->CheckStatus(object->kSuccess);
 
 1574     PIDAlternate.
Chi2 = 
object->GetQuality();
 
 1575     PIDAlternate.
NDOF = 
object->GetNDOF();
 
 1576     PIDAlternate.
Charge = TrackingUtils::GetCharge(
object);
 
 1580     ND::THandle<ND::TReconState> firstState =
 
 1581     TrackingUtils::GetFirstState(*
object);
 
 1587     ND::THandle<ND::TReconState> lastState = TrackingUtils::GetLastState(*
object);
 
 1601     ND::THandle<ND::TReconPID> PID = object;
 
 1603         PIDAlternate.
PIDWeight = PID->GetPIDWeight();
 
 1610     ND::THandle<ND::TReconBase> 
object) 
 
 1621     if (!
object) 
return length;
 
 1623     if (TrackingUtils::IsShower(
object)) 
return 0.;
 
 1625     ND::THandle<ND::TReconPID> pid = object;
 
 1626     ND::THandle<ND::TReconTrack> track = object;
 
 1628     if (!pid && !track) 
return length;
 
 1630     bool ok = ND::tman().ComputeObjectLength(
object, length_tmp);
 
 1632     if (ok) length = length_tmp;
 
 1639     ND::TND280Event& event,
 
 1640     ND::THandle<ND::TReconObjectContainer> globalObjects)
 
 1645     TString tname  = 
"trackerRecon";
 
 1646     TString tvname = 
"tracker";  
 
 1647     TString gname  = 
"globalVertex";
 
 1648     TString gvname = 
"globalVertex";
 
 1652     TString reconame = gname;
 
 1653     TString vname = gvname;
 
 1656         ND::THandle<ND::TAlgorithmResult> ResultBin = 
event.GetFit(
"globalVertex");
 
 1658         ND::THandle<ND::TReconObjectContainer> pvertices =
 
 1659         ResultBin->GetResultsContainer(
"vertices");
 
 1661             ND280NamedInfo(
"ECalVertexInTGRM",
 
 1662             "Leaving FillVertexInfo as we couldn't find the container.");
 
 1666         ND::THandle<ND::TG4PrimaryVertexContainer> g4PrimVerts;
 
 1669             event.Get<ND::TG4PrimaryVertexContainer>(
"truth/G4PrimVertex00");
 
 1671         for (
size_t prim_vert_it = 0; prim_vert_it < pvertices->size();
 
 1673             ND::THandle<ND::TReconVertex> vert = pvertices->at(prim_vert_it);
 
 1681             if (
fIsMC && 
bool(g4PrimVerts)) {
 
 1685             if (vert->GetConstituents()) {
 
 1686                 for (
size_t sec_vert_it = 0;
 
 1687                     sec_vert_it < vert->GetConstituents()->size(); ++sec_vert_it) {
 
 1688                     ND::THandle<ND::TReconVertex> sVert =
 
 1689                     vert->GetConstituents()->at(sec_vert_it);
 
 1694                     bool cool_beans = 
FillVertex(event,sVert, 
false);
 
 1696                         ND280NamedInfo(
"ECalVertexInTGRM", 
"Added secondary vertex.");
 
 1697                         if (
fIsMC && 
bool(g4PrimVerts)) {
 
 1704             ND280NamedInfo(
"ECalVertexInTGRM", 
"Added an ecalVertex.");
 
 1706         ND280NamedInfo(
"ECalVertexInTGRM", 
"Leaving FillVertexInfo having examined " 
 1707                        << pvertices->size() << 
" vertices.");
 
 1712         for (
int ibin = 0; ibin < 
NTIMEBINS; ibin++) {
 
 1713             TString bin_result_name = reconame + 
"_timebin";
 
 1714             bin_result_name += ibin;
 
 1716             ND::THandle<ND::TAlgorithmResult> ResultBin =
 
 1717             event.GetFit(bin_result_name);
 
 1719             if (ibin == 0 && !ResultBin) {
 
 1723                 ResultBin = 
event.GetFit(
"trackerRecon_timebin0");
 
 1727             if (!ResultBin) 
break;
 
 1731                 TString container_name = 
"finalTrackerObjects";
 
 1732                 ND::THandle<ND::TReconObjectContainer> finalTracks =
 
 1733                 ResultBin->GetResultsContainer(container_name);
 
 1734                 if (!finalTracks) 
continue;
 
 1735                 if (finalTracks->size() == 0) 
continue;
 
 1741             TString primary_name = vname + 
"PrimaryVertex";
 
 1742             ND::THandle<ND::TReconObjectContainer> pvertices =
 
 1743             ResultBin->GetResultsContainer(primary_name);
 
 1744             if (!pvertices) 
continue;
 
 1745             if (pvertices->size() == 0) 
continue;
 
 1747             ND::THandle<ND::TReconVertex> pv = pvertices->front();
 
 1753             ND::THandle<ND::TG4PrimaryVertexContainer> g4PrimVert =
 
 1754             event.Get<ND::TG4PrimaryVertexContainer>(
"truth/G4PrimVertex00");
 
 1757             TString vertices_name = vname + 
"Vertices";
 
 1758             ND::THandle<ND::TReconObjectContainer> svertices =
 
 1759             ResultBin->GetResultsContainer(vertices_name);
 
 1760             if (!svertices) 
continue;
 
 1762             for (ND::TReconObjectContainer::iterator siter = svertices->begin();
 
 1763                  siter != svertices->end(); siter++) {
 
 1764                 ND::THandle<ND::TReconVertex> sv = *siter;
 
 1768                 if (sv == pv) 
continue;
 
 1770                 bool vertexCreated = 
false;
 
 1790         gHit.
Position = hit->GetPosition();
 
 1791         gHit.
Time = hit->GetTime();
 
 1793         gHit.
Charge = hit->GetCharge();
 
 1794         gHit.
Type = hit->IsXHit() + (hit->IsYHit()) * 10 + (hit->IsZHit()) * 100;
 
 1811         smrdHit.
Position = hit->GetPosition();
 
 1812         smrdHit.
Time = hit->GetTime();
 
 1814         smrdHit.
Charge = hit->GetCharge();
 
 1815         smrdHit.
Type = hit->IsXHit() + (hit->IsYHit()) * 10 + (hit->IsZHit()) * 100;
 
 1831     enum ESMRDWall { kTop = 0, kBottom, kRight, kLeft };
 
 1835         bool isTopWall = ND::TGeomInfo::SMRD().IsSMRDTopWall(hit);
 
 1836         bool isBottomWall = ND::TGeomInfo::SMRD().IsSMRDBottomWall(hit);
 
 1837         bool isRightWall = ND::TGeomInfo::SMRD().IsSMRDRightWall(hit);
 
 1838         bool isLeftWall = ND::TGeomInfo::SMRD().IsSMRDLeftWall(hit);
 
 1840         if (isTopWall) smrdHit.
Wall = kTop;
 
 1841         if (isBottomWall) smrdHit.
Wall = kBottom;
 
 1842         if (isRightWall) smrdHit.
Wall = kRight;
 
 1843         if (isLeftWall) smrdHit.
Wall = kLeft;
 
 1844         smrdHit.
Yoke = ND::TGeomInfo::SMRD().GetYokeRingNumber(hit);
 
 1845         smrdHit.
Layer = ND::TGeomInfo::SMRD().GetSMRDRingNumber(hit);
 
 1846         smrdHit.
Tower = ND::TGeomInfo::SMRD().GetSMRDTowerNumber(hit);
 
 1847         smrdHit.
Counter = ND::TGeomInfo::SMRD().GetSMRDScintNumber(hit);
 
 1861     ND::THandle<ND::TReconBase> 
object, 
TSubBaseObject& sub, 
int det)
 
 1865     if (ReconObjectUtils::GetOriginalObject(
object))
 
 1866         sub.
UniqueID = ReconObjectUtils::GetOriginalObject(
object)->GetUniqueID();
 
 1868         sub.
UniqueID = 
object->GetUniqueID();
 
 1871     sub.
Status = 
object->CheckStatus(object->kSuccess);
 
 1872     sub.
NDOF = 
object->GetNDOF();
 
 1874         if (object->Get<ND::TIntegerDatum>(
"NNodes"))
 
 1875             sub.
NNodes = 
object->Get<ND::TIntegerDatum>(
"NNodes")
 
 1880             sub.
NNodes = 
object->GetNodes().size();
 
 1881     } 
catch (ND::EReconObject 
const& e) {
 
 1885     sub.
Chi2 = 
object->GetQuality();
 
 1886     sub.
EDeposit = TrackingUtils::GetEDeposit(
object);
 
 1890     if (object->GetConstituents())
 
 1894     if (object->GetHits()) sub.
NHits = object->GetHits()->size();
 
 1901     ND::THandle<ND::TReconState> firstState, lastState;
 
 1903     ND::tman().GetFirstAndLastStates(
object, firstState, lastState);
 
 1915     ND::THandle<ND::TG4Trajectory> G4track = 
GetG4Trajectory(*
object, pur, eff);
 
 1920     template <
typename T, 
size_t N>
 
 1921     size_t ArrSize(T 
const (&arr)[N]) {
 
 1932     static const ND::TReconBase::Status ECalDetBits[] = {
 
 1933         ND::TReconBase::kLeftPECal, ND::TReconBase::kRightPECal,
 
 1934         ND::TReconBase::kTopPECal,  ND::TReconBase::kBottomPECal,
 
 1935         ND::TReconBase::kLeftTECal, ND::TReconBase::kRightTECal,
 
 1936         ND::TReconBase::kTopTECal,  ND::TReconBase::kBottomTECal,
 
 1937     ND::TReconBase::kDSECal};
 
 1940     for (
size_t det_bit = 0; det_bit < ArrSize(ECalDetBits); det_bit++) {
 
 1941         if (!object->UsesDetector(ECalDetBits[det_bit])) {
 
 1949         ND::THandle<ND::TReconObjectContainer> ecalObjects(
 
 1950             new ND::TReconObjectContainer());
 
 1952         ReconObjectUtils::GetConstituentsInDetector(
object, ECalDetBits[det_bit],
 
 1955         for (
size_t eo_it = 0; eo_it < ecalObjects->size(); eo_it++) {
 
 1956             ND::THandle<ND::TReconBase> ecalObject = ecalObjects->at(eo_it);
 
 1963                 "TGlobalReconModule",
 
 1964                 "Transposing ECal object from: " << ecalObject->ConvertDetector());
 
 1970                     ND280NamedWarn(
"TGlobalReconModule",
 
 1971                         "Ignoring as already have too many P0DECal objects.");
 
 1979             else if (det_bit < 8) {
 
 1981                     ND280NamedWarn(
"TGlobalReconModule",
 
 1982                         "Ignoring as already have too many ECal objects.");
 
 1992                     ND280NamedWarn(
"TGlobalReconModule",
 
 1993                         "Ignoring as already have too many ECal objects.");
 
 2006             ECalObjToFill->LLR_Quality = -9999.;      
 
 2007             ECalObjToFill->LLR_MIP_EM = -9999.;
 
 2008             ECalObjToFill->LLR_MIP_Pion = -9999.;
 
 2009             ECalObjToFill->LLR_EM_HIP = -9999.;
 
 2010             ECalObjToFill->LLR_MIP_EM_LowMomentum = -9999.;
 
 2011             ECalObjToFill->LLR_MIP_HIP_VACut = -9999.;
 
 2015             ECalObjToFill->EMEnergyFit_Uncertainty = 
DEFAULT_MAX;
 
 2016             ECalObjToFill->FilledAsType = -1;
 
 2021             ECalObjToFill->PID_TruncatedMaxRatio = 
DEFAULT_MAX;
 
 2022             ECalObjToFill->PID_TransverseChargeRatio = 
DEFAULT_MAX;
 
 2028             ECalObjToFill->ThrustOrigin =
 
 2030             ECalObjToFill->ThrustAxis =
 
 2032             ECalObjToFill->InnerMostLayerHit = -1;
 
 2033             ECalObjToFill->OuterMostLayerHit = -1;
 
 2037                 if (!ecalObject->GetConstituents()) {
 
 2038                     ND280NamedWarn(
"TGlobalReconModule",
 
 2039                         "ECal PID contained no constituents.");
 
 2044                 ND::THandle<ND::TReconTrack> track_constit =
 
 2045                 (*ecalObject->GetConstituents()->begin());
 
 2046                 ND::THandle<ND::TReconShower> shower_constit =
 
 2047                 (*ecalObject->GetConstituents()->begin());
 
 2051                 if (track_constit) {
 
 2052                     if (!track_constit->GetEDeposit()) {
 
 2053                         ND280NamedWarn(
"TGlobalReconModule",
 
 2054                             "ECal PID-constituent track deposited no energy.");
 
 2059                         track_constit, ecalObject, 
false, &ECalIsoObjToFill);
 
 2062                     if (ECalObjToFill->LLR_Quality == 0) {
 
 2067                         ECalObjToFill->LLR_MIP_EM_LowMomentum =
 
 2072                     ECalObjToFill->EMEnergyFit_Result =
 
 2074                     ECalObjToFill->EMEnergyFit_Uncertainty =
 
 2076                     ECalObjToFill->FilledAsType = 0;
 
 2078                     ECalObjToFill->PID_Angle = ECalIsoObjToFill.
PID_Angle;
 
 2080                     ECalObjToFill->PID_Asymmetry = ECalIsoObjToFill.
PID_Asymmetry;
 
 2081                     ECalObjToFill->PID_TruncatedMaxRatio =
 
 2083                     ECalObjToFill->PID_TransverseChargeRatio =
 
 2085                     ECalObjToFill->PID_FrontBackRatio =
 
 2087                     ECalObjToFill->Containment = ECalIsoObjToFill.
Containment;
 
 2092                     ECalObjToFill->Thrust = ECalIsoObjToFill.
Thrust;
 
 2093                     ECalObjToFill->ThrustOrigin = ECalIsoObjToFill.
ThrustOrigin;
 
 2094                     ECalObjToFill->ThrustAxis = ECalIsoObjToFill.
ThrustAxis;
 
 2095                     ECalObjToFill->InnerMostLayerHit =
 
 2097                     ECalObjToFill->OuterMostLayerHit =
 
 2100                     ECalObjToFill->Width = ECalIsoObjToFill.
Track.
Width;
 
 2102                     ECalObjToFill->Length = ECalObjToFill->TSubBaseObject::Length;
 
 2105                         "TGlobalReconModule",
 
 2106                         "Added information about an ECal Track PID constituent.");
 
 2108                 else if (shower_constit) {
 
 2109                     if (!shower_constit->GetEDeposit()) {
 
 2110                         ND280NamedWarn(
"TGlobalReconModule",
 
 2111                             "ECal PID-constituent shower deposited no energy.");
 
 2116                         shower_constit, ecalObject, 
false, &ECalIsoObjToFill);
 
 2121                     ECalObjToFill->LLR_MIP_EM_LowMomentum =
 
 2124                     ECalObjToFill->EMEnergyFit_Result =
 
 2126                     ECalObjToFill->EMEnergyFit_Uncertainty =
 
 2128                     ECalObjToFill->FilledAsType = 1;
 
 2130                     ECalObjToFill->PID_Angle = ECalIsoObjToFill.
PID_Angle;
 
 2132                     ECalObjToFill->PID_Asymmetry = ECalIsoObjToFill.
PID_Asymmetry;
 
 2133                     ECalObjToFill->PID_TruncatedMaxRatio =
 
 2135                     ECalObjToFill->PID_TransverseChargeRatio =
 
 2137                     ECalObjToFill->PID_FrontBackRatio =
 
 2139                     ECalObjToFill->Containment = ECalIsoObjToFill.
Containment;
 
 2145                     ECalObjToFill->Thrust = ECalIsoObjToFill.
Thrust;
 
 2146                     ECalObjToFill->ThrustOrigin = ECalIsoObjToFill.
ThrustOrigin;
 
 2147                     ECalObjToFill->ThrustAxis = ECalIsoObjToFill.
ThrustAxis;
 
 2148                     ECalObjToFill->InnerMostLayerHit =
 
 2150                     ECalObjToFill->OuterMostLayerHit =
 
 2153                     Double_t widthHolder =
 
 2154                     ECalObjToFill->Length * tan(ECalObjToFill->PID_ShowerAngle);
 
 2155                     ECalObjToFill->Width =
 
 2156                     TVector3(widthHolder, widthHolder, widthHolder);
 
 2159                         "TGlobalReconModule",
 
 2160                         "Added information about an ECal Shower PID constituent.");
 
 2164                         "TGlobalReconModule",
 
 2165                         "When transposing an ECal object from: " 
 2166                         << ecalObject->ConvertDetector()
 
 2167                         << 
" found a constituent of type: " 
 2168                         << (*ecalObject->GetConstituents()->begin())->ClassName()
 
 2169                         << 
", expected TReconTrack or TReconShower.");
 
 2176                 ECalIsoVtxTrackToFill;
 
 2178                     ecalObject, 
false, &ECalIsoVtxTrackToFill,
 
 2179                     ND::THandle<ND::TG4TrajectoryContainer>(NULL), 
false);
 
 2182                 ECalObjToFill->LLR_MIP_EM = ECalIsoVtxTrackToFill.
PID_LLR_MIP_EM;
 
 2183                 ECalObjToFill->LLR_EM_HIP = ECalIsoVtxTrackToFill.
PID_LLR_EM_HIP;
 
 2185                 ECalObjToFill->AverageHitTime = ECalIsoVtxTrackToFill.
AverageHitTime;
 
 2187                 ECalObjToFill->InnerMostLayerHit =
 
 2189                 ECalObjToFill->OuterMostLayerHit =
 
 2192                 ECalObjToFill->EDeposit = ECalIsoVtxTrackToFill.
TotalCharge;
 
 2194                 ECalObjToFill->LLR_MIP_HIP_VACut =
 
 2197                 ECalObjToFill->Containment = ECalIsoVtxTrackToFill.
Containment;
 
 2199                 ECalObjToFill->FilledAsType = 2;
 
 2202                     "TGlobalReconModule",
 
 2203                     "Added information about an ECal Vertex Track constituent.");
 
 2230     ND::TReconTrack dummy[18];
 
 2318     for (
int i = 0; i < 18; i++) {
 
 2319         if (!object->UsesDetector(dummy[i].GetDetectors())) 
continue;
 
 2321         ND::THandle<ND::TReconBase> trackerObject =
 
 2322         ReconObjectUtils::GetConstituentInDetector(
object,
 
 2323             dummy[i].GetDetectors());
 
 2335             tracker->
Charge = TrackingUtils::GetCharge(trackerObject);
 
 2343     ND::THandle<ND::TReconBase> 
object)
 
 2369     ND::TReconBase::Status dets[3] = {
 
 2372     for (
int i = 0; i < 3; i++) {
 
 2373         if (!object->UsesDetector(dets[i])) 
continue;
 
 2376         ND::TReconObjectContainer tpcObjects =
 
 2377         ReconObjectUtils::GetAllConstituentsInDetector(
object, dets[i]);
 
 2379         if (tpcObjects.size() == 0) 
continue;
 
 2381         for (ND::TReconObjectContainer::iterator iter = tpcObjects.begin();
 
 2382             iter != tpcObjects.end(); iter++) {
 
 2383         ND::THandle<ND::TReconBase> tpcObject = *iter;
 
 2396     ND::THandle<ND::TReconBase> tpcObject, 
TTPCObject& tpc, 
int det) 
 
 2404     tpc.
Charge = TrackingUtils::GetCharge(tpcObject);
 
 2434     double edepo_sum = 0;
 
 2435     double edepo_sec_sum = 0;
 
 2436     double dedx_ave = 0;
 
 2437     double dedx_sec_ave = 0;
 
 2439     ND::THandle<ND::THitSelection> tpc_hits = tpcObject->GetHits();
 
 2442       for(ND::THitSelection::iterator hit = tpc_hits->begin();
 
 2443           hit != tpc_hits->end(); hit++){
 
 2446         std::vector<ND::TG4VHit*> g4vhit = HitTruthInfo::GetHitTruthInfo(*hit);
 
 2449         for(std::vector<ND::TG4VHit*>::iterator g4Hit = g4vhit.begin();
 
 2450             g4Hit != g4vhit.end(); g4Hit++){
 
 2453           ND::TG4HitSegment* G4HitSeg = 
dynamic_cast<ND::TG4HitSegment*
>(*g4Hit);
 
 2454           if(G4HitSeg == NULL) 
continue;
 
 2457           double edepo_temp = G4HitSeg->GetEnergyDeposit();
 
 2458           double edepo_sec_temp = G4HitSeg->GetSecondaryDeposit();
 
 2466           double len_temp = G4HitSeg->GetTrackLength();
 
 2470           edepo_sum += edepo_temp;
 
 2471           edepo_sec_sum += edepo_sec_temp;
 
 2473             dedx_ave += (edepo_temp / len_temp);
 
 2474             dedx_sec_ave += (edepo_sec_temp / len_temp);
 
 2485       tpc.
TruedEdx = dedx_ave / n_hitseg;
 
 2494     ND::THandle<ND::TReconPID> pid = tpcObject;
 
 2499             GetTPCDatum<ND::TRealDatum, int>(pid, 
"NVerRows", tpc.
NVerRows);
 
 2500         } 
catch (ND::EBadConversion& ex) {
 
 2501             GetTPCDatum<ND::TIntegerDatum, int>(pid, 
"NVerRows", tpc.
NVerRows);
 
 2505             GetTPCDatum<ND::TRealDatum, int>(pid, 
"NHorRows", tpc.
NVerRows);
 
 2506         } 
catch (ND::EBadConversion& ex) {
 
 2507             GetTPCDatum<ND::TIntegerDatum, int>(pid, 
"NHorRows", tpc.
NVerRows);
 
 2511             GetTPCDatum<ND::TRealDatum, int>(pid, 
"T0Source", tpc.
T0Source);
 
 2512         } 
catch (ND::EBadConversion& ex) {
 
 2513             GetTPCDatum<ND::TIntegerDatum, int>(pid, 
"T0Source", tpc.
T0Source);
 
 2520         ND::THandle<ND::TRealDatum> datum_ele =
 
 2521         (pid)->Get<ND::TRealDatum>(
"tpcPid_NTrun");
 
 2523             tpc.
NTrun = pid->Get<ND::TRealDatum>(
"tpcPid_NTrun")->GetValue();
 
 2524             tpc.
Craw = pid->Get<ND::TRealDatum>(
"tpcPid_Craw")->GetValue();
 
 2525             tpc.
Ccorr = pid->Get<ND::TRealDatum>(
"tpcPid_Ccorr")->GetValue();
 
 2526             tpc.
PullEle = pid->Get<ND::TRealDatum>(
"tpcPid_PullEle")->GetValue();
 
 2527             tpc.
PullMuon = pid->Get<ND::TRealDatum>(
"tpcPid_PullMuon")->GetValue();
 
 2528             tpc.
PullPion = pid->Get<ND::TRealDatum>(
"tpcPid_PullPion")->GetValue();
 
 2529             tpc.
PullKaon = pid->Get<ND::TRealDatum>(
"tpcPid_PullKaon")->GetValue();
 
 2531             pid->Get<ND::TRealDatum>(
"tpcPid_PullProton")->GetValue();
 
 2533             pid->Get<ND::TRealDatum>(
"tpcPid_dEdxexpEle")->GetValue();
 
 2535             pid->Get<ND::TRealDatum>(
"tpcPid_dEdxexpMuon")->GetValue();
 
 2537             pid->Get<ND::TRealDatum>(
"tpcPid_dEdxexpPion")->GetValue();
 
 2539             pid->Get<ND::TRealDatum>(
"tpcPid_dEdxexpKaon")->GetValue();
 
 2541             pid->Get<ND::TRealDatum>(
"tpcPid_dEdxexpProton")->GetValue();
 
 2542             tpc.
SigmaEle = pid->Get<ND::TRealDatum>(
"tpcPid_SigmaEle")->GetValue();
 
 2543             tpc.
SigmaMuon = pid->Get<ND::TRealDatum>(
"tpcPid_SigmaMuon")->GetValue();
 
 2544             tpc.
SigmaPion = pid->Get<ND::TRealDatum>(
"tpcPid_SigmaPion")->GetValue();
 
 2545             tpc.
SigmaKaon = pid->Get<ND::TRealDatum>(
"tpcPid_SigmaKaon")->GetValue();
 
 2547             pid->Get<ND::TRealDatum>(
"tpcPid_SigmaProton")->GetValue();
 
 2550         if (pid->Get<ND::TIntegerDatum>(
"TrackType")) {
 
 2551             tpc.
TrackType = pid->Get<ND::TIntegerDatum>(
"TrackType")->GetValue();
 
 2553         ND::tman(
"globalAnalysis").GetTPCLength(tpcObject, tpc.
TPCLength);
 
 2560     if (tpcObject->Get<ND::TIntegerDatum>(
"NbFittedVerticalClusters"))
 
 2562     tpcObject->Get<ND::TIntegerDatum>(
"NbFittedVerticalClusters")
 
 2565     if (tpcObject->Get<ND::TIntegerDatum>(
"NbFittedHorizontalClusters"))
 
 2567     tpcObject->Get<ND::TIntegerDatum>(
"NbFittedHorizontalClusters")
 
 2570     std::vector<double> vect_tmp;
 
 2572     if (GetTPCDatum<ND::TRealDatum, double>(tpcObject, 
"RefitDistortionCorrMom",
 
 2574         vect_tmp.size() == 1)
 
 2575     tpc.
PDist = vect_tmp[0];
 
 2577     if (GetTPCDatum<ND::TRealDatum, double>(tpcObject, 
"RefitEFieldDistortionMom",
 
 2579         vect_tmp.size() == 1)
 
 2584 template <
class T, 
typename I>
 
 2586     const std::string& datum,
 
 2587     std::vector<I>& vvector)
 const  
 2595     if (!
object) 
return false;
 
 2598     if (object->Get<T>(datum.c_str())) {
 
 2599         vvector.push_back(object->Get<T>(datum.c_str())->GetValue());
 
 2603         ND::THandle<ND::TReconObjectContainer> constituents1 =
 
 2604         object->GetConstituents();
 
 2606         if (!constituents1) 
return false;
 
 2610         for (ND::TReconObjectContainer::iterator iter = constituents1->begin();
 
 2611             iter != constituents1->end(); iter++) {
 
 2612             ND::THandle<ND::TReconBase> object_tmp1 = *iter;
 
 2613             if (!object_tmp1) 
continue;
 
 2615             if (object_tmp1->Get<T>(datum.c_str())) {
 
 2616                 vvector.push_back(object_tmp1->Get<T>(datum.c_str())->GetValue());
 
 2621             ND::THandle<ND::TReconObjectContainer> constituents2 =
 
 2622             object_tmp1->GetConstituents();
 
 2623             if (!constituents2 || constituents2->size() < 1) 
continue;
 
 2625             ND::THandle<ND::TReconBase> object_tmp2 = *(constituents2->begin());
 
 2626             if (!object_tmp2) 
continue;
 
 2628             if (object_tmp2->Get<T>(datum.c_str())) {
 
 2629                 vvector.push_back(object_tmp2->Get<T>(datum.c_str())->GetValue());
 
 2641     ND::THandle<ND::TReconBase> 
object,
 
 2649     if(!object->UsesDetector(det)) 
break;
 
 2651     ND::TReconObjectContainer sfgObjects;
 
 2654     if (TrackingUtils::GetCurvBackTrack(*
object)) {
 
 2656         ReconObjectUtils::GetAllConstituentsInDetector(
object, det);
 
 2659       ND::THandle<ND::TReconBase> sfgConst =
 
 2660         ReconObjectUtils::GetConstituentInDetector(
object, det);
 
 2661       if (sfgConst) sfgObjects.push_back(sfgConst);
 
 2664     if (sfgObjects.size() == 0) 
break;
 
 2666     for (ND::TReconObjectContainer::iterator iter = sfgObjects.begin();
 
 2667         iter != sfgObjects.end(); iter++) {
 
 2668       ND::THandle<ND::TReconBase> sfgObject = *iter;
 
 2669       std::map<ND::THandle<THit>,
int> hitIndices;
 
 2680         ND::THandle<ND::THitSelection> tbHits = sfgObject->GetHits();
 
 2683           for (ND::THitSelection::iterator hit = tbHits->begin();
 
 2684                hit != tbHits->end(); hit++) {
 
 2686             hitIndices.insert(std::make_pair(*hit, ihit));
 
 2689             TVector3 pos = (*hit)->GetPosition();
 
 2690             TLorentzVector hitpos = TLorentzVector(
 
 2691               pos[0],pos[1],pos[2],(*hit)->GetTime());
 
 2693             sfg->
HitCharge  .push_back((*hit)->GetCharge());
 
 2694             ND::THitSelection thisHit;
 
 2695             thisHit.push_back(*hit);
 
 2697               TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 2702         double edep_sum = 0;
 
 2707         const ND::TReconNodeContainer& nodeCont = sfgObject->GetNodes();
 
 2708         ND::TReconNodeContainer::const_iterator it_node;
 
 2709         for (it_node = nodeCont.begin();
 
 2710              it_node != nodeCont.end(); ++it_node) {
 
 2711           if(!(*it_node)) 
continue;
 
 2713           TLorentzVector   pos    = TLorentzVector(-999,-999,-999,-999);
 
 2714           TLorentzVector   posvar = TLorentzVector(-999,-999,-999,-999);
 
 2715           TVector3         dir    = TVector3(-999,-999,-999);
 
 2716           TVector3         dirvar = TVector3(-999,-999,-999);
 
 2718           double edep_fit = 0;
 
 2720           std::vector<int> nodeHits;
 
 2722           const ND::THandle<ND::TReconNode> node = *it_node;
 
 2723           ND::THandle<ND::TReconState> s1 = node->GetState();
 
 2725             pos    = ND::TReconStateUtilities::GetPosition(s1);
 
 2726             posvar = ND::TReconStateUtilities::GetPositionVariance(s1);
 
 2727             dir    = ND::TPIDState::GetStateDirection(s1);
 
 2728             dirvar = ND::TPIDState::GetStateDirectionVariance(s1);
 
 2730           ND::THandle<ND::TTrackState> s2 = node->GetState();
 
 2732             edep_fit = s2->GetEDeposit();
 
 2735           ND::THandle<ND::TReconBase> nodeObject = node->GetObject();
 
 2737             ND::THandle<ND::TReconState> objState = nodeObject->GetState();
 
 2739               edep =   ND::TPIDState::GetStateEDeposit(objState);
 
 2740               edep_sum += ND::TPIDState::GetStateEDeposit(objState);
 
 2743             const ND::THandle<ND::THitSelection> 
 
 2744               nodeObjectHits = nodeObject->GetHits();
 
 2745             if (nodeObjectHits) {
 
 2746               ND::THitSelection::const_iterator hit;
 
 2747               for (hit = nodeObjectHits->begin();
 
 2748                    hit != nodeObjectHits->end(); ++hit) {
 
 2749                 auto find = hitIndices.find(*hit);
 
 2750                 if(find != hitIndices.end()){
 
 2751                     nodeHits.push_back(hitIndices[*hit]);
 
 2765           sfg->
NodeHits       .push_back(nodeHits);
 
 2769         double length_temp = 0;
 
 2770         it_node = nodeCont.begin();
 
 2771         ND::THandle<ND::TReconState> nodeState = (*it_node)->GetState();
 
 2772         TVector3 frontPos = ND::TReconStateUtilities::GetPosition(nodeState).Vect();
 
 2774         while(it_node != nodeCont.end()){
 
 2779           nodeState = (*it_node)->GetState();
 
 2780           TVector3 currPos = ND::TReconStateUtilities::GetPosition(nodeState).Vect();
 
 2781           length_temp += (currPos - frontPos).Mag();
 
 2785         sfg->
Length = length_temp;
 
 2787         ND::THandle<ND::TReconPID>     sfgPID     = sfgObject;
 
 2788         ND::THandle<ND::TReconTrack>   sfgTrack   = sfgObject;
 
 2789         ND::THandle<ND::TReconCluster> sfgCluster = sfgObject;
 
 2793           ND::THandle<ND::TPIDState> pidState = sfgPID->GetState();
 
 2794           sfg->
Position      = pidState->GetPosition();
 
 2795           sfg->
PosVariance   = pidState->GetPositionVariance();
 
 2796           sfg->
Direction     = pidState->GetDirection();
 
 2797           sfg->
DirVariance   = pidState->GetDirectionVariance();
 
 2807           std::vector<int> ParticleIds;
 
 2808           std::vector<double> PIDWeights;
 
 2811           ND::TReconObjectContainer::const_iterator it;
 
 2812           for(it = sfgPID->GetAlternates().begin(); 
 
 2813               it != sfgPID->GetAlternates().end(); it++){
 
 2814             ND::THandle<ND::TReconPID> alter = *it;
 
 2816               if(alter->GetParticleId() == ND::TReconPID::kProton){
 
 2817                 ParticleIds.push_back(2212);
 
 2818                 PIDWeights.push_back(alter->GetPIDWeight());
 
 2820               else if(alter->GetParticleId() == ND::TReconPID::kPion){
 
 2821                 ParticleIds.push_back(211);
 
 2822                 PIDWeights.push_back(alter->GetPIDWeight());
 
 2824               else if(alter->GetParticleId() == ND::TReconPID::kMuon){
 
 2825                 ParticleIds.push_back(13);
 
 2826                 PIDWeights.push_back(alter->GetPIDWeight());
 
 2828               else if(alter->GetParticleId() == ND::TReconPID::kEM){
 
 2829                 ParticleIds.push_back(11);
 
 2830                 PIDWeights.push_back(alter->GetPIDWeight());
 
 2834               if(alter->GetParticleId() == ND::TReconPID::kHeavyTrack){
 
 2835                 ParticleIds.push_back(2212);
 
 2836                 PIDWeights.push_back(alter->GetPIDWeight());                
 
 2838               else if(alter->GetParticleId() == ND::TReconPID::kLightTrack){
 
 2839                 ParticleIds.push_back(211);
 
 2840                 PIDWeights.push_back(alter->GetPIDWeight());  
 
 2841                 ParticleIds.push_back(13);
 
 2842                 PIDWeights.push_back(alter->GetPIDWeight());               
 
 2844               else if(alter->GetParticleId() == ND::TReconPID::kEM){
 
 2845                 ParticleIds.push_back(11);
 
 2846                 PIDWeights.push_back(alter->GetPIDWeight());                
 
 2851           for(
unsigned int hypo = 0; hypo < ParticleIds.size(); hypo++){
 
 2852             if(ParticleIds[hypo] == 2212)
 
 2854             else if(ParticleIds[hypo] == 211)
 
 2856             else if(ParticleIds[hypo] == 13)
 
 2858             else if(ParticleIds[hypo] == 11)
 
 2864           ND::THandle<ND::TTrackState> trackState = sfgTrack->GetState();
 
 2865           sfg->
Position      = trackState->GetPosition();
 
 2866           sfg->
PosVariance   = trackState->GetPositionVariance();
 
 2867           sfg->
Direction     = trackState->GetDirection();
 
 2868           sfg->
DirVariance   = trackState->GetDirectionVariance();
 
 2869           sfg->
EDeposit      = trackState->GetEDeposit();
 
 2870         }
else if(sfgCluster){
 
 2873           sfg->
Position      = sfgCluster->GetPosition();
 
 2874           sfg->
PosVariance   = sfgCluster->GetPositionVariance();
 
 2875           sfg->
EDeposit      = sfgCluster->GetEDeposit();
 
 2878         ND::THandle<ND::TRealDatum> sfgTimeRD =
 
 2879         sfgObject->Get<ND::TRealDatum>(
"averageHitTime");
 
 2881             sfg->
avgtime = sfgTimeRD->GetValue();
 
 2897   ND::THandle<ND::TAlgorithmResult> sfgRecon = 
event.GetFit(
"sfgRecon");
 
 2898   if (!sfgRecon) 
return;
 
 2900   ND::THandle<ND::TReconObjectContainer> 
 
 2901     sfgObjects = sfgRecon->GetResultsContainer(
"final");
 
 2902   if (!sfgObjects) 
return;
 
 2905   ND::TReconObjectContainer::iterator it;
 
 2906   for (it = sfgObjects->begin();
 
 2907        it != sfgObjects->end(); it++){
 
 2908     ND::THandle<ND::TReconBase> 
object = *it;
 
 2909     if (!
object) 
continue;
 
 2910     ND::THandle<ND::TReconCluster> cluster = object;
 
 2911     ND::THandle<ND::TReconVertex>  vertex  = object;
 
 2912     if(!cluster && ! vertex) 
continue; 
 
 2927         ND::THandle<ND::TReconState> tstate = 
object->GetState();
 
 2928       } 
catch (ND::EReconObject 
const& e)
 
 2930         std::cout << 
"TReconBase with no state. Skip object !!" << std::endl;
 
 2938       globalObject->
UniqueID = 
object->GetUniqueID();
 
 2945       globalObject->
Charge   = TrackingUtils::GetCharge(
object);
 
 2946       globalObject->
EDeposit = TrackingUtils::GetEDeposit(
object);
 
 2948       globalObject->
Status   = 
object->CheckStatus(object->kSuccess);
 
 2949       globalObject->
Chi2     = 
object->GetQuality();
 
 2950       globalObject->
NDOF     = 
object->GetNDOF();
 
 2951       globalObject->
NNodes   = 0;
 
 2954       if (object->GetHits()) 
 
 2955         globalObject->
NHits = object->GetHits()->size();
 
 2958       if (object->GetHits()){
 
 2959 #ifdef FILL_ALL_GLOBAL_HITS 
 2971       ND::THandle<ND::THitSelection> tbHits = 
object->GetHits();
 
 2973         for (ND::THitSelection::iterator hit = tbHits->begin();
 
 2974              hit != tbHits->end(); hit++) {
 
 2976           TVector3 pos = (*hit)->GetPosition();
 
 2977           TLorentzVector hitpos = TLorentzVector(
 
 2978             pos[0],pos[1],pos[2],(*hit)->GetTime());
 
 2980           sfg->
HitCharge  .push_back((*hit)->GetCharge());
 
 2981           ND::THitSelection thisHit;
 
 2982           thisHit.push_back(*hit);
 
 2984             TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 2988       ND::THandle<ND::TReconCluster> sfgCluster = object;
 
 2990         sfg->
Position      = sfgCluster->GetPosition();
 
 2991         sfg->
PosVariance   = sfgCluster->GetPositionVariance();
 
 2992         sfg->
EDeposit      = sfgCluster->GetEDeposit();
 
 2998       ND::THandle<ND::TRealDatum> sfgTimeRD =
 
 2999         object->Get<ND::TRealDatum>(
"averageHitTime");
 
 3001         sfg->
avgtime = sfgTimeRD->GetValue();
 
 3012       ND::THandle<ND::TVertexState> vstate = vertex->GetState();
 
 3013       if (!vstate) 
continue;
 
 3022       gVertex->
Position      = vstate->GetPosition();
 
 3023       gVertex->
Variance      = vstate->GetPositionVariance();
 
 3025       gVertex->
Status        = vertex->GetStatus();
 
 3026       gVertex->
Quality       = vertex->GetQuality();
 
 3027       gVertex->
NDOF          = vertex->GetNDOF();
 
 3029       ND::THandle<ND::TReconObjectContainer> tracksAssociated 
 
 3030         = vertex->GetConstituents();
 
 3031       if (tracksAssociated->size() == 0) 
continue;
 
 3032       std::map<ND::THandle<ND::TReconBase>,
 
 3033       ND::THandle<ND::TReconObjectContainer>>::iterator cit;
 
 3035       ND::TReconObjectContainer::iterator assocIter;
 
 3036       for (assocIter = tracksAssociated->begin();
 
 3037            assocIter != tracksAssociated->end(); assocIter++){
 
 3039         if (ND::THandle<ND::TReconVertex> vtxDummy = (*assocIter)) 
continue;
 
 3042         ND::THandle<ND::TReconBase> track = *assocIter;
 
 3043         if (!track) 
continue;
 
 3044         ND::THandle<ND::TReconState> frontState, backState;
 
 3045         ND::tman().GetFirstAndLastStates(track, frontState, backState);
 
 3046         if (!frontState || !backState) 
continue;
 
 3047         TLorentzVector fpos = TrackingUtils::GetPosition(frontState);
 
 3048         TLorentzVector bpos = TrackingUtils::GetPosition(backState);
 
 3051         std::map<ND::THandle<ND::TReconBase>, 
int>::iterator mapIt;
 
 3053           if (!mapIt->first) 
continue;
 
 3056           if(!((mapIt->first)->UsesDetector(det))) 
continue;
 
 3057           ND::THandle<ND::TReconBase> sfgSeg =
 
 3058             ReconObjectUtils::GetConstituentInDetector(mapIt->first, det);
 
 3059           ND::THandle<ND::TReconState> frontTemp, backTemp;
 
 3060           ND::tman().GetFirstAndLastStates(sfgSeg, frontTemp, backTemp);
 
 3061           if (!frontTemp || !backTemp) 
continue;
 
 3062           TLorentzVector fpos_tmp = TrackingUtils::GetPosition(frontTemp);
 
 3063           TLorentzVector bpos_tmp = TrackingUtils::GetPosition(backTemp);
 
 3065           if((fpos.Vect()==fpos_tmp.Vect() && bpos.Vect()==bpos_tmp.Vect()) ||
 
 3066              (fpos.Vect()==bpos_tmp.Vect() && bpos.Vect()==fpos_tmp.Vect())){
 
 3067             inMap = 
true; 
break;
 
 3070         if(!inMap) 
continue;
 
 3072         int GlobalPIDIndex = mapIt->second;
 
 3077         vConst->
Charge = (int)TrackingUtils::GetCharge(track);
 
 3078         vConst->
Quality = track->GetQuality();
 
 3079         double   mom  = TrackingUtils::GetMomentum(frontState);
 
 3080         TVector3 mdir = TrackingUtils::GetDirection(frontState);
 
 3083         vConst->
PID = GlobalPIDIndex;
 
 3099     ND::THandle<ND::TReconBase> newFgdIso =
 
 3108     for (
int i = 0; i < 2; i++) {
 
 3109         if (!object->UsesDetector(dets[i])) 
continue;
 
 3111         ND::TReconObjectContainer fgdObjects;
 
 3114         if (TrackingUtils::GetCurvBackTrack(*
object)) {
 
 3116             ReconObjectUtils::GetAllConstituentsInDetector(
object, dets[i]);
 
 3120             ND::THandle<ND::TReconBase> fgdConst =
 
 3121             ReconObjectUtils::GetConstituentInDetector(
object, dets[i]);
 
 3122             if (fgdConst) fgdObjects.push_back(fgdConst);
 
 3125         if (fgdObjects.size() == 0) 
continue;
 
 3127         for (ND::TReconObjectContainer::iterator iter = fgdObjects.begin();
 
 3128             iter != fgdObjects.end(); iter++) {
 
 3129         ND::THandle<ND::TReconBase> fgdObject = *iter;
 
 3136             ND::THandle<ND::THitSelection> tbHits = fgdObject->GetHits();
 
 3138                 for (ND::THitSelection::iterator hit = tbHits->begin();
 
 3139                     hit != tbHits->end(); hit++) {
 
 3141                 TVector3 pos = (*hit)->GetPosition();
 
 3142                 int layer = ND::TGeomInfo::FGD().ActivePlane(pos.Z());
 
 3147                 ND::THitSelection thisHit;
 
 3148                 thisHit.push_back(*hit);
 
 3150                     TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 3160             const ND::TReconNodeContainer& nodeCont = fgdObject->GetNodes();
 
 3161             ND::TReconNodeContainer::const_iterator it_node;
 
 3162             for(it_node = nodeCont.begin(); it_node != nodeCont.end(); ++it_node){
 
 3164               if(!(*it_node)) 
continue;
 
 3167               TLorentzVector pos_temp(-999,-999,-999,-999);
 
 3168               double edepo_temp = -999;
 
 3170               const ND::THandle<ND::TReconNode> node = *it_node;
 
 3172               ND::THandle<ND::TReconState> node_state = node->GetState();
 
 3175                 pos_temp = ND::TReconStateUtilities::GetPosition(node_state);
 
 3178               ND::THandle<ND::TReconBase> node_object = node->GetObject();
 
 3180                 ND::THandle<ND::TReconState> object_state = node_object->GetState();
 
 3182                   edepo_temp = ND::TPIDState::GetStateEDeposit(object_state);
 
 3188                   edepo_temp = node_state->GetValue(node_state->GetEDepositIndex());
 
 3201             ND::THandle<ND::TRealDatum> fgdTimeRD =
 
 3202             fgdObject->Get<ND::TRealDatum>(
"averageHitTime");
 
 3204                 fgd->
avgtime = fgdTimeRD->GetValue();
 
 3211             ND::THandle<ND::TReconPID>   pid   = fgdObject;
 
 3212             ND::THandle<ND::TReconTrack> track = fgdObject; 
 
 3214                 fgd->
TrueE = pidUtils::GetTruthEDep(pid);
 
 3217                 fgd->
TrueE = pidUtils::GetTruthEDep(track);  
 
 3222             for (
int ilayer = 0; ilayer < 30; ilayer++) {
 
 3226             std::map<int, double> chargeMap;
 
 3227             if (fgdUtils::GetChargeByLayers(fgdObject->GetHits(), chargeMap)) {
 
 3228                 for (std::map<int, double>::iterator it = chargeMap.begin();
 
 3229                     it != chargeMap.end(); it++) {
 
 3230                 int layer = (*it).first;
 
 3237             std::map<int, double> chargeMapAC;
 
 3238             if (fgdUtils::GetFibreCorrectedChargeByLayersReconFit(
 
 3239                 fgdObject->GetHits(), fgdObject, chargeMapAC)) {
 
 3240             for (std::map<int, double>::iterator it = chargeMapAC.begin();
 
 3241                 it != chargeMapAC.end(); it++) {
 
 3242             int layer = (*it).first;
 
 3252                 ND::THandle<ND::TIntegerDatum> RD_geomFC =
 
 3253                 fgdObject->Get<ND::TIntegerDatum>(
"fgdPidPar_geomFC");
 
 3260                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_E =
 
 3261                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_E");
 
 3263                 if (RD_fgdPidPar_E) {
 
 3264                     fgd->
E = RD_fgdPidPar_E->GetValue();
 
 3266                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_x =
 
 3267                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_x");
 
 3269                 if (RD_fgdPidPar_x) {
 
 3270                     fgd->
x = RD_fgdPidPar_x->GetValue();
 
 3274                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_E_exp_EvsXPull_Muon =
 
 3275                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_E_exp_EvsXPull_Muon");
 
 3277                 if (RD_fgdPidPar_E_exp_EvsXPull_Muon) {
 
 3278                     fgd->
E_exp_muon = RD_fgdPidPar_E_exp_EvsXPull_Muon->GetValue();
 
 3280                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_E_exp_EvsXPull_Pion =
 
 3281                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_E_exp_EvsXPull_Pion");
 
 3283                 if (RD_fgdPidPar_E_exp_EvsXPull_Pion) {
 
 3284                     fgd->
E_exp_pion = RD_fgdPidPar_E_exp_EvsXPull_Pion->GetValue();
 
 3286                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_E_exp_EvsXPull_Proton =
 
 3287                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_E_exp_EvsXPull_Proton");
 
 3289                 if (RD_fgdPidPar_E_exp_EvsXPull_Proton) {
 
 3290                     fgd->
E_exp_proton = RD_fgdPidPar_E_exp_EvsXPull_Proton->GetValue();
 
 3292                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_E_exp_EvsXPull_Electron =
 
 3293                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_E_exp_EvsXPull_Electron");
 
 3295                 if (RD_fgdPidPar_E_exp_EvsXPull_Electron) {
 
 3297                     RD_fgdPidPar_E_exp_EvsXPull_Electron->GetValue();
 
 3301                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_error_EvsXPull_Muon =
 
 3302                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_error_EvsXPull_Muon");
 
 3304                 if (RD_fgdPidPar_error_EvsXPull_Muon) {
 
 3305                     fgd->
sigmaE_muon = RD_fgdPidPar_error_EvsXPull_Muon->GetValue();
 
 3307                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_error_EvsXPull_Pion =
 
 3308                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_error_EvsXPull_Pion");
 
 3310                 if (RD_fgdPidPar_error_EvsXPull_Pion) {
 
 3311                     fgd->
sigmaE_pion = RD_fgdPidPar_error_EvsXPull_Pion->GetValue();
 
 3313                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_error_EvsXPull_Proton =
 
 3314                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_error_EvsXPull_Proton");
 
 3316                 if (RD_fgdPidPar_error_EvsXPull_Proton) {
 
 3317                     fgd->
sigmaE_proton = RD_fgdPidPar_error_EvsXPull_Proton->GetValue();
 
 3319                 ND::THandle<ND::TRealDatum> RD_fgdPidPar_error_EvsXPull_Electron =
 
 3320                 fgdObject->Get<ND::TRealDatum>(
"fgdPidPar_error_EvsXPull_Electron");
 
 3322                 if (RD_fgdPidPar_error_EvsXPull_Electron) {
 
 3324                     RD_fgdPidPar_error_EvsXPull_Electron->GetValue();
 
 3328                 ND::THandle<ND::TRealDatum> RD_fgdPidWgt_EvsXPull_Muon =
 
 3329                 fgdObject->Get<ND::TRealDatum>(
"fgdPidWgt_EvsXPull_Muon");
 
 3331                 if (RD_fgdPidWgt_EvsXPull_Muon) {
 
 3332                     fgd->
PullMuon = RD_fgdPidWgt_EvsXPull_Muon->GetValue();
 
 3334                 ND::THandle<ND::TRealDatum> RD_fgdPidWgt_EvsXPull_Pion =
 
 3335                 fgdObject->Get<ND::TRealDatum>(
"fgdPidWgt_EvsXPull_Pion");
 
 3337                 if (RD_fgdPidWgt_EvsXPull_Pion) {
 
 3338                     fgd->
PullPion = RD_fgdPidWgt_EvsXPull_Pion->GetValue();
 
 3340                 ND::THandle<ND::TRealDatum> RD_fgdPidWgt_EvsXPull_Proton =
 
 3341                 fgdObject->Get<ND::TRealDatum>(
"fgdPidWgt_EvsXPull_Proton");
 
 3343                 if (RD_fgdPidWgt_EvsXPull_Proton) {
 
 3344                     fgd->
PullProton = RD_fgdPidWgt_EvsXPull_Proton->GetValue();
 
 3346                 ND::THandle<ND::TRealDatum> RD_fgdPidWgt_EvsXPull_Electron =
 
 3347                 fgdObject->Get<ND::TRealDatum>(
"fgdPidWgt_EvsXPull_Electron");
 
 3349                 if (RD_fgdPidWgt_EvsXPull_Electron) {
 
 3350                     fgd->
PullElectron = RD_fgdPidWgt_EvsXPull_Electron->GetValue();
 
 3352                 ND::THandle<ND::TRealDatum> RD_fgdPidWgt_EvsXPull_NotSet =
 
 3353                 fgdObject->Get<ND::TRealDatum>(
"fgdPidWgt_EvsXPull_NotSet");
 
 3355                 if (RD_fgdPidWgt_EvsXPull_NotSet) {
 
 3356                     fgd->
PullNotSet = RD_fgdPidWgt_EvsXPull_NotSet->GetValue();
 
 3365                     ND::THandle<ND::TRealDatum> RD_fgdVA_FgdN;
 
 3366                     RD_fgdVA_FgdN = 
object->Get<ND::TRealDatum>(
"fgdVA_FgdN");
 
 3367                     if (RD_fgdVA_FgdN) {
 
 3368                         fgdNum = int(RD_fgdVA_FgdN->GetValue());
 
 3372                     if (fgdNum == i) fgd->
isFgdVA = 1;
 
 3374                     ND::THandle<ND::TRealDatum> RD_fgdVA_flag;
 
 3375                     RD_fgdVA_flag = 
object->Get<ND::TRealDatum>(
"fgdVA_flag");
 
 3376                     if (RD_fgdVA_flag && i == fgdNum) {
 
 3381                     ND::THandle<ND::TRealDatum> RD_globpassVA_flag;
 
 3382                     RD_globpassVA_flag = 
object->Get<ND::TRealDatum>(
"globpassVA_flag");
 
 3383                     if (RD_globpassVA_flag && i == fgdNum) {
 
 3388                     ND::THandle<ND::TRealDatum> RD_fgdVA_upMinZ;
 
 3389                     RD_fgdVA_upMinZ = 
object->Get<ND::TRealDatum>(
"fgdVA_upMinZ");
 
 3390                     if (RD_fgdVA_upMinZ && i == fgdNum) {
 
 3395                     ND::THandle<ND::TRealDatum> RD_fgdVA_downMaxZ;
 
 3396                     RD_fgdVA_downMaxZ = 
object->Get<ND::TRealDatum>(
"fgdVA_downMaxZ");
 
 3397                     if (RD_fgdVA_downMaxZ && i == fgdNum) {
 
 3402                     ND::THandle<ND::TRealDatum> RD_fgdVA_upCosTheta;
 
 3403                     RD_fgdVA_upCosTheta = 
object->Get<ND::TRealDatum>(
"fgdVA_upCosTheta");
 
 3404                     if (RD_fgdVA_upCosTheta && i == fgdNum) {
 
 3409                     ND::THandle<ND::TRealDatum> RD_fgdVA_downCosTheta;
 
 3410                     RD_fgdVA_downCosTheta =
 
 3411                     object->Get<ND::TRealDatum>(
"fgdVA_downCosTheta");
 
 3412                     if (RD_fgdVA_downCosTheta && i == fgdNum) {
 
 3417                     ND::THandle<ND::TRealDatum> RD_fgdVA_otherUpQ;
 
 3418                     RD_fgdVA_otherUpQ = 
object->Get<ND::TRealDatum>(
"fgdVA_otherUpQ");
 
 3419                     if (RD_fgdVA_otherUpQ && i == fgdNum) {
 
 3424                     ND::THandle<ND::TRealDatum> RD_fgdVA_otherDownQ;
 
 3425                     RD_fgdVA_otherDownQ = 
object->Get<ND::TRealDatum>(
"fgdVA_otherDownQ");
 
 3426                     if (RD_fgdVA_otherDownQ && i == fgdNum) {
 
 3431                     ND::THandle<ND::TRealDatum> RD_fgdVA_verQ;
 
 3432                     RD_fgdVA_verQ = 
object->Get<ND::TRealDatum>(
"fgdVA_verQ");
 
 3433                     if (RD_fgdVA_verQ && i == fgdNum) {
 
 3438                     ND::THandle<ND::TRealDatum> RD_fgdVA_verLayQ;
 
 3439                     RD_fgdVA_verLayQ = 
object->Get<ND::TRealDatum>(
"fgdVA_verLayQ");
 
 3440                     if (RD_fgdVA_verLayQ && i == fgdNum) {
 
 3445                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNearQ;
 
 3446                     RD_fgdVA_verNearQ = 
object->Get<ND::TRealDatum>(
"fgdVA_verNearQ");
 
 3447                     if (RD_fgdVA_verNearQ && i == fgdNum) {
 
 3452                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNearQ;
 
 3453                     RD_fgdVA_verNextNearQ =
 
 3454                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNearQ");
 
 3455                     if (RD_fgdVA_verNextNearQ && i == fgdNum) {
 
 3460                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNextNearQ;
 
 3461                     RD_fgdVA_verNextNextNearQ =
 
 3462                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNextNearQ");
 
 3463                     if (RD_fgdVA_verNextNextNearQ && i == fgdNum) {
 
 3468                     ND::THandle<ND::TRealDatum> RD_fgdVA_totalQ;
 
 3469                     RD_fgdVA_totalQ = 
object->Get<ND::TRealDatum>(
"fgdVA_totalQ");
 
 3470                     if (RD_fgdVA_totalQ && i == fgdNum) {
 
 3475                     ND::THandle<ND::TRealDatum> RD_fgdVA_totalCorrE;
 
 3476                     RD_fgdVA_totalCorrE = 
object->Get<ND::TRealDatum>(
"fgdVA_totalCorrE");
 
 3477                     if (RD_fgdVA_totalCorrE && i == fgdNum) {
 
 3485                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNearQ_rect;
 
 3486                     RD_fgdVA_verNearQ_rect =
 
 3487                     object->Get<ND::TRealDatum>(
"fgdVA_verNearQ_rect");
 
 3488                     if (RD_fgdVA_verNearQ_rect && i == fgdNum) {
 
 3494                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNearQ_rect;
 
 3495                     RD_fgdVA_verNextNearQ_rect =
 
 3496                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNearQ_rect");
 
 3497                     if (RD_fgdVA_verNextNearQ_rect && i == fgdNum) {
 
 3499                         RD_fgdVA_verNextNearQ_rect->GetValue();
 
 3504                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNextNearQ_rect;
 
 3505                     RD_fgdVA_verNextNextNearQ_rect =
 
 3506                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNextNearQ_rect");
 
 3507                     if (RD_fgdVA_verNextNextNearQ_rect && i == fgdNum) {
 
 3509                         RD_fgdVA_verNextNextNearQ_rect->GetValue();
 
 3516                     ND::THandle<ND::TRealDatum> RD_fgdEA_FgdN;
 
 3517                     RD_fgdEA_FgdN = 
object->Get<ND::TRealDatum>(
"fgdEA_FgdN");
 
 3518                     if (RD_fgdEA_FgdN) {
 
 3519                         fgdNum = int(RD_fgdEA_FgdN->GetValue());
 
 3523                     if (fgdNum == i) fgd->
isFgdEA = 1;
 
 3525                     ND::THandle<ND::TRealDatum> RD_fgdEA_flag;
 
 3526                     RD_fgdEA_flag = 
object->Get<ND::TRealDatum>(
"fgdEA_flag");
 
 3527                     if (RD_fgdEA_flag && i == fgdNum) {
 
 3532                     ND::THandle<ND::TRealDatum> RD_globpassEA_flag;
 
 3533                     RD_globpassEA_flag = 
object->Get<ND::TRealDatum>(
"globpassEA_flag");
 
 3534                     if (RD_globpassEA_flag && i == fgdNum) {
 
 3539                     ND::THandle<ND::TRealDatum> RD_fgdEA_otherUpQ;
 
 3540                     RD_fgdEA_otherUpQ = 
object->Get<ND::TRealDatum>(
"fgdEA_otherUpQ");
 
 3541                     if (RD_fgdEA_otherUpQ && i == fgdNum) {
 
 3546                     ND::THandle<ND::TRealDatum> RD_fgdEA_otherDownQ;
 
 3547                     RD_fgdEA_otherDownQ = 
object->Get<ND::TRealDatum>(
"fgdEA_otherDownQ");
 
 3548                     if (RD_fgdEA_otherDownQ && i == fgdNum) {
 
 3553                     ND::THandle<ND::TRealDatum> RD_fgdEA_verQ;
 
 3554                     RD_fgdEA_verQ = 
object->Get<ND::TRealDatum>(
"fgdEA_verQ");
 
 3555                     if (RD_fgdEA_verQ && i == fgdNum) {
 
 3560                     ND::THandle<ND::TRealDatum> RD_fgdEA_verLayQ;
 
 3561                     RD_fgdEA_verLayQ = 
object->Get<ND::TRealDatum>(
"fgdEA_verLayQ");
 
 3562                     if (RD_fgdEA_verLayQ && i == fgdNum) {
 
 3567                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNearQ;
 
 3568                     RD_fgdEA_verNearQ = 
object->Get<ND::TRealDatum>(
"fgdEA_verNearQ");
 
 3569                     if (RD_fgdEA_verNearQ && i == fgdNum) {
 
 3574                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNearQ;
 
 3575                     RD_fgdEA_verNextNearQ =
 
 3576                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNearQ");
 
 3577                     if (RD_fgdEA_verNextNearQ && i == fgdNum) {
 
 3582                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNextNearQ;
 
 3583                     RD_fgdEA_verNextNextNearQ =
 
 3584                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNextNearQ");
 
 3585                     if (RD_fgdEA_verNextNextNearQ && i == fgdNum) {
 
 3591                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNearQ_rect;
 
 3592                     RD_fgdEA_verNearQ_rect =
 
 3593                     object->Get<ND::TRealDatum>(
"fgdEA_verNearQ_rect");
 
 3594                     if (RD_fgdEA_verNearQ_rect && i == fgdNum) {
 
 3600                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNearQ_rect;
 
 3601                     RD_fgdEA_verNextNearQ_rect =
 
 3602                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNearQ_rect");
 
 3603                     if (RD_fgdEA_verNextNearQ_rect && i == fgdNum) {
 
 3605                         RD_fgdEA_verNextNearQ_rect->GetValue();
 
 3610                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNextNearQ_rect;
 
 3611                     RD_fgdEA_verNextNextNearQ_rect =
 
 3612                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNextNearQ_rect");
 
 3613                     if (RD_fgdEA_verNextNextNearQ_rect && i == fgdNum) {
 
 3615                         RD_fgdEA_verNextNextNearQ_rect->GetValue();
 
 3625                     ND::THandle<ND::TRealDatum> RD_fgdVA_FgdN_FGD2;
 
 3626                     RD_fgdVA_FgdN_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdVA_FgdN_FGD2");
 
 3627                     if (RD_fgdVA_FgdN_FGD2) {
 
 3628                         fgdNum = int(RD_fgdVA_FgdN_FGD2->GetValue());
 
 3632                     if (fgdNum == i) fgd->
isFgdVA = 1;
 
 3634                     ND::THandle<ND::TRealDatum> RD_fgdVA_flag_FGD2;
 
 3635                     RD_fgdVA_flag_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdVA_flag_FGD2");
 
 3636                     if (RD_fgdVA_flag_FGD2 && i == fgdNum) {
 
 3637                         fgd->
isFgdVA_flag = int(RD_fgdVA_flag_FGD2->GetValue());
 
 3641                     ND::THandle<ND::TRealDatum> RD_globpassVA_flag_FGD2;
 
 3642                     RD_globpassVA_flag_FGD2 =
 
 3643                     object->Get<ND::TRealDatum>(
"globpassVA_flag_FGD2");
 
 3644                     if (RD_globpassVA_flag_FGD2 && i == fgdNum) {
 
 3649                     ND::THandle<ND::TRealDatum> RD_fgdVA_upMinZ_FGD2;
 
 3650                     RD_fgdVA_upMinZ_FGD2 =
 
 3651                     object->Get<ND::TRealDatum>(
"fgdVA_upMinZ_FGD2");
 
 3652                     if (RD_fgdVA_upMinZ_FGD2 && i == fgdNum) {
 
 3657                     ND::THandle<ND::TRealDatum> RD_fgdVA_downMaxZ_FGD2;
 
 3658                     RD_fgdVA_downMaxZ_FGD2 =
 
 3659                     object->Get<ND::TRealDatum>(
"fgdVA_downMaxZ_FGD2");
 
 3660                     if (RD_fgdVA_downMaxZ_FGD2 && i == fgdNum) {
 
 3665                     ND::THandle<ND::TRealDatum> RD_fgdVA_upCosTheta_FGD2;
 
 3666                     RD_fgdVA_upCosTheta_FGD2 =
 
 3667                     object->Get<ND::TRealDatum>(
"fgdVA_upCosTheta_FGD2");
 
 3668                     if (RD_fgdVA_upCosTheta_FGD2 && i == fgdNum) {
 
 3673                     ND::THandle<ND::TRealDatum> RD_fgdVA_downCosTheta_FGD2;
 
 3674                     RD_fgdVA_downCosTheta_FGD2 =
 
 3675                     object->Get<ND::TRealDatum>(
"fgdVA_downCosTheta_FGD2");
 
 3676                     if (RD_fgdVA_downCosTheta_FGD2 && i == fgdNum) {
 
 3681                     ND::THandle<ND::TRealDatum> RD_fgdVA_otherUpQ_FGD2;
 
 3682                     RD_fgdVA_otherUpQ_FGD2 =
 
 3683                     object->Get<ND::TRealDatum>(
"fgdVA_otherUpQ_FGD2");
 
 3684                     if (RD_fgdVA_otherUpQ_FGD2 && i == fgdNum) {
 
 3689                     ND::THandle<ND::TRealDatum> RD_fgdVA_otherDownQ_FGD2;
 
 3690                     RD_fgdVA_otherDownQ_FGD2 =
 
 3691                     object->Get<ND::TRealDatum>(
"fgdVA_otherDownQ_FGD2");
 
 3692                     if (RD_fgdVA_otherDownQ_FGD2 && i == fgdNum) {
 
 3697                     ND::THandle<ND::TRealDatum> RD_fgdVA_verQ_FGD2;
 
 3698                     RD_fgdVA_verQ_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdVA_verQ_FGD2");
 
 3699                     if (RD_fgdVA_verQ_FGD2 && i == fgdNum) {
 
 3700                         fgd->
fgdVA_verQ = RD_fgdVA_verQ_FGD2->GetValue();
 
 3704                     ND::THandle<ND::TRealDatum> RD_fgdVA_verLayQ_FGD2;
 
 3705                     RD_fgdVA_verLayQ_FGD2 =
 
 3706                     object->Get<ND::TRealDatum>(
"fgdVA_verLayQ_FGD2");
 
 3707                     if (RD_fgdVA_verLayQ_FGD2 && i == fgdNum) {
 
 3712                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNearQ_FGD2;
 
 3713                     RD_fgdVA_verNearQ_FGD2 =
 
 3714                     object->Get<ND::TRealDatum>(
"fgdVA_verNearQ_FGD2");
 
 3715                     if (RD_fgdVA_verNearQ_FGD2 && i == fgdNum) {
 
 3720                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNearQ_FGD2;
 
 3721                     RD_fgdVA_verNextNearQ_FGD2 =
 
 3722                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNearQ_FGD2");
 
 3723                     if (RD_fgdVA_verNextNearQ_FGD2 && i == fgdNum) {
 
 3728                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNextNearQ_FGD2;
 
 3729                     RD_fgdVA_verNextNextNearQ_FGD2 =
 
 3730                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNextNearQ_FGD2");
 
 3731                     if (RD_fgdVA_verNextNextNearQ_FGD2 && i == fgdNum) {
 
 3733                         RD_fgdVA_verNextNextNearQ_FGD2->GetValue();
 
 3737                     ND::THandle<ND::TRealDatum> RD_fgdVA_totalQ_FGD2;
 
 3738                     RD_fgdVA_totalQ_FGD2 =
 
 3739                     object->Get<ND::TRealDatum>(
"fgdVA_totalQ_FGD2");
 
 3740                     if (RD_fgdVA_totalQ_FGD2 && i == fgdNum) {
 
 3745                     ND::THandle<ND::TRealDatum> RD_fgdVA_totalCorrE_FGD2;
 
 3746                     RD_fgdVA_totalCorrE_FGD2 =
 
 3747                     object->Get<ND::TRealDatum>(
"fgdVA_totalCorrE_FGD2");
 
 3748                     if (RD_fgdVA_totalCorrE_FGD2 && i == fgdNum) {
 
 3757                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNearQ_FGD2_rect;
 
 3758                     RD_fgdVA_verNearQ_FGD2_rect =
 
 3759                     object->Get<ND::TRealDatum>(
"fgdVA_verNearQ_FGD2_rect");
 
 3760                     if (RD_fgdVA_verNearQ_FGD2_rect && i == fgdNum) 
 
 3767                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNearQ_FGD2_rect;
 
 3768                     RD_fgdVA_verNextNearQ_FGD2_rect =
 
 3769                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNearQ_FGD2_rect");
 
 3770                     if (RD_fgdVA_verNextNearQ_FGD2_rect && i == fgdNum) {
 
 3772                         RD_fgdVA_verNextNearQ_FGD2_rect->GetValue();
 
 3777                     ND::THandle<ND::TRealDatum> RD_fgdVA_verNextNextNearQ_FGD2_rect;
 
 3778                     RD_fgdVA_verNextNextNearQ_FGD2_rect =
 
 3779                     object->Get<ND::TRealDatum>(
"fgdVA_verNextNextNearQ_FGD2_rect");
 
 3780                     if (RD_fgdVA_verNextNextNearQ_FGD2_rect && i == fgdNum) {
 
 3782                         RD_fgdVA_verNextNextNearQ_FGD2_rect->GetValue();
 
 3789                     ND::THandle<ND::TRealDatum> RD_fgdEA_FgdN_FGD2;
 
 3790                     RD_fgdEA_FgdN_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdEA_FgdN_FGD2");
 
 3791                     if (RD_fgdEA_FgdN_FGD2) {
 
 3792                         fgdNum = int(RD_fgdEA_FgdN_FGD2->GetValue());
 
 3796                     if (fgdNum == i) fgd->
isFgdEA = 1;
 
 3798                     ND::THandle<ND::TRealDatum> RD_fgdEA_flag_FGD2;
 
 3799                     RD_fgdEA_flag_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdEA_flag_FGD2");
 
 3800                     if (RD_fgdEA_flag_FGD2 && i == fgdNum) {
 
 3801                         fgd->
isFgdEA_flag = int(RD_fgdEA_flag_FGD2->GetValue());
 
 3805                     ND::THandle<ND::TRealDatum> RD_globpassEA_flag_FGD2;
 
 3806                     RD_globpassEA_flag_FGD2 =
 
 3807                     object->Get<ND::TRealDatum>(
"globpassEA_flag_FGD2");
 
 3808                     if (RD_globpassEA_flag_FGD2 && i == fgdNum) {
 
 3813                     ND::THandle<ND::TRealDatum> RD_fgdEA_otherUpQ_FGD2;
 
 3814                     RD_fgdEA_otherUpQ_FGD2 =
 
 3815                     object->Get<ND::TRealDatum>(
"fgdEA_otherUpQ_FGD2");
 
 3816                     if (RD_fgdEA_otherUpQ_FGD2 && i == fgdNum) {
 
 3821                     ND::THandle<ND::TRealDatum> RD_fgdEA_otherDownQ_FGD2;
 
 3822                     RD_fgdEA_otherDownQ_FGD2 =
 
 3823                     object->Get<ND::TRealDatum>(
"fgdEA_otherDownQ_FGD2");
 
 3824                     if (RD_fgdEA_otherDownQ_FGD2 && i == fgdNum) {
 
 3829                     ND::THandle<ND::TRealDatum> RD_fgdEA_verQ_FGD2;
 
 3830                     RD_fgdEA_verQ_FGD2 = 
object->Get<ND::TRealDatum>(
"fgdEA_verQ_FGD2");
 
 3831                     if (RD_fgdEA_verQ_FGD2 && i == fgdNum) {
 
 3832                         fgd->
fgdEA_verQ = RD_fgdEA_verQ_FGD2->GetValue();
 
 3836                     ND::THandle<ND::TRealDatum> RD_fgdEA_verLayQ_FGD2;
 
 3837                     RD_fgdEA_verLayQ_FGD2 =
 
 3838                     object->Get<ND::TRealDatum>(
"fgdEA_verLayQ_FGD2");
 
 3839                     if (RD_fgdEA_verLayQ_FGD2 && i == fgdNum) {
 
 3844                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNearQ_FGD2;
 
 3845                     RD_fgdEA_verNearQ_FGD2 =
 
 3846                     object->Get<ND::TRealDatum>(
"fgdEA_verNearQ_FGD2");
 
 3847                     if (RD_fgdEA_verNearQ_FGD2 && i == fgdNum) {
 
 3852                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNearQ_FGD2;
 
 3853                     RD_fgdEA_verNextNearQ_FGD2 =
 
 3854                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNearQ_FGD2");
 
 3855                     if (RD_fgdEA_verNextNearQ_FGD2 && i == fgdNum) {
 
 3860                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNextNearQ_FGD2;
 
 3861                     RD_fgdEA_verNextNextNearQ_FGD2 =
 
 3862                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNextNearQ_FGD2");
 
 3863                     if (RD_fgdEA_verNextNextNearQ_FGD2 && i == fgdNum) {
 
 3865                         RD_fgdEA_verNextNextNearQ_FGD2->GetValue();
 
 3870                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNearQ_FGD2_rect;
 
 3871                     RD_fgdEA_verNearQ_FGD2_rect =
 
 3872                     object->Get<ND::TRealDatum>(
"fgdEA_verNearQ_FGD2_rect");
 
 3873                     if (RD_fgdEA_verNearQ_FGD2_rect && i == fgdNum) {
 
 3879                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNearQ_FGD2_rect;
 
 3880                     RD_fgdEA_verNextNearQ_FGD2_rect =
 
 3881                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNearQ_FGD2_rect");
 
 3882                     if (RD_fgdEA_verNextNearQ_FGD2_rect && i == fgdNum) {
 
 3884                         RD_fgdEA_verNextNearQ_FGD2_rect->GetValue();
 
 3889                     ND::THandle<ND::TRealDatum> RD_fgdEA_verNextNextNearQ_FGD2_rect;
 
 3890                     RD_fgdEA_verNextNextNearQ_FGD2_rect =
 
 3891                     object->Get<ND::TRealDatum>(
"fgdEA_verNextNextNearQ_FGD2_rect");
 
 3892                     if (RD_fgdEA_verNextNextNearQ_FGD2_rect && i == fgdNum) {
 
 3894                         RD_fgdEA_verNextNextNearQ_FGD2_rect->GetValue();
 
 3912     ND::THandle<ND::TReconBase> p0dObject =
 
 3927         ND::THandle<ND::TRealDatum> p0dTimeRD =
 
 3928         p0dObject->Get<ND::TRealDatum>(
"averageHitTime");
 
 3930             p0d->
avgtime = p0dTimeRD->GetValue();
 
 3938         ND::TReconObjectContainer::const_iterator alternate;
 
 3940         ND::THandle<ND::TReconPID> pid = p0dObject;
 
 3942         for (alternate = pid->GetAlternates().begin();
 
 3943             alternate != pid->GetAlternates().end(); alternate++) {
 
 3944         ND::THandle<ND::TReconPID> alt = (*alternate);
 
 3946             p0d->
ParticleId.push_back(alt->GetParticleId());
 
 3947             p0d->
PIDWeight.push_back(alt->GetPIDWeight());
 
 3949             ND280Warn(
"TReconPID alternate is not a TReconPID - Ignored");
 
 3952             ND::THandle<ND::TReconObjectContainer> conContainer =
 
 3953             p0dObject->GetConstituents();
 
 3957                 ND::THandle<ND::TReconBase> p0dObject2 = *(conContainer->begin());
 
 3960                     p0d->
Cone = TrackingUtils::GetCone(p0dObject2);
 
 3961                     p0d->
EDeposit = TrackingUtils::GetEDeposit(p0dObject2);
 
 3968                     ND::THandle<ND::THitSelection> hits = p0dObject2->GetHits();
 
 3970                         double totalCharge = 0.0;
 
 3971                         double avgLen = 0.0;
 
 3972                         double avgLen2 = 0.0;
 
 3974                         for (ND::THitSelection::iterator h = hits->begin(); h != hits->end();
 
 3977                         TVector3 diff = (*h)->GetPosition() - p0d->
FrontPosition.Vect();
 
 3980                         if ((*h)->IsXHit()) {
 
 3987                         double q = std::max(3.0, (*h)->GetCharge());
 
 3988                         p0d->
Width += q * perp.Mag();
 
 3989                         double len = diff.Mag();
 
 3991                         avgLen2 += q * len * len;
 
 3994                             p0d->
Width /= std::max(totalCharge, 1.0);
 
 3995                             avgLen /= std::max(totalCharge, 1.0);
 
 3996                             avgLen2 /= std::max(totalCharge, 1.0);
 
 3997                             p0d->
Length = avgLen2 - avgLen * avgLen;
 
 4011     ND::TReconBase::Status dets[4] = {
 
 4012         ND::TReconBase::kTopSMRD, ND::TReconBase::kBottomSMRD,
 
 4013     ND::TReconBase::kLeftSMRD, ND::TReconBase::kRightSMRD};
 
 4015     for (
int i = 0; i < 4; i++) {
 
 4016         if (!object->UsesDetector(dets[i])) 
continue;
 
 4019         ND::TReconObjectContainer smrdObjects =
 
 4020         ReconObjectUtils::GetAllConstituentsInDetector(
object, dets[i]);
 
 4022         if (smrdObjects.size() == 0) 
continue;
 
 4024         for (ND::TReconObjectContainer::iterator iter = smrdObjects.begin();
 
 4025             iter != smrdObjects.end(); iter++) {
 
 4026         ND::THandle<ND::TReconBase> smrdObject = *iter;
 
 4037             ND::THandle<ND::TRealDatum> totalCharge =
 
 4038             smrdObject->Get<ND::TRealDatum>(
"totalCharge");
 
 4041             smrdObject->Get<ND::TRealDatum>(
"totalCharge")->GetValue();
 
 4045             ND::THandle<ND::TRealDatum> smrdTimeRD =
 
 4046             smrdObject->Get<ND::TRealDatum>(
"averageHitTime");
 
 4047             if (smrdTimeRD) smrd->
avgtime = smrdTimeRD->GetValue();
 
 4058     std::vector<ND::TGeomModuleBase*>::const_iterator it;
 
 4066     std::vector<ND::TGeomModuleBase*> TPCMODULES =
 
 4067     ND::TGeomInfo::Get().TPC().GetModules();
 
 4069     for (it = TPCMODULES.begin(); it != TPCMODULES.end(); it++) {
 
 4070         std::string name = (*it)->GetPath() + 
"/GasGap_0/Drift_0";
 
 4076     std::vector<ND::TGeomModuleBase*> FGDMODULES =
 
 4077     ND::TGeomInfo::Get().FGD().GetModules();
 
 4079     for (it = FGDMODULES.begin(); it != FGDMODULES.end(); it++) {
 
 4080         fALLMODULES[index] = (*it)->GetPath() + 
"/Active_0";
 
 4085     std::vector<ND::TGeomModuleBase*> P0DMODULES =
 
 4086     ND::TGeomInfo::Get().P0D().GetModules();
 
 4088     for (it = P0DMODULES.begin(); it != P0DMODULES.end(); it++) {
 
 4094     const std::vector<ND::TGeomModuleBase*> ECALMODULES =
 
 4095     ND::TGeomInfo::Get().ECAL().GetModules();
 
 4097     for (it = ECALMODULES.begin(); it != ECALMODULES.end(); it++) {
 
 4098         if ((*it)->GetPath().find(
"DsECal") != std::string::npos) {
 
 4099             fALLMODULES[index] = (*it)->GetPath() + 
"/Active_0";
 
 4105     std::string SMRD_name[6];
 
 4106     std::string magnet_name = ND::tman().GetSetup().GetVolumePath(
"Magnet_0");
 
 4107     if (magnet_name != 
"") {
 
 4108         SMRD_name[0] = magnet_name + 
"/RightClam_0/SMRD_0/Side_0";
 
 4109         SMRD_name[1] = magnet_name + 
"/RightClam_0/SMRD_0/Top_0";
 
 4110         SMRD_name[2] = magnet_name + 
"/RightClam_0/SMRD_0/Bottom_0";
 
 4111         SMRD_name[3] = magnet_name + 
"/LeftClam_0/SMRD_0/Side_0";
 
 4112         SMRD_name[4] = magnet_name + 
"/LeftClam_0/SMRD_0/Top_0";
 
 4113         SMRD_name[5] = magnet_name + 
"/LeftClam_0/SMRD_0/Bottom_0";
 
 4116         for (
int i = 0; i < 6; i++) {
 
 4124     for (it = ECALMODULES.begin(); it != ECALMODULES.end(); it++) {
 
 4125         if ((*it)->GetPath().find(
"DsECal") == std::string::npos) {
 
 4126             fALLMODULES[index] = (*it)->GetPath() + 
"/Active_0";
 
 4135         if (volname == 
"") 
continue;
 
 4136         const Volume& vol = ND::gman().GetSetup().volume(volname);
 
 4137         const surface_vector& surfs = vol.surfaces(
"outer");
 
 4138         stc_tools::extend_vector<Surface*>(surfs, 
fDetSurfaces[i]);
 
 4144         std::cout << 
"list of volumes: " << std::endl;
 
 4146             std::cout << i << 
" --> " << 
fALLMODULES[i] << std::endl;
 
 4149         std::cout << 
"fDetIndex" << std::endl;
 
 4152         for (
unsigned int it2 = 0; it2 < 
fDetIndex.keys().size(); it2++) {
 
 4153             std::cout << 
fDetIndex.keys()[it2] << 
" " 
 4156             for (
unsigned int j = 0; j < 
fDetSurfaces[i].size(); j++)
 
 4157                 std::cout << 
"    " << j << 
":  " 
 4158             << (
fDetSurfaces[i])[j]->name(
"setup_name") << std::endl;
 
 4165     ND::THandle<ND::TReconBase> 
object, 
TGlobalPID& globalObject) 
 
 4170         std::cout << 
"--------------------------------------------------" 
 4172         std::cout << 
"TGlobalReconModule:: Extrapolate to subdetectors: " 
 4174         std::cout << 
"--------------------------------------------------" 
 4182         globalObject.
ExitOK[i] = 0;
 
 4213     bool ok = ND::converter().TReconBase_to_Trajectory(
object, traj);
 
 4216     if (!traj.status(
"fitted")) {
 
 4220     if (traj.state(traj.first_fitted_node()).vector()[5] < 0) {
 
 4221         traj.sort_nodes(RP::z, -1);
 
 4223             std::cout << 
"Negative sense: sort nodes in reverse z order" << std::endl;
 
 4226     if (
debug_extrap) std::cout << 
"Trajectory: " << traj << std::endl;
 
 4235         std::cout << 
"---------------------------------------------------------" 
 4237         std::cout << 
"TGlobalReconModule:: Extrapolate to subdetectors results:" 
 4239         std::cout << 
"---------------------------------------------------------" 
 4242         std::cout << 
object << std::endl;
 
 4253             if (globalObject.
ExitOK[i])
 
 4254                 std::cout << i << 
"   x = " << globalObject.
ExitPosition[i].X()
 
 4270             if (globalObject.
ExitOK[i])
 
 4271                 std::cout << i << 
"   ux = " << globalObject.
ExitDirection[i].X()
 
 4283             if (globalObject.
ExitOK[i])
 
 4284                 std::cout << i << 
"   P1 = " << (globalObject.
ExitMomentum[i])
 
 4293     ND::THandle<ND::TReconBase> 
object, 
TGlobalPID& globalObject,
 
 4294     Trajectory& traj, 
int sense) 
 
 4299     int ifirst = traj.first_fitted_node();
 
 4300     State state = traj.state(ifirst);
 
 4303         std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4304         std::cout << 
"1. First state: " << state << std::endl;
 
 4309     const Volume* volume = NULL;
 
 4310     EVector position = 
fEquation.position(state, 0.);
 
 4311     bool ok = ND::gman().GetSetup().volume(position, volume);
 
 4314             std::cout << 
"Volume not found. Position:  " << position << std::endl;
 
 4318     int current_det = -1;
 
 4319     for (
unsigned int i = 0; i < 
fALLMODULES.size(); i++) {
 
 4320         if (volume->name(
"setup_name").find(
fALLMODULES[i]) != std::string::npos)
 
 4324     if (current_det < 0) {
 
 4326             std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4327             std::cout << 
"2. Current volume not in list, name = " 
 4328             << volume->name(
"setup_name") << std::endl;
 
 4334         std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4335         std::cout << 
"2. Current volume: index = " << current_det
 
 4336         << 
", name = " << volume->name(
"setup_name") << std::endl;
 
 4341     bool in_found = 
true;
 
 4347            std::cout<<
" Loop: "<<nLoops<<std::endl;
 
 4348            std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4349            std::cout << 
"3. Exit from volume: " << volume->name(
"setup_name")
 
 4351            std::cout << 
"   ifirst: " << ifirst << 
", iexit = " << iexit
 
 4352            << 
", in found = " << in_found << std::endl;
 
 4363                 for (
unsigned int i = ifirst + 1; i < traj.nodes().size(); i++) {
 
 4364                     if (traj.node(i).status(
"fitted")) {
 
 4365                         position = 
fEquation.position(traj.state(i), 0.);
 
 4366                         bool ok = volume->is_inside(position);
 
 4378                 std::cout << 
"   Last state in volume: " << iexit << std::endl;
 
 4381             state = traj.state(iexit);
 
 4386                 std::cout << 
"   No state inside volume. Propagate to exit surface " 
 4387             "from the entrance state " 
 4393         surface_vector exit_surfaces;
 
 4394         stc_tools::extend_vector<Surface*>(
fDetSurfaces[current_det],
 
 4397         double end_length = 1000000 * sense;
 
 4398         double delta_length;
 
 4399         const Surface* exit_surf;
 
 4401         ok = ND::rpman(
"globalAnalysis")
 
 4403         .next_surface(state, end_length, exit_surfaces, delta_length,
 
 4408                 std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4409                 std::cout << 
"4. Exit surface. Length: " << delta_length << std::endl;
 
 4410                 std::cout << 
"                 name:   " 
 4411                 << exit_surf->name(
"setup_name") << std::endl;
 
 4412                 std::cout << 
"                 volume: " << volume->name(
"setup_name")
 
 4417                 std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4418                 std::cout << 
"4. Exit surface. Fail in finding exit surface. stop !!! " 
 4425         ok = ND::rpman(
"globalAnalysis")
 
 4427         .propagate(0.1 * sense, state);
 
 4428         ok = ND::rpman(
"globalAnalysis")
 
 4430         .propagate(*exit_surf, state, delta_length);
 
 4434             EVector exitPosition = 
fEquation.position(state, 0.);
 
 4435             EVector exitDirection = 
fEquation.direction(state, 0.);
 
 4437             if (state.vector()[6] != 0) exitMomentum = fabs(1 / state.vector()[6]);
 
 4440             if (state.matrix()[0][0] > 0 && state.matrix()[1][1] > 0 &&
 
 4441                 state.matrix()[2][2] > 0)
 
 4442             posErr = TLorentzVector(sqrt(state.matrix()[0][0]),
 
 4443                 sqrt(state.matrix()[1][1]),
 
 4444                 sqrt(state.matrix()[2][2]), 0);
 
 4447             if (state.matrix()[3][3] > 0 && state.matrix()[4][4] > 0 &&
 
 4448                 state.matrix()[5][5] > 0)
 
 4450             TVector3(sqrt(state.matrix()[3][3]), sqrt(state.matrix()[4][4]),
 
 4451                 sqrt(state.matrix()[5][5]));
 
 4454             if (state.matrix()[6][6] > 0 && state.vector()[6] != 0)
 
 4456             fabs(1 / pow(state.vector()[6], 2)) * sqrt(state.matrix()[6][6]);
 
 4459                 std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4460                 std::cout << 
"5. Exit position:  " << print(exitPosition) << std::endl;
 
 4461                 std::cout << 
"   Exit direction: " << print(exitDirection) << std::endl;
 
 4462                 std::cout << 
"   Exit momentum:  " << exitMomentum << std::endl;
 
 4466             ok = ND::converter().EVector3_to_TVector(exitPosition, pos);
 
 4468             TLorentzVector dir4;
 
 4469             ok = ND::converter().EVector3_to_TVector(exitDirection, dir4);
 
 4470             TVector3 dir = dir4.Vect();
 
 4473                 globalObject.
ExitOK[current_det] = 1;
 
 4492                 std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4493                 std::cout << 
"5. Exit position: " 
 4494                 << 
"surface not intersected !!!" << std::endl;
 
 4503         surface_vector entrance_surfaces;
 
 4506                 stc_tools::extend_vector<Surface*>(fDetSurfaces[det],
 
 4511         const Surface* entrance_surf;
 
 4512         ok = ND::rpman(
"globalAnalysis")
 
 4514         .next_surface(state, end_length, entrance_surfaces, delta_length,
 
 4518             if (
debug_extrap) std::cout << 
"No suface intersected " << std::endl;
 
 4523         const Volume* volume_try;
 
 4524         ok = ND::gman().GetSetup().volume(*entrance_surf, volume_try);
 
 4527             std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4528             std::cout << 
"6. Entrance surface. Length: " << delta_length << std::endl;
 
 4529             std::cout << 
"                     name:   " 
 4530             << entrance_surf->name(
"setup_name") << std::endl;
 
 4531             std::cout << 
"                     volume: " 
 4532             << volume_try->name(
"setup_name") << std::endl;
 
 4538             if ((
unsigned int)(iexit + 1) < traj.nodes().size()) {
 
 4539                 for (
unsigned int i = iexit + 1; i < traj.nodes().size(); i++) {
 
 4540                     if (traj.node(i).status(
"fitted")) {
 
 4541                         position = 
fEquation.position(traj.state(i), 0.);
 
 4542                         bool ok = volume_try->is_inside(position);
 
 4554             std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4555             std::cout << 
"7. Enter in volume: " << volume_try->name(
"setup_name")
 
 4557             std::cout << 
"   ifirst: " << ifirst << 
", iexit = " << iexit
 
 4558             << 
", in found = " << in_found << std::endl;
 
 4565                 std::cout << 
"   Next state inside volume: " << ifirst << std::endl;
 
 4567                 std::cout << 
"   No state inside volume. Propagate to entrance surface " 
 4568             "from the exit of the previous volume " 
 4576             state = traj.state(ifirst);
 
 4579         ok = ND::rpman(
"globalAnalysis")
 
 4581         .propagate(0.1 * sense, state);
 
 4582         ok = ND::rpman(
"globalAnalysis")
 
 4584         .propagate(*entrance_surf, state, delta_length);
 
 4587             volume = volume_try;
 
 4589             for (
unsigned int i = 0; i < 
fALLMODULES.size(); i++) {
 
 4590                 if (volume->name(
"setup_name").find(
fALLMODULES[i]) !=
 
 4596             EVector entrancePosition = 
fEquation.position(state, 0.);
 
 4597             EVector entranceDirection = 
fEquation.direction(state, 0.);
 
 4600             if (state.vector()[6] != 0)
 
 4601                 entranceMomentum = fabs(1 / state.vector()[6]);
 
 4604             if (state.matrix()[0][0] > 0 && state.matrix()[1][1] > 0 &&
 
 4605                 state.matrix()[2][2] > 0)
 
 4606             posErr = TLorentzVector(sqrt(state.matrix()[0][0]),
 
 4607                 sqrt(state.matrix()[1][1]),
 
 4608                 sqrt(state.matrix()[2][2]), 0);
 
 4611             if (state.matrix()[3][3] > 0 && state.matrix()[4][4] > 0 &&
 
 4612                 state.matrix()[5][5] > 0)
 
 4614             TVector3(sqrt(state.matrix()[3][3]), sqrt(state.matrix()[4][4]),
 
 4615                 sqrt(state.matrix()[5][5]));
 
 4618             if (state.matrix()[6][6] > 0 && state.vector()[6] != 0)
 
 4619                 entranceMomentumErr =
 
 4620             fabs(1 / pow(state.vector()[6], 2)) * sqrt(state.matrix()[6][6]);
 
 4623                 std::cout << 
"8. Entrance position:  " << print(entrancePosition)
 
 4625                 std::cout << 
"   Entrance direction: " << print(entranceDirection)
 
 4627                 std::cout << 
"   Entrance momentum:  " << entranceMomentum << std::endl;
 
 4631             ok = ND::converter().EVector3_to_TVector(entrancePosition, pos);
 
 4633             TLorentzVector dir4;
 
 4634             ok = ND::converter().EVector3_to_TVector(entranceDirection, dir4);
 
 4635             TVector3 dir = dir4.Vect();
 
 4646                 globalObject.
ExitOK[current_det] = 1;
 
 4649                 globalObject.
ExitMomentum[current_det] = entranceMomentum;
 
 4656                 std::cout << 
"Extrapolate to subdetectors: " << std::endl;
 
 4657                 std::cout << 
"8. Entrance position: " 
 4658                 << 
"surface not intersected !!!" << std::endl;
 
 4662              ND280Log(
"ND::TGlobalReconModule::FillExtrapolationToDetectors : Extrapolation to subdetectors failed, and "<<nLoops<<
" volumes have been attempted so abandoning extrapolation to avoid infinite loop.");
 
 4673     ND::TND280Event& event, ND::THandle<ND::TReconVertex> vertex, 
bool primary)
 
 4681   ND::THandle<ND::TVertexState> vs = vertex->GetState();
 
 4682   if (!vs) 
return false;
 
 4698   gVertex->
Position      = vs->GetPosition();
 
 4699   gVertex->
Variance      = vs->GetPositionVariance();
 
 4701   gVertex->
Status        = vertex->GetStatus();
 
 4702   gVertex->
Quality       = vertex->GetQuality();
 
 4703   gVertex->
NDOF          = vertex->GetNDOF();
 
 4706   ND::THandle<ND::TReconObjectContainer> tracksAssociated 
 
 4707     = vertex->GetConstituents();
 
 4708   if (tracksAssociated->size() == 0) {
 
 4709     ND280NamedWarn(
"ECalVertexInTGRMFV",
 
 4710         "Leaving as vertex has no associated constituents.");
 
 4713   std::map<ND::THandle<ND::TReconBase>,
 
 4714   ND::THandle<ND::TReconObjectContainer> >::iterator cit;
 
 4716   for (ND::TReconObjectContainer::iterator assocIter =
 
 4717        tracksAssociated->begin();
 
 4718        assocIter != tracksAssociated->end(); assocIter++){
 
 4719     if (ND::THandle<ND::TReconVertex> vtxDummy = (*assocIter)) {
 
 4720       ND280NamedDebug(
"ECalVertexInTGRMFV", 
"Skipping vertex constituent: " 
 4721         << vtxDummy->GetUniqueID());
 
 4727     ND::THandle<ND::TReconBase> track = *assocIter;
 
 4728     if (!track) 
continue;
 
 4729     ND::THandle<ND::TReconState> state = track->GetState();
 
 4730     if (!state) 
continue;
 
 4733     ND::THandle<ND::TReconBase> otrack;
 
 4735       ND::THandle<ND::TReconObjectContainer> trackC = track->GetConstituents();
 
 4736       if (trackC->size() == 0) 
continue;
 
 4737       otrack = trackC->front();
 
 4738       if (!otrack) 
continue;
 
 4741     int GlobalPIDIndex = -1;
 
 4743     std::map<ND::THandle<ND::TReconBase>, 
int>::iterator it, miter;
 
 4745     TLorentzVector pos_track = TrackingUtils::GetPosition(state);
 
 4746     double mom_track = TrackingUtils::GetMomentum(state);
 
 4751     if(track->Has<ND::TIntegerDatum>(
"PIDID")){
 
 4752       PIDID=track->Get<ND::TIntegerDatum>(
"PIDID")->at(0);
 
 4756       ND::THandle<ND::TReconState> ostate = otrack->GetState();
 
 4757       mom_track = TrackingUtils::GetMomentum(ostate);
 
 4758       pos_track = TrackingUtils::GetPosition(ostate);
 
 4759       if(PIDID<1&&otrack->Has<ND::TIntegerDatum>(
"PIDID")){
 
 4760         PIDID=otrack->Get<ND::TIntegerDatum>(
"PIDID")->at(0);
 
 4765         if (!it->first) 
continue;
 
 4766         if((it->first)->Has<ND::TIntegerDatum>(
"PIDID")){
 
 4767           if( (it->first)->Get<ND::TIntegerDatum>(
"PIDID")->at(0)==PIDID){
 
 4803         if (!it->first) 
continue;
 
 4804         ND::THandle<ND::TReconState> state_tmp = (it->first)->GetState();
 
 4805         if (!state_tmp) 
continue;
 
 4806         double mom_tmp = TrackingUtils::GetMomentum(state_tmp);
 
 4807         TLorentzVector pos_tmp = TrackingUtils::GetPosition(state_tmp);
 
 4808         if (pos_track == pos_tmp && mom_track == mom_tmp){
 
 4828             "ECalVertexInTGRMFV",
 
 4829             "Didn't find this constituent(" 
 4830             << track->GetUniqueID() << 
", " << track->ConvertDetector()
 
 4831             << 
" " << track->ClassName() << 
") in the global map of PIDs.");
 
 4834         ND280NamedVerbose(
"ECalVertexInTGRMFV",
 
 4835             "Adding constituent(" 
 4836             << track->GetUniqueID() << 
", " 
 4837             << track->ConvertDetector()
 
 4838             << 
") which was in the global map of PIDs.");
 
 4845       GlobalPIDIndex = miter->second;
 
 4850       std::cout << 
" WARNING: TGlobalReconModule::FillVertex(): GV constituent " 
 4851                 << 
"not found among recon tracks! Event ID is " 
 4852                 << 
event.GetEventId() << std::endl;
 
 4860     vConst->
Charge = (int)TrackingUtils::GetCharge(track);
 
 4861     vConst->
Quality = track->GetQuality();
 
 4863     double mom = TrackingUtils::GetMomentum(state);
 
 4864     TVector3 mdir = TrackingUtils::GetDirection(state);
 
 4868     vConst->
PID = GlobalPIDIndex;
 
 4875     ND::THandle<ND::TG4PrimaryVertexContainer> g4PrimVert) 
 
 4880     std::vector<TLorentzVector> vertexPos;
 
 4881     std::vector<std::vector<int> > vertexPIDs;
 
 4887     for (
int i = 0; i < nConst; i++) {
 
 4892         int this_PID = vConst->
PID;
 
 4896         bool inList = 
false;
 
 4897         for (
int j = 0; j < (int)vertexPos.size(); j++) {
 
 4898             if (vertexPos[j] == vPos) inList = 
true;
 
 4900         if (inList) 
continue;
 
 4901         vertexPos.push_back(vPos);
 
 4906         *tVertex = globalTrue.
Vertex;
 
 4914         std::vector<int> IDs;
 
 4915         for (
int k = 0; k < 
fNPIDs; k++) {
 
 4918             if (thisGlobalObject->
NNodes > 0)
 
 4922             if (thisGlobalObject->
Status != 1)
 
 4933             if (thisGlobalTrue.
ID == -1) 
continue;  
 
 4940             if (thisVPos == vPos) IDs.push_back(k);
 
 4942         vertexPIDs.push_back(IDs);
 
 4949         std::vector<int> IDs = vertexPIDs[i];
 
 4950         int nIDs = (int)IDs.size();
 
 4954         for (
int j = 0; j < nConst; j++) {
 
 4957             int this_PID = vConst->
PID;
 
 4959             for (
int k = 0; k < nIDs; k++) {
 
 4960                 if (this_PID == IDs[k]) nMatch++;
 
 4967         (double)nMatch / nConst;  
 
 4976     ND::THandle<ND::TG4Trajectory> G4track, 
double pur, 
double eff,
 
 4982         trueParticle.
ID = G4track->GetTrackId();
 
 4984         trueParticle.
Pur = pur;
 
 4985         trueParticle.
Eff = eff;
 
 4987         ND::TG4PrimaryVertex G4vertex;
 
 4992         trueParticle.
ID = -1;
 
 4997         ND::TG4PrimaryVertex G4vertex;
 
 5005     ND::THandle<ND::TG4Trajectory> G4track) 
 
 5009     const ND::TND280Event& 
event = *(ND::TEventFolder::GetCurrentEvent());
 
 5010     ND::THandle<ND::TG4TrajectoryContainer> trajectories =
 
 5011     event.Get<ND::TG4TrajectoryContainer>(
"truth/G4Trajectories");
 
 5013     if (G4track->GetParentId() != 0) {
 
 5014         ND::THandle<ND::TG4Trajectory> traj(
 
 5015             new ND::TG4Trajectory(((*trajectories)[G4track->GetParentId()])));
 
 5018         return ND::THandle<ND::TG4Trajectory>();
 
 5036     bool found, 
const ND::TG4PrimaryVertex& G4vertex, 
double pur, 
double eff,
 
 5042         vertex.
Position = G4vertex.GetPosition();
 
 5043         vertex.
ID = G4vertex.GetInteractionNumber();
 
 5057     const ND::TReconBase&, 
double& pur, 
double& eff)
 
 5061     return ND::THandle<ND::TG4PrimaryVertex>();
 
 5066     ND::TG4PrimaryVertex& G4vertex) 
 
 5072     const ND::TND280Event& 
event = *(ND::TEventFolder::GetCurrentEvent());
 
 5073     ND::THandle<ND::TG4TrajectoryContainer> trajectories =
 
 5074     event.Get<ND::TG4TrajectoryContainer>(
"truth/G4Trajectories");
 
 5075     if (!trajectories) 
return false;
 
 5079     int primaryID = G4track->GetTrackId();
 
 5081     while ((primaryID > 0) &&
 
 5082         ((nextparent = (*trajectories)[primaryID].GetParentId()) > 0)) {
 
 5083     primaryID = nextparent;
 
 5084     if (count++ > 100000000) {
 
 5087             "TGlobalReconModule: Particle has more than 100000000 levels of " 
 5089         throw ND::EeventAnalysisInfiniteLoop2();
 
 5094         ND::THandle<ND::TG4PrimaryVertexContainer> vertices =
 
 5095         event.Get<ND::TG4PrimaryVertexContainer>(
"truth/G4PrimVertex00");
 
 5096         if (!vertices) 
return false;
 
 5098         std::vector<ND::TG4PrimaryVertex>::iterator it1;
 
 5099         for (it1 = vertices->begin(); it1 != vertices->end(); it1++) {
 
 5100             const ND::TG4PrimaryParticleContainer& particles =
 
 5101             it1->GetPrimaryParticles();
 
 5103             std::vector<ND::TG4PrimaryParticle>::const_iterator it2;
 
 5104             for (it2 = particles.begin(); it2 != particles.end(); it2++) {
 
 5105                 if (it2->GetTrackId() == primaryID) {
 
 5117     const ND::TG4PrimaryVertex& G4vertex, ND::TG4PrimaryParticle& incoming)
 
 5121     for (std::vector<ND::TG4PrimaryVertex>::const_iterator infoVtxIter =
 
 5122         G4vertex.GetInfoVertex().begin();
 
 5123         infoVtxIter != G4vertex.GetInfoVertex().end(); ++infoVtxIter) {
 
 5124     std::vector<ND::TG4PrimaryParticle>::const_iterator particleIter;
 
 5125     for (particleIter = infoVtxIter->GetPrimaryParticles().begin();
 
 5126         particleIter != infoVtxIter->GetPrimaryParticles().end();
 
 5128     Int_t pdg = particleIter->GetPDGCode();
 
 5129     if (particleIter->GetTrackId() == -1) {
 
 5131         if (TMath::Abs(pdg) == 12 || TMath::Abs(pdg) == 14 ||
 
 5132             TMath::Abs(pdg) == 16) {
 
 5133         incoming = *particleIter;
 
 5145     ND::THandle<ND::TReconBase> 
object)
 
 5150     if (object->GetHits())
 
 5151         nHits += object->GetHits()->size();
 
 5152     else if (object->GetConstituents()) {
 
 5153         ND::TReconObjectContainer::const_iterator it;
 
 5154         for (it = object->GetConstituents()->begin();
 
 5155             it != 
object->GetConstituents()->end(); it++) {
 
 5165     ND::THandle<ND::TReconBase> 
object)
 
 5169     unsigned long det = 0;
 
 5185     if (object->UsesDetector(ND::TReconBase::kDSECal)) 
 
 5187     if (object->UsesDetector(ND::TReconBase::kTopPECal))
 
 5189     if (object->UsesDetector(ND::TReconBase::kBottomPECal))
 
 5191     if (object->UsesDetector(ND::TReconBase::kLeftPECal))
 
 5193     if (object->UsesDetector(ND::TReconBase::kRightPECal)) 
 
 5195     if (object->UsesDetector(ND::TReconBase::kTopTECal))
 
 5197     if (object->UsesDetector(ND::TReconBase::kBottomTECal))
 
 5199     if (object->UsesDetector(ND::TReconBase::kLeftTECal))
 
 5201     if (object->UsesDetector(ND::TReconBase::kRightTECal)) 
 
 5215     ND::THandle<ND::TReconBase> 
object){ 
 
 5227   if (object->UsesDetector(ND::TReconBase::kDSECal))      ++count;
 
 5228   if (object->UsesDetector(ND::TReconBase::kTopPECal))    ++count;
 
 5229   if (object->UsesDetector(ND::TReconBase::kBottomPECal)) ++count;
 
 5230   if (object->UsesDetector(ND::TReconBase::kLeftPECal))   ++count;
 
 5231   if (object->UsesDetector(ND::TReconBase::kRightPECal))  ++count;
 
 5232   if (object->UsesDetector(ND::TReconBase::kTopTECal))    ++count;
 
 5233   if (object->UsesDetector(ND::TReconBase::kBottomTECal)) ++count;
 
 5234   if (object->UsesDetector(ND::TReconBase::kLeftTECal))   ++count;
 
 5235   if (object->UsesDetector(ND::TReconBase::kRightTECal))  ++count;
 
 5243     ND::THandle<ND::TReconBase> 
object, 
bool dets[]) 
 
 5250     for (
int i = 0; i < 
NDETSUSED; i++) dets[i] = 
false;
 
 5262     if (object->UsesDetector(ND::TReconBase::kDSECal))      dets[10] = 
true;
 
 5263     if (object->UsesDetector(ND::TReconBase::kTopTECal))    dets[11] = 
true;
 
 5264     if (object->UsesDetector(ND::TReconBase::kBottomTECal)) dets[12] = 
true;
 
 5265     if (object->UsesDetector(ND::TReconBase::kLeftTECal))   dets[13] = 
true;
 
 5266     if (object->UsesDetector(ND::TReconBase::kRightTECal))  dets[14] = 
true;
 
 5267     if (object->UsesDetector(ND::TReconBase::kTopPECal))    dets[15] = 
true;
 
 5268     if (object->UsesDetector(ND::TReconBase::kBottomPECal)) dets[16] = 
true;
 
 5269     if (object->UsesDetector(ND::TReconBase::kLeftPECal))   dets[17] = 
true;
 
 5270     if (object->UsesDetector(ND::TReconBase::kRightPECal))  dets[18] = 
true;
 
 5271     if (object->UsesDetector(ND::TReconBase::kTopSMRD))     dets[19] = 
true;
 
 5272     if (object->UsesDetector(ND::TReconBase::kBottomSMRD))  dets[20] = 
true;
 
 5273     if (object->UsesDetector(ND::TReconBase::kLeftSMRD))    dets[21] = 
true;
 
 5274     if (object->UsesDetector(ND::TReconBase::kRightSMRD))   dets[22] = 
true;
 
 5283     ND::THandle<ND::TAlgorithmResult> tpcRecon = 
event.GetFit(
"tpcRecon");
 
 5285         ND::THandle<ND::TReconObjectContainer> otherObjects =
 
 5286         tpcRecon->GetResultsContainer(
"TPCother");
 
 5288             for (ND::TReconObjectContainer::iterator tt = otherObjects->begin();
 
 5289                 tt != otherObjects->end(); tt++) {
 
 5290             ND::THandle<ND::TReconBase> other = *tt;
 
 5297                 tpcOther->
Chi2 = other->GetQuality();
 
 5298                 tpcOther->
EDeposit = TrackingUtils::GetEDeposit(other);
 
 5299                 tpcOther->
Charge = TrackingUtils::GetCharge(other);
 
 5301                 if (other->GetHits()) tpcOther->
NHits = other->GetHits()->size();
 
 5304                 ND::THandle<ND::TReconState> firstState =
 
 5305                 TrackingUtils::GetFirstState(*other);
 
 5307                     tpcOther->
FrontPosition = TrackingUtils::GetPosition(firstState);
 
 5308                     tpcOther->
FrontDirection = TrackingUtils::GetDirection(firstState);
 
 5309                     tpcOther->
Momentum = TrackingUtils::GetMomentum(firstState);
 
 5318                 ND::THandle<ND::TReconState> lastState =
 
 5319                 TrackingUtils::GetLastState(*other);
 
 5321                     tpcOther->
BackPosition = TrackingUtils::GetPosition(lastState);
 
 5322                     tpcOther->
BackDirection = TrackingUtils::GetDirection(lastState);
 
 5332                 ND::THandle<ND::TG4Trajectory> G4track =
 
 5347     ND::THandle<ND::TAlgorithmResult> tpcRecon = 
event.GetFit(
"tpcRecon");
 
 5350         ND::THandle<ND::THitSelection> tpcHits =
 
 5351         tpcRecon->GetHitSelection(
"TPCunused");
 
 5358     ND::THandle<ND::TAlgorithmResult> p0dRecon = 
event.GetFit(
"p0dRecon");
 
 5361         ND::THandle<ND::THitSelection> p0dHits =
 
 5362         p0dRecon->GetHitSelection(
"unused");
 
 5364             for (ND::THitSelection::iterator hit = p0dHits->begin();
 
 5365                 hit != p0dHits->end(); hit++) {
 
 5372     ND::THandle<ND::TAlgorithmResult> smrdRecon = 
event.GetFit(
"smrdRecon");
 
 5375         ND::THandle<ND::THitSelection> smrdHits =
 
 5376         smrdRecon->GetHitSelection(
"unused");
 
 5378             for (ND::THitSelection::iterator h = smrdHits->begin();
 
 5379                 h != smrdHits->end(); h++) {
 
 5385             if (ND::TGeomInfo::SMRD().IsSMRDTopWall((*h))) {
 
 5387             } 
else if (ND::TGeomInfo::SMRD().IsSMRDBottomWall((*h))) {
 
 5389             } 
else if (ND::TGeomInfo::SMRD().IsSMRDLeftWall((*h))) {
 
 5391             } 
else if (ND::TGeomInfo::SMRD().IsSMRDRightWall((*h))) {
 
 5409     bool firstX = 
false;
 
 5411     bool firstY = 
false;
 
 5414     for (ND::THitSelection::iterator hit = hits.begin(); hit != hits.end();
 
 5416     if (globalObject.
NHitsSaved >= 10 || (firstX && firstY)) 
break;
 
 5418     if ((*hit)->IsXHit() && !firstX) {
 
 5424         if ((*hit)->IsYHit()) firstY = 
true;
 
 5425     } 
else if ((*hit)->IsYHit() && !firstY) {
 
 5431         if ((*hit)->IsXHit()) firstX = 
true;
 
 5435         for (ND::THitSelection::reverse_iterator hit = hits.rbegin();
 
 5436             hit != hits.rend(); hit++) {
 
 5437         if (globalObject.
NHitsSaved >= 10 || (lastX && lastY)) 
break;
 
 5439         if ((*hit)->IsXHit() && !lastX) {
 
 5445             if ((*hit)->IsYHit()) lastY = 
true;
 
 5446         } 
else if ((*hit)->IsYHit() && !lastY) {
 
 5452             if ((*hit)->IsXHit()) lastX = 
true;
 
 5459     ND::THitSelection& hits,
 
 5462   for(ND::THitSelection::iterator hit = hits.begin(); 
 
 5463       hit != hits.end(); hit++) {
 
 5477     double minX = 1000000;
 
 5478     double maxX = -1000000;
 
 5479     double minY = 1000000;
 
 5480     double maxY = -1000000;
 
 5481     double minZ = 1000000;
 
 5482     double maxZ = -1000000;
 
 5484     ND::THandle<ND::THit> hitSave[6];
 
 5486     for (ND::THitSelection::iterator hit = hits.begin(); hit != hits.end();
 
 5488     if ((*hit)->GetCharge() < charge_cut) 
continue;
 
 5490     if ((*hit)->IsXHit()) {
 
 5491         if ((*hit)->GetPosition().X() > maxX) {
 
 5492             maxX = (*hit)->GetPosition().X();
 
 5495         if ((*hit)->GetPosition().X() < minX) {
 
 5496             minX = (*hit)->GetPosition().X();
 
 5500     if ((*hit)->IsYHit()) {
 
 5501         if ((*hit)->GetPosition().Y() > maxY) {
 
 5502             maxY = (*hit)->GetPosition().Y();
 
 5505         if ((*hit)->GetPosition().Y() < minY) {
 
 5506             minY = (*hit)->GetPosition().Y();
 
 5510     if ((*hit)->IsZHit()) {
 
 5511         if ((*hit)->GetPosition().Z() > maxZ) {
 
 5512             maxZ = (*hit)->GetPosition().Z();
 
 5515         if ((*hit)->GetPosition().Z() < minZ) {
 
 5516             minZ = (*hit)->GetPosition().Z();
 
 5537   TTrackerReconUtils trackerUtils;
 
 5541     ND::THandle<ND::TAlgorithmResult> tbResult
 
 5542       = trackerUtils.GetSFGTimeBinResult(event, ibin);
 
 5562         = trackerUtils.GetTimeBinBoundary(tbResult);
 
 5565       ND::THandle<ND::THitSelection> sfgUnused =
 
 5566       tbResult->GetHitSelection(
"unused");
 
 5568         for (ND::THitSelection::iterator hit = sfgUnused->begin();
 
 5569             hit != sfgUnused->end(); hit++) {
 
 5571           if (ND::GeomId::SFG::IsCube((*hit)->GetGeomId()))
 
 5584       ND::THandle<ND::THitSelection> tbHits = tbResult->GetHitSelection(
"used");
 
 5586         bin->
nHits = tbHits->size();
 
 5587         for (ND::THitSelection::iterator hit = tbHits->begin();
 
 5588              hit != tbHits->end(); hit++) {
 
 5590           TVector3 pos = (*hit)->GetPosition();
 
 5594           bin->
SFGHitT        .push_back((*hit)->GetTime());
 
 5595           bin->
SFGHitQ        .push_back((*hit)->GetCharge());
 
 5597             ND::THitSelection thisHit;
 
 5598             thisHit.push_back(*hit);
 
 5599             bin->
SFGHitTrajID.push_back(TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 5612     bool isMC = 
event.GetContext().IsMC();
 
 5617         ND::THandle<ND::TAlgorithmResult> tbResult =
 
 5618         fgdUtils::getTimeBinResult(event, ibin);
 
 5623         for (
int ifgd = 0; ifgd < 2; ifgd++) {
 
 5624             bin->
nHits[ifgd] = 0;
 
 5627             for (
int ilayer = 0; ilayer < 30; ilayer++) {
 
 5639             ND::THandle<ND::TRealDatum> binStartTime =
 
 5640             tbResult->Get<ND::TRealDatum>(
"binStartTime");
 
 5642                 bin->
minTime = binStartTime->GetValue();
 
 5645             ND::THandle<ND::TRealDatum> binEndTime =
 
 5646             tbResult->Get<ND::TRealDatum>(
"binEndTime");
 
 5648                 bin->
maxTime = binEndTime->GetValue();
 
 5652             ND::THandle<ND::THitSelection> fgdUnused =
 
 5653             tbResult->GetHitSelection(
"unused");
 
 5655                 for (ND::THitSelection::iterator hit = fgdUnused->begin();
 
 5656                     hit != fgdUnused->end(); hit++) {
 
 5658                 if (ND::TGeomInfo::FGD().IsInFGD1((*hit)->GetPosition()))
 
 5660                 else if (ND::TGeomInfo::FGD().IsInFGD2((*hit)->GetPosition()))
 
 5670             ND::THandle<ND::TReconObjectContainer> xz =
 
 5671             tbResult->GetResultsContainer(
"xzUnmatchedFgdReconTracks");
 
 5673                 for (ND::TReconObjectContainer::iterator tt = xz->begin();
 
 5674                     tt != xz->end(); tt++) {
 
 5675                 ND::THandle<ND::TReconBase> 
object = *tt;
 
 5677                     ND::THandle<ND::THitSelection> hits = 
object->GetHits();
 
 5679                         for (ND::THitSelection::iterator hit = hits->begin();
 
 5680                             hit != hits->end(); hit++) {
 
 5682                         if (ND::TGeomInfo::FGD().IsInFGD1((*hit)->GetPosition()))
 
 5685                         else if (ND::TGeomInfo::FGD().IsInFGD2((*hit)->GetPosition()))
 
 5697             ND::THandle<ND::TReconObjectContainer> yz =
 
 5698             tbResult->GetResultsContainer(
"yzUnmatchedFgdReconTracks");
 
 5700                 for (ND::TReconObjectContainer::iterator tt = yz->begin();
 
 5701                     tt != yz->end(); tt++) {
 
 5702                 ND::THandle<ND::TReconBase> 
object = *tt;
 
 5704                     ND::THandle<ND::THitSelection> hits = 
object->GetHits();
 
 5706                         for (ND::THitSelection::iterator hit = hits->begin();
 
 5707                             hit != hits->end(); hit++) {
 
 5709                         if (ND::TGeomInfo::FGD().IsInFGD1((*hit)->GetPosition()))
 
 5712                         else if (ND::TGeomInfo::FGD().IsInFGD2((*hit)->GetPosition()))
 
 5729             ND::THandle<ND::THitSelection> tbHits = tbResult->GetHitSelection(
"fgd");
 
 5732                 ND::THitSelection hits[2];
 
 5734                 TVector3 chargeSum[2];
 
 5735                 for (ND::THitSelection::iterator hit = tbHits->begin();
 
 5736                     hit != tbHits->end(); hit++) {
 
 5738                 double charge = (*hit)->GetCharge();
 
 5739                 TVector3 pos = (*hit)->GetPosition();
 
 5740                 int layer = ND::TGeomInfo::FGD().ActivePlane(pos.Z());
 
 5744                 if ((*hit)->IsXHit()) {
 
 5750                 float time = (*hit)->GetTime();
 
 5753                 if (ND::TGeomInfo::FGD().IsInFGD1(pos)) {
 
 5758                     ND::THitSelection thisHit;
 
 5759                     thisHit.push_back(*hit);
 
 5761                         TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 5767                     ND::THitSelection thisHit;
 
 5768                     thisHit.push_back(*hit);
 
 5770                         TrackTruthInfo::GetG4TrajIDHits(thisHit));
 
 5774                 TVector3 isHit((*hit)->IsXHit(), (*hit)->IsYHit(), (*hit)->IsZHit());
 
 5778                 isInFgd[0] = ND::TGeomInfo::FGD().IsInFGD1((*hit)->GetPosition());
 
 5779                 isInFgd[1] = ND::TGeomInfo::FGD().IsInFGD2((*hit)->GetPosition());
 
 5780                 for (
int ifgd = 0; ifgd < 2; ifgd++) {
 
 5783                     if (isInFgd[ifgd]) {
 
 5784                         hits[ifgd].push_back(*hit);
 
 5788                         ND::TGeometryId geomId = (*hit)->GetGeomId();
 
 5789                         int xory = ND::TGeomInfo::FGD().GetXorY(geomId);
 
 5790                         int module = ND::TGeomInfo::FGD().GetModule(geomId);
 
 5791                         int layer = module * 2 + xory;
 
 5797                         for (
int ix = 0; ix < 3; ix++) {
 
 5802                                 chargeSum[ifgd](ix) += charge;
 
 5809                     for (
int ifgd = 0; ifgd < 2; ifgd++) {
 
 5810                         for (
int ix = 0; ix < 3; ix++) {
 
 5811                             if (chargeSum[ifgd](ix) > 1.e-3) {
 
 5817                         bin->
nHits[ifgd] = hits[ifgd].size();
 
 5821                     double charge_cut = 0;
 
 5826                         bin->
g4ID = TrackTruthInfo::GetG4TrajIDHits(*tbHits);
 
 5838     ND::THandle<ND::TReconBase> 
object)
 
 5841     std::vector<double> times;
 
 5842     ND::THandle<ND::THitSelection> hits = 
object->GetHits();
 
 5846         for (ND::THitSelection::iterator hit = (hits)->begin();
 
 5847             hit != (hits)->end(); hit++)
 
 5849             if ((ND::TGeomInfo::FGD().IsInFGD1((*hit)->GetPosition()) ||
 
 5850                 ND::TGeomInfo::FGD().IsInFGD2((*hit)->GetPosition()))) {
 
 5851             times.push_back((*hit)->GetTime());
 
 5855     std::sort(times.begin(), times.end());
 
 5857     unsigned len = times.size();
 
 5862     else if (len % 2 != 0) {
 
 5863         return times[(len - 1) / 2];
 
 5866     ND280Debug(
" end median track ");
 
 5868     return (times[len / 2] + times[len / 2 - 1]) / 2.0;
 
 5873     ND::THandle<ND::TReconBase>& 
object,
 
 5874     TLorentzVector& vertexPos,
 
 5875     int globpass, 
int vaea) 
 
 5881     int fgdRecoBinIndex = -1;
 
 5882     if (!fgdUtils::GetTrackRecoTimeBinIndex(event, 
object, fgdRecoBinIndex))
 
 5885     ND::THandle<ND::TAlgorithmResult> binRecon =
 
 5886     fgdUtils::getTimeBinResult(event, fgdRecoBinIndex);
 
 5887     if (!binRecon) 
return;
 
 5889     ND::THandle<ND::THitSelection> fgdHits = binRecon->GetHitSelection(
"fgd");
 
 5890     if (!fgdHits) 
return;
 
 5893     fgdUtils::SimpleVertexActivity(0, fgdHits, 
object, vertexPos, globpass, vaea);
 
 5910     ND::THandle<ND::TG4Trajectory> G4track = 
GetG4Trajectory(*
object, pur, eff);
 
 5923     tpcObject->
Status = 
object->CheckStatus(object->kSuccess);
 
 5924     tpcObject->
Chi2 = 
object->GetQuality();
 
 5925     tpcObject->
NDOF = 
object->GetNDOF();
 
 5926     tpcObject->
NNodes = 
object->GetNodes().size();
 
 5930     if (object->GetHits()) tpcObject->
NHits = object->GetHits()->size();
 
 5934     if (object->GetConstituents())
 
 5935         tpcObject->
NConstituents = object->GetConstituents()->size();
 
 5937     tpcObject->
isForward = (TrackingUtils::GetDirection(
object).Z() > 0);
 
 5940     TrackingUtils::GetMomentumError(
object);
 
 5941     tpcObject->
Charge = TrackingUtils::GetCharge(
object);
 
 5942     tpcObject->
EDeposit = TrackingUtils::GetEDeposit(
object);
 
 5944     TrackingUtils::GetWidth(
object).X();  
 
 5945     tpcObject->
Cone = TrackingUtils::GetCone(
object);
 
 5949     ND::THandle<ND::TReconState> firstState =
 
 5950     TrackingUtils::GetFirstState(*
object);
 
 5952         tpcObject->
FrontPosition = TrackingUtils::GetPosition(firstState);
 
 5954         TrackingUtils::GetPositionVariance(firstState);
 
 5955         tpcObject->
FrontDirection = TrackingUtils::GetDirection(firstState);
 
 5957         TrackingUtils::GetDirectionVariance(firstState);
 
 5958         tpcObject->
FrontMomentum = TrackingUtils::GetMomentum(firstState);
 
 5972     ND::THandle<ND::TReconState> lastState = TrackingUtils::GetLastState(*
object);
 
 5974         tpcObject->
BackPosition = TrackingUtils::GetPosition(lastState);
 
 5975         tpcObject->
BackPositionVar = TrackingUtils::GetPositionVariance(lastState);
 
 5976         tpcObject->
BackDirection = TrackingUtils::GetDirection(lastState);
 
 5978         TrackingUtils::GetDirectionVariance(lastState);
 
 5979         tpcObject->
BackMomentum = TrackingUtils::GetMomentum(lastState);
 
 5994     ND::THandle<ND::TReconPID> PID = object;
 
 5996         tpcObject->
Likelihoods.push_back(PID->GetPIDWeight());
 
 5997         ND::TReconObjectContainer::const_iterator it;
 
 5998         for (it = PID->GetAlternates().begin(); it != PID->GetAlternates().end();
 
 6000         ND::THandle<ND::TReconPID> alter = *it;
 
 6001         tpcObject->
Likelihoods.push_back(alter->GetPIDWeight());
 
 6008     const ND::TReconBase& 
object, 
double& purity, 
double& eff)
 
 6017     ND::TG4Trajectory traj;
 
 6018     ND::THandle<ND::THitSelection> hits = 
object.GetHits();
 
 6020         return ND::THandle<ND::TG4Trajectory>();
 
 6022     if (hits->size() < 1) {
 
 6023         return ND::THandle<ND::TG4Trajectory>();
 
 6026     int G4TrkId = TrackTruthInfo::GetG4TrajIDHits(*hits, eff, purity);
 
 6027     const ND::TND280Event& 
event = *(ND::TEventFolder::GetCurrentEvent());
 
 6028     ND::THandle<ND::TG4TrajectoryContainer> G4trajectories =
 
 6029     event.Get<ND::TG4TrajectoryContainer>(
"truth/G4Trajectories");
 
 6030     if (!G4trajectories) {
 
 6031         return ND::THandle<ND::TG4Trajectory>();
 
 6033     ND::TG4TrajectoryContainer::iterator trajIter = G4trajectories->begin();
 
 6034     ND::TG4TrajectoryContainer::iterator trajEnd = G4trajectories->end();
 
 6035     for (; trajIter != trajEnd; ++trajIter) {
 
 6036         ND::TG4Trajectory* trajectory = &(trajIter->second);
 
 6037         if (trajectory->GetTrackId() == G4TrkId) {
 
 6038             ND::THandle<ND::TG4Trajectory> traj(
new ND::TG4Trajectory((*trajectory)));
 
 6043     return ND::THandle<ND::TG4Trajectory>();
 
 6049     std::vector<int>& coinc,
 
 6054     std::vector<TG4VHit*> contrib;
 
 6056         contrib = mch->GetContributors();
 
 6058         contrib = mcd->GetContributors();
 
 6063     for (std::vector<ND::TG4VHit*>::const_iterator h = contrib.begin();
 
 6064         h != contrib.end(); ++h) {
 
 6066     ND::TG4HitSegment* g4hitseg = 
dynamic_cast<ND::TG4HitSegment*
>(*h);
 
 6067     if (g4hitseg != NULL) {
 
 6068         for (
unsigned int i = 0; i != g4hitseg->GetContributors().size(); ++i) {
 
 6069             unsigned int vv = g4hitseg->GetContributors()[i];
 
 6070             if (vv >= coinc.size()) coinc.resize(vv + 1);
 
 6080     ND::THandle<ND::TMCHit> mch,
 
 6081     ND::THandle<ND::TG4TrajectoryContainer> trajectories) 
 
 6085     if (!mch) 
return ND::THandle<ND::TG4Trajectory>();
 
 6086     if (!trajectories) 
return ND::THandle<ND::TG4Trajectory>();
 
 6088     std::vector<int> coinc;
 
 6089     coinc.resize(trajectories->size());
 
 6092     for (std::vector<ND::TG4VHit*>::const_iterator h =
 
 6093         (mch->GetContributors()).begin();
 
 6094         h != (mch->GetContributors()).end(); ++h) {
 
 6096     ND::TG4HitSegment* g4hitseg = 
dynamic_cast<ND::TG4HitSegment*
>(*h);
 
 6097     if (g4hitseg != NULL) {
 
 6098         for (
unsigned int i = 0; i != g4hitseg->GetContributors().size(); ++i) {
 
 6099             unsigned int vv = g4hitseg->GetContributors()[i];
 
 6100             if (vv >= coinc.size()) coinc.resize(vv + 1);
 
 6108         for (
unsigned int i = 0; i < coinc.size(); i++) {
 
 6109             if (coinc[i] > maxim) {
 
 6116             ND::THandle<ND::TG4Trajectory> traj(
 
 6117                 new ND::TG4Trajectory((*trajectories)[imax]));
 
 6121         return ND::THandle<ND::TG4Trajectory>();
 
 6126     const ND::THitSelection& hits, ND::THandle<ND::TG4Trajectory> traj,
 
 6127     ND::THitSelection& traj_hits) 
 
 6133     const ND::TND280Event& 
event = *(ND::TEventFolder::GetCurrentEvent());
 
 6134     ND::THandle<ND::TG4TrajectoryContainer> trajectories =
 
 6135     event.Get<ND::TG4TrajectoryContainer>(
"truth/G4Trajectories");
 
 6137     if (!trajectories) 
return;
 
 6140     for (ND::THitSelection::const_iterator ht = hits.begin(); ht != hits.end();
 
 6142     ND::THandle<ND::TComboHit> ch(*ht);
 
 6145         for (ND::THitSelection::const_iterator ch_member = ch->GetHits().begin();
 
 6146             ch_member != ch->GetHits().end(); ++ch_member) {
 
 6148         ND::THandle<ND::TMCHit> mch;
 
 6149         ND::THandle<ND::TMultiHit> mhit = *ch_member;
 
 6151             mch = *(mhit->begin());
 
 6155         ND::THandle<ND::TG4Trajectory> mainCont =
 
 6158             if (GetPointer(mainCont) == GetPointer(traj))
 
 6159             traj_hits.push_back(mch);
 
 6162         ND::THandle<ND::TMultiHit> mhit = *ht;
 
 6163         ND::THandle<ND::TMCHit> mch;
 
 6166             mch = *(mhit->begin());
 
 6170         ND::THandle<ND::TG4Trajectory> mainCont =
 
 6173             if (GetPointer(mainCont) == GetPointer(traj)) traj_hits.push_back(mch);
 
 6180     ND::THandle<ND::TReconBase> 
object) 
 
 6184     std::string reco_class_name = 
"";
 
 6186     ND::THandle<ND::TReconObjectContainer> conContainer =
 
 6187     object->GetConstituents();
 
 6189         ND::THandle<ND::TReconBase> object2 = *(conContainer->begin());
 
 6190         if (object2) reco_class_name = object2->ClassName();
 
 6193     return reco_class_name;
 
 6201     ND::THandle<ND::TReconObjectContainer> conContainer =
 
 6202     object->GetConstituents();
 
 6204     if (!conContainer) 
return true;
 
 6206     if (conContainer->size() > 1) 
return true;
 
 6208     ND::THandle<ND::TReconBase> object2 = *(conContainer->begin());
 
 6209     if (!object2) 
return true;
 
 6211     std::string reco_class_name = object2->ClassName();
 
 6213     if (reco_class_name.find(
"ND::TReconPID") != std::string::npos ||
 
 6214         reco_class_name.find(
"ND::TReconTrack") != std::string::npos)
 
 6222     ND::THandle<ND::TReconBase> t1, ND::TReconObjectContainer& trackerObjects) 
 
 6228         trackerObjects.push_back(t1);
 
 6232     ND::THandle<ND::TReconObjectContainer> t1const = t1->GetConstituents();
 
 6233     if (!t1const) 
return;
 
 6236     ND::TReconObjectContainer::const_iterator it1;
 
 6237     for (it1 = t1const->begin(); it1 != t1const->end(); it1++) {
 
 6238         ND::THandle<ND::TReconBase> 
object = *it1;
 
 6239         if (!
object) 
continue;
 
 6250         t1->UsesDetector(ND::TReconBase::kDSECal) ||
 
 6251     t1->UsesDetector(ND::TReconBase::kECal) ||
 
 6261     const ND::TReconObjectContainer& globalObjects,
 
 6262     const ND::TReconObjectContainer& trackerObjects) 
 
 6267     for (ND::TReconObjectContainer::const_iterator tt = globalObjects.begin();
 
 6268         tt != globalObjects.end(); tt++) {
 
 6269     ND::THandle<ND::TReconBase> gobject = *tt;
 
 6270     if (!gobject) 
continue;
 
 6273     ND::TReconObjectContainer trackerObjects2;
 
 6277     for (ND::TReconObjectContainer::iterator tt2 = trackerObjects2.begin();
 
 6278         tt2 != trackerObjects2.end(); tt2++) {
 
 6279     ND::THandle<ND::TReconBase> tobject2 = *tt2;
 
 6280     if (!tobject2) 
continue;
 
 6283     for (ND::TReconObjectContainer::const_iterator tt1 =
 
 6284         trackerObjects.begin();
 
 6285         tt1 != trackerObjects.end(); tt1++) {
 
 6286     ND::THandle<ND::TReconBase> tobject1 = *tt1;
 
 6287     if (!tobject1) 
continue;
 
 6291     if (fabs(tobject1->GetQuality() - tobject2->GetQuality()) < 1e-6 &&
 
 6292         tobject1->GetDetectors() == tobject2->GetDetectors()) {
 
 6307 ND::THandle<ND::TReconBase>
 
 6309     ND::THandle<ND::TReconBase> 
object) 
 
 6313     ND::THandle<ND::TReconBase> trackerIsoObject;
 
 6314     if (!object->UsesDetector(ND::TReconBase::kFGD) ||
 
 6315         object->UsesDetector(ND::TReconBase::kTPC) ||
 
 6316     object->UsesDetector(ND::TReconBase::kECal) ||
 
 6317     object->UsesDetector(ND::TReconBase::kDSECal) ||
 
 6320     return trackerIsoObject;
 
 6323     bool printStuff = 
true;
 
 6324     double objecttime = -1.e10;
 
 6325     ND::THandle<ND::TReconObjectContainer> cons = 
object->GetConstituents();
 
 6326     int ncons = cons->size();
 
 6328         std::cout << 
"Found an FGD-only track" << std::endl;
 
 6330             std::cout << 
"  and has " << ncons << 
" constituents" << std::endl;
 
 6332             std::cout << 
"  and has no constituents" << std::endl;
 
 6335     ND::THandle<ND::TReconTrack> track = object;
 
 6336     ND::THandle<ND::TReconPID> pid = object;
 
 6338         if (printStuff) std::cout << 
"   object is a track" << std::endl;
 
 6339         objecttime = track->GetPosition().T();
 
 6341         if (printStuff) std::cout << 
"   object is a PID" << std::endl;
 
 6342         objecttime = pid->GetPosition().T();
 
 6344         std::cout << 
"Not a track or a PID?" << std::endl;
 
 6347         std::cout << 
"object time is " << objecttime << std::endl;
 
 6348         for (
int i = 0; i < ncons; i++) {
 
 6349             std::cout << 
"cons " << i << 
" detectors: P" 
 6356             << (*cons)[i]->UsesDetector(ND::TReconBase::kECal)
 
 6357             << (*cons)[i]->UsesDetector(ND::TReconBase::kDSECal) << 
" S" 
 6363     ND::THandle<ND::TAlgorithmResult> trackerRecon =
 
 6364     ND::TEventFolder::GetCurrentEvent()->GetFit(
"trackerRecon");
 
 6367         ND::THandle<ND::TReconObjectContainer> trackerObjects =
 
 6368         trackerRecon->GetResultsContainer(
"final");
 
 6370         if (trackerObjects) {
 
 6371             for (ND::TReconObjectContainer::iterator tt = trackerObjects->begin();
 
 6372                 tt != trackerObjects->end(); tt++) {
 
 6373             if ((*tt)->UsesDetector(ND::TReconBase::kFGD) &&
 
 6374                 !(*tt)->UsesDetector(ND::TReconBase::kTPC)) {
 
 6375             ND::THandle<ND::TReconTrack> track = *tt;
 
 6376             ND::THandle<ND::TReconPID> pid = *tt;
 
 6377             double fgdtime = -1.e10;
 
 6379                 std::cout << 
"   fgd object is a track?!?!?!?" << std::endl;
 
 6380                 fgdtime = track->GetPosition().T();
 
 6382                 if (printStuff) std::cout << 
"   fgd object is a PID" << std::endl;
 
 6383                 fgdtime = pid->GetPosition().T();
 
 6385                 std::cout << 
"fgd not a track or a PID?" << std::endl;
 
 6388                 std::cout << 
"fgd object time is " << fgdtime << std::endl;
 
 6389             if (fabs(fgdtime - objecttime) < 1.e-3) {
 
 6390                 if (printStuff) std::cout << 
"replacing..." << std::endl;
 
 6391                 trackerIsoObject = *tt;
 
 6395                     if (printStuff) std::cout << 
"---no TPC component" << std::endl;
 
 6400             << 
"Why doesn't trackerRecon final results container exist?!?!?!?!?" 
 6404         std::cout << 
"Why doesn't trackerRecon result exist?!?!?!?!? " << std::endl;
 
 6406     if (!trackerIsoObject && printStuff) {
 
 6408         << 
"!!!!!!!!!!!!!!!! ERROR:  FGD-only object NOT found!!!!!!!!!!!!!!!" 
 6412     return trackerIsoObject;
 
 6417     const ND::TReconObjectContainer& globalObjects) 
 
 6427     std::map<ND::THandle<ND::TReconBase>, std::vector<UInt_t> > brokenMap1;
 
 6430     std::map<ND::THandle<ND::TReconBase>, std::vector<UInt_t> > brokenMap2;
 
 6433     for (ND::TReconObjectContainer::const_iterator tt = globalObjects.begin();
 
 6434         tt != globalObjects.end(); tt++) {
 
 6435     ND::THandle<ND::TReconBase> 
object = *tt;
 
 6436     if (!
object) 
continue;
 
 6439     std::vector<UInt_t> brokenIDs1;
 
 6440     std::vector<UInt_t> brokenIDs2;
 
 6441     bool found = 
GetBrokenIDs(
object, brokenIDs1, brokenIDs2);
 
 6445         brokenMap1[object] = brokenIDs1;
 
 6446         brokenMap2[object] = brokenIDs2;
 
 6449             std::cout << 
" - " << 
object->GetUniqueID() << 
" " << 
object 
 6451             std::cout << 
"     --> broken IDs1: ";
 
 6452             for (
unsigned int i = 0; i < brokenIDs1.size(); i++) {
 
 6453                 std::cout << 
" " << brokenIDs1[i];
 
 6455             std::cout << std::endl;
 
 6456             std::cout << 
"     --> broken IDs2: ";
 
 6457             for (
unsigned int i = 0; i < brokenIDs2.size(); i++) {
 
 6458                 std::cout << 
" " << brokenIDs2[i];
 
 6460             std::cout << std::endl;
 
 6466         std::map<ND::THandle<ND::TReconBase>, std::vector<UInt_t> >::const_iterator
 
 6468         std::map<ND::THandle<ND::TReconBase>, std::vector<UInt_t> >::const_iterator
 
 6470         for (tt1 = brokenMap1.begin(); tt1 != brokenMap1.end(); tt1++) {
 
 6471             ND::THandle<ND::TReconBase> object1 = tt1->first;
 
 6472             if (!object1) 
continue;
 
 6474             const std::vector<UInt_t>& brokenIDs1 = tt1->second;
 
 6476             std::vector<UInt_t> brokenIDsFinal;
 
 6480             for (tt2 = brokenMap2.begin(); tt2 != brokenMap2.end(); tt2++) {
 
 6481                 ND::THandle<ND::TReconBase> object2 = tt2->first;
 
 6482                 if (!object2) 
continue;
 
 6484                 const std::vector<UInt_t>& brokenIDs2 = tt2->second;
 
 6486                 for (
unsigned int i = 0; i < brokenIDs1.size(); i++) {
 
 6487                     for (
unsigned int j = 0; j < brokenIDs2.size(); j++) {
 
 6488                         if (brokenIDs1[i] == brokenIDs2[j]) {
 
 6489                             brokenIDsFinal.push_back(object2->GetUniqueID());
 
 6504                     std::cout << 
" - " << object1->GetUniqueID() << 
" " << object1
 
 6506                     std::cout << 
"     --> broken IDs FINAL: ";
 
 6507                     for (
unsigned int i = 0; i < brokenIDsFinal.size(); i++) {
 
 6508                         std::cout << 
" " << brokenIDsFinal[i];
 
 6510                     std::cout << std::endl;
 
 6518     std::vector<UInt_t>& brokenIDs1,
 
 6519     std::vector<UInt_t>& brokenIDs2) 
 
 6526     ND::THandle<ND::TDataVector> broken =
 
 6527     object->Get<ND::TDataVector>(
"brokenID");
 
 6529         brokenIDs1.push_back(object->GetUniqueID());
 
 6531         for (
unsigned int i = 0; i < broken->size(); i++) {
 
 6532             UInt_t ID = broken->At<ND::TIntegerDatum>(i)->GetValue();
 
 6533             brokenIDs2.push_back(ID);
 
 6538     if (ReconObjectUtils::GetOriginalObject(
object)) {
 
 6539         found = 
GetBrokenIDs(ReconObjectUtils::GetOriginalObject(
object),
 
 6540             brokenIDs1, brokenIDs2);
 
 6544         ND::THandle<ND::TReconObjectContainer> cons = 
object->GetConstituents();
 
 6545         if (!cons) 
return found;
 
 6547         for (ND::TReconObjectContainer::const_iterator tt = cons->begin();
 
 6548             tt != cons->end(); tt++) {
 
 6550         ND::THandle<ND::TReconPID> object2 = *tt;
 
 6551         if (!object2) 
continue;
 
 6553         bool found2 = 
GetBrokenIDs(object2, brokenIDs1, brokenIDs2);
 
 6554         if (found2) found = 
true;
 
 6558     if (found) brokenIDs1.push_back(object->GetUniqueID());
 
 6573     ND::THandle<ND::TReconBase> fgdCons;
 
 6574     ND::THandle<ND::TReconPID> fgdPid;
 
 6575     ND::THandle<ND::TReconTrack> fgdTrack;
 
 6584                 ND::TReconObjectContainer::const_iterator it =
 
 6585                 fgdPid->GetConstituents()->begin();
 
 6590         if (fgdTrack && fgdTrack->Has<ND::TIntegerDatum>(
"matchingFailure_flag")) {
 
 6592             fgdTrack->Get<ND::TIntegerDatum>(
"matchingFailure_flag")->GetValue();
 
 6605                 ND::TReconObjectContainer::const_iterator it =
 
 6606                 fgdPid->GetConstituents()->begin();
 
 6611         if (fgdTrack && fgdTrack->Has<ND::TIntegerDatum>(
"matchingFailure_flag"))
 
 6613         fgdTrack->Get<ND::TIntegerDatum>(
"matchingFailure_flag")->GetValue();
 
Int_t fNP0DECAL
Number of objects containing the P0DECAL. 
 
double PIDWeightMuon
PID weights for muon hypothesis. 
 
void FillSMRDInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
double PullPion
The FGD PID pull value for a pion. 
 
double PID_FrontBackRatio
The ratio of the charge in equal length blocks at each end of the track. 
 
bool IsTrackLike(ND::THandle< ND::TReconBase > object)
 
double PIDWeightProt
PID weights for proton hypothesis. 
 
void FillGlobalPIDAlternates(ND::THandle< ND::TG4Trajectory > G4track, ND::THandle< ND::TReconBase > object, TGlobalPID &globalObject)
 
void FillGlobalHit(ND::THandle< ND::THit > hit, TGlobalHit &gHit)
 
double dEdxexpMuon
Estimated dE/dx for muon hypothesis. 
 
double Length
The length of the track or shower, its value depends on if the object is reconstructed as track-like ...
 
void GetConstituentsInTracker(ND::THandle< ND::TReconBase > t1, ND::TReconObjectContainer &trackerObjects)
 
int NHits
The number of constituent hits. 
 
TVector3 BackDirection
The direction of the object. 
 
int ExitOK[NDETSEXTRAP]
Status of the subdetector exit. 
 
Int_t NECALs
Number of ECAL objects. 
 
void FillP0DInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
double Quality
The quality of the fit. 
 
double PID_Circularity
Pid Variables, For more info on the Pid variable see the documentation in ecalRecon or the technical ...
 
Int_t NTRACKERs
Number of Tracker objects. 
 
double RangeMomentumEndToTPCProton
the momentum by range for the proton hypothesis (from end to a TPC) 
 
float chargePerLayer[2][30]
Summed hit charge for layer x in FGD1 (chargePerLayer[0][x]), and 2 (chargePerLayer[1][x]) ...
 
double PullMuon
The FGD PID pull value for a muon. 
 
double PullElectron
The FGD PID pull value for an electron. 
 
TLorentzVector Position
The position of the vertex. 
 
TClonesArray * Constituents
Constituent tracks. 
 
Int_t fNSMRDRightUnused
Number of hits unused in the SMRDRight. 
 
An object to describe a reconstructed PID. 
 
UInt_t UniqueID
Unique identifier for global recon objects (needed fro broken association) 
 
double SigmaEle
Sigma estimated width of TPC pid electron hypothesis. 
 
int NDOF
The number of degrees of freedom. 
 
double fgdEA_verNextNextNearQ_rect
FGD end activity values. 
 
TLorentzVector BackPosition
The position of the object. 
 
double fgdVA_verNearQ
FGD vertex activity values. 
 
double RangeMomentumEndToTPCPion
the momentum by range for the pion hypothesis (from end to a TPC) 
 
double ExitMomentumErr[NDETSEXTRAP]
The error of the momentum of the object at the exit of each subdetector. 
 
virtual void InitializeBranches()
Initialize Branches. Don't do anything else in this function. 
 
double FrontMomentumError
the error on the momentum of the object 
 
double fgdVA_totalQ
FGD vertex activity values. 
 
double minTime
Bin start time. 
 
double Length
The length of the track or shower (RMS) 
 
double PID_ShowerAngle
The angle from the start of an object to its width at its charge centre. 
 
std::vector< int > fgdhits_TrajID
Vector to store the ID of the Trajectory that created the hit. 
 
TClonesArray * FGD2Unused
The vector unused hits in FGD2. 
 
std::vector< int > TPCGasPathIDs
The IDs of the TREx paths which contributed to the object. 
 
TLorentzVector BackPosition
The position of the object. 
 
std::vector< std::string > fALLMODULES
 
std::vector< float > SFGHitPositionX
Vector to store the Xposition of each hit in SFG. 
 
double EMEnergyFit_Uncertainty
The uncertainty of the EM energy fit to the cluster. 
 
TTrueParticle TrueParticle
The associated true particle. 
 
double FrontMomentumError
The uncertainty on ND::TSubBaseObject::FrontMomentum. 
 
double Chi2
The chi2 of the fit. 
 
Int_t NDsECALs
Number of DsECAL objects. 
 
void FillUnusedHits(ND::TND280Event &event)
 
std::vector< float > SFGHitPositionY
Vector to store the Y position of each hit in SFG. 
 
TLorentzVector PositionVarAtTrueVertex
The position variance at the true vertex. 
 
const int NDETSEXTRAP
For questions or suggestions about this module please contact the current responsible and CC in the e...
 
Int_t NFGDs
Number of FGD objects. 
 
double fgdEA_verNearQ_rect
FGD end activity values. 
 
double FrontMomentum
The momentum measurement at the 'front' of the object. 
 
int g4ID
The ID for the G4 trajectory that contributed most to this time bin. 
 
double RangeMomentumProton
the momentum by range for the proton hypothesis 
 
virtual Bool_t ProcessFirstEvent(ND::TND280Event &event)
Is called after the first event is loaded in. 
 
unsigned long Detectors
Detectors used, defined according to the formula in GetDetectorNumber. 
 
Int_t NSFGUnused
Number of hits unused in SFG. 
 
double SigmaPion
Sigma estimated width of TPC pid pion hypothesis. 
 
int Status
The status for the fit. 
 
double PID_LLR_MIP_EM_LowMomentum
A combined discriminator for separating MIPs from EM showers. This is similar to LLR_MIP_EM but train...
 
An object to describe a reconstructed PID. 
 
TTrueParticle TrueParticle
The true particle. 
 
double Chi2
The chi2 of the fit. 
 
double ComputeTrackLength(ND::THandle< ND::TReconBase > object)
 
TClonesArray * fVertices
The TGlobalVertex vector of vertices. 
 
TVector3 FrontDirection
The direction of the object. 
 
bool SortNodesInXReverse(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
void FillDetectorUsed(ND::THandle< ND::TReconBase > object, bool dets[])
 
void SetDetectorUsed(unsigned long &BitField, ESubdetector det)
 
int NegPionBraggCut
Bragg peak cut (only used for SFGD contained tracks) 
 
void FillTrueParticle(ND::THandle< ND::TG4Trajectory > G4track, double pur, double eff, ND::TTrueParticle &part)
 
void FillSfgTimeBins(ND::TND280Event &event)
 
std::vector< double > Likelihoods
 
double fgdVA_verQ
FGD vertex activity values. 
 
TLorentzVector BackPosition
The position of the object. 
 
int EntranceOK[NDETSEXTRAP]
Status of the subdetector entrance. 
 
double fgdVA_verNextNearQ
FGD vertex activity values. 
 
TLorentzVector BackPositionVar
The position variance;. 
 
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
 
TLorentzVector FrontPosition
The global coordinate position at the 'front' of the object. 
 
bool GetIncomingParticle(const ND::TG4PrimaryVertex &G4vertex, ND::TG4PrimaryParticle &incoming)
 
int GetTrackerDetectorNumber(ND::THandle< ND::TReconBase > object)
 
TVector3 DirectionVarAtTrueVertex
The direction variance at the true vertex. 
 
double Charge
Deposited charge. 
 
double Eff
The efficiency for matching the rec particle with the true particle. 
 
bool IsTrackerOnly(ND::THandle< ND::TReconBase > t1)
 
unsigned long Status
The status for the fit. 
 
void FillFgdTimeBins(ND::TND280Event &event)
 
std::vector< double > NodeEDeposit_fit
 
std::vector< int > TPCGasPatternIDs
Variables to get the association between the global track and the gas ouptut involved The vectorS of ...
 
TVector3 FrontDirection
The direction of the object. 
 
Double_t ObjectLength
Recon object length in mm. 
 
Int_t fNDsECAL
Number of objects containing the DsECAL. 
 
double EMEnergyFit_Result
The result from the EM energy fit to the cluster. 
 
An object to hold specific TPC variables. 
 
std::vector< float > FGD1HitT
Vector to store the time of each hit in FGD1. 
 
double BackMomentum
the momentum of the object 
 
double MomentumAtTrueVertex
Momentum at the true vertex. 
 
std::string fDescription
A longish descrition of the analysis. 
 
void InitializeExtrapolationToDetectors()
 
TVector3 DirectionAtTrueVertex
Direction at the true vertex. 
 
std::vector< float > FGD1HitPosition
Vector to store the X or Y position of each hit in FGD1. 
 
std::map< ND::THandle< ND::TReconBase >, int > fTrackerGlobalIndexMap
 
int TrackType
Record of why the track was refit with a kalman filter fit instead of the likelihood fit...
 
std::vector< TVector3 > NodeDirVariance
Vector to store the variance on the direction of each node. 
 
int PionBraggCut
Bragg peak cut (only used for SFGD contained tracks) 
 
double Charge
Deposited charge. 
 
int CountDetector(ND::THandle< ND::TReconBase > object)
 
TLorentzVector Position
The position of the vertex. 
 
bool GetTPCDatum(ND::THandle< ND::TReconBase > object, const std::string &datum, std::vector< I > &vector) const 
A getter for TPC Datums to work both with TREx and TPC info. 
 
Int_t fNTPCOthers
The number of TPC other objects. 
 
Int_t NSFGs
Number of SFG objects. 
 
double RangeMomentumEndToTPCMuon
the momentum by range for the muon hypothesis (from end to a TPC) 
 
double fgdEA_verQ
FGD end activity values. 
 
double PID_TruncatedMaxRatio
A truncated Max Ratio. See ecalRecon docs for the full definition. 
 
double BackMomentum
the momentum of the object 
 
double avgtime
Averaged corrected node time. 
 
std::vector< int > NodeNHits
Vector to store the number of hits contributing to each node. 
 
std::vector< std::pair< unsigned long, TVector2 > > NodeTimes
vector of pairs, sub-detecor number and time-stamps of edge nodes in this subdetector ...
 
void CheckMatchingFailure(TTrackerObject *result, ND::THandle< ND::TReconBase > reco)
Method to find FGD constituent track from a matching object and fill matchingFailure_flag. 
 
An object to hold specific TRACKER variables. 
 
int ComputeParticleId(ND::THandle< ND::TReconPID > PID)
 
TClonesArray * fFgdTimeBins
Information for each hit time bin (TFgdTimeBins). 
 
std::vector< float > SFGHitPositionZ
Vector to store the X or Y position of each hit in SFG. 
 
Int_t fNP0D
Number of objects containing the P0D. 
 
TLorentzVector ExitPosition[NDETSEXTRAP]
The position of the object at the exit of each subdetector. 
 
double maxTime
Bin end time. 
 
void FillSFGInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
void FillTPCPID(ND::THandle< ND::TReconBase > object)
 
std::vector< TLorentzVector > HitPosition
 
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...
 
TClonesArray * fP0DUnused
The vector unused hits in the P0D (TGlobalHit). 
 
An object to store hit information for the SMRD subdetector. 
 
double SigmaMuon
Sigma estimated width of TPC pid muon hypothesis. 
 
TECALReconTrack Track
Objects to store information for a track. 
 
double Length
The length of the track or shower (RMS) 
 
double FrontCharge
the charge of the object at the first state 
 
TClonesArray * HitsSaved
the two first and two last hits (TGlobalHit). 
 
TClonesArray * TRACKER
Tracker specific variables. 
 
double RangeMomentumMuonFlip
the momentum by range for the flipped muon hypothesis 
 
void UpdateCoincidences(ND::THandle< ND::TMCHit > mch, ND::TMCDigit *mcdigit, std::vector< int > &coinc, int &nhits)
 
TLorentzVector FrontPosition
The position of the object. 
 
int NConstituents
The number of constituents. 
 
double PullProton
Pull for TPC pid proton hypothesis. 
 
double TrueE
True energy in an FGD. 
 
TVector3 FrontDirectionVar
The direction variance of the object. 
 
double SigmaKaon
Sigma estimated width of TPC pid kaon hypothesis. 
 
bool fPassedDetector[NDETSEXTRAP]
 
const bool debug_vertex_extrap
 
unsigned long GetDetectorNumber(ND::THandle< ND::TReconBase > object)
 
void FillTPCObject(ND::THandle< ND::TReconBase > object, TTPCObject &sub, int det)
 
std::vector< float > FGD2HitT
Vector to store the time of each hit in FGD2. 
 
Int_t fNTrECALIso
Number of objects in the TrECAL only. 
 
Int_t fPVInd
The last primary vertex index. 
 
double MomentumAtTrueVertex
The momentum at the true vertex. 
 
Double_t AverageHitTime
Average time of hits in reconstructed object. 
 
Int_t fNTPC
Number of objects containing the TPC. 
 
TVector3 FrontDirection
The Front direction of the object. 
 
TLorentzVector ExitPositionErr[NDETSEXTRAP]
The error of the position of the object at the exit of each subdetector. 
 
int NConstituents
The number of constituents. 
 
double Momentum
the momentum of the object 
 
TClonesArray * fSfgTimeBins
Information for each hit time bin (TSfgTimeBins). 
 
TLorentzVector Position
Position of the correspponding object. 
 
TVector3 FrontDirection
The direction at the 'front' of the object. 
 
double TPCLength
TPC track length. 
 
TLorentzVector PosVariance
Variance on the position of the corresponding object. 
 
int Counter
SMRD scint number. 
 
std::vector< double > PIDWeight
The weights for the PID hypotheses, c.f. TP0DObject::ParticleId. 
 
double FrontMomentumError
the error on the momentum of the object 
 
Int_t fNVertices
The number of added primary vertices. 
 
virtual ~TOutermostHits()
 
TECALReconShower Shower
Objects to store information for a shower. 
 
double EDeposit
Energy deposit. 
 
bool GetBrokenIDs(ND::THandle< ND::TReconBase > object, std::vector< UInt_t > &brokenIDs1, std::vector< UInt_t > &brokenIDs2)
 
An object to store subdetector-agnostic hit information. 
 
int Charge
Charge of the constituent track. 
 
double PEField
Placeholder for momentum of EField refit. 
 
void FillKinematics(ND::THandle< ND::TReconState > state, TLorentzVector &pos, TVector3 &dir, double &mom, double &momErr, double &charge, double(&cov)[7][7])
 
double sigmaE_pion
Expected energy uncertainty for a pion. 
 
double MomentumAtTrueVertex
Momentum at the true vertex. 
 
TVector3 chargeWeightedPos[2]
Charge weighted average hit position in FGD1 chargeWeightedPos[0]) and 2 (chargeWeightedPos[1]) ...
 
int ParticleId
the PDG code obtained in the recon combined PID 
 
bool SortNodesInYReverse(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
double AverageZPosition
Unweighted average Z position of object-constituent hits. 
 
double avgtime
Average fully corrected SFG hit time. 
 
double PID_LLR_Quality
A quality flag for the likelihood PID variables. Good quality = 0, Bad quality != 0...
 
int NDOF
For Vertices created using -O TGlobalReconModule=UseECalVertices the quality denotes. 
 
bool SortHitsInY(const ND::THandle< ND::THit > &h1, const ND::THandle< ND::THit > &h2)
 
double BackMomentumError
the error on the momentum of the object 
 
void FillConfigTree(TTree *configTree)
 
Int_t fNFgdTimeBins
Number of hit time bins in the FGD as determined by fgdRecon. 
 
TClonesArray * TPC
TPC specific variables. 
 
double minTime
Bin start time. 
 
std::vector< float > FGD2HitQ
Vector to store the charge of each hit in FGD2. 
 
unsigned long Detectors
Detectors used, defined according to the algorithm in GetDetectorNumber. 
 
int PrimaryIndex
The index of the corresponding primary vertex. 
 
int NNodes
The number of nodes. 
 
TGlobalHit hitMaxZ
Hit with highest Z position. 
 
ND::THandle< ND::TG4Trajectory > GetG4Trajectory(const ND::TReconBase &object, double &pur, double &eff)
 
double RangeMomentumEndToTPCElectron
the momentum by range for the electron hypothesis (from end to a TPC) 
 
double BackCharge
the momentum of the object at the back state 
 
TLorentzVector BackPosition
The global coordinate position at the 'back' of the object. 
 
virtual ~TGlobalReconModule()
 
double fgdEA_verNextNearQ_rect
FGD end activity values. 
 
TLorentzVector EntrancePosition[NDETSEXTRAP]
The position of the object at the entrance of each subdetector. 
 
bool SortNodesInY(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
double E_exp_electron
Expected energy deposit for an electron. 
 
std::vector< int > fgdhits_Layer
Vector to store the layer number of each hit. 
 
double sigmaE_muon
Expected energy uncertainty for a muon. 
 
double ChargeAtTrueVertex
Charge at the true vertex. 
 
std::vector< double > NodeEDeposit
 
TClonesArray * fTPCOthers
The vector of TPC other objects (TTPCOtherObject). 
 
dict::dictionary< int > fDetIndex
 
double EDeposit
The deposited charge for the object. 
 
TVector3 Direction
Direction of the corresponding object. 
 
Int_t fNTPCUnused
Number of hits unused in the TPC. 
 
TVector3 BackDirection
The direction at the 'back' of the object. 
 
bool DetectorUsed[NDETSUSED]
Detectors used (NDETSUSED = 23) 
 
TVector3 BackDirectionVar
The direction variance of the object. 
 
double Length
The total length of the object. 
 
int NbFittedHorizontalClusters
The number of horizontal clusters contributed to the fit, TREx. 
 
double FrontMomentum
the momentum of the object 
 
Int_t fBufferSize
Buffer Size for TBranch. 
 
double Charge
Charge from the TPC pid (+1, or -1) 
 
int Layer
SMRD hit layer number. 
 
Int_t fNFGD
Number of objects containing the FGD. 
 
double fgdVA_verNextNextNearQ_rect
FGD vertex activity 2x7. 
 
TVector3 EntranceDirection[NDETSEXTRAP]
The direction of the object at the entrance of each subdetector volume. 
 
double PID_LLR_EM_HIP
A combined discriminator for separating protons from electrons. 
 
double MomentumErrorAtTrueVertex
Error of the momentum at the true vertex. 
 
Int_t fNTPCIso
Number of objects in the TPC only. 
 
void FillTPCInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
double MomentumErrorAtTrueVertex
The error of the momentum at the true vertex. 
 
double maxTime
Bin end time. 
 
An object to hold specific FGD variables. 
 
double EntranceMomentum[NDETSEXTRAP]
The momentum of the object at the entrance of each subdetector. 
 
std::vector< int > FGD1HitLayer
Vector to store the layer number of each hit in FGD1. 
 
float chargePerLayerAttenCorr[30]
 
double fgdEA_verNextNearQ
FGD end activity values. 
 
double fgdEA_verNextNextNearQ
FGD end activity values. 
 
double PullNotSet
PullNotSet = 1 if the pull is not set, and 0 otherwise. 
 
TClonesArray * FGD1Unused
The vector unused hits in FGD1. 
 
double PID_Angle
The zenith angle with respect to each detector. 
 
int Yoke
Yoke ring number. 
 
double PDist
Placeholder for momentum of BField refit. 
 
bool SortNodesInX(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
int Type
Vertex type (0: Global vertex | 1: SFG vertex) 
 
double fgdEA_verLayQ
FGD end activity values. 
 
int PID
The TGlobalPID of the constituent track. 
 
Int_t fNSFG
Number of objects containing the SFG. 
 
Int_t fNPIDs
The number of global objects. 
 
double PullProton
The FGD PID pull value for a proton. 
 
std::vector< TLorentzVector > NodePosition
Vector to store the position and time of each node. 
 
TVector3 DirVariance
Direction variance of the corresponding object. 
 
double PullKaon
Pull for TPC pid kaon hypothesis. 
 
Int_t fNTrECAL
Number of objects containing the TrECAL. 
 
Int_t fNSMRD
Number of objects containing the SMRD. 
 
Int_t fNSFGIso
Number of objects in the SFG only. 
 
TClonesArray * fSMRDUnused
The vector unused hits in the SMRD (TSMRDHit). 
 
Describes a reconstructed ECalObject. 
 
double fgdVA_verNearQ_rect
FGD vertex activity 2x3. 
 
Int_t fNSMRDLeftUnused
Number of hits unused in the SMRDLeft. 
 
ND::THandle< ND::TReconBase > GetTrackerReconVersionOfFGDIsoTrack(ND::THandle< ND::TReconBase > object)
 
Int_t NSMRDs
Number of SMRD objects. 
 
TClonesArray * SFG
SFG specific variables. 
 
double fgdVA_otherUpQ
FGD vertex activity values. 
 
Int_t NHitsSaved
Number of entries in the HitsSaved array. 
 
std::vector< std::vector< int > > NodeHits
Vector to store the hits contributing to each node. 
 
TVector3 ConeAngle
The shower opening angle. 
 
UInt_t UniqueID
Unique identifier for sub-detector recon objects. 
 
bool DetectorUsed[NDETSUSED]
Detectors used. Index order from 0 to 26. 
 
An object to describe a reconstructed PID. 
 
std::vector< int > T0Source
The T0Source, the values are defined in TTPCFitStatusBranch.hxx, the TTPCT0Source enumeration...
 
Int_t fNSMRDTopUnused
Number of hits unused in the SMRDTop. 
 
double MedianObjectTime(ND::THandle< ND::TReconBase > object)
 
std::vector< int > ParticleIds
the PDG codes obtained in the recon combined PID 
 
void FillFirstLastHits(ND::THitSelection &hits, TGlobalPID &globalObject)
 
std::string fCVSID
Defined if an official tagged version. 
 
double Ccorr
Corrected truncated mean charge deposit in PID. 
 
void FillAllHits(ND::THitSelection &hits, TGlobalPID &globalObject)
 
double fgdVA_totalCorrE
FGD vertex activity values. 
 
std::vector< TLorentzVector > NodePosition
FGD Node positions. 
 
Int_t NP0DECALs
Number of P0DECAL objects. 
 
double x
Distance traveled in an FGD. 
 
TVector3 Momentum
3-momentum of the constituent track 
 
An object to hold a reconstructed vertex constituent track. 
 
TVector3 ExitDirection[NDETSEXTRAP]
The direction of the object at the exit of each subdetector. 
 
TVector3 ExitDirectionErr[NDETSEXTRAP]
The error of the direction of the object at the exit of each subdetector. 
 
double BackMomentum
The momentum measurement at the 'back' of the object. 
 
double BackStateCov[7][7]
full covariance matrix for last state: pos, dir, qp 
 
int NHits
The number of hits. 
 
double RangeMomentumPion
the momentum by range for the pion hypothesis 
 
std::vector< int > HitTrajID
Vector to store the ID of the Trajectory that created the hit. 
 
An object to described a P0D shower. 
 
ND::THandle< ND::TG4Trajectory > GetMainContributor(ND::THandle< ND::TMCHit > mch, ND::THandle< ND::TG4TrajectoryContainer > trajectories)
 
double Chi2
The chi2 of the fit. 
 
bool SenseOK
Sense of object. 
 
void FillSFGOther(ND::TND280Event &event)
 
void FillGlobalPIDAlternate(ND::THandle< ND::TG4Trajectory > G4track, ND::THandle< ND::TReconBase > object, TGlobalPIDAlternate &PIDAlternate)
 
double EDeposit
Deposited energy. Its value depends on if the object is reconstructed as track-like or shower-like If...
 
TClonesArray * SMRD
SMRD specific variables. 
 
double E_exp_pion
Expected energy deposit for a pion. 
 
std::vector< TLorentzVector > NodePosition
 
Int_t fNP0DECALIso
Number of objects in the P0DECAL only. 
 
An object to hold specific SMRD variables. 
 
std::vector< float > fgdhits_Charge
Vector to store the charge of each hit. 
 
std::vector< double > PIDWeights
the PID likelihoods for combined PID 
 
int NDOF
The number of degrees of freedom in the fit. 
 
double GetTRealDatumValue(ND::THandle< ND::TReconBase > trb, char const *name, double const &defaultValue)
 
int Type
Object type, 0: Particle, 1: Track, 2: Cluster, 3: Shower, 4: Vertex. 
 
int ProtonBraggCut
Bragg peak cut (only used for SFGD contained tracks) 
 
double PIDWeightElec
PID weights for electron hypothesis. 
 
std::vector< double > NodeEDeposit
Vector to store the energy deposit of each node. 
 
double PID_LLR_MIP_Pion
Discriminator for tagging showering pions in a sample of MIP-like tracks. 
 
double sigmaE_proton
Expected energy uncertainty for a proton. 
 
double fgdEA_verNearQ
FGD end activity values. 
 
double PID_TransverseChargeRatio
A variable sensitive to the charge distribution in the plane transverse to a shower/track direction...
 
TGlobalHit hitMinX
Hit with lowest X position. 
 
bool SortHitsInX(const ND::THandle< ND::THit > &h1, const ND::THandle< ND::THit > &h2)
 
double avgtime
Average fully corrected FGD hit time. 
 
double Pur
The purity for matching the rec particle with the true particle. 
 
void SetNameTitle(char const *name, char const *title)
 
double EDeposit
The energy deposited in the shower. 
 
double RangeMomentumPionFlip
the momentum by range for the flipped pion hypothesis 
 
int Tower
SMRD Tower number. 
 
TVector3 Width
TrackShower width Filled depending on FilledAsShower. * Track: ND::TReconTrack::GetWidth * Shower: Al...
 
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. 
 
std::vector< int > FGD2HitLayer
Vector to store the layer number of each hit in FGD2. 
 
int NNodes
The number of nodes. 
 
Int_t fNFGDIso
Number of objects in the FGD only. 
 
void FillVertexInfo(ND::TND280Event &event, ND::THandle< ND::TReconObjectContainer > globalObjects)
 
std::vector< TVector3 > NodeDirection
Vector to store the direction of each node. 
 
double PID_LLR_MIP_EM
A combined discriminator for separating MIPs from EM showers. 
 
virtual bool FillTree(ND::TND280Event &)
Fill all the stuff that goes in the output tree. 
 
double PullPion
Pull for TPC pid pion hypothesis. 
 
TClonesArray * FGD
FGD specific variables. 
 
TVector3 Position
Hit position in global ND coordinates [mm]. 
 
Int_t NFGD2Unused
Number of hits unused in FGD2. 
 
TVector3 BackDirection
The direction of the object. 
 
void FillOutermostHits(ND::THitSelection &hits, double charge_cut, TOutermostHits &outer)
 
double Pur
Purity of reconstructed - true vertex association. 
 
double FrontMomentum
the momentum of the object 
 
double BackMomentumError
The uncertainty on ND::TSubBaseObject::BackMomentum. 
 
bool IsCurvBack
A curving-back object. 
 
Int_t NTrECALs
Number of TrECAL objects. 
 
ND::THandle< ND::TG4PrimaryVertex > GetG4Vertex(const ND::TReconBase &object, double &pur, double &eff)
 
unsigned long Status
The status for the fit. 
 
TVector3 BackDirectionVar
The direction variance of the object. 
 
Int_t fNFGD1Unused
Number of hits unused in the FGD1. 
 
void DoAssociationBetweenTrackerAndGlobalObjects(const ND::TReconObjectContainer &globalObjects, const ND::TReconObjectContainer &trackerObjects)
 
double dEdxexpPion
Estimated dE/dx for pion hypothesis. 
 
virtual void InitializeModule()
Initialize Module, override if necessary. 
 
TLorentzVector PositionVarAtTrueVertex
The position variance at the true vertex. 
 
TVector3 DirectionAtTrueVertex
Direction at the true vertex. 
 
TVector3 FrontDirectionVar
The direction variance of the object. 
 
TVector3 Cone
The opening angles of the reconstructed shower cone. 
 
double EDeposit
The deposited charge for the object. 
 
std::vector< float > SFGHitT
Vector to store the time of each hit in SFG. 
 
std::string AlgorithmName
The name of the algorithm that created this object. 
 
TLorentzVector BackPositionVar
The uncertainty on ND::TSubBaseObject::BackPosition. 
 
TClonesArray * P0D
P0D specific variables. 
 
An object to store the outermost hits in x,y, and z. 
 
double Eff
Efficiency of vertex association of tracks. 
 
TLorentzVector FrontPosition
The Front position of the object. 
 
void GetFGDSimpleVA(ND::TND280Event &event, ND::THandle< ND::TReconBase > &object, TLorentzVector &vertexPos, int globpass, int vaea)
 
double fgdVA_downMaxZ
FGD vertex activity values. 
 
void FillTrackerInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
double fgdVA_downCosTheta
FGD vertex activity values. 
 
TOutermostHits FGD2OutermostHits
A named collection of the outermost hits in X,Y, and Z from FGD2. 
 
double PullMuon
Pull for TPC pid muon hypothesis. 
 
TLorentzVector FrontPositionVar
The position variance;. 
 
void FillFGDInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
std::map< ND::THandle< ND::TReconBase >, int > fGlobalIndexMap
 
Describes a true G4 particle associated to a TGlobalPID. 
 
double MomentumErrorAtTrueVertex
The momentum variance at the true vertex. 
 
double E_exp_proton
Expected energy deposit for a proton. 
 
std::vector< int > ParticleId
A vector of potential PIDs, sorted by weight, c.f. TP0DObject::PIDWeight. 
 
double Time
Hit time [ns]. 
 
double dEdxexpProton
Estimated dE/dx for proton hypothesis. 
 
bool isForward
Sense of object. 
 
double fgdEA_otherDownQ
FGD end activity values. 
 
int NDOF
The number of degrees of freedom. 
 
void FillTrueVertex(bool, const ND::TG4PrimaryVertex &G4vertex, double pur, double eff, ND::TTrueVertex &vertex)
 
TClonesArray * ECAL
ECAL specific variables. 
 
double BackMomentumError
the error on the momentum of the object 
 
int Type
The hit 'type': (0=X,1=Y,2=Z) 
 
An object to store information about an SFG Time Bin. 
 
int GetNumberOfHits(ND::THandle< ND::TReconBase > object)
 
double BackMomentum
the momentum of the object 
 
TClonesArray * Alternates
List of alternate hypotheses. 
 
std::vector< UInt_t > BrokenUniqueIDs
the broken partners unique IDs 
 
std::vector< double > HitCharge
Vector to store the charge of each hit. 
 
std::string AlgorithmName
The name of the algorithm that created this object. 
 
An object to hold specific TPC variables. 
 
TLorentzVector FrontPositionVar
The uncertainty on ND::TSubBaseObject::FrontPosition. 
 
double PullEle
Pull for TPC pid electron hypothesis. 
 
Int_t fNDsECALIso
Number of objects in the DsECAL only. 
 
TLorentzVector EntrancePositionErr[NDETSEXTRAP]
The error of the position of the object at the entrance of each subdetector. 
 
TVector3 BackDirection
The Back direction of the object. 
 
unsigned long Status
The status for the fit, from: object->CheckStatus(object->kSuccess). 
 
std::vector< int > SFGHitTrajID
Vector to store the ID of the Trajectory that created the hit in SFG. 
 
void FillECALInfo(ND::THandle< ND::TReconBase > object, TGlobalPID &pid)
 
TVector3 Cone
The opening angles of the cone (only for showers) 
 
TClonesArray * fTPCPIDs
For tests only (TTpcPID). 
 
TLorentzVector PositionAtTrueVertex
Position at true vertex. 
 
double E_exp_muon
Expected energy deposit for a muon. 
 
double PIDWeight
the PID weight for this hypothesis 
 
TGlobalHit hitMinY
Hit with lowest Y position. 
 
bool fTestTPCInfo
For tests only. 
 
TGlobalHit hitMaxX
Hit with highest X position. 
 
int NNodes
The number of reconstruction nodes. 
 
bool FillVertex(ND::TND280Event &event, ND::THandle< ND::TReconVertex > vertex, bool primary)
 
int fgdContainment
Fully contained PID information. 
 
double RangeMomentumElectronFlip
the momentum by range for the flipped electron hypothesis 
 
double dEdxexpKaon
Estimated dE/dx for kaon hypothesis. 
 
double fgdVA_verNextNearQ_rect
FGD vertex activity 2x5. 
 
double Width
The width of the shower (perpendicular to the direction). 
 
double fgdEA_otherUpQ
FGD end activity End (1) or Exit (2) 
 
Int_t fSplitLevel
Split Level for TBranch. 
 
bool SortNodesInZ(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
TVector3 BackDirectionVar
The uncertainty on ND::TSubBaseObject::BackDirection. 
 
int Type
The hit 'type': (0=X,1=Y,2=Z) 
 
TClonesArray * P0DECAL
P0DECAL specific variables. 
 
Int_t fNSMRDBottomUnused
Number of hits unused in the SMRDBottom. 
 
double EntranceMomentumErr[NDETSEXTRAP]
The error of the momentum of the object at the entrance of each subdetector. 
 
std::vector< float > FGD2HitPosition
Vector to store the X or Y position of each hit in FGD2. 
 
Int_t fNSMRDUnused
Number of all hits unused in the SMRD. 
 
int NConstituents
The number of constituents. 
 
std::vector< float > fgdhits_Time
Vector to store the time of each hit. 
 
Int_t fNSVertices
Number of added secondary vertices. 
 
Int_t fNFGD2Unused
Number of hits unused in the FGD2. 
 
Int_t ID
The vertex ID from G4. 
 
TVector3 chargeWeightedPos
Charge weighted average hit position in SFG. 
 
double BackMomentumError
the error on the momentum of the object 
 
Int_t fNP0DIso
Number of objects in the P0D only. 
 
double Containment
Containment: contained = 1.0, not-contained = 0.0, default = -1.0. An object is classed as contained ...
 
TLorentzVector PositionAtTrueVertex
Position at the true vertex. 
 
double Length
The length of the track or shower (RMS) 
 
int NDOF
The number of degrees of freedom. 
 
std::map< ND::THandle< ND::TReconBase >, std::vector< UInt_t > > fBrokenIndexMap
 
An object to hold specific SFG variables. 
 
TLorentzVector BackPositionVar
The position variance;. 
 
TTrueParticle TrueParticle
The true particle. 
 
void MatchTrueVertex(ND::THandle< ND::TG4PrimaryVertexContainer > g4PrimVert)
 
double PIDWeightPion
PID weights for pion hypothesis. 
 
double FrontStateCov[7][7]
full covariance matrix for front state: pos, dir, qp 
 
TLorentzVector PositionAtTrueVertex
The position at the true vertex. 
 
double SigmaProton
Sigma estimated width of TPC pid proton hypothesis. 
 
TOutermostHits FGD1OutermostHits
A named collection of the outermost hits in X,Y, and Z from FGD1. 
 
bool isForward
Sense of object. 
 
std::vector< TLorentzVector > HitPosition
Vector to store the position of each hit. 
 
Int_t fNTPCPIDs
For tests only. 
 
TLorentzVector FrontPosition
The position of the object. 
 
std::vector< int > FGD2HitTrajID
Vector to store the ID of the Trajectory that created the hit in FGD1. 
 
double FrontMomentumError
the error on the momentum of the object 
 
void FillSubBaseObject(ND::THandle< ND::TReconBase > object, TSubBaseObject &sub, int det)
 
double RangeMomentumProtonFlip
the momentum by range for the flipped proton hypothesis 
 
bool IsFgdECalIncremental
A track created by FGD-ECal matching algorithm. 
 
double fgdVA_upMinZ
FGD vertex activity Vertex (1) or Entrance (2) 
 
std::string GetObjectType(ND::THandle< ND::TReconBase > object)
 
std::string fCVSTagName
Defined if an official tagged version. 
 
double RangeMomentumMuon
the momentum by range for the muon hypothesis 
 
double StateCovAtTrueVertex[7][7]
Full covariance matrix for the state: pos, dir, qp at the true vertex. 
 
double Time
Hit time [ns]. 
 
void FillBrokenTracksMap(const ND::TReconObjectContainer &globalObjects)
 
double fEarliestTrackMedianHitTime
Median hit time of the earliest track. 
 
int Wall
SMRD wall number, 0=Top, 1=Bottom, 2= Right, 3= Left. 
 
double EDeposit
The charge deposited by the track in units of MIPs. 
 
double Quality
Quality (chi2) of the constituent track. 
 
TVector3 PositionError
The variance on ND::TGlobalReconModule::TSMRDHit::Position [mm]. 
 
std::vector< int > TPCGasJunctionIDs
The IDs of the TREx junctions which contributed to the object. 
 
double sigmaE_electron
Expected energy uncertainty for an electron. 
 
double fgdVA_upCosTheta
FGD vertex activity values. 
 
An object to describe the true G4 vertex associated to the TGlobalVertex. 
 
void FillTPCOther(ND::TND280Event &event)
 
TVector3 EntranceDirectionErr[NDETSEXTRAP]
The error of the direction of the object at the entrance of each subdetector. 
 
Int_t NFGD1Unused
Number of hits unused in FGD1. 
 
std::string AlgorithmName
The name of the algorithm that created this object. 
 
TVector3 BackDirection
The direction of the object. 
 
An object to store information about an FGD Time Bin. 
 
TOutermostHits fP0DOutermostHits
Outermost hits in the P0D. 
 
int NHits
The number of hits. 
 
void CheckFGDdist(TLorentzVector &FGDPos, TVector3 fFGDActiveMin, TVector3 fFGDActiveMax)
 
virtual ~TTPCOtherObject()
 
TGlobalReconModule(const char *name="Global", const char *title="Global Recon Module")
Default Constructor. 
 
double RangeMomentumElectron
the momentum by range for the electron hypothesis 
 
virtual ~TVertexConstituent()
 
double fgdVA_otherDownQ
FGD vertex activity values. 
 
double rawChargeSum
Summed hit charge in SFG. 
 
TClonesArray * TrueVertices
The true vertex. 
 
double Chi2
The chi2 of the fit. 
 
void SetSplitLevel(Int_t splitlevel)
ROOT output parameters, usually no need to touch. 
 
double rawChargeSum[2]
Summed hit charge in FGD1 (rawChargeSum[0]), and 2 (rawChargeSum[1]) 
 
void FillExtrapolationToDetectors(ND::THandle< ND::TReconBase > object, TGlobalPID &globalObject)
 
int nHits[2]
Number of hits in FGD1 (nHits[0]), and 2 (nHits[1]) 
 
Int_t fNSFGUnused
Number of hits unused in the SFG. 
 
Int_t MostUpStreamLayerHit
The layer closest to the tracker that was hit by the object. 0 indexed. 
 
std::vector< float > SFGHitQ
Vector to store the charge of each hit in SFG. 
 
TVector3 Position
Hit position in global ND coordinates [mm]. 
 
Provides data members common to reconstructed objects from all sub detectors. 
 
TGlobalHit hitMaxY
Hit with highest Y position. 
 
virtual ~TTrackerObject()
 
TClonesArray * fPIDs
The vector of TGlobalPID. 
 
TVector3 FrontDirection
The direction of the object. 
 
std::vector< TVector3 > fgdhits_Position
Vector to store the X or Y position of each hit. 
 
void FillGlobalPIDs(ND::TND280Event &event, ND::THandle< ND::TReconBase > object)
 
std::vector< int > NVerRows
The number of vertical clusters in the track. 
 
double ExitMomentum[NDETSEXTRAP]
The momentum of the object at the exit of each subdetector. 
 
TVector3 FrontDirectionVar
The uncertainty on ND::TSubBaseObject::FrontDirection. 
 
TVector3 Cone
The opening angles of the cone (only for showers) 
 
double FrontMomentum
the momentum of the object 
 
An object to describe a reconstructed primary vertex candidate. 
 
double fgdVA_verLayQ
FGD vertex activity values. 
 
std::vector< float > FGD1HitQ
Vector to store the charge of each hit in FGD1. 
 
ND::THandle< ND::TG4Trajectory > GetParent(ND::THandle< ND::TG4Trajectory > G4track)
 
Int_t fNSMRDIso
Number on objects in the SMRD only. 
 
TLorentzVector FrontPosition
the PID likelihoods for combined PID 
 
Int_t NTPCs
Number of TPC objects. 
 
void FillKinematicsAtTrueVertex(ND::THandle< ND::TG4Trajectory > G4track, ND::THandle< ND::TReconBase > object, TLorentzVector &pos, TVector3 &dir, double &mom, double &momErr, double &charge, double(&cov)[7][7])
 
ND::TTrueVertex Vertex
True vertex associated to this TrueParticle. 
 
TVector3 PositionError
The variance on ND::TGlobalReconModule::TGlobalHit::Position [mm]. 
 
TVector3 DirectionAtTrueVertex
The direction at the true vertex. 
 
Int_t fNP0DUnused
Number of hits unused in the P0D. 
 
TGlobalHit hitMinZ
Hit with lowest Z position. 
 
Int_t NTrueVertices
The true vertex. 
 
unsigned long Status
The status for the fit. 
 
int Detector
Integer specifying which subdetector(s) the object belongs to. See TGlobalReconModule::GetDetectorNum...
 
void FillSmrdHit(ND::THandle< ND::THit > hit, TSMRDHit &smrdHit)
 
TECALReconVertexTrack * TECALReconVertexTrackFactory(ND::THandle< ND::TReconPID > trk, bool IsMC, void *pos, ND::THandle< ND::TG4TrajectoryContainer > trajectories, bool Allocate)
 
unsigned long Detectors
Detectors used. 
 
int g4ID
The ID for the G4 trajectory that contributed most to this time bin. 
 
TLorentzVector FrontPositionVar
The position variance;. 
 
TLorentzVector Variance
The position variance;. 
 
double E
Measured energy in an FGD. 
 
Int_t NConstituents
Constituent tracks. 
 
double dEdxexpEle
Estimated dE/dx for electron hypothesis. 
 
double EDeposit
Deposited energy, N.B. the meaning of this is subdetector-local. 
 
std::vector< TLorentzVector > NodePosVariance
Vector to store the variance on the position and time of each node. 
 
double PID_Asymmetry
Ratio of the big width of an object by its small width. 
 
double Width
The width of the shower (perpendicular to the direction) 
 
surface_vector fDetSurfaces[NDETSEXTRAP]
 
std::vector< int > FGD1HitTrajID
Vector to store the ID of the Trajectory that created the hit in FGD1. 
 
double fgdVA_verNextNextNearQ
FGD vertex activity values. 
 
Int_t NP0Ds
Number of P0D objects. 
 
bool SortHitsInZ(const ND::THandle< ND::THit > &h1, const ND::THandle< ND::THit > &h2)
 
bool SortNodesInZReverse(const ND::THandle< ND::TReconNode > &n1, const ND::THandle< ND::TReconNode > &n2)
 
TLorentzVector BackPosition
The Back position of the object. 
 
int nHits
Number of hits in SFG. 
 
Int_t NAlternates
Number of entries in the alternate hypotheses list. 
 
double Width
The width of the shower (perpendicular to the direction) 
 
Int_t fNSfgTimeBins
Number of hit time bins in the SFG as determined by sfgRecon. 
 
void GetHitsAssociatedToG4Trajectory(const ND::THitSelection &hits, ND::THandle< ND::TG4Trajectory > traj, ND::THitSelection &traj_hits)
 
int NbFittedVerticalClusters
The number of vertical clusters contributed to the fit, TREx. 
 
TClonesArray * SFGUnused
The vector unused hits in SFG. 
 
double NTrun
70% of the number of cluster 
 
TTrueParticle TrueParticle
The true particle. 
 
virtual void FillConfigTree(TTree *)
 
double EDeposit
Energy deposit of the corresponding object. 
 
Bool_t Configure(std::string &opt)
A function that allows the module to be configured from an external class without any dependencies...