// // Created by tbritton on 5/31/17. // #include #include #include #include #include #include #include #ifndef EVESTANDALONE_TRACKING_H #define EVESTANDALONE_TRACKING_H class Tracking { public: Tracking(DMagneticFieldMap* Bfield, DGeometry* Geom)//DGeometry { int RMAX_INTERIOR=65; int RMAX_EXTERIOR=89; rt=new DReferenceTrajectory(Bfield); rt->Rsqmax_interior = RMAX_INTERIOR*RMAX_INTERIOR;//innerBCAL radius rt->Rsqmax_exterior = RMAX_EXTERIOR*RMAX_EXTERIOR; rt->SetDRootGeom(NULL); rt->SetDGeometry(Geom); }; tao::json::value Add_DChargedTracks(vector ChargedTracks) { auto jsonTracks = tao::json::value::array({}); for(int i=0;i AllHypos; string BestPID_name = ParticleType(ChargedTracks[i]->Get_BestTrackingFOM()->PID()); string Bestname = BestPID_name + Form(" Track Points %i", i); tao::json::value track( { {"id", i}, {"BestTrackingPID", Bestname} }); for (int w=0;wdChargedTrackHypotheses.size();w++) { //TrackHypo* th= new TrackHypo; string PID_name=ParticleType(ChargedTracks[i]->dChargedTrackHypotheses[w]->PID()); string name = PID_name + Form(" Track Points %i", i); //cout<Reset(); //auto Track_ps = new TEvePointSet(); double mass = ChargedTracks[i]->dChargedTrackHypotheses[w]->mass(); rt->SetMass(mass); //rt.SetMass(TrackCandidates[i]->mass()); auto PID = ChargedTracks[i]->dChargedTrackHypotheses[w]->PID(); auto position = ChargedTracks[i]->dChargedTrackHypotheses[w]->position(); auto momentum = ChargedTracks[i]->dChargedTrackHypotheses[w]->momentum(); auto charge = ChargedTracks[i]->dChargedTrackHypotheses[w]->charge(); auto start_time = -1E9; if (!isnan(float(ChargedTracks[i]->dChargedTrackHypotheses[w]->time()))) { start_time = ChargedTracks[i]->dChargedTrackHypotheses[w]->time(); } double TrackChiSq_NDF = ChargedTracks[i]->Get_Hypothesis(PID)->Get_TrackTimeBased()->chisq / double(ChargedTracks[i]->Get_Hypothesis(PID)->Get_TrackTimeBased()->Ndof); rt->Swim(position, momentum, charge); //rt.Swim(TrackCandidates[i]->position(), TrackCandidates[i]->momentum(), TrackCandidates[i]->charge()); DReferenceTrajectory::swim_step_t *steps = rt->swim_steps; vector track_points; vector track_point_times; for (int j = 0; j < rt->Nswim_steps; j++) { DVector3 step_loc = steps[j].origin; //cout< 625) break; if (step_loc.Z() <= 0) continue; track_points.push_back(step_loc); track_point_times.push_back(steps[j].t);//flight time since start } //std::vector<> //for (int k = 0; k < ChargedTracks[i]->GetAssociatedAncestors()->size(); k++) { //} // event_out< NeutralTracks) { //ostringstream event_out; // event_out<<"\"neutral_tracks\": "<<"[\n";//JSON auto jsonnTracks = tao::json::value::array({}); for(int i=0;i AllHypos; string BestPID_name = ParticleType(NeutralTracks[i]->Get_BestFOM()->PID()); string Bestname = BestPID_name + Form(" Track Points %i", i); tao::json::value ntrack( { {"id", i}, {"BestTrackingPID", Bestname} }); for (int w = 0; w < NeutralTracks[i]->dNeutralParticleHypotheses.size(); w++) { string PID_name = ParticleType(NeutralTracks[i]->dNeutralParticleHypotheses[w]->PID()); string name = PID_name + Form(" Track Points %i", i); //cout<Reset(); rt->SetMass(NeutralTracks[i]->dNeutralParticleHypotheses[w]->mass()); //rt.SetMass(TrackCandidates[i]->mass()); auto momentum = NeutralTracks[i]->dNeutralParticleHypotheses[w]->momentum(); auto position = NeutralTracks[i]->dNeutralParticleHypotheses[w]->position(); auto mass = NeutralTracks[i]->dNeutralParticleHypotheses[w]->mass(); auto start_time = -1E9; if (!isnan(float(NeutralTracks[i]->dNeutralParticleHypotheses[w]->time()))) { start_time = NeutralTracks[i]->dNeutralParticleHypotheses[w]->time(); } rt->Swim(NeutralTracks[i]->dNeutralParticleHypotheses[w]->position(), momentum, NeutralTracks[i]->dNeutralParticleHypotheses[w]->charge()); //rt.Swim(TrackCandidates[i]->position(), TrackCandidates[i]->momentum(), TrackCandidates[i]->charge()); DReferenceTrajectory::swim_step_t *steps = rt->swim_steps; vector track_points; vector track_point_times; for (int j = 0; j < rt->Nswim_steps; j++) { DVector3 step_loc = steps[j].origin; //cout< 645/*625*/ ) break; if (step_loc.Z() <= 0) continue; track_points.push_back(step_loc); track_point_times.push_back(steps[j].t); } //event_out< track_points, vector track_point_times, double mass,TVector3 position) { tao::json::value track( { {"id", id}, {"charge", charge}, {"TrackChiSq_NDF", TrackChiSq_NDF}, {"momentum", momentum.Mag()}, {"mass", mass}, {"start_time", start_time}, {"px",momentum.X()}, {"py",momentum.Y()}, {"pz",momentum.Z()} }); auto jsonposArray = tao::json::value::array({}); //std::cout<