438 std::vector<art::Ptr<simb::MCTruth>> MCtruthlist;
443 MCtruth = MCtruthlist[0];
448 else if (nu.
CCNC() == 1)
452 const TLorentzVector& nu_momentum = nu.
Nu().
Momentum(0);
460 double tmp_leadingPionPlusE = 0.0;
461 double tmp_leadingPionMinusE = 0.0;
462 double tmp_leadingProtonE = 0.0;
472 const sim::ParticleList& plist = pi_serv->
ParticleList();
476 auto const clockData =
482 particle = ipar->second;
484 const TLorentzVector& lepton_momentum = particle->
Momentum(0);
491 if (particle->
Mother() == 0) {
493 if (particle->
PdgCode() == 2212) {
494 if (particle->
Momentum().E() > tmp_leadingProtonE) {
495 tmp_leadingProtonE = particle->
Momentum().E();
503 else if (particle->
PdgCode() == 211) {
504 if (particle->
Momentum().E() > tmp_leadingPionPlusE) {
505 tmp_leadingPionPlusE = particle->
Momentum().E();
510 MCpion_plus = particle;
513 else if (particle->
PdgCode() == -211) {
514 if (particle->
Momentum().E() > tmp_leadingPionMinusE) {
515 tmp_leadingPionMinusE = particle->
Momentum().E();
520 MCpion_minus = particle;
530 if (particle->
Mother() == 0) {
531 const TLorentzVector& positionStart = particle->
Position(0);
534 if (particle->
PdgCode() == 321) {
546 else if (particle->
PdgCode() == 2212) {
547 if (particle->
Momentum().E() > tmp_leadingProtonE) {
548 tmp_leadingProtonE = particle->
Momentum().E();
556 else if (particle->
PdgCode() == 211) {
557 if (particle->
Momentum().E() > tmp_leadingPionPlusE) {
558 tmp_leadingPionPlusE = particle->
Momentum().E();
563 MCpion_plus = particle;
566 else if (particle->
PdgCode() == -211) {
567 if (particle->
Momentum().E() > tmp_leadingPionMinusE) {
568 tmp_leadingPionMinusE = particle->
Momentum().E();
573 MCpion_minus = particle;
576 else if (particle->
Process() ==
"Decay" &&
583 else if (TMath::Abs(particle->
PdgCode() == 321)) {
601 theta_mu *= (180.0 / 3.14159);
602 double truth_lengthLepton =
truthLength(clockData, detProp, MClepton);
603 double proton_length =
truthLength(clockData, detProp, MCproton);
604 double pion_plus_length =
truthLength(clockData, detProp, MCpion_plus);
605 double pion_minus_length =
truthLength(clockData, detProp, MCpion_minus);
606 double kaonLength =
truthLength(clockData, detProp, MCkaon);
607 double michelLength =
truthLength(clockData, detProp, MCmichel);
669 std::vector<art::Ptr<recob::Track>> tracklist;
671 int n_recoTrack = tracklist.size();
674 if (n_recoTrack == 0) {
675 MF_LOG_DEBUG(
"NeutrinoTrackingEff") <<
"There are no reco tracks... bye";
678 MF_LOG_DEBUG(
"NeutrinoTrackingEff") <<
"Found this many reco tracks " << n_recoTrack;
680 double Efrac_lepton = 0.0;
681 double Ecomplet_lepton = 0.0;
682 double Efrac_proton = 0.0;
683 double Ecomplet_proton = 0.0;
684 double Efrac_pionplus = 0.0;
685 double Ecomplet_pionplus = 0.0;
686 double Efrac_pionminus = 0.0;
687 double Ecomplet_pionminus = 0.0;
688 double Efrac_kaon = 0.0;
689 double Ecomplet_kaon = 0.0;
690 double Efrac_michel = 0.0;
691 double Ecomplet_michel = 0.0;
692 double trackLength_lepton = 0.0;
693 double trackLength_proton = 0.0;
694 double trackLength_pion_plus = 0.0;
695 double trackLength_pion_minus = 0.0;
696 double trackLength_kaon = 0.0;
697 double trackLength_michel = 0.0;
705 std::vector<art::Ptr<recob::Hit>> tmp_all_trackHits = track_hits.at(0);
706 std::vector<art::Ptr<recob::Hit>> all_hits;
708 auto const pd =
event.getProductDescription(tmp_all_trackHits[0].
id());
709 if (pd &&
event.getByLabel(pd->inputTag(), hithandle)) {
713 for (
int i = 0; i < n_recoTrack; i++) {
715 std::vector<art::Ptr<recob::Hit>> all_trackHits = track_hits.at(i);
717 double tmpEcomplet = 0;
719 truthMatcher(clockData, all_hits, all_trackHits, particle, tmpEfrac, tmpEcomplet);
720 if (!particle)
continue;
724 if (tmpEcomplet > Ecomplet_lepton) {
725 Ecomplet_lepton = tmpEcomplet;
726 Efrac_lepton = tmpEfrac;
727 trackLength_lepton = track->
Length();
728 MClepton_reco = particle;
733 if (tmpEcomplet > Ecomplet_proton) {
734 Ecomplet_proton = tmpEcomplet;
735 Efrac_proton = tmpEfrac;
736 trackLength_proton = track->
Length();
737 MCproton_reco = particle;
742 if (tmpEcomplet > Ecomplet_pionplus) {
743 Ecomplet_pionplus = tmpEcomplet;
744 Efrac_pionplus = tmpEfrac;
745 trackLength_pion_plus = track->
Length();
746 MCpion_plus_reco = particle;
751 if (tmpEcomplet > Ecomplet_pionminus) {
752 Ecomplet_pionminus = tmpEcomplet;
753 Efrac_pionminus = tmpEfrac;
754 trackLength_pion_minus = track->
Length();
755 MCpion_minus_reco = particle;
761 if (tmpEcomplet > Ecomplet_kaon) {
762 Ecomplet_kaon = tmpEcomplet;
763 Efrac_kaon = tmpEfrac;
764 trackLength_kaon = track->
Length();
765 MCkaon_reco = particle;
771 if (tmpEcomplet > Ecomplet_michel) {
772 Ecomplet_michel = tmpEcomplet;
773 Efrac_michel = tmpEfrac;
774 trackLength_michel = track->
Length();
775 MCmichel_reco = particle;
780 double Reco_LengthRes = truth_lengthLepton - trackLength_lepton;
781 double Reco_LengthResProton = proton_length - trackLength_proton;
782 double Reco_LengthResPionPlus = pion_plus_length - trackLength_pion_plus;
783 double Reco_LengthResPionMinus = pion_minus_length - trackLength_pion_minus;
785 if (MClepton_reco && MClepton) {
796 if (MCproton_reco && MCproton) {
805 if (MCpion_plus_reco && MCpion_plus) {
814 if (MCpion_minus_reco && MCpion_minus) {
823 if (MCkaon_reco && MCkaon) {
835 if (MClepton_reco && MClepton) {
842 if (MCkaon_reco && MCkaon) {
849 if (MCproton_reco && MCproton) {
856 if (MCpion_plus_reco && MCpion_plus) {
863 if (MCpion_minus_reco && MCpion_minus) {
870 if (MCmichel_reco && MCmichel) {
const TLorentzVector & Position(const int i=0) const
const simb::MCNeutrino & GetNeutrino() const
std::string fTrackModuleLabel
std::string fMCTruthModuleLabel
TH1D * h_michelwtrk_length
const simb::MCParticle & Nu() const
std::string Process() const
TH1D * h_protonwtrk_length
TH1D * h_trackRes_pion_plus
void truthMatcher(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> all_hits, std::vector< art::Ptr< recob::Hit >> track_hits, const simb::MCParticle *&MCparticle, double &Efrac, double &Ecomplet)
double Length(size_t p=0) const
Access to various track properties.
double MC_lepton_startMomentum[4]
TH1D * h_Efrac_pion_minus
double truthLength(const detinfo::DetectorClocksData &clockData, detinfo::DetectorPropertiesData const &detProp, const simb::MCParticle *MCparticle)
const sim::ParticleList & ParticleList() const
double MC_leading_PionPlusP
TH1D * h_Ecomplet_pion_plus
int MC_leading_PionMinusID
TH1D * h_trackRes_pion_minus
int MC_leading_PionPlusID
const TLorentzVector & Momentum(const int i=0) const
TH1D * h_pionmwtrk_length
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
double MC_leading_ProtonP
Event generator information.
TH1D * h_pionpwtrk_length
double MC_leading_PionMinusP
TH1D * h_Ecomplet_pion_minus
bool insideFV(double vertex[4])
Event finding and building.