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