DA are updated to a new raw data decoder AliCaloRawStreamV3
authorkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Jul 2009 19:10:45 +0000 (19:10 +0000)
committerkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Jul 2009 19:10:45 +0000 (19:10 +0000)
PHOS/PHOSBCMda.cxx
PHOS/PHOSGAINda.cxx
PHOS/PHOSLEDda.cxx

index 1d56b54..4b5fdc7 100644 (file)
@@ -27,8 +27,9 @@ extern "C" {
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
 #include "AliPHOSDA2.h"
-#include "AliPHOSRawDecoderv1.h"
+#include "AliPHOSRawFitterv1.h"
 #include "AliCaloAltroMapping.h"
+#include "AliCaloRawStreamV3.h"
 
 
 /* Main routine
@@ -110,10 +111,12 @@ int main(int argc, char **argv) {
   
   Float_t q[64][56][2];
 
-  Int_t gain = -1;
-  Int_t X = -1;
-  Int_t Z = -1;
-  Int_t nFired = -1;
+  Int_t gain     = -1;
+  Int_t cellX    = -1;
+  Int_t cellZ    = -1;
+  Int_t nBunches =  0;
+  Int_t nFired   = -1;
+  Int_t sigStart, sigLength;
 
   /* main loop (infinite) */
   for(;;) {
@@ -157,25 +160,40 @@ int main(int argc, char **argv) {
       nFired = 0;
 
       rawReader = new AliRawReaderDate((void*)event);
-      AliPHOSRawDecoderv1 dc(rawReader,mapping);
-      dc.SubtractPedestals(kTRUE);
+      AliCaloRawStreamV3 stream(rawReader,"PHOS",mapping);
+      AliPHOSRawFitterv0 fitter();
+      fitter.SubtractPedestals(kTRUE); // assume that data is non-ZS
       
-      while(dc.NextDigit()) {
-
-       X = dc.GetRow() - 1;
-       Z = dc.GetColumn() - 1;
-
-       if(dc.IsLowGain()) gain = 0;
-       else
-         gain = 1;
-       
-       q[X][Z][gain] = dc.GetSampleQuality();
-
-       if(gain && dc.GetEnergy()>40)
-         nFired++;
-       
+      while (stream.NextDDL()) {
+       while (stream.NextChannel()) {
+
+         cellX    = stream.GetCellX();
+         cellZ    = stream.GetCellZ();
+         caloFlag = stream.GetCaloFlag();  // 0=LG, 1=HG, 2=TRU
+
+         // In case of oscillating signals with ZS, a channel can have several bunches
+         nBunches = 0;
+         while (stream.NextBunch()) {
+           nBunches++;
+           if (nBunches > 1) continue;
+           sigStart  = fRawStream.GetStartTimeBin();
+           sigLength = fRawStream.GetBunchLength();
+           fitter.SetSamples(fRawStream->GetSignals(),sigStart,sigLength);
+         } // End of NextBunch()
+         
+         fitter.SetNBunches(nBunches);
+         fitter.SetChannelGeo(module,cellX,cellZ,caloFlag);
+         fitter.Eval();
+
+         if (nBunches>1 || caloFlag!=0 || caloFlag!=1 || fitter.GetSignalQuality()>1) continue;
+         
+         q[cellX][cellZ][caloFlag] = fitter.GetSignalQuality();
+         
+         if(gain && dc.GetEnergy()>40)
+           nFired++;
+       }
       }
-      
+       
       da2->FillQualityHistograms(q);
       da2->FillFiredCellsHistogram(nFired);
       //da1.UpdateHistoFile();
index ea94530..5eac03b 100644 (file)
@@ -27,8 +27,9 @@ extern "C" {
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
 #include "AliPHOSRcuDA1.h"
-#include "AliPHOSRawDecoder.h"
+#include "AliPHOSRawFitterv0.h"
 #include "AliCaloAltroMapping.h"
+#include "AliCaloRawStreamV3.h"
 
 
 /* Main routine
@@ -73,7 +74,6 @@ int main(int argc, char **argv) {
     mapping[i] = new AliCaloAltroMapping(path2.Data());
   }
   
-
   /* define data source : this is argument 1 */  
   status=monitorSetDataSource( argv[1] );
   if (status!=0) {
@@ -105,9 +105,11 @@ int main(int argc, char **argv) {
   Float_t e[64][56][2];
   Float_t t[64][56][2];
 
-  Int_t gain = -1;
-  Int_t X = -1;
-  Int_t Z = -1;
+  Int_t gain     = -1;
+  Int_t cellX    = -1;
+  Int_t cellZ    = -1;
+  Int_t nBunches =  0;
+  Int_t sigStart, sigLength;
 
   /* main loop (infinite) */
   for(;;) {
@@ -150,26 +152,40 @@ int main(int argc, char **argv) {
       }
 
       rawReader = new AliRawReaderDate((void*)event);
-//       AliPHOSRawDecoderv1 dc(rawReader,mapping);
-      AliPHOSRawDecoder dc(rawReader,mapping);
-      dc.SubtractPedestals(kTRUE);
+      AliCaloRawStreamV3 stream(rawReader,"PHOS",mapping);
+      AliPHOSRawFitterv0 fitter();
+      fitter.SubtractPedestals(kTRUE); // assume that data is non-ZS
       
-      while(dc.NextDigit()) {
-
-       X = dc.GetRow() - 1;
-       Z = dc.GetColumn() - 1;
-
-       if(dc.IsLowGain()) gain = 0;
-       else
-         gain = 1;
-       
-       e[X][Z][gain] = dc.GetEnergy();
-       t[X][Z][gain] = dc.GetTime();
-       
+      while (stream.NextDDL()) {
+       while (stream.NextChannel()) {
+
+         cellX    = stream.GetCellX();
+         cellZ    = stream.GetCellZ();
+         caloFlag = stream.GetCaloFlag();  // 0=LG, 1=HG, 2=TRU
+
+         // In case of oscillating signals with ZS, a channel can have several bunches
+         nBunches = 0;
+         while (stream.NextBunch()) {
+           nBunches++;
+           if (nBunches > 1) continue;
+           sigStart  = fRawStream.GetStartTimeBin();
+           sigLength = fRawStream.GetBunchLength();
+           fitter.SetSamples(fRawStream->GetSignals(),sigStart,sigLength);
+         } // End of NextBunch()
+         
+         fitter.SetNBunches(nBunches);
+         fitter.SetChannelGeo(module,cellX,cellZ,caloFlag);
+         fitter.Eval();
+
+         if (nBunches>1 || caloFlag!=0 || caloFlag!=1 || fitter.GetSignalQuality()>1) continue;
+         
+         e[cellX][cellZ][caloFlag] = fitter.GetEnergy();
+         t[cellX][cellZ][caloFlag] = fitter.GetTime();
+       }
       }
 
       da1.FillHistograms(e,t);
-      //da1.UpdateHistoFile();
+    //da1.UpdateHistoFile();
       
       delete rawReader;     
       nevents_physics++;
index 3e652f1..5e2c3c3 100644 (file)
@@ -27,8 +27,9 @@ extern "C" {
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
 #include "AliPHOSRcuDA1.h"
-#include "AliPHOSRawDecoder.h"
+#include "AliPHOSRawFitterv0.h"
 #include "AliCaloAltroMapping.h"
+#include "AliCaloRawStreamV3.h"
 
 
 /* Main routine
@@ -106,10 +107,12 @@ int main(int argc, char **argv) {
   Float_t e[64][56][2];
   Float_t t[64][56][2];
 
-  Int_t gain = -1;
-  Int_t X = -1;
-  Int_t Z = -1;
-  Int_t nFired = -1;
+  Int_t gain     = -1;
+  Int_t cellX    = -1;
+  Int_t cellZ    = -1;
+  Int_t nBunches =  0;
+  Int_t nFired   = -1;
+  Int_t sigStart, sigLength;
 
   TH1I fFiredCells("fFiredCells","Number of fired cells per event",100,0,1000);
 
@@ -156,27 +159,42 @@ int main(int argc, char **argv) {
       nFired = 0;
 
       rawReader = new AliRawReaderDate((void*)event);
-//       AliPHOSRawDecoderv1 dc(rawReader,mapping);
-      AliPHOSRawDecoder dc(rawReader,mapping);
-      dc.SubtractPedestals(kTRUE);
+      AliCaloRawStreamV3 stream(rawReader,"PHOS",mapping);
+      AliPHOSRawFitterv0 fitter();
+      fitter.SubtractPedestals(kTRUE); // assume that data is non-ZS
       
-      while(dc.NextDigit()) {
-
-       X = dc.GetRow() - 1;
-       Z = dc.GetColumn() - 1;
+      while (stream.NextDDL()) {
+       while (stream.NextChannel()) {
+
+         cellX    = stream.GetCellX();
+         cellZ    = stream.GetCellZ();
+         caloFlag = stream.GetCaloFlag();  // 0=LG, 1=HG, 2=TRU
+
+         // In case of oscillating signals with ZS, a channel can have several bunches
+         nBunches = 0;
+         while (stream.NextBunch()) {
+           nBunches++;
+           if (nBunches > 1) continue;
+           sigStart  = fRawStream.GetStartTimeBin();
+           sigLength = fRawStream.GetBunchLength();
+           fitter.SetSamples(fRawStream->GetSignals(),sigStart,sigLength);
+         } // End of NextBunch()
+         
+         fitter.SetNBunches(nBunches);
+         fitter.SetChannelGeo(module,cellX,cellZ,caloFlag);
+         fitter.Eval();
+
+         if (nBunches>1 || caloFlag!=0 || caloFlag!=1 || fitter.GetSignalQuality()>1) continue;
+         
+         e[cellX][cellZ][caloFlag] = fitter.GetEnergy();
+         t[cellX][cellZ][caloFlag] = fitter.GetTime();
+
+         if(caloFlag==1 && fitter.GetEnergy()>40)
+           nFired++;
+       }
+      }
 
-       if(dc.IsLowGain()) gain = 0;
-       else
-         gain = 1;
-       
-       e[X][Z][gain] = dc.GetEnergy();
-       t[X][Z][gain] = dc.GetTime();
-       
-       if(gain && dc.GetEnergy()>40)
-         nFired++;
 
-      }
-      
       da1.FillHistograms(e,t);
       fFiredCells.Fill(nFired);