Update by Raphaelle
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Oct 2007 14:02:16 +0000 (14:02 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Oct 2007 14:02:16 +0000 (14:02 +0000)
TRD/AliTRDCalibPadStatus.cxx
TRD/AliTRDCalibPadStatus.h
TRD/AliTRDCalibraFillHisto.cxx
TRD/AliTRDCalibraFillHisto.h
TRD/AliTRDPreprocessor.cxx
TRD/Cal/AliTRDCalPadStatus.h
TRD/Calib/DetNoise/Run0_999999999_v0_s0.root [new file with mode: 0644]
TRD/Calib/PadNoise/Run0_999999999_v0_s0.root [new file with mode: 0644]

index b72b78dafd7bcdc3efce52c8afad20172d258bf0..e6414e4db1a8c0f0b3434c9941589c20ad6f1bd1 100644 (file)
@@ -54,15 +54,12 @@ histo->Draw();
 
 //Root includes
 #include <TObjArray.h>
-#include <TH1F.h>
 #include <TH2F.h>
 #include <TString.h>
 #include <TMath.h>
-#include <TF1.h>
 #include <TRandom.h>
 #include <TDirectory.h>
 #include <TFile.h>
-#include <TTreeStream.h>
 
 //AliRoot includes
 #include <AliMathBase.h>
@@ -71,9 +68,9 @@ histo->Draw();
 #include "AliRawReaderDate.h"
 
 //header file
+#include "AliLog.h"
 #include "AliTRDCalibPadStatus.h"
 #include "AliTRDRawStreamV2.h"
-#include "AliTRDarrayF.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDCommonParam.h"
 #include "./Cal/AliTRDCalROC.h"
@@ -96,15 +93,11 @@ AliTRDCalibPadStatus::AliTRDCalibPadStatus() : /*FOLD00*/
   fAdcMax(20),
   fDetector(-1),
   fNumberOfTimeBins(0),
-  fCalArrayEntries(540),
-  fCalArrayMean(540),
-  fCalArraySquares(540),
   fCalRocArrayMean(540),
   fCalRocArrayRMS(540),
-  fHistoArray(540),
-  fCalEntries(0x0),
-  fCalMean(0x0),
-  fCalSquares(0x0)
+  fCalRocArrayMeand(540),
+  fCalRocArrayRMSd(540),
+  fHistoArray(540)
 {
     //
     // default constructor
@@ -122,33 +115,28 @@ AliTRDCalibPadStatus::AliTRDCalibPadStatus(const AliTRDCalibPadStatus &ped) : /*
   fAdcMax(ped.GetAdcMax()),
   fDetector(ped.fDetector),
   fNumberOfTimeBins(ped.fNumberOfTimeBins),
-  fCalArrayEntries(540),
-  fCalArrayMean(540),
-  fCalArraySquares(540),
   fCalRocArrayMean(540),
   fCalRocArrayRMS(540),
-  fHistoArray(540),
-  fCalEntries(0x0),
-  fCalMean(0x0),
-  fCalSquares(0x0)
+  fCalRocArrayMeand(540),
+  fCalRocArrayRMSd(540),
+  fHistoArray(540)
 {
     //
     // copy constructor
     //
     for (Int_t idet = 0; idet < 540; idet++){
-       const AliTRDarrayF *calEntries  = (AliTRDarrayF*)ped.fCalArrayEntries.UncheckedAt(idet);
-       const AliTRDarrayF *calMean     = (AliTRDarrayF*)ped.fCalArrayMean.UncheckedAt(idet);
-       const AliTRDarrayF *calSquares  = (AliTRDarrayF*)ped.fCalArraySquares.UncheckedAt(idet);
        const AliTRDCalROC *calRocMean  = (AliTRDCalROC*)ped.fCalRocArrayMean.UncheckedAt(idet);
        const AliTRDCalROC *calRocRMS   = (AliTRDCalROC*)ped.fCalRocArrayRMS.UncheckedAt(idet);
+       const AliTRDCalROC *calRocMeand = (AliTRDCalROC*)ped.fCalRocArrayMeand.UncheckedAt(idet);
+       const AliTRDCalROC *calRocRMSd  = (AliTRDCalROC*)ped.fCalRocArrayRMSd.UncheckedAt(idet);
        const TH2F         *hped        = (TH2F*)ped.fHistoArray.UncheckedAt(idet);
     
-       if ( calEntries != 0x0 ) fCalArrayEntries.AddAt(new AliTRDarrayF(*calEntries), idet);
-       if ( calMean != 0x0 )    fCalArrayMean.AddAt(new AliTRDarrayF(*calMean), idet);
-       if ( calSquares != 0x0 ) fCalArraySquares.AddAt(new AliTRDarrayF(*calSquares), idet);
        if ( calRocMean != 0x0 ) fCalRocArrayMean.AddAt(new AliTRDCalROC(*calRocMean), idet);
        if ( calRocRMS != 0x0 )  fCalRocArrayRMS.AddAt(new AliTRDCalROC(*calRocRMS), idet);
 
+       if ( calRocMeand != 0x0 ) fCalRocArrayMeand.AddAt(new AliTRDCalROC(*calRocMeand), idet);
+       if ( calRocRMSd != 0x0 )  fCalRocArrayRMSd.AddAt(new AliTRDCalROC(*calRocRMSd), idet);
+
        if ( hped != 0x0 ){
          TH2F *hNew = new TH2F(*hped);
          hNew->SetDirectory(0);
@@ -185,54 +173,25 @@ AliTRDCalibPadStatus::~AliTRDCalibPadStatus() /*FOLD00*/
   }
 }
 
-//_____________________________________________________________________
-Int_t AliTRDCalibPadStatus::Update(const Int_t icdet, /*FOLD00*/
-                                  const Int_t icRow,
-                                  const Int_t icCol,
-                                  const Int_t csignal,
-                                  const Int_t crowMax)
-{
-    //
-    // Signal filling methode 
-    //
-    if ( (csignal>fAdcMax) || (csignal<fAdcMin)   ) return 0;
-
-    if(fDetector != icdet){
-      fCalEntries = ((AliTRDarrayF *)GetCalEntries(icdet,kTRUE));
-      fCalMean    = ((AliTRDarrayF *)GetCalMean(icdet,kTRUE));
-      fCalSquares = ((AliTRDarrayF *)GetCalSquares(icdet,kTRUE));
-    }
-
-    Float_t entries  = fCalEntries->At(icRow+icCol*crowMax);
-    Float_t mean     = fCalMean->At(icRow+icCol*crowMax);
-    Float_t squares  = fCalSquares->At(icRow+icCol*crowMax);
-    
-    Float_t entriesn = entries+1.0;
-    fCalEntries->AddAt(entriesn,(icRow+icCol*crowMax));
-    Float_t meann = (mean*entries+((Float_t)(csignal+0.5)))/entriesn;
-    fCalMean->AddAt(meann,icRow+icCol*crowMax);
-    Float_t squaresn = ((squares*entries)+(((Float_t)(csignal+0.5))*((Float_t)(csignal+0.5))))/entriesn;
-    fCalSquares->AddAt(squaresn,icRow+icCol*crowMax);
-
-    //printf("icdet %d, icRow %d, icCol %d, csignal %d, crowMax %d\n",icdet,icRow,icCol,csignal,crowMax);
-    //printf("entries %f, mean %f, squares %f\n",entriesn,meann,squaresn);
-
-    fDetector = icdet;
-    
-    return 0;
-}
-
 //_____________________________________________________________________
 Int_t AliTRDCalibPadStatus::UpdateHisto(const Int_t icdet, /*FOLD00*/
-                                      const Int_t icRow,
-                                      const Int_t icCol,
-                                      const Int_t csignal,
-                                      const Int_t crowMax)
+                                       const Int_t icRow,
+                                       const Int_t icCol,
+                                       const Int_t csignal,
+                                       const Int_t crowMax,
+                                       const Int_t ccold,
+                                       const Int_t icMcm)
 {
-    //
-    // Signal filling methode 
-    //
+  //
+  // Signal filling methode 
+  //
   Int_t nbchannel = icRow+icCol*crowMax;
+
+  // now the case of double read channel
+  if(ccold > 0){
+    nbchannel = (((ccold-1)*8+ icMcm)*crowMax+icRow)+144*crowMax;
+    //printf("nbchannel %d, ccold %d, icMcm %d, crowMax %d, icRow %d\n",nbchannel,ccold,icMcm,crowMax,icRow);
+  }
   
   // fast filling methode.
   // Attention: the entry counter of the histogram is not increased
@@ -245,12 +204,11 @@ Int_t AliTRDCalibPadStatus::UpdateHisto(const Int_t icdet, /*FOLD00*/
   
   return 0;
 }
-
 //_____________________________________________________________________
 Int_t AliTRDCalibPadStatus::ProcessEvent(AliTRDRawStreamV2 *rawStream, Bool_t nocheck)
 {
   //
-  // Event Processing loop - AliTRDRawStreamV2
+  // Event Processing loop - AliTRDRawStreamCosmic
   // 0 time bin problem or zero suppression
   // 1 no input
   // 2 input
@@ -258,26 +216,51 @@ Int_t AliTRDCalibPadStatus::ProcessEvent(AliTRDRawStreamV2 *rawStream, Bool_t no
 
   Int_t withInput = 1;
 
+  //rawStream->SetSharedPadReadout(kTRUE);
+
   if(!nocheck) {
     while (rawStream->Next()) {
       Int_t rawversion = rawStream->GetRawVersion();                     //  current raw version
-      if(rawversion != 2) return 0;
+      //if(!rawStream->IsDataZeroSuppressed()) {
+      if(rawversion > 2) {
+       AliInfo(Form("this is not no-zero-suppressed data, the version is %d",rawversion));
+       return 0;
+      }
       Int_t idetector  = rawStream->GetDet();                            //  current detector
       Int_t iRow       = rawStream->GetRow();                            //  current row
       Int_t iRowMax    = rawStream->GetMaxRow();                         //  current rowmax
       Int_t iCol       = rawStream->GetCol();                            //  current col
+      
+
+      Int_t iADC       = 21-rawStream->GetADC();                            //  current ADC
+      Int_t col        = 0;
+      if(iADC == 1) col = 1;
+      else {
+       col = TMath::Max(0,(Int_t)(iADC-19));
+       if(col > 0) col++;
+      }
+      Int_t mcm        = (Int_t)(iCol/18);                               //  current group of 18 col pads
+      if(col > 1) mcm -= 1;      
+      if(col ==1) mcm += 1;
+
+      //Bool_t shared = rawStream->IsCurrentPadShared();                  
+      //printf("ADC %d, iCol %d, col %d, mcm %d, shared %d\n",iADC,iCol,col,mcm,(Int_t)shared);
+
       Int_t iTimeBin   = rawStream->GetTimeBin();                        //  current time bin
       Int_t *signal    = rawStream->GetSignals();                        //  current ADC signal
       Int_t nbtimebin  = rawStream->GetNumberOfTimeBins();               //  number of time bins read from data
 
-      if((fDetector != -1) && (nbtimebin != fNumberOfTimeBins)) return 0;
+      if((fDetector != -1) && (nbtimebin != fNumberOfTimeBins)) {
+       AliInfo(Form("the number of time bins is %d, is different from the previous one %d",nbtimebin,fNumberOfTimeBins));
+       return 0;
+      }
       fNumberOfTimeBins = nbtimebin;
       
       Int_t fin        = TMath::Min(nbtimebin,(iTimeBin+3));
       Int_t n          = 0;
       
       for(Int_t k = iTimeBin; k < fin; k++){
-       if(signal[n]>0) UpdateHisto(idetector,iRow,iCol,signal[n],iRowMax);
+       if(signal[n]>0) UpdateHisto(idetector,iRow,iCol,signal[n],iRowMax,col,mcm);
        n++;
       }
       
@@ -290,6 +273,19 @@ Int_t AliTRDCalibPadStatus::ProcessEvent(AliTRDRawStreamV2 *rawStream, Bool_t no
       Int_t iRow       = rawStream->GetRow();                            //  current row
       Int_t iRowMax    = rawStream->GetMaxRow();                         //  current rowmax
       Int_t iCol       = rawStream->GetCol();                            //  current col
+      
+
+      Int_t iADC       = 21-rawStream->GetADC();                            //  current ADC
+      Int_t col        = 0;
+      if(iADC == 1) col = 1;
+      else {
+       col = TMath::Max(0,(Int_t)(iADC-19));
+       if(col > 0) col++;
+      }
+      Int_t mcm        = (Int_t)(iCol/18);                               //  current group of 18 col pads
+      if(col > 1) mcm -= 1;      
+      if(col ==1) mcm += 1;
+
       Int_t iTimeBin   = rawStream->GetTimeBin();                        //  current time bin
       Int_t *signal    = rawStream->GetSignals();                        //  current ADC signal
       Int_t nbtimebin = rawStream->GetNumberOfTimeBins();               //  number of time bins read from data
@@ -298,7 +294,7 @@ Int_t AliTRDCalibPadStatus::ProcessEvent(AliTRDRawStreamV2 *rawStream, Bool_t no
       Int_t n          = 0;
       
       for(Int_t k = iTimeBin; k < fin; k++){
-       if(signal[n]>0) UpdateHisto(idetector,iRow,iCol,signal[n],iRowMax);
+       if(signal[n]>0) UpdateHisto(idetector,iRow,iCol,signal[n],iRowMax,col,mcm);
        n++;
       }
       
@@ -351,33 +347,6 @@ Int_t AliTRDCalibPadStatus::ProcessEvent(
 
 }
 
-//_____________________________________________________________________
-Bool_t AliTRDCalibPadStatus::TestEvent(Int_t nevent, Int_t sm) /*FOLD00*/
-{
-  //
-  //  Test event loop
-  // fill one oroc and one iroc with random gaus
-  //
-
-  gRandom->SetSeed(0);
-
-    for (Int_t ism=sm; ism<sm+1; ism++){
-               for (Int_t ich=0; ich < 5; ich++){
-           for (Int_t ipl=0; ipl < 6; ipl++){
-             for(Int_t irow = 0; irow < fGeo->GetRowMax(ipl,ich,ism); irow++){
-               for(Int_t icol = 0; icol < fGeo->GetColMax(ipl); icol++){
-                 for (Int_t iTimeBin=0; iTimeBin<(30*nevent); iTimeBin++){
-                   Int_t signal=(Int_t)(gRandom->Gaus(10.0,1.2));
-                   if ( signal>0 )Update((ipl+ich*6+ism*6*5),irow,icol,signal,fGeo->GetRowMax(ipl,ich,ism));
-                 }
-               }
-             }
-           }
-       }
-    }
-    return kTRUE;
-}
-
 //_____________________________________________________________________
 Bool_t AliTRDCalibPadStatus::TestEventHisto(Int_t nevent, Int_t sm) /*FOLD00*/
 {
@@ -395,7 +364,7 @@ Bool_t AliTRDCalibPadStatus::TestEventHisto(Int_t nevent, Int_t sm) /*FOLD00*/
                for(Int_t icol = 0; icol < fGeo->GetColMax(ipl); icol++){
                  for (Int_t iTimeBin=0; iTimeBin<(30*nevent); iTimeBin++){
                    Int_t signal=(Int_t)(gRandom->Gaus(10.0,1.2));
-                   if ( signal>0 )UpdateHisto((ipl+ich*6+ism*6*5),irow,icol,signal,fGeo->GetRowMax(ipl,ich,ism));
+                   if ( signal>0 )UpdateHisto((ipl+ich*6+ism*6*5),irow,icol,signal,fGeo->GetRowMax(ipl,ich,ism),0,0);
                  }
                }
              }
@@ -425,6 +394,10 @@ TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, TObjArray *arr, /*FOLD00*/
 
    
     Int_t nbchannels = fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det))*fGeo->GetColMax(GetPlane(det));
+    
+    // we will add 3*8*rowMax channels at the end for the double counted
+    nbchannels += 3*8*(fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det)));
+
 
     // new histogram with calib information. One value for each pad!
     TH2F* hist = new TH2F(name,title,
@@ -447,30 +420,6 @@ TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, Bool_t force) /*FOLD00*/
     return GetHisto(det, arr, fAdcMax-fAdcMin, fAdcMin, fAdcMax, "Pedestal", force);
 }
 
-//_____________________________________________________________________
-AliTRDarrayF* AliTRDCalibPadStatus::GetCal(Int_t det, TObjArray* arr, Bool_t force) /*FOLD00*/
-{
-    //
-    // return pointer to ROC Calibration
-    // if force is true create a new AliTRDarrayF if it doesn't exist allready
-    //
-    if ( !force || arr->UncheckedAt(det) )
-       return (AliTRDarrayF*)arr->UncheckedAt(det);
-
-    // if we are forced and histogram doesn't yes exist create it
-    AliTRDarrayF *croc = new AliTRDarrayF();
-    Int_t nbpad = fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det))*fGeo->GetColMax(GetPlane(det));
-
-    // new AliTRDCalROC. One value for each pad!
-    croc->Expand(nbpad);
-    for(Int_t k = 0; k < nbpad; k++){
-      croc->AddAt(0.0,k);
-    }
-    arr->AddAt(croc,det);
-    return croc;
-}
-
 //_____________________________________________________________________
 AliTRDCalROC* AliTRDCalibPadStatus::GetCalRoc(Int_t det, TObjArray* arr, Bool_t force) /*FOLD00*/
 {
@@ -488,101 +437,49 @@ AliTRDCalROC* AliTRDCalibPadStatus::GetCalRoc(Int_t det, TObjArray* arr, Bool_t
     arr->AddAt(croc,det);
     return croc;
 }
-
 //_____________________________________________________________________
-AliTRDarrayF* AliTRDCalibPadStatus::GetCalEntries(Int_t det, Bool_t force) /*FOLD00*/
-{
-    //
-    // return pointer to Carge ROC Calibration
-    // if force is true create a new histogram if it doesn't exist allready
-    //
-    TObjArray *arr = &fCalArrayEntries;
-    return GetCal(det, arr, force);
-}
-
-//_____________________________________________________________________
-AliTRDarrayF* AliTRDCalibPadStatus::GetCalMean(Int_t det, Bool_t force) /*FOLD00*/
+AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocMean(Int_t det, Bool_t force) /*FOLD00*/
 {
     //
     // return pointer to Carge ROC Calibration
     // if force is true create a new histogram if it doesn't exist allready
     //
-    TObjArray *arr = &fCalArrayMean;
-    return GetCal(det, arr, force);
+    TObjArray *arr = &fCalRocArrayMean;
+    return GetCalRoc(det, arr, force);
 }
 
 //_____________________________________________________________________
-AliTRDarrayF* AliTRDCalibPadStatus::GetCalSquares(Int_t det, Bool_t force) /*FOLD00*/
+AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocRMS(Int_t det, Bool_t force) /*FOLD00*/
 {
     //
     // return pointer to Carge ROC Calibration
     // if force is true create a new histogram if it doesn't exist allready
     //
-    TObjArray *arr = &fCalArraySquares;
-    return GetCal(det, arr, force);
+    TObjArray *arr = &fCalRocArrayRMS;
+    return GetCalRoc(det, arr, force);
 }
-
 //_____________________________________________________________________
-AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocMean(Int_t det, Bool_t force) /*FOLD00*/
+AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocMeand(Int_t det, Bool_t force) /*FOLD00*/
 {
     //
     // return pointer to Carge ROC Calibration
     // if force is true create a new histogram if it doesn't exist allready
     //
-    TObjArray *arr = &fCalRocArrayMean;
+    TObjArray *arr = &fCalRocArrayMeand;
     return GetCalRoc(det, arr, force);
 }
 
 //_____________________________________________________________________
-AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocRMS(Int_t det, Bool_t force) /*FOLD00*/
+AliTRDCalROC* AliTRDCalibPadStatus::GetCalRocRMSd(Int_t det, Bool_t force) /*FOLD00*/
 {
     //
     // return pointer to Carge ROC Calibration
     // if force is true create a new histogram if it doesn't exist allready
     //
-    TObjArray *arr = &fCalRocArrayRMS;
+    TObjArray *arr = &fCalRocArrayRMSd;
     return GetCalRoc(det, arr, force);
 }
 
-//_________________________________________________________________________
-void AliTRDCalibPadStatus::Analyse() /*FOLD00*/
-{
-  //
-  // Calcul the rms properly
-  // 
-
-  for(Int_t idet = 0; idet < 540; idet++){
-
-    // Take the stuff
-    fCalEntries                 = ((AliTRDarrayF *)GetCalEntries(idet));
-    fCalMean                    = ((AliTRDarrayF *)GetCalMean(idet));
-    fCalSquares                 = ((AliTRDarrayF *)GetCalSquares(idet));
-
-    if(!fCalEntries) continue;
-
-    AliTRDCalROC *calRocMean    = ((AliTRDCalROC *)GetCalRocMean(idet,kTRUE));
-    AliTRDCalROC *calRocRMS     = ((AliTRDCalROC *)GetCalRocRMS(idet,kTRUE));
-
-    // range channels
-    Int_t channels = calRocMean->GetNchannels();
-    
-    for(Int_t ichannels = 0 ; ichannels < channels; ichannels++){
-      
-      Float_t entries  = fCalEntries->At(ichannels);
-      Float_t mean     = fCalMean->At(ichannels);
-      Float_t squares  = fCalSquares->At(ichannels);
-
-      Float_t rms = 0.0;
-      if(entries > 0){
-       Double_t rm = TMath::Abs(squares-(mean*mean));
-       rms = TMath::Sqrt(rm);
-       calRocRMS->SetValue(ichannels,rms/10.0);
-       calRocMean->SetValue(ichannels,mean/10.0);
-      }
-    }
-  }
-}
-
 //_____________________________________________________________________
 void AliTRDCalibPadStatus::AnalyseHisto() /*FOLD00*/
 {
@@ -623,8 +520,50 @@ void AliTRDCalibPadStatus::AnalyseHisto() /*FOLD00*/
            rocMean->SetValue(iChannel,param[1]/10.0);
             rocRMS->SetValue(iChannel,param[2]/10.0);
        }
+
+       // here we analyse doubled read channels
+       
+       AliTRDCalROC *rocMeand     = GetCalRocMeand(idet,kTRUE);
+       AliTRDCalROC *rocRMSd      = GetCalRocRMSd(idet,kTRUE);
+
+       Int_t nrows = rocMeand->GetNrows();
+       Int_t shift = 144*nrows;
+       Int_t total = shift+3*8*nrows; 
+
+       for (Int_t iChannel=shift; iChannel<total; iChannel++){
+            Int_t offset = (nbinsAdc+2)*(iChannel+1)+1;
+           Double_t ret = AliMathBase::FitGaus(array_hP+offset,nbinsAdc,fAdcMin,fAdcMax,&param,&dummy);
+            // if the fitting failed set noise and pedestal to 0
+           if ((ret==-4) || (ret==-1) || (ret==-2)) {
+               param[1]=0.0;
+               param[2]=0.0;
+           }
+           if((param[1]/10.0) > 65534.0) param[1] = 0.0;
+           if((param[2]/10.0) > 65534.0) param[2] = 0.0;
+           
+           // here we have to recalculate backward
+           Int_t nb   = iChannel-shift;
+           Int_t row  = nb%nrows;
+           Int_t j    = (Int_t)(nb/nrows);
+           Int_t imcm = j%8;
+           Int_t icol = (Int_t)(j/8);
+           
+           Int_t finalcol = 18*imcm;
+           if(icol > 0) icol += 17;
+           else icol = -1;
+           finalcol += icol;
+
+           Int_t channel = row+finalcol*nrows;
+
+           //printf("iChannel %d, nrows %d, finalcol %d, row %d, channel %d\n",iChannel,nrows,finalcol,row,channel);
+           if((finalcol < 0) || (finalcol >= 144)) continue;
+
+           rocMeand->SetValue(channel,param[1]/10.0);
+            rocRMSd->SetValue(channel,param[2]/10.0);
+       }
+
     }
-   
+      
 }
 
 //_______________________________________________________________________________________
@@ -644,6 +583,10 @@ AliTRDCalPadStatus* AliTRDCalibPadStatus::CreateCalPadStatus()
       AliTRDCalROC *calRocMean    = ((AliTRDCalROC *)GetCalRocMean(idet));
       AliTRDCalROC *calRocRMS     = ((AliTRDCalROC *)GetCalRocRMS(idet));
 
+      //Take the stuff second chance
+      AliTRDCalROC *calRocMeand    = ((AliTRDCalROC *)GetCalRocMeand(idet));
+      AliTRDCalROC *calRocRMSd     = ((AliTRDCalROC *)GetCalRocRMSd(idet));
+
       if ( !calRocMean ) {
        for(Int_t k = 0; k < calROC->GetNchannels(); k++){
          calROC->SetStatus(k,AliTRDCalPadStatus::kMasked);
@@ -658,21 +601,28 @@ AliTRDCalPadStatus* AliTRDCalibPadStatus::CreateCalPadStatus()
       Double_t meanmean      = calRocMean->GetMean()*10.0;
       Double_t meansquares   = calRocRMS->GetMean()*10.0;
 
-
       for(Int_t ich = 0; ich < channels; ich++){
        
        Float_t mean     = calRocMean->GetValue(ich)*10.0;
        Float_t rms      = calRocRMS->GetValue(ich)*10.0;
        
-       if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) calROC->SetStatus(ich, AliTRDCalPadStatus::kMasked);
-      
+       if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) {
+         // look at second chance
+         Float_t meand     = calRocMeand->GetValue(ich)*10.0;
+         Float_t rmsd      = calRocRMSd->GetValue(ich)*10.0;
+
+         if((rmsd <= 0.0001) || (TMath::Abs(meand-meanmean)>(5*rmsmean)) || (TMath::Abs(rmsd)>(5.0*TMath::Abs(meansquares)))) {
+           calROC->SetStatus(ich, AliTRDCalPadStatus::kMasked);
+         }
+         else calROC->SetStatus(ich, AliTRDCalPadStatus::kReadSecond);
+       }
+       
       }
     }
   
   return obj;
   
 }
-
 //_______________________________________________________________________________________
 AliTRDCalPad* AliTRDCalibPadStatus::CreateCalPad()
 {
@@ -783,7 +733,45 @@ void AliTRDCalibPadStatus::SetCalRocRMS(AliTRDCalROC *rms, Int_t det) /*FOLD00*/
   }
   
 }
+//_____________________________________________________________________
+void AliTRDCalibPadStatus::SetCalRocMeand(AliTRDCalROC *mean, Int_t det) /*FOLD00*/
+{
+    //
+    //  Put the AliTRDCalROC in the array fCalRocArrayMean
+    //
 
+
+  AliTRDCalROC *rocMean = GetCalRocMeand(det,kTRUE);
+  
+  Int_t nChannels = rocMean->GetNchannels();
+  
+  for (Int_t iChannel=0; iChannel<nChannels; iChannel++){
+    
+    rocMean->SetValue(iChannel,mean->GetValue(iChannel));
+    
+  }
+  
+}
+
+//_____________________________________________________________________
+void AliTRDCalibPadStatus::SetCalRocRMSd(AliTRDCalROC *rms, Int_t det) /*FOLD00*/
+{
+    //
+    //  Put the AliTRDCalROC in the array fCalRocArrayRMS
+    //
+
+
+  AliTRDCalROC *rocRms = GetCalRocRMSd(det,kTRUE);
+  
+  Int_t nChannels = rocRms->GetNchannels();
+  
+  for (Int_t iChannel=0; iChannel<nChannels; iChannel++){
+    
+    rocRms->SetValue(iChannel,rms->GetValue(iChannel));
+    
+  }
+  
+}
 //_____________________________________________________________________________
 Int_t AliTRDCalibPadStatus::GetPlane(Int_t d) const
 {
index cd22f486b4e083f262f50e4144925883dfc6f6e4..1a146adaedceab37e8bbb3281671020227e26e2f 100644 (file)
@@ -13,7 +13,6 @@
 
 class TObjArray;
 class TH2F;
-class TTreeSRedirector;
 
 class AliRawReader;
 
@@ -22,7 +21,6 @@ class AliTRDCalPad;
 class AliTRDCalROC;
 class AliTRDCalPadStatus;
 class AliTRDRawStreamV2;
-class AliTRDarrayF;
 class AliTRDgeometry;
 
 struct eventHeaderStruct;
@@ -41,12 +39,9 @@ public:
   Int_t ProcessEvent(AliRawReader    *rawReader, Bool_t nocheck = kFALSE);
   Int_t ProcessEvent(eventHeaderStruct   *event, Bool_t nocheck = kFALSE);
 
-  Int_t Update(const Int_t idet, const Int_t iRow, const Int_t iCol,
-              const Int_t signal, const Int_t rowMax);
   Int_t UpdateHisto(const Int_t idet, const Int_t iRow, const Int_t iCol,
-                   const Int_t signal, const Int_t crowMax);
+                   const Int_t signal, const Int_t crowMax, const Int_t ccold, const Int_t icMcm);
 
-  void Analyse();
   void AnalyseHisto();
   AliTRDCalPadStatus *CreateCalPadStatus();
   AliTRDCalPad *CreateCalPad();
@@ -55,13 +50,16 @@ public:
   void SetCalRocMean(AliTRDCalROC *mean, Int_t det);
   void SetCalRocRMS(AliTRDCalROC *rms, Int_t det);  
 
+  void SetCalRocMeand(AliTRDCalROC *mean, Int_t det);
+  void SetCalRocRMSd(AliTRDCalROC *rms, Int_t det);  
+
   //
-  AliTRDarrayF* GetCalEntries(Int_t det, Bool_t force=kFALSE);    // get calibration object
-  AliTRDarrayF* GetCalMean(Int_t det, Bool_t force=kFALSE);       // get calibration object
-  AliTRDarrayF* GetCalSquares(Int_t det, Bool_t force=kFALSE);    // get calibration object
   AliTRDCalROC* GetCalRocMean(Int_t det, Bool_t force=kFALSE);    // get calibration object
   AliTRDCalROC* GetCalRocRMS(Int_t det, Bool_t force=kFALSE);     // get calibration object
 
+  AliTRDCalROC* GetCalRocMeand(Int_t det, Bool_t force=kFALSE);   // get calibration object
+  AliTRDCalROC* GetCalRocRMSd(Int_t det, Bool_t force=kFALSE);    // get calibration object
+
   TH2F* GetHisto  (Int_t det, Bool_t force=kFALSE);              // get refernce histogram
   
   void  DumpToFile(const Char_t *filename, const Char_t *dir="", const Bool_t append=kFALSE);
@@ -72,10 +70,9 @@ public:
   void    SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range 
 
 
-  Bool_t TestEvent(Int_t nevent, Int_t sm);  //test the fast approach to fill array  - used for test purposes
   Bool_t TestEventHisto(Int_t nevent, Int_t sm);  //test the fast approach to fill histograms  
 
-private:
+ private:
 
   // Geometry
   AliTRDgeometry  *fGeo;            //! The TRD geometry
@@ -85,19 +82,15 @@ private:
   Int_t fDetector;                  //  Current detector
   Int_t fNumberOfTimeBins;          //  Current number of time bins
      
-  TObjArray fCalArrayEntries;       //  Array of AliTRDarrayF class calibration
-  TObjArray fCalArrayMean;          //  Array of AliTRDarrayF class calibration
-  TObjArray fCalArraySquares;       //  Array of AliTRDarrayF class calibration
   TObjArray fCalRocArrayMean;       //  Array of AliTRDCalROC class for signal width calibration
   TObjArray fCalRocArrayRMS;        //  Array of AliTRDCalROC class for mean width calibration
 
+  TObjArray fCalRocArrayMeand;      //  Array of AliTRDCalROC class for signal width calibration doubled
+  TObjArray fCalRocArrayRMSd;       //  Array of AliTRDCalROC class for mean width calibration doubled
+
   TObjArray fHistoArray;            //  Array of histos for mean width calibration
   
-  AliTRDarrayF *fCalEntries;        //  Current AliTRDArrayF entries
-  AliTRDarrayF *fCalMean;           //  Current AliTRDArrayF Mean
-  AliTRDarrayF *fCalSquares;        //  Current AliTRDArrayF Squares
-
-  AliTRDarrayF* GetCal(Int_t det, TObjArray* arr, Bool_t force);
   AliTRDCalROC* GetCalRoc(Int_t det, TObjArray* arr, Bool_t force);
  
   TH2F* GetHisto(Int_t det, TObjArray *arr,
@@ -109,8 +102,6 @@ private:
   virtual Int_t    GetChamber(Int_t d) const;
   virtual Int_t    GetSector(Int_t d) const;
 
-public:
-
   ClassDef(AliTRDCalibPadStatus,1)
 
 };
index b79658b25cff16cc11c2a14840d0c048b1c3b16e..7387b9cc466422e952ed5cede8b1ce5c50f15fd7 100644 (file)
@@ -61,7 +61,7 @@
 #include "AliTRDpadPlane.h"
 #include "AliTRDcluster.h"
 #include "AliTRDtrack.h"
-#include "AliTRDRawStream.h"
+#include "AliTRDRawStreamV2.h"
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
 #include "AliTRDgeometry.h"
@@ -135,6 +135,8 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto()
   ,fDebugLevel(0)
   ,fDetectorAliTRDtrack(kFALSE)
   ,fDetectorPreviousTrack(-1)
+  ,fMCMPrevious(-1)
+  ,fROBPrevious(-1)
   ,fNumberClusters(18)
   ,fProcent(6.0)
   ,fDifference(17)
@@ -206,6 +208,8 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c)
   ,fDebugLevel(c.fDebugLevel)
   ,fDetectorAliTRDtrack(c.fDetectorAliTRDtrack)
   ,fDetectorPreviousTrack(c.fDetectorPreviousTrack)
+  ,fMCMPrevious(c.fMCMPrevious)
+  ,fROBPrevious(c.fROBPrevious)
   ,fNumberClusters(c.fNumberClusters)
   ,fProcent(c.fProcent)
   ,fDifference(c.fDifference)
@@ -1197,74 +1201,156 @@ void AliTRDCalibraFillHisto::StoreInfoCHPHtrack(AliTRDcluster *cl, AliTRDtrack *
   
 }
 //_____________________________________________________________________
-Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliTRDRawStream *rawStream, Bool_t nocheck)
+Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliTRDRawStreamV2 *rawStream, Bool_t nocheck)
 {
   //
-  // Event Processing loop - AliTRDRawStream
+  // Event Processing loop - AliTRDRawStreamV2
   // 0 timebin problem
   // 1 no input
   // 2 input
   //
-
+  
   Int_t withInput = 1;
-
-  Int_t phvalue[36];
-  //Int_t row[36];
-  //Int_t col[36];
+  
+  Int_t phvalue[21][36];
   for(Int_t k = 0; k < 36; k++){
-    phvalue[k] = 10;
-    //row[k]     = -1;
-    //col[36]    = -1;
+    for(Int_t j = 0; j < 21; j++){
+      phvalue[j][k] = 10;
+    }
   }
+  
   fDetectorPreviousTrack = -1;
-  Int_t nbtimebin = 0;                                           
+  fMCMPrevious           = -1;
+  fROBPrevious           = -1;
+  Int_t nbtimebin = 0;                                        
+  Int_t baseline  = 10;  
+
+  // For selecting the signal
+  Double_t mean[21]   = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
+  Int_t first[21]     = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; 
+  Int_t    select[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
   if(!nocheck){
   
     fTimeMax = 0;
-  
+       
     while (rawStream->Next()) {
       
       Int_t idetector = rawStream->GetDet();                            //  current detector
-      if((fDetectorPreviousTrack != idetector) && (fDetectorPreviousTrack != -1)){
-       if(TMath::Mean(fTimeMax,phvalue)>20.0){
-         withInput = 2;
-         for(Int_t k = 0; k < fTimeMax; k++){
-           UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],fTimeMax);
-           phvalue[k] = 10;
-           //row[k]     = -1;
-           //col[k]     = -1;
+      Int_t imcm      = rawStream->GetMCM();                            //  current MCM
+      Int_t irob      = rawStream->GetROB();                            //  current ROB
+      
+      if(((fMCMPrevious != imcm) || (fDetectorPreviousTrack != idetector) || (fROBPrevious != irob)) && (fDetectorPreviousTrack != -1)){
+       
+       // take the mean values and check the first time bin
+       for(Int_t j = 0; j < 21; j++){       
+         if(TMath::RMS(fTimeMax,phvalue[j]) != 0.0) mean[j] = TMath::Mean(fTimeMax,phvalue[j]);
+         else mean[j] = 0.0;
+         if(phvalue[j][0] > 200.0) first[j] = 1;
+         else first[j] = 0;
+       }
+       
+       // select
+       for(Int_t j = 1; j < 20; j++){
+         if((first[j-1] == 0) && (first[j] ==0) && (first[j+1] == 0) && (mean[j-1] > (baseline+5.0)) && (mean[j] > (baseline+10.0)) && (mean[j+1] > (baseline+5.0)) && (mean[j] >= mean[j-1]) && (mean[j] >= mean[j+1])){
+           select[j] = 1;
+         }
+         else select[j] = 0;
+       }
+
+       // fill
+       for(Int_t j = 1; j < 20; j++){
+         if(select[j] == 1){
+           withInput = 2;
+           for(Int_t k = 0; k < fTimeMax; k++){
+             if((phvalue[j][k] >= phvalue[j-1][k]) && (phvalue[j][k] >= phvalue[j+1][k])){
+               UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j-1][k]+phvalue[j][k]+phvalue[j+1][k]),fTimeMax);
+             }
+             else{
+               if((j < 19) && (phvalue[j+1][k] >= phvalue[j][k]) && (phvalue[j+1][k] >= phvalue[j+2][k])){
+                 UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j][k]+phvalue[j+1][k]+phvalue[j+2][k]),fTimeMax);
+               }
+               else UpdateDAQ(fDetectorPreviousTrack,0,0,k,(3*baseline),fTimeMax);
+             }    
+           }
+         }
+       }
+
+       // reset
+       for(Int_t k = 0; k < 36; k++){
+         for(Int_t j = 0; j < 21; j++){
+           phvalue[j][k] = baseline;
          }
        }
       }
+
       fDetectorPreviousTrack = idetector;
+      fMCMPrevious           = imcm;
+      fROBPrevious           = irob;
+
       nbtimebin         = rawStream->GetNumberOfTimeBins();              //  number of time bins read from data
       if(nbtimebin == 0) return 0;
       if((fTimeMax != 0) && (nbtimebin != fTimeMax)) return 0;
       fTimeMax          = nbtimebin;
+
+      //baseline          = rawStream->GetCommonAdditive();                // common additive baseline
+     
       Int_t iTimeBin    = rawStream->GetTimeBin();                       //  current time bin
-      //row[iTimeBin]   = rawStream->GetRow();                           //  current row
-      //col[iTimeBin]   = rawStream->GetCol();                           //  current col     
       Int_t *signal     = rawStream->GetSignals();                       //  current ADC signal
-      
+      Int_t col         = (rawStream->GetCol())%18;                      //  current COL MCM
+           
+      if((col < 0) || (col >= 21)) return 0;  
+      if((imcm>=16) || (imcm < 0)) return 0;  
+           
       Int_t fin     = TMath::Min(fTimeMax,(iTimeBin+3));
       Int_t n       = 0;
       for(Int_t itime = iTimeBin; itime < fin; itime++){
-       // should extract baseline here!
-       if(signal[n]>13) phvalue[itime] = signal[n];
+       if(signal[n]> (baseline+3)) phvalue[col][itime] = signal[n];
        n++;
       }
     }
-  
+    
     // fill the last one
     if(fDetectorPreviousTrack != -1){
-      if(TMath::Mean(fTimeMax,phvalue)>20.0){
-       withInput = 2;
-       for(Int_t k = 0; k < fTimeMax; k++){
-         UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],fTimeMax);
-         phvalue[k] = 10;
-         //row[k]     = -1;
-         //col[k]     = -1;
+
+      // take the mean values and check the first time bin
+      for(Int_t j = 0; j < 21; j++){       
+       if(TMath::RMS(fTimeMax,phvalue[j]) != 0.0) mean[j] = TMath::Mean(fTimeMax,phvalue[j]);
+       else mean[j] = 0.0;
+         if(phvalue[j][0] > 200.0) first[j] = 1;
+         else first[j] = 0;
+      }
+      
+      // select
+      for(Int_t j = 1; j < 20; j++){
+       if((first[j-1] == 0) && (first[j] ==0) && (first[j+1] == 0) && (mean[j-1] > (baseline+5.0)) && (mean[j] > (baseline+10.0)) && (mean[j+1] > (baseline+5.0)) && (mean[j] >= mean[j-1]) && (mean[j] >= mean[j+1])){
+         select[j] = 1;
+       }
+       else select[j] = 0;
+      }
+      
+      // fill
+      for(Int_t j = 1; j < 20; j++){
+       if(select[j] == 1){
+         withInput = 2;
+         for(Int_t k = 0; k < fTimeMax; k++){
+           if((phvalue[j][k] >= phvalue[j-1][k]) && (phvalue[j][k] >= phvalue[j+1][k])){
+             UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j-1][k]+phvalue[j][k]+phvalue[j+1][k]),fTimeMax);
+           }
+           else{
+             if((j < 19) && (phvalue[j+1][k] >= phvalue[j][k]) && (phvalue[j+1][k] >= phvalue[j+2][k])){
+               UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j][k]+phvalue[j+1][k]+phvalue[j+2][k]),fTimeMax);
+             }
+             else UpdateDAQ(fDetectorPreviousTrack,0,0,k,(3*baseline),fTimeMax);
+           }      
+         }
+       }
+      }
+      
+      // reset
+      for(Int_t k = 0; k < 36; k++){
+       for(Int_t j = 0; j < 21; j++){
+         phvalue[j][k] = baseline;
        }
       }
     }
@@ -1275,49 +1361,126 @@ Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliTRDRawStream *rawStream, Bool_t
     while (rawStream->Next()) {
 
       Int_t idetector = rawStream->GetDet();                            //  current detector
-      if((fDetectorPreviousTrack != idetector) && (fDetectorPreviousTrack != -1)){
-       if(TMath::Mean(nbtimebin,phvalue)>20.0){
-         withInput = 2;
-         for(Int_t k = 0; k < nbtimebin; k++){
-           UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],nbtimebin);
-           phvalue[k] = 10;
-           //row[k]     = -1;
-           //col[k]     = -1;
+      Int_t imcm      = rawStream->GetMCM();                            //  current MCM
+      Int_t irob      = rawStream->GetROB();                            //  current ROB
+
+      if(((fMCMPrevious != imcm) || (fDetectorPreviousTrack != idetector) || (fROBPrevious != irob)) && (fDetectorPreviousTrack != -1)){
+
+       // take the mean values and check the first time bin
+       for(Int_t j = 0; j < 21; j++){       
+         if(TMath::RMS(fTimeMax,phvalue[j]) != 0.0) mean[j] = TMath::Mean(fTimeMax,phvalue[j]);
+         else mean[j] = 0.0;
+         if(phvalue[j][0] > 200.0) first[j] = 1;
+         else first[j] = 0;
+       }
+       
+       // select
+       for(Int_t j = 1; j < 20; j++){
+         if((first[j-1] == 0) && (first[j] ==0) && (first[j+1] == 0) && (mean[j-1] > (baseline+5.0)) && (mean[j] > (baseline+10.0)) && (mean[j+1] > (baseline+5.0)) && (mean[j] >= mean[j-1]) && (mean[j] >= mean[j+1])){
+           select[j] = 1;
+         }
+         else select[j] = 0;
+       }
+       
+      // fill
+       for(Int_t j = 1; j < 20; j++){
+         if(select[j] == 1){
+           withInput = 2;
+           for(Int_t k = 0; k < fTimeMax; k++){
+             if((phvalue[j][k] >= phvalue[j-1][k]) && (phvalue[j][k] >= phvalue[j+1][k])){
+               UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j-1][k]+phvalue[j][k]+phvalue[j+1][k]),fTimeMax);
+             }
+             else{
+               if((j < 19) && (phvalue[j+1][k] >= phvalue[j][k]) && (phvalue[j+1][k] >= phvalue[j+2][k])){
+                 UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j][k]+phvalue[j+1][k]+phvalue[j+2][k]),fTimeMax);
+               }
+               else UpdateDAQ(fDetectorPreviousTrack,0,0,k,3*baseline,fTimeMax);
+             }    
+           }
+         }
+       }
+       
+       // reset
+       for(Int_t k = 0; k < 36; k++){
+         for(Int_t j = 0; j < 21; j++){
+           phvalue[j][k] = baseline;
          }
        }
       }
+      
       fDetectorPreviousTrack = idetector;
+      fMCMPrevious           = imcm;
+      fROBPrevious           = irob;
+      
+
+
+      //baseline          = rawStream->GetCommonAdditive();                //  common baseline
+      
       nbtimebin         = rawStream->GetNumberOfTimeBins();              //  number of time bins read from data
       Int_t iTimeBin    = rawStream->GetTimeBin();                       //  current time bin
-      //row[iTimeBin]   = rawStream->GetRow();                           //  current row
-      //col[iTimeBin]   = rawStream->GetCol();                           //  current col     
       Int_t *signal     = rawStream->GetSignals();                       //  current ADC signal
-      
+      Int_t col         = (rawStream->GetCol())%18;                      //  current COL MCM
+
       Int_t fin     = TMath::Min(nbtimebin,(iTimeBin+3));
       Int_t n       = 0;
+      
+      if((col < 0) || (col >= 21)) return 0;  
+      if((imcm>=16) || (imcm < 0)) return 0;  
+      
       for(Int_t itime = iTimeBin; itime < fin; itime++){
-       // should extract baseline here!
-       if(signal[n]>13) phvalue[itime] = signal[n];
+       if(signal[n]>13) phvalue[col][itime] = signal[n];
        n++;
       }
     }
     
     // fill the last one
     if(fDetectorPreviousTrack != -1){
-      if(TMath::Mean(nbtimebin,phvalue)>20.0){
-       withInput = 2;
-       for(Int_t k = 0; k < nbtimebin; k++){
-         UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],nbtimebin);
-         phvalue[k] = 10;
-         //row[k]     = -1;
-         //col[k]     = -1;
+      
+      // take the mean values and check the first time bin
+      for(Int_t j = 0; j < 21; j++){       
+       if(TMath::RMS(fTimeMax,phvalue[j]) != 0.0) mean[j] = TMath::Mean(fTimeMax,phvalue[j]);
+       else mean[j] = 0.0;
+       if(phvalue[j][0] > 200.0) first[j] = 1;
+       else first[j] = 0;
+      }
+      
+      // select
+      for(Int_t j = 1; j < 20; j++){
+       if((first[j-1] == 0) && (first[j] ==0) && (first[j+1] == 0) && (mean[j-1] > (baseline+5.0)) && (mean[j] > (baseline+10.0)) && (mean[j+1] > (baseline+5.0)) && (mean[j] >= mean[j-1]) && (mean[j] >= mean[j+1])){
+         select[j] = 1;
+       }
+       else select[j] = 0;
+      }
+      
+      // fill
+      for(Int_t j = 1; j < 20; j++){
+       if(select[j] == 1){
+         withInput = 2;
+         for(Int_t k = 0; k < fTimeMax; k++){
+           if((phvalue[j][k] >= phvalue[j-1][k]) && (phvalue[j][k] >= phvalue[j+1][k])){
+             UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j-1][k]+phvalue[j][k]+phvalue[j+1][k]),fTimeMax);
+           }
+           else{
+             if((j < 19) && (phvalue[j+1][k] >= phvalue[j][k]) && (phvalue[j+1][k] >= phvalue[j+2][k])){
+               UpdateDAQ(fDetectorPreviousTrack,0,0,k,(phvalue[j][k]+phvalue[j+1][k]+phvalue[j+2][k]),fTimeMax);
+             }
+             else UpdateDAQ(fDetectorPreviousTrack,0,0,k,3*baseline,fTimeMax);
+           }      
+         }
+       }
+      }
+      
+      // reset
+      for(Int_t k = 0; k < 36; k++){
+       for(Int_t j = 0; j < 21; j++){
+         phvalue[j][k] = baseline;
        }
       }
     }
   }
   
   return withInput;
-
+  
 }
 //_____________________________________________________________________
 Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck)
@@ -1327,7 +1490,7 @@ Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliRawReader *rawReader, Bool_t no
   //
 
 
-  AliTRDRawStream rawStream(rawReader);
+  AliTRDRawStreamV2 rawStream(rawReader);
 
   rawReader->Select("TRD");
 
index 9e09866d51ea25584ebd2dd341a96921927c42bd..5083901bcc97f67678ea8bd83f8ea77c7a030b38 100644 (file)
@@ -39,7 +39,7 @@ class AliRawReader;
 class AliTRDCalibraMode;
 class AliTRDCalibraVector;
 class AliTRDCalibraVdriftLinearFit;
-class AliTRDRawStream;
+class AliTRDRawStreamV2;
 class AliTRDcluster;
 class AliTRDtrack;
 class AliTRDmcmTracklet;
@@ -73,7 +73,7 @@ class AliTRDCalibraFillHisto : public TObject {
           Bool_t   UpdateHistogramcm(AliTRDmcmTracklet *trk);
  
   // Process events DAQ
-         Int_t   ProcessEventDAQ(AliTRDRawStream *rawStream, Bool_t nocheck = kFALSE);
+         Int_t   ProcessEventDAQ(AliTRDRawStreamV2 *rawStream, Bool_t nocheck = kFALSE);
          Int_t   ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck = kFALSE);
          Int_t   ProcessEventDAQ(eventHeaderStruct *event, Bool_t nocheck = kFALSE);
 
@@ -154,7 +154,7 @@ class AliTRDCalibraFillHisto : public TObject {
 
   // Vector method
 AliTRDCalibraVector *GetCalibraVector() const                                { return fCalibraVector;          }   
-
+  
  protected:
 
   // Geometry
@@ -188,6 +188,8 @@ AliTRDCalibraVector *GetCalibraVector() const                                { r
   // Fill the 2D histos in the offline tracking
           Bool_t   fDetectorAliTRDtrack;    // Change of track
          Int_t    fDetectorPreviousTrack;  // Change of detector
+         Int_t    fMCMPrevious;            // Change of MCM
+         Int_t    fROBPrevious;            // Change of ROB
          Short_t  fNumberClusters;         // Minimum number of clusters in the tracklets
           Float_t  fProcent;                // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
           Short_t  fDifference;             // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
@@ -284,15 +286,13 @@ AliTRDCalibraVector *GetCalibraVector() const                                { r
   static  AliTRDCalibraFillHisto *fgInstance;                // Instance
   static  Bool_t   fgTerminated;                             // If terminated
 
-  
  private:
   
   // This is a singleton, contructor is private!
   AliTRDCalibraFillHisto();
-  virtual ~AliTRDCalibraFillHisto();
+  virtual ~AliTRDCalibraFillHisto(); 
     
-  ClassDef(AliTRDCalibraFillHisto,3)                         // TRD Calibration class
+  ClassDef(AliTRDCalibraFillHisto,4)                         // TRD Calibration class
 
 };
   
index 90a3334ce81d41556991747125a5af34a9e90a66..3153eabf8a9a7148a022cdfb80538094c76220ec 100644 (file)
@@ -175,6 +175,7 @@ Bool_t AliTRDPreprocessor::ProcessDCS(TMap * dcsAliasMap)
     if (nGraph [iAlias] == 0) {
       Log("No TGraph for this dcsDatapointAlias : not stored");
       results [iAlias] = kFALSE;
+      //error  = kTRUE;
       continue;
     }
                
@@ -305,6 +306,14 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
            if ( rocRMS )  {
              calPedSum.SetCalRocRMS(rocRMS,idet);
            }
+           AliTRDCalROC *rocMeand  = calPed->GetCalRocMeand(idet, kFALSE);
+           if ( rocMeand )  {
+             calPedSum.SetCalRocMeand(rocMeand,idet);
+           }
+           AliTRDCalROC *rocRMSd = calPed->GetCalRocRMSd(idet, kFALSE);
+           if ( rocRMSd )  {
+             calPedSum.SetCalRocRMSd(rocRMSd,idet);
+           }
          }// det loop
 
          // store as reference data
index 50ceee2bf19f5a71c84f9ded329e32d73687150e..83b15756f80b84a19c252942a3d321eee4ec0180 100644 (file)
@@ -20,7 +20,7 @@ class AliTRDCalPadStatus : public TNamed {
  public:
  
   enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
-  enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8    };
+  enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8, kReadSecond = 16 };
 
   AliTRDCalPadStatus();
   AliTRDCalPadStatus(const Text_t* name, const Text_t* title);
@@ -36,6 +36,8 @@ class AliTRDCalPadStatus : public TNamed {
                                                { return CheckStatus(d, col, row, kPadBridgedLeft);  };
           Bool_t      IsBridgedRight(Int_t d, Int_t col, Int_t row) const 
                                                { return CheckStatus(d, col, row, kPadBridgedRight); };
+         Bool_t      IsReadSecond(Int_t d, Int_t col, Int_t row) const 
+                                              { return CheckStatus(d, col, row, kReadSecond); };
           Bool_t      CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const;
 
   AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; };
diff --git a/TRD/Calib/DetNoise/Run0_999999999_v0_s0.root b/TRD/Calib/DetNoise/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..dfaa1e2
Binary files /dev/null and b/TRD/Calib/DetNoise/Run0_999999999_v0_s0.root differ
diff --git a/TRD/Calib/PadNoise/Run0_999999999_v0_s0.root b/TRD/Calib/PadNoise/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..b4aace7
Binary files /dev/null and b/TRD/Calib/PadNoise/Run0_999999999_v0_s0.root differ