Using static variables to access the volume ID avoiding search by name. This reduces...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Oct 2004 08:19:22 +0000 (08:19 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Oct 2004 08:19:22 +0000 (08:19 +0000)
EMCAL/AliEMCALv1.cxx
PHOS/AliPHOSDebug.cxx
PHOS/AliPHOSv1.cxx
PHOS/AliPHOSvImpacts.cxx
RICH/AliRICHv0.cxx
RICH/AliRICHv1.cxx
VZERO/AliVZEROv2.cxx
VZERO/AliVZEROv3.cxx
VZERO/AliVZEROv4.cxx
VZERO/AliVZEROv5.cxx

index 739cd6e..48e3ca0 100644 (file)
@@ -123,7 +123,8 @@ void AliEMCALv1::StepManager(void){
   
   AliEMCALGeometry * geom = GetGeometry() ; 
 
-  if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer 
+  static Int_t idXPHI = gMC->VolId("XPHI");
+  if(gMC->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
index 4b42034..ed5d859 100644 (file)
@@ -545,7 +545,8 @@ void AliPHOSv1::StepManager(void)
 
     // Yuri Kharlov, 28 September 2000
 
-    if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
+    static Int_t idPCPQ = gMC->VolId("PCPQ");
+    if( gMC->CurrentVolID(copy) == idPCPQ &&
        entered &&
        gMC->TrackCharge() != 0) {      
       
index 2e6a0be..d8cc5f0 100644 (file)
@@ -292,7 +292,8 @@ void AliPHOSv1::StepManager(void)
 
   Int_t moduleNumber ;
   
-  if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
+  static Int_t idPCPQ = gMC->VolId("PCPQ");
+  if( gMC->CurrentVolID(copy) == idPCPQ &&
       (gMC->IsTrackEntering() ) &&
       gMC->TrackCharge() != 0) {      
     
@@ -387,8 +388,8 @@ void AliPHOSv1::StepManager(void)
   }
 
  
-  
-  if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) { //  We are inside a PBWO crystal
+  static Int_t idPXTL = gMC->VolId("PXTL");  
+  if(gMC->CurrentVolID(copy) == idPXTL ) { //  We are inside a PBWO crystal
 
     gMC->TrackPosition(pos) ;
     xyzte[0] = pos[0] ;
index 805364b..2669b48 100644 (file)
@@ -206,7 +206,8 @@ void AliPHOSvImpacts::StepManager(void)
 
   // Add impact to EMC
 
-  if( gMC->CurrentVolID(copy) == gMC->VolId("PXTL") &&
+  static Int_t idPXTL = gMC->VolId("PXTL");
+  if( gMC->CurrentVolID(copy) == idPXTL &&
       gMC->IsTrackEntering() ) {
     gMC->TrackMomentum(pmom);
     gMC->TrackPosition(pos) ;
@@ -235,7 +236,8 @@ void AliPHOSvImpacts::StepManager(void)
 
   // Add impact to CPV
 
-  if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
+  static Int_t idPCPQ = gMC->VolId("PCPQ");
+  if( gMC->CurrentVolID(copy) == idPCPQ &&
       gMC->IsTrackEntering() ) {
     gMC->TrackMomentum(pmom);
     gMC->TrackPosition(pos) ;
index 06adbc8..bced7de 100644 (file)
@@ -110,7 +110,8 @@ void AliRICHv0::StepManager()
   Info("X4 glo","(x,y,z)=(%+8.3f,%+8.3f,%+8.3f) (r,theta,phi)=(%8.3f,%8.3f,%8.3f)",
                       glo[0],glo[1],glo[2],x4.Rho(),x4.Theta()*TMath::RadToDeg(),x4.Phi()*TMath::RadToDeg());  
   Info("X4 loc","(x,y,z)=(%+8.3f,%+8.3f,%8.3f) by gMC->Gmtod()",loc[0],loc[1],loc[2]);  
-  if(gMC->VolId("GAP ")==gMC->CurrentVolID(copy0)){
+  static Int_t idGAP = gMC->VolId("GAP ");
+  if(idGAP==gMC->CurrentVolID(copy0)){
     Int_t iChamber;
     gMC->CurrentVolOffID(2,iChamber);
     TVector2 x2=C(iChamber)->Mrs2Pc(x4);
index cca5906..b4f3765 100644 (file)
@@ -38,17 +38,22 @@ void AliRICHv1::StepManager()
          
   Int_t          copy;
   static Int_t   iCurrentChamber;
+  static Int_t idRRAD = gMC->VolId("RRAD");
+  static Int_t idRRWI = gMC->VolId("RRWI");
+  static Int_t idRICH = gMC->VolId("RICH");
+  static Int_t idRPC  = gMC->VolId("RPC ");
+  static Int_t idRGAP = gMC->VolId("RGAP");
 //history of Cerenkovs
   if(gMC->TrackPid()==kCerenkov){
-    if( gMC->IsNewTrack()   && gMC->CurrentVolID(copy)==gMC->VolId("RRAD")) fCounters(0)++;// 0- Ckovs produced in radiator
-    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==gMC->VolId("RRAD")) fCounters(1)++;// 1- Ckovs absorbed in radiator
-    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==gMC->VolId("RRWI")) fCounters(2)++;// 2- Ckovs absorbed in radiator window
-    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==gMC->VolId("RICH")) fCounters(4)++;// 4- Ckovs absorbed in CH4
+    if( gMC->IsNewTrack()   && gMC->CurrentVolID(copy)==idRRAD) fCounters(0)++;// 0- Ckovs produced in radiator
+    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==idRRAD) fCounters(1)++;// 1- Ckovs absorbed in radiator
+    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==idRRWI) fCounters(2)++;// 2- Ckovs absorbed in radiator window
+    if(!gMC->IsTrackAlive() && gMC->CurrentVolID(copy)==idRICH) fCounters(4)++;// 4- Ckovs absorbed in CH4
   }
           
 //Treat photons    
   static TLorentzVector cerX4;
-  if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("RPC ")){//photon in PC
+  if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==idRPC){//photon in PC
     if(gMC->Edep()>0){//photon in PC +DE
       if(IsLostByFresnel()){ 
         if(gMC->TrackPid()==kCerenkov) fCounters(7)++;// 7- Ckovs reflected from CsI
@@ -66,7 +71,7 @@ void AliRICHv1::StepManager()
 //Treat charged particles  
   static Float_t eloss;
   static TLorentzVector mipInX4,mipOutX4;
-  if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==gMC->VolId("RGAP")){//MIP in GAP
+  if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==idRGAP){//MIP in GAP
     gMC->CurrentVolOffID(1,iCurrentChamber);//RICH-RGAP
     if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP entering or newly created
       eloss=0;                                                           
index 68d6e75..b165ed1 100755 (executable)
@@ -1010,23 +1010,35 @@ void AliVZEROv2::StepManager()
      vol[2]    = gMC->CurrentVolID(copy);
      vol[3]    = copy;
      
-
-     if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
+     static Int_t idV0R1 = gMC->VolId("V0R1");
+     static Int_t idV0L1 = gMC->VolId("V0L1");
+     static Int_t idV0R2 = gMC->VolId("V0R2");
+     static Int_t idV0L2 = gMC->VolId("V0L2");
+     static Int_t idV0R3 = gMC->VolId("V0R3");
+     static Int_t idV0L3 = gMC->VolId("V0L3");
+     static Int_t idV0R4 = gMC->VolId("V0R4");
+     static Int_t idV0L4 = gMC->VolId("V0L4");
+     static Int_t idV0R5 = gMC->VolId("V0R5");
+     static Int_t idV0L5 = gMC->VolId("V0L5");
+     static Int_t idV0R6 = gMC->VolId("V0R6");
+     static Int_t idV0L6 = gMC->VolId("V0L6");
+
+     if      ( gMC->CurrentVolID(copy) == idV0R1 ||
+               gMC->CurrentVolID(copy) == idV0L1 )
               ringNumber = 1.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
+     else if ( gMC->CurrentVolID(copy) == idV0R2 ||
+               gMC->CurrentVolID(copy) == idV0L2 ) 
               ringNumber = 2.0;  
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
+     else if ( gMC->CurrentVolID(copy) == idV0R3 ||
+               gMC->CurrentVolID(copy) == idV0L3 )
               ringNumber = 3.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )          
+     else if ( gMC->CurrentVolID(copy) == idV0R4 ||
+               gMC->CurrentVolID(copy) == idV0L4 )      
               ringNumber = 4.0; 
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L5") ||
-              gMC->CurrentVolID(copy) == gMC->VolId("V0L6") ||
-              gMC->CurrentVolID(copy) == gMC->VolId("V0R6") )    
+     else if ( gMC->CurrentVolID(copy) == idV0R5 ||
+               gMC->CurrentVolID(copy) == idV0L5 ||
+              gMC->CurrentVolID(copy) == idV0R6 ||
+              gMC->CurrentVolID(copy) == idV0L6 )        
                ringNumber = 5.0; 
      else
               ringNumber = 0.0;
index a32948c..dc685d9 100755 (executable)
@@ -846,18 +846,25 @@ void AliVZEROv3::StepManager()
      
      if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return; 
 
+     static Int_t idV0R1 = gMC->VolId("V0R1");
+     static Int_t idV0L1 = gMC->VolId("V0L1");
+     static Int_t idV0R2 = gMC->VolId("V0R2");
+     static Int_t idV0L2 = gMC->VolId("V0L2");
+     static Int_t idV0R3 = gMC->VolId("V0R3");
+     static Int_t idV0L3 = gMC->VolId("V0L3");
+
      vol[0]    = gMC->CurrentVolOffID(1, vol[1]);
      vol[2]    = gMC->CurrentVolID(copy);
      vol[3]    = copy;
      
-     if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
+     if      ( gMC->CurrentVolID(copy) == idV0R1 ||
+               gMC->CurrentVolID(copy) == idV0L1 )
               ringNumber = 1.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
+     else if ( gMC->CurrentVolID(copy) == idV0R2 ||
+               gMC->CurrentVolID(copy) == idV0L2 ) 
               ringNumber = 2.0;  
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
+     else if ( gMC->CurrentVolID(copy) == idV0R3 ||
+               gMC->CurrentVolID(copy) == idV0L3 )
               ringNumber = 3.0;
      else
               ringNumber = 0.0;
index c5f2219..9fadfb5 100755 (executable)
@@ -888,17 +888,26 @@ void AliVZEROv4::StepManager()
      vol[2]    = gMC->CurrentVolID(copy);
      vol[3]    = copy;
      
-     if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
+     static Int_t idV0R1 = gMC->VolId("V0R1");
+     static Int_t idV0L1 = gMC->VolId("V0L1");
+     static Int_t idV0R2 = gMC->VolId("V0R2");
+     static Int_t idV0L2 = gMC->VolId("V0L2");
+     static Int_t idV0R3 = gMC->VolId("V0R3");
+     static Int_t idV0L3 = gMC->VolId("V0L3");
+     static Int_t idV0R4 = gMC->VolId("V0R4");
+     static Int_t idV0L4 = gMC->VolId("V0L4");
+
+     if      ( gMC->CurrentVolID(copy) == idV0R1 ||
+               gMC->CurrentVolID(copy) == idV0L1 )
               ringNumber = 1.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
+     else if ( gMC->CurrentVolID(copy) == idV0R2 ||
+               gMC->CurrentVolID(copy) == idV0L2 ) 
               ringNumber = 2.0;  
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
+     else if ( gMC->CurrentVolID(copy) == idV0R3 ||
+               gMC->CurrentVolID(copy) == idV0L3 )
               ringNumber = 3.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )
+     else if ( gMC->CurrentVolID(copy) == idV0R4 ||
+               gMC->CurrentVolID(copy) == idV0L4 )
               ringNumber = 4.0;               
      else
               ringNumber = 0.0;
index b9f4ae7..bc96f87 100755 (executable)
@@ -938,19 +938,30 @@ void AliVZEROv5::StepManager()
      vol[2]    = gMC->CurrentVolID(copy);
      vol[3]    = copy;
      
-     if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
+     static Int_t idV0R1 = gMC->VolId("V0R1");
+     static Int_t idV0L1 = gMC->VolId("V0L1");
+     static Int_t idV0R2 = gMC->VolId("V0R2");
+     static Int_t idV0L2 = gMC->VolId("V0L2");
+     static Int_t idV0R3 = gMC->VolId("V0R3");
+     static Int_t idV0L3 = gMC->VolId("V0L3");
+     static Int_t idV0R4 = gMC->VolId("V0R4");
+     static Int_t idV0L4 = gMC->VolId("V0L4");
+     static Int_t idV0R5 = gMC->VolId("V0R5");
+     static Int_t idV0R6 = gMC->VolId("V0R6");
+
+     if      ( gMC->CurrentVolID(copy) == idV0R1 ||
+               gMC->CurrentVolID(copy) == idV0L1 )
               ringNumber = 1.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
+     else if ( gMC->CurrentVolID(copy) == idV0R2 ||
+               gMC->CurrentVolID(copy) == idV0L2 ) 
               ringNumber = 2.0;  
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
+     else if ( gMC->CurrentVolID(copy) == idV0R3 ||
+               gMC->CurrentVolID(copy) == idV0R4 ||
+               gMC->CurrentVolID(copy) == idV0L3 )
               ringNumber = 3.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0R6") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )
+     else if ( gMC->CurrentVolID(copy) == idV0R5 ||
+               gMC->CurrentVolID(copy) == idV0R6 ||
+               gMC->CurrentVolID(copy) == idV0L4 )
               ringNumber = 4.0;               
      else
               ringNumber = 0.0;