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 #include "TTreeStream.h"
21 #include "AliTrackPointArray.h"
24 #include "AliTRDgeometry.h"
25 #include "AliTRDcluster.h"
26 #include "AliTRDseedV1.h"
27 #include "AliTRDtrackV1.h"
29 #include "AliTRDalignmentTask.h"
31 ClassImp(AliTRDalignmentTask)
33 //________________________________________________________
34 AliTRDalignmentTask::AliTRDalignmentTask()
35 :AliTRDrecoTask("Alignment", "TRD alignment")
40 DefineOutput(1, TTree::Class());
44 //________________________________________________________
45 AliTRDalignmentTask::~AliTRDalignmentTask()
47 if (fArray) delete fArray;
51 //________________________________________________________
52 void AliTRDalignmentTask::CreateOutputObjects()
55 OpenFile(1, "RECREATE");
57 fTree = new TTree("spTree", "Tree with track space point arrays");
58 fTree->Branch("SP","AliTrackPointArray", &fArray);
62 //________________________________________________________
63 void AliTRDalignmentTask::Exec(Option_t *opt)
65 AliTRDrecoTask::Exec(opt);
70 //________________________________________________________
71 TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track)
73 if(track) fTrack = track;
75 AliWarning("No Track defined.");
79 if (fArray) delete fArray;
80 fArray = new AliTrackPointArray(fTrack->GetNumberOfTracklets());
82 // Filling the track points array
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;
91 x = tracklet->GetX0();
92 y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x);
93 z = tracklet->GetZfit(0);
95 fArray->AddPoint(ip++, &p);
99 /* if(fDebugLevel>=1){
100 Float_t yt = fRim.GetYat(x[il]);
101 (*fDebugStream) << "TrkltResiduals"
106 << "dydx=" << dydx[il]
114 //________________________________________________________
115 void AliTRDalignmentTask::Terminate(Option_t *)
122 if(HasPostProcess()) PostProcess();
126 //________________________________________________________
127 TObjArray* AliTRDalignmentTask::Histos()
130 /* if(fContainer) return fContainer;
132 fContainer = new TObjArray(3);
136 if(!(h = (TH1D*)gROOT->FindObject("cuttra"))){
137 h = new TH1D("cuttra","cuttra",20,0.5,20.5);
140 if(!(h = (TH1D*)gROOT->FindObject("cutpoi"))){
141 h = new TH1D("cutpoi","cutpoi",20,0.5,20.5);
144 if(!(h = (TH2D*)gROOT->FindObject("modpop"))){
145 h = new TH2D("modpop","modpop",90,-0.5,89.5,30,-0.5,29.5);
146 h->SetXTitle("module nr");
147 h->SetYTitle("layer nr");
152 //________________________________________________________
153 Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint *p, AliTrackPointArray *parray, int nmax) {
155 // Is the point p identical with one of the points on the list parray?
156 // This is a fix for aliroot 4-16-Rev-01 (and before) writing some
157 // spurious unitialized points.
159 for (int i=0; i<parray->GetNPoints() && i<nmax; i++) {
161 parray->GetPoint(pa,i);
162 //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY());
163 if (p->GetResidual(pa,0)<1e-8) return kTRUE;
164 //printf("different\n");