]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Algorithmic way of getting entry index in fParticleMap. Protection of fParticleFileMa...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Feb 2001 15:45:20 +0000 (15:45 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Feb 2001 15:45:20 +0000 (15:45 +0000)
STEER/AliHeader.h
STEER/AliRun.cxx

index efaab925ff83407e66af069277e870c9db3a90f9..cef5dccd74705653d4641e5cf77c14c79520ab42 100644 (file)
@@ -19,7 +19,8 @@ public:
   virtual  Int_t GetRun() const {return fRun;}
   
   virtual  void  SetNprimary(Int_t nprimary) {fNprimary = nprimary;}
-  virtual  Int_t GetNprimary() const {return fNprimary;}
+  virtual  Int_t GetNprimary()   const {return fNprimary;}
+  virtual  Int_t GetNsecondary() const {return fNtrack-fNprimary;}
   
   virtual  void  SetNvertex(Int_t vertex) {fNvertex = vertex;}
   virtual  Int_t GetNvertex() const {return fNvertex;}
index aed2f5bd517fd19a849ed09ad6fdc63d140bb6eb..e5cfc7bdb0388cdb056094fba5e47cabce5b5024 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.55  2001/02/12 15:52:54  buncic
+Removed OpenBaseFile().
+
 Revision 1.54  2001/02/07 10:39:05  hristov
 Remove default value for argument
 
@@ -589,7 +592,11 @@ void AliRun::FinishEvent()
   // Write out the kinematics
   if (fTreeK) {
     CleanParents();
-    //    fTreeK->Fill();
+    if(fTreeK->GetEntries() ==0) {
+      // set the fParticleFileMap size for the first time
+      fParticleFileMap.Set(fHgwmk+1);
+    }
+     //    fTreeK->Fill();
     Bool_t allFilled = kFALSE;
     TObject *part;
     for(i=0; i<fHgwmk+1; ++i) if((part=fParticleMap->At(i))) {
@@ -612,6 +619,9 @@ void AliRun::FinishEvent()
     }  
   }
   
+  // Set number of tracks to event header 
+  fHeader.SetNtrack(fNtrack);
+  
   // Write out the digits
   if (fTreeD) {
     fTreeD->Fill();
@@ -1396,6 +1406,23 @@ TParticle* AliRun::Particle(Int_t i)
 {
   if(!(*fParticleMap)[i]) {
     Int_t nentries = fParticles->GetEntries();
+    
+    // algorithmic way of getting entry index
+    // (primary particles are filled after secondaries)
+    Int_t entry;
+    if (i<fHeader.GetNprimary())
+      entry = i+fHeader.GetNsecondary();
+    else 
+      entry = i-fHeader.GetNprimary();
+      
+    // only check the algorithmic way and give
+    // the fatal error if it is wrong
+    if (entry != fParticleFileMap[i]) {
+      Fatal("Particle",
+        "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
+       entry, fParticleFileMap[i]); 
+    }  
+      
     fTreeK->GetEntry(fParticleFileMap[i]);
     new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
     fParticleMap->AddAt((*fParticles)[nentries],i);