8 #include "canvas/Persistency/Common/FindManyP.h" 9 #include "dune/DuneObj/ProtoDUNEBeamEvent.h" 28 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
30 unsigned int trackIndex = track.
ID();
33 std::vector<anab::CosmicTag> trackTags;
36 const art::FindManyP<anab::CosmicTag> findCosmicTags(recoTracks,evt,trackModule);
37 for(
unsigned int t = 0;
t < findCosmicTags.at(trackIndex).size(); ++
t){
38 trackTags.push_back((*(findCosmicTags.at(trackIndex)[
t])));
50 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
52 unsigned int trackIndex = track.
ID();
55 std::vector<anab::T0> trackT0s;
58 const art::FindManyP<anab::T0> findTrackT0s(recoTracks,evt,trackModule);
59 for(
unsigned int t = 0;
t < findTrackT0s.at(trackIndex).size(); ++
t){
60 trackT0s.push_back((*(findTrackT0s.at(trackIndex)[
t])));
74 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
75 std::vector<anab::Calorimetry> caloInfo;
78 const art::FindManyP<anab::Calorimetry> findCalorimetry(recoTracks,evt,caloModule);
79 std::vector<art::Ptr<anab::Calorimetry>> theseCalos = findCalorimetry.at(track.
ID());
81 for(
auto calo : theseCalos){
82 caloInfo.push_back(*
calo);
86 std::cerr <<
"No track calorimetry object found... returning empty vector" <<
std::endl;
95 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
96 art::FindManyP<recob::Hit> findHits(recoTracks,evt,trackModule);
97 std::vector<art::Ptr<recob::Hit>> inputHits = findHits.at(track.
ID());
99 std::vector<const recob::Hit*> trackHits;
103 trackHits.push_back(
hit.get());
113 std::vector<const recob::Hit*> trackHits;
115 std::cout <<
"Please input plane 0, 1, or 2" <<
std::endl;
119 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
120 art::FindManyP<recob::Hit> findHits(recoTracks,evt,trackModule);
121 std::vector<art::Ptr<recob::Hit>> inputHits = findHits.at(track.
ID());
124 unsigned int thePlane =
hit.get()->WireID().asPlaneID().Plane;
125 if( thePlane != planeID )
continue;
127 trackHits.push_back(
hit.get());
138 unsigned int planeID = ps.
get<
unsigned int >(
"PlaneID" );
140 double betap = ps.
get<
double >(
"betap" );
141 double Rho = ps.
get<
double >(
"Rho" );
142 double Efield = ps.
get<
double >(
"Efield" );
143 double Wion = ps.
get<
double >(
"Wion" );
144 double alpha = ps.
get<
double >(
"alpha" );
145 double norm_factor = ps.
get<
double >(
"norm_factor" );
148 TFile X_correction_file = TFile( X_correction_name.c_str(),
"OPEN" );
149 TH1F * X_correction_hist = NULL;
151 bool UseNewVersion = ps.
get<
bool >(
"UseNewVersion", false );
154 X_correction_hist = (TH1F*)X_correction_file.Get( hist_name.c_str() );
158 X_correction_hist = (TH1F*)X_correction_file.Get(
"dqdx_X_correction_hist" );
162 std::vector< float > calibrated_dEdx;
167 size_t calo_position;
168 bool found_plane =
false;
169 for(
size_t i = 0; i < caloVector.size(); ++i ){
170 unsigned int thePlane = caloVector.at(i).PlaneID().Plane;
171 if( thePlane == planeID ){
179 std::cout <<
"Could not find the correct plane in the calorimetry vector" <<
std::endl;
180 return calibrated_dEdx;
183 std::vector< float > dQdX = caloVector.at( calo_position).dQdx();
184 auto theXYZPoints = caloVector.at( calo_position).XYZ();
188 if( hits.size() == 0 ){
189 std::cout <<
"Got empty hits vector" <<
std::endl;
190 return calibrated_dEdx;
194 for(
size_t i = 0; i < dQdX.size(); ++i ){
195 float hit_x = theXYZPoints[i].X();
196 int X_bin = X_correction_hist->FindBin( hit_x );
197 float X_correction = X_correction_hist->GetBinContent(X_bin);
199 float corrected_dq_dx = dQdX[i] * X_correction * norm_factor;
200 float scaled_corrected_dq_dx = corrected_dq_dx /
calib_factor;
201 float cal_de_dx =
calc_dEdX( scaled_corrected_dq_dx, betap, Rho, Efield, Wion, alpha );
203 calibrated_dEdx.push_back( cal_de_dx );
207 return calibrated_dEdx;
211 return (exp(dqdx*(betap/(Rho*Efield)*Wion))-alpha)/(betap/(Rho*Efield));
225 auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
226 std::vector<anab::ParticleID> pidvec;
229 const art::FindManyP<anab::ParticleID> findPID(recoTracks,evt,pidModule);
230 std::vector<art::Ptr<anab::ParticleID>> thePID = findPID.at(track.
ID());
232 for(
auto pid : thePID){
233 pidvec.push_back(*
pid);
237 std::cerr <<
"No track PID object found... returning empty vector" <<
std::endl;
247 theBrokenTrack.
Valid =
false;
249 double fBrokenTrackZ_low = BrokenTrackPars.
get<
double >(
"BrokenTrackZ_low" );
250 double fBrokenTrackZ_high = BrokenTrackPars.
get<
double >(
"BrokenTrackZ_high" );
252 double fStitchTrackZ_low = BrokenTrackPars.
get<
double >(
"StitchTrackZ_low" );
253 double fStitchTrackZ_high = BrokenTrackPars.
get<
double >(
"StitchTrackZ_high" );
255 double fStitchXTol = BrokenTrackPars.
get<
double >(
"StitchXTol" );
256 double fStitchYTol = BrokenTrackPars.
get<
double >(
"StitchYTol" );
262 if( fBrokenTrackZ_low < endZ && endZ < fBrokenTrackZ_high ){
264 const auto recoTracks = evt.
getValidHandle<std::vector<recob::Track> >(trackModule);
265 for(
auto const & tr : *recoTracks ){
268 if( tr.ID() == track.
ID() )
continue;
270 double stitchStartZ = tr.Trajectory().Start().Z();
271 if( fStitchTrackZ_low < stitchStartZ && stitchStartZ < fStitchTrackZ_high ){
272 double deltaX = fabs(endX - tr.Trajectory().Start().X());
273 double deltaY = fabs(endY - tr.Trajectory().Start().Y());
275 std::cout <<
"Possible stitching track: " << stitchStartZ <<
" " << deltaX <<
" " << deltaY <<
std::endl;
277 if( deltaX < fStitchXTol && deltaY < fStitchYTol ){
281 auto stitchDir = tr.StartDirection();
283 std::cout <<
"Cos_theta " << stitch_cos_theta <<
std::endl;
286 unsigned int planeID = CalorimetryPars.
get<
unsigned int >(
"PlaneID");
290 bool found_broken_calo =
false;
291 size_t calo_position= 0;
292 for(
size_t i = 0; i < broken_calos.size(); ++i ){
293 unsigned int thePlane = broken_calos.at(i).PlaneID().Plane;
294 if( thePlane == planeID ){
295 found_broken_calo =
true;
302 if( !found_broken_calo )
return theBrokenTrack;
304 auto broken_range = broken_calos.at( calo_position ).ResidualRange();
305 auto broken_dQdx = broken_calos.at( calo_position ).dQdx();
306 std::vector< float > broken_cal_dEdx =
CalibrateCalorimetry( track, evt, trackModule, caloModule, CalorimetryPars );
311 bool found_stitch_calo =
false;
312 for(
size_t i = 0; i < stitch_calos.size(); ++i ){
313 unsigned int thePlane = stitch_calos.at(i).PlaneID().Plane;
314 if( thePlane == planeID ){
315 found_stitch_calo =
true;
322 if( !found_stitch_calo )
continue;
324 auto stitch_range = stitch_calos.at( calo_position ).ResidualRange();
325 auto stitch_dQdx = stitch_calos.at( calo_position ).dQdx();
326 std::vector< float > stitch_cal_dEdx =
CalibrateCalorimetry( tr, evt, trackModule, caloModule, CalorimetryPars );
329 std::vector< float > combined_range, combined_dQdx, combined_dEdx;
332 combined_range = stitch_range;
333 if( stitch_range[0] > stitch_range.back() ){
334 std::cout <<
"Adding range: " << stitch_range[0] <<
std::endl;
335 for(
size_t i = 0 ; i < broken_range.size(); ++i ){
336 combined_range.push_back( broken_range[i] + stitch_range[0] );
340 std::cout <<
"Adding range: " << stitch_range[0] <<
std::endl;
341 for(
size_t i = 0 ; i < broken_range.size(); ++i ){
342 combined_range.push_back( broken_range[i] + stitch_range.back() );
346 for(
size_t i = 0; i < combined_range.size(); ++i ){
347 std::cout << combined_range[i] <<
std::endl;
350 combined_dQdx = stitch_dQdx;
351 combined_dQdx.insert( combined_dQdx.end(), broken_dQdx.begin(), broken_dQdx.end() );
352 combined_dEdx = stitch_cal_dEdx;
353 combined_dEdx.insert( combined_dEdx.end(), broken_cal_dEdx.begin(), broken_cal_dEdx.end() );
393 theBrokenTrack.
CosTheta = stitch_cos_theta;
397 theBrokenTrack.
Valid =
true;
399 return theBrokenTrack;
404 return theBrokenTrack;
411 std::vector< double > calo_dEdX;
412 std::vector< double > calo_range;
413 for(
size_t i = 0; i <
calo[0].dEdx().size(); ++i ){
414 calo_dEdX.push_back(
calo[0].
dEdx()[i] );
415 calo_range.push_back(
calo[0].ResidualRange()[i] );
418 return Chi2PID( calo_dEdX, calo_range, profile );
424 double pid_chi2 = 0.;
427 if( track_dedx.size() < 1 || range.size() < 1 )
428 return std::make_pair(9999., -1);
431 for(
size_t i = 1; i < track_dedx.size()-1; ++i ){
434 if( track_dedx[i] > 1000. || track_dedx[i] < 0.) {
438 int bin = profile->FindBin( range[i] );
439 if( bin >= 1 && bin <= profile->GetNbinsX() ){
441 double template_dedx = profile->GetBinContent( bin );
442 if( template_dedx < 1.
e-6 ){
443 template_dedx = ( profile->GetBinContent( bin - 1 ) + profile->GetBinContent( bin + 1 ) ) / 2.;
446 double template_dedx_err = profile->GetBinError( bin );
447 if( template_dedx_err < 1.
e-6 ){
448 template_dedx_err = ( profile->GetBinError( bin - 1 ) + profile->GetBinError( bin + 1 ) ) / 2.;
452 double dedx_res = 0.04231 + 0.0001783 * track_dedx[i] * track_dedx[i];
453 dedx_res *= track_dedx[i];
456 pid_chi2 += (
pow( (track_dedx[i] - template_dedx), 2 ) / (
pow(template_dedx_err, 2) +
pow(dedx_res, 2) ) );
463 return std::make_pair(9999., -1);
467 return std::make_pair(pid_chi2, npt);
473 auto recoTracks = evt.
getValidHandle< std::vector< recob::Track > >(trackModule);
474 art::FindManyP< recob::Hit, recob::TrackHitMeta > trackHitMetas(recoTracks,evt,trackModule);
475 art::FindManyP< recob::Hit > findHits(recoTracks,evt,trackModule);
477 std::vector< art::Ptr< recob::Hit > > track_hits = findHits.at( track.
ID() );
481 size_t beam_index = 0;
482 for(
size_t i = 0; i < recoTracks->size(); ++i ){
483 if( (*recoTracks)[i].ID() == track.
ID() ){
491 std::map< size_t, const recob::Hit * > results;
492 if( trackHitMetas.isValid() ){
494 auto beamHits = trackHitMetas.at( beam_index );
495 auto beamMetas = trackHitMetas.data( beam_index );
497 for(
size_t i = 0; i < beamHits.size(); ++i ){
503 std::cout <<
"Has no valid hit: " << beamMetas[i]->Index() <<
std::endl;
509 for(
size_t j = 0; j < track_hits.size(); ++j ){
513 if( beamHits[i].
key() == track_hits[j].key() ){
517 <<
"Requested track trajectory index " << beamMetas[i]->Index()
519 <<
" for track index " << beam_index
520 <<
". Something is wrong with the track reconstruction. Please contact tjyang@fnal.gov";
525 results[ beamMetas[i]->Index() ] = track_hits[j].get();
548 double trackDirX = 0.;
549 double trackDirY = 0.;
550 double trackDirZ = 0.;
553 if( flip && ( endZ < startZ ) ){
558 trackDirX = -1. * endDir.X();
559 trackDirY = -1. * endDir.Y();
560 trackDirZ = -1. * endDir.Z();
563 trackDirX = startDir.X();
564 trackDirY = startDir.Y();
565 trackDirZ = startDir.Z();
571 double beamDirX = 0.;
572 double beamDirY = 0.;
573 double beamDirZ = 0.;
577 std::vector<art::Ptr<beam::ProtoDUNEBeamEvent>> beamVec;
578 auto beamHandle = evt.
getValidHandle< std::vector< beam::ProtoDUNEBeamEvent > >(
"beamevent");
580 if( beamHandle.isValid()){
586 const std::vector< recob::Track > & beamTracks = beamEvent.
GetBeamTracks();
587 if( beamTracks.size() == 0 ){
588 std::cout <<
"Warning: no tracks associated to beam data" <<
std::endl;
591 else if( beamTracks.size() > 1 ){
592 std::cout <<
"Warning: mutiple tracks associated to beam data" <<
std::endl;
596 beamX = beamTracks.at(0).Trajectory().End().X();
597 beamY = beamTracks.at(0).Trajectory().End().Y();
599 beamDirX = beamTracks.at(0).EndDirection().X();
600 beamDirY = beamTracks.at(0).EndDirection().Y();
601 beamDirZ = beamTracks.at(0).EndDirection().Z();
607 auto mcTruths = evt.
getValidHandle< std::vector< simb::MCTruth > >(
"generator");
611 if( !true_beam_particle ){
612 std::cout <<
"No true beam particle" <<
std::endl;
617 beamDirX = true_beam_particle->Px() / true_beam_particle->P();
618 beamDirY = true_beam_particle->Py() / true_beam_particle->P();
619 beamDirZ = true_beam_particle->Pz() / true_beam_particle->P();
622 beamX = true_beam_particle->Position(0).X() + (-1.*true_beam_particle->Position(0).Z())*(beamDirX / beamDirZ);
623 beamY = true_beam_particle->Position(0).Y() + (-1.*true_beam_particle->Position(0).Z())*(beamDirY / beamDirZ);
627 double deltaX = startX - beamX;
628 double deltaY = startY - beamY;
630 double costheta = beamDirX*trackDirX + beamDirY*trackDirY + beamDirZ*trackDirZ;
632 std::pair< double, double > startX_cut = BeamPars.
get< std::pair< double, double > >(
"TrackStartXCut");
633 std::pair< double, double > startY_cut = BeamPars.
get< std::pair< double, double > >(
"TrackStartYCut");
634 std::pair< double, double > startZ_cut = BeamPars.
get< std::pair< double, double > >(
"TrackStartZCut");
635 double costheta_cut = BeamPars.
get<
double >(
"TrackDirCut");
637 if( deltaX < startX_cut.first || deltaX > startX_cut.second )
639 if( deltaY < startY_cut.first || deltaY > startY_cut.second )
641 if( startZ < startZ_cut.first || startZ > startZ_cut.second )
643 if( costheta < costheta_cut )
654 double min_length,
double min_x,
655 double max_x,
double min_y,
double max_y,
double min_z,
bool check_wire,
656 double check_x,
double check_y,
double check_z) {
663 auto start = track.
Vertex();
665 if ((TMath::Max(start.X(),
end.X()) > max_x) ||
666 (TMath::Min(start.X(),
end.X()) < min_x) ||
667 (TMath::Max(start.Y(),
end.Y()) > max_y) ||
668 (TMath::Min(start.Y(),
end.Y()) < min_y) ||
669 (TMath::Min(start.Z(),
end.Z()) < min_z) ||
670 (track.
Length() < min_length)) {
676 std::map<size_t, const recob::Hit *>
678 std::vector<const recob::Hit *> hits_from_traj_view2;
679 std::vector<size_t> index_from_traj_view2;
681 for (
auto it = hits_from_traj.begin(); it != hits_from_traj.end(); ++it) {
682 if (it->second->View() != 2)
continue;
683 hits_from_traj_view2.push_back(it->second);
684 index_from_traj_view2.push_back(it->first);
688 double highest_z = -100.;
690 int vertex_wire = -1;
691 float vertex_peak_time = -1.;
694 for (
const auto *
hit : hits_from_traj_view2) {
695 double wire_z = geom->
Wire(
hit->WireID()).GetCenter().Z();
696 if (wire_z > highest_z) {
698 vertex_tpc =
hit->WireID().TPC;
699 vertex_peak_time =
hit->PeakTime();
700 vertex_wire =
hit->WireID().Wire;
706 double highest_diff = -1.;
707 for (
size_t i = 0; i < hits_from_traj_view2.size(); ++i) {
709 size_t traj_index = index_from_traj_view2[i];
715 double diff = sqrt(
std::pow((traj_x - check_x), 2) +
718 if (diff > highest_diff) {
727 std::pair<double, int> results = {0., 0};
730 auto allHits = evt.
getValidHandle<std::vector<recob::Hit>>(hitModule);
731 std::vector<art::Ptr<recob::Hit>> hit_vector;
733 art::FindManyP<recob::Track> tracks_from_all_hits(allHits, evt, trackModule);
734 for (
size_t i = 0; i < hit_vector.size(); ++i) {
737 const recob::Hit * theHit = hit_vector[i].get();
738 if (std::find(hits_from_traj_view2.begin(),
739 hits_from_traj_view2.end(),
740 theHit) != hits_from_traj_view2.end()) {
746 float peak_time = theHit->
PeakTime();
748 int plane = theHit->
View();
749 if ((
abs(wire - vertex_wire) > 15) ||
750 (
abs(peak_time - vertex_peak_time) > 100.) ||
751 (tpc != vertex_tpc) || (plane != 2)) {
761 auto & tracks_from_hit = tracks_from_all_hits.at(hit_vector[i].
key());
762 if (!tracks_from_hit.empty() &&
763 (tracks_from_hit[0].get()->ID() != track.
ID()) &&
764 (tracks_from_hit[0].
get()->Length() > 25.))
768 std::array<float, 4> cnn_out = hitResults.
getOutput(hit_vector[i]);
769 results.first += cnn_out[hitResults.
getIndex(
"michel")];
779 double min_length,
double min_x,
780 double max_x,
double min_y,
double max_y,
double min_z,
bool check_wire,
781 double check_x,
double check_y,
double check_z) {
788 auto start = track.
Vertex();
790 if ((TMath::Max(start.X(),
end.X()) > max_x) ||
791 (TMath::Min(start.X(),
end.X()) < min_x) ||
792 (TMath::Max(start.Y(),
end.Y()) > max_y) ||
793 (TMath::Min(start.Y(),
end.Y()) < min_y) ||
794 (TMath::Min(start.Z(),
end.Z()) < min_z) ||
795 (track.
Length() < min_length)) {
801 std::map<size_t, const recob::Hit *>
803 std::vector<const recob::Hit *> hits_from_traj_view2;
804 std::vector<size_t> index_from_traj_view2;
806 for (
auto it = hits_from_traj.begin(); it != hits_from_traj.end(); ++it) {
807 if (it->second->View() != 2)
continue;
808 hits_from_traj_view2.push_back(it->second);
809 index_from_traj_view2.push_back(it->first);
813 double highest_z = -100.;
815 int vertex_wire = -1;
816 float vertex_peak_time = -1.;
819 for (
const auto *
hit : hits_from_traj_view2) {
820 double wire_z = geom->
Wire(
hit->WireID()).GetCenter().Z();
821 if (wire_z > highest_z) {
823 vertex_tpc =
hit->WireID().TPC;
824 vertex_peak_time =
hit->PeakTime();
825 vertex_wire =
hit->WireID().Wire;
831 double highest_diff = -1.;
832 for (
size_t i = 0; i < hits_from_traj_view2.size(); ++i) {
834 size_t traj_index = index_from_traj_view2[i];
840 double diff = sqrt(
std::pow((traj_x - check_x), 2) +
843 if (diff > highest_diff) {
852 std::pair<double, double> results = {0., 0.};
855 auto allHits = evt.
getValidHandle<std::vector<recob::Hit>>(hitModule);
856 std::vector<art::Ptr<recob::Hit>> hit_vector;
858 art::FindManyP<recob::Track> tracks_from_all_hits(allHits, evt, trackModule);
859 for (
size_t i = 0; i < hit_vector.size(); ++i) {
862 const recob::Hit * theHit = hit_vector[i].get();
863 if (std::find(hits_from_traj_view2.begin(),
864 hits_from_traj_view2.end(),
865 theHit) != hits_from_traj_view2.end()) {
871 float peak_time = theHit->
PeakTime();
873 int plane = theHit->
View();
874 if ((
abs(wire - vertex_wire) > 15) ||
875 (
abs(peak_time - vertex_peak_time) > 100.) ||
876 (tpc != vertex_tpc) || (plane != 2)) {
886 auto & tracks_from_hit = tracks_from_all_hits.at(hit_vector[i].
key());
887 if (!tracks_from_hit.empty() &&
888 (tracks_from_hit[0].get()->ID() != track.
ID()) &&
889 (tracks_from_hit[0].
get()->Length() > 25.))
893 std::array<float, 4> cnn_out = hitResults.
getOutput(hit_vector[i]);
894 double hitcharge = hit_vector[i]->Integral();
895 results.first += hitcharge*cnn_out[hitResults.
getIndex(
"michel")];
896 results.second += hitcharge;
905 double min_length,
double min_x,
906 double max_x,
double min_y,
double max_y,
double min_z,
bool check_wire,
907 double check_x,
double check_y,
double check_z) {
910 std::vector < art::Ptr < recob::Track > > trkList;
911 auto trkListHandle = evt.
getHandle < std::vector < recob::Track > >(trackModule);
917 std::vector < art::Ptr < recob::Hit > > hitList;
918 auto hitListHandle = evt.
getHandle < std::vector < recob::Hit > >(hitModule);
924 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trkListHandle, evt,trackModule);
927 art::FindManyP<recob::Track> thass(hitListHandle, evt, trackModule);
934 double endpeakt = -1;
935 std::vector<int> wirekeys;
937 if (fmthm.isValid()){
939 auto vhit=fmthm.at(track.
ID());
940 auto vmeta=fmthm.data(track.
ID());
941 for (
size_t ii = 0; ii<vhit.size(); ++ii){
942 bool fBadhit =
false;
948 throw cet::exception(
"Calorimetry_module.cc") <<
"Requested track trajectory index "<<vmeta[ii]->Index()<<
" exceeds the total number of trajectory points "<<track.
NumberTrajectoryPoints()<<
" for track index "<<track.
ID()<<
". Something is wrong with the track reconstruction. Please contact tjyang@fnal.gov!!";
955 if (fBadhit)
continue;
956 if (
loc.Z()<-100)
continue;
957 if(vhit[ii]->
WireID().Plane==2){
958 wirekeys.push_back(vhit[ii].
key());
962 endwire=vhit[ii]->WireID().Wire;
963 endpeakt=vhit[ii]->PeakTime();
964 endtpc=vhit[ii]->WireID().TPC;
970 int ndaughterhits = 0;
971 double average_daughter_score_mic = 0;
973 for(
size_t hitl=0;hitl<hitList.size();hitl++){
974 std::array<float,4> cnn_out=hitResults.
getOutput(hitList[hitl]);
975 auto &
tracks = thass.at(hitList[hitl].
key());
977 if (std::find(wirekeys.begin(), wirekeys.end(), hitl) != wirekeys.end())
continue;
980 int planeid=hitList[hitl]->WireID().Plane;
981 if (planeid!=2)
continue;
982 int tpcid=hitList[hitl]->WireID().TPC;
983 if (tpcid!=endtpc)
continue;
984 float peakth1=hitList[hitl]->PeakTime();
985 int wireh1=hitList[hitl]->WireID().Wire;
986 if(
std::abs(wireh1-endwire)<8 &&
std::abs(peakth1-endpeakt)<150 && tpcid==endtpc){
988 average_daughter_score_mic += cnn_out[hitResults.
getIndex(
"michel")];
993 if (ndaughterhits) average_daughter_score_mic /= ndaughterhits;
995 return {average_daughter_score_mic, ndaughterhits};
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::pair< double, double > GetVertexMichelScore_weight_by_charge(const recob::Track &track, const art::Event &evt, const std::string trackModule, const std::string hitModule, double min_length=5., double min_x=-200., double max_x=0., double min_y=200., double max_y=500., double min_z=25., bool check_wire=true, double check_x=0, double check_y=0., double check_z=0.)
unsigned int GetNumberRecoTrackHits(const recob::Track &track, art::Event const &evt, const std::string trackModule) const
Get the number of hits from a given reco track.
std::vector< float > Combined_ResidualRange
bool IsBeamlike(const recob::Track &track, art::Event const &evt, const fhicl::ParameterSet &BeamPars, bool flip=false)
std::vector< anab::ParticleID > GetRecoTrackPID(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string pidModule) const
Get the PID from a given track.
BrokenTrack IsBrokenTrack(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule, const fhicl::ParameterSet &BrokenTrackPars, const fhicl::ParameterSet &CalorimetryPars)
Try to determine if it's a broken track.
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
Handle< PROD > getHandle(SelectorBase const &) const
geo::WireID WireID() const
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
Point_t const & LocationAtPoint(size_t i) const
bool HasValidPoint(size_t i) const
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
int getIndex(const std::string &name) const
Index of column with given name, or -1 if name not found.
geo::View_t View() const
View for the plane of the hit.
WireID_t Wire
Index of the wire within its plane.
std::vector< anab::T0 > GetRecoTrackT0(const recob::Track &track, art::Event const &evt, std::string trackModule) const
Get the T0(s) from a given reco track.
std::pair< double, int > GetVertexMichelScore(const recob::Track &track, const art::Event &evt, const std::string trackModule, const std::string hitModule, double min_length=5., double min_x=-200., double max_x=0., double min_y=200., double max_y=500., double min_z=25., bool check_wire=true, double check_x=0, double check_y=0., double check_z=0.)
float calc_dEdX(double, double, double, double, double, double)
double dEdx(float dqdx, float Efield)
Vector_t StartDirection() const
Access to track direction at different points.
double Length(size_t p=0) const
Access to various track properties.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
A trajectory in space reconstructed from hits.
T LocationAtPoint(unsigned int p) const
Position at point p. Use e.g. as:
const recob::Track * secondTrack
std::vector< anab::CosmicTag > GetRecoTrackCosmicTag(const recob::Track &track, art::Event const &evt, std::string trackModule) const
Get the cosmic tag(s) from a given reco track.
T get(std::string const &key) const
Point_t const & Vertex() const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
static int max(int a, int b)
static constexpr double ps
Detector simulation of raw signals on wires.
std::vector< float > Combined_dQdx
std::pair< double, int > Chi2PID(const std::vector< double > &track_dedx, const std::vector< double > &range, TProfile *profile)
std::vector< float > Combined_dEdx
const std::vector< const recob::Hit * > GetRecoTrackHitsFromPlane(const recob::Track &track, art::Event const &evt, const std::string trackModule, unsigned int planeID) const
Get the hits from a given reco track from a specific plane.
WireGeo const & Wire(geo::WireID const &wireid) const
Returns the specified wire.
const std::vector< const recob::Hit * > GetRecoTrackHits(const recob::Track &track, art::Event const &evt, const std::string trackModule) const
Get the hits from a given reco track.
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
const recob::Track * firstTrack
Vector_t EndDirection() const
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
QTextStream & bin(QTextStream &s)
Point_t const & End() const
const std::vector< recob::Track > & GetBeamTracks() const
2D representation of charge deposited in the TDC/wire plane
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
std::map< size_t, const recob::Hit * > GetRecoHitsFromTrajPoints(const recob::Track &track, art::Event const &evt, std::string trackModule)
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
std::pair< double, int > Chi2PIDFromTrack_MC(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule, TProfile *profile)
Until we have fully calibrated calorimetry, use this PID algo.
std::array< float, N > getOutput(size_t key) const
Get copy of the MVA output vector at index "key".
std::string to_string(ModuleType const mt)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
std::pair< double, int > GetVertexMichelScoreAlt(const recob::Track &track, const art::Event &evt, const std::string trackModule, const std::string hitModule, double min_length=5., double min_x=-200., double max_x=0., double min_y=200., double max_y=500., double min_z=25., bool check_wire=true, double check_x=0, double check_y=0., double check_z=0.)
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< float > CalibrateCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule, const fhicl::ParameterSet &ps)
Calibrate a Calorimetry object for a given plane from a given track.