]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSvFast.cxx
Bug correction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSvFast.cxx
index a69be991927c3ee227ee2fb85ec185fa19078b96..816cb09ceba55a76888e790a45c2429b6cd6d884 100644 (file)
@@ -1,4 +1,4 @@
-/**************************************************************************
+  /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
 
 // --- ROOT system ---
  
-#include "TBRIK.h"
-#include "TNode.h"
-#include "TParticle.h"
-#include "TTree.h"
-#include "TGeometry.h"
-#include "TFile.h"
+#include <TBRIK.h>
+#include <TGeometry.h>
+#include <TNode.h>
+#include <TParticle.h>
+#include "TClonesArray.h" 
+#include <TVirtualMC.h>
 
 // --- Standard library ---
 
-#include <stdio.h>
-
 // --- AliRoot header files ---
 #include "AliPHOSFastRecParticle.h"
 #include "AliPHOSGeometry.h"
+#include "AliPHOSLoader.h"
 #include "AliPHOSvFast.h"
-#include "AliPHOSGetter.h"
 #include "AliRun.h"
-#include "AliConst.h"
-#include "AliMC.h"
 
 ClassImp(AliPHOSvFast)
 
@@ -76,26 +72,24 @@ AliPHOSvFast::AliPHOSvFast(const char *name, const char *title):
   // ctor
 
   
-  // create the geometry parameters object  
-  // and post it to a folder (Post retrieves the correct geometry)
-  AliPHOSGetter::GetInstance(gDirectory->GetName(), 0)->PostGeometry() ;    
-    
-    SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
-    SetBigBox(1, GetGeometry()->GetOuterBoxSize(3) + GetGeometry()->GetCPVBoxSize(1) ) ; 
-    SetBigBox(2, GetGeometry()->GetOuterBoxSize(2) ); 
-    
-    fNRecParticles = 0 ; 
-    fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
-
-    fResPara1 = 0.030 ;    // GeV
-    fResPara2 = 0.00003 ; 
-    fResPara3 = 0.00001 ; 
-    
-    fPosParaA0 = 2.87 ;    // mm
-    fPosParaA1 = -0.0975 ;  
-    fPosParaB0 = 0.257 ;   
-    fPosParaB1 = 0.137 ; 
-    fPosParaB2 = 0.00619 ; 
+  // create the Loader 
+  
+  SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
+  SetBigBox(1, GetGeometry()->GetOuterBoxSize(3) + GetGeometry()->GetCPVBoxSize(1) ) ; 
+  SetBigBox(2, GetGeometry()->GetOuterBoxSize(2) ); 
+  
+  fNRecParticles = 0 ; 
+  fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
+  
+  fResPara1 = 0.030 ;    // GeV
+  fResPara2 = 0.00003 ; 
+  fResPara3 = 0.00001 ; 
+  
+  fPosParaA0 = 2.87 ;    // mm
+  fPosParaA1 = -0.0975 ;  
+  fPosParaB0 = 0.257 ;   
+  fPosParaB1 = 0.137 ; 
+  fPosParaB2 = 0.00619 ; 
 }
 
 //____________________________________________________________________________
@@ -109,6 +103,29 @@ AliPHOSvFast::~AliPHOSvFast()
 
 }
 
+//____________________________________________________________________________
+void AliPHOSvFast::Copy(AliPHOSvFast & fast)
+{
+  TObject::Copy(fast) ; 
+  AliPHOS::Copy(fast) ; 
+  fast.fBigBoxX = fBigBoxX ; 
+  fast.fBigBoxY = fBigBoxY ; 
+  fast.fBigBoxZ = fBigBoxZ ;
+  fast.fNRecParticles = fNRecParticles ;
+  fast.fRan = fRan ; 
+  fast.fResPara1 = fResPara1 ; 
+  fast.fResPara2 = fResPara2 ; 
+  fast.fResPara3 = fResPara3 ;
+  fast.fPosParaA0 = fPosParaA0 ;
+  fast.fPosParaA1 = fPosParaA1 ; 
+  fast.fPosParaB0 = fPosParaB0 ;
+  fast.fPosParaB1 = fPosParaB1 ;
+  fast.fFastRecParticles = new TClonesArray(fFastRecParticles->GetClass()->GetName(), 100) ; 
+  Int_t index ; 
+  for (index = 0 ; index < fFastRecParticles->GetEntries(); index++) 
+    (fast.fFastRecParticles)->AddAt(fFastRecParticles->At(index), index) ;
+}
+
 //____________________________________________________________________________
 void AliPHOSvFast::AddRecParticle(const AliPHOSFastRecParticle & rp)
 {  
@@ -142,7 +159,7 @@ void AliPHOSvFast::BuildGeometry()
  
   const Int_t kColorPHOS = kRed ;
   
-  Double_t const kRADDEG = 180.0 / kPI ;
+  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
   
   new TBRIK( "BigBox", "PHOS box", "void", GetBigBox(0)/2, 
             GetBigBox(1)/2, 
@@ -202,7 +219,7 @@ void AliPHOSvFast::CreateGeometry()
   // --- Position  PHOS mdules in ALICE setup ---
   
   Int_t idrotm[99] ;
-  Double_t const kRADDEG = 180.0 / kPI ;
+  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
   
   for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) {
     
@@ -260,26 +277,21 @@ Float_t AliPHOSvFast::GetBigBox(Int_t index) const
  }
   return rv ; 
 }
-
 //___________________________________________________________________________
-void AliPHOSvFast::MakeBranch(Option_t* opt, const char *file)
+
+void AliPHOSvFast::MakeBranch(Option_t* opt)
 {  
   // Create new branch in the current reconstructed Root Tree
-  AliDetector::MakeBranch(opt,file) ;
-  
-  char branchname[10];
-  sprintf(branchname,"%s",GetName());
+  AliDetector::MakeBranch(opt);
   const char *cd = strstr(opt,"R");
   
-  if (fFastRecParticles && gAlice->TreeR() && cd) {
-    MakeBranchInTree(gAlice->TreeR(), 
-                     branchname, &fFastRecParticles, fBufferSize, file);
+  if (fFastRecParticles && fLoader->TreeR() && cd) {
+    MakeBranchInTree(fLoader->TreeR(), GetName(), &fFastRecParticles, fBufferSize, 0);
   }
 }
-
 //____________________________________________________________________________
-Double_t AliPHOSvFast::MakeEnergy(const Double_t energy)
+
+Double_t AliPHOSvFast::MakeEnergy(Double_t energy)
 {  
   // Smears the energy according to the energy dependent energy resolution.
   // A gaussian distribution is assumed
@@ -287,9 +299,9 @@ Double_t AliPHOSvFast::MakeEnergy(const Double_t energy)
   Double_t sigma  = SigmaE(energy) ; 
   return  fRan.Gaus(energy, sigma) ;   
 }
-
 //____________________________________________________________________________
-TVector3 AliPHOSvFast::MakePosition(const Double_t energy, const TVector3 pos, const Double_t theta, const Double_t phi)
+
+TVector3 AliPHOSvFast::MakePosition(Double_t energy, TVector3 pos, Double_t theta, Double_t phi)
 {
   // Smears the impact position according to the energy dependent position resolution
   // A gaussian position distribution is assumed
@@ -309,7 +321,7 @@ TVector3 AliPHOSvFast::MakePosition(const Double_t energy, const TVector3 pos, c
 }
 
 //____________________________________________________________________________
-void AliPHOSvFast::MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHOSFastRecParticle & rp)
+void AliPHOSvFast::MakeRecParticle(Int_t modid, TVector3 pos, AliPHOSFastRecParticle & rp)
 {
   // Modify the primary particle properties according
   //  1. the response function of PHOS
@@ -358,8 +370,8 @@ Int_t AliPHOSvFast::MakeType(AliPHOSFastRecParticle & rp )
   else
     test = rp.GetPdgCode() ; 
 
-  cout << " SHOULD NOT BE USED until values of probabilities are properly set " << endl ;
-  assert(1==0) ;    // NB: ALL VALUES SHOLD BE CHECKED !!!!
+  Fatal("MakeType", "SHOULD NOT BE USED until values of probabilities are properly set ") ;
+   // NB: ALL VALUES SHOULD BE CHECKED !!!!
   switch (test) { 
 
   case 22:    // it's a photon              // NB: ALL VALUES SHOLD BE CHECKED !!!!
@@ -468,7 +480,7 @@ Double_t AliPHOSvFast::SigmaE(Double_t energy)
 }
 
 //____________________________________________________________________________
-Double_t AliPHOSvFast::SigmaP(Double_t energy, Int_t incidence)
+Double_t AliPHOSvFast::SigmaP(Double_t energy, Double_t incidence)
 {
   // Calculates the energy dependent position resolution 
 
@@ -483,8 +495,6 @@ void AliPHOSvFast::StepManager(void)
 {
   // Only verifies if the particle reaches PHOS and stops the tracking 
 
-  Int_t primary =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
-
   TLorentzVector lv ; 
   gMC->TrackPosition(lv) ;
   TVector3 pos = lv.Vect() ; 
@@ -505,7 +515,6 @@ void AliPHOSvFast::StepManager(void)
     TParticle * part = new TParticle(gMC->TrackPid(), 0,-1,-1,-1,-1, pTrack, lv)  ;
         
     AliPHOSFastRecParticle rp(*part) ;
-    rp.SetPrimary(primary) ; 
 
     // Adds the response of PHOS to the particle
     MakeRecParticle(modid, pos, rp) ;