-
Notifications
You must be signed in to change notification settings - Fork 0
/
GeoCuts_Test.h
91 lines (84 loc) · 2.76 KB
/
GeoCuts_Test.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
// 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/PFParticle.h"
#include "lardataobj/RecoBase/TrackingTypes.h"
#include "lardataobj/Simulation/SimChannel.h"
#include "lardataobj/RawData/RawDigit.h"
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;
}