22 fTree->Branch(
"mct_run", &
fRun,
"mct_run/i");
54 fTree->Branch(
"mct_miny", &
fMinY,
"mct_miny/F");
55 fTree->Branch(
"mct_maxy", &
fMaxY,
"mct_maxy/F");
56 fTree->Branch(
"mct_minz", &
fMinZ,
"mct_minz/F");
57 fTree->Branch(
"mct_maxz", &
fMaxZ,
"mct_maxz/F");
58 fTree->Branch(
"mct_minx", &
fMinX,
"mct_minx/F");
59 fTree->Branch(
"mct_maxx", &
fMaxX,
"mct_maxx/F");
64 const std::vector<sim::MCTrack>& mctVec)
79 if (mctVec.size() == 0) {
84 std::vector<double> y_vals;
85 std::vector<double> z_vals;
86 std::vector<double> x_vals;
87 std::vector<double> stepL_vals;
89 std::vector<double> mct_length(mctVec.size(), 0);
91 for (
size_t i_p = 0; i_p < mctVec.size(); i_p++) {
99 for (
size_t i_s = 1; i_s < mctVec[i_p].size(); i_s++) {
101 TVector3
const& vec1 = mctVec[i_p][i_s - 1].Position().Vect();
102 TVector3
const& vec2 = mctVec[i_p][i_s].Position().Vect();
103 double stepL = (vec2 - vec1).Mag();
105 double thisy = 0.5 * (vec1.Y() + vec2.Y());
106 double thisz = 0.5 * (vec1.Z() + vec2.Z());
107 double thisx = 0.5 * (vec1.X() + vec2.X());
109 y_vals.push_back(thisy);
110 z_vals.push_back(thisz);
111 x_vals.push_back(thisx);
112 stepL_vals.push_back(stepL);
114 mct_length[i_p] += stepL;
126 double totalL = std::accumulate(mct_length.begin(), mct_length.end(), 0.0);
129 std::distance(mct_length.begin(), std::max_element(mct_length.begin(), mct_length.end()));
133 double sumy = 0, sumz = 0, sumx = 0;
134 for (
size_t i_step = 0; i_step < stepL_vals.size(); i_step++) {
135 sumy += stepL_vals[i_step] * y_vals[i_step];
136 sumz += stepL_vals[i_step] * z_vals[i_step];
137 sumx += stepL_vals[i_step] * x_vals[i_step];
144 double sumy2 = 0, sumz2 = 0, sumx2 = 0;
145 for (
size_t i_step = 0; i_step < stepL_vals.size(); i_step++) {
160 size_t nsteps = mctrack.size();
simb::Origin_t Origin() const
void SetOutputTree(TTree *, bool fill=true)
unsigned int AncestorTrackID() const
void FillTree(unsigned int, unsigned int, const std::vector< sim::MCTrack > &)
int AncestorPdgCode() const
unsigned int MotherTrackID() const
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
Class def header for mctrack data container.
unsigned int fDParticleAncestorTrackId
int MotherPdgCode() const
int fDParticleAncestorPdgCode
unsigned int fDParticleMotherTrackId
int fDParticleMotherPdgCode
unsigned int TrackID() const
unsigned int fDParticleTrackId
void FillDominantParticleInfo(const sim::MCTrack &)
Event finding and building.