3 #include "AliComplexCluster.h"
4 //#include "AliTPCclusterM.h"
5 #include "AliTPCtrackerMI.h"
6 #include "AliTPCclusterMI.h"
10 Int_t AliTPCCompareTracks(Int_t eventn, Bool_t all = kFALSE) {
11 cerr<<"Comparing tracks...\n";
13 TFile *file=TFile::Open("galice.root");
14 if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
16 TFile *ftracks=TFile::Open("AliTPCtracks.root","update");
17 if (!ftracks->IsOpen()){cerr<<"Can't open AliTPCtracks.root !\n"; return 3;}
19 AliTPCParam *param=(AliTPCParam *)file->Get("75x40_100x60_150x60");
20 if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
22 TFile *fout=TFile::Open("AliTPCTracksDif.root","new");
23 if (!fout->IsOpen()) fout=TFile::Open("AliTPCClustersDif.root","recreate");
25 //connect exact clusters
27 AliTPCClustersArray *ce=new AliTPCClustersArray;
29 ce->SetClusterType("AliComplexCluster");
31 sprintf(cname,"TreeCExact_%d",eventn);
32 ce->ConnectTree(cname);
34 //connect reconstructed tracks
36 sprintf(cname,"Seeds");
37 TTree * treetracks = (TTree*)ftracks->Get(cname);
38 TBranch * branchtracks = treetracks->GetBranch("seeds");
40 //load seeds to the memory
41 Int_t trackmap[500000][4]; // map of tracks corresponding to given track number
42 memset(trackmap,0,sizeof(Int_t)*4*500000);
43 Int_t ntracks = treetracks->GetEntries();
44 TObjArray * trackarr= new TObjArray(ntracks);
45 Int_t nproces = TMath::Min(ntracks,4000);
47 // for (Int_t itrack =0; itrack<ntracks; itrack++){
48 for (Int_t itrack =0; itrack<nproces; itrack++){
49 AliTPCseed * seed = new AliTPCseed;
51 seed->fPoints = new TClonesArray("AliTPCTrackPoint",200);
52 branchtracks->SetAddress(&seed);
53 branchtracks->GetEntry(itrack);
55 //if (seed->fRemoval>0 && (itrack%4) ) continue;
56 trackarr->AddLast(seed);
58 //crete array with exact position information
59 seed->fEPoints = new TClonesArray("AliTPCTrackPointRef",1);
60 seed->fEPoints->ExpandCreateFast(200);
62 Int_t label = TMath::Abs(seed->GetLabel());
68 if ( trackmap[label][i]==0)
71 if(i<4) trackmap[label][i]=itrack;
75 //add information about exact positions
76 Int_t nrows=Int_t(ce->GetTree()->GetEntries());
78 for (Int_t n=0; n<nrows; n++) {
79 AliSegmentID *se=ce->LoadEntry(n);
81 param->AdjustSectorRow(se->GetID(),sec,row);
83 AliTPCClustersRow* clrowe = ce->GetRow(sec,row);
85 Int_t ncl=clrowe->GetArray()->GetEntriesFast();
86 const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
89 npads = param->GetNPadsLow(row);
90 sign = (sec < kNIS/2) ? 1 : -1;
92 npads = param->GetNPadsUp(row);
93 sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
97 if (sec>=param->GetNInnerSector()) trrow += param->GetNRowLow();
100 AliComplexCluster *cl=(AliComplexCluster*)(clrowe->GetArray()->At(ncl));
101 Double_t x=param->GetPadRowRadii(sec,row);
103 y = ( y + 0.5 - 0.5*npads) *param->GetPadPitchWidth(sec);
104 Double_t z=cl->fX*param->GetZWidth();
105 z = sign*(param->GetZLength() - z);
107 param->AdjustCosSin(sec,cs,sn);
108 for (Int_t i=0;i<3;i++){
109 if (cl->fTracks[0]<500000) if (trackmap[cl->fTracks[0]][i]) {
110 AliTPCseed * seed = (AliTPCseed*)trackarr->At(trackmap[cl->fTracks[0]][i]);
111 TClonesArray * clarr = seed->fPoints;
113 //printf("Seed %d without info",trackmap[cl->fTracks[0]][i]);
116 AliTPCTrackPoint * trcluster = (AliTPCTrackPoint*)(seed->fPoints->At(trrow));
117 AliTPCTrackPointRef * ecluster = (AliTPCTrackPointRef*)(seed->fEPoints->At(trrow));
119 ecluster->GetCPoint() = trcluster->GetCPoint();
120 ecluster->GetTPoint() = trcluster->GetTPoint();
122 AliTPCExactPoint & epoint = ecluster->GetExactPoint();
126 trcluster->fAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
127 trcluster->fAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
128 trcluster->fEAmp = cl->fQ;
129 trcluster->fEPrim = cl->fMax;
133 epoint.fEAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
134 epoint.fEAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
135 epoint.fEAmp = cl->fQ;
136 epoint.fEPrim = cl->fMax;
140 // cr->ClearRow(sec,row);
141 ce->ClearRow(sec,row);
144 // make new tree - with tracks - exact position
146 TTree * treenew = new TTree("Seedref","Seedref");
147 AliTPCseed * ioseed = (AliTPCseed*)trackarr->At(0);
148 TBranch * br = treenew->Branch("seeds","AliTPCseed",&ioseed,32000,99);
150 for (Int_t itrack =0; itrack<ntracks; itrack++){
151 ioseed = (AliTPCseed*) trackarr->At(itrack);
152 br->SetAddress(&ioseed);
161 // carray->GetTree()->Write();