]>
Commit | Line | Data |
---|---|---|
1c53abe2 | 1 | #ifndef __CINT__ |
2 | #include "alles.h" | |
3 | #include "AliComplexCluster.h" | |
4 | //#include "AliTPCclusterM.h" | |
1c53abe2 | 5 | #include "AliTPCclusterMI.h" |
6 | #endif | |
7 | ||
8 | ||
9 | Int_t AliTPCCompareTracks(Int_t eventn, Bool_t all = kFALSE) { | |
10 | cerr<<"Comparing tracks...\n"; | |
11 | //CONNECT FILES | |
12 | TFile *file=TFile::Open("galice.root"); | |
13 | if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} | |
14 | // | |
15 | TFile *ftracks=TFile::Open("AliTPCtracks.root","update"); | |
16 | if (!ftracks->IsOpen()){cerr<<"Can't open AliTPCtracks.root !\n"; return 3;} | |
17 | // | |
18 | AliTPCParam *param=(AliTPCParam *)file->Get("75x40_100x60_150x60"); | |
19 | if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;} | |
20 | // | |
21 | TFile *fout=TFile::Open("AliTPCTracksDif.root","new"); | |
22 | if (!fout->IsOpen()) fout=TFile::Open("AliTPCClustersDif.root","recreate"); | |
23 | // | |
24 | //connect exact clusters | |
25 | file->cd(); | |
26 | AliTPCClustersArray *ce=new AliTPCClustersArray; | |
27 | ce->Setup(param); | |
28 | ce->SetClusterType("AliComplexCluster"); | |
29 | char cname[100]; | |
30 | sprintf(cname,"TreeCExact_%d",eventn); | |
31 | ce->ConnectTree(cname); | |
32 | // | |
33 | //connect reconstructed tracks | |
34 | ftracks->cd(); | |
35 | sprintf(cname,"Seeds"); | |
36 | TTree * treetracks = (TTree*)ftracks->Get(cname); | |
37 | TBranch * branchtracks = treetracks->GetBranch("seeds"); | |
38 | // | |
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); | |
45 | ||
46 | // for (Int_t itrack =0; itrack<ntracks; itrack++){ | |
47 | for (Int_t itrack =0; itrack<nproces; itrack++){ | |
48 | AliTPCseed * seed = new AliTPCseed; | |
49 | // | |
50 | seed->fPoints = new TClonesArray("AliTPCTrackPoint",200); | |
51 | branchtracks->SetAddress(&seed); | |
52 | branchtracks->GetEntry(itrack); | |
53 | ||
54 | //if (seed->fRemoval>0 && (itrack%4) ) continue; | |
55 | trackarr->AddLast(seed); | |
56 | ||
57 | //crete array with exact position information | |
58 | seed->fEPoints = new TClonesArray("AliTPCTrackPointRef",1); | |
59 | seed->fEPoints->ExpandCreateFast(200); | |
60 | ||
61 | Int_t label = TMath::Abs(seed->GetLabel()); | |
62 | Int_t i; | |
63 | if (label>500000) { | |
64 | //too big track label | |
65 | }else{ | |
66 | for (i=0;i<4;i++) { | |
67 | if ( trackmap[label][i]==0) | |
68 | break; | |
69 | } | |
70 | if(i<4) trackmap[label][i]=itrack; | |
71 | } | |
72 | } | |
73 | ||
74 | //add information about exact positions | |
75 | Int_t nrows=Int_t(ce->GetTree()->GetEntries()); | |
76 | ||
77 | for (Int_t n=0; n<nrows; n++) { | |
78 | AliSegmentID *se=ce->LoadEntry(n); | |
79 | Int_t sec,row; | |
80 | param->AdjustSectorRow(se->GetID(),sec,row); | |
81 | // | |
82 | AliTPCClustersRow* clrowe = ce->GetRow(sec,row); | |
83 | // | |
84 | Int_t ncl=clrowe->GetArray()->GetEntriesFast(); | |
85 | const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); | |
86 | Int_t npads, sign; | |
87 | if (sec < kNIS) { | |
88 | npads = param->GetNPadsLow(row); | |
89 | sign = (sec < kNIS/2) ? 1 : -1; | |
90 | } else { | |
91 | npads = param->GetNPadsUp(row); | |
92 | sign = ((sec-kNIS) < kNOS/2) ? 1 : -1; | |
93 | } | |
94 | ||
95 | Int_t trrow = row; | |
96 | if (sec>=param->GetNInnerSector()) trrow += param->GetNRowLow(); | |
97 | ||
98 | while (ncl--) { | |
99 | AliComplexCluster *cl=(AliComplexCluster*)(clrowe->GetArray()->At(ncl)); | |
100 | Double_t x=param->GetPadRowRadii(sec,row); | |
101 | Double_t y=cl->fY; | |
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); | |
105 | Float_t cs, sn, tmp; | |
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; | |
111 | if (!clarr){ | |
112 | //printf("Seed %d without info",trackmap[cl->fTracks[0]][i]); | |
113 | continue; | |
114 | } | |
115 | AliTPCTrackPoint * trcluster = (AliTPCTrackPoint*)(seed->fPoints->At(trrow)); | |
116 | AliTPCTrackPointRef * ecluster = (AliTPCTrackPointRef*)(seed->fEPoints->At(trrow)); | |
117 | // | |
118 | ecluster->GetCPoint() = trcluster->GetCPoint(); | |
119 | ecluster->GetTPoint() = trcluster->GetTPoint(); | |
120 | // | |
121 | AliTPCExactPoint & epoint = ecluster->GetExactPoint(); | |
122 | /* | |
123 | trcluster->fEZ = z; | |
124 | trcluster->fEY = y; | |
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; | |
129 | */ | |
130 | epoint.fEZ = z; | |
131 | epoint.fEY = y; | |
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; | |
136 | } | |
137 | } | |
138 | } | |
139 | // cr->ClearRow(sec,row); | |
140 | ce->ClearRow(sec,row); | |
141 | } | |
142 | ||
143 | // make new tree - with tracks - exact position | |
144 | fout->cd(); | |
145 | TTree * treenew = new TTree("Seedref","Seedref"); | |
146 | AliTPCseed * ioseed = (AliTPCseed*)trackarr->At(0); | |
147 | TBranch * br = treenew->Branch("seeds","AliTPCseed",&ioseed,32000,99); | |
148 | ||
149 | for (Int_t itrack =0; itrack<ntracks; itrack++){ | |
150 | ioseed = (AliTPCseed*) trackarr->At(itrack); | |
151 | br->SetAddress(&ioseed); | |
152 | treenew->Fill(); | |
153 | } | |
154 | ||
155 | treenew->Write(); | |
156 | printf("1\n"); | |
157 | delete ce; | |
158 | printf("2\n"); | |
159 | //delete cr; | |
160 | // carray->GetTree()->Write(); | |
161 | printf("3\n"); | |
162 | // delete carray; | |
163 | printf("4\n"); | |
164 | // cf->Close(); | |
165 | printf("5\n"); | |
166 | fout->Close(); | |
167 | printf("6\n"); | |
168 | ftracks->Close(); | |
169 | printf("7\n"); | |
170 | return 0; | |
171 | } |