]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv1.cxx
avoid warnings with modern compilers due to unused variables or wrong comparison...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv1.cxx
index 6934ce7430237f6cf28e7be80e1724a06eadadf0..2bdd6a8d1a4a4e0b5a6449e5a5d0ca5312a0e684 100644 (file)
@@ -44,6 +44,8 @@
 #include "AliMC.h"
 #include "AliStack.h"
 
+using std::cout;
+using std::endl;
 ClassImp(AliEMCALv1)
 
 
@@ -59,8 +61,9 @@ AliEMCALv1::AliEMCALv1()
 }
 
 //______________________________________________________________________
-AliEMCALv1::AliEMCALv1(const char *name, const char *title)
-  : AliEMCALv0(name,title), 
+AliEMCALv1::AliEMCALv1(const char *name, const char *title, 
+                       const Bool_t checkGeoAndRun)
+  : AliEMCALv0(name,title,checkGeoAndRun), 
     fCurPrimary(-1), 
     fCurParent(-1), 
     fCurTrack(-1), 
@@ -77,13 +80,13 @@ AliEMCALv1::AliEMCALv1(const char *name, const char *title)
 
 //______________________________________________________________________
 AliEMCALv1::~AliEMCALv1(){
-    // dtor
-
-    if ( fHits) {
-       fHits->Delete();
-       delete fHits;
-       fHits = 0;
-    }
+  // dtor
+  
+  if ( fHits ) {
+    fHits->Clear();
+    delete fHits;
+    fHits = 0;
+  }
 }
 
 //______________________________________________________________________
@@ -92,10 +95,10 @@ void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t ipa
     // Add a hit to the hit list.
     // An EMCAL hit is the sum of all hits in a tower section
     //   originating from the same entering particle 
-    Int_t hitCounter;
+    Int_t hitCounter=0;
     
-    AliEMCALHit *newHit;
-    AliEMCALHit *curHit;
+    AliEMCALHit *newHit=0;
+    AliEMCALHit *curHit=0;
     Bool_t deja = kFALSE;
 
     newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
@@ -122,7 +125,7 @@ void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t ipa
 void AliEMCALv1::StepManager(void){
   // Accumulates hits as long as the track stays in a tower
 
-  Int_t          id[2];           // (phi, Eta) indices
+  Int_t          id[2]={0,0};           // (phi, Eta) indices
   // position wrt MRS and energy deposited
   Float_t        xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
   Float_t        pmom[4]={0.,0.,0.,0.};
@@ -134,26 +137,33 @@ void AliEMCALv1::StepManager(void){
   
   AliEMCALGeometry * geom = GetGeometry() ; 
 
-  static Int_t idXPHI = gMC->VolId("XPHI");
-  if(gMC->CurrentVolID(copy) == idXPHI ) { // We are in a Scintillator Layer 
+  TParticle *part=0;
+  Int_t parent=-1;
+
+  static Int_t idXPHI = TVirtualMC::GetMC()->VolId("XPHI");
+  if(TVirtualMC::GetMC()->CurrentVolID(copy) == idXPHI ) { // We are in a Scintillator Layer 
     Float_t depositedEnergy ; 
     
-    if( ((depositedEnergy = gMC->Edep()) > 0.)  && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
+    if( ((depositedEnergy = TVirtualMC::GetMC()->Edep()) > 0.)  && (TVirtualMC::GetMC()->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
        if (fCurPrimary==-1) 
        fCurPrimary=gAlice->GetMCApp()->GetPrimary(tracknumber);
 
       if (fCurParent==-1 || tracknumber != fCurTrack) {
        // Check parentage
-       Int_t parent=tracknumber;
+       //Int_t parent=tracknumber;
+       parent=tracknumber;
        if (fCurParent != -1) {
          while (parent != fCurParent && parent != -1) {
-           TParticle *part=gAlice->GetMCApp()->Particle(parent);
+           //TParticle *part=gAlice->GetMCApp()->Particle(parent);
+           part=gAlice->GetMCApp()->Particle(parent);
            parent=part->GetFirstMother();
          }
        }
        if (fCurParent==-1 || parent==-1) {
-         Int_t parent=tracknumber;
-         TParticle *part=gAlice->GetMCApp()->Particle(parent);
+         //Int_t parent=tracknumber;
+         //TParticle *part=gAlice->GetMCApp()->Particle(parent);
+         parent=tracknumber;
+         part=gAlice->GetMCApp()->Particle(parent);
          while (parent != -1 && geom->IsInEMCAL(part->Vx(),part->Vy(),part->Vz())) {
            parent=part->GetFirstMother();
            if (parent!=-1) 
@@ -163,7 +173,8 @@ void AliEMCALv1::StepManager(void){
          if (fCurParent==-1)
            Error("StepManager","Cannot find parent");
          else {
-           TParticle *part=gAlice->GetMCApp()->Particle(fCurParent);
+           //TParticle *part=gAlice->GetMCApp()->Particle(fCurParent);
+           part=gAlice->GetMCApp()->Particle(fCurParent);
            ienergy = part->Energy(); 
          }
          while (parent != -1) {
@@ -174,20 +185,20 @@ void AliEMCALv1::StepManager(void){
        }
        fCurTrack=tracknumber;
       }    
-      gMC->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackPosition(pos);
       xyzte[0] = pos[0];
       xyzte[1] = pos[1];
       xyzte[2] = pos[2];
-      xyzte[3] = gMC->TrackTime() ;       
+      xyzte[3] = TVirtualMC::GetMC()->TrackTime() ;       
       
-      gMC->TrackMomentum(mom);
+      TVirtualMC::GetMC()->TrackMomentum(mom);
       pmom[0] = mom[0];
       pmom[1] = mom[1];
       pmom[2] = mom[2];
       pmom[3] = mom[3];
       
-      gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
-      gMC->CurrentVolID(id[1]); // get the phi number inside the layer
+      TVirtualMC::GetMC()->CurrentVolOffID(1, id[0]); // get the POLY copy number;
+      TVirtualMC::GetMC()->CurrentVolID(id[1]); // get the phi number inside the layer
       
       Int_t tower = (id[0]-1) % geom->GetNZ() + 1 + (id[1] - 1) * geom->GetNZ() ;  
       Int_t layer = static_cast<Int_t>((id[0]-1)/(geom->GetNZ())) + 1 ; 
@@ -199,17 +210,17 @@ void AliEMCALv1::StepManager(void){
       Float_t lightYield =  depositedEnergy ;
       // Apply Birk's law (copied from G3BIRK)
 
-      if (gMC->TrackCharge()!=0) { // Check
+      if (TVirtualMC::GetMC()->TrackCharge()!=0) { // Check
          Float_t birkC1Mod = 0;
        if (fBirkC0==1){ // Apply correction for higher charge states
-         if (TMath::Abs(gMC->TrackCharge())>=2)
+         if (TMath::Abs(TVirtualMC::GetMC()->TrackCharge())>=2)
            birkC1Mod=fBirkC1*7.2/12.6;
          else
            birkC1Mod=fBirkC1;
        }
-       Float_t dedxcm;
-       if (gMC->TrackStep()>0) 
-         dedxcm=1000.*gMC->Edep()/gMC->TrackStep();
+       Float_t dedxcm=0.;
+       if (TVirtualMC::GetMC()->TrackStep()>0) 
+         dedxcm=1000.*TVirtualMC::GetMC()->Edep()/TVirtualMC::GetMC()->TrackStep();
        else
          dedxcm=0;
        lightYield=lightYield/(1.+birkC1Mod*dedxcm+fBirkC2*dedxcm*dedxcm);
@@ -226,6 +237,7 @@ void AliEMCALv1::StepManager(void){
   }
 }
 
+//___________________________________________________________
 void AliEMCALv1::RemapTrackHitIDs(Int_t *map) {
   // remap track index numbers for primary and parent indices
   // (Called by AliStack::PurifyKine)
@@ -244,6 +256,7 @@ void AliEMCALv1::RemapTrackHitIDs(Int_t *map) {
   }
 }
 
+//___________________________________________________________
 void AliEMCALv1::FinishPrimary() {
   // finish primary
   fCurPrimary=-1;