]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDDigitizer.cxx
Relate HLT tracks to the primary vertex (Youri)
[u/mrichter/AliRoot.git] / PMD / AliPMDDigitizer.cxx
index 5dd212d9983223ad48708db9f3a3aaf96e6c399d..0a1edd6efdd7dec25bdefa9ab7d843f0a1291ccd 100644 (file)
@@ -30,6 +30,7 @@
 #include <TFile.h>
 #include <TNtuple.h>
 #include <TParticle.h>
+#include <TRandom.h>
 
 #include "AliLog.h"
 #include "AliRun.h"
@@ -63,13 +64,14 @@ AliPMDDigitizer::AliPMDDigitizer() :
   fPMDHit(0),
   fPMD(0),
   fPMDLoader(0),
+  fCalibData(GetCalibData()),
   fSDigits(0),
   fDigits(0),
   fCell(0),
   fNsdigit(0),
   fNdigit(0),
   fDetNo(0),
-  fZPos(361.5)// in units of cm, This is the default position of PMD
+  fZPos(361.5)   // in units of cm, default position of PMD
 {
   // Default Constructor
   //
@@ -87,16 +89,46 @@ AliPMDDigitizer::AliPMDDigitizer() :
            }
        }
     }
-  fCalibData = GetCalibData();
+
 
 }
 //____________________________________________________________________________
-AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager) 
-  :AliDigitizer(manager),
+AliPMDDigitizer::AliPMDDigitizer(const AliPMDDigitizer& digitizer):
+  AliDigitizer(digitizer),
   fRunLoader(0),
   fPMDHit(0),
   fPMD(0),
   fPMDLoader(0),
+  fCalibData(GetCalibData()),
+  fSDigits(0),
+  fDigits(0),
+  fCell(0),
+  fNsdigit(0),
+  fNdigit(0),
+  fDetNo(0),
+  fZPos(361.5)   // in units of cm, default position of PMD
+{
+  // copy constructor
+  AliError("Copy constructor not allowed ");
+  
+}
+//____________________________________________________________________________
+
+AliPMDDigitizer & AliPMDDigitizer::operator=(const AliPMDDigitizer& /*digitizer*/)
+{
+  // Assignment operator
+  AliError("Assignement operator not allowed ");
+
+  return *this;
+}
+//____________________________________________________________________________
+AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager):
+  AliDigitizer(manager),
+  fRunLoader(0),
+  fPMDHit(0),
+  fPMD(0),
+  fPMDLoader(0),
+  fCalibData(GetCalibData()),
   fSDigits(new TClonesArray("AliPMDsdigit", 1000)),
   fDigits(new TClonesArray("AliPMDdigit", 1000)),
   fCell(0),
@@ -107,7 +139,6 @@ AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager)
 {
   // ctor which should be used
 
-  fCalibData = GetCalibData();
 
   for (Int_t i = 0; i < fgkTotUM; i++)
     {
@@ -124,6 +155,7 @@ AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager)
        }
     }
 }
+
 //____________________________________________________________________________
 AliPMDDigitizer::~AliPMDDigitizer()
 {
@@ -161,32 +193,37 @@ void AliPMDDigitizer::OpengAliceFile(const char *file, Option_t *option)
    {
      AliError(Form("Can not open session for file %s.",file));
    }
-  
-  if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice();
-  if (!fRunLoader->TreeE()) fRunLoader->LoadHeader();
-  if (!fRunLoader->TreeK()) fRunLoader->LoadKinematics();
 
-  gAlice = fRunLoader->GetAliRun();
+  const char *cHS = strstr(option,"HS");
+  const char *cHD = strstr(option,"HD");
+  const char *cSD = strstr(option,"SD");
   
-  if (gAlice)
-    {
-      AliDebug(1,"Alirun object found");
-    }
-  else
+  if(cHS || cHD)
     {
-      AliError("Could not found Alirun object");
-    }
+      if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice();
+      if (!fRunLoader->TreeE()) fRunLoader->LoadHeader();
+      if (!fRunLoader->TreeK()) fRunLoader->LoadKinematics();
   
-  fPMD  = (AliPMD*)gAlice->GetDetector("PMD");
+      gAlice = fRunLoader->GetAliRun();
+  
+      if (gAlice)
+       {
+         AliDebug(1,"Alirun object found");
+       }
+      else
+       {
+         AliError("Could not found Alirun object");
+       }
+  
+      fPMD  = (AliPMD*)gAlice->GetDetector("PMD");
+    }
+
   fPMDLoader = fRunLoader->GetLoader("PMDLoader");
   if (fPMDLoader == 0x0)
     {
       AliError("Can not find PMDLoader");
     }
 
-  const char *cHS = strstr(option,"HS");
-  const char *cHD = strstr(option,"HD");
-  const char *cSD = strstr(option,"SD");
 
   if (cHS)
     {
@@ -338,37 +375,41 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
              edep       = fPMDHit->GetEnergy();
              Int_t vol1 = fPMDHit->GetVolume(1); // Column
              Int_t vol2 = fPMDHit->GetVolume(2); // Row
-             Int_t vol3 = fPMDHit->GetVolume(3); // UnitModule
-             Int_t vol6 = fPMDHit->GetVolume(6); // SuperModule
+             Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule
+             Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule
+
 
              // -----------------------------------------//
+             // In new geometry after adding electronics //
              // For Super Module 1 & 2                   //
-             //  nrow = 96, ncol = 48                    //
-             // For Super Module 3 & 4                   //
              //  nrow = 48, ncol = 96                    //
+             // For Super Module 3 & 4                   //
+             //  nrow = 96, ncol = 48                    //
              // -----------------------------------------//
+
+
              
-             smnumber = (vol6-1)*6 + vol3;
+             smnumber = (vol8-1)*6 + vol7;
 
-             if (vol6 == 1 || vol6 == 2)
-               {
-                 xpad = vol1;
-                 ypad = vol2;
-               }
-             else if (vol6 == 3 || vol6 == 4)
+             if (vol8 == 1 || vol8 == 2)
                {
                  xpad = vol2;
                  ypad = vol1;
                }
+             else if (vol8 == 3 || vol8 == 4)
+               {
+                 xpad = vol1;
+                 ypad = vol2;
+               }
 
              AliDebug(2,Form("Zposition = %f Edeposition = %f",zPos,edep));
-             Float_t zposition = TMath::Abs(zPos);
-             if (zposition < fZPos)
+             //Float_t zposition = TMath::Abs(zPos);
+             if (zPos < fZPos)
                {
                  // CPV
                  fDetNo = 1;
                }
-             else if (zposition > fZPos)
+             else if (zPos > fZPos)
                {
                  // PMD
                  fDetNo = 0;
@@ -433,7 +474,6 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
     }
   fPMDLoader->WriteSDigits("OVERWRITE");
   ResetCellADC();
-
 }
 //____________________________________________________________________________
 
@@ -575,42 +615,43 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
              xPos = fPMDHit->X();
              yPos = fPMDHit->Y();
              zPos = fPMDHit->Z();
-
+             edep       = fPMDHit->GetEnergy();
              Int_t vol1 = fPMDHit->GetVolume(1); // Column
              Int_t vol2 = fPMDHit->GetVolume(2); // Row
-             Int_t vol3 = fPMDHit->GetVolume(3); // UnitModule
-             Int_t vol6 = fPMDHit->GetVolume(6); // SuperModule
-             edep       = fPMDHit->GetEnergy();
+             Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule
+             Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule
+
 
              // -----------------------------------------//
+             // In new geometry after adding electronics //
              // For Super Module 1 & 2                   //
-             //  nrow = 96, ncol = 48                    //
-             // For Super Module 3 & 4                   //
              //  nrow = 48, ncol = 96                    //
+             // For Super Module 3 & 4                   //
+             //  nrow = 96, ncol = 48                    //
              // -----------------------------------------//
              
-             smnumber = (vol6-1)*6 + vol3;
+             smnumber = (vol8-1)*6 + vol7;
 
-             if (vol6 == 1 || vol6 == 2)
-               {
-                 xpad = vol1;
-                 ypad = vol2;
-               }
-             else if (vol6 == 3 || vol6 == 4)
+             if (vol8 == 1 || vol8 == 2)
                {
                  xpad = vol2;
                  ypad = vol1;
                }
+             else if (vol8 == 3 || vol8 == 4)
+               {
+                 xpad = vol1;
+                 ypad = vol2;
+               }
 
              AliDebug(2,Form("ZPosition = %f Edeposition = %d",zPos,edep));
-             Float_t zposition = TMath::Abs(zPos);
+             //Float_t zposition = TMath::Abs(zPos);
 
-             if (zposition < fZPos)
+             if (zPos < fZPos)
                {
                  // CPV
                  fDetNo = 1;
                }
-             else if (zposition > fZPos)
+             else if (zPos > fZPos)
                {
                  // PMD
                  fDetNo = 0;