]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaRec/AliTRDalignmentTask.cxx
remove warnings during reloading the TRD track list in the prompt
[u/mrichter/AliRoot.git] / TRD / qaRec / AliTRDalignmentTask.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercialf purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15
16 #include "TTreeStream.h"
17 #include "TROOT.h"
18 #include "TH1.h"
19 #include "TH2.h"
20
21 #include "AliTrackPointArray.h"
22 #include "AliLog.h"
23
24 #include "AliTRDgeometry.h"
25 #include "AliTRDcluster.h"
26 #include "AliTRDseedV1.h"
27 #include "AliTRDtrackV1.h"
28
29 #include "AliTRDalignmentTask.h"
30
31 ClassImp(AliTRDalignmentTask)
32
33 //________________________________________________________
34 AliTRDalignmentTask::AliTRDalignmentTask()
35   :AliTRDrecoTask("Alignment", "TRD alignment")
36   ,fTree(0x0)
37   ,fArray(0x0)
38 {
39   InitFunctorList();
40   DefineOutput(1, TTree::Class());
41
42 }
43
44 //________________________________________________________
45 AliTRDalignmentTask::~AliTRDalignmentTask()
46 {
47   if (fArray) delete fArray;
48 }
49
50
51 //________________________________________________________
52 void AliTRDalignmentTask::CreateOutputObjects()
53 {
54   // spatial resolution
55   OpenFile(1, "RECREATE");
56
57   fTree = new TTree("spTree", "Tree with track space point arrays");
58   fTree->Branch("SP","AliTrackPointArray", &fArray);
59 }
60
61
62 //________________________________________________________
63 void AliTRDalignmentTask::Exec(Option_t *opt)
64 {
65   AliTRDrecoTask::Exec(opt);
66   PostData(1, fTree);
67 }
68
69
70 //________________________________________________________
71 TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track)
72 {
73   if(track) fTrack = track;
74   if(!fTrack){
75     AliWarning("No Track defined.");
76     return 0x0;
77   }
78
79   if (fArray) delete fArray;
80   fArray = new AliTrackPointArray(fTrack->GetNumberOfTracklets());
81
82   // Filling the track points array
83   Float_t x, y, z;
84   AliTrackPoint p; Int_t ip = 0;
85   AliTRDseedV1 *tracklet = 0x0;
86   for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
87     if(!(tracklet = fTrack->GetTracklet(il))) continue;
88     if(!tracklet->IsOK()) continue;
89     tracklet->Fit(kTRUE);
90
91     x = tracklet->GetX0();
92     y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x);
93     z = tracklet->GetZfit(0);
94     p.SetXYZ(x,y,z);
95     fArray->AddPoint(ip++, &p);
96   }
97   fTree->Fill();
98
99 /*  if(fDebugLevel>=1){
100     Float_t yt = fRim.GetYat(x[il]);
101     (*fDebugStream) << "TrkltResiduals"
102       << "layer="  << il
103       << "x="      <<x[il]
104       << "y="      <<y[il]
105       << "yt="     <<yt
106       << "dydx="   << dydx[il]
107       << "dy="     << dy
108       << "\n";
109   }*/
110   return 0x0;
111 }
112
113
114
115 //________________________________________________________
116 void AliTRDalignmentTask::GetRefFigure(Int_t ifig)
117 {
118   AliInfo(Form("Reference plot [%d] missing result", ifig));
119 }
120
121
122 //________________________________________________________
123 void AliTRDalignmentTask::Terminate(Option_t *)
124 {
125   if(fDebugStream){ 
126     delete fDebugStream;
127     fDebugStream = 0x0;
128     fDebugLevel = 0;
129   }
130   if(HasPostProcess()) PostProcess();
131 }
132
133
134 //________________________________________________________
135 TObjArray* AliTRDalignmentTask::Histos()
136 {
137   return 0x0;
138 /*  if(fContainer) return fContainer;
139
140   fContainer  = new TObjArray(3);
141
142   TH1 *h = 0x0;
143   
144   if(!(h = (TH1D*)gROOT->FindObject("cuttra"))){
145     h = new TH1D("cuttra","cuttra",20,0.5,20.5); 
146   } else h->Reset();
147
148   if(!(h = (TH1D*)gROOT->FindObject("cutpoi"))){
149     h = new TH1D("cutpoi","cutpoi",20,0.5,20.5);
150   } else h->Reset();
151
152   if(!(h = (TH2D*)gROOT->FindObject("modpop"))){
153     h = new TH2D("modpop","modpop",90,-0.5,89.5,30,-0.5,29.5);
154     h->SetXTitle("module nr");
155     h->SetYTitle("layer nr");
156   } else h->Reset();*/
157 }
158
159
160 //________________________________________________________
161 Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint *p, AliTrackPointArray *parray, int nmax) {
162
163   // Is the point p identical with one of the points on the list parray?
164   // This is a fix for aliroot 4-16-Rev-01 (and before) writing some 
165   // spurious unitialized points. 
166  
167   for (int i=0; i<parray->GetNPoints() && i<nmax; i++) {
168     AliTrackPoint pa;
169     parray->GetPoint(pa,i);
170     //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY());
171     if (p->GetResidual(pa,0)<1e-8) return kTRUE;
172     //printf("different\n");
173   }
174   return kFALSE;
175 }