changed to new data reader
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 11:49:10 +0000 (11:49 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 11:49:10 +0000 (11:49 +0000)
PMD/AliPMDCalibrator.cxx
PMD/AliPMDClusterFinder.cxx
PMD/AliPMDRawDataRead.C

index 86c8378..4d2c50f 100644 (file)
 #include "TROOT.h"
 #include "TClonesArray.h"
 #include "TH1F.h"
+#include "TObjArray.h"
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliLog.h"
+#include "AliRawReaderFile.h"
 #include "AliPMDCalibrator.h"
 #include "AliRawReaderDate.h"
 #include "AliPMDRawStream.h"
-#include "AliRawReaderFile.h"
 #include "AliPMDCalibData.h"
+#include "AliPMDddldata.h"
 #include "AliCDBManager.h"
 #include "AliCDBId.h"
 #include "AliCDBMetaData.h"
+#include "AliDAQ.h"
 
 ClassImp(AliPMDCalibrator)
 
@@ -121,6 +124,8 @@ void AliPMDCalibrator::CalculateIsoCell()
 {
   // Calculates the ADC of isolated cell
 
+  TObjArray pmdddlcont;
+  const Int_t kDDL           = AliDAQ::NumberOfDdls("PMD");
   const Int_t kMaxHit        = 60000;
   const Int_t kCellNeighbour = 6;
 
@@ -159,6 +164,7 @@ void AliPMDCalibrator::CalculateIsoCell()
     {
       // printf("In CalculateIsoCell before while(stream.Next()), ...\n");
       
+      /*
       while(stream.Next())
        {
          Int_t idet = stream.GetDetector();
@@ -174,7 +180,37 @@ void AliPMDCalibrator::CalculateIsoCell()
              ch[idet][ismn][irow][icol] = ichno;
            }
        }
+      */
+      // New PMD Reader is plugged in
       
+      for (Int_t iddl = 0; iddl < kDDL; iddl++)
+       {
+         reader.Select("PMD", iddl, iddl);
+         stream.DdlData(&pmdddlcont);
+         
+         Int_t ientries = pmdddlcont.GetEntries();
+         for (Int_t ient = 0; ient < ientries; ient++)
+           {
+             AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+             
+             Int_t idet = pmdddl->GetDetector();
+             Int_t ismn = pmdddl->GetSMN();
+             //Int_t mcm = pmdddl->GetMCM();
+             Int_t ichno = pmdddl->GetChannel();
+             Int_t irow = pmdddl->GetRow();
+             Int_t icol = pmdddl->GetColumn();
+             Int_t isig = pmdddl->GetSignal();
+             
+             if (isig>0)
+               {
+                 d1[idet][ismn][irow][icol] = isig;
+                 ch[idet][ismn][irow][icol] = ichno;
+               }
+           }
+         pmdddlcont.Clear();
+       }
+
+
       maxhit = 0;
       
       for(Int_t idet=0; idet < kDet; idet++)
index 5661d87..36b1bb1 100644 (file)
@@ -41,6 +41,7 @@
 #include "AliPMDrechit.h"
 #include "AliPMDRawStream.h"
 #include "AliPMDCalibData.h"
+#include "AliPMDddldata.h"
 
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
@@ -239,6 +240,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
   //
 
   Float_t  clusdata[6];
+  TObjArray pmdddlcont;
 
   TObjArray *pmdcont = new TObjArray();
   AliPMDClustering *pmdclust = new AliPMDClusteringV1();
@@ -290,26 +292,26 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
       rawReader->Reset();
       AliPMDRawStream pmdinput(rawReader);
       rawReader->Select("PMD", indexDDL, indexDDL);
-      while(pmdinput.Next())
+      pmdinput.DdlData(&pmdddlcont);
+      Int_t indexsmn = 0;
+      Int_t ientries = pmdddlcont.GetEntries();
+      for (Int_t ient = 0; ient < ientries; ient++)
        {
-         Int_t det = pmdinput.GetDetector();
-         Int_t smn = pmdinput.GetSMN();
-         //Int_t mcm = pmdinput.GetMCM();
-         //Int_t chno = pmdinput.GetChannel();
-         Int_t row = pmdinput.GetRow();
-         Int_t col = pmdinput.GetColumn();
-         Int_t sig = pmdinput.GetSignal();
+         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
          
-         Float_t sig1 = (Float_t) sig;
+         Int_t det = pmdddl->GetDetector();
+         Int_t smn = pmdddl->GetSMN();
+         //Int_t mcm = pmdddl->GetMCM();
+         //Int_t chno = pmdddl->GetChannel();
+         Int_t row = pmdddl->GetRow();
+         Int_t col = pmdddl->GetColumn();
+         Int_t sig = pmdddl->GetSignal();
 
+         Float_t sig1 = (Float_t) sig;
          // CALIBRATION
          Float_t gain = fCalibData->GetGainFact(det,smn,row,col);
-         
-       //  printf("sig = %d gain = %f\n",sig,gain);
-         
+         //printf("sig = %d gain = %f\n",sig,gain);
          sig = (Int_t) (sig1*gain);
-         
-         Int_t indexsmn = 0;
 
          if (indexDDL < 4)
            {
@@ -327,9 +329,9 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                {
                  indexsmn = smn;
                }
-             else if (smn >= 12 && smn < 18)
+             else if (smn >= 18 && smn < 24)
                {
-                 indexsmn = smn - 6;
+                 indexsmn = smn - 12;
                }
            }
          else if (indexDDL == 5)
@@ -341,13 +343,15 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                {
                  indexsmn = smn - 6;
                }
-             else if (smn >= 18 && smn < 24)
+             else if (smn >= 12 && smn < 18)
                {
-                 indexsmn = smn - 12;
+                 indexsmn = smn - 6;
                }
            }         
          precpvADC[indexsmn][row][col] = sig;
-       } // while loop
+       }
+      
+      pmdddlcont.Clear();
 
       Int_t ismn = 0;
       for (Int_t indexsmn = 0; indexsmn < iSMN; indexsmn++)
@@ -361,6 +365,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                    (Double_t) precpvADC[indexsmn][irow][icol];
                } // row
            }     // col
+         
          if (indexDDL < 4)
            {
              ismn = indexsmn + indexDDL * 6;
@@ -374,7 +379,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                }
              else if (indexsmn >= 6 && indexsmn < 12)
                {
-                 ismn = indexsmn + 6;
+                 ismn = indexsmn + 12;
                }
              idet = 1;
            }
@@ -386,12 +391,11 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                }
              else if (indexsmn >= 6 && indexsmn < 12)
                {
-                 ismn = indexsmn + 12;
+                 ismn = indexsmn + 6;
                }
              idet = 1;
            }
 
-
          pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
          Int_t nentries1 = pmdcont->GetEntries();
 
@@ -455,7 +459,7 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
   //
 
   Float_t  clusdata[6];
-
+  TObjArray pmdddlcont;
   TObjArray *pmdcont = new TObjArray();
 
   AliPMDClustering *pmdclust = new AliPMDClusteringV1();
@@ -514,25 +518,29 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
       rawReader->Reset();
       AliPMDRawStream pmdinput(rawReader);
       rawReader->Select("PMD", indexDDL, indexDDL);
-      while(pmdinput.Next())
+      
+      pmdinput.DdlData(&pmdddlcont);
+    
+      Int_t indexsmn = 0;
+      Int_t ientries = pmdddlcont.GetEntries();
+      for (Int_t ient = 0; ient < ientries; ient++)
        {
-         Int_t det = pmdinput.GetDetector();
-         Int_t smn = pmdinput.GetSMN();
-         //Int_t mcm = pmdinput.GetMCM();
-         //Int_t chno = pmdinput.GetChannel();
-         Int_t row = pmdinput.GetRow();
-         Int_t col = pmdinput.GetColumn();
-         Int_t sig = pmdinput.GetSignal();
+         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+         
+         Int_t det = pmdddl->GetDetector();
+         Int_t smn = pmdddl->GetSMN();
+         //Int_t mcm = pmdddl->GetMCM();
+         //Int_t chno = pmdddl->GetChannel();
+         Int_t row = pmdddl->GetRow();
+         Int_t col = pmdddl->GetColumn();
+         Int_t sig = pmdddl->GetSignal();
 
          Float_t sig1 = (Float_t) sig;
          // CALIBRATION
          Float_t gain = fCalibData->GetGainFact(det,smn,row,col);
-         
-        // printf("sig = %d gain = %f\n",sig,gain);
-         
+         //printf("sig = %d gain = %f\n",sig,gain);
          sig = (Int_t) (sig1*gain);
-         
-         Int_t indexsmn = 0;
+
 
          if (indexDDL < 4)
            {
@@ -550,9 +558,9 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
                {
                  indexsmn = smn;
                }
-             else if (smn >= 12 && smn < 18)
+             else if (smn >= 18 && smn < 24)
                {
-                 indexsmn = smn - 6;
+                 indexsmn = smn - 12;
                }
            }
          else if (indexDDL == 5)
@@ -564,13 +572,16 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
                {
                  indexsmn = smn - 6;
                }
-             else if (smn >= 18 && smn < 24)
+             else if (smn >= 12 && smn < 18)
                {
-                 indexsmn = smn - 12;
+                 indexsmn = smn - 6;
                }
            }         
          precpvADC[indexsmn][row][col] = sig;
-       } // while loop
+
+       }
+      
+      pmdddlcont.Clear();
 
       Int_t ismn = 0;
       for (Int_t indexsmn = 0; indexsmn < iSMN; indexsmn++)
@@ -584,6 +595,8 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
                    (Double_t) precpvADC[indexsmn][irow][icol];
                } // row
            }     // col
+
+         
          if (indexDDL < 4)
            {
              ismn = indexsmn + indexDDL * 6;
@@ -597,7 +610,7 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
                }
              else if (indexsmn >= 6 && indexsmn < 12)
                {
-                 ismn = indexsmn + 6;
+                 ismn = indexsmn + 12;
                }
              idet = 1;
            }
@@ -609,12 +622,11 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
                }
              else if (indexsmn >= 6 && indexsmn < 12)
                {
-                 ismn = indexsmn + 12;
+                 ismn = indexsmn + 6;
                }
              idet = 1;
            }
 
-
          pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
          Int_t nentries1 = pmdcont->GetEntries();
 
index 00d8591..ded883d 100644 (file)
@@ -3,28 +3,38 @@ void AliPMDRawDataRead()
 {
   // To read PMD raw data
 
+  TObjArray pmdddlcont;
+
   Int_t ievt = 0;
   AliRawReaderFile reader(ievt);
   AliPMDRawStream stream(&reader);
 
-  //  FILE *fpw2 = fopen("rawread2.txt","w");
+  Int_t indexDDL = 0;
 
-  while(stream.Next())
-    {
-      printf("%d %d %d %d\n",stream.GetModule(),stream.GetRow(),
-            stream.GetColumn(),stream.GetSignal());
 
-      Int_t det = stream.GetDetector();
-      Int_t smn = stream.GetSMN();
-      Int_t mcm = stream.GetMCM();
-      Int_t chno = stream.GetChannel();
-      Int_t row = stream.GetRow();
-      Int_t col = stream.GetColumn();
-      Int_t sig = stream.GetSignal();
+  for (Int_t iddl = 0; iddl < 6; iddl++)
+    {
+      
+      reader.Select("PMD", iddl, iddl);
+      //cout << reader.GetDataSize() << endl;
+      stream.DdlData(&pmdddlcont);
+      Int_t ientries = pmdddlcont.GetEntries();
+      for (Int_t ient = 0; ient < ientries; ient++)
+       {
+         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+         
+         Int_t det = pmdddl->GetDetector();
+         Int_t smn = pmdddl->GetSMN();
+         //Int_t mcm = pmdddl->GetMCM();
+         //Int_t chno = pmdddl->GetChannel();
+         Int_t row = pmdddl->GetRow();
+         Int_t col = pmdddl->GetColumn();
+         Int_t sig = pmdddl->GetSignal();
 
-      //  fprintf(fpw2,"%d %d %d %d %d %d %d\n",det, smn, row, col,
-      //      mcm, chno, sig);
+       }
+      pmdddlcont.Clear();
 
     }
 
+
 }