687 std::unique_ptr<mf::LogInfo> pdump;
690 pdump = std::unique_ptr<mf::LogInfo>(
new mf::LogInfo(
"TrackAna"));
706 std::map<const recob::Seed*, int> seedmap;
718 *pdump <<
"MC Tracks\n" 719 <<
" Id pdg x y z dx dy dz p\n" 720 <<
"-------------------------------------------------------------------------------------------\n";
727 imctrk != mctrackh->end(); ++imctrk) {
735 int apdg = std::abs(pdg);
747 double mctime = mctrk.
Start().
T();
756 double plen = length(mctrk, mcdx, mcstart, mcend, mcstartmom, mcendmom);
766 double pstart = mcstartmom.Mag();
767 double pend = mcendmom.Mag();
769 << std::setw(3) << mctrk.
TrackID()
770 << std::setw(6) << mctrk.
PdgCode()
772 << std::fixed << std::setprecision(2)
773 << std::setw(10) << mcdx
775 << std::setw(3) << mctrk.
TrackID()
776 << std::setw(6) << mctrk.
PdgCode()
778 << std::fixed << std::setprecision(2)
779 << std::setw(10) << mcstart[0]
780 << std::setw(10) << mcstart[1]
781 << std::setw(10) << mcstart[2];
784 << std::fixed << std::setprecision(3)
785 << std::setw(10) << mcstartmom[0]/pstart
786 << std::setw(10) << mcstartmom[1]/pstart
787 << std::setw(10) << mcstartmom[2]/pstart;
790 *pdump << std::setw(32) <<
" ";
791 *pdump << std::setw(12) << std::fixed << std::setprecision(3) << pstart;
793 << std::setw(3) << mctrk.
TrackID()
794 << std::setw(6) << mctrk.
PdgCode()
796 << std::fixed << std::setprecision(2)
797 << std::setw(10) << mcend[0]
798 << std::setw(10) << mcend[1]
799 << std::setw(10) << mcend[2];
802 << std::fixed << std::setprecision(3)
803 << std::setw(10) << mcendmom[0]/pend
804 << std::setw(10) << mcendmom[1]/pend
805 << std::setw(10) << mcendmom[2]/pend;
808 *pdump << std::setw(32)<<
" ";
809 *pdump << std::setw(12) << std::fixed << std::setprecision(3) << pend <<
"\n";
815 std::ostringstream ostr;
816 ostr <<
"MC" << (
fIgnoreSign ?
"All" : (pdg > 0 ?
"Pos" :
"Neg")) << std::abs(pdg);
821 double mctheta_xz = std::atan2(mcstartmom.X(), mcstartmom.Z());
822 double mctheta_yz = std::atan2(mcstartmom.Y(), mcstartmom.Z());
824 mchists.fHmcstartx->Fill(mcstart.X());
825 mchists.fHmcstarty->Fill(mcstart.Y());
826 mchists.fHmcstartz->Fill(mcstart.Z());
827 mchists.fHmcendx->Fill(mcend.X());
828 mchists.fHmcendy->Fill(mcend.Y());
829 mchists.fHmcendz->Fill(mcend.Z());
830 mchists.fHmctheta->Fill(mcstartmom.Theta());
831 mchists.fHmcphi->Fill(mcstartmom.Phi());
832 mchists.fHmctheta_xz->Fill(mctheta_xz);
833 mchists.fHmctheta_yz->Fill(mctheta_yz);
834 mchists.fHmcmom->Fill(mcstartmom.Mag());
835 mchists.fHmclen->Fill(plen);
844 int nseed = seedh->size();
845 for(
int i = 0; i < nseed; ++i) {
848 if(seedmap.count(&seed) == 0)
863 double dirmag = dir.Mag();
864 double diryz = std::sqrt(dir.Y()*dir.Y() + dir.Z()*dir.Z());
866 double sinth = dir.X() / dirmag;
867 double costh = diryz / dirmag;
871 sinphi = -dir.Y() / diryz;
872 cosphi = dir.Z() / diryz;
877 rot(0,1) = sinth * sinphi;
879 rot(2,1) = -costh * sinphi;
880 rot(0,2) = -sinth * cosphi;
882 rot(2,2) = costh * cosphi;
886 int itraj = mcmatch(mctrk, seed);
891 TVector3 mcpos = mctrk[itraj].Position().Vect() - pos;
892 TVector3 mcmom = mctrk[itraj].Momentum().Vect();
898 TVector3 mcmoml = rot * mcmom;
899 TVector3 mcposl = rot * mcpos;
903 double costh = mcmoml.Z() / mcmoml.Mag();
905 double u = mcposl.X();
906 double v = mcposl.Y();
907 double w = mcposl.Z();
909 double pu = mcmoml.X();
910 double pv = mcmoml.Y();
911 double pw = mcmoml.Z();
913 double dudw = pu / pw;
914 double dvdw = pv / pw;
916 double u0 = u - w * dudw;
917 double v0 = v - w * dvdw;
918 double uv0 = std::sqrt(u0*u0 + v0*v0);
922 mchists.fHduvcosth->Fill(costh, uv0);
927 mchists.fHmcdudw->Fill(dudw);
928 mchists.fHmcdvdw->Fill(dvdw);
930 mchists.fHcosth->Fill(costh);
935 mchists.fHmcu->Fill(u0);
936 mchists.fHmcv->Fill(v0);
937 mchists.fHmcw->Fill(w);
949 mchists.fHmstartx->Fill(mcstart.X());
950 mchists.fHmstarty->Fill(mcstart.Y());
951 mchists.fHmstartz->Fill(mcstart.Z());
952 mchists.fHmendx->Fill(mcend.X());
953 mchists.fHmendy->Fill(mcend.Y());
954 mchists.fHmendz->Fill(mcend.Z());
955 mchists.fHmtheta->Fill(mcstartmom.Theta());
956 mchists.fHmphi->Fill(mcstartmom.Phi());
957 mchists.fHmtheta_xz->Fill(mctheta_xz);
958 mchists.fHmtheta_yz->Fill(mctheta_yz);
959 mchists.fHmmom->Fill(mcstartmom.Mag());
960 mchists.fHmlen->Fill(plen);
970 mchists.fHgstartx->Fill(mcstart.X());
971 mchists.fHgstarty->Fill(mcstart.Y());
972 mchists.fHgstartz->Fill(mcstart.Z());
973 mchists.fHgendx->Fill(mcend.X());
974 mchists.fHgendy->Fill(mcend.Y());
975 mchists.fHgendz->Fill(mcend.Z());
976 mchists.fHgtheta->Fill(mcstartmom.Theta());
977 mchists.fHgphi->Fill(mcstartmom.Phi());
978 mchists.fHgtheta_xz->Fill(mctheta_xz);
979 mchists.fHgtheta_yz->Fill(mctheta_yz);
980 mchists.fHgmom->Fill(mcstartmom.Mag());
981 mchists.fHglen->Fill(plen);
996 int nseed = seedh->size();
998 if(nseed > 0 && pdump != 0) {
999 *pdump <<
"\nReconstructed Seeds\n" 1000 <<
" MCid x y z dx dy dz p\n" 1001 <<
"-------------------------------------------------------------------------------------------\n";
1004 for(
int i = 0; i < nseed; ++i) {
1015 double mdir = dir.Mag();
1020 double dpos = bdist(pos);
1021 double theta_xz = std::atan2(dir.X(), dir.Z());
1022 double theta_yz = std::atan2(dir.Y(), dir.Z());
1027 int mcid = seedmap[&
seed];
1028 *pdump << std::setw(15) << mcid
1030 << std::fixed << std::setprecision(2)
1031 << std::setw(10) << pos[0]
1032 << std::setw(10) << pos[1]
1033 << std::setw(10) << pos[2]
1035 << std::fixed << std::setprecision(3)
1036 << std::setw(10) << dir[0]
1037 << std::setw(10) << dir[1]
1038 << std::setw(10) << dir[2]
1048 rhists.fHx->Fill(pos.X());
1049 rhists.fHy->Fill(pos.Y());
1050 rhists.fHz->Fill(pos.Z());
1051 rhists.fHdist->Fill(dpos);
1052 rhists.fHtheta->Fill(dir.Theta());
1053 rhists.fHphi->Fill(dir.Phi());
1054 rhists.fHtheta_xz->Fill(theta_xz);
1055 rhists.fHtheta_yz->Fill(theta_yz);
std::string fMCTrackModuleLabel
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void GetPoint(double *Pt, double *Err) const
std::string fSeedModuleLabel
std::map< int, RecoHists > fRecoHistMap
const TLorentzVector & Momentum() const
std::map< int, MCHists > fMCHistMap
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
virtual double DriftVelocity(double efield=0., double temperature=0.) const =0
const MCStep & Start() const
unsigned int TrackID() const
void GetDirection(double *Dir, double *Err) const