]>
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 | ||
acd84897 | 16 | /* $Id$ */ |
4c039060 | 17 | |
fe4da5cc | 18 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // | |
20 | // Base class for ALICE modules. Both sensitive modules (detectors) and // | |
21 | // non-sensitive ones are described by this base class. This class // | |
22 | // supports the hit and digit trees produced by the simulation and also // | |
23 | // the objects produced by the reconstruction. // | |
24 | // // | |
25 | // This class is also responsible for building the geometry of the // | |
26 | // detectors. // | |
27 | // // | |
28 | //Begin_Html | |
29 | /* | |
1439f98e | 30 | <img src="picts/AliDetectorClass.gif"> |
fe4da5cc | 31 | */ |
32 | //End_Html | |
33 | // // | |
34 | /////////////////////////////////////////////////////////////////////////////// | |
65fb704d | 35 | |
27d40e08 | 36 | #include <assert.h> |
37 | ||
116cbefd | 38 | #include <Riostream.h> |
2ab0c725 | 39 | #include <TBrowser.h> |
40 | #include <TFile.h> | |
9e1a0ddb | 41 | #include <TFolder.h> |
6644b9ca | 42 | #include <TROOT.h> |
43 | #include <TTree.h> | |
fe4da5cc | 44 | |
9e1a0ddb | 45 | #include "AliConfig.h" |
94de3818 | 46 | #include "AliDetector.h" |
94de3818 | 47 | #include "AliHit.h" |
48 | #include "AliPoints.h" | |
6644b9ca | 49 | #include "AliRun.h" |
aab9c8d5 | 50 | #include "AliTrackReference.h" |
51 | ||
9e1a0ddb | 52 | |
fe4da5cc | 53 | // Static variables for the hit iterator routines |
54 | static Int_t sMaxIterHit=0; | |
55 | static Int_t sCurIterHit=0; | |
56 | ||
aab9c8d5 | 57 | |
fe4da5cc | 58 | ClassImp(AliDetector) |
59 | ||
6644b9ca | 60 | //_______________________________________________________________________ |
61 | AliDetector::AliDetector(): | |
62 | fTimeGate(200.e-9), | |
63 | fIshunt(0), | |
64 | fNhits(0), | |
65 | fNdigits(0), | |
66 | fBufferSize(1600), | |
67 | fHits(0), | |
68 | fDigits(0), | |
69 | fDigitsFile(0), | |
70 | fPoints(0), | |
71 | fTrackReferences(0), | |
72 | fMaxIterTrackRef(0), | |
73 | fCurrentIterTrackRef(0) | |
fe4da5cc | 74 | { |
75 | // | |
76 | // Default constructor for the AliDetector class | |
77 | // | |
fe4da5cc | 78 | } |
79 | ||
e2afb3b6 | 80 | //_______________________________________________________________________ |
81 | AliDetector::AliDetector(const AliDetector &det): | |
82 | AliModule(det), | |
83 | fTimeGate(200.e-9), | |
84 | fIshunt(0), | |
85 | fNhits(0), | |
86 | fNdigits(0), | |
87 | fBufferSize(1600), | |
88 | fHits(0), | |
89 | fDigits(0), | |
90 | fDigitsFile(0), | |
91 | fPoints(0), | |
92 | fTrackReferences(0), | |
93 | fMaxIterTrackRef(0), | |
94 | fCurrentIterTrackRef(0) | |
95 | { | |
96 | det.Copy(*this); | |
97 | } | |
98 | ||
fe4da5cc | 99 | //_____________________________________________________________________________ |
6644b9ca | 100 | AliDetector::AliDetector(const char* name,const char *title): |
101 | AliModule(name,title), | |
102 | fTimeGate(200.e-9), | |
103 | fIshunt(0), | |
104 | fNhits(0), | |
105 | fNdigits(0), | |
106 | fBufferSize(1600), | |
107 | fHits(0), | |
108 | fDigits(0), | |
109 | fDigitsFile(0), | |
110 | fPoints(0), | |
111 | fTrackReferences(new TClonesArray("AliTrackReference", 100)), | |
112 | fMaxIterTrackRef(0), | |
113 | fCurrentIterTrackRef(0) | |
fe4da5cc | 114 | { |
115 | // | |
116 | // Normal constructor invoked by all Detectors. | |
117 | // Create the list for detector specific histograms | |
118 | // Add this Detector to the global list of Detectors in Run. | |
119 | // | |
120 | ||
fe4da5cc | 121 | fActive = kTRUE; |
9e1a0ddb | 122 | AliConfig::Instance()->Add(this); |
aab9c8d5 | 123 | |
fe4da5cc | 124 | } |
125 | ||
6644b9ca | 126 | //_______________________________________________________________________ |
fe4da5cc | 127 | AliDetector::~AliDetector() |
128 | { | |
129 | // | |
130 | // Destructor | |
131 | // | |
6644b9ca | 132 | |
fe4da5cc | 133 | // Delete space point structure |
e460afec | 134 | if (fPoints) { |
135 | fPoints->Delete(); | |
136 | delete fPoints; | |
137 | fPoints = 0; | |
138 | } | |
139 | // Delete digits structure | |
140 | if (fDigits) { | |
141 | fDigits->Delete(); | |
142 | delete fDigits; | |
143 | fDigits = 0; | |
144 | } | |
14f75f83 | 145 | // Delete track references |
146 | if (fTrackReferences) { | |
147 | fTrackReferences->Delete(); | |
148 | delete fTrackReferences; | |
149 | fTrackReferences = 0; | |
150 | } | |
2ab0c725 | 151 | if (fDigitsFile) delete [] fDigitsFile; |
fe4da5cc | 152 | } |
9e1a0ddb | 153 | |
6644b9ca | 154 | //_______________________________________________________________________ |
9e1a0ddb | 155 | void AliDetector::Publish(const char *dir, void *address, const char *name) |
156 | { | |
157 | // | |
158 | // Register pointer to detector objects. | |
159 | // | |
e2afb3b6 | 160 | TFolder *topFolder = dynamic_cast<TFolder *>(gROOT->FindObjectAny("/Folders")); |
682a4a95 | 161 | if (topFolder) { |
e2afb3b6 | 162 | TFolder *folder = dynamic_cast<TFolder *>(topFolder->FindObjectAny(dir)); |
163 | // TFolder *folder = dynamic_cast<TFolder *>(gROOT->FindObjectAny(dir)); | |
682a4a95 | 164 | if (!folder) { |
165 | cerr << "Cannot register: Missing folder: " << dir << endl; | |
166 | } else { | |
e2afb3b6 | 167 | TFolder *subfolder = dynamic_cast<TFolder *>(folder->FindObjectAny(this->GetName())); |
682a4a95 | 168 | |
169 | if(!subfolder) | |
170 | subfolder = folder->AddFolder(this->GetName(),this->GetTitle()); | |
171 | if (address) { | |
e2afb3b6 | 172 | TObject **obj = static_cast<TObject **>(address); |
682a4a95 | 173 | if ((*obj)->InheritsFrom(TCollection::Class())) { |
e2afb3b6 | 174 | TCollection *collection = dynamic_cast<TCollection *>(*obj); |
682a4a95 | 175 | if (name) |
176 | collection->SetName(name); | |
177 | } | |
178 | subfolder->Add(*obj); | |
9e1a0ddb | 179 | } |
9e1a0ddb | 180 | } |
181 | } | |
182 | } | |
183 | ||
6644b9ca | 184 | //_______________________________________________________________________ |
185 | TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, | |
186 | void* address, Int_t size, | |
187 | const char *file) | |
9e1a0ddb | 188 | { |
d0f40f23 | 189 | return(MakeBranchInTree(tree,name,0,address,size,99,file)); |
9e1a0ddb | 190 | } |
191 | ||
6644b9ca | 192 | //_______________________________________________________________________ |
193 | TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, | |
194 | const char *classname, | |
195 | void* address,Int_t size, | |
196 | Int_t splitlevel, const char *file) | |
9e1a0ddb | 197 | { |
198 | // | |
199 | // Makes branch in given tree and diverts them to a separate file | |
200 | // | |
201 | if (GetDebug()>1) | |
202 | printf("* MakeBranch * Making Branch %s \n",name); | |
203 | ||
204 | TDirectory *cwd = gDirectory; | |
205 | TBranch *branch = 0; | |
206 | ||
207 | if (classname) { | |
208 | branch = tree->Branch(name,classname,address,size,splitlevel); | |
209 | } else { | |
210 | branch = tree->Branch(name,address,size); | |
211 | } | |
212 | ||
213 | if (file) { | |
214 | char * outFile = new char[strlen(gAlice->GetBaseFile())+strlen(file)+2]; | |
215 | sprintf(outFile,"%s/%s",gAlice->GetBaseFile(),file); | |
216 | branch->SetFile(outFile); | |
217 | TIter next( branch->GetListOfBranches()); | |
e2afb3b6 | 218 | while ((branch=dynamic_cast<TBranch*>(next()))) { |
9e1a0ddb | 219 | branch->SetFile(outFile); |
220 | } | |
221 | delete outFile; | |
222 | ||
223 | cwd->cd(); | |
224 | ||
225 | if (GetDebug()>1) | |
226 | printf("* MakeBranch * Diverting Branch %s to file %s\n",name,file); | |
227 | } | |
e2afb3b6 | 228 | const char *folder = 0; |
7e90ff59 | 229 | TString folderName(name); |
230 | ||
9e1a0ddb | 231 | if (!strncmp(tree->GetName(),"TreeE",5)) folder = "RunMC/Event/Data"; |
232 | if (!strncmp(tree->GetName(),"TreeK",5)) folder = "RunMC/Event/Data"; | |
7e90ff59 | 233 | if (!strncmp(tree->GetName(),"TreeH",5)) { |
234 | folder = "RunMC/Event/Data/Hits"; | |
235 | folderName = "Hits" ; | |
236 | } | |
aab9c8d5 | 237 | if (!strncmp(tree->GetName(),"TreeTrackReferences",5)) { |
238 | folder = "RunMC/Event/Data/TrackReferences"; | |
239 | folderName = "TrackReferences" ; | |
240 | } | |
241 | ||
7e90ff59 | 242 | if (!strncmp(tree->GetName(),"TreeD",5)) { |
243 | folder = "Run/Event/Data"; | |
244 | folderName = "Digits" ; | |
245 | } | |
246 | if (!strncmp(tree->GetName(),"TreeS",5)) { | |
247 | folder = "RunMC/Event/Data/SDigits"; | |
248 | folderName = "SDigits" ; | |
249 | } | |
9e1a0ddb | 250 | if (!strncmp(tree->GetName(),"TreeR",5)) folder = "Run/Event/RecData"; |
251 | ||
252 | if (folder) { | |
253 | if (GetDebug()) | |
254 | printf("%15s: Publishing %s to %s\n",ClassName(),name,folder); | |
7e90ff59 | 255 | Publish(folder,address, folderName.Data()); |
9e1a0ddb | 256 | } |
257 | return branch; | |
258 | } | |
259 | ||
6644b9ca | 260 | //_______________________________________________________________________ |
fe4da5cc | 261 | void AliDetector::Browse(TBrowser *b) |
262 | { | |
263 | // | |
264 | // Insert Detector objects in the list of objects to be browsed | |
265 | // | |
266 | char name[64]; | |
267 | if( fHits == 0) return; | |
268 | TObject *obj; | |
269 | Int_t i, nobjects; | |
270 | // | |
271 | nobjects = fHits->GetEntries(); | |
272 | for (i=0;i<nobjects;i++) { | |
273 | obj = fHits->At(i); | |
274 | sprintf(name,"%s_%d",obj->GetName(),i); | |
275 | b->Add(obj, &name[0]); | |
276 | } | |
277 | } | |
278 | ||
6644b9ca | 279 | //_______________________________________________________________________ |
e2afb3b6 | 280 | void AliDetector::Copy(AliDetector &) const |
8918e700 | 281 | { |
282 | // | |
283 | // Copy *this onto det -- not implemented | |
284 | // | |
e2afb3b6 | 285 | Fatal("Copy","Not implemented\n"); |
8918e700 | 286 | } |
287 | ||
6644b9ca | 288 | //_______________________________________________________________________ |
fe4da5cc | 289 | void AliDetector::FinishRun() |
290 | { | |
291 | // | |
292 | // Procedure called at the end of a run. | |
293 | // | |
294 | } | |
295 | ||
6644b9ca | 296 | //_______________________________________________________________________ |
ae9676e4 | 297 | void AliDetector::RemapTrackReferencesIDs(Int_t *map) |
298 | { | |
299 | // | |
6644b9ca | 300 | // Remapping track reference |
301 | // Called at finish primary | |
302 | // | |
ae9676e4 | 303 | if (!fTrackReferences) return; |
304 | for (Int_t i=0;i<fTrackReferences->GetEntries();i++){ | |
e2afb3b6 | 305 | AliTrackReference * ref = dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(i)); |
ae9676e4 | 306 | if (ref) { |
307 | Int_t newID = map[ref->GetTrack()]; | |
308 | if (newID>=0) ref->SetTrack(newID); | |
309 | else ref->SetTrack(-1); | |
310 | ||
311 | } | |
312 | } | |
313 | } | |
314 | ||
6644b9ca | 315 | //_______________________________________________________________________ |
fe4da5cc | 316 | AliHit* AliDetector::FirstHit(Int_t track) |
317 | { | |
318 | // | |
319 | // Initialise the hit iterator | |
320 | // Return the address of the first hit for track | |
321 | // If track>=0 the track is read from disk | |
322 | // while if track<0 the first hit of the current | |
323 | // track is returned | |
324 | // | |
325 | if(track>=0) { | |
326 | gAlice->ResetHits(); | |
327 | gAlice->TreeH()->GetEvent(track); | |
328 | } | |
329 | // | |
330 | sMaxIterHit=fHits->GetEntriesFast(); | |
331 | sCurIterHit=0; | |
e2afb3b6 | 332 | if(sMaxIterHit) return dynamic_cast<AliHit*>(fHits->UncheckedAt(0)); |
fe4da5cc | 333 | else return 0; |
334 | } | |
335 | ||
aab9c8d5 | 336 | |
6644b9ca | 337 | //_______________________________________________________________________ |
aab9c8d5 | 338 | AliTrackReference* AliDetector::FirstTrackReference(Int_t track) |
339 | { | |
340 | // | |
341 | // Initialise the hit iterator | |
342 | // Return the address of the first hit for track | |
343 | // If track>=0 the track is read from disk | |
344 | // while if track<0 the first hit of the current | |
345 | // track is returned | |
346 | // | |
347 | if(track>=0) { | |
348 | gAlice->ResetTrackReferences(); | |
349 | gAlice->TreeTR()->GetEvent(track); | |
350 | } | |
351 | // | |
15c86cce | 352 | fMaxIterTrackRef = fTrackReferences->GetEntriesFast(); |
353 | fCurrentIterTrackRef = 0; | |
e2afb3b6 | 354 | if(fMaxIterTrackRef) return dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(0)); |
aab9c8d5 | 355 | else return 0; |
356 | } | |
357 | ||
6644b9ca | 358 | //_______________________________________________________________________ |
fe4da5cc | 359 | AliHit* AliDetector::NextHit() |
360 | { | |
361 | // | |
362 | // Return the next hit for the current track | |
363 | // | |
364 | if(sMaxIterHit) { | |
365 | if(++sCurIterHit<sMaxIterHit) | |
e2afb3b6 | 366 | return dynamic_cast<AliHit*>(fHits->UncheckedAt(sCurIterHit)); |
fe4da5cc | 367 | else |
368 | return 0; | |
369 | } else { | |
370 | printf("* AliDetector::NextHit * Hit Iterator called without calling FistHit before\n"); | |
371 | return 0; | |
372 | } | |
373 | } | |
6644b9ca | 374 | |
375 | //_______________________________________________________________________ | |
aab9c8d5 | 376 | AliTrackReference* AliDetector::NextTrackReference() |
377 | { | |
378 | // | |
379 | // Return the next hit for the current track | |
380 | // | |
381 | if(fMaxIterTrackRef) { | |
382 | if(++fCurrentIterTrackRef<fMaxIterTrackRef) | |
e2afb3b6 | 383 | return dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(fCurrentIterTrackRef)); |
aab9c8d5 | 384 | else |
385 | return 0; | |
386 | } else { | |
387 | printf("* AliDetector::NextTrackReference * TrackReference Iterator called without calling FistTrackReference before\n"); | |
388 | return 0; | |
389 | } | |
390 | } | |
fe4da5cc | 391 | |
6644b9ca | 392 | //_______________________________________________________________________ |
fe4da5cc | 393 | void AliDetector::LoadPoints(Int_t) |
394 | { | |
395 | // | |
396 | // Store x, y, z of all hits in memory | |
397 | // | |
398 | if (fHits == 0) return; | |
399 | // | |
fe4da5cc | 400 | Int_t nhits = fHits->GetEntriesFast(); |
401 | if (nhits == 0) return; | |
080a67a1 | 402 | Int_t tracks = gAlice->GetNtrack(); |
403 | if (fPoints == 0) fPoints = new TObjArray(tracks); | |
fe4da5cc | 404 | AliHit *ahit; |
405 | // | |
080a67a1 | 406 | Int_t *ntrk=new Int_t[tracks]; |
407 | Int_t *limi=new Int_t[tracks]; | |
408 | Float_t **coor=new Float_t*[tracks]; | |
409 | for(Int_t i=0;i<tracks;i++) { | |
410 | ntrk[i]=0; | |
411 | coor[i]=0; | |
412 | limi[i]=0; | |
413 | } | |
414 | // | |
fe4da5cc | 415 | AliPoints *points = 0; |
080a67a1 | 416 | Float_t *fp=0; |
417 | Int_t trk; | |
418 | Int_t chunk=nhits/4+1; | |
fe4da5cc | 419 | // |
420 | // Loop over all the hits and store their position | |
421 | for (Int_t hit=0;hit<nhits;hit++) { | |
e2afb3b6 | 422 | ahit = dynamic_cast<AliHit*>(fHits->UncheckedAt(hit)); |
080a67a1 | 423 | trk=ahit->GetTrack(); |
27d40e08 | 424 | assert(trk<=tracks); |
080a67a1 | 425 | if(ntrk[trk]==limi[trk]) { |
fe4da5cc | 426 | // |
427 | // Initialise a new track | |
080a67a1 | 428 | fp=new Float_t[3*(limi[trk]+chunk)]; |
429 | if(coor[trk]) { | |
430 | memcpy(fp,coor[trk],sizeof(Float_t)*3*limi[trk]); | |
431 | delete [] coor[trk]; | |
432 | } | |
433 | limi[trk]+=chunk; | |
434 | coor[trk] = fp; | |
435 | } else { | |
436 | fp = coor[trk]; | |
437 | } | |
94de3818 | 438 | fp[3*ntrk[trk] ] = ahit->X(); |
439 | fp[3*ntrk[trk]+1] = ahit->Y(); | |
440 | fp[3*ntrk[trk]+2] = ahit->Z(); | |
080a67a1 | 441 | ntrk[trk]++; |
442 | } | |
443 | // | |
444 | for(trk=0; trk<tracks; ++trk) { | |
445 | if(ntrk[trk]) { | |
446 | points = new AliPoints(); | |
fe4da5cc | 447 | points->SetMarkerColor(GetMarkerColor()); |
fe4da5cc | 448 | points->SetMarkerSize(GetMarkerSize()); |
449 | points->SetDetector(this); | |
450 | points->SetParticle(trk); | |
080a67a1 | 451 | points->SetPolyMarker(ntrk[trk],coor[trk],GetMarkerStyle()); |
452 | fPoints->AddAt(points,trk); | |
453 | delete [] coor[trk]; | |
454 | coor[trk]=0; | |
fe4da5cc | 455 | } |
fe4da5cc | 456 | } |
080a67a1 | 457 | delete [] coor; |
458 | delete [] ntrk; | |
459 | delete [] limi; | |
fe4da5cc | 460 | } |
461 | ||
6644b9ca | 462 | //_______________________________________________________________________ |
9e1a0ddb | 463 | void AliDetector::MakeBranch(Option_t *option, const char *file) |
fe4da5cc | 464 | { |
465 | // | |
466 | // Create a new branch in the current Root Tree | |
467 | // The branch of fHits is automatically split | |
468 | // | |
2ab0c725 | 469 | |
fe4da5cc | 470 | char branchname[10]; |
471 | sprintf(branchname,"%s",GetName()); | |
472 | // | |
473 | // Get the pointer to the header | |
5cf7bbad | 474 | const char *cH = strstr(option,"H"); |
fe4da5cc | 475 | // |
2ab0c725 | 476 | if (fHits && gAlice->TreeH() && cH) { |
9e1a0ddb | 477 | MakeBranchInTree(gAlice->TreeH(), |
478 | branchname, &fHits, fBufferSize, file) ; | |
fe4da5cc | 479 | } |
2ab0c725 | 480 | |
5cf7bbad | 481 | const char *cD = strstr(option,"D"); |
2ab0c725 | 482 | |
483 | if (cD) { | |
484 | if (file) { | |
485 | fDigitsFile = new char[strlen (file)]; | |
486 | strcpy(fDigitsFile,file); | |
487 | } | |
488 | } | |
fe4da5cc | 489 | } |
6644b9ca | 490 | //_______________________________________________________________________ |
aab9c8d5 | 491 | void AliDetector::MakeBranchTR(Option_t *option, const char *file) |
492 | { | |
493 | // | |
494 | // Create a new branch in the current Root Tree | |
495 | // The branch of fHits is automatically split | |
496 | // | |
497 | ||
498 | char branchname[10]; | |
499 | sprintf(branchname,"%s",GetName()); | |
500 | // | |
501 | // Get the pointer to the header | |
502 | const char *cTR = strstr(option,"T"); | |
503 | // | |
504 | if (fTrackReferences && gAlice->TreeTR() && cTR) { | |
505 | MakeBranchInTree(gAlice->TreeTR(), | |
506 | branchname, &fTrackReferences, fBufferSize, file) ; | |
507 | } | |
508 | } | |
fe4da5cc | 509 | |
6644b9ca | 510 | //_______________________________________________________________________ |
fe4da5cc | 511 | void AliDetector::ResetDigits() |
512 | { | |
513 | // | |
514 | // Reset number of digits and the digits array | |
515 | // | |
516 | fNdigits = 0; | |
517 | if (fDigits) fDigits->Clear(); | |
518 | } | |
519 | ||
6644b9ca | 520 | //_______________________________________________________________________ |
fe4da5cc | 521 | void AliDetector::ResetHits() |
522 | { | |
523 | // | |
524 | // Reset number of hits and the hits array | |
525 | // | |
526 | fNhits = 0; | |
527 | if (fHits) fHits->Clear(); | |
528 | } | |
529 | ||
6644b9ca | 530 | //_______________________________________________________________________ |
aab9c8d5 | 531 | void AliDetector::ResetTrackReferences() |
532 | { | |
533 | // | |
534 | // Reset number of hits and the hits array | |
535 | // | |
536 | fMaxIterTrackRef = 0; | |
537 | if (fTrackReferences) fTrackReferences->Clear(); | |
538 | } | |
539 | ||
6644b9ca | 540 | //_______________________________________________________________________ |
fe4da5cc | 541 | void AliDetector::ResetPoints() |
542 | { | |
543 | // | |
544 | // Reset array of points | |
545 | // | |
546 | if (fPoints) { | |
547 | fPoints->Delete(); | |
548 | delete fPoints; | |
549 | fPoints = 0; | |
550 | } | |
551 | } | |
552 | ||
6644b9ca | 553 | //_______________________________________________________________________ |
fe4da5cc | 554 | void AliDetector::SetTreeAddress() |
555 | { | |
556 | // | |
557 | // Set branch address for the Hits and Digits Trees | |
558 | // | |
559 | TBranch *branch; | |
560 | char branchname[20]; | |
561 | sprintf(branchname,"%s",GetName()); | |
562 | // | |
563 | // Branch address for hit tree | |
564 | TTree *treeH = gAlice->TreeH(); | |
565 | if (treeH && fHits) { | |
566 | branch = treeH->GetBranch(branchname); | |
567 | if (branch) branch->SetAddress(&fHits); | |
568 | } | |
569 | // | |
570 | // Branch address for digit tree | |
571 | TTree *treeD = gAlice->TreeD(); | |
572 | if (treeD && fDigits) { | |
573 | branch = treeD->GetBranch(branchname); | |
574 | if (branch) branch->SetAddress(&fDigits); | |
575 | } | |
ae9676e4 | 576 | |
577 | // Branch address for tr tree | |
578 | TTree *treeTR = gAlice->TreeTR(); | |
579 | if (treeTR && fTrackReferences) { | |
580 | branch = treeTR->GetBranch(branchname); | |
581 | if (branch) branch->SetAddress(&fTrackReferences); | |
582 | } | |
fe4da5cc | 583 | } |
584 | ||
fe4da5cc | 585 |