1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////
23 ////////////////////////////////////////////////
25 #include "TTreeStream.h"
30 #include "AliTrackPointArray.h"
33 #include "AliTRDgeometry.h"
34 #include "AliTRDcluster.h"
35 #include "AliTRDseedV1.h"
36 #include "AliTRDtrackV1.h"
38 #include "AliTRDalignmentTask.h"
40 ClassImp(AliTRDalignmentTask)
42 //________________________________________________________
43 AliTRDalignmentTask::AliTRDalignmentTask()
44 :AliTRDrecoTask("Alignment", "TRD alignment")
49 DefineOutput(1, TTree::Class());
53 //________________________________________________________
54 AliTRDalignmentTask::~AliTRDalignmentTask()
56 if (fArray) delete fArray;
60 //________________________________________________________
61 void AliTRDalignmentTask::CreateOutputObjects()
64 OpenFile(1, "RECREATE");
66 fTree = new TTree("spTree", "Tree with track space point arrays");
67 fTree->Branch("SP","AliTrackPointArray", &fArray);
71 //________________________________________________________
72 void AliTRDalignmentTask::Exec(Option_t *opt)
74 // Documentation to come
76 AliTRDrecoTask::Exec(opt);
81 //________________________________________________________
82 TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track)
84 // Documentation to come
86 if(track) fkTrack = track;
88 AliWarning("No Track defined.");
92 if (fArray) delete fArray;
93 fArray = new AliTrackPointArray(fkTrack->GetNumberOfTracklets());
95 // Filling the track points array
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);
104 x = tracklet->GetX0();
105 y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x);
106 z = tracklet->GetZfit(0);
108 fArray->AddPoint(ip++, &p);
112 /* if(fDebugLevel>=1){
113 Float_t yt = fRim.GetYat(x[il]);
114 (*fDebugStream) << "TrkltResiduals"
119 << "dydx=" << dydx[il]
128 //________________________________________________________
129 Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint * const p, AliTrackPointArray *parray, int nmax) {
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.
135 for (int i=0; i<parray->GetNPoints() && i<nmax; i++) {
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");