]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
bug fixed
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Nov 2003 09:21:10 +0000 (09:21 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Nov 2003 09:21:10 +0000 (09:21 +0000)
PMD/AliPMDClusterFinder.cxx
PMD/AliPMDClusterFinder.h
PMD/AliPMDDigitizer.cxx
PMD/AliPMDDigitizer.h

index 8ff353fd8864f432246a8ad4cdf12fe4b44a1f59..67b5d0f0fb83a66e56580a88845ed48e76e84dda 100644 (file)
@@ -23,6 +23,7 @@
 //-----------------------------------------------------//
 
 #include <Riostream.h>
+#include <TMath.h>
 #include <TBRIK.h>
 #include <TNode.h>
 #include <TTree.h>
 
 
 ClassImp(AliPMDClusterFinder)
-//
-// Constructor
-//
+
 AliPMDClusterFinder::AliPMDClusterFinder()
 {
+//
+// Default Constructor
+//
   if (!fRecpoints) fRecpoints = new TClonesArray("AliPMDrecpoint1", 1000);  
   fNpoint = 0;
 
@@ -62,14 +64,15 @@ AliPMDClusterFinder::AliPMDClusterFinder()
 }
 AliPMDClusterFinder::~AliPMDClusterFinder()
 {
+  // Destructor
   delete fRecpoints;
 }
-//
-// Member functions
-//
+
 void AliPMDClusterFinder::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");
   
@@ -94,9 +97,9 @@ void AliPMDClusterFinder::OpengAliceFile(Char_t *file, Option_t *option)
       printf("<AliPMDdigitizer::Open> ");
       printf("Could not find AliRun object.\n");
     }
-  PMD  = (AliPMD*)gAlice->GetDetector("PMD");
-  pmdloader = fRunLoader->GetLoader("PMDLoader");
-  if (pmdloader == 0x0)
+  fPMD  = (AliPMD*)gAlice->GetDetector("PMD");
+  fPMDLoader = fRunLoader->GetLoader("PMDLoader");
+  if (fPMDLoader == 0x0)
     {
       cerr<<"OpengAlice : Can not find PMD or PMDLoader\n";
     }
@@ -105,13 +108,16 @@ void AliPMDClusterFinder::OpengAliceFile(Char_t *file, Option_t *option)
 
   if (cDR)
     {
-      pmdloader->LoadDigits("READ");
-      pmdloader->LoadRecPoints("recreate");
+      fPMDLoader->LoadDigits("READ");
+      fPMDLoader->LoadRecPoints("recreate");
     }
 }
 
 void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
 {
+  // Converts digits to recpoints after running clustering
+  // algorithm on CPV plane and PREshower plane
+  //
   Int_t    det = 0,smn = 0;
   Int_t    cellno;
   Int_t    xpos,ypos;
@@ -128,32 +134,32 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
 
   fRunLoader->GetEvent(ievt);
   //cout << " ***** Beginning::Digits2RecPoints *****" << endl;
-  treeD = pmdloader->TreeD();
-  if (treeD == 0x0)
+  fTreeD = fPMDLoader->TreeD();
+  if (fTreeD == 0x0)
     {
       cout << " Can not get TreeD" << endl;
     }
   AliPMDdigit  *pmddigit;
-  TBranch *branch = treeD->GetBranch("PMDDigit");
+  TBranch *branch = fTreeD->GetBranch("PMDDigit");
   branch->SetAddress(&fDigits);
 
   ResetRecpoint();
-  treeR = pmdloader->TreeR();
-  if (treeR == 0x0)
+  fTreeR = fPMDLoader->TreeR();
+  if (fTreeR == 0x0)
     {
-      pmdloader->MakeTree("R");
-      treeR = pmdloader->TreeR();
+      fPMDLoader->MakeTree("R");
+      fTreeR = fPMDLoader->TreeR();
     }
 
   Int_t bufsize = 16000;
-  treeR->Branch("PMDRecpoint", &fRecpoints, bufsize); 
+  fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize); 
 
-  Int_t nmodules = (Int_t) treeD->GetEntries();
+  Int_t nmodules = (Int_t) fTreeD->GetEntries();
   
   for (Int_t imodule = 0; imodule < nmodules; imodule++)
     {
       ResetCellADC();
-      treeD->GetEntry(imodule); 
+      fTreeD->GetEntry(imodule); 
       Int_t nentries = fDigits->GetLast();
       for (Int_t ient = 0; ient < nentries+1; ient++)
        {
@@ -193,14 +199,14 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
        }
       pmdcont->Clear();
       
-      treeR->Fill();
+      fTreeR->Fill();
       ResetRecpoint();
 
     } // modules
 
   ResetCellADC();
   
-  pmdloader->WriteRecPoints("OVERWRITE");
+  fPMDLoader->WriteRecPoints("OVERWRITE");
 
   //   delete the pointers
   delete pmdclust;
@@ -220,6 +226,8 @@ void AliPMDClusterFinder::SetDebug(Int_t idebug)
 
 void AliPMDClusterFinder::AddRecPoint(Float_t *clusdata)
 {
+  // Add Reconstructed points
+  //
   TClonesArray &lrecpoints = *fRecpoints;
   AliPMDrecpoint1 *newrecpoint;
   newrecpoint = new AliPMDrecpoint1(clusdata);
@@ -228,6 +236,8 @@ void AliPMDClusterFinder::AddRecPoint(Float_t *clusdata)
 }
 void AliPMDClusterFinder::ResetCellADC()
 {
+  // Reset the individual cell ADC value to zero
+  //
   for(Int_t irow = 0; irow < fRow; irow++)
     {
       for(Int_t icol = 0; icol < fCol; icol++)
@@ -239,11 +249,14 @@ void AliPMDClusterFinder::ResetCellADC()
 
 void AliPMDClusterFinder::ResetRecpoint()
 {
+  // Clear the list of reconstructed points
   fNpoint = 0;
   if (fRecpoints) fRecpoints->Clear();
 }
 void AliPMDClusterFinder::UnLoad(Option_t *option)
 {
+  // Unload all the *.root files
+  //
   const char *cR = strstr(option,"R");
 
   fRunLoader->UnloadgAlice();
@@ -252,6 +265,6 @@ void AliPMDClusterFinder::UnLoad(Option_t *option)
 
   if (cR)
     {
-      pmdloader->UnloadDigits();
+      fPMDLoader->UnloadDigits();
     }
 }
index 442877a4163abbd8a32fc10b3cfe0f7610bd680a..6b7f7cff0fd5b6c46f06c0cc5deb8cc5fc08fc92 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef PMDClusterFinder_H
-#define PMDClusterFinder_H
+#ifndef ALIPMDCLUSTERFINDER_H
+#define ALIPMDCLUSTERFINDER_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 //-----------------------------------------------------//
 //                                                     //
 //-----------------------------------------------------//
 
-#include <Riostream.h>
-#include <stdlib.h>
-#include <math.h>
-#include <TMath.h>
-
 class TClonesArray;
 class TFile;
 class TObjArray;
 class TTree;
 class TNtuple;
+class TMath;
 
 class AliLoader;
 class AliRunLoader;
@@ -35,44 +31,44 @@ class AliPMDrecpoint1;
 
 class AliPMDClusterFinder
 {
- protected:
-  AliRunLoader *fRunLoader;
-  AliRun       *gAlice;
-  AliDetector  *PMD;      /* Get pointers to Alice detectors 
-                            and Hits containers */
-  AliLoader    *pmdloader;
-
-  TTree        *treeD;
-  TTree        *treeR;
-
-  TClonesArray *fDigits;
-  TClonesArray *fRecpoints;
-
-  Int_t fNpoint;
-  Int_t fDetNo;
-  Int_t fDebug;
-  Float_t fEcut;
-
-  static const Int_t fRow = 48;
-  static const Int_t fCol = 96;
-  Double_t fCellADC[fRow][fCol];
 
  public:
 
   AliPMDClusterFinder();
   virtual ~AliPMDClusterFinder();
 
-  void OpengAliceFile(char * /* galice.root */, Option_t * /* option */);
+  void OpengAliceFile(char * file, Option_t * option);
 
-  void Digits2RecPoints(Int_t /* ievt */);
-  void SetCellEdepCut(Float_t /* ecut */);
-  void SetDebug(Int_t /* idebug */);
-  void AddRecPoint(Float_t * /* clusdata */);
+  void Digits2RecPoints(Int_t ievt);
+  void SetCellEdepCut(Float_t ecut);
+  void SetDebug(Int_t idebug);
+  void AddRecPoint(Float_t * clusdata);
   void ResetCellADC();
   void ResetRecpoint();
-  void UnLoad(Option_t * /* option */);
+  void UnLoad(Option_t * option);
+
+ protected:
+  AliRunLoader *fRunLoader; // Pointer to Run Loader
+  AliRun       *gAlice;     // Pointer to Run
+  AliDetector  *fPMD;       // Pointers to Alice detectors & Hits containers
+  AliLoader    *fPMDLoader; // Pointer to specific detector loader
+
+  TTree        *fTreeD;     // Digits tree
+  TTree        *fTreeR;     // Reconstructed points
+
+  TClonesArray *fDigits;    // List of digits
+  TClonesArray *fRecpoints; // List of reconstructed points
+
+  Int_t   fNpoint;          // 
+  Int_t   fDetNo;           // Detector Number (0:PRE, 1:CPV)
+  Int_t   fDebug;           // Debugging switch (0:NO, 1:YES)
+  Float_t fEcut;            // Energy/ADC cut per cell
+
+  static const Int_t fRow = 48; // Total number of rows in one unitmodule
+  static const Int_t fCol = 96; // Total number of cols in one unitmodule
+  Double_t fCellADC[fRow][fCol]; // Array containing individual cell ADC
 
-  ClassDef(AliPMDClusterFinder,2)
+  ClassDef(AliPMDClusterFinder,2) // To run PMD clustering
 };
 #endif
 
index e51bb5bb6efe9be3d6e7ec9fe9756c5fe9fc372e..6d9b376295854364590040f32fc2415af3eb86d6 100644 (file)
@@ -106,9 +106,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 +119,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)
     {
@@ -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
@@ -197,16 +197,15 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
   if (fPMD) fHits   = fPMD->Hits();
 
   // 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();
+         cout << " npmd = " << npmd << endl;
          for (int ipmd = 0; ipmd < npmd; ipmd++) 
            {
              fPMDHit = (AliPMDhit*) fHits->UncheckedAt(ipmd);
@@ -214,9 +213,11 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
 
              //  get kinematics of the particles
 
-             fParticle = fAlice->GetMCApp()->Particle(trackno);
+             fParticle = gAlice->GetMCApp()->Particle(trackno);
              trackpid  = fParticle->GetPdgCode();
 
+             cout << " trackno = " << trackno << " track = " << track << endl;
+             //cout << " trackpid = " << trackpid << endl;
              Int_t igatr = -999;
              Int_t ichtr = -999;
              Int_t igapid = -999;
@@ -225,6 +226,9 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
              Int_t idmo = -999;
 
              TParticle*  mparticle = fParticle;
+             Int_t jjnu = mparticle->GetFirstMother();
+             cout << " Coming to this step - step 0 jjnu = " << jjnu << endl;
+             
              Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
              if (mparticle->GetFirstMother() == -1)
                {
@@ -232,13 +236,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 +282,6 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt)
                  mtrackno  = tracknoOld;
                  mtrackpid = trackpidOld;
                }
-             
              xPos = fPMDHit->X();
              yPos = fPMDHit->Y();
              zPos = fPMDHit->Z();
@@ -414,12 +416,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 +447,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 +460,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 +484,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt)
                {
                  igen++;
 
-                 mparticle =  fAlice->GetMCApp()->Particle(imo);
+                 mparticle =  gAlice->GetMCApp()->Particle(imo);
                  idmo = mparticle->GetPdgCode();
                  
                  vx = mparticle->Vx();
index 58ffa08cc0f0d83960600e002958c4042c3c83d7..13def45a788a9f29a97c0b3a470cb3a7d5b9d2b6 100644 (file)
@@ -59,7 +59,7 @@ class AliPMDDigitizer
 
  protected:
   AliRunLoader *fRunLoader;  // Pointer to Run Loader
-  AliRun       *fAlice;      // Pointer to a Run
+  AliRun       *gAlice;      // Pointer to a Run
   AliPMDhit    *fPMDHit;     // Pointer to specific detector hits
   AliDetector  *fPMD;        // Get pointers to Alice detectors 
                              // and Hits containers