3 #include "AliComplexCluster.h"
4 //#include "AliTPCclusterM.h"
5 #include "AliTPCclusterMI.h"
9 Int_t AliTPCCompareTracks(Int_t eventn, Bool_t all = kFALSE) {
10 cerr<<"Comparing tracks...\n";
12 TFile *file=TFile::Open("galice.root");
13 if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
15 TFile *ftracks=TFile::Open("AliTPCtracks.root","update");
16 if (!ftracks->IsOpen()){cerr<<"Can't open AliTPCtracks.root !\n"; return 3;}
18 AliTPCParam *param=(AliTPCParam *)file->Get("75x40_100x60_150x60");
19 if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
21 TFile *fout=TFile::Open("AliTPCTracksDif.root","new");
22 if (!fout->IsOpen()) fout=TFile::Open("AliTPCClustersDif.root","recreate");
24 //connect exact clusters
26 AliTPCClustersArray *ce=new AliTPCClustersArray;
28 ce->SetClusterType("AliComplexCluster");
30 sprintf(cname,"TreeCExact_%d",eventn);
31 ce->ConnectTree(cname);
33 //connect reconstructed tracks
35 sprintf(cname,"Seeds");
36 TTree * treetracks = (TTree*)ftracks->Get(cname);
37 TBranch * branchtracks = treetracks->GetBranch("seeds");
39 //load seeds to the memory
40 Int_t trackmap[500000][4]; // map of tracks corresponding to given track number
41 memset(trackmap,0,sizeof(Int_t)*4*500000);
42 Int_t ntracks = treetracks->GetEntries();
43 TObjArray * trackarr= new TObjArray(ntracks);
44 Int_t nproces = TMath::Min(ntracks,4000);
46 // for (Int_t itrack =0; itrack<ntracks; itrack++){
47 for (Int_t itrack =0; itrack<nproces; itrack++){
48 AliTPCseed * seed = new AliTPCseed;
50 seed->fPoints = new TClonesArray("AliTPCTrackPoint",200);
51 branchtracks->SetAddress(&seed);
52 branchtracks->GetEntry(itrack);
54 //if (seed->fRemoval>0 && (itrack%4) ) continue;
55 trackarr->AddLast(seed);
57 //crete array with exact position information
58 seed->fEPoints = new TClonesArray("AliTPCTrackPointRef",1);
59 seed->fEPoints->ExpandCreateFast(200);
61 Int_t label = TMath::Abs(seed->GetLabel());
67 if ( trackmap[label][i]==0)
70 if(i<4) trackmap[label][i]=itrack;
74 //add information about exact positions
75 Int_t nrows=Int_t(ce->GetTree()->GetEntries());
77 for (Int_t n=0; n<nrows; n++) {
78 AliSegmentID *se=ce->LoadEntry(n);
80 param->AdjustSectorRow(se->GetID(),sec,row);
82 AliTPCClustersRow* clrowe = ce->GetRow(sec,row);
84 Int_t ncl=clrowe->GetArray()->GetEntriesFast();
85 const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
88 npads = param->GetNPadsLow(row);
89 sign = (sec < kNIS/2) ? 1 : -1;
91 npads = param->GetNPadsUp(row);
92 sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
96 if (sec>=param->GetNInnerSector()) trrow += param->GetNRowLow();
99 AliComplexCluster *cl=(AliComplexCluster*)(clrowe->GetArray()->At(ncl));
100 Double_t x=param->GetPadRowRadii(sec,row);
102 y = ( y + 0.5 - 0.5*npads) *param->GetPadPitchWidth(sec);
103 Double_t z=cl->fX*param->GetZWidth();
104 z = sign*(param->GetZLength() - z);
106 param->AdjustCosSin(sec,cs,sn);
107 for (Int_t i=0;i<3;i++){
108 if (cl->fTracks[0]<500000) if (trackmap[cl->fTracks[0]][i]) {
109 AliTPCseed * seed = (AliTPCseed*)trackarr->At(trackmap[cl->fTracks[0]][i]);
110 TClonesArray * clarr = seed->fPoints;
112 //printf("Seed %d without info",trackmap[cl->fTracks[0]][i]);
115 AliTPCTrackPoint * trcluster = (AliTPCTrackPoint*)(seed->fPoints->At(trrow));
116 AliTPCTrackPointRef * ecluster = (AliTPCTrackPointRef*)(seed->fEPoints->At(trrow));
118 ecluster->GetCPoint() = trcluster->GetCPoint();
119 ecluster->GetTPoint() = trcluster->GetTPoint();
121 AliTPCExactPoint & epoint = ecluster->GetExactPoint();
125 trcluster->fAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
126 trcluster->fAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
127 trcluster->fEAmp = cl->fQ;
128 trcluster->fEPrim = cl->fMax;
132 epoint.fEAngleY = cl->fSigmaY2*param->GetPadPitchLength(sec);
133 epoint.fEAngleZ = cl->fSigmaX2*param->GetPadPitchLength(sec);
134 epoint.fEAmp = cl->fQ;
135 epoint.fEPrim = cl->fMax;
139 // cr->ClearRow(sec,row);
140 ce->ClearRow(sec,row);
143 // make new tree - with tracks - exact position
145 TTree * treenew = new TTree("Seedref","Seedref");
146 AliTPCseed * ioseed = (AliTPCseed*)trackarr->At(0);
147 TBranch * br = treenew->Branch("seeds","AliTPCseed",&ioseed,32000,99);
149 for (Int_t itrack =0; itrack<ntracks; itrack++){
150 ioseed = (AliTPCseed*) trackarr->At(itrack);
151 br->SetAddress(&ioseed);
160 // carray->GetTree()->Write();