]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDclusterErrors.h
new digitization and reconstruction corresponded to new data format
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterErrors.h
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "AliTrackReference.h"
3 #endif
4
5 AliTRDclusterCorrection * gCorrection;
6
7 void ReadCorrection(){
8   TFile f("TRDcorrection.root");
9   gCorrection= (AliTRDclusterCorrection *)f.Get("TRDcorrection");
10   if (gCorrection==0){
11     printf("Correction not found");
12   }
13 }
14
15
16 class AliTRDExactPoint: public TObject {
17   public : 
18   AliTRDExactPoint();
19   Float_t fTX;    //x in rotated coordinate in the center of time bin
20   Float_t fTY;    //y 
21   Float_t fTZ;    //z
22   Float_t fTAY;   //angle y
23   Float_t fTAZ;   //angle z
24   Float_t fGx;
25   Float_t fGy;
26   Float_t fGz;
27   //
28   void SetReference(AliTrackReference *ref);
29   Float_t fTRefAngleY;
30   Float_t fRefPos[3];
31   Float_t fRefMom[3];
32   //
33   Int_t   fDetector;      // detector (chamber)
34   Int_t   fLocalTimeBin;  // local time bin
35   Int_t   fPlane;         // plane (layer)
36   Int_t   fSector;       // segment
37   Int_t   fPlaneMI;  
38   // 
39   Float_t fTQ;
40   Float_t fTPrim;
41   //  
42   ClassDef(AliTRDExactPoint,1)
43 };
44
45 class AliTRDCI: public TObject {
46   public :
47   AliTRDCI(){;}
48   virtual ~AliTRDCI(){;}
49   //
50   AliTRDclusterMI fCl;
51   AliTRDExactPoint fEp;
52   TParticle fP;
53   Char_t fStatus;
54   Int_t  fNClusters;
55   //
56   Float_t fDYtilt;
57   Float_t fTDistZ;  
58   //
59   Int_t   fNTracks;
60   Float_t fPt;
61   Float_t fCharge;
62   Bool_t  fIsPrim;
63   Float_t fCorrection;
64   void Update();
65   ClassDef(AliTRDCI,1)
66 };
67
68 class AliTRDClusterErrAnal: public TObject{
69 public: 
70   AliTRDClusterErrAnal(Char_t *chloader  = "galice.root");
71   void SetIO(Int_t event);  
72   Int_t Analyze(Int_t trackmax);
73   void LoadClusters();
74   void MakeExactPoints(Int_t trackmax);
75   void SortReferences();
76   AliTrackReference * FindNearestReference(Int_t lab, Float_t pos[3], Float_t dmax=10.);
77 public:
78   AliRunLoader * fRunLoader;
79   AliLoader * fTRDLoader;
80   AliTRDparameter *fParam;
81   AliTRDgeometry *fGeometry;
82   TTree * fHitTree;
83   TTree * fClusterTree;
84   TTree * fReferenceTree;
85   AliTRDv1 * fTRD;
86   //
87   TTree * fTreeA;
88   TFile * fFileA;
89   AliTRDtracker *fTracker;
90   AliStack *fStack;
91   TObjArray fClusters[12][100][18];  //first plane, second time bin
92   TObjArray fExactPoints;
93   TObjArray *fReferences;
94
95   ClassDef(AliTRDClusterErrAnal,1)
96 };
97
98
99 class AliTRDClusterErrDraw: public TObject{
100 public:
101   TTree * fTree;
102   AliTRDclusterCorrection*   MakeCorrection(TTree * tree, Float_t offset);
103   static TH1F * ResDyVsAmp(TTree* tree, const char* selection, Float_t t0, Float_t ampmin=10, Float_t ampmax=300);
104   static TH1F * ResDyVsRelPos(TTree* tree, const char* selection, Float_t t0, Float_t min=-0.5, Float_t max=0.5);
105   static TH1F * ResDyVsAngleY(TTree* tree, const char* selection, Float_t t0, Float_t min=-1., Float_t max=1.);
106   static void   AliLabelAxes(TH1* histo, const char* xAxisTitle, const char* yAxisTitle);
107   static TH1F*  CreateEffHisto(TH1F* hGen, TH1F* hRec);
108   static TH1F*  CreateResHisto(TH2F* hRes2, Bool_t draw = kTRUE, Bool_t drawBinFits = kTRUE, 
109                      Bool_t overflowBinFits = kFALSE);
110   ClassDef(AliTRDClusterErrDraw,1)
111 };
112
113
114
115
116 AliTRDExactPoint::AliTRDExactPoint()
117 {
118   fTX=fTY=fTZ=fTAZ=fTAY=fGx=fGy=fGz=fTRefAngleY=0;
119   fRefPos[0]=fRefPos[1]=fRefPos[2]=fRefMom[0]=fRefMom[1]=fRefMom[2]=0;
120   fDetector=fLocalTimeBin=fPlane=fSector=fPlaneMI=0;
121   fTQ=fTPrim=0;
122 }
123
124 void AliTRDExactPoint::SetReference(AliTrackReference *ref){
125   fRefPos[0] = ref->X();
126   fRefPos[1] = ref->Y();
127   fRefPos[2] = ref->Z();
128   //
129   fRefMom[0] = ref->Px();
130   fRefMom[1] = ref->Py();
131   fRefMom[2] = ref->Pz();
132 }
133
134
135 void AliTRDCI::Update()
136 {
137   //
138   //thanks to root
139   fPt = fP.Pt();
140   fCharge = fP.GetPDG()->Charge();
141   fIsPrim = (fP.GetMother(0)>0)? kFALSE :kTRUE;
142   fCorrection = gCorrection->GetCorrection(fEp.fPlane,fCl.fTimeBin,fEp.fTAY);
143 }
144
145
146 /*
147 //example seesion
148
149 .L AliGenInfo.C+
150 .L AliTRDclusterErrors.C+
151 gCorrection  = AliTRDclusterCorrection::GetCorrection();
152 AliTRDClusterErrAnal ana;
153 ana.Analyze(10000000)
154
155
156
157 .L AliGenInfo.C+
158 .L AliTRDclusterErrors.C+
159 TFile f("trdclusteranal.root");
160 TTree* tree = (TTree*)f.Get("trdcl");
161 AliComparisonDraw comp;
162 comp->fTree = tree;
163
164
165 tree->SetAlias("shapef","(1.-(0.8+0.06*(6-fEp.fPlane))*(fCl.fSigmaY2/(0.17+0.027*abs(fEp.fTAY))))");
166 tree->SetAlias("shapes","0.08+0.3/sqrt(fCl.fQ)");
167 tree->SetAlias("sfactor","shapef/shapes");
168
169 tree->SetAlias("shapen","(fCl.fNPads-2.7-0.9*abs(fEp.fTAY))");
170
171 tree->SetAlias("gshape","sfactor>-2&&fCl.fNPads<6&&shapen<1");
172
173
174 tree->SetAlias("dy"    , "fEp.fTY-fCl.fY-fDYtilt");
175 tree->SetAlias("angle","abs(fEp.fTAY)");
176 TCut cbase("cbase","(abs(fP.fPdgCode)!=11||fPt>0.2)&&fPt>0.1&&angle<2");
177
178 tree->SetAlias("erry0","(0.028+0.07*angle)");
179 tree->SetAlias("erry1","erry0*(0.9+15./fCl.fQ)");
180 tree->SetAlias("erry2","erry1*(0.8+0.5*max(-sfactor,0))"); 
181
182
183
184
185 TH1F his("resy","resy",100,-0.2,0.2);
186 comp->fTree->Draw("dy:0.028*fEp.fTAY","fStatus==0 && abs(dy)<1.0&&fNTracks<2&&angle<2&&gshape","")
187 comp->DrawXY("sqrt(fCl.fQ)","dy","fStatus==0"+cbase,"gshape",10,0,20,-0.7,0.7);
188
189 comp->DrawXY("angle","dy/erry1","fStatus==0"+cbase,"gshape",10,0,2,-5.7,5.7);
190 comp->DrawXY("sqrt(cl->fQ)","dy/err1","fStatus==0"+cbase,"gshape",10,2,20,-5.7,5.7);
191
192
193
194 AliTRDClusterErrDraw::ResDyVsAmp(tree,"abs(dy)<0.4&&abs(fEp.fTAY)<0.2&&fNTracks<2&&fPt>0.1"+cbase,-0.03);
195 AliTRDClusterErrDraw::ResDyVsRelPos(tree,"abs(dy)<0.4&&abs(fEp.fTAY)<0.2&&fNTracks<2&&fPt>0.2"+cbase,-0.03);
196 AliTRDClusterErrDraw::ResDyVsAngleY(tree,"abs(fEp.fTY-fCl.fY+fDYtilt)<0.4",0.);
197
198 AliTRDclusterCorrection * cor = AliTRDClusterErrDraw::MakeCorrection(tree,0.134);
199 tree->Draw("sqrt(fCl.fRmsY)","fStatus==0&&abs(fEp.fTY-fCl.fY+fDYtilt)<0.4&&abs(fEp.fTAY)<0.2&&fNTracks<2&&fPt>0.2&&fCl.fNPads==0");
200
201 tree->Draw("fEp.fTY-fCl.fY+fDYtilt:fCl.fTimeBin","fStatus==0&&abs(fEp.fTY-fCl.fY+fDYtilt)<0.5&&abs(fEp.fTAY)<0.3&&fEp.fTAY>0.13","prof") 
202
203
204 */
205