]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv4.cxx
added initialization in the default ctor
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv4.cxx
index edd162fbbcc210ac023f0d2aed8537ab50040bca..d40552c2ecef50131591c34ae5a5d6e1b1224cb8 100644 (file)
 #include "TParticle.h"
 #include "TTree.h"
 #include "TGeometry.h"
+#include "TFile.h"
 
 // --- Standard library ---
 
 #include <stdio.h>
 
 // --- AliRoot header files ---
-
+#include "AliPHOSFastRecParticle.h"
+#include "AliPHOSGeometry.h"
 #include "AliPHOSv4.h"
 #include "AliRun.h"
 #include "AliConst.h"
 
 ClassImp(AliPHOSv4)
 
+//____________________________________________________________________________
+AliPHOSv4::AliPHOSv4() AliPHOS(name,title)
+{
+  // default ctor : initialize data member
+   fBigBoxX = 0. ;                      
+   fBigBoxY = 0. ;                      
+   fBigBoxZ = 0. ;                       
+   fFastRecParticles = 0 ;        
+   fNRecParticles = 0 ;                
+   fRan = 0 ;                            
+   fResPara1 = 0. ;                       
+   fResPara2 = 0. ;                        
+   fResPara3 = 0. ;                      
+   fPosParaA0 = 0. ;                      
+   fPosParaA1 = 0. ;
+   fPosParaB0 = 0. ;     
+   fPosParaB1 = 0. ;    
+   fPosParaB2 = 0. ;    
+
+}
+
 //____________________________________________________________________________
 AliPHOSv4::AliPHOSv4(const char *name, const char *title):
   AliPHOS(name,title)
@@ -53,12 +76,12 @@ AliPHOSv4::AliPHOSv4(const char *name, const char *title):
 
   // gets an instance of the geometry parameters class  
   if (strcmp(GetTitle(),"") != 0 ) 
-    fGeom =  AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
+    fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ; 
      
     
-    SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
-    SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) ; 
-    SetBigBox(2, fGeom->GetOuterBoxSize(0) ); 
+    SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
+    SetBigBox(1, GetGeometry()->GetOuterBoxSize(1) + GetGeometry()->GetCPVBoxSize(1) ) ; 
+    SetBigBox(2, GetGeometry()->GetOuterBoxSize(0) ); 
     
     fNRecParticles = 0 ; 
     fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
@@ -126,17 +149,17 @@ void AliPHOSv4::BuildGeometry()
   
   // position PHOS into ALICE
 
-  Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+  Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
   Int_t number = 988 ; 
-  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * fGeom->GetIPtoCrystalSurface() ) ) ;
+  Float_t pphi =  TMath::ATan( GetBigBox(0)  / ( 2.0 * GetGeometry()->GetIPtoCrystalSurface() ) ) ;
   pphi *= kRADDEG ;
   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
  
   char * nodename = new char[20] ;  
   char * rotname  = new char[20] ; 
 
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { 
-   Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) { 
+   Float_t angle = pphi * 2 * ( i - GetGeometry()->GetNModules() / 2.0 - 0.5 ) ;
    sprintf(rotname, "%s%d", "rot", number++) ;
    new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
    top->cd();
@@ -180,12 +203,12 @@ void AliPHOSv4::CreateGeometry()
   Int_t idrotm[99] ;
   Double_t const kRADDEG = 180.0 / kPI ;
   
-  for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+  for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) {
     
-    Float_t angle = fGeom->GetPHOSAngle(i) ;
+    Float_t angle = GetGeometry()->GetPHOSAngle(i) ;
     AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
  
-    Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+    Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
 
     Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
     Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
@@ -217,7 +240,7 @@ void AliPHOSv4::Init(void)
 }
 
 //___________________________________________________________________________
-Float_t AliPHOSv4::GetBigBox(Int_t index)
+Float_t AliPHOSv4::GetBigBox(Int_t index) const
 {
   // Get the X, Y or Z dimension of the box describing a PHOS module
   
@@ -238,18 +261,19 @@ Float_t AliPHOSv4::GetBigBox(Int_t index)
 }
 
 //___________________________________________________________________________
-void AliPHOSv4::MakeBranch(Option_t* opt)
+void AliPHOSv4::MakeBranch(Option_t* opt, const char *file)
 {  
   // Create new branch in the current reconstructed Root Tree
  
-  AliDetector::MakeBranch(opt) ;
+  AliDetector::MakeBranch(opt,file) ;
   
   char branchname[10];
   sprintf(branchname,"%s",GetName());
-  char *cd = strstr(opt,"R");
+  const char *cd = strstr(opt,"R");
   
   if (fFastRecParticles && gAlice->TreeR() && cd) {
-    gAlice->TreeR()->Branch(branchname, &fFastRecParticles, fBufferSize);
+    MakeBranchInTree(gAlice->TreeR(), 
+                     branchname, &fFastRecParticles, fBufferSize, file);
   }
 }
 
@@ -306,7 +330,7 @@ void AliPHOSv4::MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHOSFa
   // get the angle of incidence 
   
   Double_t incidencetheta = 90. * TMath::Pi() /180 - rp.Theta() ; 
-  Double_t incidencephi   = ( 270 + fGeom->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
+  Double_t incidencephi   = ( 270 + GetGeometry()->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;   
 
   // get the detected direction
   
@@ -469,16 +493,16 @@ void AliPHOSv4::StepManager(void)
   Int_t modid  ; 
   gMC->CurrentVolID(modid);
   
-  Float_t Energy = gMC->Etot() ; //Total energy of current track
+  Float_t energy = gMC->Etot() ; //Total energy of current track
 
   //Calculating mass of current particle
-  TDatabasePDG * PDG = TDatabasePDG::Instance() ;
-  TParticlePDG * partPDG = PDG->GetParticle(gMC->TrackPid()) ;
+  TDatabasePDG * pdg = TDatabasePDG::Instance() ;
+  TParticlePDG * partPDG = pdg->GetParticle(gMC->TrackPid()) ;
   Float_t mass = partPDG->Mass() ;
 
-  if(Energy > mass){
-    pos.SetMag(TMath::Sqrt(Energy*Energy-mass*mass)) ;
-    TLorentzVector pTrack(pos,Energy) ;  
+  if(energy > mass){
+    pos.SetMag(TMath::Sqrt(energy*energy-mass*mass)) ;
+    TLorentzVector pTrack(pos, energy) ;  
 
     TParticle * part = new TParticle(gMC->TrackPid(), 0,-1,-1,-1,-1, pTrack, lv)  ;