1 |
mocchiut |
1.1 |
/** |
2 |
|
|
* \file CaloFranzini.h |
3 |
|
|
* \author Emiliano Mocchiutti (2007/12/03) |
4 |
|
|
*/ |
5 |
|
|
#ifndef calofranzini_h |
6 |
|
|
#define calofranzini_h |
7 |
|
|
|
8 |
mocchiut |
1.3 |
#include <iostream> |
9 |
mocchiut |
1.1 |
|
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 |
mocchiut |
1.5 |
#include <TMatrixF.h> |
21 |
mocchiut |
1.1 |
#include <TArrayI.h> |
22 |
|
|
#include <TArrayF.h> |
23 |
mocchiut |
1.3 |
#include <TStyle.h> |
24 |
|
|
#include <TCanvas.h> |
25 |
|
|
#include <TStyle.h> |
26 |
|
|
#include <TH1F.h> |
27 |
mocchiut |
1.8 |
#include <TF1.h> |
28 |
|
|
#include <TGraph.h> |
29 |
mocchiut |
1.7 |
#include <TDecompSVD.h> |
30 |
mocchiut |
1.3 |
// |
31 |
mocchiut |
1.1 |
|
32 |
mocchiut |
1.3 |
#include <PamLevel2.h> |
33 |
mocchiut |
1.1 |
|
34 |
|
|
using namespace std; |
35 |
|
|
|
36 |
|
|
/** |
37 |
|
|
* |
38 |
|
|
* Class to store and calculate variables useful for analysis with the Franzini method |
39 |
|
|
*/ |
40 |
|
|
class CaloFranzini : public TObject { |
41 |
|
|
|
42 |
|
|
private: |
43 |
|
|
// |
44 |
|
|
PamLevel2 *L2; |
45 |
|
|
Bool_t debug; |
46 |
mocchiut |
1.8 |
TFile *lfile; |
47 |
|
|
TFile *ffile; |
48 |
mocchiut |
1.1 |
Int_t nbin; |
49 |
|
|
TArrayF *brig; |
50 |
mocchiut |
1.4 |
TArrayF *brigm; |
51 |
|
|
TArrayF *qplmean[17]; |
52 |
|
|
TMatrixD *hmat[17]; |
53 |
mocchiut |
1.8 |
TMatrixD *hfmat[17]; |
54 |
mocchiut |
1.5 |
TMatrixD *fqplmean[17]; |
55 |
mocchiut |
1.3 |
Int_t N; |
56 |
|
|
Int_t NC; |
57 |
mocchiut |
1.1 |
// |
58 |
|
|
// needed to avoid reprocessing the same event over and over to obtain the variables; |
59 |
|
|
// |
60 |
|
|
UInt_t OBT; |
61 |
|
|
UInt_t PKT; |
62 |
|
|
UInt_t atime; |
63 |
|
|
Int_t sntr; |
64 |
|
|
Float_t estrip[2][22][96]; |
65 |
mocchiut |
1.3 |
Float_t qplane[43]; |
66 |
|
|
Bool_t sel; |
67 |
|
|
Bool_t cont; |
68 |
mocchiut |
1.5 |
Bool_t crig; |
69 |
mocchiut |
1.1 |
// |
70 |
mocchiut |
1.3 |
Int_t mask18b; |
71 |
mocchiut |
1.1 |
Bool_t dofull; |
72 |
|
|
Bool_t dolong; |
73 |
|
|
Int_t degfre; |
74 |
mocchiut |
1.8 |
Int_t fdegfre; |
75 |
mocchiut |
1.1 |
// |
76 |
|
|
Float_t longtzeta; ///< longitudinal covariance parameter used for event selection |
77 |
|
|
Float_t fulltzeta; ///< full calorimeter covariance parameter used for event selection |
78 |
|
|
// |
79 |
mocchiut |
1.8 |
Float_t negfulltzeta; |
80 |
|
|
Float_t posfulltzeta; |
81 |
|
|
Float_t minsvalue; |
82 |
|
|
Float_t maxsvalue; |
83 |
|
|
Float_t aveposvar; |
84 |
|
|
Float_t avenegvar; |
85 |
|
|
Int_t numneg; |
86 |
|
|
Int_t numpos; |
87 |
|
|
// |
88 |
mocchiut |
1.1 |
|
89 |
|
|
public: |
90 |
|
|
// |
91 |
|
|
CaloFranzini(); |
92 |
|
|
CaloFranzini(PamLevel2 *L2); |
93 |
|
|
~CaloFranzini(){ Delete(); }; |
94 |
|
|
// |
95 |
|
|
Float_t GetLongTZeta(){Process(); return longtzeta;}; ///< Returns longitudinal covariance parameter used for event selection |
96 |
|
|
Float_t GetFullTZeta(){Process(); return fulltzeta;}; ///< Returns full calorimeter covariance parameter used for event selection |
97 |
|
|
// |
98 |
|
|
Float_t GetNormLongTZeta(); ///< Returns longitudinal covariance parameter used for event selection |
99 |
|
|
Float_t GetNormFullTZeta(); ///< Returns full calorimeter covariance parameter used for event selection |
100 |
|
|
// |
101 |
mocchiut |
1.8 |
|
102 |
|
|
Float_t GetFullPositive(){Process(); return posfulltzeta;}; |
103 |
|
|
Float_t GetFullNegative(){Process(); return negfulltzeta;}; |
104 |
|
|
Int_t GetFullNumPositive(){Process(); return numpos;}; |
105 |
|
|
Int_t GetFullNumNegative(){Process(); return numneg;}; |
106 |
|
|
Float_t GetFullMaxVar(){Process(); return maxsvalue;}; |
107 |
|
|
Float_t GetFullMinVar(){Process(); return minsvalue;}; |
108 |
|
|
Float_t GetFullAveragePosVar(){Process(); return aveposvar;}; |
109 |
|
|
Float_t GetFullAverageNegVar(){Process(); return avenegvar;}; |
110 |
|
|
|
111 |
|
|
// |
112 |
mocchiut |
1.3 |
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); |
113 |
|
|
void Contamination(){sel = false; cont = true;}; ///< Set contamination mode: planes from N to 22 are used. |
114 |
mocchiut |
1.2 |
Int_t GetDegreeOfFreedom(){return degfre;}; |
115 |
mocchiut |
1.8 |
Int_t GetLongDegreeOfFreedom(){return degfre;}; |
116 |
|
|
Int_t GetFullDegreeOfFreedom(){return fdegfre;}; |
117 |
mocchiut |
1.2 |
// |
118 |
mocchiut |
1.6 |
TArrayF *LoadLongAverage(Float_t rig); |
119 |
mocchiut |
1.1 |
TMatrixD *LoadCovarianceMatrix(Float_t rig); |
120 |
|
|
// |
121 |
mocchiut |
1.4 |
Float_t GetAverageAt(Int_t plane, Float_t rig); |
122 |
|
|
Float_t GetHmatrixAt(Int_t i, Int_t j, Float_t rig); |
123 |
|
|
// |
124 |
mocchiut |
1.5 |
Float_t GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig); |
125 |
|
|
Float_t GetFullHmatrixAt(Int_t i, Int_t j, Float_t rig); |
126 |
mocchiut |
1.6 |
Float_t GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig, Int_t rigbin); |
127 |
|
|
Float_t GetFullHmatrixAt(Int_t i, Int_t j, Float_t rig, Int_t rigbin); |
128 |
mocchiut |
1.8 |
Float_t GetFullHmatrixAt(Int_t i, Int_t j, Float_t rig, Int_t rigbin, Int_t mtherig); |
129 |
mocchiut |
1.5 |
// |
130 |
mocchiut |
1.1 |
Bool_t Open(TString matrixfile); |
131 |
mocchiut |
1.8 |
Bool_t Open(TString longmatrixfile,TString fullmatrixfile); |
132 |
mocchiut |
1.4 |
Bool_t LoadBin(); |
133 |
mocchiut |
1.8 |
Bool_t LoadBin(Bool_t full); |
134 |
mocchiut |
1.5 |
Bool_t LoadLong(); |
135 |
|
|
Bool_t LoadFull(); |
136 |
mocchiut |
1.4 |
Bool_t LoadMatrices(); |
137 |
mocchiut |
1.5 |
Bool_t LoadFullMatrices(); |
138 |
mocchiut |
1.8 |
TFile *GetFile(){return lfile;}; |
139 |
|
|
TFile *GetLongFile(){return lfile;}; |
140 |
|
|
TFile *GetFullFile(){return ffile;}; |
141 |
mocchiut |
1.1 |
// |
142 |
mocchiut |
1.6 |
TMatrixD *LoadFullAverage(Int_t rigbin); |
143 |
|
|
TMatrixD *LoadFullNAverage(Int_t rigbin); |
144 |
|
|
void UnLoadFullAverage(Int_t rigbin); |
145 |
|
|
void UnLoadFullNAverage(Int_t rigbin); |
146 |
|
|
TMatrixF *LoadFullMatrix(Int_t rigbin); |
147 |
|
|
void LoadFullMatrix(Int_t rigbin, TMatrixF *&fmatri); |
148 |
|
|
TMatrixF *LoadFullNMatrix(Int_t rigbin); |
149 |
|
|
void UnLoadFullMatrix(Int_t rigbin); |
150 |
|
|
void UnLoadFullNMatrix(Int_t rigbin); |
151 |
|
|
// |
152 |
mocchiut |
1.7 |
Int_t ConvertStrip(Int_t mstrip); |
153 |
|
|
// |
154 |
mocchiut |
1.1 |
Bool_t CreateMatrixFile(TString matrixfile); |
155 |
mocchiut |
1.4 |
Bool_t UpdateMatrixFile(TString matrixfile); |
156 |
mocchiut |
1.1 |
void WriteNumBin(Int_t numbin); |
157 |
|
|
void WriteRigBin(TArrayF *rigbin); |
158 |
|
|
void WriteLongMean(TArrayF *qpl, Int_t bin); |
159 |
|
|
void WriteLongMatrix(TMatrixD *matrix, Int_t bin); |
160 |
mocchiut |
1.7 |
void WriteFullMatrix(TMatrixD *matrix, Int_t bin); |
161 |
mocchiut |
1.6 |
void WriteFullNMatrix(TMatrixF *matrix, Int_t bin); |
162 |
mocchiut |
1.5 |
void WriteFullMean(TMatrixD *matrix, Int_t bin); |
163 |
mocchiut |
1.6 |
void WriteFullNMean(TMatrixD *matrix, Int_t bin); |
164 |
mocchiut |
1.3 |
void WriteInvertedLongMatrix(TMatrixD matrix, Int_t bin); |
165 |
mocchiut |
1.7 |
void WriteInvertedFullMatrix(TMatrixD matrix, Int_t bin); |
166 |
mocchiut |
1.1 |
void CloseMatrixFile(); |
167 |
|
|
// |
168 |
mocchiut |
1.8 |
void CalculateLongTZeta(){ dolong=true; }; |
169 |
|
|
void CalculateFullTZeta(){ dofull=true; }; |
170 |
|
|
void CalculateLongTZeta(Bool_t bo){ dolong=bo; }; |
171 |
|
|
void CalculateFullTZeta(Bool_t bo){ dofull=bo; }; |
172 |
mocchiut |
1.1 |
void SetDebug(Bool_t d){ debug=d; }; |
173 |
mocchiut |
1.3 |
void SetNoWpreSampler(Int_t n); |
174 |
|
|
void SetNoWcalo(Int_t n); |
175 |
|
|
Int_t GetNoWpreSampler(){return N;}; ///< Get the number of W planes used as presampler. |
176 |
|
|
Int_t GetNoWcalo(){return NC;}; ///< Get the number of W planes used as calorimeter. |
177 |
|
|
void DrawLongAverage(Float_t rig); |
178 |
mocchiut |
1.5 |
void DrawLongAverage(Int_t bin); |
179 |
|
|
void UseCaloRig(){crig=true;}; |
180 |
mocchiut |
1.1 |
// |
181 |
|
|
void Clear(); |
182 |
|
|
void Clear(Option_t *option){Clear();}; |
183 |
|
|
void Delete(); |
184 |
|
|
void Delete(Option_t *option){Delete();}; |
185 |
|
|
// |
186 |
|
|
void Process(Int_t ntrack); ///< Process data track number ntrack |
187 |
|
|
void Process(); ///< Process data |
188 |
|
|
void Print(); |
189 |
|
|
void Print(Option_t *option){Print();}; |
190 |
|
|
// |
191 |
|
|
ClassDef(CaloFranzini,1); |
192 |
|
|
}; |
193 |
|
|
|
194 |
|
|
#endif |
195 |
|
|
|