1 |
/** |
2 |
* \file CaloFranzini.h |
3 |
* \author Emiliano Mocchiutti (2007/12/03) |
4 |
*/ |
5 |
#ifndef calofranzini_h |
6 |
#define calofranzini_h |
7 |
|
8 |
#include <iostream> |
9 |
|
10 |
#include <TTree.h> |
11 |
#include <TFriendElement.h> |
12 |
#include <TChain.h> |
13 |
#include <TFile.h> |
14 |
#include <TList.h> |
15 |
#include <TKey.h> |
16 |
#include <TSystemFile.h> |
17 |
#include <TSystemDirectory.h> |
18 |
#include <TSQLServer.h> |
19 |
#include <TMatrixD.h> |
20 |
#include <TMatrixF.h> |
21 |
#include <TArrayI.h> |
22 |
#include <TArrayF.h> |
23 |
#include <TStyle.h> |
24 |
#include <TCanvas.h> |
25 |
#include <TStyle.h> |
26 |
#include <TH1F.h> |
27 |
// |
28 |
|
29 |
#include <PamLevel2.h> |
30 |
|
31 |
using namespace std; |
32 |
|
33 |
/** |
34 |
* |
35 |
* Class to store and calculate variables useful for analysis with the Franzini method |
36 |
*/ |
37 |
class CaloFranzini : public TObject { |
38 |
|
39 |
private: |
40 |
// |
41 |
PamLevel2 *L2; |
42 |
Bool_t debug; |
43 |
TFile *file; |
44 |
Int_t nbin; |
45 |
TArrayF *brig; |
46 |
TArrayF *brigm; |
47 |
TArrayF *qplmean[17]; |
48 |
TMatrixD *hmat[17]; |
49 |
TMatrixF *hfmat[17]; |
50 |
TMatrixD *fqplmean[17]; |
51 |
Int_t N; |
52 |
Int_t NC; |
53 |
// |
54 |
// needed to avoid reprocessing the same event over and over to obtain the variables; |
55 |
// |
56 |
UInt_t OBT; |
57 |
UInt_t PKT; |
58 |
UInt_t atime; |
59 |
Int_t sntr; |
60 |
Float_t estrip[2][22][96]; |
61 |
Float_t qplane[43]; |
62 |
Bool_t sel; |
63 |
Bool_t cont; |
64 |
Bool_t crig; |
65 |
// |
66 |
Int_t mask18b; |
67 |
Bool_t dofull; |
68 |
Bool_t dolong; |
69 |
Int_t degfre; |
70 |
// |
71 |
Float_t longtzeta; ///< longitudinal covariance parameter used for event selection |
72 |
Float_t fulltzeta; ///< full calorimeter covariance parameter used for event selection |
73 |
// |
74 |
|
75 |
public: |
76 |
// |
77 |
CaloFranzini(); |
78 |
CaloFranzini(PamLevel2 *L2); |
79 |
~CaloFranzini(){ Delete(); }; |
80 |
// |
81 |
Float_t GetLongTZeta(){Process(); return longtzeta;}; ///< Returns longitudinal covariance parameter used for event selection |
82 |
Float_t GetFullTZeta(){Process(); return fulltzeta;}; ///< Returns full calorimeter covariance parameter used for event selection |
83 |
// |
84 |
Float_t GetNormLongTZeta(); ///< Returns longitudinal covariance parameter used for event selection |
85 |
Float_t GetNormFullTZeta(); ///< Returns full calorimeter covariance parameter used for event selection |
86 |
// |
87 |
void Selection(){sel = true; cont = false;}; ///< Set selection mode: planes from 1 to 22-N are used, plane 18 - N is masked if "emulate18" variable is true (DEFAULT); |
88 |
void Contamination(){sel = false; cont = true;}; ///< Set contamination mode: planes from N to 22 are used. |
89 |
Int_t GetDegreeOfFreedom(){return degfre;}; |
90 |
// |
91 |
TArrayF *LoadLongAverage(Float_t rig); |
92 |
TMatrixD *LoadCovarianceMatrix(Float_t rig); |
93 |
// |
94 |
Float_t GetAverageAt(Int_t plane, Float_t rig); |
95 |
Float_t GetHmatrixAt(Int_t i, Int_t j, Float_t rig); |
96 |
// |
97 |
Float_t GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig); |
98 |
Float_t GetFullHmatrixAt(Int_t i, Int_t j, Float_t rig); |
99 |
Float_t GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig, Int_t rigbin); |
100 |
Float_t GetFullHmatrixAt(Int_t i, Int_t j, Float_t rig, Int_t rigbin); |
101 |
// |
102 |
Bool_t Open(TString matrixfile); |
103 |
Bool_t LoadBin(); |
104 |
Bool_t LoadLong(); |
105 |
Bool_t LoadFull(); |
106 |
Bool_t LoadMatrices(); |
107 |
Bool_t LoadFullMatrices(); |
108 |
TFile *GetFile(){return file;}; |
109 |
// |
110 |
TMatrixD *LoadFullAverage(Int_t rigbin); |
111 |
TMatrixD *LoadFullNAverage(Int_t rigbin); |
112 |
void UnLoadFullAverage(Int_t rigbin); |
113 |
void UnLoadFullNAverage(Int_t rigbin); |
114 |
TMatrixF *LoadFullMatrix(Int_t rigbin); |
115 |
void LoadFullMatrix(Int_t rigbin, TMatrixF *&fmatri); |
116 |
TMatrixF *LoadFullNMatrix(Int_t rigbin); |
117 |
void UnLoadFullMatrix(Int_t rigbin); |
118 |
void UnLoadFullNMatrix(Int_t rigbin); |
119 |
// |
120 |
Bool_t CreateMatrixFile(TString matrixfile); |
121 |
Bool_t UpdateMatrixFile(TString matrixfile); |
122 |
void WriteNumBin(Int_t numbin); |
123 |
void WriteRigBin(TArrayF *rigbin); |
124 |
void WriteLongMean(TArrayF *qpl, Int_t bin); |
125 |
void WriteLongMatrix(TMatrixD *matrix, Int_t bin); |
126 |
void WriteFullMatrix(TMatrixF *matrix, Int_t bin); |
127 |
void WriteFullNMatrix(TMatrixF *matrix, Int_t bin); |
128 |
void WriteFullMean(TMatrixD *matrix, Int_t bin); |
129 |
void WriteFullNMean(TMatrixD *matrix, Int_t bin); |
130 |
void WriteInvertedLongMatrix(TMatrixD matrix, Int_t bin); |
131 |
void WriteInvertedFullMatrix(TMatrixF matrix, Int_t bin); |
132 |
void CloseMatrixFile(); |
133 |
// |
134 |
void CalculateLongTZeta(){ dofull = false; dolong=true; }; |
135 |
void CalculateFullTZeta(){ dolong = false; dofull=true; }; |
136 |
void SetDebug(Bool_t d){ debug=d; }; |
137 |
void SetNoWpreSampler(Int_t n); |
138 |
void SetNoWcalo(Int_t n); |
139 |
Int_t GetNoWpreSampler(){return N;}; ///< Get the number of W planes used as presampler. |
140 |
Int_t GetNoWcalo(){return NC;}; ///< Get the number of W planes used as calorimeter. |
141 |
void DrawLongAverage(Float_t rig); |
142 |
void DrawLongAverage(Int_t bin); |
143 |
void UseCaloRig(){crig=true;}; |
144 |
// |
145 |
void Clear(); |
146 |
void Clear(Option_t *option){Clear();}; |
147 |
void Delete(); |
148 |
void Delete(Option_t *option){Delete();}; |
149 |
// |
150 |
void Process(Int_t ntrack); ///< Process data track number ntrack |
151 |
void Process(); ///< Process data |
152 |
void Print(); |
153 |
void Print(Option_t *option){Print();}; |
154 |
// |
155 |
ClassDef(CaloFranzini,1); |
156 |
}; |
157 |
|
158 |
#endif |
159 |
|