CAF.h
Go to the documentation of this file.
1 #ifndef CAF_h
2 #define CAF_h
3 
4 #include "TFile.h"
5 #include "TTree.h"
6 #include "TH2F.h"
7 
8 #include "Utils.h"
9 
10 #include <unordered_map>
11 
12 class CAF {
13 
14  typedef std::pair<float, std::string> P;
15 
16 public:
17 
18  /* Default Constructor */
19  CAF();
20 
21  /* Constructor */
22  CAF( std::string infile, std::string filename, int correct4origin, double *originTPC);
23 
24  /* Default Copy Constructor */
25  CAF(const CAF &) = default;
26 
27  /* Destructor */
28  ~CAF();
29 
30  /* Method to book the output TFile */
31  bool BookTFile();
32 
33  /* Method to fill the output TTree */
34  void FillTTree();
35 
36  /* Method to write the output TTree */
37  void WriteTTree();
38 
39  /* Method to close the output TTree */
40  void CloseTFile();
41 
42  /* Method to clear the event variables */
43  void ClearVectors();
44 
45  /* Method to loop */
46  void loop();
47 
48  /* Method to check vector size */
49  bool CheckVectorSize();
50 
51 private:
52 
53  TFile * cafFile; ///< The output TFile pointer */
54  TTree * cafMVA; ///< The output TTree pointer */
55  std::unordered_map<int, TH2F*> m_pidinterp;
56 
57  TFile* _intfile;
58  TTree* _inttree;
59 
61 
63  std::string _outputFile; ///< The output TFile name */
64  unsigned int _correct4origin; ///< sets the string for the coordinates origins (World or TPC)
65 
66  //Event-wise values
67  unsigned int _Run, _Event, _SubRun;
68  //Generator values
69  std::vector<int> mode, ccnc, ntype, gint, weight, tgtpdg, gt_t, intert, detected;
71  std::vector<float> GPartPx, GPartPy, GPartPz, GPartE, GPartMass;
72  std::vector<std::string> GPartName;
73  std::vector<double> q2, w, y, x, theta, t, mctime, mcnupx, mcnupy, mcnupz, vertx, verty, vertz;
74  //MC Particle Values, with motherid added
75  std::vector<unsigned int> _nFSP;
77  std::vector<std::string> _MCProc, _MCEndProc;
78  std::vector<double> trkLen, trkLenPerp, truep, truepx, truepy, truepz, _angle;
79  //Reco values
80  std::vector<int> recopid, recopidecal;
81  std::vector<double> prob_arr, anglereco, _preco, erecon, etime;
82  //Geometry
85  std::vector<unsigned int> isBarrelStart, isEndcapStart, isBarrelEnd, isEndcapEnd;
86 
87  float calcGluck(double sigmaX, double B, double X0, float nHits, double mom, double length, double& ratio);
88 };
89 
90 #endif
std::vector< double > _angle
Definition: CAF.h:78
std::vector< int > tgtpdg
Definition: CAF.h:69
std::vector< int > GPartFirstDaugh
Definition: CAF.h:70
std::vector< double > w
Definition: CAF.h:73
std::vector< unsigned int > isInBetweenStart
Definition: CAF.h:83
std::vector< int > GPartStatus
Definition: CAF.h:70
std::string _outputFile
The output TFile name */.
Definition: CAF.h:63
std::vector< int > recopid
Definition: CAF.h:80
std::vector< float > GPartPz
Definition: CAF.h:71
std::vector< double > x
Definition: CAF.h:73
std::vector< std::string > _MCEndProc
Definition: CAF.h:77
std::vector< unsigned int > isBarrelStart
Definition: CAF.h:85
std::vector< int > ntype
Definition: CAF.h:69
std::string string
Definition: nybbler.cc:12
std::vector< double > truep
Definition: CAF.h:78
std::vector< double > etime
Definition: CAF.h:81
CAF()
Definition: CAF.cpp:22
unsigned int _SubRun
Definition: CAF.h:67
std::vector< float > GPartPy
Definition: CAF.h:71
std::vector< double > trkLen
Definition: CAF.h:78
std::vector< double > trkLenPerp
Definition: CAF.h:78
std::vector< int > _MCPStartY
Definition: CAF.h:76
std::vector< unsigned int > _nFSP
Definition: CAF.h:75
std::vector< std::string > GPartName
Definition: CAF.h:72
bool BookTFile()
Definition: CAF.cpp:43
std::vector< double > _preco
Definition: CAF.h:81
float calcGluck(double sigmaX, double B, double X0, float nHits, double mom, double length, double &ratio)
Definition: CAF.cpp:337
std::vector< unsigned int > isEndcapEnd
Definition: CAF.h:85
std::vector< int > motherid
Definition: CAF.h:76
std::vector< unsigned int > isFidStart
Definition: CAF.h:83
std::vector< float > GPartMass
Definition: CAF.h:71
string filename
Definition: train.py:213
std::vector< double > mctime
Definition: CAF.h:73
std::vector< unsigned int > isBarrelEnd
Definition: CAF.h:85
std::vector< int > gint
Definition: CAF.h:69
void WriteTTree()
Definition: CAF.cpp:172
std::vector< double > mcnupy
Definition: CAF.h:73
std::vector< double > t
Definition: CAF.h:73
void CloseTFile()
Definition: CAF.cpp:163
std::vector< int > recopidecal
Definition: CAF.h:80
std::vector< unsigned int > isThroughCaloStart
Definition: CAF.h:83
std::vector< double > erecon
Definition: CAF.h:81
std::vector< int > GPartFirstMom
Definition: CAF.h:70
std::vector< double > mcnupz
Definition: CAF.h:73
std::vector< double > theta
Definition: CAF.h:73
TFile * cafFile
The output TFile pointer */.
Definition: CAF.h:53
std::vector< int > _MCPEndZ
Definition: CAF.h:76
std::vector< int > _MCPStartX
Definition: CAF.h:76
std::string _inputfile
Definition: CAF.h:62
TFile * _intfile
Definition: CAF.h:57
string infile
std::vector< int > detected
Definition: CAF.h:69
std::pair< float, std::string > P
Definition: CAF.h:14
std::vector< unsigned int > isThroughCaloEnd
Definition: CAF.h:84
unsigned int _Event
Definition: CAF.h:67
std::vector< int > intert
Definition: CAF.h:69
std::vector< double > anglereco
Definition: CAF.h:81
std::vector< int > _MCPStartZ
Definition: CAF.h:76
void loop()
Definition: CAF.cpp:348
std::vector< int > truepdg
Definition: CAF.h:76
std::vector< double > verty
Definition: CAF.h:73
std::unordered_map< int, TH2F * > m_pidinterp
Definition: CAF.h:55
std::vector< float > GPartE
Definition: CAF.h:71
std::vector< int > ccnc
Definition: CAF.h:69
unsigned int _Run
Definition: CAF.h:67
Utils * _util
Definition: CAF.h:60
Definition: CAF.h:12
std::vector< double > q2
Definition: CAF.h:73
std::vector< unsigned int > isInBetweenEnd
Definition: CAF.h:84
std::vector< int > nGPart
Definition: CAF.h:70
std::vector< int > pdgmother
Definition: CAF.h:76
std::vector< int > _MCPEndY
Definition: CAF.h:76
std::vector< unsigned int > isTPCStart
Definition: CAF.h:83
std::vector< double > vertz
Definition: CAF.h:73
std::vector< double > truepz
Definition: CAF.h:78
std::vector< double > vertx
Definition: CAF.h:73
std::vector< double > truepx
Definition: CAF.h:78
std::vector< int > weight
Definition: CAF.h:69
std::vector< int > GPartLastMom
Definition: CAF.h:70
unsigned int _correct4origin
sets the string for the coordinates origins (World or TPC)
Definition: CAF.h:64
std::vector< float > GPartPx
Definition: CAF.h:71
TTree * _inttree
Definition: CAF.h:58
bool CheckVectorSize()
Definition: CAF.cpp:282
~CAF()
Definition: CAF.cpp:34
std::vector< unsigned int > isCaloEnd
Definition: CAF.h:84
TTree * cafMVA
The output TTree pointer */.
Definition: CAF.h:54
std::vector< unsigned int > isFidEnd
Definition: CAF.h:84
void ClearVectors()
Definition: CAF.cpp:193
std::vector< int > GPartPdg
Definition: CAF.h:70
std::vector< int > gt_t
Definition: CAF.h:69
std::vector< int > mode
Definition: CAF.h:69
void FillTTree()
Definition: CAF.cpp:183
Definition: Utils.h:7
std::vector< unsigned int > isTPCEnd
Definition: CAF.h:84
std::vector< double > y
Definition: CAF.h:73
std::vector< unsigned int > isCaloStart
Definition: CAF.h:83
std::vector< double > truepy
Definition: CAF.h:78
std::vector< double > mcnupx
Definition: CAF.h:73
std::vector< unsigned int > isEndcapStart
Definition: CAF.h:85
std::vector< int > mctrkid
Definition: CAF.h:76
std::vector< int > GPartLastDaugh
Definition: CAF.h:70
std::vector< double > prob_arr
Definition: CAF.h:81
std::vector< int > _MCPEndX
Definition: CAF.h:76
std::vector< std::string > _MCProc
Definition: CAF.h:77