]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDalignmentTask.cxx
small fix for name of files
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDalignmentTask.cxx
CommitLineData
1ee39b3a 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///////////////////////////////////////////////
17// TRD alignment task
18//
19// Some documentation
20//
21// Authors :
22//
23////////////////////////////////////////////////
24
25#include "TTreeStream.h"
26#include "TROOT.h"
27#include "TH1.h"
28#include "TH2.h"
29
30#include "AliTrackPointArray.h"
31#include "AliLog.h"
32
33#include "AliTRDgeometry.h"
34#include "AliTRDcluster.h"
35#include "AliTRDseedV1.h"
36#include "AliTRDtrackV1.h"
37
38#include "AliTRDalignmentTask.h"
39
40ClassImp(AliTRDalignmentTask)
41
42//________________________________________________________
43AliTRDalignmentTask::AliTRDalignmentTask()
44 :AliTRDrecoTask("Alignment", "TRD alignment")
45 ,fTree(0x0)
46 ,fArray(0x0)
47{
48 InitFunctorList();
49 DefineOutput(1, TTree::Class());
50
51}
52
53//________________________________________________________
54AliTRDalignmentTask::~AliTRDalignmentTask()
55{
56 if (fArray) delete fArray;
57}
58
59
60//________________________________________________________
61void AliTRDalignmentTask::CreateOutputObjects()
62{
63 // spatial resolution
64 OpenFile(1, "RECREATE");
65
66 fTree = new TTree("spTree", "Tree with track space point arrays");
67 fTree->Branch("SP","AliTrackPointArray", &fArray);
68}
69
70
71//________________________________________________________
72void AliTRDalignmentTask::Exec(Option_t *opt)
73{
74// Documentation to come
75
76 AliTRDrecoTask::Exec(opt);
77 PostData(1, fTree);
78}
79
80
81//________________________________________________________
82TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track)
83{
84// Documentation to come
85
86 if(track) fkTrack = track;
87 if(!fkTrack){
88 AliWarning("No Track defined.");
89 return 0x0;
90 }
91
92 if (fArray) delete fArray;
93 fArray = new AliTrackPointArray(fkTrack->GetNumberOfTracklets());
94
95 // Filling the track points array
96 Float_t x, y, z;
97 AliTrackPoint p; Int_t ip = 0;
98 AliTRDseedV1 *tracklet = 0x0;
99 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
100 if(!(tracklet = fkTrack->GetTracklet(il))) continue;
101 if(!tracklet->IsOK()) continue;
102 tracklet->Fit(kTRUE);
103
104 x = tracklet->GetX0();
105 y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x);
106 z = tracklet->GetZfit(0);
107 p.SetXYZ(x,y,z);
108 fArray->AddPoint(ip++, &p);
109 }
110 fTree->Fill();
111
112/* if(fDebugLevel>=1){
113 Float_t yt = fRim.GetYat(x[il]);
114 (*fDebugStream) << "TrkltResiduals"
115 << "layer=" << il
116 << "x=" <<x[il]
117 << "y=" <<y[il]
118 << "yt=" <<yt
119 << "dydx=" << dydx[il]
120 << "dy=" << dy
121 << "\n";
122 }*/
123 return 0x0;
124}
125
126
127
128//________________________________________________________
129Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint * const p, AliTrackPointArray *parray, int nmax) {
130
131 // Is the point p identical with one of the points on the list parray?
132 // This is a fix for aliroot 4-16-Rev-01 (and before) writing some
133 // spurious unitialized points.
134
135 for (int i=0; i<parray->GetNPoints() && i<nmax; i++) {
136 AliTrackPoint pa;
137 parray->GetPoint(pa,i);
138 //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY());
139 if (p->GetResidual(pa,0)<1e-8) return kTRUE;
140 //printf("different\n");
141 }
142 return kFALSE;
143}