variable names are changed according to ALICE convention
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Oct 2003 12:25:36 +0000 (12:25 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Oct 2003 12:25:36 +0000 (12:25 +0000)
PMD/AliPMDDigitizer.cxx
PMD/AliPMDDigitizer.h
PMD/AliPMDcell.cxx
PMD/AliPMDcell.h
PMD/AliPMDv1.cxx
PMD/AliPMDv1.h

index 743a014..6f16a77 100644 (file)
@@ -6,6 +6,7 @@
 //                                                     //
 //-----------------------------------------------------//
 
+#include <Riostream.h>
 #include <TBRIK.h>
 #include <TNode.h>
 #include <TTree.h>
@@ -40,19 +41,21 @@ ClassImp(AliPMDDigitizer)
 //
 AliPMDDigitizer::AliPMDDigitizer()
 {
+  // Default Constructor
+  //
   if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000);  
   fNsdigit = 0;
   if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);  
   fNdigit = 0;
 
-  for (Int_t i = 0; i < fTotUM; i++)
+  for (Int_t i = 0; i < fgkTotUM; i++)
     {
-      for (Int_t j = 0; j < fRow; j++)
+      for (Int_t j = 0; j < fgkRow; j++)
        {
-         for (Int_t k = 0; k < fCol; k++)
+         for (Int_t k = 0; k < fgkCol; k++)
            {
              fCPV[i][j][k] = 0.; 
-             fPMD[i][j][k] = 0.; 
+             fPRE[i][j][k] = 0.; 
            }
        }
     }
@@ -63,6 +66,8 @@ AliPMDDigitizer::AliPMDDigitizer()
 }
 AliPMDDigitizer::~AliPMDDigitizer()
 {
+  // Default Destructor
+  //
   delete fSDigits;
   delete fDigits;
   delete fCell;
@@ -72,7 +77,9 @@ AliPMDDigitizer::~AliPMDDigitizer()
 //
 void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
 {
-
+  // Loads galice.root file and corresponding header, kinematics
+  // hits and sdigits or digits depending on the option
+  //
   fRunLoader = AliRunLoader::Open(file,AliConfig::fgkDefaultEventFolderName,
                                  "UPDATE");
   
@@ -85,9 +92,9 @@ void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
   fRunLoader->LoadHeader();
   fRunLoader->LoadKinematics();
 
-  gAlice = fRunLoader->GetAliRun();
+  fAlice = fRunLoader->GetAliRun();
   
-  if (gAlice)
+  if (fAlice)
     {
       printf("<AliPMDdigitizer::Open> ");
       printf("AliRun object found on file.\n");
@@ -98,9 +105,9 @@ void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
       printf("Could not find AliRun object.\n");
     }
 
-  PMD  = (AliPMD*)gAlice->GetDetector("PMD");
-  pmdloader = fRunLoader->GetLoader("PMDLoader");
-  if (pmdloader == 0x0)
+  fPMD  = (AliPMD*)fAlice->GetDetector("PMD");
+  fPMDLoader = fRunLoader->GetLoader("PMDLoader");
+  if (fPMDLoader == 0x0)
     {
       cerr<<"Hits2Digits : Can not find PMD or PMDLoader\n";
     }
@@ -111,27 +118,30 @@ void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
 
   if (cHS)
     {
-      pmdloader->LoadHits("READ");
-      pmdloader->LoadSDigits("recreate");
+      fPMDLoader->LoadHits("READ");
+      fPMDLoader->LoadSDigits("recreate");
     }
   else if (cHD)
     {
-      pmdloader->LoadHits("READ");
-      pmdloader->LoadDigits("recreate");
+      fPMDLoader->LoadHits("READ");
+      fPMDLoader->LoadDigits("recreate");
     }
   else if (cSD)
     {
-      pmdloader->LoadSDigits("READ");
-      pmdloader->LoadDigits("recreate");
+      fPMDLoader->LoadSDigits("READ");
+      fPMDLoader->LoadDigits("recreate");
     }
 
 }
 void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
 {
-  cout << " -------- Beginning of Hits2SDigits ----------- " << endl;
+  // This reads the PMD Hits tree and assigns the right track number
+  // to a cell and stores in the summable digits tree
+  //
+  // cout << " -------- Beginning of Hits2SDigits ----------- " << endl;
 
-  Int_t kPi0 = 111;
-  Int_t kGamma = 22;
+  const Int_t kPi0 = 111;
+  const Int_t kGamma = 22;
   Int_t npmd;
   Int_t trackno;
   Int_t smnumber;
@@ -151,95 +161,96 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
   Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
   printf("Number of Particles = %d \n", nparticles);
   fRunLoader->GetEvent(ievt);
-  Particles = gAlice->GetMCApp()->Particles();
+  fPArray = fAlice->GetMCApp()->Particles();
   // ------------------------------------------------------- //
   // Pointer to specific detector hits.
   // Get pointers to Alice detectors and Hits containers
 
-  treeH = pmdloader->TreeH();
+  fTreeH = fPMDLoader->TreeH();
   
-  Int_t ntracks    = (Int_t) treeH->GetEntries();
+  Int_t ntracks    = (Int_t) fTreeH->GetEntries();
   printf("Number of Tracks in the TreeH = %d \n", ntracks);
 
-  treeS = pmdloader->TreeS();
-  if (treeS == 0x0)
+  fTreeS = fPMDLoader->TreeS();
+  if (fTreeS == 0x0)
     {
-      pmdloader->MakeTree("S");
-      treeS = pmdloader->TreeS();
+      fPMDLoader->MakeTree("S");
+      fTreeS = fPMDLoader->TreeS();
     }
   Int_t bufsize = 16000;
-  treeS->Branch("PMDSDigit", &fSDigits, bufsize); 
+  fTreeS->Branch("PMDSDigit", &fSDigits, bufsize); 
   
-  if (PMD) PMDhits   = PMD->Hits();
+  if (fPMD) fHits   = fPMD->Hits();
 
   // Start loop on tracks in the hits containers
 
   
   for (Int_t track=0; track<ntracks;track++) 
     {
-      gAlice->ResetHits();
-      treeH->GetEvent(track);
+      fAlice->ResetHits();
+      fTreeH->GetEvent(track);
       
-      if (PMD) 
+      if (fPMD) 
        {
-         npmd = PMDhits->GetEntriesFast();
+         npmd = fHits->GetEntriesFast();
          for (int ipmd = 0; ipmd < npmd; ipmd++) 
            {
-             pmdHit = (AliPMDhit*) PMDhits->UncheckedAt(ipmd);
-             trackno = pmdHit->GetTrack();
+             fPMDHit = (AliPMDhit*) fHits->UncheckedAt(ipmd);
+             trackno = fPMDHit->GetTrack();
 
              //  get kinematics of the particles
-             
-             particle = gAlice->GetMCApp()->Particle(trackno);
-             trackpid  = particle->GetPdgCode();
+
+             fParticle = fAlice->GetMCApp()->Particle(trackno);
+             trackpid  = fParticle->GetPdgCode();
 
              Int_t igatr = -999;
              Int_t ichtr = -999;
              Int_t igapid = -999;
              Int_t imo;
              Int_t igen = 0;
-             Int_t id_mo = -999;
+             Int_t idmo = -999;
 
-             TParticle*  mparticle = particle;
-             Int_t trackno_old=0, trackpid_old=0, status_old = 0;
+             TParticle*  mparticle = fParticle;
+             Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
              if (mparticle->GetFirstMother() == -1)
                {
-                 trackno_old  = trackno;
-                 trackpid_old = trackpid;
-                 status_old   = -1;
+                 tracknoOld  = trackno;
+                 trackpidOld = trackpid;
+                 statusOld   = -1;
                }
 
              Int_t igstatus = 0;
              while((imo = mparticle->GetFirstMother()) >= 0)
                {
                  igen++;
-                 mparticle =  gAlice->GetMCApp()->Particle(imo);
-                 id_mo = mparticle->GetPdgCode();
+
+                 mparticle =  fAlice->GetMCApp()->Particle(imo);
+                 idmo = mparticle->GetPdgCode();
                  
                  vx = mparticle->Vx();
                  vy = mparticle->Vy();
                  vz = mparticle->Vz();
                
-                 //printf("==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, id_mo, vx, vy, vz);
-                 //fprintf(fpw1,"==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, id_mo, vx, vy, vz);
-                 if ((id_mo == kGamma || id_mo == -11 || id_mo == 11) && vx == 0. && vy == 0. && vz == 0.)
+                 //printf("==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, idmo, vx, vy, vz);
+                 //fprintf(fpw1,"==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, idmo, vx, vy, vz);
+                 if ((idmo == kGamma || idmo == -11 || idmo == 11) && vx == 0. && vy == 0. && vz == 0.)
                    {
                      igatr = imo;
-                     igapid = id_mo;
+                     igapid = idmo;
                      igstatus = 1;
                    }
                  if(igstatus == 0)
                    {
-                     if (id_mo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
+                     if (idmo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
                        {
                          igatr = imo;
-                         igapid = id_mo;
+                         igapid = idmo;
                        }
                    }
                  ichtr = imo;
                }
 
-             if (id_mo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
+             if (idmo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
                {
                  mtrackno = igatr;
                  mtrackpid = igapid;
@@ -247,22 +258,22 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
              else
                {
                  mtrackno  = ichtr;
-                 mtrackpid = id_mo;
+                 mtrackpid = idmo;
                }
-             if (status_old == -1)
+             if (statusOld == -1)
                {
-                 mtrackno  = trackno_old;
-                 mtrackpid = trackpid_old;
+                 mtrackno  = tracknoOld;
+                 mtrackpid = trackpidOld;
                }
              
-             xPos = pmdHit->X();
-             yPos = pmdHit->Y();
-             zPos = pmdHit->Z();
-             edep       = pmdHit->fEnergy;
-             Int_t Vol1 = pmdHit->fVolume[1]; // Column
-             Int_t Vol2 = pmdHit->fVolume[2]; // Row
-             Int_t Vol3 = pmdHit->fVolume[3]; // UnitModule
-             Int_t Vol6 = pmdHit->fVolume[6]; // SuperModule
+             xPos = fPMDHit->X();
+             yPos = fPMDHit->Y();
+             zPos = fPMDHit->Z();
+             edep       = fPMDHit->fEnergy;
+             Int_t vol1 = fPMDHit->fVolume[1]; // Column
+             Int_t vol2 = fPMDHit->fVolume[2]; // Row
+             Int_t vol3 = fPMDHit->fVolume[3]; // UnitModule
+             Int_t vol6 = fPMDHit->fVolume[6]; // SuperModule
              // -----------------------------------------//
              // For Super Module 1 & 2                   //
              //  nrow = 96, ncol = 48                    //
@@ -270,17 +281,17 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
              //  nrow = 48, ncol = 96                    //
              // -----------------------------------------//
              
-             smnumber = (Vol6-1)*6 + Vol3;
+             smnumber = (vol6-1)*6 + vol3;
 
-             if (Vol6 == 1 || Vol6 == 2)
+             if (vol6 == 1 || vol6 == 2)
                {
-                 xpad = Vol1;
-                 ypad = Vol2;
+                 xpad = vol1;
+                 ypad = vol2;
                }
-             else if (Vol6 == 3 || Vol6 == 4)
+             else if (vol6 == 3 || vol6 == 4)
                {
-                 xpad = Vol2;
-                 ypad = Vol1;
+                 xpad = vol2;
+                 ypad = vol1;
                }
 
              //cout << "zpos = " << zPos << " edep = " << edep << endl;
@@ -301,12 +312,12 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
              Int_t iyy = ypad     - 1;
              if (fDetNo == 0)
                {
-                 fPMD[smn][ixx][iyy] += edep;
-                 fPMDCounter[smn][ixx][iyy]++;
+                 fPRE[smn][ixx][iyy] += edep;
+                 fPRECounter[smn][ixx][iyy]++;
 
-                 pmdcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep);
+                 fPMDcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep);
 
-                 fCell->Add(pmdcell);
+                 fCell->Add(fPMDcell);
                }
              else if(fDetNo == 1)
                {
@@ -327,17 +338,17 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
 
   for (Int_t idet = 0; idet < 2; idet++)
     {
-      for (Int_t ism = 0; ism < fTotUM; ism++)
+      for (Int_t ism = 0; ism < fgkTotUM; ism++)
        {
-         for (Int_t jrow = 0; jrow < fRow; jrow++)
+         for (Int_t jrow = 0; jrow < fgkRow; jrow++)
            {
-             for (Int_t kcol = 0; kcol < fCol; kcol++)
+             for (Int_t kcol = 0; kcol < fgkCol; kcol++)
                {
-                 cellno = jrow*fCol + kcol;
+                 cellno = jrow*fgkCol + kcol;
                  if (idet == 0)
                    {
-                     deltaE = fPMD[ism][jrow][kcol];
-                     trno   = fPMDTrackNo[ism][jrow][kcol];
+                     deltaE = fPRE[ism][jrow][kcol];
+                     trno   = fPRETrackNo[ism][jrow][kcol];
                      detno = 0;
                    }
                  else if (idet == 1)
@@ -352,11 +363,11 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
                    }
                }
            }
-         treeS->Fill();
+         fTreeS->Fill();
          ResetSDigit();
        }
     }
-  pmdloader->WriteSDigits("OVERWRITE");
+  fPMDLoader->WriteSDigits("OVERWRITE");
   ResetCellADC();
 
   //  cout << " -------- End of Hits2SDigit ----------- " << endl;
@@ -364,8 +375,11 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
 
 void AliPMDDigitizer::Hits2Digits(Int_t ievt)
 {
-  Int_t kPi0 = 111;
-  Int_t kGamma = 22;
+  // This reads the PMD Hits tree and assigns the right track number
+  // to a cell and stores in the digits tree
+  //
+  const Int_t kPi0 = 111;
+  const Int_t kGamma = 22;
   Int_t npmd;
   Int_t trackno;
   Int_t smnumber;
@@ -386,100 +400,101 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
   Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
   printf("Number of Particles = %d \n", nparticles);
   fRunLoader->GetEvent(ievt);
-  Particles = gAlice->GetMCApp()->Particles();
+  fPArray = fAlice->GetMCApp()->Particles();
   // ------------------------------------------------------- //
   // Pointer to specific detector hits.
   // Get pointers to Alice detectors and Hits containers
 
-  PMD  = (AliPMD*)gAlice->GetDetector("PMD");
-  pmdloader = fRunLoader->GetLoader("PMDLoader");
+  fPMD  = (AliPMD*)fAlice->GetDetector("PMD");
+  fPMDLoader = fRunLoader->GetLoader("PMDLoader");
 
-  if (pmdloader == 0x0)
+  if (fPMDLoader == 0x0)
     {
       cerr<<"Hits2Digits method : Can not find PMD or PMDLoader\n";
     }
-  treeH = pmdloader->TreeH();
-  Int_t ntracks    = (Int_t) treeH->GetEntries();
+  fTreeH = fPMDLoader->TreeH();
+  Int_t ntracks    = (Int_t) fTreeH->GetEntries();
   printf("Number of Tracks in the TreeH = %d \n", ntracks);
-  pmdloader->LoadDigits("recreate");
-  treeD = pmdloader->TreeD();
-  if (treeD == 0x0)
+  fPMDLoader->LoadDigits("recreate");
+  fTreeD = fPMDLoader->TreeD();
+  if (fTreeD == 0x0)
     {
-      pmdloader->MakeTree("D");
-      treeD = pmdloader->TreeD();
+      fPMDLoader->MakeTree("D");
+      fTreeD = fPMDLoader->TreeD();
     }
   Int_t bufsize = 16000;
-  treeD->Branch("PMDDigit", &fDigits, bufsize); 
+  fTreeD->Branch("PMDDigit", &fDigits, bufsize); 
   
-  if (PMD) PMDhits   = PMD->Hits();
+  if (fPMD) fHits   = fPMD->Hits();
 
   // Start loop on tracks in the hits containers
 
   for (Int_t track=0; track<ntracks;track++) 
     {
-      gAlice->ResetHits();
-      treeH->GetEvent(track);
+      fAlice->ResetHits();
+      fTreeH->GetEvent(track);
       
-      if (PMD) 
+      if (fPMD) 
        {
-         npmd = PMDhits->GetEntriesFast();
+         npmd = fHits->GetEntriesFast();
          for (int ipmd = 0; ipmd < npmd; ipmd++) 
            {
-             pmdHit = (AliPMDhit*) PMDhits->UncheckedAt(ipmd);
-             trackno = pmdHit->GetTrack();
+             fPMDHit = (AliPMDhit*) fHits->UncheckedAt(ipmd);
+             trackno = fPMDHit->GetTrack();
              
              //  get kinematics of the particles
              
-             particle = gAlice->GetMCApp()->Particle(trackno);
-             trackpid  = particle->GetPdgCode();
+             fParticle = fAlice->GetMCApp()->Particle(trackno);
+             trackpid  = fParticle->GetPdgCode();
 
              Int_t igatr = -999;
              Int_t ichtr = -999;
              Int_t igapid = -999;
              Int_t imo;
              Int_t igen = 0;
-             Int_t id_mo = -999;
+             Int_t idmo = -999;
 
-             TParticle*  mparticle = particle;
-             Int_t trackno_old=0, trackpid_old=0, status_old = 0;
+             TParticle*  mparticle = fParticle;
+             Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
              if (mparticle->GetFirstMother() == -1)
                {
-                 trackno_old  = trackno;
-                 trackpid_old = trackpid;
-                 status_old   = -1;
+                 tracknoOld  = trackno;
+                 trackpidOld = trackpid;
+                 statusOld   = -1;
                }
 
              Int_t igstatus = 0;
              while((imo = mparticle->GetFirstMother()) >= 0)
                {
                  igen++;
-                 mparticle =  gAlice->GetMCApp()->Particle(imo);
-                 id_mo = mparticle->GetPdgCode();
+
+                 mparticle =  fAlice->GetMCApp()->Particle(imo);
+                 idmo = mparticle->GetPdgCode();
                  
                  vx = mparticle->Vx();
                  vy = mparticle->Vy();
                  vz = mparticle->Vz();
                
-                 //printf("==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, id_mo, vx, vy, vz);
-                 //fprintf(fpw1,"==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, id_mo, vx, vy, vz);
-                 if ((id_mo == kGamma || id_mo == -11 || id_mo == 11) && vx == 0. && vy == 0. && vz == 0.)
+                 //printf("==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, idmo, vx, vy, vz);
+                 //fprintf(fpw1,"==> Mother ID %5d %5d %5d Vertex: %13.3f %13.3f %13.3f\n", igen, imo, idmo, vx, vy, vz);
+                 if ((idmo == kGamma || idmo == -11 || idmo == 11) && vx == 0. && vy == 0. && vz == 0.)
                    {
                      igatr = imo;
-                     igapid = id_mo;
+                     igapid = idmo;
                      igstatus = 1;
                    }
                  if(igstatus == 0)
                    {
-                     if (id_mo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
+                     if (idmo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
                        {
                          igatr = imo;
-                         igapid = id_mo;
+                         igapid = idmo;
                        }
                    }
                  ichtr = imo;
                }
 
-             if (id_mo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
+             if (idmo == kPi0 && vx == 0. && vy == 0. && vz == 0.)
                {
                  mtrackno = igatr;
                  mtrackpid = igapid;
@@ -487,22 +502,22 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
              else
                {
                  mtrackno  = ichtr;
-                 mtrackpid = id_mo;
+                 mtrackpid = idmo;
                }
-             if (status_old == -1)
+             if (statusOld == -1)
                {
-                 mtrackno  = trackno_old;
-                 mtrackpid = trackpid_old;
+                 mtrackno  = tracknoOld;
+                 mtrackpid = trackpidOld;
                }
              
-             xPos = pmdHit->X();
-             yPos = pmdHit->Y();
-             zPos = pmdHit->Z();
-             edep       = pmdHit->fEnergy;
-             Int_t Vol1 = pmdHit->fVolume[1]; // Column
-             Int_t Vol2 = pmdHit->fVolume[2]; // Row
-             Int_t Vol3 = pmdHit->fVolume[3]; // UnitModule
-             Int_t Vol6 = pmdHit->fVolume[6]; // SuperModule
+             xPos = fPMDHit->X();
+             yPos = fPMDHit->Y();
+             zPos = fPMDHit->Z();
+             edep       = fPMDHit->fEnergy;
+             Int_t vol1 = fPMDHit->fVolume[1]; // Column
+             Int_t vol2 = fPMDHit->fVolume[2]; // Row
+             Int_t vol3 = fPMDHit->fVolume[3]; // UnitModule
+             Int_t vol6 = fPMDHit->fVolume[6]; // SuperModule
 
              // -----------------------------------------//
              // For Super Module 1 & 2                   //
@@ -511,17 +526,17 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
              //  nrow = 48, ncol = 96                    //
              // -----------------------------------------//
              
-             smnumber = (Vol6-1)*6 + Vol3;
+             smnumber = (vol6-1)*6 + vol3;
 
-             if (Vol6 == 1 || Vol6 == 2)
+             if (vol6 == 1 || vol6 == 2)
                {
-                 xpad = Vol1;
-                 ypad = Vol2;
+                 xpad = vol1;
+                 ypad = vol2;
                }
-             else if (Vol6 == 3 || Vol6 == 4)
+             else if (vol6 == 3 || vol6 == 4)
                {
-                 xpad = Vol2;
-                 ypad = Vol1;
+                 xpad = vol2;
+                 ypad = vol1;
                }
 
              //cout << "-zpos = " << -zPos << endl;
@@ -544,12 +559,12 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
              Int_t iyy = ypad     - 1;
              if (fDetNo == 0)
                {
-                 fPMD[smn][ixx][iyy] += edep;
-                 fPMDCounter[smn][ixx][iyy]++;
+                 fPRE[smn][ixx][iyy] += edep;
+                 fPRECounter[smn][ixx][iyy]++;
 
-                 pmdcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep);
+                 fPMDcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep);
 
-                 fCell->Add(pmdcell);
+                 fCell->Add(fPMDcell);
                }
              else if(fDetNo == 1)
                {
@@ -570,17 +585,17 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
 
   for (Int_t idet = 0; idet < 2; idet++)
     {
-      for (Int_t ism = 0; ism < fTotUM; ism++)
+      for (Int_t ism = 0; ism < fgkTotUM; ism++)
        {
-         for (Int_t jrow = 0; jrow < fRow; jrow++)
+         for (Int_t jrow = 0; jrow < fgkRow; jrow++)
            {
-             for (Int_t kcol = 0; kcol < fCol; kcol++)
+             for (Int_t kcol = 0; kcol < fgkCol; kcol++)
                {
-                 cellno = jrow*fCol + kcol;
+                 cellno = jrow*fgkCol + kcol;
                  if (idet == 0)
                    {
-                     deltaE = fPMD[ism][jrow][kcol];
-                     trno   = fPMDTrackNo[ism][jrow][kcol];
+                     deltaE = fPRE[ism][jrow][kcol];
+                     trno   = fPRETrackNo[ism][jrow][kcol];
                      detno = 0;
                    }
                  else if (idet == 1)
@@ -596,11 +611,11 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
                } // column loop
            } // row    loop
        } // supermodule loop
-      treeD->Fill();
+      fTreeD->Fill();
       ResetDigit();
     } // detector loop
 
-  pmdloader->WriteDigits("OVERWRITE");
+  fPMDLoader->WriteDigits("OVERWRITE");
   ResetCellADC();
   
   //  cout << " -------- End of Hits2Digit ----------- " << endl;
@@ -609,32 +624,35 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
 
 void AliPMDDigitizer::SDigits2Digits(Int_t ievt)
 {
+  // This reads the PMD sdigits tree and converts energy deposition
+  // in a cell to ADC and stores in the digits tree
+  //
   //  cout << " -------- Beginning of SDigits2Digit ----------- " << endl;
   fRunLoader->GetEvent(ievt);
 
-  treeS = pmdloader->TreeS();
+  fTreeS = fPMDLoader->TreeS();
   AliPMDsdigit  *pmdsdigit;
-  TBranch *branch = treeS->GetBranch("PMDSDigit");
+  TBranch *branch = fTreeS->GetBranch("PMDSDigit");
   branch->SetAddress(&fSDigits);
 
-  treeD = pmdloader->TreeD();
-  if (treeD == 0x0)
+  fTreeD = fPMDLoader->TreeD();
+  if (fTreeD == 0x0)
     {
-      pmdloader->MakeTree("D");
-      treeD = pmdloader->TreeD();
+      fPMDLoader->MakeTree("D");
+      fTreeD = fPMDLoader->TreeD();
     }
   Int_t bufsize = 16000;
-  treeD->Branch("PMDDigit", &fDigits, bufsize); 
+  fTreeD->Branch("PMDDigit", &fDigits, bufsize); 
 
   Int_t   trno, det, smn;
   Int_t   cellno;
   Float_t edep, adc;
 
-  Int_t nmodules = (Int_t) treeS->GetEntries();
+  Int_t nmodules = (Int_t) fTreeS->GetEntries();
 
   for (Int_t imodule = 0; imodule < nmodules; imodule++)
     {
-      treeS->GetEntry(imodule); 
+      fTreeS->GetEntry(imodule); 
       Int_t nentries = fSDigits->GetLast();
       //cout << " nentries = " << nentries << endl;
       for (Int_t ient = 0; ient < nentries+1; ient++)
@@ -649,10 +667,10 @@ void AliPMDDigitizer::SDigits2Digits(Int_t ievt)
          MeV2ADC(edep,adc);
          AddDigit(trno,det,smn,cellno,adc);      
        }
-      treeD->Fill();
+      fTreeD->Fill();
       ResetDigit();
     }
-  pmdloader->WriteDigits("OVERWRITE");
+  fPMDLoader->WriteDigits("OVERWRITE");
   //  cout << " -------- End of SDigits2Digit ----------- " << endl;
 }
 
@@ -667,50 +685,50 @@ void AliPMDDigitizer::TrackAssignment2Cell()
 
   Int_t i, j, k;
 
-  Float_t *frac_edp;
-  Float_t *tr_edp;
+  Float_t *fracEdp;
+  Float_t *trEdp;
   Int_t *status1;
   Int_t *status2;
   Int_t *trnarray;
-  Int_t   ****PMDTrack;
-  Float_t ****PMDEdep;
+  Int_t   ****pmdTrack;
+  Float_t ****pmdEdep;
 
-  PMDTrack = new Int_t ***[fTotUM];
-  PMDEdep  = new Float_t ***[fTotUM];
-  for (i=0; i<fTotUM; i++)
+  pmdTrack = new Int_t ***[fgkTotUM];
+  pmdEdep  = new Float_t ***[fgkTotUM];
+  for (i=0; i<fgkTotUM; i++)
     {
-      PMDTrack[i] = new Int_t **[fRow];
-      PMDEdep[i]  = new Float_t **[fRow];
+      pmdTrack[i] = new Int_t **[fgkRow];
+      pmdEdep[i]  = new Float_t **[fgkRow];
     }
 
-  for (i = 0; i < fTotUM; i++)
+  for (i = 0; i < fgkTotUM; i++)
     {
-      for (j = 0; j < fRow; j++)
+      for (j = 0; j < fgkRow; j++)
        {
-         PMDTrack[i][j] = new Int_t *[fCol];
-         PMDEdep[i][j]  = new Float_t *[fCol];
+         pmdTrack[i][j] = new Int_t *[fgkCol];
+         pmdEdep[i][j]  = new Float_t *[fgkCol];
        }
     }
   
-  for (i = 0; i < fTotUM; i++)
+  for (i = 0; i < fgkTotUM; i++)
     {
-      for (j = 0; j < fRow; j++)
+      for (j = 0; j < fgkRow; j++)
        {
-         for (k = 0; k < fCol; k++)
+         for (k = 0; k < fgkCol; k++)
            {
-             Int_t nn = fPMDCounter[i][j][k];
+             Int_t nn = fPRECounter[i][j][k];
              if(nn > 0)
                {
-                 PMDTrack[i][j][k] = new Int_t[nn];
-                 PMDEdep[i][j][k] = new Float_t[nn];
+                 pmdTrack[i][j][k] = new Int_t[nn];
+                 pmdEdep[i][j][k] = new Float_t[nn];
                }
              else
                {
                  nn = 1;
-                 PMDTrack[i][j][k] = new Int_t[nn];
-                 PMDEdep[i][j][k] = new Float_t[nn];
+                 pmdTrack[i][j][k] = new Int_t[nn];
+                 pmdEdep[i][j][k] = new Float_t[nn];
                }                     
-             fPMDCounter[i][j][k] = 0;
+             fPRECounter[i][j][k] = 0;
            }
        }
     }
@@ -723,31 +741,31 @@ void AliPMDDigitizer::TrackAssignment2Cell()
 
   for (i = 0; i < nentries; i++)
     {
-      pmdcell = (AliPMDcell*)fCell->UncheckedAt(i);
+      fPMDcell = (AliPMDcell*)fCell->UncheckedAt(i);
       
-      mtrackno = pmdcell->GetTrackNumber();
-      ism = pmdcell->GetSMNumber();
-      ixp = pmdcell->GetX();
-      iyp = pmdcell->GetY();
-      edep = pmdcell->GetEdep();
-      Int_t nn = fPMDCounter[ism][ixp][iyp];
+      mtrackno = fPMDcell->GetTrackNumber();
+      ism      = fPMDcell->GetSMNumber();
+      ixp      = fPMDcell->GetX();
+      iyp      = fPMDcell->GetY();
+      edep     = fPMDcell->GetEdep();
+      Int_t nn = fPRECounter[ism][ixp][iyp];
       //      cout << " nn = " << nn << endl;
-      PMDTrack[ism][ixp][iyp][nn] = (Int_t) mtrackno;
-      PMDEdep[ism][ixp][iyp][nn] = edep;
-      fPMDCounter[ism][ixp][iyp]++;
+      pmdTrack[ism][ixp][iyp][nn] = (Int_t) mtrackno;
+      pmdEdep[ism][ixp][iyp][nn] = edep;
+      fPRECounter[ism][ixp][iyp]++;
     }
   
   Int_t iz, il;
   Int_t im, ix, iy;
   Int_t nn;
   
-  for (im=0; im<fTotUM; im++)
+  for (im=0; im<fgkTotUM; im++)
     {
-      for (ix=0; ix<fRow; ix++)
+      for (ix=0; ix<fgkRow; ix++)
        {
-         for (iy=0; iy<fCol; iy++)
+         for (iy=0; iy<fgkCol; iy++)
            {
-             nn = fPMDCounter[im][ix][iy];
+             nn = fPRECounter[im][ix][iy];
              if (nn > 1)
                {
                  // This block handles if a cell is fired
@@ -757,54 +775,54 @@ void AliPMDDigitizer::TrackAssignment2Cell()
                  trnarray = new Int_t[nn];
                  for (iz = 0; iz < nn; iz++)
                    {
-                     status1[iz] = PMDTrack[im][ix][iy][iz];
+                     status1[iz] = pmdTrack[im][ix][iy][iz];
                    }
                  TMath::Sort(nn,status1,status2,jsort);
-                 Int_t track_old = -99999;
-                 Int_t track, tr_count = 0;
+                 Int_t trackOld = -99999;
+                 Int_t track, trCount = 0;
                  for (iz = 0; iz < nn; iz++)
                    {
                      track = status1[status2[iz]];
-                     if (track_old != track)
+                     if (trackOld != track)
                        {
-                         trnarray[tr_count] = track;
-                         tr_count++;
+                         trnarray[trCount] = track;
+                         trCount++;
                        }                             
-                     track_old = track;
+                     trackOld = track;
                    }
                  delete status1;
                  delete status2;
-                 Float_t tot_edp = 0.;
-                 tr_edp = new Float_t[tr_count];
-                 frac_edp = new Float_t[tr_count];
-                 for (il = 0; il < tr_count; il++)
+                 Float_t totEdp = 0.;
+                 trEdp = new Float_t[trCount];
+                 fracEdp = new Float_t[trCount];
+                 for (il = 0; il < trCount; il++)
                    {
-                     tr_edp[il] = 0.;
+                     trEdp[il] = 0.;
                      track = trnarray[il];
                      for (iz = 0; iz < nn; iz++)
                        {
-                         if (track == PMDTrack[im][ix][iy][iz])
+                         if (track == pmdTrack[im][ix][iy][iz])
                            {
-                             tr_edp[il] += PMDEdep[im][ix][iy][iz];
+                             trEdp[il] += pmdEdep[im][ix][iy][iz];
                            }
                        }
-                     tot_edp += tr_edp[il];
+                     totEdp += trEdp[il];
                    }
-                 Int_t il_old = 0;
-                 Float_t frac_old = 0.;
+                 Int_t ilOld = 0;
+                 Float_t fracOld = 0.;
                  
-                 for (il = 0; il < tr_count; il++)
+                 for (il = 0; il < trCount; il++)
                    {
-                     frac_edp[il] = tr_edp[il]/tot_edp;
-                     if (frac_old < frac_edp[il])
+                     fracEdp[il] = trEdp[il]/totEdp;
+                     if (fracOld < fracEdp[il])
                        {
-                         frac_old = frac_edp[il];
-                         il_old = il;
+                         fracOld = fracEdp[il];
+                         ilOld = il;
                        }
                    }
-                 fPMDTrackNo[im][ix][iy] = trnarray[il_old];
-                 delete frac_edp;
-                 delete tr_edp;
+                 fPRETrackNo[im][ix][iy] = trnarray[ilOld];
+                 delete fracEdp;
+                 delete trEdp;
                  delete trnarray;
                }
              else if (nn == 1)
@@ -812,13 +830,13 @@ void AliPMDDigitizer::TrackAssignment2Cell()
                  // This only handles if a cell is fired
                  // by only one track
                  
-                 fPMDTrackNo[im][ix][iy] = PMDTrack[im][ix][iy][0];
+                 fPRETrackNo[im][ix][iy] = pmdTrack[im][ix][iy][0];
                  
                }
              else if (nn ==0)
                {
                  // This is if no cell is fired
-                 fPMDTrackNo[im][ix][iy] = -999;
+                 fPRETrackNo[im][ix][iy] = -999;
                }
            } // end of iy
        } // end of ix
@@ -826,34 +844,34 @@ void AliPMDDigitizer::TrackAssignment2Cell()
   
   // Delete all the pointers
   
-  for (i = 0; i < fTotUM; i++)
+  for (i = 0; i < fgkTotUM; i++)
     {
-      for (j = 0; j < fRow; j++)
+      for (j = 0; j < fgkRow; j++)
        {
-         for (k = 0; k < fCol; k++)
+         for (k = 0; k < fgkCol; k++)
            {
-             delete [] PMDTrack[i][j][k];
-             delete [] PMDEdep[i][j][k];
+             delete [] pmdTrack[i][j][k];
+             delete [] pmdEdep[i][j][k];
            }
        }
     }
   
-  for (i = 0; i < fTotUM; i++)
+  for (i = 0; i < fgkTotUM; i++)
     {
-      for (j = 0; j < fRow; j++)
+      for (j = 0; j < fgkRow; j++)
        {
-         delete [] PMDTrack[i][j];
-         delete [] PMDEdep[i][j];
+         delete [] pmdTrack[i][j];
+         delete [] pmdEdep[i][j];
        }
     }
   
-  for (i = 0; i < fTotUM; i++)
+  for (i = 0; i < fgkTotUM; i++)
     {
-      delete [] PMDTrack[i];
-      delete [] PMDEdep[i];
+      delete [] pmdTrack[i];
+      delete [] pmdEdep[i];
     }
-  delete PMDTrack;
-  delete PMDEdep;
+  delete pmdTrack;
+  delete pmdEdep;
   // 
   // End of the cell id assignment
   //
@@ -862,13 +880,17 @@ void AliPMDDigitizer::TrackAssignment2Cell()
 
 void AliPMDDigitizer::MeV2ADC(Float_t mev, Float_t & adc)
 {
+  // This converts the simulated edep to ADC according to the
+  // Test Beam Data
   // To be done
-
+  //
   adc = mev*1.;
 }
 void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber, 
   Int_t cellnumber, Float_t adc)
 {
+  // Add SDigit
+  //
   TClonesArray &lsdigits = *fSDigits;
   AliPMDsdigit *newcell;
   newcell = new AliPMDsdigit(trnumber,det,smnumber,cellnumber,adc);
@@ -879,6 +901,8 @@ void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber,
 void AliPMDDigitizer::AddDigit(Int_t trnumber, Int_t det, Int_t smnumber, 
   Int_t cellnumber, Float_t adc)
 {
+  // Add Digit
+  //
   TClonesArray &ldigits = *fDigits;
   AliPMDdigit *newcell;
   newcell = new AliPMDdigit(trnumber,det,smnumber,cellnumber,adc);
@@ -886,43 +910,6 @@ void AliPMDDigitizer::AddDigit(Int_t trnumber, Int_t det, Int_t smnumber,
   delete newcell;
 }
 
-Int_t AliPMDDigitizer::Convert2RealSMNumber(Int_t smnumber1)
-{
-  Int_t smnumber = -999;
-
-  if (smnumber1==1)  smnumber =  1;
-  if (smnumber1==2)  smnumber = 10;
-  if (smnumber1==3)  smnumber = 19;
-  if (smnumber1==4)  smnumber =  1;
-  if (smnumber1==5)  smnumber = 10;
-  if (smnumber1==6)  smnumber = 19;
-  if (smnumber1==7)  smnumber =  2;
-  if (smnumber1==8)  smnumber =  3;
-  if (smnumber1==9)  smnumber =  4;
-  if (smnumber1==10) smnumber =  5;
-  if (smnumber1==11) smnumber =  6;
-  if (smnumber1==12) smnumber =  7;
-  if (smnumber1==13) smnumber =  8;
-  if (smnumber1==14) smnumber =  9;
-  if (smnumber1==15) smnumber = 11;
-  if (smnumber1==16) smnumber = 12;
-  if (smnumber1==17) smnumber = 13;
-  if (smnumber1==18) smnumber = 14;
-  if (smnumber1==19) smnumber = 15;
-  if (smnumber1==20) smnumber = 16;
-  if (smnumber1==21) smnumber = 17;
-  if (smnumber1==22) smnumber = 18;
-  if (smnumber1==23) smnumber = 20;
-  if (smnumber1==24) smnumber = 21;
-  if (smnumber1==25) smnumber = 22;
-  if (smnumber1==26) smnumber = 23;
-  if (smnumber1==27) smnumber = 24;
-  if (smnumber1==28) smnumber = 25;
-  if (smnumber1==29) smnumber = 26;
-  if (smnumber1==30) smnumber = 27;
-
-  return smnumber;
-}
 void AliPMDDigitizer::SetZPosition(Float_t zpos)
 {
   fZPos = zpos;
@@ -934,39 +921,45 @@ Float_t AliPMDDigitizer::GetZPosition() const
 
 void AliPMDDigitizer::ResetCell()
 {
+  // clears the cell array and also the counter
+  //  for each cell
+  //
   fCell->Clear();
-  for (Int_t i = 0; i < fTotUM; i++)
+  for (Int_t i = 0; i < fgkTotUM; i++)
     {
-      for (Int_t j = 0; j < fRow; j++)
+      for (Int_t j = 0; j < fgkRow; j++)
        {
-         for (Int_t k = 0; k < fCol; k++)
+         for (Int_t k = 0; k < fgkCol; k++)
            {
-             fPMDCounter[i][j][k] = 0; 
+             fPRECounter[i][j][k] = 0; 
            }
        }
     }
 }
 void AliPMDDigitizer::ResetSDigit()
 {
+  // Clears SDigits
   fNsdigit = 0;
   if (fSDigits) fSDigits->Clear();
 }
 void AliPMDDigitizer::ResetDigit()
 {
+  // Clears Digits
   fNdigit = 0;
   if (fDigits) fDigits->Clear();
 }
 
 void AliPMDDigitizer::ResetCellADC()
 {
-  for (Int_t i = 0; i < fTotUM; i++)
+  // Clears individual cells edep
+  for (Int_t i = 0; i < fgkTotUM; i++)
     {
-      for (Int_t j = 0; j < fRow; j++)
+      for (Int_t j = 0; j < fgkRow; j++)
        {
-         for (Int_t k = 0; k < fCol; k++)
+         for (Int_t k = 0; k < fgkCol; k++)
            {
              fCPV[i][j][k] = 0.; 
-             fPMD[i][j][k] = 0.; 
+             fPRE[i][j][k] = 0.; 
            }
        }
     }
@@ -974,6 +967,8 @@ void AliPMDDigitizer::ResetCellADC()
 
 void AliPMDDigitizer::UnLoad(Option_t *option)
 {
+  // Unloads all the root files
+  //
   const char *cS = strstr(option,"S");
   const char *cD = strstr(option,"D");
 
@@ -983,11 +978,11 @@ void AliPMDDigitizer::UnLoad(Option_t *option)
 
   if (cS)
     {
-      pmdloader->UnloadHits();
+      fPMDLoader->UnloadHits();
     }
   if (cD)
     {
-      pmdloader->UnloadHits();
-      pmdloader->UnloadSDigits();
+      fPMDLoader->UnloadHits();
+      fPMDLoader->UnloadSDigits();
     }
 }
index 9c3dbdc..15041a2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef PMDDigitizer_H
-#define PMDDigitizer_H
+#ifndef ALIPMDDIGITIZER_H
+#define ALIPMDDIGITIZER_H
 //-----------------------------------------------------//
 //                                                     //
 //  Header File : PMDDigitization.h, Version 00        //
@@ -8,14 +8,9 @@
 //                                                     //
 //-----------------------------------------------------//
 
-#include <Riostream.h>
-#include <stdlib.h>
-#include <math.h>
-#include <TMath.h>
-
 class TClonesArray;
 class TFile;
-
+class TMath;
 class TObjArray;
 class TParticle;
 class TTree;
@@ -36,60 +31,23 @@ class AliPMDClustering;
 
 class AliPMDDigitizer
 {
- protected:
-  AliRunLoader *fRunLoader;
-  AliRun       *gAlice;
-  AliPMDhit    *pmdHit;   /* Pointer to specific detector hits. */
-  AliDetector  *PMD;      /* Get pointers to Alice detectors 
-                            and Hits containers */
-  AliLoader    *pmdloader;
-
-  TClonesArray *PMDhits;
-  TObjArray    *Particles;
-  TParticle    *particle;
-
-  TTree        *treeH;
-  TTree        *treeS;
-  TTree        *treeD;
-
-  TClonesArray *fSDigits;
-  TClonesArray *fDigits;
-
-  TObjArray    *fCell;
-  AliPMDcell   *pmdcell;
-
-  Int_t fNsdigit;
-  Int_t fNdigit;
-  Int_t fDetNo;
-  Float_t fZPos;
-
-  static const Int_t fTotUM = 24;
-  static const Int_t fRow   = 48;
-  static const Int_t fCol   = 96;
-  Float_t fCPV[fTotUM][fRow][fCol];
-  Float_t fPMD[fTotUM][fRow][fCol];
-  Int_t   fPMDCounter[fTotUM][fRow][fCol];
-  Int_t   fPMDTrackNo[fTotUM][fRow][fCol];
-  Int_t   fCPVTrackNo[fTotUM][fRow][fCol];
-
  public:
 
   AliPMDDigitizer();
   virtual ~AliPMDDigitizer();
 
-  void OpengAliceFile(char * /* galice.root */, Option_t * /* option */);
+  void OpengAliceFile(char *file, Option_t *option);
 
-  void Hits2SDigits(Int_t /* ievt */);
-  void Hits2Digits(Int_t /* ievt */);
-  void SDigits2Digits(Int_t /* ievt */);
+  void Hits2SDigits(Int_t ievt);
+  void Hits2Digits(Int_t ievt);
+  void SDigits2Digits(Int_t ievt);
   void TrackAssignment2Cell();
-  void MeV2ADC(Float_t /* mev */, Float_t & /* adc */);
-  void AddSDigit(Int_t /* trnumber */, Int_t /* det */, Int_t /* smnumber */, 
-                Int_t /* cellnumber */, Float_t /* adc */);
-  void AddDigit(Int_t /* trnumber */, Int_t /* det */, Int_t /* smnumber */, 
-               Int_t /* cellnumber */, Float_t /* adc */);
-  Int_t Convert2RealSMNumber(Int_t /* smnumber1 */ );
-  void SetZPosition(Float_t /* zpos */);
+  void MeV2ADC(Float_t mev, Float_t & adc);
+  void AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber, 
+                Int_t cellnumber, Float_t adc);
+  void AddDigit(Int_t trnumber, Int_t det, Int_t smnumber, 
+               Int_t cellnumber, Float_t adc);
+  void  SetZPosition(Float_t zpos);
   Float_t GetZPosition() const;
   void ResetCell();
   void ResetSDigit();
@@ -97,7 +55,45 @@ class AliPMDDigitizer
   void ResetCellADC();
   void UnLoad(Option_t * /* option */);
 
-  ClassDef(AliPMDDigitizer,2)
+ protected:
+  AliRunLoader *fRunLoader;  // Pointer to Run Loader
+  AliRun       *fAlice;      // Pointer to a Run
+  AliPMDhit    *fPMDHit;     // Pointer to specific detector hits
+  AliDetector  *fPMD;        // Get pointers to Alice detectors 
+                             // and Hits containers 
+  AliLoader    *fPMDLoader;  // Pointer to specific detector loader
+
+  TClonesArray *fHits;       // Pointer to hits array
+  TObjArray    *fPArray;     // Pointer to particle array
+  TParticle    *fParticle;   // Pointer to a given particle
+
+  TTree        *fTreeH;      // Hits tree
+  TTree        *fTreeS;      // Summable Digits tree
+  TTree        *fTreeD;      // Digits tree
+
+  TClonesArray *fSDigits;    // List of summable digits
+  TClonesArray *fDigits;     // List of digits
+
+  TObjArray    *fCell;       // List of pmd cells
+  AliPMDcell   *fPMDcell;    // Pointer to a PMD cell
+
+  Int_t   fNsdigit;          // Summable digits counter
+  Int_t   fNdigit;           // Digits counter
+  Int_t   fDetNo;            // Detector Number (0:PRE, 1:CPV)
+  Float_t fZPos;             // z-position of the detector
+
+  static const Int_t fgkTotUM = 24; // Total Unit modules in one detector
+  static const Int_t fgkRow   = 48; // Total number of rows in one unitmodule
+  static const Int_t fgkCol   = 96; // Total number of cols in one unitmodule
+  Float_t fCPV[fgkTotUM][fgkRow][fgkCol]; // CPV Array containing total edep
+  Float_t fPRE[fgkTotUM][fgkRow][fgkCol]; // PRE Array containing total edep
+  Int_t   fPRECounter[fgkTotUM][fgkRow][fgkCol]; // Number of times each cell
+                                                 // is fired in PMD
+  Int_t   fPRETrackNo[fgkTotUM][fgkRow][fgkCol]; // PRE Array containing track number
+  Int_t   fCPVTrackNo[fgkTotUM][fgkRow][fgkCol]; // CPV Array containing track number
+
+
+  ClassDef(AliPMDDigitizer,2)    // To digitize PMD Hits
 };
 #endif
 
index c43c38c..ea06be2 100644 (file)
@@ -7,12 +7,16 @@
 //                                                     //
 //-----------------------------------------------------//
 
+#include "Riostream.h"
+#include "Rtypes.h"
+
 #include "AliPMDcell.h"
 
 ClassImp(AliPMDcell)
 
 AliPMDcell::AliPMDcell()
 {
+  // Standard constructor
   fTrNumber = 0;
   fSMNumber = 0;
   fXpos     = 0;
@@ -23,6 +27,7 @@ AliPMDcell::AliPMDcell()
 AliPMDcell::AliPMDcell(Int_t trnumber, Int_t smnumber, 
                         Int_t xpos, Int_t ypos, Float_t edep)
 {
+  // Constructor
   fTrNumber = trnumber;
   fSMNumber = smnumber;
   fXpos     = xpos;
@@ -32,7 +37,7 @@ AliPMDcell::AliPMDcell(Int_t trnumber, Int_t smnumber,
 }
 AliPMDcell::~AliPMDcell()
 {
-
+  // Default destructor
 }
 
 Int_t AliPMDcell::GetTrackNumber() const
index 4f6f91d..33e3dd1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef PMDcell_H
-#define PMDcell_H
+#ifndef ALIPMDCELL_H
+#define ALIPMDCELL_H
 //-----------------------------------------------------//
 //                                                     //
 //  Date   : August 05 2003                            //
@@ -9,24 +9,22 @@
 //                                                     //
 //-----------------------------------------------------//
 
-#include "Riostream.h"
-#include "Rtypes.h"
+//#include "Riostream.h"
+//#include "Rtypes.h"
 #include "TObject.h"
-#include "TClonesArray.h"
+//class TObject;
+class TClonesArray;
 
 class AliPMDcell : public TObject
 {
-  
- protected:
-  Int_t   fTrNumber, fSMNumber, fXpos, fYpos;
-  Float_t fEdep;
-
  public:
   AliPMDcell();
-  AliPMDcell(Int_t /* trnumber */, Int_t /* smnumber */,
-             Int_t /* xpos */, Int_t /* ypos */, Float_t /* edep */);
+  AliPMDcell(Int_t trnumber, Int_t smnumber,
+             Int_t xpos, Int_t ypos, Float_t edep);
   AliPMDcell(AliPMDcell *pmdcell) {*this = *pmdcell;}
-  
+  AliPMDcell (const AliPMDcell &alipmdcell);  // dummy copy constructor
+  AliPMDcell &operator=(const AliPMDcell &alipmdcell); // dummy assignment op
+
   virtual ~AliPMDcell();
 
   Int_t   GetTrackNumber() const;
@@ -35,7 +33,14 @@ class AliPMDcell : public TObject
   Int_t   GetY() const;
   Float_t GetEdep() const;
   
-  ClassDef(AliPMDcell,1)
+ protected:
+  Int_t   fTrNumber;     // Track Number
+  Int_t   fSMNumber;     // Serial Module Number
+  Int_t   fXpos;         // x-position of the cell
+  Int_t   fYpos;         // y-position of the cell
+  Float_t fEdep;         // Energy deposition in a cell
+  
+  ClassDef(AliPMDcell,1) // To keep cell information
 };
 
 #endif
index 10109aa..5826f69 100644 (file)
@@ -14,6 +14,9 @@
  **************************************************************************/
 /*
 $Log$
+Revision 1.30  2003/10/23 16:32:19  hristov
+MC-dependent part of AliRun extracted in AliMC (F.Carminati)
+
 Revision 1.29  2003/10/13 05:28:59  bnandi
 gaspmd[2] value changed 0.25->7.0 because of overlap
 
@@ -60,14 +63,14 @@ June 2003
 #include <TVirtualMC.h>
 #include "AliMC.h"
  
-static Int_t     ncol_um1,ncol_um2, nrow_um1, nrow_um2;
-static Int_t     kdet;
-static Float_t   sm_length_ax,sm_length_ay;
-static Float_t   sm_length_bx,sm_length_by;
-static Float_t   zdist, zdist1;
-static Float_t   sm_thick, cell_radius, cell_wall, cell_depth;
-static Float_t   boundary, th_base, th_air, th_pcb;
-static Float_t   th_lead, th_steel;
+static Int_t     gAliNcolUM1, gAliNcolUM2, gAliNrowUM1, gAliNrowUM2;
+static Int_t     gAliKdet;
+static Float_t   gAliSMLengthax, gAliSMLengthay;
+static Float_t   gAliSMLengthbx, gAliSMLengthby;
+static Float_t   gAliZdist, gAliZdist1;
+static Float_t   gAliSMthick, gAliCellRadius, gAliCellWall, gAliCellDepth;
+static Float_t   gAliBoundary, gAliThBase, gAliThAir, gAliThPCB;
+static Float_t   gAliThLead, gAliThSteel;
 
 ClassImp(AliPMDv1)
  
@@ -124,23 +127,23 @@ void AliPMDv1::CreateSupermodule()
   Float_t xb, yb, zb;
   Int_t number;
   Int_t ihrotm,irotdm;
-  const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
-  const Float_t root3 = TMath::Sqrt(3.); 
+  const Float_t kroot3by2 = TMath::Sqrt(3.) /2.; 
+  const Float_t kroot3 = TMath::Sqrt(3.); 
   Int_t *idtmed = fIdtmed->GetArray()-599;
  
   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
  
-  zdist = TMath::Abs(zdist1);
+  gAliZdist = TMath::Abs(gAliZdist1);
 
   // First create the sensitive medium of a hexagon cell (ECAR)
   // Inner hexagon filled with gas (Ar+CO2)
   
   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
-  hexd2[4] = -cell_depth/2.;
-  hexd2[7] =  cell_depth/2.;
-  hexd2[6] =  cell_radius - cell_wall;
-  hexd2[9] =  cell_radius - cell_wall;
+  hexd2[4] = -gAliCellDepth/2.;
+  hexd2[7] =  gAliCellDepth/2.;
+  hexd2[6] =  gAliCellRadius - gAliCellWall;
+  hexd2[9] =  gAliCellRadius - gAliCellWall;
   
   gMC->Gsvolu("ECAR", "PGON", idtmed[604], hexd2,10);
   gMC->Gsatt("ECAR", "SEEN", 0);
@@ -149,10 +152,10 @@ void AliPMDv1::CreateSupermodule()
   // Outer hexagon made of Copper
   
   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
-  hexd1[4] = -cell_depth/2.;
-  hexd1[7] =  cell_depth/2.;
-  hexd1[6] =  cell_radius;
-  hexd1[9] =  cell_radius;
+  hexd1[4] = -gAliCellDepth/2.;
+  hexd1[7] =  gAliCellDepth/2.;
+  hexd1[6] =  gAliCellRadius;
+  hexd1[9] =  gAliCellRadius;
 
   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
   gMC->Gsatt("ECCU", "SEEN", 0);
@@ -167,9 +170,9 @@ void AliPMDv1::CreateSupermodule()
   // volume for first strip EST1 made of AIR 
 
   Float_t dbox1[3];
-  dbox1[0] = ncol_um1*cell_radius;
-  dbox1[1] = cell_radius/root3_2;
-  dbox1[2] = cell_depth/2.;
+  dbox1[0] = gAliNcolUM1*gAliCellRadius;
+  dbox1[1] = gAliCellRadius/kroot3by2;
+  dbox1[2] = gAliCellDepth/2.;
   
   gMC->Gsvolu("EST1","BOX", idtmed[698], dbox1, 3);
   gMC->Gsatt("EST1", "SEEN", 0);
@@ -177,7 +180,7 @@ void AliPMDv1::CreateSupermodule()
   // volume for second strip EST2 
 
   Float_t dbox2[3];
-  dbox2[0] = ncol_um2*cell_radius;
+  dbox2[0] = gAliNcolUM2*gAliCellRadius;
   dbox2[1] = dbox1[1];
   dbox2[2] = dbox1[2];
 
@@ -187,22 +190,22 @@ void AliPMDv1::CreateSupermodule()
   // Place hexagonal cells ECCU placed inside EST1 
   yb = 0.; 
   zb = 0.;
-  xb = -(dbox1[0]) + cell_radius; 
-  for (i = 1; i <= ncol_um1; ++i) 
+  xb = -(dbox1[0]) + gAliCellRadius; 
+  for (i = 1; i <= gAliNcolUM1; ++i) 
        {
          number = i;
          gMC->Gsposp("ECCU", number, "EST1", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
-         xb += (cell_radius*2.);
+         xb += (gAliCellRadius*2.);
        }
   // Place hexagonal cells ECCU placed inside EST2 
       yb = 0.; 
       zb = 0.;
-      xb = -(dbox2[0]) + cell_radius; 
-      for (i = 1; i <= ncol_um2; ++i) 
+      xb = -(dbox2[0]) + gAliCellRadius; 
+      for (i = 1; i <= gAliNcolUM2; ++i) 
        {
          number = i;
          gMC->Gsposp("ECCU", number, "EST2", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
-         xb += (cell_radius*2.);
+         xb += (gAliCellRadius*2.);
        }
 
 
@@ -212,9 +215,9 @@ void AliPMDv1::CreateSupermodule()
   // Create EUM1
 
   Float_t dbox3[3];
-  dbox3[0] = dbox1[0]+cell_radius/2.;
-  dbox3[1] = (dbox1[1]*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.); 
-  dbox3[2] = cell_depth/2.;
+  dbox3[0] = dbox1[0]+gAliCellRadius/2.;
+  dbox3[1] = (dbox1[1]*gAliNrowUM1)-(gAliCellRadius*kroot3*(gAliNrowUM1-1)/6.); 
+  dbox3[2] = gAliCellDepth/2.;
   
   gMC->Gsvolu("EUM1","BOX", idtmed[698], dbox3, 3);
   gMC->Gsatt("EUM1", "SEEN", 1);
@@ -222,26 +225,26 @@ void AliPMDv1::CreateSupermodule()
   // Place rectangular strips EST1 inside EUM1 unit module
 
   yb = -dbox3[1]+dbox1[1];  
-  for (j = 1; j <= nrow_um1; ++j)  
+  for (j = 1; j <= gAliNrowUM1; ++j)  
     {
       if(j%2 == 0)
        {
-      xb =cell_radius/2.0;
+      xb =gAliCellRadius/2.0;
        }
       else
        {
-         xb = -cell_radius/2.0;
+         xb = -gAliCellRadius/2.0;
        }
       number = j;
       gMC->Gsposp("EST1",number, "EUM1", xb, yb , 0. , 0, "MANY",dbox1,3);
-      yb = (-dbox3[1]+dbox1[1])+j*1.0*cell_radius*root3;
+      yb = (-dbox3[1]+dbox1[1])+j*1.0*gAliCellRadius*kroot3;
     }
 
   // Create EUM2
 
   Float_t dbox4[3];
-  dbox4[0] = dbox2[0]+cell_radius/2.;
-  dbox4[1] =(dbox2[1]*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.); 
+  dbox4[0] = dbox2[0]+gAliCellRadius/2.;
+  dbox4[1] =(dbox2[1]*gAliNrowUM2)-(gAliCellRadius*kroot3*(gAliNrowUM2-1)/6.); 
   dbox4[2] = dbox3[2];
 
   gMC->Gsvolu("EUM2","BOX", idtmed[698], dbox4, 3);
@@ -250,19 +253,19 @@ void AliPMDv1::CreateSupermodule()
   // Place rectangular strips EST2 inside EUM2 unit module
 
   yb = -dbox4[1]+dbox2[1]; 
-  for (j = 1; j <= nrow_um2; ++j) 
+  for (j = 1; j <= gAliNrowUM2; ++j) 
       {
       if(j%2 == 0)
        {
-      xb =cell_radius/2.0;
+      xb =gAliCellRadius/2.0;
        }
       else
        {
-         xb = -cell_radius/2.0;
+         xb = -gAliCellRadius/2.0;
        }
       number = j;
       gMC->Gsposp("EST2",number, "EUM2", xb, yb , 0. , 0, "MANY",dbox2,3);
-      yb = (-dbox4[1]+dbox2[1])+j*1.0*cell_radius*root3;
+      yb = (-dbox4[1]+dbox2[1])+j*1.0*gAliCellRadius*kroot3;
     }
 
   // 2 types of Rectangular shaped supermodules (BOX) 
@@ -271,235 +274,231 @@ void AliPMDv1::CreateSupermodule()
   // volume for SUPERMODULE ESMA 
   //Space added to provide a gapping for HV between UM's
 
-  Float_t dbox_sm1[3];
-  dbox_sm1[0] = 3.0*dbox3[0]+(2.0*0.025);
-  dbox_sm1[1] = 2.0*dbox3[1]+0.025;
-  dbox_sm1[2] = cell_depth/2.;
+  Float_t dboxSM1[3];
+  dboxSM1[0] = 3.0*dbox3[0]+(2.0*0.025);
+  dboxSM1[1] = 2.0*dbox3[1]+0.025;
+  dboxSM1[2] = gAliCellDepth/2.;
 
-  gMC->Gsvolu("ESMA","BOX", idtmed[698], dbox_sm1, 3);
+  gMC->Gsvolu("ESMA","BOX", idtmed[698], dboxSM1, 3);
   gMC->Gsatt("ESMA", "SEEN", 1);
 
   //Position the 6 unit modules in EMSA
-  Float_t x_a1,x_a2,x_a3,y_a1,y_a2; 
-  x_a1 = -dbox_sm1[0] + dbox3[0];
-  x_a2 = 0.;
-  x_a3 = dbox_sm1[0]  - dbox3[0]; 
-  y_a1 = dbox_sm1[1]  - dbox3[1];
-  y_a2 = -dbox_sm1[1] + dbox3[1];
+  Float_t xa1,xa2,xa3,ya1,ya2; 
+  xa1 = -dboxSM1[0] + dbox3[0];
+  xa2 = 0.;
+  xa3 = dboxSM1[0]  - dbox3[0]; 
+  ya1 = dboxSM1[1]  - dbox3[1];
+  ya2 = -dboxSM1[1] + dbox3[1];
   
-  gMC->Gsposp("EUM1", 1, "ESMA", x_a1, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 2, "ESMA", x_a2, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 3, "ESMA", x_a3, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 4, "ESMA", x_a1, y_a2, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 5, "ESMA", x_a2, y_a2, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 6, "ESMA", x_a3, y_a2, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 1, "ESMA", xa1, ya1, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 2, "ESMA", xa2, ya1, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 3, "ESMA", xa3, ya1, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 4, "ESMA", xa1, ya2, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 5, "ESMA", xa2, ya2, 0., 0, "ONLY",dbox3,3);
+  gMC->Gsposp("EUM1", 6, "ESMA", xa3, ya2, 0., 0, "ONLY",dbox3,3);
 
 
   // volume for SUPERMODULE ESMB 
   //Space is added to provide a gapping for HV between UM's
-  Float_t dbox_sm2[3];
-  dbox_sm2[0] = 2.0*dbox4[0]+0.025;
-  dbox_sm2[1] = 3.0*dbox4[1]+(2.0*0.025);
-  dbox_sm2[2] = cell_depth/2.;
+  Float_t dboxSM2[3];
+  dboxSM2[0] = 2.0*dbox4[0]+0.025;
+  dboxSM2[1] = 3.0*dbox4[1]+(2.0*0.025);
+  dboxSM2[2] = gAliCellDepth/2.;
   
-  gMC->Gsvolu("ESMB","BOX", idtmed[698], dbox_sm2, 3);
+  gMC->Gsvolu("ESMB","BOX", idtmed[698], dboxSM2, 3);
   gMC->Gsatt("ESMB", "SEEN", 1);
-
   //Position the 6 unit modules in EMSB
-  Float_t x_b1,x_b2,y_b1,y_b2,y_b3; 
-  x_b1 = -dbox_sm2[0] +dbox4[0];
-  x_b2 = dbox_sm2[0]-dbox4[0];
-  y_b1  =dbox_sm2[1]-dbox4[1];
-  y_b2  = 0.; 
-  y_b3  = -dbox_sm2[1]+dbox4[1];
+  Float_t xb1,xb2,yb1,yb2,yb3; 
+  xb1 = -dboxSM2[0] +dbox4[0];
+  xb2 = dboxSM2[0]-dbox4[0];
+  yb1 = dboxSM2[1]-dbox4[1];
+  yb2 = 0.; 
+  yb3 = -dboxSM2[1]+dbox4[1];
   
-  gMC->Gsposp("EUM2", 1, "ESMB", x_b1, y_b1, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 2, "ESMB", x_b2, y_b1, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 3, "ESMB", x_b1, y_b2, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 4, "ESMB", x_b2, y_b2, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 5, "ESMB", x_b1, y_b3, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 6, "ESMB", x_b2, y_b3, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 1, "ESMB", xb1, yb1, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 2, "ESMB", xb2, yb1, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 3, "ESMB", xb1, yb2, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 4, "ESMB", xb2, yb2, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 5, "ESMB", xb1, yb3, 0., 0, "ONLY",dbox4,3);
+  gMC->Gsposp("EUM2", 6, "ESMB", xb2, yb3, 0., 0, "ONLY",dbox4,3);
 
 
   // Make a 3mm thick G10 Base plate for ESMA
-  Float_t dbox_g1a[3];
-  dbox_g1a[0] = dbox_sm1[0]; 
-  dbox_g1a[1] = dbox_sm1[1];       
-  dbox_g1a[2] = th_base/2.;
+  Float_t dboxG1a[3];
+  dboxG1a[0] = dboxSM1[0]; 
+  dboxG1a[1] = dboxSM1[1];       
+  dboxG1a[2] = gAliThBase/2.;
 
-  gMC->Gsvolu("EBPA","BOX", idtmed[607], dbox_g1a, 3);
+  gMC->Gsvolu("EBPA","BOX", idtmed[607], dboxG1a, 3);
   gMC->Gsatt("EBPA", "SEEN", 1);
 
   // Make a 1.6mm thick G10 PCB for ESMA
-  Float_t dbox_g2a[3];
-  dbox_g2a[0] = dbox_sm1[0]; 
-  dbox_g2a[1] = dbox_sm1[1];       
-  dbox_g2a[2] = th_pcb/2.;
+  Float_t dboxG2a[3];
+  dboxG2a[0] = dboxSM1[0]; 
+  dboxG2a[1] = dboxSM1[1];       
+  dboxG2a[2] = gAliThPCB/2.;
 
-  gMC->Gsvolu("EPCA","BOX", idtmed[607], dbox_g2a, 3);
+  gMC->Gsvolu("EPCA","BOX", idtmed[607], dboxG2a, 3);
   gMC->Gsatt("EPCA", "SEEN", 1);
 
 
   // Make a Full module EFPA of AIR to place EBPA, 
   // 1mm AIR, EPCA, ESMA,EPCA for PMD
   
-  Float_t dbox_alla[3];
-  dbox_alla[0] = dbox_sm1[0]; 
-  dbox_alla[1] = dbox_sm1[1];       
-  dbox_alla[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
+  Float_t dboxAlla[3];
+  dboxAlla[0] = dboxSM1[0]; 
+  dboxAlla[1] = dboxSM1[1];       
+  dboxAlla[2] = (gAliThBase+0.1+gAliThPCB+dboxSM1[2]+gAliThPCB)/2.;
 
-  gMC->Gsvolu("EFPA","BOX", idtmed[698], dbox_alla, 3);
+  gMC->Gsvolu("EFPA","BOX", idtmed[698], dboxAlla, 3);
   gMC->Gsatt("EFPA", "SEEN", 1);
 
 
   // Make a Full module EFCA of AIR to place EBPA, 
   // 1mm AIR, EPCA, ESMA,EPC for CPV
-  Float_t dbox_alla2[3];
-  dbox_alla2[0] = dbox_sm1[0]; 
-  dbox_alla2[1] = dbox_sm1[1];       
-  dbox_alla2[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
+  Float_t dboxAlla2[3];
+  dboxAlla2[0] = dboxSM1[0]; 
+  dboxAlla2[1] = dboxSM1[1];       
+  dboxAlla2[2] = (gAliThBase+0.1+gAliThPCB+dboxSM1[2]+gAliThPCB)/2.;
 
-  gMC->Gsvolu("EFCA","BOX", idtmed[698], dbox_alla2, 3);
+  gMC->Gsvolu("EFCA","BOX", idtmed[698], dboxAlla2, 3);
   gMC->Gsatt("EFCA", "SEEN", 1);
 
   // Now place everything in EFPA for PMD
 
-  Float_t z_bpa,z_pcba1,z_pcba2,z_sma; 
-  z_pcba1 = - dbox_alla[2]+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 1, "EFPA", 0., 0., z_pcba1, 0, "ONLY",dbox_g2a,3);
-  z_sma = z_pcba1+dbox_sm1[2];
-  gMC->Gsposp("ESMA", 1, "EFPA", 0., 0., z_sma, 0, "ONLY",dbox_sm1,3);
-  z_pcba2 = z_sma+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 2, "EFPA", 0., 0., z_pcba2, 0, "ONLY",dbox_g2a,3);
-  z_bpa = z_pcba2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
-  gMC->Gsposp("EBPA", 1, "EFPA", 0., 0., z_bpa, 0, "ONLY",dbox_g1a,3);
+  Float_t zbpa,zpcba1,zpcba2,zsma; 
+  zpcba1 = - dboxAlla[2]+gAliThPCB/2.0;
+  gMC->Gsposp("EPCA", 1, "EFPA", 0., 0., zpcba1, 0, "ONLY",dboxG2a,3);
+  zsma = zpcba1+dboxSM1[2];
+  gMC->Gsposp("ESMA", 1, "EFPA", 0., 0., zsma, 0, "ONLY",dboxSM1,3);
+  zpcba2 = zsma+gAliThPCB/2.0;
+  gMC->Gsposp("EPCA", 2, "EFPA", 0., 0., zpcba2, 0, "ONLY",dboxG2a,3);
+  zbpa = zpcba2+0.1+gAliThBase/2.0; // 0.1 for 0.1 mm Air gap 
+  gMC->Gsposp("EBPA", 1, "EFPA", 0., 0., zbpa, 0, "ONLY",dboxG1a,3);
 
   // Now place everything in EFCA for CPV
 
-  Float_t z_bpa2,z_pcba12,z_pcba22,z_sma2; 
-  z_bpa2 = - dbox_alla2[2]+th_base/2.0;
-  gMC->Gsposp("EBPA", 1, "EFCA", 0., 0., z_bpa2, 0, "ONLY",dbox_g1a,3);
-  z_pcba12 = z_bpa2+0.1+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 1, "EFCA", 0., 0., z_pcba12, 0, "ONLY",dbox_g2a,3);
-  z_sma2 = z_pcba12+dbox_sm1[2];
-  gMC->Gsposp("ESMA", 1, "EFCA", 0., 0., z_sma2, 0, "ONLY",dbox_sm1,3);
-  z_pcba22 = z_sma2+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 2, "EFCA", 0., 0., z_pcba22, 0, "ONLY",dbox_g2a,3);
+  Float_t zbpa2,zpcba12,zpcba22,zsma2; 
+  zbpa2 = - dboxAlla2[2]+gAliThBase/2.0;
+  gMC->Gsposp("EBPA", 1, "EFCA", 0., 0., zbpa2, 0, "ONLY",dboxG1a,3);
+  zpcba12 = zbpa2+0.1+gAliThPCB/2.0;
+  gMC->Gsposp("EPCA", 1, "EFCA", 0., 0., zpcba12, 0, "ONLY",dboxG2a,3);
+  zsma2 = zpcba12+dboxSM1[2];
+  gMC->Gsposp("ESMA", 1, "EFCA", 0., 0., zsma2, 0, "ONLY",dboxSM1,3);
+  zpcba22 = zsma2+gAliThPCB/2.0;
+  gMC->Gsposp("EPCA", 2, "EFCA", 0., 0., zpcba22, 0, "ONLY",dboxG2a,3);
 
 
 
   // Make a 3mm thick G10 Base plate for ESMB
-  Float_t dbox_g1b[3];
-  dbox_g1b[0] = dbox_sm2[0]; 
-  dbox_g1b[1] = dbox_sm2[1];       
-  dbox_g1b[2] = th_base/2.;
+  Float_t dboxG1b[3];
+  dboxG1b[0] = dboxSM2[0]; 
+  dboxG1b[1] = dboxSM2[1];       
+  dboxG1b[2] = gAliThBase/2.;
 
-  gMC->Gsvolu("EBPB","BOX", idtmed[607], dbox_g1b, 3);
+  gMC->Gsvolu("EBPB","BOX", idtmed[607], dboxG1b, 3);
   gMC->Gsatt("EBPB", "SEEN", 1);
 
   // Make a 1.6mm thick G10 PCB for ESMB
-  Float_t dbox_g2b[3];
-  dbox_g2b[0] = dbox_sm2[0]; 
-  dbox_g2b[1] = dbox_sm2[1];       
-  dbox_g2b[2] = th_pcb/2.;
+  Float_t dboxG2b[3];
+  dboxG2b[0] = dboxSM2[0]; 
+  dboxG2b[1] = dboxSM2[1];       
+  dboxG2b[2] = gAliThPCB/2.;
 
-  gMC->Gsvolu("EPCB","BOX", idtmed[607], dbox_g2b, 3);
+  gMC->Gsvolu("EPCB","BOX", idtmed[607], dboxG2b, 3);
   gMC->Gsatt("EPCB", "SEEN", 1);
 
 
   // Make a Full module EFPB of AIR to place EBPB, 
   //1mm AIR, EPCB, ESMB,EPCB for PMD
-  Float_t dbox_allb[3];
-  dbox_allb[0] = dbox_sm2[0]; 
-  dbox_allb[1] = dbox_sm2[1];       
-  dbox_allb[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
+  Float_t dboxAllb[3];
+  dboxAllb[0] = dboxSM2[0]; 
+  dboxAllb[1] = dboxSM2[1];       
+  dboxAllb[2] = (gAliThBase+0.1+gAliThPCB+dboxSM2[2]+gAliThPCB)/2.;
 
-  gMC->Gsvolu("EFPB","BOX", idtmed[698], dbox_allb, 3);
+  gMC->Gsvolu("EFPB","BOX", idtmed[698], dboxAllb, 3);
   gMC->Gsatt("EFPB", "SEEN", 1);
 
   // Make a Full module EFCB of AIR to place EBPB, 
   //1mm AIR, EPCB, ESMB,EPCB for CPV
-  Float_t dbox_allb2[3];
-  dbox_allb2[0] = dbox_sm2[0]; 
-  dbox_allb2[1] = dbox_sm2[1];       
-  dbox_allb2[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
+  Float_t dboxAllb2[3];
+  dboxAllb2[0] = dboxSM2[0]; 
+  dboxAllb2[1] = dboxSM2[1];       
+  dboxAllb2[2] = (gAliThBase+0.1+gAliThPCB+dboxSM2[2]+gAliThPCB)/2.;
 
-  gMC->Gsvolu("EFCB","BOX", idtmed[698], dbox_allb2, 3);
+  gMC->Gsvolu("EFCB","BOX", idtmed[698], dboxAllb2, 3);
   gMC->Gsatt("EFCB", "SEEN", 1);
 
 
   // Now place everything in EFPB for PMD
 
-  Float_t z_bpb,z_pcbb1,z_pcbb2,z_smb; 
-  z_pcbb1 = - dbox_allb[2]+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 1, "EFPB", 0., 0., z_pcbb1, 0, "ONLY",dbox_g2b,3);
-  z_smb = z_pcbb1+dbox_sm2[2];
-  gMC->Gsposp("ESMB", 1, "EFPB", 0., 0., z_smb, 0, "ONLY",dbox_sm2,3);
-  z_pcbb2 = z_smb+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 2, "EFPB", 0., 0., z_pcbb2, 0, "ONLY",dbox_g2b,3);
-  z_bpb = z_pcbb2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
-  gMC->Gsposp("EBPB", 1, "EFPB", 0., 0., z_bpb, 0, "ONLY",dbox_g1b,3);
+  Float_t zbpb,zpcbb1,zpcbb2,zsmb; 
+  zpcbb1 = - dboxAllb[2]+gAliThPCB/2.0;
+  gMC->Gsposp("EPCB", 1, "EFPB", 0., 0., zpcbb1, 0, "ONLY",dboxG2b,3);
+  zsmb = zpcbb1+dboxSM2[2];
+  gMC->Gsposp("ESMB", 1, "EFPB", 0., 0., zsmb, 0, "ONLY",dboxSM2,3);
+  zpcbb2 = zsmb+gAliThPCB/2.0;
+  gMC->Gsposp("EPCB", 2, "EFPB", 0., 0., zpcbb2, 0, "ONLY",dboxG2b,3);
+  zbpb = zpcbb2+0.1+gAliThBase/2.0; // 0.1 for 0.1 mm Air gap 
+  gMC->Gsposp("EBPB", 1, "EFPB", 0., 0., zbpb, 0, "ONLY",dboxG1b,3);
 
 
   // Now place everything in EFCB for CPV
 
-  Float_t z_bpb2,z_pcbb12,z_pcbb22,z_smb2; 
-  z_bpb2 = - dbox_allb2[2]+th_base/2.0;
-  gMC->Gsposp("EBPB", 1, "EFCB", 0., 0., z_bpb2, 0, "ONLY",dbox_g1b,3);
-  z_pcbb12 = z_bpb2+0.1+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 1, "EFCB", 0., 0., z_pcbb12, 0, "ONLY",dbox_g2b,3);
-  z_smb2 = z_pcbb12+dbox_sm2[2];
-  gMC->Gsposp("ESMB", 1, "EFCB", 0., 0., z_smb2, 0, "ONLY",dbox_sm2,3);
-  z_pcbb22 = z_smb2+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 2, "EFCB", 0., 0., z_pcbb22, 0, "ONLY",dbox_g2b,3);
+  Float_t zbpb2,zpcbb12,zpcbb22,zsmb2; 
+  zbpb2 = - dboxAllb2[2]+gAliThBase/2.0;
+  gMC->Gsposp("EBPB", 1, "EFCB", 0., 0., zbpb2, 0, "ONLY",dboxG1b,3);
+  zpcbb12 = zbpb2+0.1+gAliThPCB/2.0;
+  gMC->Gsposp("EPCB", 1, "EFCB", 0., 0., zpcbb12, 0, "ONLY",dboxG2b,3);
+  zsmb2 = zpcbb12+dboxSM2[2];
+  gMC->Gsposp("ESMB", 1, "EFCB", 0., 0., zsmb2, 0, "ONLY",dboxSM2,3);
+  zpcbb22 = zsmb2+gAliThPCB/2.0;
+  gMC->Gsposp("EPCB", 2, "EFCB", 0., 0., zpcbb22, 0, "ONLY",dboxG2b,3);
 
 
   // Master MODULE EMPA of aluminum for PMD
-  //Float_t dbox_mm1[3];
-  dbox_mm1[0] = dbox_sm1[0]+boundary; 
-  dbox_mm1[1] = dbox_sm1[1]+boundary;       
-  dbox_mm1[2] = dbox_alla[2];
+  fDboxmm1[0] = dboxSM1[0]+gAliBoundary; 
+  fDboxmm1[1] = dboxSM1[1]+gAliBoundary;       
+  fDboxmm1[2] = dboxAlla[2];
 
-  gMC->Gsvolu("EMPA","BOX", idtmed[603], dbox_mm1, 3);
+  gMC->Gsvolu("EMPA","BOX", idtmed[603], fDboxmm1, 3);
   gMC->Gsatt("EMPA", "SEEN", 1);
 
   // Master MODULE EMCA of aluminum for CPV
-  //Float_t dbox_mm12[3];
-  dbox_mm12[0] = dbox_sm1[0]+boundary; 
-  dbox_mm12[1] = dbox_sm1[1]+boundary;       
-  dbox_mm12[2] = dbox_alla[2];
+  fDboxmm12[0] = dboxSM1[0]+gAliBoundary; 
+  fDboxmm12[1] = dboxSM1[1]+gAliBoundary;       
+  fDboxmm12[2] = dboxAlla[2];
 
-  gMC->Gsvolu("EMCA","BOX", idtmed[603], dbox_mm12, 3);
+  gMC->Gsvolu("EMCA","BOX", idtmed[603], fDboxmm12, 3);
   gMC->Gsatt("EMCA", "SEEN", 1);
 
 
   //Position EFMA inside EMMA for PMD and CPV
-  gMC->Gsposp("EFPA", 1, "EMPA", 0., 0., 0., 0, "ONLY",dbox_alla,3);
-  gMC->Gsposp("EFCA", 1, "EMCA", 0., 0., 0., 0, "ONLY",dbox_alla2,3);
+  gMC->Gsposp("EFPA", 1, "EMPA", 0., 0., 0., 0, "ONLY",dboxAlla,3);
+  gMC->Gsposp("EFCA", 1, "EMCA", 0., 0., 0., 0, "ONLY",dboxAlla2,3);
 
 
   // Master MODULE EMPB of aluminum for PMD
-  //Float_t dbox_mm2[3];
-  dbox_mm2[0] = dbox_sm2[0]+boundary; 
-  dbox_mm2[1] = dbox_sm2[1]+boundary;       
-  dbox_mm2[2] = dbox_allb[2];
+  fDboxmm2[0] = dboxSM2[0]+gAliBoundary; 
+  fDboxmm2[1] = dboxSM2[1]+gAliBoundary;       
+  fDboxmm2[2] = dboxAllb[2];
 
-  gMC->Gsvolu("EMPB","BOX", idtmed[603], dbox_mm2, 3);
+  gMC->Gsvolu("EMPB","BOX", idtmed[603], fDboxmm2, 3);
   gMC->Gsatt("EMPB", "SEEN", 1);
 
   // Master MODULE EMCB of aluminum for CPV
-  //Float_t dbox_mm22[3];
-  dbox_mm22[0] = dbox_sm2[0]+boundary; 
-  dbox_mm22[1] = dbox_sm2[1]+boundary;       
-  dbox_mm22[2] = dbox_allb[2];
+  fDboxmm22[0] = dboxSM2[0]+gAliBoundary; 
+  fDboxmm22[1] = dboxSM2[1]+gAliBoundary;       
+  fDboxmm22[2] = dboxAllb[2];
 
-  gMC->Gsvolu("EMCB","BOX", idtmed[603], dbox_mm22, 3);
+  gMC->Gsvolu("EMCB","BOX", idtmed[603], fDboxmm22, 3);
   gMC->Gsatt("EMCB", "SEEN", 1);
 
  
   //Position EFMB inside EMMB
-  gMC->Gsposp("EFPB", 1, "EMPB", 0., 0., 0., 0, "ONLY",dbox_allb,3);
-  gMC->Gsposp("EFCB", 1, "EMCB", 0., 0., 0., 0, "ONLY",dbox_allb2,3);
+  gMC->Gsposp("EFPB", 1, "EMPB", 0., 0., 0., 0, "ONLY",dboxAllb,3);
+  gMC->Gsposp("EFCB", 1, "EMCB", 0., 0., 0., 0, "ONLY",dboxAllb2,3);
 
 }
  
@@ -507,7 +506,6 @@ void AliPMDv1::CreateSupermodule()
 
 void AliPMDv1::CreatePMD()
 {
-
   //
   // Create final detector from supermodules
   // -- Author : Bedanga and Viyogi June 2003
@@ -520,48 +518,48 @@ void AliPMDv1::CreatePMD()
 
   // --- DEFINE Iron, and lead volumes  for SM A
   
-  Float_t dbox_pba[3];
-  dbox_pba[0] = sm_length_ax;
-  dbox_pba[1] = sm_length_ay;
-  dbox_pba[2] = th_lead/2.;
+  Float_t dboxPba[3];
+  dboxPba[0] = gAliSMLengthax;
+  dboxPba[1] = gAliSMLengthay;
+  dboxPba[2] = gAliThLead/2.;
   
-  gMC->Gsvolu("EPBA","BOX", idtmed[600], dbox_pba, 3);
+  gMC->Gsvolu("EPBA","BOX", idtmed[600], dboxPba, 3);
   gMC->Gsatt ("EPBA", "SEEN", 0);
   
   //   Fe Support 
-  Float_t dbox_fea[3];
-  dbox_fea[0] = sm_length_ax;
-  dbox_fea[1] = sm_length_ay;
-  dbox_fea[2] = th_steel/2.;
+  Float_t dboxFea[3];
+  dboxFea[0] = gAliSMLengthax;
+  dboxFea[1] = gAliSMLengthay;
+  dboxFea[2] = gAliThSteel/2.;
   
-  gMC->Gsvolu("EFEA","BOX", idtmed[618], dbox_fea, 3);
+  gMC->Gsvolu("EFEA","BOX", idtmed[618], dboxFea, 3);
   gMC->Gsatt ("EFEA", "SEEN", 0);
 
   // --- DEFINE Iron, and lead volumes  for SM B
 
-  Float_t dbox_pbb[3];
-  dbox_pbb[0] = sm_length_bx;
-  dbox_pbb[1] = sm_length_by;
-  dbox_pbb[2] = th_lead/2.;
+  Float_t dboxPbb[3];
+  dboxPbb[0] = gAliSMLengthbx;
+  dboxPbb[1] = gAliSMLengthby;
+  dboxPbb[2] = gAliThLead/2.;
   
-  gMC->Gsvolu("EPBB","BOX", idtmed[600], dbox_pbb, 3);
+  gMC->Gsvolu("EPBB","BOX", idtmed[600], dboxPbb, 3);
   gMC->Gsatt ("EPBB", "SEEN", 0);
   
   //   Fe Support 
-  Float_t dbox_feb[3];
-  dbox_feb[0] = sm_length_bx;
-  dbox_feb[1] = sm_length_by;
-  dbox_feb[2] = th_steel/2.;
+  Float_t dboxFeb[3];
+  dboxFeb[0] = gAliSMLengthbx;
+  dboxFeb[1] = gAliSMLengthby;
+  dboxFeb[2] = gAliThSteel/2.;
   
-  gMC->Gsvolu("EFEB","BOX", idtmed[618], dbox_feb, 3);
+  gMC->Gsvolu("EFEB","BOX", idtmed[618], dboxFeb, 3);
   gMC->Gsatt ("EFEB", "SEEN", 0);
 
 
   // Gaspmd, the dimension of RECTANGULAR mother volume of PMD,
 
   Float_t gaspmd[3] = {81.5,94.5,7.};
-  gaspmd[0] = sm_length_ax+sm_length_bx;
-  gaspmd[1] = sm_length_ay+sm_length_by;
+  gaspmd[0] = gAliSMLengthax+gAliSMLengthbx;
+  gaspmd[1] = gAliSMLengthay+gAliSMLengthby;
 
 
   gMC->Gsvolu("EPMD", "BOX", idtmed[698], gaspmd, 3);
@@ -572,52 +570,52 @@ void AliPMDv1::CreatePMD()
   AliMatrix(jhrot12, 90., 180., 90., 270., 0., 0.);
   AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
 
-  Float_t x_sma,y_sma;
-  Float_t x_smb,y_smb;
-  x_sma = -(sm_length_bx)/1.0;
-  y_sma = sm_length_by;
-  x_smb = -sm_length_ax;
-  y_smb = -sm_length_ay;
+  Float_t xsma,ysma;
+  Float_t xsmb,ysmb;
+  xsma = -(gAliSMLengthbx)/1.0;
+  ysma = gAliSMLengthby;
+  xsmb = -gAliSMLengthax;
+  ysmb = -gAliSMLengthay;
 
   //Complete detector for Type A
   //Position Super modules type A for both CPV and PMD in EPMD  
-  Float_t z_psa,z_pba,z_fea,z_cva; 
-
-  z_psa = - gaspmd[2] + sm_thick/2.;
-
-  gMC->Gsposp("EMPA", 1, "EPMD", x_sma, y_sma, z_psa, 0, "ONLY",dbox_mm1,3);
-  gMC->Gsposp("EMPA", 2, "EPMD", -x_sma, -y_sma, z_psa, jhrot12, "ONLY",dbox_mm1,3);
-  z_pba=z_psa+sm_thick/2.+dbox_pba[2];
-  gMC->Gsposp("EPBA", 1, "EPMD", x_sma, y_sma, z_pba, 0, "ONLY",dbox_pba,3);
-  gMC->Gsposp("EPBA", 2, "EPMD", -x_sma, -y_sma, z_pba, 0, "ONLY",dbox_pba,3);
-  z_fea=z_pba+dbox_pba[2]+dbox_fea[2];
-  gMC->Gsposp("EFEA", 1, "EPMD", x_sma, y_sma, z_fea, 0, "ONLY",dbox_fea,3);
-  gMC->Gsposp("EFEA", 2, "EPMD", -x_sma, -y_sma, z_fea, 0, "ONLY",dbox_fea,3);
-  z_cva=z_fea+dbox_fea[2]+sm_thick/2.;
-  gMC->Gsposp("EMCA", 1, "EPMD", x_sma, y_sma, z_cva, 0, "ONLY",dbox_mm12,3);
-  gMC->Gsposp("EMCA", 2, "EPMD", -x_sma,-y_sma, z_cva, jhrot12, "ONLY",dbox_mm12,3);
+  Float_t zpsa,zpba,zfea,zcva; 
+
+  zpsa = - gaspmd[2] + gAliSMthick/2.;
+
+  gMC->Gsposp("EMPA", 1, "EPMD", xsma, ysma, zpsa, 0, "ONLY",fDboxmm1,3);
+  gMC->Gsposp("EMPA", 2, "EPMD", -xsma, -ysma, zpsa, jhrot12, "ONLY",fDboxmm1,3);
+  zpba=zpsa+gAliSMthick/2.+dboxPba[2];
+  gMC->Gsposp("EPBA", 1, "EPMD", xsma, ysma, zpba, 0, "ONLY",dboxPba,3);
+  gMC->Gsposp("EPBA", 2, "EPMD", -xsma, -ysma, zpba, 0, "ONLY",dboxPba,3);
+  zfea=zpba+dboxPba[2]+dboxFea[2];
+  gMC->Gsposp("EFEA", 1, "EPMD", xsma, ysma, zfea, 0, "ONLY",dboxFea,3);
+  gMC->Gsposp("EFEA", 2, "EPMD", -xsma, -ysma, zfea, 0, "ONLY",dboxFea,3);
+  zcva=zfea+dboxFea[2]+gAliSMthick/2.;
+  gMC->Gsposp("EMCA", 1, "EPMD", xsma, ysma, zcva, 0, "ONLY",fDboxmm12,3);
+  gMC->Gsposp("EMCA", 2, "EPMD", -xsma,-ysma, zcva, jhrot12, "ONLY",fDboxmm12,3);
  
   //Complete detector for Type B
   //Position Super modules type B for both CPV and PMD in EPMD  
-  Float_t z_psb,z_pbb,z_feb,z_cvb; 
-  z_psb = - gaspmd[2] + sm_thick/2.;
-  
-  gMC->Gsposp("EMPB", 3, "EPMD", x_smb, y_smb, z_psb, 0, "ONLY",dbox_mm2,3);
-  gMC->Gsposp("EMPB", 4, "EPMD", -x_smb, -y_smb, z_psb, jhrot12, "ONLY",dbox_mm2,3);
-  z_pbb=z_psb+sm_thick/2.+dbox_pbb[2];
-  gMC->Gsposp("EPBB", 3, "EPMD", x_smb, y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
-  gMC->Gsposp("EPBB", 4, "EPMD", -x_smb, -y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
-  z_feb=z_pbb+dbox_pbb[2]+dbox_feb[2];
-  gMC->Gsposp("EFEB", 3, "EPMD", x_smb, y_smb, z_feb, 0, "ONLY",dbox_feb,3);
-  gMC->Gsposp("EFEB", 4, "EPMD", -x_smb, -y_smb, z_feb, 0, "ONLY",dbox_feb,3);
-  z_cvb=z_feb+dbox_feb[2]+sm_thick/2.;
-  gMC->Gsposp("EMCB", 3, "EPMD", x_smb, y_smb, z_cvb, 0, "ONLY",dbox_mm22,3);
-  gMC->Gsposp("EMCB", 4, "EPMD", -x_smb,-y_smb, z_cvb, jhrot12, "ONLY",dbox_mm22,3);
+  Float_t zpsb,zpbb,zfeb,zcvb; 
+  zpsb = - gaspmd[2] + gAliSMthick/2.;
+  
+  gMC->Gsposp("EMPB", 3, "EPMD", xsmb, ysmb, zpsb, 0, "ONLY",fDboxmm2,3);
+  gMC->Gsposp("EMPB", 4, "EPMD", -xsmb, -ysmb, zpsb, jhrot12, "ONLY",fDboxmm2,3);
+  zpbb=zpsb+gAliSMthick/2.+dboxPbb[2];
+  gMC->Gsposp("EPBB", 3, "EPMD", xsmb, ysmb, zpbb, 0, "ONLY",dboxPbb,3);
+  gMC->Gsposp("EPBB", 4, "EPMD", -xsmb, -ysmb, zpbb, 0, "ONLY",dboxPbb,3);
+  zfeb=zpbb+dboxPbb[2]+dboxFeb[2];
+  gMC->Gsposp("EFEB", 3, "EPMD", xsmb, ysmb, zfeb, 0, "ONLY",dboxFeb,3);
+  gMC->Gsposp("EFEB", 4, "EPMD", -xsmb, -ysmb, zfeb, 0, "ONLY",dboxFeb,3);
+  zcvb=zfeb+dboxFeb[2]+gAliSMthick/2.;
+  gMC->Gsposp("EMCB", 3, "EPMD", xsmb, ysmb, zcvb, 0, "ONLY",fDboxmm22,3);
+  gMC->Gsposp("EMCB", 4, "EPMD", -xsmb,-ysmb, zcvb, jhrot12, "ONLY",fDboxmm22,3);
   
   // --- Place the EPMD in ALICE 
   xp = 0.;
   yp = 0.;
-  zp = zdist1;
+  zp = gAliZdist1;
 
   //Position Full PMD in ALICE   
   gMC->Gsposp("EPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY",gaspmd,3);
@@ -626,12 +624,11 @@ void AliPMDv1::CreatePMD()
 
  
 //_____________________________________________________________________________
-void AliPMDv1::DrawModule()
+void AliPMDv1::DrawModule() const
 {
-  cout << " Inside Draw Modules " << endl;
-  //
   // Draw a shaded view of the Photon Multiplicity Detector
   //
+  //  cout << " Inside Draw Modules " << endl;
 
   gMC->Gsatt("*", "seen", -1);
   gMC->Gsatt("alic", "seen", 0);
@@ -665,13 +662,11 @@ void AliPMDv1::DrawModule()
 //_____________________________________________________________________________
 void AliPMDv1::CreateMaterials()
 {
-  cout << " Inside create materials " << endl;
-  //
   // Create materials for the PMD
   //
   // ORIGIN    : Y. P. VIYOGI 
   //
-  
+  //  cout << " Inside create materials " << endl;
   // --- The Argon- CO2 mixture --- 
   Float_t ag[2] = { 39.95 };
   Float_t zg[2] = { 18. };
@@ -806,7 +801,7 @@ void AliPMDv1::Init()
   //
 
   Int_t i;
-  kdet=1;
+  gAliKdet=1;
   //
   cout << " Inside Init " << endl;
   if(fDebug) {
@@ -818,7 +813,7 @@ void AliPMDv1::Init()
       printf("                 PMD simulation package (v1) initialised\n");
       printf("%s: parameters of pmd\n",ClassName());
       printf("%s: %10.2f %10.2f %10.2f \
-      %10.2f\n",ClassName(),cell_radius,cell_wall,cell_depth,zdist1 );
+      %10.2f\n",ClassName(),gAliCellRadius,gAliCellWall,gAliCellDepth,gAliZdist1 );
       printf("%s: ",ClassName());
       for(i=0;i<80;i++) printf("*");
       printf("\n");
@@ -902,35 +897,46 @@ void AliPMDv1::StepManager()
 
 void AliPMDv1::GetParameters()
 {
-  const Float_t root3 = TMath::Sqrt(3.); 
-  const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
+  // This gives all the parameters of the detector
+  // such as thickness of the Pb plate, Cell Radius,
+  // Cell thickness, number of rows, number of columns etc.
   //
-  cell_radius=0.25;
-  cell_wall=0.02;
-  cell_depth=0.25 * 2.;
+  const Float_t kroot3 = TMath::Sqrt(3.); 
+  const Float_t kroot3by2 = TMath::Sqrt(3.) /2.; 
   //
-  ncol_um1 = 48;
-  ncol_um2 = 96;
-  nrow_um1 = 96;//each strip has 1 row
-  nrow_um2 = 48;//each strip has 1 row
+  gAliCellRadius = 0.25;
+  gAliCellWall   = 0.02;
+  gAliCellDepth  = 0.25 * 2.;
   //
-  sm_length_ax = (3.0*(ncol_um1*cell_radius+cell_radius/2.)+(2.0*0.025)) + 0.7;
-  sm_length_bx = 2.0*(ncol_um2*cell_radius+cell_radius/2.)+0.025+0.7; 
-
-  sm_length_ay = 2.0*(((cell_radius/root3_2)*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.))+0.025+0.7;
-  sm_length_by = 3.0*(((cell_radius/root3_2)*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.))+(2.0*0.025)+0.7;
-    //
-    boundary=0.7;
-    //
-    th_base=0.3;
-    th_air=0.1;
-    th_pcb=0.16;
-    //
-    sm_thick = th_base + th_air + th_pcb + cell_depth + th_pcb + th_air + th_pcb;
-    //
-    th_lead=1.5;
-    th_steel=0.5;
-    
-    zdist1 = 361.5;
-
+  gAliNcolUM1    = 48;
+  gAliNcolUM2    = 96;
+  gAliNrowUM1    = 96;//each strip has 1 row
+  gAliNrowUM2    = 48;//each strip has 1 row
+  //
+  gAliSMLengthax = (3.0*(gAliNcolUM1*gAliCellRadius+gAliCellRadius/2.)
+                   + (2.0*0.025)) + 0.7;
+  gAliSMLengthbx = 2.0*(gAliNcolUM2*gAliCellRadius+gAliCellRadius/2.)
+    + 0.025 + 0.7; 
+
+  gAliSMLengthay = 2.0*(((gAliCellRadius/kroot3by2)*gAliNrowUM1)
+                       - (gAliCellRadius*kroot3*(gAliNrowUM1-1)/6.))
+    + 0.025 + 0.7;
+  gAliSMLengthby = 3.0*(((gAliCellRadius/kroot3by2)*gAliNrowUM2)
+                       - (gAliCellRadius*kroot3*(gAliNrowUM2-1)/6.))
+    + (2.0*0.025) + 0.7;
+  //
+  gAliBoundary   = 0.7;
+  //
+  gAliThBase     = 0.3;
+  gAliThAir      = 0.1;
+  gAliThPCB      = 0.16;
+  //
+  gAliSMthick    = gAliThBase + gAliThAir + gAliThPCB 
+    + gAliCellDepth + gAliThPCB + gAliThAir + gAliThPCB;
+  //
+  gAliThLead     = 1.5;
+  gAliThSteel    = 0.5;
+  
+  gAliZdist1     = 361.5;
+  
 }
index 6398e4d..caae6d0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef PMDV1_H
-#define PMDV1_H
+#ifndef ALIPMDV1_H
+#define ALIPMDV1_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 //___________________________________________
  
 class AliPMDv1 : public AliPMD {
-
-private:
-  Int_t fMedSens;
-  Int_t fMedSens1;
-  Float_t dbox_mm1[3];
-  Float_t dbox_mm12[3];
-  Float_t dbox_mm2[3];
-  Float_t dbox_mm22[3];
   
 public:
   AliPMDv1();
@@ -36,11 +28,16 @@ public:
   virtual void  Init();
   virtual Int_t IsVersion() const {return 1;}
   virtual void  StepManager();
-  virtual void  DrawModule();
+  virtual void  DrawModule() const;
+
+private:
+  Int_t   fMedSens;        // Sensitive Medium Ar+CO2
+  Float_t fDboxmm1[3];     // Master MODULE EMPA of aluminum for PMD
+  Float_t fDboxmm12[3];    // Master MODULE EMCA of aluminum for CPV
+  Float_t fDboxmm2[3];     // Master MODULE EMPB of aluminum for PMD
+  Float_t fDboxmm22[3];    // Master MODULE EMCB of aluminum for CPV
  
-   ClassDef(AliPMDv1,1)  //Hits manager for set:PMD
+  ClassDef(AliPMDv1,1)     //Hits manager for set:PMD
 };
  
 #endif
-
-