| 1 | /** | 
| 2 | * \file CaloProfile.h | 
| 3 | * \author Emiliano Mocchiutti | 
| 4 | */ | 
| 5 | #ifndef caloprofile_h | 
| 6 | #define caloprofile_h | 
| 7 |  | 
| 8 | #define EMPTY -1 | 
| 9 | #define MAX 50 | 
| 10 |  | 
| 11 | #include <iostream> | 
| 12 | #include <stdio.h> | 
| 13 | #include <string.h> | 
| 14 | #include <ctype.h> | 
| 15 | #include <TTree.h> | 
| 16 | #include <TFriendElement.h> | 
| 17 | #include <TChain.h> | 
| 18 | #include <TCanvas.h> | 
| 19 | #include <TGraph.h> | 
| 20 | #include <TH1F.h> | 
| 21 | #include <TH2F.h> | 
| 22 | #include <TFile.h> | 
| 23 | #include <TPolyLine.h> | 
| 24 | #include <TMath.h> | 
| 25 | #include <TStyle.h> | 
| 26 | #include <TList.h> | 
| 27 | #include <TKey.h> | 
| 28 | #include <TSystemFile.h> | 
| 29 | #include <TSystemDirectory.h> | 
| 30 | #include <TSQLServer.h> | 
| 31 | #include <TF1.h> | 
| 32 |  | 
| 33 | #include <PamLevel2.h> | 
| 34 |  | 
| 35 | using namespace std; | 
| 36 |  | 
| 37 | struct stack{ | 
| 38 | char data[MAX]; | 
| 39 | int top; | 
| 40 | }; | 
| 41 |  | 
| 42 | /** | 
| 43 | * | 
| 44 | */ | 
| 45 | class CaloLat : public TObject { | 
| 46 |  | 
| 47 | private: | 
| 48 | // | 
| 49 | PamLevel2 *L2; | 
| 50 | Bool_t debug; | 
| 51 | // | 
| 52 | // needed to avoid reprocessing the same event over and over to obtain the variables | 
| 53 | // | 
| 54 | UInt_t OBT; | 
| 55 | UInt_t PKT; | 
| 56 | UInt_t atime; | 
| 57 | // | 
| 58 | Float_t estrip[2][22][96]; | 
| 59 | // | 
| 60 |  | 
| 61 | public: | 
| 62 | // | 
| 63 | // | 
| 64 | void Draw(); | 
| 65 | void Draw(Int_t,Int_t); | 
| 66 | // | 
| 67 | CaloLat(); | 
| 68 | CaloLat(PamLevel2 *L2); | 
| 69 | ~CaloLat(){ Delete(); }; | 
| 70 | // | 
| 71 | void SetDebug(Bool_t d){ debug=d; }; | 
| 72 | // | 
| 73 | void Clear(); | 
| 74 | void Clear(Option_t *option){Clear();}; | 
| 75 | void Delete(); | 
| 76 | void Delete(Option_t *option){Delete();}; | 
| 77 | // | 
| 78 | void Process(); ///< Process data | 
| 79 | void Print(); | 
| 80 | void Print(Option_t *option){Print();}; | 
| 81 | // | 
| 82 | ClassDef(CaloLat,1); | 
| 83 | }; | 
| 84 |  | 
| 85 | /** | 
| 86 | * | 
| 87 | */ | 
| 88 | class CaloLong : public TObject { | 
| 89 |  | 
| 90 | private: | 
| 91 | // | 
| 92 | PamLevel2 *L2; | 
| 93 | Bool_t debug; | 
| 94 | // | 
| 95 | // needed to avoid reprocessing the same event over and over to obtain the variables | 
| 96 | // | 
| 97 | UInt_t OBT; | 
| 98 | UInt_t PKT; | 
| 99 | UInt_t atime; | 
| 100 | UInt_t fOBT; | 
| 101 | UInt_t fPKT; | 
| 102 | UInt_t fatime; | 
| 103 | // | 
| 104 | Int_t N; | 
| 105 | Int_t NC; | 
| 106 | Bool_t sel; | 
| 107 | Bool_t cont; | 
| 108 | Int_t mask18b; | 
| 109 | // | 
| 110 | Float_t chi2; | 
| 111 | Float_t ndf; | 
| 112 | Float_t E0; | 
| 113 | Float_t a; | 
| 114 | Float_t b; | 
| 115 | Float_t errE0; | 
| 116 | Float_t erra; | 
| 117 | Float_t errb; | 
| 118 | Float_t etmax; | 
| 119 | Float_t asymm; | 
| 120 | Float_t X0pl; | 
| 121 | Float_t defE0; | 
| 122 | Float_t umax; | 
| 123 | Float_t lmax; | 
| 124 | TString sumax; | 
| 125 | TString slmax; | 
| 126 | Int_t fitresult; | 
| 127 | // | 
| 128 | Bool_t no18x; | 
| 129 | Bool_t maskXE; | 
| 130 | Bool_t maskYE; | 
| 131 | Bool_t maskXO; | 
| 132 | Bool_t maskYO; | 
| 133 | // | 
| 134 | Float_t eplane[2][22]; | 
| 135 | // | 
| 136 | CaloLevel2 *clp; | 
| 137 | // | 
| 138 | Float_t Evaluate(TString s, Float_t max); // expression must be of the form "5*t"."t+10","t-(4*t)"... | 
| 139 | // | 
| 140 |  | 
| 141 | public: | 
| 142 | // | 
| 143 | // | 
| 144 | void Fit(); | 
| 145 | void Fit(Bool_t draw); | 
| 146 | // | 
| 147 | //    Double_t ccurve(Double_t *t, Double_t *par); | 
| 148 | // | 
| 149 | void SetCaloLevel2Pointer(CaloLevel2 *cp){ clp = cp;}; | 
| 150 | // | 
| 151 | Float_t Get_E0(){this->Fit(); return E0;}; | 
| 152 | Float_t Get_defE0(){this->Fit(); return defE0;}; | 
| 153 | Float_t Get_a(){this->Fit(); return a;}; | 
| 154 | Float_t Get_b(){this->Fit(); return b;}; | 
| 155 | Float_t Get_errE0(){this->Fit(); return errE0;}; | 
| 156 | Float_t Get_erra(){this->Fit(); return erra;}; | 
| 157 | Float_t Get_errb(){this->Fit(); return errb;}; | 
| 158 | Float_t Get_chi2(){this->Fit(); return chi2;}; | 
| 159 | Float_t Get_ndf(){this->Fit(); return ndf;}; | 
| 160 | Float_t Get_nchi2(){this->Fit(); if ( ndf > 0 ) return (chi2/ndf); return 0;}; | 
| 161 | Float_t Get_tmax(){this->Fit(); if ( b != 0 ) return ((a-1.)/b); return 0;}; | 
| 162 | Float_t Get_asymm(){this->Fit(); return asymm;}; | 
| 163 | Float_t Get_exptmax(){this->Process(); return etmax;}; | 
| 164 | Float_t Get_X0pl(){this->Process(); return X0pl;}; | 
| 165 | Int_t Get_fitresult(){this->Fit(); return fitresult;}; | 
| 166 | // | 
| 167 | void ForceNextFit(){atime=0;fatime=0;}; | 
| 168 | void Draw(); | 
| 169 | void Draw(Int_t); | 
| 170 | // | 
| 171 | CaloLong(); | 
| 172 | CaloLong(PamLevel2 *L2); | 
| 173 | ~CaloLong(){ Delete(); }; | 
| 174 | // | 
| 175 | void SetDebug(Bool_t d){ debug=d; }; | 
| 176 | void UsePlane18X(){ no18x=false; }; | 
| 177 | // | 
| 178 | void MaskSection(TString); | 
| 179 | void UnMaskSection(TString); | 
| 180 | void UnMaskSections(); | 
| 181 | 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); | 
| 182 | void Contamination(){sel = false; cont = true;}; ///< Set contamination mode: planes from N to 22 are used. | 
| 183 | void SetNoWpreSampler(Int_t n); | 
| 184 | void SetNoWcalo(Int_t n); | 
| 185 | void SplitInto(Int_t NoWpreSampler, Int_t NoWcalo); | 
| 186 | Int_t GetNoWpreSampler(){return N;}; ///< Get the number of W planes used as presampler. | 
| 187 | Int_t GetNoWcalo(){return NC;}; ///< Get the number of W planes used as calorimeter. | 
| 188 | void SetEnergies(Float_t myene[][22]); | 
| 189 | // | 
| 190 | void SetLowerLimit(Float_t l){ lmax = l; }; | 
| 191 | void SetUpperLimit(Float_t u){ umax = u; }; | 
| 192 | void SetLowerLimit(TString sl){ slmax = sl; };// expression must be of the form "5*t"."t+10","t-(4*t)"... where t will be replaced by the fitted maximum (X0) | 
| 193 | void SetUpperLimit(TString su){ sumax = su; };// expression must be of the form "5*t"."t+10","t-(4*t)"... where t will be replaced by the fitted maximum (X0) | 
| 194 | // | 
| 195 | void Clear(); | 
| 196 | void Clear(Option_t *option){Clear();}; | 
| 197 | void Delete(); | 
| 198 | void Delete(Option_t *option){Delete();}; | 
| 199 | // | 
| 200 | void Process(); ///< Process data | 
| 201 | void Print(); | 
| 202 | void Print(Option_t *option){Print();}; | 
| 203 | // | 
| 204 | ClassDef(CaloLong,2); | 
| 205 | }; | 
| 206 |  | 
| 207 | /** | 
| 208 | * | 
| 209 | */ | 
| 210 | class Calo2D : public TObject { | 
| 211 |  | 
| 212 | private: | 
| 213 | // | 
| 214 | PamLevel2 *L2; | 
| 215 | Bool_t debug; | 
| 216 | // | 
| 217 | // needed to avoid reprocessing the same event over and over to obtain the variables | 
| 218 | // | 
| 219 | UInt_t OBT; | 
| 220 | UInt_t PKT; | 
| 221 | UInt_t atime; | 
| 222 | // | 
| 223 | Float_t estrip[23][96][96]; | 
| 224 | Int_t smax[23]; | 
| 225 | Int_t smay[23]; | 
| 226 | // | 
| 227 |  | 
| 228 | public: | 
| 229 | // | 
| 230 | // | 
| 231 | void Draw(); | 
| 232 | void Draw(Int_t); | 
| 233 | // | 
| 234 | Calo2D(); | 
| 235 | Calo2D(PamLevel2 *L2); | 
| 236 | ~Calo2D(){ Delete(); }; | 
| 237 | // | 
| 238 | void SetDebug(Bool_t d){ debug=d; }; | 
| 239 | // | 
| 240 | void Clear(); | 
| 241 | void Clear(Option_t *option){Clear();}; | 
| 242 | void Delete(); | 
| 243 | void Delete(Option_t *option){Delete();}; | 
| 244 | // | 
| 245 | void Process(); ///< Process data | 
| 246 | void Print(); | 
| 247 | void Print(Option_t *option){Print();}; | 
| 248 | // | 
| 249 | ClassDef(Calo2D,1); | 
| 250 | }; | 
| 251 |  | 
| 252 | #endif | 
| 253 |  |