-
Notifications
You must be signed in to change notification settings - Fork 0
/
GeoCuts_Radius.h
141 lines (124 loc) · 3.75 KB
/
GeoCuts_Radius.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// c++ includes
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <chrono>
#include <exception>
// root includes
#include "TInterpreter.h"
#include "TROOT.h"
#include "TH1.h"
#include "TH2D.h"
#include "TH2I.h"
#include "TFile.h"
#include "TNtuple.h"
#include "TClonesArray.h"
#include "TCanvas.h"
#include "TGraph.h"
// art includes
#include "canvas/Utilities/InputTag.h"
#include "gallery/Event.h"
#include "gallery/ValidHandle.h"
#include "canvas/Persistency/Common/FindMany.h"
#include "canvas/Persistency/Common/FindManyP.h"
#include "canvas/Persistency/Common/FindOne.h"
// larsoft object includes
#include "lardataobj/RecoBase/Track.h"
#include "lardataobj/RecoBase/Shower.h"
#include "lardataobj/RecoBase/Vertex.h"
#include "lardataobj/RecoBase/PFParticle.h"
#include "lardataobj/RecoBase/TrackingTypes.h"
#include "lardataobj/Simulation/SimChannel.h"
#include "lardataobj/RawData/RawDigit.h"
// Decay vertex class
class DecayVertex {
private:
double fx, fy, fz, fpid1, fpid2;
public:
DecayVertex(double x, double y, double z, int pid1, int pid2) : fx(x), fy(y), fz(z), fpid1(pid1), fpid2(pid2) {}
double X() {return fx;}
double Y() {return fy;}
double Z() {return fz;}
int PID1() {return fpid1;}
int PID2() {return fpid2;}
};
// Calculate distance between vertices
double Distance(DecayVertex v1, DecayVertex v2){
double dist = sqrt(
pow((v1.X() - v2.X()),2.) +
pow((v1.Y() - v2.Y()),2.) +
pow((v1.Z() - v2.Z()),2.)
);
return dist;
}
// Find vertex half-way between two vertices
DecayVertex MeanVertex(DecayVertex v1, DecayVertex v2){
double x = (v1.X() + v2.X())/2.;
double y = (v1.Y() + v2.Y())/2.;
double z = (v1.Z() + v2.Z())/2.;
int pid1 = v1.PID1();
int pid2 = v2.PID1();
DecayVertex meanVertex(x,y,z,pid1,pid2);
return meanVertex;
}
std::vector<double> GetTSVertexDistance(const recob::Track* track, const recob::Shower* shower){
std::vector<double> distance;
TVector3 tVertex1 = track->Vertex();
TVector3 tVertex2 = track->End();
TVector3 sVertex = shower->ShowerStart();
distance.push_back(sqrt(
pow((tVertex1.X() - sVertex.X()),2.) +
pow((tVertex1.Y() - sVertex.Y()),2.) +
pow((tVertex1.Z() - sVertex.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex2.X() - sVertex.X()),2.) +
pow((tVertex2.Y() - sVertex.Y()),2.) +
pow((tVertex2.Z() - sVertex.Z()),2.))
);
return distance;
}
std::vector<double> GetTTVertexDistance(const recob::Track* track1, const recob::Track* track2){
std::vector<double> distance;
TVector3 tVertex1 = track1->Vertex();
TVector3 tVertex2 = track2->Vertex();
TVector3 tVertex3 = track1->End();
TVector3 tVertex4 = track2->End();
distance.push_back(sqrt(
pow((tVertex1.X() - tVertex2.X()),2.) +
pow((tVertex1.Y() - tVertex2.Y()),2.) +
pow((tVertex1.Z() - tVertex2.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex1.X() - tVertex3.X()),2.) +
pow((tVertex1.Y() - tVertex3.Y()),2.) +
pow((tVertex1.Z() - tVertex3.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex1.X() - tVertex4.X()),2.) +
pow((tVertex1.Y() - tVertex4.Y()),2.) +
pow((tVertex1.Z() - tVertex4.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex2.X() - tVertex3.X()),2.) +
pow((tVertex2.Y() - tVertex3.Y()),2.) +
pow((tVertex2.Z() - tVertex3.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex2.X() - tVertex4.X()),2.) +
pow((tVertex2.Y() - tVertex4.Y()),2.) +
pow((tVertex2.Z() - tVertex4.Z()),2.))
);
distance.push_back(sqrt(
pow((tVertex3.X() - tVertex4.X()),2.) +
pow((tVertex3.Y() - tVertex4.Y()),2.) +
pow((tVertex3.Z() - tVertex4.Z()),2.))
);
return distance;
}
int factorial(int n){
return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}