]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial 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 | **************************************************************************/ | |
15 | ||
16 | /* | |
2e5f0f7b | 17 | $Log$ |
4c039060 | 18 | */ |
19 | ||
2e5f0f7b | 20 | |
ddae0931 | 21 | //////////////////////////////////////////////// |
22 | // Manager and hits classes for set:RICH // | |
23 | //////////////////////////////////////////////// | |
fe4da5cc | 24 | |
ddae0931 | 25 | #include <TBRIK.h> |
26 | #include <TTUBE.h> | |
fe4da5cc | 27 | #include <TNode.h> |
28 | #include <TRandom.h> | |
ddae0931 | 29 | #include <TObject.h> |
30 | #include <TVector.h> | |
31 | #include <TObjArray.h> | |
2e5f0f7b | 32 | #include <TArrayF.h> |
fe4da5cc | 33 | |
fe4da5cc | 34 | #include "AliRICH.h" |
ddae0931 | 35 | #include "AliRICHHitMap.h" |
2e5f0f7b | 36 | #include "AliRICHClusterFinder.h" |
fe4da5cc | 37 | #include "AliRun.h" |
ddae0931 | 38 | #include "AliMC.h" |
2e5f0f7b | 39 | #include "AliPoints.h" |
ddae0931 | 40 | #include "iostream.h" |
41 | #include "AliCallf77.h" | |
2e5f0f7b | 42 | #include "TParticle.h" |
ddae0931 | 43 | |
44 | // Static variables for the pad-hit iterator routines | |
45 | static Int_t sMaxIterPad=0; | |
46 | static Int_t sCurIterPad=0; | |
47 | static TClonesArray *fClusters2; | |
48 | static TClonesArray *fHits2; | |
2e5f0f7b | 49 | static TTree *TrH1; |
ddae0931 | 50 | |
fe4da5cc | 51 | ClassImp(AliRICH) |
ddae0931 | 52 | |
53 | //___________________________________________ | |
fe4da5cc | 54 | AliRICH::AliRICH() |
55 | { | |
ddae0931 | 56 | fIshunt = 0; |
57 | fHits = 0; | |
2e5f0f7b | 58 | fPadHits = 0; |
59 | fNPadHits = 0; | |
60 | fNcerenkovs = 0; | |
ddae0931 | 61 | fDchambers = 0; |
ddae0931 | 62 | fCerenkovs = 0; |
63 | fNdch = 0; | |
fe4da5cc | 64 | } |
ddae0931 | 65 | |
66 | //___________________________________________ | |
fe4da5cc | 67 | AliRICH::AliRICH(const char *name, const char *title) |
ddae0931 | 68 | : AliDetector(name,title) |
fe4da5cc | 69 | { |
ddae0931 | 70 | //Begin_Html |
71 | /* | |
72 | <img src="gif/alirich.gif"> | |
73 | */ | |
74 | //End_Html | |
75 | ||
2e5f0f7b | 76 | fHits = new TClonesArray("AliRICHHit",1000 ); |
1cedd08a | 77 | gAlice->AddHitList(fHits); |
2e5f0f7b | 78 | fPadHits = new TClonesArray("AliRICHPadHit",100000); |
79 | fCerenkovs = new TClonesArray("AliRICHCerenkov",1000); | |
80 | gAlice->AddHitList(fCerenkovs); | |
81 | //gAlice->AddHitList(fHits); | |
82 | fNPadHits = 0; | |
83 | fNcerenkovs = 0; | |
84 | fIshunt = 0; | |
ddae0931 | 85 | |
86 | fNdch = new Int_t[7]; | |
87 | ||
88 | fDchambers = new TObjArray(7); | |
2e5f0f7b | 89 | |
90 | fRecHits = new TObjArray(7); | |
ddae0931 | 91 | |
92 | Int_t i; | |
93 | ||
94 | for (i=0; i<7 ;i++) { | |
2e5f0f7b | 95 | (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000); |
ddae0931 | 96 | fNdch[i]=0; |
97 | } | |
2e5f0f7b | 98 | |
99 | fNrawch = new Int_t[7]; | |
ddae0931 | 100 | |
2e5f0f7b | 101 | fRawClusters = new TObjArray(7); |
102 | printf("Created fRwClusters with adress:%p",fRawClusters); | |
103 | ||
104 | for (i=0; i<7 ;i++) { | |
105 | (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000); | |
106 | fNrawch[i]=0; | |
107 | } | |
108 | ||
109 | fNrechits = new Int_t[7]; | |
ddae0931 | 110 | |
2e5f0f7b | 111 | for (i=0; i<7 ;i++) { |
112 | (*fRecHits)[i] = new TClonesArray("AliRICHRecHit",1000); | |
113 | } | |
114 | printf("Created fRecHits with adress:%p",fRecHits); | |
115 | ||
116 | ||
ddae0931 | 117 | SetMarkerColor(kRed); |
fe4da5cc | 118 | } |
119 | ||
ddae0931 | 120 | //___________________________________________ |
fe4da5cc | 121 | AliRICH::~AliRICH() |
122 | { | |
ddae0931 | 123 | fIshunt = 0; |
124 | delete fHits; | |
2e5f0f7b | 125 | delete fPadHits; |
ddae0931 | 126 | delete fCerenkovs; |
fe4da5cc | 127 | } |
128 | ||
ddae0931 | 129 | //___________________________________________ |
fe4da5cc | 130 | void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
131 | { | |
ddae0931 | 132 | TClonesArray &lhits = *fHits; |
2e5f0f7b | 133 | new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits); |
fe4da5cc | 134 | } |
fe4da5cc | 135 | //_____________________________________________________________________________ |
ddae0931 | 136 | void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs) |
137 | { | |
138 | TClonesArray &lcerenkovs = *fCerenkovs; | |
139 | new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs); | |
2e5f0f7b | 140 | //printf ("Done for Cerenkov %d\n\n\n\n",fNcerenkovs); |
fe4da5cc | 141 | } |
ddae0931 | 142 | //___________________________________________ |
2e5f0f7b | 143 | void AliRICH::AddPadHit(Int_t *clhits) |
ddae0931 | 144 | { |
2e5f0f7b | 145 | TClonesArray &lPadHits = *fPadHits; |
146 | new(lPadHits[fNPadHits++]) AliRICHPadHit(clhits); | |
fe4da5cc | 147 | } |
fe4da5cc | 148 | //_____________________________________________________________________________ |
ddae0931 | 149 | void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) |
150 | { | |
151 | // | |
152 | // Add a RICH digit to the list | |
153 | // | |
154 | ||
155 | TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]); | |
2e5f0f7b | 156 | new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits); |
fe4da5cc | 157 | } |
158 | ||
159 | //_____________________________________________________________________________ | |
2e5f0f7b | 160 | void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c) |
fe4da5cc | 161 | { |
ddae0931 | 162 | // |
2e5f0f7b | 163 | // Add a RICH digit to the list |
ddae0931 | 164 | // |
2e5f0f7b | 165 | |
166 | TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]); | |
167 | new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c); | |
fe4da5cc | 168 | } |
169 | ||
2e5f0f7b | 170 | //_____________________________________________________________________________ |
171 | void AliRICH::AddRecHit(Int_t id, Float_t *rechit) | |
172 | { | |
173 | // | |
174 | // Add a RICH reconstructed hit to the list | |
175 | // | |
fe4da5cc | 176 | |
2e5f0f7b | 177 | TClonesArray &lrec = *((TClonesArray*)(*fRecHits)[id]); |
178 | new(lrec[fNrechits[id]++]) AliRICHRecHit(id,rechit); | |
179 | } | |
fe4da5cc | 180 | |
ddae0931 | 181 | //___________________________________________ |
182 | void AliRICH::BuildGeometry() | |
183 | ||
fe4da5cc | 184 | { |
ddae0931 | 185 | // |
186 | // Builds a TNode geometry for event display | |
187 | // | |
188 | TNode *Node, *Top; | |
189 | ||
190 | const int kColorRICH = kGreen; | |
191 | // | |
192 | Top=gAlice->GetGeometry()->GetNode("alice"); | |
193 | ||
194 | ||
195 | new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15); | |
196 | ||
197 | Top->cd(); | |
198 | Float_t pos1[3]={0,471.8999,165.2599}; | |
2e5f0f7b | 199 | //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2], |
200 | new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90); | |
ddae0931 | 201 | Node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993"); |
202 | ||
203 | ||
204 | Node->SetLineColor(kColorRICH); | |
205 | fNodes->Add(Node); | |
206 | Top->cd(); | |
207 | ||
208 | Float_t pos2[3]={171,470,0}; | |
2e5f0f7b | 209 | //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2], |
210 | new TRotMatrix("rot994","rot994",90,-20,90,70,0,0); | |
ddae0931 | 211 | Node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994"); |
212 | ||
213 | ||
214 | Node->SetLineColor(kColorRICH); | |
215 | fNodes->Add(Node); | |
216 | Top->cd(); | |
217 | Float_t pos3[3]={0,500,0}; | |
2e5f0f7b | 218 | //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2], |
219 | new TRotMatrix("rot995","rot995",90,0,90,90,0,0); | |
ddae0931 | 220 | Node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995"); |
221 | ||
222 | ||
223 | Node->SetLineColor(kColorRICH); | |
224 | fNodes->Add(Node); | |
225 | Top->cd(); | |
226 | Float_t pos4[3]={-171,470,0}; | |
2e5f0f7b | 227 | //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2], |
228 | new TRotMatrix("rot996","rot996",90,20,90,110,0,0); | |
ddae0931 | 229 | Node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996"); |
230 | ||
231 | ||
232 | Node->SetLineColor(kColorRICH); | |
233 | fNodes->Add(Node); | |
234 | Top->cd(); | |
235 | Float_t pos5[3]={161.3999,443.3999,-165.3}; | |
2e5f0f7b | 236 | //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2], |
237 | new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70); | |
ddae0931 | 238 | Node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997"); |
239 | ||
240 | Node->SetLineColor(kColorRICH); | |
241 | fNodes->Add(Node); | |
242 | Top->cd(); | |
243 | Float_t pos6[3]={0., 471.9, -165.3,}; | |
2e5f0f7b | 244 | //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2], |
245 | new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90); | |
ddae0931 | 246 | Node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998"); |
247 | ||
248 | ||
249 | Node->SetLineColor(kColorRICH); | |
250 | fNodes->Add(Node); | |
251 | Top->cd(); | |
252 | Float_t pos7[3]={-161.399,443.3999,-165.3}; | |
2e5f0f7b | 253 | //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2], |
254 | new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110); | |
ddae0931 | 255 | Node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999"); |
256 | Node->SetLineColor(kColorRICH); | |
257 | fNodes->Add(Node); | |
258 | ||
fe4da5cc | 259 | } |
260 | ||
ddae0931 | 261 | //___________________________________________ |
262 | Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t ) | |
263 | { | |
264 | return 9999; | |
265 | } | |
fe4da5cc | 266 | |
ddae0931 | 267 | //___________________________________________ |
268 | void AliRICH::MakeBranch(Option_t* option) | |
fe4da5cc | 269 | { |
ddae0931 | 270 | // Create Tree branches for the RICH. |
fe4da5cc | 271 | |
ddae0931 | 272 | const Int_t buffersize = 4000; |
273 | char branchname[20]; | |
fe4da5cc | 274 | |
ddae0931 | 275 | |
276 | AliDetector::MakeBranch(option); | |
277 | sprintf(branchname,"%sCerenkov",GetName()); | |
278 | if (fCerenkovs && gAlice->TreeH()) { | |
279 | gAlice->TreeH()->Branch(branchname,&fCerenkovs, buffersize); | |
280 | printf("Making Branch %s for Cerenkov Hits\n",branchname); | |
fe4da5cc | 281 | } |
ddae0931 | 282 | |
2e5f0f7b | 283 | sprintf(branchname,"%sPadHits",GetName()); |
284 | if (fPadHits && gAlice->TreeH()) { | |
285 | gAlice->TreeH()->Branch(branchname,&fPadHits, buffersize); | |
286 | printf("Making Branch %s for PadHits\n",branchname); | |
fe4da5cc | 287 | } |
288 | ||
ddae0931 | 289 | // one branch for digits per chamber |
290 | Int_t i; | |
291 | ||
292 | for (i=0; i<7 ;i++) { | |
293 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
294 | ||
295 | if (fDchambers && gAlice->TreeD()) { | |
296 | gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), buffersize); | |
297 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); | |
298 | } | |
fe4da5cc | 299 | } |
2e5f0f7b | 300 | |
301 | // one branch for raw clusters per chamber | |
302 | for (i=0; i<7 ;i++) { | |
303 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
304 | ||
305 | if (fRawClusters && gAlice->TreeR()) { | |
306 | gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), buffersize); | |
307 | printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); | |
308 | } | |
309 | } | |
310 | ||
311 | // one branch for rec hits per chamber | |
312 | for (i=0; i<7 ;i++) { | |
313 | sprintf(branchname,"%sRecHits%d",GetName(),i+1); | |
314 | ||
315 | if (fRecHits && gAlice->TreeR()) { | |
316 | gAlice->TreeR()->Branch(branchname,&((*fRecHits)[i]), buffersize); | |
317 | printf("Making Branch %s for rec. hits in chamber %d\n",branchname,i+1); | |
318 | } | |
319 | } | |
fe4da5cc | 320 | } |
321 | ||
ddae0931 | 322 | //___________________________________________ |
323 | void AliRICH::SetTreeAddress() | |
fe4da5cc | 324 | { |
ddae0931 | 325 | // Set branch address for the Hits and Digits Tree. |
2e5f0f7b | 326 | char branchname[20]; |
327 | Int_t i; | |
328 | ||
ddae0931 | 329 | AliDetector::SetTreeAddress(); |
330 | ||
331 | TBranch *branch; | |
332 | TTree *treeH = gAlice->TreeH(); | |
333 | TTree *treeD = gAlice->TreeD(); | |
2e5f0f7b | 334 | TTree *treeR = gAlice->TreeR(); |
ddae0931 | 335 | |
336 | if (treeH) { | |
2e5f0f7b | 337 | if (fPadHits) { |
338 | branch = treeH->GetBranch("RICHPadHits"); | |
339 | if (branch) branch->SetAddress(&fPadHits); | |
fe4da5cc | 340 | } |
ddae0931 | 341 | if (fCerenkovs) { |
342 | branch = treeH->GetBranch("RICHCerenkov"); | |
343 | if (branch) branch->SetAddress(&fCerenkovs); | |
fe4da5cc | 344 | } |
ddae0931 | 345 | } |
346 | ||
347 | if (treeD) { | |
348 | for (int i=0; i<7; i++) { | |
349 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
350 | if (fDchambers) { | |
351 | branch = treeD->GetBranch(branchname); | |
352 | if (branch) branch->SetAddress(&((*fDchambers)[i])); | |
353 | } | |
fe4da5cc | 354 | } |
fe4da5cc | 355 | } |
2e5f0f7b | 356 | if (treeR) { |
357 | for (i=0; i<7; i++) { | |
358 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
359 | if (fRawClusters) { | |
360 | branch = treeR->GetBranch(branchname); | |
361 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); | |
362 | } | |
363 | } | |
364 | ||
365 | for (i=0; i<7; i++) { | |
366 | sprintf(branchname,"%sRecHits%d",GetName(),i+1); | |
367 | if (fRecHits) { | |
368 | branch = treeR->GetBranch(branchname); | |
369 | if (branch) branch->SetAddress(&((*fRecHits)[i])); | |
370 | } | |
371 | } | |
372 | ||
373 | } | |
ddae0931 | 374 | } |
375 | //___________________________________________ | |
376 | void AliRICH::ResetHits() | |
377 | { | |
378 | // Reset number of clusters and the cluster array for this detector | |
379 | AliDetector::ResetHits(); | |
2e5f0f7b | 380 | fNPadHits = 0; |
381 | fNcerenkovs = 0; | |
382 | if (fPadHits) fPadHits->Clear(); | |
ddae0931 | 383 | if (fCerenkovs) fCerenkovs->Clear(); |
fe4da5cc | 384 | } |
385 | ||
2e5f0f7b | 386 | |
ddae0931 | 387 | //____________________________________________ |
388 | void AliRICH::ResetDigits() | |
389 | { | |
390 | // | |
391 | // Reset number of digits and the digits array for this detector | |
392 | // | |
393 | for ( int i=0;i<7;i++ ) { | |
394 | if ((*fDchambers)[i]) (*fDchambers)[i]->Clear(); | |
395 | if (fNdch) fNdch[i]=0; | |
396 | } | |
397 | } | |
2e5f0f7b | 398 | |
ddae0931 | 399 | //____________________________________________ |
2e5f0f7b | 400 | void AliRICH::ResetRawClusters() |
fe4da5cc | 401 | { |
ddae0931 | 402 | // |
2e5f0f7b | 403 | // Reset number of raw clusters and the raw clust array for this detector |
ddae0931 | 404 | // |
405 | for ( int i=0;i<7;i++ ) { | |
2e5f0f7b | 406 | if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear(); |
407 | if (fNrawch) fNrawch[i]=0; | |
fe4da5cc | 408 | } |
ddae0931 | 409 | } |
fe4da5cc | 410 | |
2e5f0f7b | 411 | //____________________________________________ |
412 | void AliRICH::ResetRecHits() | |
fe4da5cc | 413 | { |
2e5f0f7b | 414 | // |
415 | // Reset number of raw clusters and the raw clust array for this detector | |
416 | // | |
417 | ||
418 | for ( int i=0;i<7;i++ ) { | |
419 | if ((*fRecHits)[i]) ((TClonesArray*)(*fRecHits)[i])->Clear(); | |
420 | if (fNrechits) fNrechits[i]=0; | |
421 | } | |
fe4da5cc | 422 | } |
423 | ||
ddae0931 | 424 | //___________________________________________ |
2e5f0f7b | 425 | void AliRICH::SetGeometryModel(Int_t id, AliRICHGeometry *geometry) |
fe4da5cc | 426 | { |
2e5f0f7b | 427 | ((AliRICHChamber*) (*fChambers)[id])->GeometryModel(geometry); |
fe4da5cc | 428 | } |
429 | ||
ddae0931 | 430 | //___________________________________________ |
2e5f0f7b | 431 | void AliRICH::SetSegmentationModel(Int_t id, AliRICHSegmentation *segmentation) |
ddae0931 | 432 | { |
2e5f0f7b | 433 | ((AliRICHChamber*) (*fChambers)[id])->SegmentationModel(segmentation); |
ddae0931 | 434 | } |
fe4da5cc | 435 | |
ddae0931 | 436 | //___________________________________________ |
2e5f0f7b | 437 | void AliRICH::SetResponseModel(Int_t id, AliRICHResponse *response) |
fe4da5cc | 438 | { |
2e5f0f7b | 439 | ((AliRICHChamber*) (*fChambers)[id])->ResponseModel(response); |
fe4da5cc | 440 | } |
441 | ||
2e5f0f7b | 442 | void AliRICH::SetReconstructionModel(Int_t id, AliRICHClusterFinder *reconst) |
ddae0931 | 443 | { |
2e5f0f7b | 444 | ((AliRICHChamber*) (*fChambers)[id])->ReconstructionModel(reconst); |
fe4da5cc | 445 | } |
446 | ||
ddae0931 | 447 | void AliRICH::SetNsec(Int_t id, Int_t nsec) |
448 | { | |
2e5f0f7b | 449 | ((AliRICHChamber*) (*fChambers)[id])->SetNsec(nsec); |
ddae0931 | 450 | } |
451 | ||
452 | ||
453 | //___________________________________________ | |
454 | ||
455 | void AliRICH::StepManager() | |
fe4da5cc | 456 | { |
ddae0931 | 457 | } |
2e5f0f7b | 458 | |
459 | void AliRICH::FindClusters(Int_t nev,Int_t last_entry) | |
ddae0931 | 460 | { |
2e5f0f7b | 461 | |
ddae0931 | 462 | // |
463 | // Loop on chambers and on cathode planes | |
464 | // | |
2e5f0f7b | 465 | for (Int_t icat=1;icat<2;icat++) { |
466 | gAlice->ResetDigits(); | |
467 | gAlice->TreeD()->GetEvent(1); // spurious +1 ... | |
468 | for (Int_t ich=0;ich<7;ich++) { | |
469 | AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich]; | |
470 | TClonesArray *RICHdigits = this->DigitsAddress(ich); | |
471 | if (RICHdigits == 0) | |
472 | continue; | |
473 | // | |
474 | // Get ready the current chamber stuff | |
475 | // | |
476 | AliRICHResponse* response = iChamber->GetResponseModel(); | |
477 | AliRICHSegmentation* seg = iChamber->GetSegmentationModel(); | |
478 | AliRICHClusterFinder* rec = iChamber->GetReconstructionModel(); | |
479 | if (seg) { | |
480 | rec->SetSegmentation(seg); | |
481 | rec->SetResponse(response); | |
482 | rec->SetDigits(RICHdigits); | |
483 | rec->SetChamber(ich); | |
484 | if (nev==0) rec->CalibrateCOG(); | |
485 | rec->FindRawClusters(); | |
486 | } | |
487 | TClonesArray *fRch; | |
488 | fRch=RawClustAddress(ich); | |
489 | fRch->Sort(); | |
490 | } // for ich | |
491 | ||
492 | gAlice->TreeR()->Fill(); | |
493 | TClonesArray *fRch; | |
494 | for (int i=0;i<7;i++) { | |
495 | fRch=RawClustAddress(i); | |
496 | int nraw=fRch->GetEntriesFast(); | |
497 | printf ("Chamber %d, raw clusters %d\n",i,nraw); | |
498 | } | |
499 | ||
500 | ResetRawClusters(); | |
501 | ||
502 | } // for icat | |
503 | ||
504 | char hname[30]; | |
505 | sprintf(hname,"TreeR%d",nev); | |
506 | gAlice->TreeR()->Write(hname); | |
507 | gAlice->TreeR()->Reset(); | |
508 | ||
509 | //gObjectTable->Print(); | |
ddae0931 | 510 | } |
511 | ||
512 | ||
513 | //______________________________________________________________________________ | |
514 | void AliRICH::Streamer(TBuffer &R__b) | |
515 | { | |
516 | // Stream an object of class AliRICH. | |
2e5f0f7b | 517 | AliRICHChamber *iChamber; |
518 | AliRICHSegmentation *segmentation; | |
519 | AliRICHResponse *response; | |
ddae0931 | 520 | TClonesArray *digitsaddress; |
2e5f0f7b | 521 | TClonesArray *rawcladdress; |
522 | TClonesArray *rechitaddress; | |
ddae0931 | 523 | |
524 | if (R__b.IsReading()) { | |
525 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
526 | AliDetector::Streamer(R__b); | |
2e5f0f7b | 527 | R__b >> fNPadHits; |
528 | R__b >> fPadHits; // diff | |
529 | R__b >> fNcerenkovs; | |
530 | R__b >> fCerenkovs; // diff | |
ddae0931 | 531 | R__b >> fDchambers; |
2e5f0f7b | 532 | R__b >> fRawClusters; |
533 | R__b >> fRecHits; //diff | |
ddae0931 | 534 | R__b.ReadArray(fNdch); |
2e5f0f7b | 535 | R__b.ReadArray(fNrawch); |
536 | R__b.ReadArray(fNrechits); | |
537 | // | |
ddae0931 | 538 | R__b >> fChambers; |
539 | // Stream chamber related information | |
540 | for (Int_t i =0; i<7; i++) { | |
2e5f0f7b | 541 | iChamber=(AliRICHChamber*) (*fChambers)[i]; |
ddae0931 | 542 | iChamber->Streamer(R__b); |
2e5f0f7b | 543 | segmentation=iChamber->GetSegmentationModel(); |
544 | segmentation->Streamer(R__b); | |
545 | response=iChamber->GetResponseModel(); | |
ddae0931 | 546 | response->Streamer(R__b); |
2e5f0f7b | 547 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
548 | rawcladdress->Streamer(R__b); | |
549 | rechitaddress=(TClonesArray*) (*fRecHits)[i]; | |
550 | rechitaddress->Streamer(R__b); | |
ddae0931 | 551 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
552 | digitsaddress->Streamer(R__b); | |
553 | } | |
554 | ||
555 | } else { | |
556 | R__b.WriteVersion(AliRICH::IsA()); | |
557 | AliDetector::Streamer(R__b); | |
2e5f0f7b | 558 | R__b << fNPadHits; |
559 | R__b << fPadHits; // diff | |
560 | R__b << fNcerenkovs; | |
561 | R__b << fCerenkovs; // diff | |
ddae0931 | 562 | R__b << fDchambers; |
2e5f0f7b | 563 | R__b << fRawClusters; |
564 | R__b << fRecHits; //diff | |
ddae0931 | 565 | R__b.WriteArray(fNdch, 7); |
2e5f0f7b | 566 | R__b.WriteArray(fNrawch, 7); |
567 | R__b.WriteArray(fNrechits, 7); | |
ddae0931 | 568 | // |
ddae0931 | 569 | R__b << fChambers; |
570 | // Stream chamber related information | |
571 | for (Int_t i =0; i<7; i++) { | |
2e5f0f7b | 572 | iChamber=(AliRICHChamber*) (*fChambers)[i]; |
ddae0931 | 573 | iChamber->Streamer(R__b); |
2e5f0f7b | 574 | segmentation=iChamber->GetSegmentationModel(); |
575 | segmentation->Streamer(R__b); | |
576 | response=iChamber->GetResponseModel(); | |
ddae0931 | 577 | response->Streamer(R__b); |
2e5f0f7b | 578 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
579 | rawcladdress->Streamer(R__b); | |
580 | rechitaddress=(TClonesArray*) (*fRecHits)[i]; | |
581 | rechitaddress->Streamer(R__b); | |
ddae0931 | 582 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
583 | digitsaddress->Streamer(R__b); | |
584 | } | |
fe4da5cc | 585 | } |
ddae0931 | 586 | } |
2e5f0f7b | 587 | AliRICHPadHit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters ) |
ddae0931 | 588 | { |
589 | // | |
590 | // Initialise the pad iterator | |
591 | // Return the address of the first padhit for hit | |
592 | TClonesArray *theClusters = clusters; | |
593 | Int_t nclust = theClusters->GetEntriesFast(); | |
594 | if (nclust && hit->fPHlast > 0) { | |
2e5f0f7b | 595 | sMaxIterPad=Int_t(hit->fPHlast); |
596 | sCurIterPad=Int_t(hit->fPHfirst); | |
597 | return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1); | |
ddae0931 | 598 | } else { |
599 | return 0; | |
fe4da5cc | 600 | } |
ddae0931 | 601 | |
fe4da5cc | 602 | } |
603 | ||
2e5f0f7b | 604 | AliRICHPadHit* AliRICH::NextPad(TClonesArray *clusters) |
fe4da5cc | 605 | { |
ddae0931 | 606 | sCurIterPad++; |
607 | if (sCurIterPad <= sMaxIterPad) { | |
2e5f0f7b | 608 | return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1); |
ddae0931 | 609 | } else { |
610 | return 0; | |
611 | } | |
fe4da5cc | 612 | } |
613 | ||
fe4da5cc | 614 | |
ddae0931 | 615 | void AliRICH::Digitise(Int_t nev,Option_t *option,Text_t *filename) |
fe4da5cc | 616 | { |
ddae0931 | 617 | // keep galice.root for signal and name differently the file for |
618 | // background when add! otherwise the track info for signal will be lost ! | |
2e5f0f7b | 619 | |
c90dd3e2 | 620 | static Bool_t first=kTRUE; |
ddae0931 | 621 | static TFile *File; |
622 | char *Add = strstr(option,"Add"); | |
623 | ||
2e5f0f7b | 624 | FILE* points; //these will be the digits... |
625 | ||
626 | points=fopen("points.dat","w"); | |
627 | ||
628 | AliRICHChamber* iChamber; | |
629 | AliRICHSegmentation* segmentation; | |
ddae0931 | 630 | |
631 | ||
632 | Int_t trk[50]; | |
633 | Int_t chtrk[50]; | |
634 | TObjArray *list=new TObjArray; | |
2e5f0f7b | 635 | static TClonesArray *p_adr=0; |
636 | if(!p_adr) p_adr=new TClonesArray("TVector",1000); | |
637 | Int_t digits[5]; | |
ddae0931 | 638 | |
2e5f0f7b | 639 | AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); |
ddae0931 | 640 | AliRICHHitMap* HitMap[10]; |
2e5f0f7b | 641 | Int_t i; |
c90dd3e2 | 642 | for (i=0; i<10; i++) {HitMap[i]=0;} |
ddae0931 | 643 | if (Add ) { |
644 | if(first) { | |
645 | fFileName=filename; | |
646 | cout<<"filename"<<fFileName<<endl; | |
647 | File=new TFile(fFileName); | |
648 | cout<<"I have opened "<<fFileName<<" file "<<endl; | |
2e5f0f7b | 649 | fHits2 = new TClonesArray("AliRICHHit",1000 ); |
650 | fClusters2 = new TClonesArray("AliRICHPadHit",10000); | |
c90dd3e2 | 651 | first=kFALSE; |
ddae0931 | 652 | } |
653 | File->cd(); | |
ddae0931 | 654 | // Get Hits Tree header from file |
655 | if(fHits2) fHits2->Clear(); | |
656 | if(fClusters2) fClusters2->Clear(); | |
2e5f0f7b | 657 | if(TrH1) delete TrH1; |
658 | TrH1=0; | |
659 | ||
ddae0931 | 660 | char treeName[20]; |
661 | sprintf(treeName,"TreeH%d",nev); | |
2e5f0f7b | 662 | TrH1 = (TTree*)gDirectory->Get(treeName); |
663 | if (!TrH1) { | |
ddae0931 | 664 | printf("ERROR: cannot find Hits Tree for event:%d\n",nev); |
665 | } | |
666 | // Set branch addresses | |
667 | TBranch *branch; | |
668 | char branchname[20]; | |
669 | sprintf(branchname,"%s",GetName()); | |
2e5f0f7b | 670 | if (TrH1 && fHits2) { |
671 | branch = TrH1->GetBranch(branchname); | |
ddae0931 | 672 | if (branch) branch->SetAddress(&fHits2); |
673 | } | |
2e5f0f7b | 674 | if (TrH1 && fClusters2) { |
675 | branch = TrH1->GetBranch("RICHCluster"); | |
ddae0931 | 676 | if (branch) branch->SetAddress(&fClusters2); |
677 | } | |
678 | } | |
679 | // | |
680 | // loop over cathodes | |
681 | // | |
682 | AliRICHHitMap* hm; | |
2e5f0f7b | 683 | Int_t countadr=0; |
f91473f6 | 684 | for (int icat=0; icat<1; icat++) { |
ddae0931 | 685 | Int_t counter=0; |
c90dd3e2 | 686 | for (i =0; i<7; i++) { |
2e5f0f7b | 687 | iChamber=(AliRICHChamber*) (*fChambers)[i]; |
ddae0931 | 688 | if (iChamber->Nsec()==1 && icat==1) { |
689 | continue; | |
690 | } else { | |
691 | segmentation=iChamber->GetSegmentationModel(icat+1); | |
692 | } | |
693 | HitMap[i] = new AliRICHHitMapA1(segmentation, list); | |
694 | } | |
ddae0931 | 695 | // |
696 | // Loop over tracks | |
697 | // | |
698 | ||
699 | TTree *TH = gAlice->TreeH(); | |
700 | Int_t ntracks =(Int_t) TH->GetEntries(); | |
701 | for (Int_t track=0; track<ntracks; track++) { | |
702 | gAlice->ResetHits(); | |
703 | TH->GetEvent(track); | |
704 | // | |
705 | // Loop over hits | |
2e5f0f7b | 706 | for(AliRICHHit* mHit=(AliRICHHit*)RICH->FirstHit(-1); |
ddae0931 | 707 | mHit; |
2e5f0f7b | 708 | mHit=(AliRICHHit*)RICH->NextHit()) |
ddae0931 | 709 | { |
710 | Int_t nch = mHit->fChamber-1; // chamber number | |
711 | if (nch >7) continue; | |
712 | iChamber = &(RICH->Chamber(nch)); | |
2e5f0f7b | 713 | |
714 | ||
ddae0931 | 715 | // |
716 | // Loop over pad hits | |
2e5f0f7b | 717 | for (AliRICHPadHit* mPad= |
718 | (AliRICHPadHit*)RICH->FirstPad(mHit,fPadHits); | |
ddae0931 | 719 | mPad; |
2e5f0f7b | 720 | mPad=(AliRICHPadHit*)RICH->NextPad(fPadHits)) |
ddae0931 | 721 | { |
722 | Int_t cathode = mPad->fCathode; // cathode number | |
723 | Int_t ipx = mPad->fPadX; // pad number on X | |
724 | Int_t ipy = mPad->fPadY; // pad number on Y | |
725 | Int_t iqpad = mPad->fQpad; // charge per pad | |
726 | // | |
727 | // | |
2e5f0f7b | 728 | //printf("X:%d, Y:%d, Q:%d\n",ipx,ipy,iqpad); |
729 | ||
ddae0931 | 730 | Float_t thex, they; |
731 | segmentation=iChamber->GetSegmentationModel(cathode); | |
732 | segmentation->GetPadCxy(ipx,ipy,thex,they); | |
2e5f0f7b | 733 | new((*p_adr)[countadr++]) TVector(2); |
734 | TVector &trinfo=*((TVector*) (*p_adr)[countadr-1]); | |
ddae0931 | 735 | trinfo(0)=(Float_t)track; |
736 | trinfo(1)=(Float_t)iqpad; | |
737 | ||
738 | digits[0]=ipx; | |
739 | digits[1]=ipy; | |
740 | digits[2]=iqpad; | |
741 | ||
2e5f0f7b | 742 | AliRICHTransientDigit* pdigit; |
ddae0931 | 743 | // build the list of fired pads and update the info |
744 | if (!HitMap[nch]->TestHit(ipx, ipy)) { | |
745 | list->AddAtAndExpand( | |
2e5f0f7b | 746 | new AliRICHTransientDigit(nch,digits),counter); |
ddae0931 | 747 | HitMap[nch]->SetHit(ipx, ipy, counter); |
748 | counter++; | |
2e5f0f7b | 749 | pdigit=(AliRICHTransientDigit*)list->At(list->GetLast()); |
ddae0931 | 750 | // list of tracks |
751 | TObjArray *trlist=(TObjArray*)pdigit->TrackList(); | |
752 | trlist->Add(&trinfo); | |
753 | } else { | |
2e5f0f7b | 754 | pdigit=(AliRICHTransientDigit*) HitMap[nch]->GetHit(ipx, ipy); |
ddae0931 | 755 | // update charge |
756 | (*pdigit).fSignal+=iqpad; | |
757 | // update list of tracks | |
758 | TObjArray* trlist=(TObjArray*)pdigit->TrackList(); | |
759 | Int_t last_entry=trlist->GetLast(); | |
760 | TVector *ptrk_p=(TVector*)trlist->At(last_entry); | |
761 | TVector &ptrk=*ptrk_p; | |
762 | Int_t last_track=Int_t(ptrk(0)); | |
763 | Int_t last_charge=Int_t(ptrk(1)); | |
764 | if (last_track==track) { | |
765 | last_charge+=iqpad; | |
766 | trlist->RemoveAt(last_entry); | |
767 | trinfo(0)=last_track; | |
768 | trinfo(1)=last_charge; | |
769 | trlist->AddAt(&trinfo,last_entry); | |
770 | } else { | |
771 | trlist->Add(&trinfo); | |
772 | } | |
773 | // check the track list | |
774 | Int_t nptracks=trlist->GetEntriesFast(); | |
775 | if (nptracks > 2) { | |
2e5f0f7b | 776 | printf("Attention - tracks: %d (>2)\n",nptracks); |
777 | //printf("cat,nch,ix,iy %d %d %d %d \n",icat+1,nch,ipx,ipy); | |
ddae0931 | 778 | for (Int_t tr=0;tr<nptracks;tr++) { |
779 | TVector *pptrk_p=(TVector*)trlist->At(tr); | |
780 | TVector &pptrk=*pptrk_p; | |
781 | trk[tr]=Int_t(pptrk(0)); | |
782 | chtrk[tr]=Int_t(pptrk(1)); | |
783 | } | |
784 | } // end if nptracks | |
785 | } // end if pdigit | |
786 | } //end loop over clusters | |
787 | } // hit loop | |
788 | } // track loop | |
789 | ||
ddae0931 | 790 | // open the file with background |
791 | ||
792 | if (Add ) { | |
2e5f0f7b | 793 | ntracks =(Int_t)TrH1->GetEntries(); |
794 | //printf("background - icat,ntracks1 %d %d\n",icat,ntracks); | |
795 | //printf("background - Start loop over tracks \n"); | |
ddae0931 | 796 | // |
797 | // Loop over tracks | |
798 | // | |
f91473f6 | 799 | for (Int_t trak=0; trak<ntracks; trak++) { |
ddae0931 | 800 | if (fHits2) fHits2->Clear(); |
801 | if (fClusters2) fClusters2->Clear(); | |
2e5f0f7b | 802 | TrH1->GetEvent(trak); |
ddae0931 | 803 | // |
804 | // Loop over hits | |
2e5f0f7b | 805 | AliRICHHit* mHit; |
f91473f6 | 806 | for(int j=0;j<fHits2->GetEntriesFast();++j) |
ddae0931 | 807 | { |
2e5f0f7b | 808 | mHit=(AliRICHHit*) (*fHits2)[j]; |
ddae0931 | 809 | Int_t nch = mHit->fChamber-1; // chamber number |
2e5f0f7b | 810 | if (nch >6) continue; |
ddae0931 | 811 | iChamber = &(RICH->Chamber(nch)); |
812 | Int_t rmin = (Int_t)iChamber->RInner(); | |
813 | Int_t rmax = (Int_t)iChamber->ROuter(); | |
814 | // | |
815 | // Loop over pad hits | |
2e5f0f7b | 816 | for (AliRICHPadHit* mPad= |
817 | (AliRICHPadHit*)RICH->FirstPad(mHit,fClusters2); | |
ddae0931 | 818 | mPad; |
2e5f0f7b | 819 | mPad=(AliRICHPadHit*)RICH->NextPad(fClusters2)) |
ddae0931 | 820 | { |
821 | Int_t cathode = mPad->fCathode; // cathode number | |
822 | Int_t ipx = mPad->fPadX; // pad number on X | |
823 | Int_t ipy = mPad->fPadY; // pad number on Y | |
824 | Int_t iqpad = mPad->fQpad; // charge per pad | |
f91473f6 | 825 | if (trak==3 && nch==0 && icat==0) printf("bgr - trak,iqpad,ipx,ipy %d %d %d %d\n",trak,iqpad,ipx,ipy); |
ddae0931 | 826 | // |
827 | // | |
ddae0931 | 828 | Float_t thex, they; |
829 | segmentation=iChamber->GetSegmentationModel(cathode); | |
830 | segmentation->GetPadCxy(ipx,ipy,thex,they); | |
831 | Float_t rpad=TMath::Sqrt(thex*thex+they*they); | |
832 | if (rpad < rmin || iqpad ==0 || rpad > rmax) continue; | |
2e5f0f7b | 833 | new((*p_adr)[countadr++]) TVector(2); |
834 | TVector &trinfo=*((TVector*) (*p_adr)[countadr-1]); | |
ddae0931 | 835 | trinfo(0)=-1; // tag background |
836 | trinfo(1)=-1; | |
ddae0931 | 837 | digits[0]=ipx; |
838 | digits[1]=ipy; | |
839 | digits[2]=iqpad; | |
f91473f6 | 840 | if (trak <4 && icat==0 && nch==0) |
841 | printf("bgr - HitMap[nch]->TestHit(ipx, ipy),trak %d %d\n", | |
842 | HitMap[nch]->TestHit(ipx, ipy),trak); | |
2e5f0f7b | 843 | AliRICHTransientDigit* pdigit; |
ddae0931 | 844 | // build the list of fired pads and update the info |
845 | if (!HitMap[nch]->TestHit(ipx, ipy)) { | |
2e5f0f7b | 846 | list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter); |
ddae0931 | 847 | |
848 | HitMap[nch]->SetHit(ipx, ipy, counter); | |
849 | counter++; | |
850 | printf("bgr new elem in list - counter %d\n",counter); | |
851 | ||
2e5f0f7b | 852 | pdigit=(AliRICHTransientDigit*)list->At(list->GetLast()); |
ddae0931 | 853 | // list of tracks |
854 | TObjArray *trlist=(TObjArray*)pdigit->TrackList(); | |
855 | trlist->Add(&trinfo); | |
856 | } else { | |
2e5f0f7b | 857 | pdigit=(AliRICHTransientDigit*) HitMap[nch]->GetHit(ipx, ipy); |
ddae0931 | 858 | // update charge |
859 | (*pdigit).fSignal+=iqpad; | |
860 | // update list of tracks | |
861 | TObjArray* trlist=(TObjArray*)pdigit->TrackList(); | |
862 | Int_t last_entry=trlist->GetLast(); | |
863 | TVector *ptrk_p=(TVector*)trlist->At(last_entry); | |
864 | TVector &ptrk=*ptrk_p; | |
865 | Int_t last_track=Int_t(ptrk(0)); | |
866 | if (last_track==-1) { | |
867 | continue; | |
868 | } else { | |
869 | trlist->Add(&trinfo); | |
870 | } | |
871 | // check the track list | |
872 | Int_t nptracks=trlist->GetEntriesFast(); | |
873 | if (nptracks > 0) { | |
874 | for (Int_t tr=0;tr<nptracks;tr++) { | |
875 | TVector *pptrk_p=(TVector*)trlist->At(tr); | |
876 | TVector &pptrk=*pptrk_p; | |
877 | trk[tr]=Int_t(pptrk(0)); | |
878 | chtrk[tr]=Int_t(pptrk(1)); | |
879 | } | |
880 | } // end if nptracks | |
881 | } // end if pdigit | |
882 | } //end loop over clusters | |
883 | } // hit loop | |
884 | } // track loop | |
ddae0931 | 885 | TTree *fAli=gAlice->TreeK(); |
886 | if (fAli) File =fAli->GetCurrentFile(); | |
887 | File->cd(); | |
888 | } // if Add | |
889 | ||
890 | Int_t tracks[10]; | |
891 | Int_t charges[10]; | |
2e5f0f7b | 892 | //cout<<"Start filling digits \n "<<endl; |
ddae0931 | 893 | Int_t nentries=list->GetEntriesFast(); |
2e5f0f7b | 894 | //printf(" \n \n nentries %d \n",nentries); |
ddae0931 | 895 | |
896 | // start filling the digits | |
897 | ||
898 | for (Int_t nent=0;nent<nentries;nent++) { | |
2e5f0f7b | 899 | AliRICHTransientDigit *address=(AliRICHTransientDigit*)list->At(nent); |
ddae0931 | 900 | if (address==0) continue; |
901 | Int_t ich=address->fChamber; | |
902 | Int_t q=address->fSignal; | |
2e5f0f7b | 903 | iChamber=(AliRICHChamber*) (*fChambers)[ich]; |
904 | AliRICHResponse * response=iChamber->GetResponseModel(); | |
905 | Int_t adcmax= (Int_t) response->MaxAdc(); | |
906 | // add white noise and do zero-suppression and signal truncation (new electronics,old electronics gaus 1.2,0.2) | |
907 | Float_t MeanNoise = gRandom->Gaus(1.7, 0.25); | |
ddae0931 | 908 | Float_t Noise = gRandom->Gaus(0, MeanNoise); |
2e5f0f7b | 909 | q+=(Int_t)Noise; |
910 | // magic number to be parametrised !!! | |
911 | if ( q <= 6.8) continue; | |
912 | if ( q >= adcmax) q=adcmax; | |
ddae0931 | 913 | digits[0]=address->fPadX; |
914 | digits[1]=address->fPadY; | |
915 | digits[2]=q; | |
916 | ||
917 | TObjArray* trlist=(TObjArray*)address->TrackList(); | |
918 | Int_t nptracks=trlist->GetEntriesFast(); | |
919 | ||
920 | // this was changed to accomodate the real number of tracks | |
921 | if (nptracks > 10) { | |
2e5f0f7b | 922 | cout<<"Attention - tracks > 10 "<<nptracks<<endl; |
ddae0931 | 923 | nptracks=10; |
924 | } | |
925 | if (nptracks > 2) { | |
2e5f0f7b | 926 | printf("Attention - tracks > 2 %d \n",nptracks); |
927 | //printf("cat,ich,ix,iy,q %d %d %d %d %d \n", | |
928 | //icat,ich,digits[0],digits[1],q); | |
ddae0931 | 929 | } |
930 | for (Int_t tr=0;tr<nptracks;tr++) { | |
931 | TVector *pp_p=(TVector*)trlist->At(tr); | |
932 | TVector &pp =*pp_p; | |
933 | tracks[tr]=Int_t(pp(0)); | |
934 | charges[tr]=Int_t(pp(1)); | |
935 | } //end loop over list of tracks for one pad | |
936 | if (nptracks < 10 ) { | |
f91473f6 | 937 | for (Int_t t=nptracks; t<10; t++) { |
938 | tracks[t]=0; | |
939 | charges[t]=0; | |
ddae0931 | 940 | } |
941 | } | |
2e5f0f7b | 942 | //write file |
943 | if (ich==2) | |
944 | fprintf(points,"%4d, %4d, %4d\n",digits[0],digits[1],digits[2]); | |
945 | ||
ddae0931 | 946 | // fill digits |
947 | RICH->AddDigits(ich,tracks,charges,digits); | |
ddae0931 | 948 | } |
ddae0931 | 949 | gAlice->TreeD()->Fill(); |
2e5f0f7b | 950 | |
951 | list->Delete(); | |
952 | for(Int_t ii=0;ii<7;++ii) { | |
953 | if (HitMap[ii]) { | |
954 | hm=HitMap[ii]; | |
955 | delete hm; | |
956 | HitMap[ii]=0; | |
957 | } | |
958 | } | |
959 | ||
960 | //TTree *TD=gAlice->TreeD(); | |
961 | //Stat_t ndig=TD->GetEntries(); | |
962 | //cout<<"number of digits "<<ndig<<endl; | |
ddae0931 | 963 | TClonesArray *fDch; |
f91473f6 | 964 | for (int k=0;k<7;k++) { |
965 | fDch= RICH->DigitsAddress(k); | |
c90dd3e2 | 966 | int ndigit=fDch->GetEntriesFast(); |
2e5f0f7b | 967 | printf ("Chamber %d digits %d \n",k,ndigit); |
ddae0931 | 968 | } |
969 | RICH->ResetDigits(); | |
ddae0931 | 970 | } //end loop over cathodes |
971 | char hname[30]; | |
972 | sprintf(hname,"TreeD%d",nev); | |
973 | gAlice->TreeD()->Write(hname); | |
ddae0931 | 974 | |
2e5f0f7b | 975 | // reset tree |
976 | // gAlice->TreeD()->Reset(); | |
977 | delete list; | |
978 | p_adr->Clear(); | |
979 | // gObjectTable->Print(); | |
980 | } | |
ddae0931 | 981 | |
982 | ||
983 |