1 /// \file AliTPCCompareTracks.C
5 #include "AliComplexCluster.h"
6 //#include "AliTPCclusterM.h"
8 #include "AliTPCclusterMI.h"
11 Int_t AliTPCCompareTracks(Int_t eventn, Bool_t all = kFALSE) {
12 cerr<<"Comparing tracks...\n";
14 TFile *file=TFile::Open("galice.root");
15 if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
17 TFile *ftracks=TFile::Open("AliTPCtracks.root","update");
18 if (!ftracks->IsOpen()){cerr<<"Can't open AliTPCtracks.root !\n"; return 3;}
20 AliTPCParam *param=(AliTPCParam *)file->Get("75x40_100x60_150x60");
21 if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
23 TFile *fout=TFile::Open("AliTPCTracksDif.root","new");
24 if (!fout->IsOpen()) fout=TFile::Open("AliTPCClustersDif.root","recreate");
26 //connect exact clusters
28 AliTPCClustersArray *ce=new AliTPCClustersArray;
30 ce->SetClusterType("AliComplexCluster");
32 sprintf(cname,"TreeCExact_%d",eventn);
33 ce->ConnectTree(cname);
35 //connect reconstructed tracks
37 sprintf(cname,"Seeds");
38 TTree * treetracks = (TTree*)ftracks->Get(cname);
39 TBranch * branchtracks = treetracks->GetBranch("seeds");
41 //load seeds to the memory
42 Int_t trackmap[500000][4]; // map of tracks corresponding to given track number
43 memset(trackmap,0,sizeof(Int_t)*4*500000);
44 Int_t ntracks = treetracks->GetEntries();
45 TObjArray * trackarr= new TObjArray(ntracks);
46 Int_t nproces = TMath::Min(ntracks,4000);
48 // for (Int_t itrack =0; itrack<ntracks; itrack++){
49 for (Int_t itrack =0; itrack<nproces; itrack++){
50 AliTPCseed * seed = new AliTPCseed;
52 seed->fPoints = new TClonesArray("AliTPCTrackPoint",200);
53 branchtracks->SetAddress(&seed);
54 branchtracks->GetEntry(itrack);
56 //if (seed->fRemoval>0 && (itrack%4) ) continue;
57 trackarr->AddLast(seed);
59 //crete array with exact position information
60 seed->fEPoints = new TClonesArray("AliTPCTrackPointRef",1);
61 seed->fEPoints->ExpandCreateFast(200);
63 Int_t label = TMath::Abs(seed->GetLabel());
69 if ( trackmap[label][i]==0)
72 if(i<4) trackmap[label][i]=itrack;
76 //add information about exact positions
77 Int_t nrows=Int_t(ce->GetTree()->GetEntries());
79 for (Int_t n=0; n<nrows; n++) {
80 AliSegmentID *se=ce->LoadEntry(n);
82 param->AdjustSectorRow(se->GetID(),sec,row);
84 AliTPCClustersRow* clrowe = ce->GetRow(sec,row);
86 Int_t ncl=clrowe->GetArray()->GetEntriesFast();
87 const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
90 npads = param->GetNPadsLow(row);
91 sign = (sec < kNIS/2) ? 1 : -1;
93 npads = param->GetNPadsUp(row);
94 sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
98 if (sec>=param->GetNInnerSector()) trrow += param->GetNRowLow();
101 AliComplexCluster *cl=(AliComplexCluster*)(clrowe->GetArray()->At(ncl));
102 Double_t x=param->GetPadRowRadii(sec,row);
104 y = ( y + 0.5 - 0.5*npads) *param->GetPadPitchWidth(sec);
105 Double_t z=cl->fX*param->GetZWidth();
106 z = sign*(param->GetZLength() - z);
108 param->AdjustCosSin(sec,cs,sn);
109 for (Int_t i=0;i<3;i++){
110 if (cl->fTracks[0]<500000) if (trackmap[cl->fTracks[0]][i]) {
111 AliTPCseed * seed = (AliTPCseed*)trackarr->At(trackmap[cl->fTracks[0]][i]);
112 TClonesArray * clarr = seed->fPoints;
114 //printf("Seed %d without info",trackmap[cl->fTracks[0]][i]);
117 AliTPCTrackPoint * trcluster = (AliTPCTrackPoint*)(seed->fPoints->At(trrow));
118 AliTPCTrackPointRef * ecluster = (AliTPCTrackPointRef*)(seed->fEPoints->At(trrow));
120 ecluster->GetCPoint() = trcluster->GetCPoint();
121 ecluster->GetTPoint() = trcluster->GetTPoint();
123 AliTPCExactPoint & epoint = ecluster->GetExactPoint();
127 trcluster->fAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
128 trcluster->fAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
129 trcluster->fEAmp = cl->fQ;
130 trcluster->fEPrim = cl->fMax;
134 epoint.fEAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
135 epoint.fEAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
136 epoint.fEAmp = cl->fQ;
137 epoint.fEPrim = cl->fMax;
141 // cr->ClearRow(sec,row);
142 ce->ClearRow(sec,row);
145 // make new tree - with tracks - exact position
147 TTree * treenew = new TTree("Seedref","Seedref");
148 AliTPCseed * ioseed = (AliTPCseed*)trackarr->At(0);
149 TBranch * br = treenew->Branch("seeds","AliTPCseed",&ioseed,32000,99);
151 for (Int_t itrack =0; itrack<ntracks; itrack++){
152 ioseed = (AliTPCseed*) trackarr->At(itrack);
153 br->SetAddress(&ioseed);
162 // carray->GetTree()->Write();