756 std::unique_ptr<mf::LogInfo> pdump;
759 pdump = std::unique_ptr<mf::LogInfo>(
new mf::LogInfo(
"TrackAnaCT"));
771 std::vector<const simb::MCParticle*> plist2;
776 sim::ParticleList
const& plist = pi_serv->
ParticleList();
777 plist2.reserve(plist.size());
781 *pdump <<
"MC Particles\n" 782 <<
" Id pdg x y z dx dy dz p\n" 783 <<
"-------------------------------------------------------------------------------------------\n";
791 ipart != plist.end(); ++ipart) {
813 double mctime = part->
T();
814 double mcdx = mctime * 1.e-3 * detProp.DriftVelocity();
822 double plen = length(detProp, *part, mcdx, mcstart, mcend, mcstartmom, mcendmom);
831 plist2.push_back(part);
836 double pstart = mcstartmom.Mag();
837 double pend = mcendmom.Mag();
857 <<
std::setw(10) << mcstartmom[2]/pstart;
885 std::ostringstream ostr;
891 double mctheta_xz = std::atan2(mcstartmom.X(), mcstartmom.Z());
892 double mctheta_yz = std::atan2(mcstartmom.Y(), mcstartmom.Z());
894 mchists.fHmcstartx->Fill(mcstart.X());
895 mchists.fHmcstarty->Fill(mcstart.Y());
896 mchists.fHmcstartz->Fill(mcstart.Z());
897 mchists.fHmcendx->Fill(mcend.X());
898 mchists.fHmcendy->Fill(mcend.Y());
899 mchists.fHmcendz->Fill(mcend.Z());
900 mchists.fHmctheta->Fill(mcstartmom.Theta());
901 mchists.fHmcphi->Fill(mcstartmom.Phi());
902 mchists.fHmctheta_xz->Fill(mctheta_xz);
903 mchists.fHmctheta_yz->Fill(mctheta_yz);
904 mchists.fHmcmom->Fill(mcstartmom.Mag());
905 mchists.fHmclen->Fill(plen);
925 <<
"TrackAnaCT read " << trackvh->size()
926 <<
" vectors of Stitched PtrVectorsof tracks.";
930 if(trackh.isValid()) {
933 *pdump <<
"\nReconstructed Tracks\n" 934 <<
" Id MCid x y z dx dy dz p\n" 935 <<
"-------------------------------------------------------------------------------------------\n";
941 int ntrack = trackh->size();
942 for(
int i = 0; i < ntrack; ++i) {
956 auto hit = fh.at(0).at(0);
958 int hit_tpc=tmpWireid.
TPC;
980 double recotime = 0.;
981 double trackdx = recotime * 1.e-3 * detProp.DriftVelocity();
989 TVector3
end = track.
End<TVector3>();
993 double dpos = bdist(pos,hit_tpc);
994 double dend = bdist(end,hit_tpc);
995 double tlen = length(track);
996 double theta_xz = std::atan2(dir.X(), dir.Z());
997 double theta_yz = std::atan2(dir.Y(), dir.Z());
1003 rhists.fHstartx->Fill(pos.X());
1004 rhists.fHstarty->Fill(pos.Y());
1005 rhists.fHstartz->Fill(pos.Z());
1006 rhists.fHstartd->Fill(dpos);
1007 rhists.fHendx->Fill(end.X());
1008 rhists.fHendy->Fill(end.Y());
1009 rhists.fHendz->Fill(end.Z());
1010 rhists.fHendd->Fill(dend);
1011 rhists.fHtheta->Fill(dir.Theta());
1012 rhists.fHphi->Fill(dir.Phi());
1013 rhists.fHtheta_xz->Fill(theta_xz);
1014 rhists.fHtheta_yz->Fill(theta_yz);
1019 rhists.fHmom->Fill(mom);
1020 rhists.fHlen->Fill(tlen);
1038 int start_point = (
swap == 0 ? 0 : ntraj-1);
1044 rot(1, 0) = -rot(1, 0);
1045 rot(2, 0) = -rot(2, 0);
1046 rot(1, 1) = -rot(1, 1);
1047 rot(2, 1) = -rot(2, 1);
1048 rot(1, 2) = -rot(1, 2);
1049 rot(2, 2) = -rot(2, 2);
1051 pos = track.
End<TVector3>();
1053 end = track.
Vertex<TVector3>();
1057 dpos = bdist(pos,hit_tpc);
1058 dend = bdist(end,hit_tpc);
1059 theta_xz = std::atan2(dir.X(), dir.Z());
1060 theta_yz = std::atan2(dir.Y(), dir.Z());
1072 for(
auto ipart = plist2.begin(); ipart != plist2.end(); ++ipart) {
1080 throw cet::exception(
"SeedAna") <<
"no particle with ID=" << pdg <<
"\n";
1081 const MCHists& mchists = iMCHistMap->second;
1085 double mctime = part->
T();
1086 double mcdx = mctime * 1.e-3 * detProp.DriftVelocity();
1093 TVector3 mcstartmom;
1095 double plen = length(detProp, *part, mcdx, mcstart, mcend, mcstartmom, mcendmom);
1099 TVector3 mcpos = mcstart -
pos;
1104 TVector3 mcmoml = rot * mcstartmom;
1105 TVector3 mcposl = rot * mcpos;
1107 double colinearity = mcmoml.Z() / mcmoml.Mag();
1109 double u = mcposl.X();
1110 double v = mcposl.Y();
1111 double w = mcposl.Z();
1113 double pu = mcmoml.X();
1114 double pv = mcmoml.Y();
1115 double pw = mcmoml.Z();
1117 double dudw = pu / pw;
1118 double dvdw = pv / pw;
1120 double u0 = u - w * dudw;
1121 double v0 = v - w * dvdw;
1122 double uv0 = std::sqrt(u0*u0 + v0*v0);
1124 mchists.fHduvcosth->Fill(colinearity, uv0);
1129 mchists.fHmcdudw->Fill(dudw);
1130 mchists.fHmcdvdw->Fill(dvdw);
1134 mchists.fHcosth->Fill(colinearity);
1139 mchists.fHmcu->Fill(u0);
1140 mchists.fHmcv->Fill(v0);
1141 mchists.fHmcw->Fill(w);
1149 double mctheta_xz = std::atan2(mcstartmom.X(), mcstartmom.Z());
1150 double mctheta_yz = std::atan2(mcstartmom.Y(), mcstartmom.Z());
1152 mchists.fHstartdx->Fill(pos.X() - mcstart.X());
1153 mchists.fHstartdy->Fill(pos.Y() - mcstart.Y());
1154 mchists.fHstartdz->Fill(pos.Z() - mcstart.Z());
1155 mchists.fHenddx->Fill(end.X() - mcend.X());
1156 mchists.fHenddy->Fill(end.Y() - mcend.Y());
1157 mchists.fHenddz->Fill(end.Z() - mcend.Z());
1158 mchists.fHlvsl->Fill(plen, tlen);
1159 mchists.fHdl->Fill(tlen - plen);
1160 mchists.fHpvsp->Fill(mcstartmom.Mag(), mom);
1161 double dp = mom - mcstartmom.Mag();
1162 mchists.fHdp->Fill(dp);
1165 mchists.fHpvspc->Fill(mcstartmom.Mag(), mom);
1166 mchists.fHdpc->Fill(dp);
1179 mchists.fHgstartx->Fill(mcstart.X());
1180 mchists.fHgstarty->Fill(mcstart.Y());
1181 mchists.fHgstartz->Fill(mcstart.Z());
1182 mchists.fHgendx->Fill(mcend.X());
1183 mchists.fHgendy->Fill(mcend.Y());
1184 mchists.fHgendz->Fill(mcend.Z());
1185 mchists.fHgtheta->Fill(mcstartmom.Theta());
1186 mchists.fHgphi->Fill(mcstartmom.Phi());
1187 mchists.fHgtheta_xz->Fill(mctheta_xz);
1188 mchists.fHgtheta_yz->Fill(mctheta_yz);
1189 mchists.fHgmom->Fill(mcstartmom.Mag());
1190 mchists.fHglen->Fill(plen);
1200 TVector3 pos = track.
Vertex<TVector3>();
1202 TVector3 end = track.
End<TVector3>();
1208 *pdump <<
"\nOffset" double E(const int i=0) const
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
double EndMomentum() const
double VertexMomentum() const
void anaStitch(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::Event &evt)
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Vector_t VertexDirection() const
Q_EXPORT QTSManip setprecision(int p)
Rotation_t GlobalToLocalRotationAtPoint(size_t p) const
std::string fStitchModuleLabel
void swap(Handle< T > &a, Handle< T > &b)
Point_t const & Vertex() const
double T(const int i=0) const
std::string fTrackModuleLabel
Detector simulation of raw signals on wires.
Q_EXPORT QTSManip setw(int w)
const sim::ParticleList & ParticleList() const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Vector_t EndDirection() const
std::string fTrkSpptAssocModuleLabel
std::map< int, MCHists > fMCHistMap
Point_t const & End() const
TPCID_t TPC
Index of the TPC within its cryostat.
std::map< int, RecoHists > fRecoHistMap
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception