1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.82 2002/03/12 11:06:03 morsch
19 Add particle status code to argument list of SetTrack(..).
21 Revision 1.81 2001/12/19 14:46:26 morsch
22 Add possibility to disable StepManager() for each module separately.
24 Revision 1.80 2001/10/21 18:22:55 hristov
25 BranchOld replaced by Branch. It works correctly with Root 2.02.xx
27 Revision 1.79 2001/10/09 18:00:35 hristov
28 Temporary fix to provide unique event number in the simulation (J.Chudoba)
30 Revision 1.78 2001/10/04 15:30:56 hristov
31 Changes to accommodate the set of PHOS folders and tasks (Y.Schutz)
33 Revision 1.77 2001/09/04 15:09:11 hristov
34 fTreeE->Branch replaced temporary by fTreeE->BranchOld to avoid data corruption in case of many events per file
36 Revision 1.76 2001/08/03 14:38:35 morsch
37 Use original method to access TreeH.
39 Revision 1.75 2001/07/28 10:52:27 hristov
40 Event number updated correctly (M.Ivanov)
42 Revision 1.74 2001/07/28 10:39:16 morsch
43 GetEventsPerRun() method needed by afterburners added to AliRun.h
44 Corresponding setters and getters have been from AliGenerator.
46 Revision 1.73 2001/07/27 12:34:30 jchudoba
47 remove the dummy argument in fStack->GetEvent call
49 Revision 1.72 2001/07/03 08:10:57 hristov
50 J.Chudoba's changes merged correctly with the HEAD
52 Revision 1.70 2001/06/29 08:01:36 morsch
53 Small correction to the previous.
55 Revision 1.69 2001/06/28 16:27:50 morsch
56 AliReco() with user control of event range.
58 Revision 1.68 2001/06/11 13:14:40 morsch
59 SetAliGenEventHeader() method added.
61 Revision 1.67 2001/06/07 18:24:50 buncic
62 Removed compilation warning in AliConfig initialisation.
64 Revision 1.66 2001/05/22 14:32:40 hristov
67 Revision 1.65 2001/05/21 17:22:51 buncic
68 Fixed problem with missing AliConfig while reading galice.root
70 Revision 1.64 2001/05/16 14:57:22 alibrary
71 New files for folders and Stack
73 Revision 1.62 2001/04/06 11:12:33 morsch
74 Clear fParticles after each event. (Ivana Hrivnacova)
76 Revision 1.61 2001/03/30 07:04:10 morsch
77 Call fGenerator->FinishRun() for final print-outs, cross-section and weight calculations.
79 Revision 1.60 2001/03/21 18:22:30 hristov
80 fParticleFileMap fix (I.Hrivnacova)
82 Revision 1.59 2001/03/12 17:47:03 hristov
83 Changes needed on Sun with CC 5.0
85 Revision 1.58 2001/03/09 14:27:26 morsch
86 Fix for multiple events per file: inhibit decrease of size of fParticleFileMap.
88 Revision 1.57 2001/02/23 17:40:23 buncic
89 All trees needed for simulation created in RunMC(). TreeR and its branches
90 are now created in new RunReco() method.
92 Revision 1.56 2001/02/14 15:45:20 hristov
93 Algorithmic way of getting entry index in fParticleMap. Protection of fParticleFileMap (I.Hrivnacova)
95 Revision 1.55 2001/02/12 15:52:54 buncic
96 Removed OpenBaseFile().
98 Revision 1.54 2001/02/07 10:39:05 hristov
99 Remove default value for argument
101 Revision 1.53 2001/02/06 11:02:26 hristov
102 New SetTrack interface added, added check for unfilled particles in FinishEvent (I.Hrivnacova)
104 Revision 1.52 2001/02/05 16:22:25 buncic
105 Added TreeS to GetEvent().
107 Revision 1.51 2001/02/02 15:16:20 morsch
108 SetHighWaterMark method added to mark last particle in event.
110 Revision 1.50 2001/01/27 10:32:00 hristov
111 Leave the loop when primaries are filled (I.Hrivnacova)
113 Revision 1.49 2001/01/26 19:58:48 hristov
114 Major upgrade of AliRoot code
116 Revision 1.48 2001/01/17 10:50:50 hristov
117 Corrections to destructors
119 Revision 1.47 2000/12/18 10:44:01 morsch
120 Possibility to set field map by passing pointer to objet of type AliMagF via
123 gAlice->SetField(new AliMagFCM("Map2", "$(ALICE_ROOT)/data/field01.dat",2,1.,10.));
125 Revision 1.46 2000/12/14 19:29:27 fca
126 galice.cuts was not read any more
128 Revision 1.45 2000/11/30 07:12:49 alibrary
129 Introducing new Rndm and QA classes
131 Revision 1.44 2000/10/26 13:58:59 morsch
132 Add possibility to choose the lego generator (of type AliGeneratorLego or derived) when running
133 RunLego(). Default is the base class AliGeneratorLego.
135 Revision 1.43 2000/10/09 09:43:17 fca
136 Special remapping of hits for TPC and TRD. End-of-primary action introduced
138 Revision 1.42 2000/10/02 21:28:14 fca
139 Removal of useless dependecies via forward declarations
141 Revision 1.41 2000/07/13 16:19:09 fca
142 Mainly coding conventions + some small bug fixes
144 Revision 1.40 2000/07/12 08:56:25 fca
145 Coding convention correction and warning removal
147 Revision 1.39 2000/07/11 18:24:59 fca
148 Coding convention corrections + few minor bug fixes
150 Revision 1.38 2000/06/20 13:05:45 fca
151 Writing down the TREE headers before job starts
153 Revision 1.37 2000/06/09 20:05:11 morsch
154 Introduce possibility to chose magnetic field version 3: AliMagFDM + field02.dat
156 Revision 1.36 2000/06/08 14:03:58 hristov
157 Only one initializer for a default argument
159 Revision 1.35 2000/06/07 10:13:14 hristov
160 Delete only existent objects.
162 Revision 1.34 2000/05/18 10:45:38 fca
163 Delete Particle Factory properly
165 Revision 1.33 2000/05/16 13:10:40 fca
166 New method IsNewTrack and fix for a problem in Father-Daughter relations
168 Revision 1.32 2000/04/27 10:38:21 fca
169 Correct termination of Lego Run and introduce Lego getter in AliRun
171 Revision 1.31 2000/04/26 10:17:32 fca
172 Changes in Lego for G4 compatibility
174 Revision 1.30 2000/04/18 19:11:40 fca
175 Introduce variable Config.C function signature
177 Revision 1.29 2000/04/07 11:12:34 fca
178 G4 compatibility changes
180 Revision 1.28 2000/04/05 06:51:06 fca
181 Workaround for an HP compiler problem
183 Revision 1.27 2000/03/22 18:08:07 fca
184 Rationalisation of the virtual MC interfaces
186 Revision 1.26 2000/03/22 13:42:26 fca
187 SetGenerator does not replace an existing generator, ResetGenerator does
189 Revision 1.25 2000/02/23 16:25:22 fca
190 AliVMC and AliGeant3 classes introduced
191 ReadEuclid moved from AliRun to AliModule
193 Revision 1.24 2000/01/19 17:17:20 fca
194 Introducing a list of lists of hits -- more hits allowed for detector now
196 Revision 1.23 1999/12/03 11:14:31 fca
197 Fixing previous wrong checking
199 Revision 1.21 1999/11/25 10:40:08 fca
200 Fixing daughters information also in primary tracks
202 Revision 1.20 1999/10/04 18:08:49 fca
203 Adding protection against inconsistent Euclid files
205 Revision 1.19 1999/09/29 07:50:40 fca
206 Introduction of the Copyright and cvs Log
210 ///////////////////////////////////////////////////////////////////////////////
212 // Control class for Alice C++ //
213 // Only one single instance of this class exists. //
214 // The object is created in main program aliroot //
215 // and is pointed by the global gAlice. //
217 // -Supports the list of all Alice Detectors (fModules). //
218 // -Supports the list of particles (fParticles). //
219 // -Supports the Trees. //
220 // -Supports the geometry. //
221 // -Supports the event display. //
224 <img src="picts/AliRunClass.gif">
229 <img src="picts/alirun.gif">
233 ///////////////////////////////////////////////////////////////////////////////
238 #include <iostream.h>
245 #include <TObjectTable.h>
247 #include <TGeometry.h>
249 #include <TBrowser.h>
253 #include "TParticle.h"
255 #include "AliDisplay.h"
258 #include "AliMagFC.h"
259 #include "AliMagFCM.h"
260 #include "AliMagFDM.h"
262 #include "TRandom3.h"
264 #include "AliGenerator.h"
265 #include "AliLegoGenerator.h"
266 #include "AliConfig.h"
267 #include "AliStack.h"
268 #include "AliGenEventHeader.h"
269 #include "AliHeader.h"
271 #include "AliDetector.h"
277 //_____________________________________________________________________________
281 // Default constructor for AliRun
305 fPDGDB = 0; //Particle factory object!
307 fConfigFunction = "\0";
310 fTransParName = "\0";
311 fBaseFileName = ".\0";
321 //_____________________________________________________________________________
322 AliRun::AliRun(const char *name, const char *title)
326 // Constructor for the main processor.
327 // Creates the geometry
328 // Creates the list of Detectors.
329 // Creates the list of particles.
345 fConfigFunction = "Config();";
353 // Set random number generator
354 gRandom = fRandom = new TRandom3();
356 if (gSystem->Getenv("CONFIG_SEED")) {
357 gRandom->SetSeed((UInt_t)atoi(gSystem->Getenv("CONFIG_SEED")));
360 gROOT->GetListOfBrowsables()->Add(this,name);
363 fStack = new AliStack(10000);
364 // create the support list for the various Detectors
365 fModules = new TObjArray(77);
367 // Create the TNode geometry for the event display
369 BuildSimpleGeometry();
371 fHeader = new AliHeader();
378 // Create default mag field
383 // Prepare the tracking medium lists
384 fImedia = new TArrayI(1000);
385 for(i=0;i<1000;i++) (*fImedia)[i]=-99;
388 fPDGDB = TDatabasePDG::Instance(); //Particle factory object!
390 AliConfig::Instance()->Add(fPDGDB);
392 // Create HitLists list
393 fHitLists = new TList();
396 fBaseFileName = ".\0";
402 //_____________________________________________________________________________
406 // Default AliRun destructor
409 if(fTreeE)curfil=fTreeE->GetCurrentFile();
431 // avoid to delete TFile objects not owned by this object
432 // avoid multiple deletions
433 if(curfil == fTreeDFile) fTreeDFile=0;
434 if(curfil == fTreeSFile) fTreeSFile=0;
435 if(curfil == fTreeRFile) fTreeRFile=0;
436 if(fTreeSFile == fTreeDFile) fTreeSFile=0;
437 if(fTreeRFile == fTreeDFile) fTreeRFile=0;
438 if(fTreeRFile == fTreeSFile) fTreeRFile=0;
440 if(fTreeDFile->IsOpen())fTreeDFile->Close();
444 if(fTreeSFile->IsOpen())fTreeSFile->Close();
448 if(fTreeRFile->IsOpen())fTreeRFile->Close();
451 if (gROOT->GetListOfBrowsables())
452 gROOT->GetListOfBrowsables()->Remove(this);
455 //_____________________________________________________________________________
456 void AliRun::AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const
459 // Add a hit to detector id
461 TObjArray &dets = *fModules;
462 if(dets[id]) ((AliModule*) dets[id])->AddHit(track,vol,hits);
465 //_____________________________________________________________________________
466 void AliRun::AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const
469 // Add digit to detector id
471 TObjArray &dets = *fModules;
472 if(dets[id]) ((AliModule*) dets[id])->AddDigit(tracks,digits);
475 //_____________________________________________________________________________
476 void AliRun::Browse(TBrowser *b)
479 // Called when the item "Run" is clicked on the left pane
480 // of the Root browser.
481 // It displays the Root Trees and all detectors.
483 if(!fStack) fStack=fHeader->Stack();
484 TTree* pTreeK = fStack->TreeK();
486 if (pTreeK) b->Add(pTreeK,pTreeK->GetName());
487 if (fTreeH) b->Add(fTreeH,fTreeH->GetName());
488 if (fTreeD) b->Add(fTreeD,fTreeD->GetName());
489 if (fTreeE) b->Add(fTreeE,fTreeE->GetName());
490 if (fTreeR) b->Add(fTreeR,fTreeR->GetName());
491 if (fTreeS) b->Add(fTreeS,fTreeS->GetName());
493 TIter next(fModules);
495 while((detector = (AliModule*)next())) {
496 b->Add(detector,detector->GetName());
498 b->Add(fMCQA,"AliMCQA");
501 //_____________________________________________________________________________
505 // Initialize Alice geometry
510 //_____________________________________________________________________________
511 void AliRun::BuildSimpleGeometry()
514 // Create a simple TNode geometry used by Root display engine
516 // Initialise geometry
518 fGeometry = new TGeometry("AliceGeom","Galice Geometry for Hits");
519 new TMaterial("void","Vacuum",0,0,0); //Everything is void
520 TBRIK *brik = new TBRIK("S_alice","alice volume","void",2000,2000,3000);
521 brik->SetVisibility(0);
522 new TNode("alice","alice","S_alice");
525 //_____________________________________________________________________________
526 void AliRun::CleanDetectors()
529 // Clean Detectors at the end of event
531 TIter next(fModules);
533 while((detector = (AliModule*)next())) {
534 detector->FinishEvent();
538 //_____________________________________________________________________________
539 Int_t AliRun::DistancetoPrimitive(Int_t, Int_t)
542 // Return the distance from the mouse to the AliRun object
548 //_____________________________________________________________________________
549 void AliRun::DumpPart (Int_t i) const
552 // Dumps particle i in the stack
557 //_____________________________________________________________________________
558 void AliRun::DumpPStack () const
561 // Dumps the particle stack
563 fStack->DumpPStack();
566 //_____________________________________________________________________________
567 void AliRun::SetField(AliMagF* magField)
569 // Set Magnetic Field Map
574 //_____________________________________________________________________________
575 void AliRun::SetField(Int_t type, Int_t version, Float_t scale,
576 Float_t maxField, char* filename)
579 // Set magnetic field parameters
580 // type Magnetic field transport flag 0=no field, 2=helix, 3=Runge Kutta
581 // version Magnetic field map version (only 1 active now)
582 // scale Scale factor for the magnetic field
583 // maxField Maximum value for the magnetic field
586 // --- Sanity check on mag field flags
587 if(fField) delete fField;
589 fField = new AliMagFC("Map1"," ",type,scale,maxField);
590 } else if(version<=2) {
591 fField = new AliMagFCM("Map2-3",filename,type,scale,maxField);
593 } else if(version==3) {
594 fField = new AliMagFDM("Map4",filename,type,scale,maxField);
597 Warning("SetField","Invalid map %d\n",version);
601 //_____________________________________________________________________________
602 void AliRun::PreTrack()
604 TObjArray &dets = *fModules;
607 for(Int_t i=0; i<=fNdets; i++)
608 if((module = (AliModule*)dets[i]))
614 //_____________________________________________________________________________
615 void AliRun::PostTrack()
617 TObjArray &dets = *fModules;
620 for(Int_t i=0; i<=fNdets; i++)
621 if((module = (AliModule*)dets[i]))
625 //_____________________________________________________________________________
626 void AliRun::FinishPrimary()
629 // Called at the end of each primary track
632 // static Int_t count=0;
633 // const Int_t times=10;
634 // This primary is finished, purify stack
635 fStack->PurifyKine();
637 TIter next(fModules);
639 while((detector = (AliModule*)next())) {
640 detector->FinishPrimary();
643 // Write out hits if any
644 if (gAlice->TreeH()) {
645 gAlice->TreeH()->Fill();
649 // if(++count%times==1) gObjectTable->Print();
652 //_____________________________________________________________________________
653 void AliRun::BeginPrimary()
656 // Called at the beginning of each primary track
664 //_____________________________________________________________________________
665 void AliRun::FinishEvent()
668 // Called at the end of the event.
672 if(fLego) fLego->FinishEvent();
674 //Update the energy deposit tables
676 for(i=0;i<fEventEnergy.GetSize();i++) {
677 fSummEnergy[i]+=fEventEnergy[i];
678 fSum2Energy[i]+=fEventEnergy[i]*fEventEnergy[i];
683 // Update Header information
685 fHeader->SetNprimary(fStack->GetNprimary());
686 fHeader->SetNtrack(fStack->GetNtrack());
689 // Write out the kinematics
690 fStack->FinishEvent();
692 // Write out the event Header information
694 fHeader->SetStack(fStack);
699 // Write Tree headers
700 TTree* pTreeK = fStack->TreeK();
701 if (pTreeK) pTreeK->Write(0,TObject::kOverwrite);
702 if (fTreeH) fTreeH->Write(0,TObject::kOverwrite);
708 //_____________________________________________________________________________
709 void AliRun::FinishRun()
712 // Called at the end of the run.
716 if(fLego) fLego->FinishRun();
718 // Clean detector information
719 TIter next(fModules);
721 while((detector = (AliModule*)next())) {
722 detector->FinishRun();
725 //Output energy summary tables
728 TFile *file = fTreeE->GetCurrentFile();
732 fTreeE->Write(0,TObject::kOverwrite);
734 // Write AliRun info and all detectors parameters
735 Write(0,TObject::kOverwrite);
737 // Clean tree information
742 delete fTreeH; fTreeH = 0;
745 delete fTreeD; fTreeD = 0;
748 delete fTreeR; fTreeR = 0;
751 // delete fTreeE; fTreeE = 0;
754 delete fTreeS; fTreeS = 0;
756 fGenerator->FinishRun();
762 //_____________________________________________________________________________
763 void AliRun::FlagTrack(Int_t track)
767 fStack->FlagTrack(track);
770 //_____________________________________________________________________________
771 void AliRun::EnergySummary()
774 // Print summary of deposited energy
780 Int_t kn, i, left, j, id;
781 const Float_t kzero=0;
782 Int_t ievent=fHeader->GetEvent()+1;
784 // Energy loss information
786 printf("***************** Energy Loss Information per event (GEV) *****************\n");
787 for(kn=1;kn<fEventEnergy.GetSize();kn++) {
790 fEventEnergy[ndep]=kn;
795 ed2=100*TMath::Sqrt(TMath::Max(ed2-ed*ed,kzero))/ed;
798 fSummEnergy[ndep]=ed;
799 fSum2Energy[ndep]=TMath::Min((Float_t) 99.,TMath::Max(ed2,kzero));
804 for(kn=0;kn<(ndep-1)/3+1;kn++) {
806 for(i=0;i<(3<left?3:left);i++) {
808 id=Int_t (fEventEnergy[j]+0.1);
809 printf(" %s %10.3f +- %10.3f%%;",gMC->VolName(id),fSummEnergy[j],fSum2Energy[j]);
814 // Relative energy loss in different detectors
815 printf("******************** Relative Energy Loss per event ********************\n");
816 printf("Total energy loss per event %10.3f GeV\n",edtot);
817 for(kn=0;kn<(ndep-1)/5+1;kn++) {
819 for(i=0;i<(5<left?5:left);i++) {
821 id=Int_t (fEventEnergy[j]+0.1);
822 printf(" %s %10.3f%%;",gMC->VolName(id),100*fSummEnergy[j]/edtot);
826 for(kn=0;kn<75;kn++) printf("*");
830 // Reset the TArray's
831 // fEventEnergy.Set(0);
832 // fSummEnergy.Set(0);
833 // fSum2Energy.Set(0);
836 //_____________________________________________________________________________
837 AliModule *AliRun::GetModule(const char *name) const
840 // Return pointer to detector from name
842 return (AliModule*)fModules->FindObject(name);
845 //_____________________________________________________________________________
846 AliDetector *AliRun::GetDetector(const char *name) const
849 // Return pointer to detector from name
851 return (AliDetector*)fModules->FindObject(name);
854 //_____________________________________________________________________________
855 Int_t AliRun::GetModuleID(const char *name) const
858 // Return galice internal detector identifier from name
861 TObject *mod=fModules->FindObject(name);
862 if(mod) i=fModules->IndexOf(mod);
866 //_____________________________________________________________________________
867 Int_t AliRun::GetEvent(Int_t event)
870 // Connect the Trees Kinematics and Hits for event # event
871 // Set branch addresses
874 // Reset existing structures
879 // Delete Trees already connected
880 if (fTreeH) { delete fTreeH; fTreeH = 0;}
881 if (fTreeD) { delete fTreeD; fTreeD = 0;}
882 if (fTreeR) { delete fTreeR; fTreeR = 0;}
883 if (fTreeS) { delete fTreeS; fTreeS = 0;}
885 // Create the particle stack
886 if (fHeader) delete fHeader;
889 // Get header from file
891 fTreeE->SetBranchAddress("Header", &fHeader);
893 if (!fTreeE->GetEntry(event)) {
894 Error("GetEvent","Cannot find event:%d\n",event);
899 Error("GetEvent","Cannot find Header Tree (TE)\n");
903 // Get the stack from the header, set fStack to 0 if it
904 // fails to get event
905 if (fStack) delete fStack;
906 fStack = fHeader->Stack();
908 if (!fStack->GetEvent(event)) fStack = 0;
912 TFile *file = fTreeE->GetCurrentFile();
917 // Get Hits Tree header from file
918 sprintf(treeName,"TreeH%d",event);
919 fTreeH = (TTree*)gDirectory->Get(treeName);
921 Error("GetEvent","cannot find Hits Tree for event:%d\n",event);
924 // get current file name and compare with names containing trees S,D,R
925 TString curfilname=(TString)fTreeE->GetCurrentFile()->GetName();
926 if(fTreeDFileName==curfilname)fTreeDFileName="";
927 if(fTreeSFileName==curfilname)fTreeSFileName="";
928 if(fTreeRFileName==curfilname)fTreeRFileName="";
929 // Get Digits Tree header from file
930 sprintf(treeName,"TreeD%d",event);
932 if (!fTreeDFile && fTreeDFileName != "") {
933 InitTreeFile("D",fTreeDFileName);
936 fTreeD = (TTree*)fTreeDFile->Get(treeName);
938 fTreeD = (TTree*)file->Get(treeName);
941 // Warning("GetEvent","cannot find Digits Tree for event:%d\n",event);
943 if(fTreeDFileName != ""){
944 if(fTreeDFileName==fTreeSFileName) {
946 fTreeSFile = fTreeDFile;
948 if(fTreeDFileName==fTreeRFileName) {
950 fTreeRFile = fTreeDFile;
956 // Get SDigits Tree header from file
957 sprintf(treeName,"TreeS%d",event);
958 if (!fTreeSFile && fTreeSFileName != "") {
959 InitTreeFile("S",fTreeSFileName);
962 fTreeS = (TTree*)fTreeSFile->Get(treeName);
964 fTreeS = (TTree*)gDirectory->Get(treeName);
967 // Warning("GetEvent","cannot find SDigits Tree for event:%d\n",event);
970 if(fTreeSFileName != ""){
971 if(fTreeSFileName==fTreeRFileName){
973 fTreeRFile = fTreeSFile;
979 // Get Reconstruct Tree header from file
980 sprintf(treeName,"TreeR%d",event);
981 if (!fTreeRFile && fTreeRFileName != "") {
982 InitTreeFile("R",fTreeRFileName);
985 fTreeR = (TTree*)fTreeRFile->Get(treeName);
987 fTreeR = (TTree*)gDirectory->Get(treeName);
990 // printf("WARNING: cannot find Reconstructed Tree for event:%d\n",event);
995 // Set Trees branch addresses
996 TIter next(fModules);
998 while((detector = (AliModule*)next())) {
999 detector->SetTreeAddress();
1002 fEvent=event; //MI change
1004 return fHeader->GetNtrack();
1007 //_____________________________________________________________________________
1008 TGeometry *AliRun::GetGeometry()
1011 // Import Alice geometry from current file
1012 // Return pointer to geometry object
1014 if (!fGeometry) fGeometry = (TGeometry*)gDirectory->Get("AliceGeom");
1016 // Unlink and relink nodes in detectors
1017 // This is bad and there must be a better way...
1020 TIter next(fModules);
1021 AliModule *detector;
1022 while((detector = (AliModule*)next())) {
1023 TList *dnodes=detector->Nodes();
1025 TNode *node, *node1;
1026 for ( j=0; j<dnodes->GetSize(); j++) {
1027 node = (TNode*) dnodes->At(j);
1028 node1 = fGeometry->GetNode(node->GetName());
1029 dnodes->Remove(node);
1030 dnodes->AddAt(node1,j);
1036 //_____________________________________________________________________________
1037 void AliRun::GetNextTrack(Int_t &mtrack, Int_t &ipart, Float_t *pmom,
1038 Float_t &e, Float_t *vpos, Float_t *polar,
1041 // Delegate to stack
1043 fStack->GetNextTrack(mtrack, ipart, pmom, e, vpos, polar, tof);
1046 //_____________________________________________________________________________
1047 Int_t AliRun::GetPrimary(Int_t track) const
1050 // return number of primary that has generated track
1052 return fStack->GetPrimary(track);
1055 //_____________________________________________________________________________
1056 void AliRun::InitMC(const char *setup)
1059 // Initialize the Alice setup
1063 Warning("Init","Cannot initialise AliRun twice!\n");
1067 gROOT->LoadMacro(setup);
1068 gInterpreter->ProcessLine(fConfigFunction.Data());
1071 gMC->DefineParticles(); //Create standard MC particles
1073 TObject *objfirst, *objlast;
1075 fNdets = fModules->GetLast()+1;
1078 //=================Create Materials and geometry
1081 // Added also after in case of interactive initialisation of modules
1082 fNdets = fModules->GetLast()+1;
1084 TIter next(fModules);
1085 AliModule *detector;
1086 while((detector = (AliModule*)next())) {
1087 detector->SetTreeAddress();
1088 objlast = gDirectory->GetList()->Last();
1090 // Add Detector histograms in Detector list of histograms
1091 if (objlast) objfirst = gDirectory->GetList()->After(objlast);
1092 else objfirst = gDirectory->GetList()->First();
1094 detector->Histograms()->Add(objfirst);
1095 objfirst = gDirectory->GetList()->After(objfirst);
1098 ReadTransPar(); //Read the cuts for all materials
1100 MediaTable(); //Build the special IMEDIA table
1102 //Initialise geometry deposition table
1103 fEventEnergy.Set(gMC->NofVolumes()+1);
1104 fSummEnergy.Set(gMC->NofVolumes()+1);
1105 fSum2Energy.Set(gMC->NofVolumes()+1);
1107 //Compute cross-sections
1108 gMC->BuildPhysics();
1110 //Write Geometry object to current file.
1115 fMCQA = new AliMCQA(fNdets);
1117 // JCH note: the following line is useless, AliConfig instance is already
1118 // created in AliMC ctor. But it does not hurt.
1119 AliConfig::Instance();
1121 // Save stuff at the beginning of the file to avoid file corruption
1125 //_____________________________________________________________________________
1126 void AliRun::MediaTable()
1129 // Built media table to get from the media number to
1132 Int_t kz, nz, idt, lz, i, k, ind;
1134 TObjArray &dets = *gAlice->Detectors();
1137 // For all detectors
1138 for (kz=0;kz<fNdets;kz++) {
1139 // If detector is defined
1140 if((det=(AliModule*) dets[kz])) {
1141 TArrayI &idtmed = *(det->GetIdtmed());
1142 for(nz=0;nz<100;nz++) {
1143 // Find max and min material number
1144 if((idt=idtmed[nz])) {
1145 det->LoMedium() = det->LoMedium() < idt ? det->LoMedium() : idt;
1146 det->HiMedium() = det->HiMedium() > idt ? det->HiMedium() : idt;
1149 if(det->LoMedium() > det->HiMedium()) {
1150 det->LoMedium() = 0;
1151 det->HiMedium() = 0;
1153 if(det->HiMedium() > fImedia->GetSize()) {
1154 Error("MediaTable","Increase fImedia from %d to %d",
1155 fImedia->GetSize(),det->HiMedium());
1158 // Tag all materials in rage as belonging to detector kz
1159 for(lz=det->LoMedium(); lz<= det->HiMedium(); lz++) {
1166 // Print summary table
1167 printf(" Traking media ranges:\n");
1168 for(i=0;i<(fNdets-1)/6+1;i++) {
1169 for(k=0;k< (6<fNdets-i*6?6:fNdets-i*6);k++) {
1171 det=(AliModule*)dets[ind];
1173 printf(" %6s: %3d -> %3d;",det->GetName(),det->LoMedium(),
1176 printf(" %6s: %3d -> %3d;","NULL",0,0);
1182 //____________________________________________________________________________
1183 void AliRun::SetGenerator(AliGenerator *generator)
1186 // Load the event generator
1188 if(!fGenerator) fGenerator = generator;
1191 //____________________________________________________________________________
1192 void AliRun::ResetGenerator(AliGenerator *generator)
1195 // Load the event generator
1199 Warning("ResetGenerator","Replacing generator %s with %s\n",
1200 fGenerator->GetName(),generator->GetName());
1202 Warning("ResetGenerator","Replacing generator %s with NULL\n",
1203 fGenerator->GetName());
1204 fGenerator = generator;
1207 //____________________________________________________________________________
1208 void AliRun::SetTransPar(char *filename)
1210 fTransParName = filename;
1213 //____________________________________________________________________________
1214 void AliRun::SetBaseFile(char *filename)
1216 fBaseFileName = filename;
1219 //____________________________________________________________________________
1220 void AliRun::ReadTransPar()
1223 // Read filename to set the transport parameters
1227 const Int_t kncuts=10;
1228 const Int_t knflags=11;
1229 const Int_t knpars=kncuts+knflags;
1230 const char kpars[knpars][7] = {"CUTGAM" ,"CUTELE","CUTNEU","CUTHAD","CUTMUO",
1231 "BCUTE","BCUTM","DCUTE","DCUTM","PPCUTM","ANNI",
1232 "BREM","COMP","DCAY","DRAY","HADR","LOSS",
1233 "MULS","PAIR","PHOT","RAYL"};
1237 Float_t cut[kncuts];
1238 Int_t flag[knflags];
1239 Int_t i, itmed, iret, ktmed, kz;
1242 // See whether the file is there
1243 filtmp=gSystem->ExpandPathName(fTransParName.Data());
1244 lun=fopen(filtmp,"r");
1247 Warning("ReadTransPar","File %s does not exist!\n",fTransParName.Data());
1252 printf(" "); for(i=0;i<60;i++) printf("*"); printf("\n");
1253 printf(" *%59s\n","*");
1254 printf(" * Please check carefully what you are doing!%10s\n","*");
1255 printf(" *%59s\n","*");
1259 // Initialise cuts and flags
1260 for(i=0;i<kncuts;i++) cut[i]=-99;
1261 for(i=0;i<knflags;i++) flag[i]=-99;
1263 for(i=0;i<256;i++) line[i]='\0';
1264 // Read up to the end of line excluded
1265 iret=fscanf(lun,"%[^\n]",line);
1270 printf(" *%59s\n","*");
1271 printf(" "); for(i=0;i<60;i++) printf("*"); printf("\n");
1275 // Read the end of line
1278 if(line[0]=='*') continue;
1280 iret=sscanf(line,"%s %d %f %f %f %f %f %f %f %f %f %f %d %d %d %d %d %d %d %d %d %d %d",
1281 detName,&itmed,&cut[0],&cut[1],&cut[2],&cut[3],&cut[4],&cut[5],&cut[6],&cut[7],&cut[8],
1282 &cut[9],&flag[0],&flag[1],&flag[2],&flag[3],&flag[4],&flag[5],&flag[6],&flag[7],
1283 &flag[8],&flag[9],&flag[10]);
1287 Warning("ReadTransPar","Error reading file %s\n",fTransParName.Data());
1290 // Check that the module exist
1291 AliModule *mod = GetModule(detName);
1293 // Get the array of media numbers
1294 TArrayI &idtmed = *mod->GetIdtmed();
1295 // Check that the tracking medium code is valid
1296 if(0<=itmed && itmed < 100) {
1297 ktmed=idtmed[itmed];
1299 Warning("ReadTransPar","Invalid tracking medium code %d for %s\n",itmed,mod->GetName());
1302 // Set energy thresholds
1303 for(kz=0;kz<kncuts;kz++) {
1305 if(fDebug) printf(" * %-6s set to %10.3E for tracking medium code %4d for %s\n",
1306 kpars[kz],cut[kz],itmed,mod->GetName());
1307 gMC->Gstpar(ktmed,kpars[kz],cut[kz]);
1310 // Set transport mechanisms
1311 for(kz=0;kz<knflags;kz++) {
1313 if(fDebug) printf(" * %-6s set to %10d for tracking medium code %4d for %s\n",
1314 kpars[kncuts+kz],flag[kz],itmed,mod->GetName());
1315 gMC->Gstpar(ktmed,kpars[kncuts+kz],Float_t(flag[kz]));
1319 Warning("ReadTransPar","Invalid medium code %d *\n",itmed);
1323 if(fDebug) printf("%s::ReadTransParModule: %s not present\n",ClassName(),detName);
1330 //_____________________________________________________________________________
1331 void AliRun::MakeTree(Option_t *option, const char *file)
1334 // Create the ROOT trees
1335 // Loop on all detectors to create the Root branch (if any)
1341 const char *oK = strstr(option,"K");
1342 const char *oH = strstr(option,"H");
1343 const char *oE = strstr(option,"E");
1344 const char *oD = strstr(option,"D");
1345 const char *oR = strstr(option,"R");
1346 const char *oS = strstr(option,"S");
1349 TDirectory *cwd = gDirectory;
1351 TBranch *branch = 0;
1353 if (oK) fStack->MakeTree(fEvent, file);
1355 if (oE && !fTreeE) {
1356 fTreeE = new TTree("TE","Header");
1357 // branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0);
1358 branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0);
1359 branch->SetAutoDelete(kFALSE);
1360 TFolder *folder = (TFolder *)gROOT->FindObjectAny("/Folders/RunMC/Event/Header");
1361 if (folder) folder->Add(fHeader);
1362 // branch = fTreeE->Branch("Stack","AliStack", &fStack, 4000, 0);
1363 // branch->SetAutoDelete(kFALSE);
1364 // if (folder) folder->Add(fStack);
1365 fTreeE->Write(0,TObject::kOverwrite);
1368 if (file && branch) {
1369 char * outFile = new char[strlen(gAlice->GetBaseFile())+strlen(file)+2];
1370 sprintf(outFile,"%s/%s",GetBaseFile(),file);
1371 branch->SetFile(outFile);
1372 TIter next( branch->GetListOfBranches());
1373 while ((branch=(TBranch*)next())) {
1374 branch->SetFile(outFile);
1377 printf("* MakeBranch * Diverting Branch %s to file %s\n", branch->GetName(),file);
1382 if (oH && !fTreeH) {
1383 sprintf(hname,"TreeH%d",fEvent);
1384 fTreeH = new TTree(hname,"Hits");
1385 fTreeH->SetAutoSave(1000000000); //no autosave
1386 fTreeH->Write(0,TObject::kOverwrite);
1388 if (oD && !fTreeD) {
1389 sprintf(hname,"TreeD%d",fEvent);
1390 fTreeD = new TTree(hname,"Digits");
1391 fTreeD->Write(0,TObject::kOverwrite);
1393 if (oS && !fTreeS) {
1394 sprintf(hname,"TreeS%d",fEvent);
1395 fTreeS = new TTree(hname,"SDigits");
1396 fTreeS->Write(0,TObject::kOverwrite);
1398 if (oR && !fTreeR) {
1399 sprintf(hname,"TreeR%d",fEvent);
1400 fTreeR = new TTree(hname,"Reconstruction");
1401 fTreeR->Write(0,TObject::kOverwrite);
1405 // Create a branch for hits/digits for each detector
1406 // Each branch is a TClonesArray. Each data member of the Hits classes
1407 // will be in turn a subbranch of the detector master branch
1408 TIter next(fModules);
1409 AliModule *detector;
1410 while((detector = (AliModule*)next())) {
1411 if (oH) detector->MakeBranch(option,file);
1415 //_____________________________________________________________________________
1416 TParticle* AliRun::Particle(Int_t i)
1418 return fStack->Particle(i);
1421 //_____________________________________________________________________________
1422 void AliRun::BeginEvent()
1424 // Clean-up previous event
1426 fEventEnergy.Reset();
1427 // Clean detector information
1434 // Reset all Detectors & kinematics & trees
1438 // Initialise event header
1439 fHeader->Reset(fRun,fEvent,fEventNrInRun);
1441 fStack->BeginEvent(fEvent);
1445 fLego->BeginEvent();
1458 sprintf(hname,"TreeH%d",fEvent);
1459 fTreeH->SetName(hname);
1463 sprintf(hname,"TreeD%d",fEvent);
1464 fTreeD->SetName(hname);
1465 fTreeD->Write(0,TObject::kOverwrite);
1469 sprintf(hname,"TreeS%d",fEvent);
1470 fTreeS->SetName(hname);
1471 fTreeS->Write(0,TObject::kOverwrite);
1475 sprintf(hname,"TreeR%d",fEvent);
1476 fTreeR->SetName(hname);
1477 fTreeR->Write(0,TObject::kOverwrite);
1480 //_____________________________________________________________________________
1481 void AliRun::ResetDigits()
1484 // Reset all Detectors digits
1486 TIter next(fModules);
1487 AliModule *detector;
1488 while((detector = (AliModule*)next())) {
1489 detector->ResetDigits();
1493 //_____________________________________________________________________________
1494 void AliRun::ResetSDigits()
1497 // Reset all Detectors digits
1499 TIter next(fModules);
1500 AliModule *detector;
1501 while((detector = (AliModule*)next())) {
1502 detector->ResetSDigits();
1506 //_____________________________________________________________________________
1507 void AliRun::ResetHits()
1510 // Reset all Detectors hits
1512 TIter next(fModules);
1513 AliModule *detector;
1514 while((detector = (AliModule*)next())) {
1515 detector->ResetHits();
1519 //_____________________________________________________________________________
1520 void AliRun::ResetPoints()
1523 // Reset all Detectors points
1525 TIter next(fModules);
1526 AliModule *detector;
1527 while((detector = (AliModule*)next())) {
1528 detector->ResetPoints();
1532 //_____________________________________________________________________________
1533 void AliRun::RunMC(Int_t nevent, const char *setup)
1536 // Main function to be called to process a galice run
1538 // Root > gAlice.Run();
1539 // a positive number of events will cause the finish routine
1542 fEventsPerRun = nevent;
1543 // check if initialisation has been done
1544 if (!fInitDone) InitMC(setup);
1546 // Create the Root Tree with one branch per detector
1550 if (gSystem->Getenv("CONFIG_SPLIT_FILE")) {
1551 MakeTree("K","Kine.root");
1552 MakeTree("H","Hits.root");
1557 gMC->ProcessRun(nevent);
1559 // End of this run, close files
1560 if(nevent>0) FinishRun();
1563 //_____________________________________________________________________________
1564 void AliRun::RunReco(const char *selected, Int_t first, Int_t last)
1567 // Main function to be called to reconstruct Alice event
1569 cout << "Found "<< gAlice->TreeE()->GetEntries() << "events" << endl;
1570 Int_t nFirst = first;
1571 Int_t nLast = (last < 0)? (Int_t) gAlice->TreeE()->GetEntries() : last;
1573 for (Int_t nevent = nFirst; nevent <= nLast; nevent++) {
1574 cout << "Processing event "<< nevent << endl;
1577 Digits2Reco(selected);
1581 //_____________________________________________________________________________
1583 void AliRun::Hits2Digits(const char *selected)
1586 // Convert Hits to sumable digits
1588 for (Int_t nevent=0; nevent<gAlice->TreeE()->GetEntries(); nevent++) {
1591 Hits2SDigits(selected);
1592 SDigits2Digits(selected);
1597 //_____________________________________________________________________________
1599 void AliRun::Tree2Tree(Option_t *option, const char *selected)
1602 // Function to transform the content of
1604 // - TreeH to TreeS (option "S")
1605 // - TreeS to TreeD (option "D")
1606 // - TreeD to TreeR (option "R")
1608 // If multiple options are specified ("SDR"), transformation will be done in sequence for
1609 // selected detector and for all detectors if none is selected (detector string
1610 // can contain blank separated list of detector names).
1613 const char *oS = strstr(option,"S");
1614 const char *oD = strstr(option,"D");
1615 const char *oR = strstr(option,"R");
1617 TObjArray *detectors = Detectors();
1619 TIter next(detectors);
1621 AliDetector *detector = 0;
1623 TDirectory *cwd = gDirectory;
1627 while((detector = (AliDetector*)next())) {
1629 if (strcmp(detector->GetName(),selected)) continue;
1630 if (detector->IsActive()){
1631 if (gSystem->Getenv("CONFIG_SPLIT_FILE")) {
1633 sprintf(outFile,"SDigits.%s.root",detector->GetName());
1634 detector->MakeBranch("S",outFile);
1637 sprintf(outFile,"Digits.%s.root",detector->GetName());
1638 detector->MakeBranch("D",outFile);
1641 sprintf(outFile,"Reco.%s.root",detector->GetName());
1642 detector->MakeBranch("R",outFile);
1645 detector->MakeBranch(option);
1651 cout << "Hits2SDigits: Processing " << detector->GetName() << "..." << endl;
1652 detector->Hits2SDigits();
1655 cout << "SDigits2Digits: Processing " << detector->GetName() << "..." << endl;
1656 detector->SDigits2Digits();
1659 cout << "Digits2Reco: Processing " << detector->GetName() << "..." << endl;
1660 detector->Digits2Reco();
1669 //_____________________________________________________________________________
1670 void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min,
1671 Float_t c1max,Int_t nc2,Float_t c2min,Float_t c2max,
1672 Float_t rmin,Float_t rmax,Float_t zmax, AliLegoGenerator* gener)
1675 // Generates lego plots of:
1676 // - radiation length map phi vs theta
1677 // - radiation length map phi vs eta
1678 // - interaction length map
1679 // - g/cm2 length map
1681 // ntheta bins in theta, eta
1682 // themin minimum angle in theta (degrees)
1683 // themax maximum angle in theta (degrees)
1685 // phimin minimum angle in phi (degrees)
1686 // phimax maximum angle in phi (degrees)
1687 // rmin minimum radius
1688 // rmax maximum radius
1691 // The number of events generated = ntheta*nphi
1692 // run input parameters in macro setup (default="Config.C")
1694 // Use macro "lego.C" to visualize the 3 lego plots in spherical coordinates
1697 <img src="picts/AliRunLego1.gif">
1702 <img src="picts/AliRunLego2.gif">
1707 <img src="picts/AliRunLego3.gif">
1712 // check if initialisation has been done
1713 if (!fInitDone) InitMC(setup);
1714 //Save current generator
1715 AliGenerator *gen=Generator();
1717 // Set new generator
1718 if (!gener) gener = new AliLegoGenerator();
1719 ResetGenerator(gener);
1721 // Configure Generator
1722 gener->SetRadiusRange(rmin, rmax);
1723 gener->SetZMax(zmax);
1724 gener->SetCoor1Range(nc1, c1min, c1max);
1725 gener->SetCoor2Range(nc2, c2min, c2max);
1728 //Create Lego object
1729 fLego = new AliLego("lego",gener);
1731 //Prepare MC for Lego Run
1736 gMC->ProcessRun(nc1*nc2+1);
1738 // Create only the Root event Tree
1741 // End of this run, close files
1743 // Restore current generator
1744 ResetGenerator(gen);
1745 // Delete Lego Object
1746 delete fLego; fLego=0;
1749 //_____________________________________________________________________________
1750 void AliRun::SetConfigFunction(const char * config)
1753 // Set the signature of the function contained in Config.C to configure
1756 fConfigFunction=config;
1759 //_____________________________________________________________________________
1760 void AliRun::SetCurrentTrack(Int_t track)
1763 // Set current track number
1765 fStack->SetCurrentTrack(track);
1768 //_____________________________________________________________________________
1769 void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
1770 Float_t *vpos, Float_t *polar, Float_t tof,
1771 AliMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
1773 // Delegate to stack
1775 fStack->SetTrack(done, parent, pdg, pmom, vpos, polar, tof,
1776 mech, ntr, weight, is);
1779 //_____________________________________________________________________________
1780 void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg,
1781 Double_t px, Double_t py, Double_t pz, Double_t e,
1782 Double_t vx, Double_t vy, Double_t vz, Double_t tof,
1783 Double_t polx, Double_t poly, Double_t polz,
1784 AliMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
1786 // Delegate to stack
1788 fStack->SetTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof,
1789 polx, poly, polz, mech, ntr, weight, is);
1793 //_____________________________________________________________________________
1794 void AliRun::SetHighWaterMark(const Int_t nt)
1797 // Set high water mark for last track in event
1798 fStack->SetHighWaterMark(nt);
1801 //_____________________________________________________________________________
1802 void AliRun::KeepTrack(const Int_t track)
1805 // Delegate to stack
1807 fStack->KeepTrack(track);
1810 //_____________________________________________________________________________
1811 void AliRun::StepManager(Int_t id)
1814 // Called at every step during transport
1818 // --- If lego option, do it and leave
1820 fLego->StepManager();
1823 //Update energy deposition tables
1824 AddEnergyDeposit(gMC->CurrentVolID(copy),gMC->Edep());
1826 //Call the appropriate stepping routine;
1827 AliModule *det = (AliModule*)fModules->At(id);
1828 if(det && det->StepManagerIsEnabled()) {
1829 fMCQA->StepManager(id);
1835 //_____________________________________________________________________________
1836 void AliRun::Streamer(TBuffer &R__b)
1838 // Stream an object of class AliRun.
1840 if (R__b.IsReading()) {
1841 if (!gAlice) gAlice = this;
1843 AliRun::Class()->ReadBuffer(R__b, this);
1845 gROOT->GetListOfBrowsables()->Add(this,"Run");
1847 fTreeE = (TTree*)gDirectory->Get("TE");
1849 fTreeE->SetBranchAddress("Header", &fHeader);
1852 else Error("Streamer","cannot find Header Tree\n");
1853 fTreeE->GetEntry(0);
1857 AliRun::Class()->WriteBuffer(R__b, this);
1862 //___________________________________________________________________________
1863 Int_t AliRun::CurrentTrack() const {
1865 // Returns current track
1867 return fStack->CurrentTrack();
1870 //___________________________________________________________________________
1871 Int_t AliRun::GetNtrack() const {
1873 // Returns number of tracks in stack
1875 return fStack->GetNtrack();
1878 //___________________________________________________________________________
1879 TObjArray* AliRun::Particles() {
1881 // Returns pointer to Particles array
1883 return fStack->Particles();
1886 //___________________________________________________________________________
1887 TTree* AliRun::TreeK() {
1889 // Returns pointer to the TreeK array
1891 return fStack->TreeK();
1894 ////////////////////////////////////////////////////////////////////////
1895 void AliRun::SetGenEventHeader(AliGenEventHeader* header)
1897 fHeader->SetGenEventHeader(header);
1899 ////////////////////////////////////////////////////////////////////////
1900 TFile* AliRun::InitFile(TString fileName)
1903 // create the file where the whole tree will be saved
1905 TDirectory *wd = gDirectory;
1906 TFile* file = TFile::Open(fileName,"update");
1908 if (!file->IsOpen()) {
1909 Error("Cannot open file, %s\n",fileName);
1915 ////////////////////////////////////////////////////////////////////////
1916 TFile* AliRun::InitTreeFile(Option_t *option, TString fileName)
1919 // create the file where one of the following trees will be saved
1922 Bool_t oS = (strstr(option,"S")!=0);
1923 Bool_t oR = (strstr(option,"R")!=0);
1924 Bool_t oD = (strstr(option,"D")!=0);
1925 Bool_t none = !(oS || oR || oD);
1928 Warning("InitTreeFile","wrong option - nothing done\n");
1931 fTreeSFileName=fileName;
1933 if (fTreeSFile->IsOpen()) {
1934 Warning("InitTreeSFile","File already opened");
1937 fTreeSFile = InitFile(fileName);
1942 fTreeDFileName=fileName;
1943 if(oS)fTreeDFile = fTreeSFile;
1945 if (fTreeDFile->IsOpen()) {
1946 Warning("InitTreeDFile","File already opened");
1949 fTreeDFile = InitFile(fileName);
1954 fTreeRFileName=fileName;
1955 if(oS)fTreeRFile = fTreeSFile;
1956 if(oD)fTreeRFile = fTreeDFile;
1958 if (fTreeRFile->IsOpen()) {
1959 Warning("InitTreeRFile","File already opened");
1962 fTreeRFile = InitFile(fileName);
1969 ////////////////////////////////////////////////////////////////////////
1970 void AliRun::MakeTree(Option_t *option, TFile *file)
1973 // Create some trees in the separate file
1975 const char *oD = strstr(option,"D");
1976 const char *oR = strstr(option,"R");
1977 const char *oS = strstr(option,"S");
1979 TDirectory *cwd = gDirectory;
1984 sprintf(hname,"TreeD%d",fEvent);
1986 fTreeD = static_cast<TTree*>(file->Get("hname"));
1988 fTreeD = new TTree(hname,"Digits");
1989 fTreeD->Write(0,TObject::kOverwrite);
1995 sprintf(hname,"TreeS%d",fEvent);
1997 fTreeS = static_cast<TTree*>(file->Get("hname"));
1999 fTreeS = new TTree(hname,"SDigits");
2000 fTreeS->Write(0,TObject::kOverwrite);
2007 sprintf(hname,"TreeR%d",fEvent);
2009 fTreeR = static_cast<TTree*>(file->Get("hname"));
2011 fTreeR = new TTree(hname,"RecPoint");
2012 fTreeR->Write(0,TObject::kOverwrite);
2017 ////////////////////////////////////////////////////////////////////////