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()
51 AliTRDalignmentTask::AliTRDalignmentTask(char* name)
52 :AliTRDrecoTask(name, "TRD alignment")
57 DefineOutput(2, TTree::Class());
60 //________________________________________________________
61 AliTRDalignmentTask::~AliTRDalignmentTask()
63 if (fArray) delete fArray;
67 //________________________________________________________
68 void AliTRDalignmentTask::UserCreateOutputObjects()
72 if(!HasFunctorList()) InitFunctorList();
73 OpenFile(2, "RECREATE");
75 fTree = new TTree("spTree", "Tree with track space point arrays");
76 fTree->Branch("SP","AliTrackPointArray", &fArray);
80 //________________________________________________________
81 void AliTRDalignmentTask::UserExec(Option_t *opt)
83 // Documentation to come
85 AliTRDrecoTask::UserExec(opt);
90 //________________________________________________________
91 TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track)
93 // Documentation to come
95 if(track) fkTrack = track;
97 AliWarning("No Track defined.");
101 if (fArray) delete fArray;
102 fArray = new AliTrackPointArray(fkTrack->GetNumberOfTracklets());
104 // Filling the track points array
106 AliTrackPoint p; Int_t ip = 0;
107 AliTRDseedV1 *tracklet = 0x0;
108 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
109 if(!(tracklet = fkTrack->GetTracklet(il))) continue;
110 if(!tracklet->IsOK()) continue;
111 tracklet->Fit(kTRUE);
113 x = tracklet->GetX0();
114 y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x);
115 z = tracklet->GetZfit(0);
117 fArray->AddPoint(ip++, &p);
121 /* if(fDebugLevel>=1){
122 Float_t yt = fRim.GetYat(x[il]);
123 (*fDebugStream) << "TrkltResiduals"
128 << "dydx=" << dydx[il]
137 //________________________________________________________
138 Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint * const p, AliTrackPointArray *parray, int nmax) {
140 // Is the point p identical with one of the points on the list parray?
141 // This is a fix for aliroot 4-16-Rev-01 (and before) writing some
142 // spurious unitialized points.
144 for (int i=0; i<parray->GetNPoints() && i<nmax; i++) {
146 parray->GetPoint(pa,i);
147 //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY());
148 if (p->GetResidual(pa,0)<1e-8) return kTRUE;
149 //printf("different\n");