mev2adc defined to be const
[u/mrichter/AliRoot.git] / PMD / AliPMDDigitizer.cxx
index e51bb5bb6efe9be3d6e7ec9fe9756c5fe9fc372e..26633dde83687d0090ff09f7a7282f14cc0afe8f 100644 (file)
@@ -50,9 +50,7 @@
 #include "AliMC.h"
 
 ClassImp(AliPMDDigitizer)
-//
-// Constructor
-//
+
 AliPMDDigitizer::AliPMDDigitizer()
 {
   // Default Constructor
@@ -106,9 +104,9 @@ void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
   fRunLoader->LoadHeader();
   fRunLoader->LoadKinematics();
 
-  fAlice = fRunLoader->GetAliRun();
+  gAlice = fRunLoader->GetAliRun();
   
-  if (fAlice)
+  if (gAlice)
     {
       printf("<AliPMDdigitizer::Open> ");
       printf("AliRun object found on file.\n");
@@ -119,7 +117,7 @@ void AliPMDDigitizer::OpengAliceFile(Char_t *file, Option_t *option)
       printf("Could not find AliRun object.\n");
     }
 
-  fPMD  = (AliPMD*)fAlice->GetDetector("PMD");
+  fPMD  = (AliPMD*)gAlice->GetDetector("PMD");
   fPMDLoader = fRunLoader->GetLoader("PMDLoader");
   if (fPMDLoader == 0x0)
     {
@@ -168,6 +166,8 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
   Float_t edep;
   Float_t vx = -999.0, vy = -999.0, vz = -999.0;
 
+
+  FILE *fpw = fopen("junk_digit1.dat","w");
   
   ResetSDigit();
 
@@ -175,7 +175,7 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
   Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
   printf("Number of Particles = %d \n", nparticles);
   fRunLoader->GetEvent(ievt);
-  fPArray = fAlice->GetMCApp()->Particles();
+  //  fPArray = gAlice->GetMCApp()->Particles();
   // ------------------------------------------------------- //
   // Pointer to specific detector hits.
   // Get pointers to Alice detectors and Hits containers
@@ -198,12 +198,10 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
 
   // Start loop on tracks in the hits containers
 
-  
   for (Int_t track=0; track<ntracks;track++) 
     {
-      fAlice->ResetHits();
+      gAlice->ResetHits();
       fTreeH->GetEvent(track);
-      
       if (fPMD) 
        {
          npmd = fHits->GetEntriesFast();
@@ -211,12 +209,13 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
            {
              fPMDHit = (AliPMDhit*) fHits->UncheckedAt(ipmd);
              trackno = fPMDHit->GetTrack();
-
              //  get kinematics of the particles
 
-             fParticle = fAlice->GetMCApp()->Particle(trackno);
+             fParticle = gAlice->GetMCApp()->Particle(trackno);
              trackpid  = fParticle->GetPdgCode();
 
+             fprintf(fpw,"track =%d trackno = %d trackpid = %d\n",
+                     track, trackno, trackpid);
              Int_t igatr = -999;
              Int_t ichtr = -999;
              Int_t igapid = -999;
@@ -232,13 +231,12 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
                  trackpidOld = trackpid;
                  statusOld   = -1;
                }
-
              Int_t igstatus = 0;
              while((imo = mparticle->GetFirstMother()) >= 0)
                {
                  igen++;
 
-                 mparticle =  fAlice->GetMCApp()->Particle(imo);
+                 mparticle =  gAlice->GetMCApp()->Particle(imo);
                  idmo = mparticle->GetPdgCode();
                  
                  vx = mparticle->Vx();
@@ -279,7 +277,6 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
                  mtrackno  = tracknoOld;
                  mtrackpid = trackpidOld;
                }
-             
              xPos = fPMDHit->X();
              yPos = fPMDHit->Y();
              zPos = fPMDHit->Z();
@@ -406,7 +403,6 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
   Float_t edep;
   Float_t vx = -999.0, vy = -999.0, vz = -999.0;
 
-  
   ResetDigit();
 
   printf("Event Number =  %d \n",ievt); 
@@ -414,12 +410,12 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
   Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
   printf("Number of Particles = %d \n", nparticles);
   fRunLoader->GetEvent(ievt);
-  fPArray = fAlice->GetMCApp()->Particles();
+  //  fPArray = gAlice->GetMCApp()->Particles();
   // ------------------------------------------------------- //
   // Pointer to specific detector hits.
   // Get pointers to Alice detectors and Hits containers
 
-  fPMD  = (AliPMD*)fAlice->GetDetector("PMD");
+  fPMD  = (AliPMD*)gAlice->GetDetector("PMD");
   fPMDLoader = fRunLoader->GetLoader("PMDLoader");
 
   if (fPMDLoader == 0x0)
@@ -445,7 +441,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
 
   for (Int_t track=0; track<ntracks;track++) 
     {
-      fAlice->ResetHits();
+      gAlice->ResetHits();
       fTreeH->GetEvent(track);
       
       if (fPMD) 
@@ -458,7 +454,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
              
              //  get kinematics of the particles
              
-             fParticle = fAlice->GetMCApp()->Particle(trackno);
+             fParticle = gAlice->GetMCApp()->Particle(trackno);
              trackpid  = fParticle->GetPdgCode();
 
              Int_t igatr = -999;
@@ -482,7 +478,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
                {
                  igen++;
 
-                 mparticle =  fAlice->GetMCApp()->Particle(imo);
+                 mparticle =  gAlice->GetMCApp()->Particle(imo);
                  idmo = mparticle->GetPdgCode();
                  
                  vx = mparticle->Vx();
@@ -892,7 +888,7 @@ void AliPMDDigitizer::TrackAssignment2Cell()
 }
 
 
-void AliPMDDigitizer::MeV2ADC(Float_t mev, Float_t & adc)
+void AliPMDDigitizer::MeV2ADC(Float_t mev, Float_t & adc) const
 {
   // This converts the simulated edep to ADC according to the
   // Test Beam Data