]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv2.cxx
bugfix: corrected defines to use right default algorithms
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv2.cxx
index 1e8715b10f2cfe99889c43aa698de1a4d425007d..941ec8739e17006bea7da86d084e7564f58d9b65 100644 (file)
 // This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis.
 // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
 
+#include <cassert>
 // --- ROOT system ---
-#include <TParticle.h>
-#include <TVirtualMC.h>
 #include <TBrowser.h>
+#include <TClonesArray.h>
 #include <TH1.h>
 #include <TH2.h>
+#include <TParticle.h>
+#include <TROOT.h>
+#include <TVirtualMC.h>
 
 // --- Standard library ---
 
@@ -41,6 +44,7 @@
 #include "AliRun.h"
 #include "AliHeader.h"
 #include "AliMC.h"
+#include "AliStack.h"
 #include "AliPoints.h"
 // for TRD1 case only; May 31,2006
 
@@ -49,7 +53,6 @@ ClassImp(AliEMCALv2)
 //______________________________________________________________________
 AliEMCALv2::AliEMCALv2()
   : AliEMCALv1(), 
-    fGeometry(0),
     fHDe(0),
     fHNhits(0)
 {
@@ -59,7 +62,6 @@ AliEMCALv2::AliEMCALv2()
 //______________________________________________________________________
 AliEMCALv2::AliEMCALv2(const char *name, const char *title)
   : AliEMCALv1(name,title),
-    fGeometry(0),
     fHDe(0),
     fHNhits(0)
 {
@@ -136,9 +138,9 @@ void AliEMCALv2::StepManager(void){
   // position wrt MRS and energy deposited
   static Float_t        xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
   static Float_t        pmom[4]={0.,0.,0.,0.};
-  static TLorentzVector pos; // Lorentz vector of the track current position.
-  static TLorentzVector mom; // Lorentz vector of the track current momentum.
-  static Float_t ienergy = 0;
+  static TLorentzVector pos;  // Lorentz vector of the track current position.
+  static TLorentzVector mom;  // Lorentz vector of the track current momentum.
+  static Float_t ienergy = 0; // part->Energy();
   static TString curVolName;
   static int supModuleNumber, moduleNumber, yNumber, xNumber, absid;
   static int keyGeom=1;
@@ -161,7 +163,6 @@ void AliEMCALv2::StepManager(void){
 
   curVolName = gMC->CurrentVolName();
   if(curVolName.Contains(vn) || curVolName.Contains("SCX")) { // We are in a scintillator layer; SCX for 3X3
-    //    printf(" keyGeom %i : Sensetive volume %s (%s) \n", keyGeom, curVolName.Data(), vn); 
     
     if( ((depositedEnergy = gMC->Edep()) > 0.)  && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
       //       Info("StepManager "," entry %i DE %f",++ientry, depositedEnergy); // for testing
@@ -214,19 +215,18 @@ void AliEMCALv2::StepManager(void){
       
       //      if(ientry%200 > 0) return; // testing
       supModuleNumber = moduleNumber = yNumber = xNumber = absid = 0;
-      if(keyGeom >= 1) { // old style
+      if(keyGeom >= 1) { // TRD1 case now
         gMC->CurrentVolOffID(4, supModuleNumber);
         gMC->CurrentVolOffID(3, moduleNumber);
         gMC->CurrentVolOffID(1, yNumber);
         gMC->CurrentVolOffID(0, xNumber); // really x number now
         if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0) supModuleNumber += 10; // 13-oct-05
        // Nov 10,2006
-        xNumber == 0;
-        if     (strcmp(gMC->CurrentVolOffName(0),"SCX1")==0) xNumber=1;
-        else if(strcmp(gMC->CurrentVolOffName(0),"SCX2")==0) xNumber=2;
-        else if(strcmp(gMC->CurrentVolOffName(0),"SCX3")==0) xNumber=3;
-        if(xNumber==0) {
-          Fatal("StepManager()", "Wrong name SCX : %s ", gMC->CurrentVolOffName(0)) ;
+        if(strcmp(gMC->CurrentVolOffName(0),vn) != 0) { // 3X3 case
+          if     (strcmp(gMC->CurrentVolOffName(0),"SCX1")==0) xNumber=1;
+          else if(strcmp(gMC->CurrentVolOffName(0),"SCX2")==0) xNumber=2;
+          else if(strcmp(gMC->CurrentVolOffName(0),"SCX3")==0) xNumber=3;
+          else Fatal("StepManager()", "Wrong name of sensetive volume in 3X3 case : %s ", gMC->CurrentVolOffName(0));
        }
       } else {
         gMC->CurrentVolOffID(5, supModuleNumber);
@@ -498,7 +498,7 @@ void AliEMCALv2::DrawAlicWithHits(int mode)
   }
 
   TClonesArray *hits = Hits();
-  Int_t nhits = hits->GetEntries(), absId, nSupMod, nTower, nIphi, nIeta, iphi, ieta;
+  Int_t nhits = hits->GetEntries(), absId, nSupMod, nModule, nIphi, nIeta, iphi, ieta;
   AliEMCALHit *hit = 0;
   Double_t de, des=0.;
   for(Int_t i=0; i<nhits; i++) {
@@ -506,11 +506,11 @@ void AliEMCALv2::DrawAlicWithHits(int mode)
     absId = hit->GetId();
     de    = hit->GetEnergy();
     des += de;
-    if(fGeometry->GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta)){
+    if(fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta)){
       //      printf(" de %f abs id %i smod %i tower %i | cell iphi %i : ieta %i\n",
-      // de, absId, nSupMod, nTower, nIphi, nIeta); 
+      // de, absId, nSupMod, nModule, nIphi, nIeta); 
       if(nSupMod==3) {
-        fGeometry->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
+        fGeometry->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
         // printf(" iphi %i : ieta %i\n", iphi,ieta);
         h2->Fill(double(ieta),double(iphi), de);
       }
@@ -542,18 +542,18 @@ void AliEMCALv2::TestIndexTransition(int pri, int idmax)
     return; 
   }
 
-  Int_t nSupMod, nTower, nIphi, nIeta, idNew, nGood=0;
+  Int_t nSupMod, nModule, nIphi, nIeta, idNew, nGood=0;
   if(idmax==0) idmax = fGeometry->GetNCells();
   for(Int_t id=1; id<=idmax; id++) {
-    if(!fGeometry->GetCellIndex(id, nSupMod, nTower, nIphi, nIeta)){
+    if(!fGeometry->GetCellIndex(id, nSupMod, nModule, nIphi, nIeta)){
       printf(" Wrong abs ID %i : #cells %i\n", id, fGeometry->GetNCells());
       break;  
     }
-    idNew = fGeometry->GetAbsCellId(nSupMod, nTower, nIphi, nIeta);
+    idNew = fGeometry->GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
     if(id != idNew || pri>0) {
       printf(" ID %i : %i <- new id\n", id, idNew);
       printf(" nSupMod   %i ",  nSupMod);
-      printf(" nTower    %i ", nTower);
+      printf(" nModule    %i ", nModule);
       printf(" nIphi     %i ", nIphi);
       printf(" nIeta     %i \n", nIeta);