]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
o add Reset function to CalPad and CalROC o Add functionality to AliTPCdataQA - Reset...
authorwiechula <Jens.Wiechula@cern.ch>
Tue, 11 Nov 2014 14:21:23 +0000 (15:21 +0100)
committermivanov <marian.ivanov@cern.ch>
Sat, 22 Nov 2014 23:50:45 +0000 (00:50 +0100)
TPC/Base/AliTPCCalPad.cxx
TPC/Base/AliTPCCalPad.h
TPC/Base/AliTPCCalROC.cxx
TPC/Base/AliTPCCalROC.h
TPC/Base/AliTPCdataQA.cxx
TPC/Base/AliTPCdataQA.h

index 18786bb3de00894936c05181a731d89c8fb6f7d9..5d478774dde7099f993605821e2855ea1c349fb3 100644 (file)
@@ -90,7 +90,7 @@ AliTPCCalPad::AliTPCCalPad(const AliTPCCalPad &c):TNamed(c)
 }
 
 //_____________________________________________________________________________
-AliTPCCalPad::AliTPCCalPad(TObjArray * array):TNamed()
+AliTPCCalPad::AliTPCCalPad(TObjArray * array):TNamed(array->GetName(),array->GetName())
 {
   //
   // AliTPCCalPad default constructor
@@ -271,6 +271,19 @@ void AliTPCCalPad::Divide(const AliTPCCalPad * pad)
     }
 }
 
+//_____________________________________________________________________________
+void AliTPCCalPad::Reset()
+{
+  //
+  // Reset all cal Rocs
+  //
+  for (Int_t isec = 0; isec < kNsec; isec++) {
+    if (fROC[isec]){
+      fROC[isec]->Reset();
+    }
+  }
+}
+
 //_____________________________________________________________________________
 TGraph  *  AliTPCCalPad::MakeGraph(Int_t type, Float_t ratio){
   //
index 40f7fc876d5fb950eebd5e748c502b0759f674af..af89f284eacee2158190bca86cd0fc8e28369a24 100644 (file)
@@ -59,6 +59,7 @@ class AliTPCCalPad : public TNamed {
   void Add(const AliTPCCalPad * roc, Double_t c1 = 1);   // multiply AliTPCCalPad 'pad' by c1 and add each channel to the coresponing channel in all ROCs
   void Multiply(const AliTPCCalPad * pad);  // multiply each channel of all ROCs with the coresponding channel of 'pad'
   void Divide(const AliTPCCalPad * pad);    // divide each channel of all ROCs by the coresponding channel of 'pad'
+  void Reset();
   //
   Double_t GetMeanRMS(Double_t &rms);   // Calculates mean and RMS of all ROCs
   Double_t GetMean(AliTPCCalPad* outlierPad = 0);   // return mean of the mean of all ROCs
index b6a5c382026ca2b56b557010681c393af732749c..6c70e40ff97f1b33a599e6e639321a42148a2ba9 100644 (file)
@@ -74,7 +74,8 @@ AliTPCCalROC::AliTPCCalROC(UInt_t  sector)
   fNRows        =  AliTPCROC::Instance()->GetNRows(fSector);
   fkIndexes      =  AliTPCROC::Instance()->GetRowIndexes(fSector);
   fData = new Float_t[fNChannels];
-  for (UInt_t  idata = 0; idata< fNChannels; idata++) fData[idata] = 0.;
+  Reset();
+//   for (UInt_t  idata = 0; idata< fNChannels; idata++) fData[idata] = 0.;
 }
 
 //_____________________________________________________________________________
@@ -326,6 +327,7 @@ void AliTPCCalROC::Add(const AliTPCCalROC * roc, Double_t c1){
   // multiply AliTPCCalROC roc by c1 and add each channel to the coresponing channel in the ROC
   //  - pad by pad 
   //
+  if (!roc) return;
   for (UInt_t  idata = 0; idata< fNChannels; idata++){
     fData[idata]+=roc->fData[idata]*c1;
   }
@@ -337,6 +339,7 @@ void AliTPCCalROC::Multiply(const AliTPCCalROC*  roc) {
   // multiply each channel of the ROC with the coresponding channel of 'roc'
   //     - pad by pad -
   //
+  if (!roc) return;
   for (UInt_t  idata = 0; idata< fNChannels; idata++){
     fData[idata]*=roc->fData[idata];
   }
@@ -348,6 +351,7 @@ void AliTPCCalROC::Divide(const AliTPCCalROC*  roc) {
   // divide each channel of the ROC by the coresponding channel of 'roc'
   //     - pad by pad -
   //
+  if (!roc) return;
   Float_t kEpsilon=0.00000000000000001;
   for (UInt_t  idata = 0; idata< fNChannels; idata++){
     if (TMath::Abs(roc->fData[idata])>kEpsilon)
@@ -355,6 +359,14 @@ void AliTPCCalROC::Divide(const AliTPCCalROC*  roc) {
   }
 }
 
+void AliTPCCalROC::Reset()
+{
+  //
+  // reset to ZERO
+  //
+  memset(fData,0,sizeof(Float_t)*fNChannels); // set all values to 0
+}
+
 Double_t AliTPCCalROC::GetMean(AliTPCCalROC *const outlierROC) const {
    //
    //  returns the mean value of the ROC
index 477d07bad9499226ed24df96fe5df4cc6d564a9d..361b291b8ad339aaf85d9f7390af18e502f5b2ad 100644 (file)
@@ -36,8 +36,9 @@ class AliTPCCalROC : public TNamed {
   UInt_t        GetNPads(UInt_t row)  const     { return (row<fNRows)? AliTPCROC::Instance()->GetNPads(fSector,row):0;};
   Float_t      GetValue(UInt_t row, UInt_t pad) const { return ( (row<fNRows) && (fkIndexes[row]+pad)<fNChannels)? fData[fkIndexes[row]+pad]: 0; };
   Float_t      GetValue(UInt_t channel) const { return  fData[channel]; };
-  void         SetValue(UInt_t row, UInt_t pad, Float_t vd) { if ( row<fNRows && (fkIndexes[row]+pad)<fNChannels)fData[fkIndexes[row]+pad]= vd; };
-  void         SetValue(UInt_t channel, Float_t vd) {fData[channel]= vd; };
+  void         SetValue(UInt_t row, UInt_t pad, Float_t vd) { if ( row<fNRows && (fkIndexes[row]+pad)<fNChannels)fData[fkIndexes[row]+pad]= vd; }
+  void         SetValue(UInt_t channel, Float_t vd) {fData[channel]= vd; }
+  void         Reset();
   virtual void Draw(Option_t* option = "");
   //
   Bool_t MedianFilter(Int_t deltaRow, Int_t deltaPad, AliTPCCalROC*outlierROC=0, Bool_t doEdge=kTRUE);
index bc05c2b4ce13b34730a195e9c5b7463bb17eac97..fbcc9f795c3f0e08e5b162f43546ded87ec2cfc1 100644 (file)
 #include <TError.h>
 #include <TMap.h>
 #include <TProfile.h>
+#include <TObjArray.h>
 //AliRoot includes
 #include "AliRawReader.h"
 #include "AliRawReaderRoot.h"
@@ -128,8 +129,10 @@ ClassImp(AliTPCdataQA)
 AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/  
   fFirstTimeBin(60),
   fLastTimeBin(1000),
-  fAdcMin(1),
-  fAdcMax(100),
+  fAdcMin(3),
+  fAdcMax(1000),
+  fMinQMax(5.f),
+  fRequireNeighbouringPad(kTRUE),
   fMapping(NULL),
   fPedestal(0),
   fNoise(0),
@@ -155,6 +158,7 @@ AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/
   fEventsPerBin(1000),          // Events per bin for event histograms
   fSignalCounter(0),            // Signal counter
   fClusterCounter(0),           // Cluster counter
+  fActiveChambers(72),
   fAllBins(0),
   fAllSigBins(0),
   fAllNSigBins(0),
@@ -174,6 +178,8 @@ AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/
   //
   // default constructor
   //
+
+  for (Int_t i=0; i<72; ++i) {fActiveChambers.SetBitNumber(i,kTRUE);}
 }
 
 //_____________________________________________________________________
@@ -183,6 +189,8 @@ AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/
   fLastTimeBin(ped.GetLastTimeBin()),
   fAdcMin(ped.GetAdcMin()),
   fAdcMax(ped.GetAdcMax()),
+  fMinQMax(ped.GetMinQMax()),
+  fRequireNeighbouringPad(ped.GetRequireNeighbouringPad()),
   fMapping(NULL),
   fPedestal(0),
   fNoise(0),
@@ -208,6 +216,7 @@ AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/
   fEventsPerBin(ped.GetEventsPerBin()),
   fSignalCounter(ped.GetSignalCounter()),
   fClusterCounter(ped.GetClusterCounter()),
+  fActiveChambers(ped.fActiveChambers),
   fAllBins(0),
   fAllSigBins(0),
   fAllNSigBins(0),
@@ -278,8 +287,10 @@ AliTPCdataQA::AliTPCdataQA(const TMap *config) : /*FOLD00*/
   TH1F("TPCRAW","TPCRAW",100,0,100),
   fFirstTimeBin(60),
   fLastTimeBin(1000),
-  fAdcMin(1),
-  fAdcMax(100),
+  fAdcMin(3),
+  fAdcMax(1000),
+  fMinQMax(5.f),
+  fRequireNeighbouringPad(kTRUE),
   fMapping(NULL),
   fPedestal(0),
   fNoise(0),
@@ -305,6 +316,7 @@ AliTPCdataQA::AliTPCdataQA(const TMap *config) : /*FOLD00*/
   fEventsPerBin(1000),
   fSignalCounter(0),
   fClusterCounter(0),
+  fActiveChambers(72),
   fAllBins(0),
   fAllSigBins(0),
   fAllNSigBins(0),
@@ -328,8 +340,11 @@ AliTPCdataQA::AliTPCdataQA(const TMap *config) : /*FOLD00*/
   if (config->GetValue("LastTimeBin"))  fLastTimeBin = ((TObjString*)config->GetValue("LastTimeBin"))->GetString().Atoi();
   if (config->GetValue("AdcMin"))       fAdcMin = ((TObjString*)config->GetValue("AdcMin"))->GetString().Atoi();
   if (config->GetValue("AdcMax"))       fAdcMax = ((TObjString*)config->GetValue("AdcMax"))->GetString().Atoi();
+  if (config->GetValue("MinQMax"))      fMinQMax = ((TObjString*)config->GetValue("MinQMax"))->GetString().Atof();
   if (config->GetValue("MaxEvents"))    fMaxEvents = ((TObjString*)config->GetValue("MaxEvents"))->GetString().Atoi();
   if (config->GetValue("EventsPerBin")) fEventsPerBin = ((TObjString*)config->GetValue("EventsPerBin"))->GetString().Atoi();
+  if (config->GetValue("RequireNeighbouringPad")) fRequireNeighbouringPad = ((TObjString*)config->GetValue("RequireNeighbouringPad"))->GetString().Atoi();
+  for (Int_t i=0; i<72; ++i) {fActiveChambers.SetBitNumber(i,kTRUE);}
 }
 
 //_____________________________________________________________________
@@ -504,6 +519,8 @@ Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStreamV3 *const rawStreamV3)
   Bool_t withInput = kFALSE;
   Int_t nSignals = 0;
   Int_t lastSector = -1;
+
+  Init();
   
   while ( rawStreamV3->NextDDL() ){
 
@@ -543,6 +560,8 @@ Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStreamV3 *const rawStreamV3)
     
   if (lastSector>=0&&nSignals>0)  
     FindLocalMaxima(lastSector);
+
+  CleanArrays();
   
   return withInput;
 }
@@ -620,118 +639,7 @@ Int_t AliTPCdataQA::Update(const Int_t iSector, /*FOLD00*/
   // Signal filling method
   //
   
-  //
-  // Define the calibration objects the first time Update is called
-  // NB! This has to be done first even if the data is rejected by the time 
-  // cut to make sure that the objects are available in Analyse
-  //
-  if(!fIsDQM) {
-
-    if (!fNLocalMaxima) fNLocalMaxima = new AliTPCCalPad("NLocalMaxima","NLocalMaxima");
-    if (!fMaxCharge) fMaxCharge = new AliTPCCalPad("MaxCharge","MaxCharge");
-    if (!fMeanCharge) fMeanCharge = new AliTPCCalPad("MeanCharge","MeanCharge");
-    if (!fNoThreshold) fNoThreshold = new AliTPCCalPad("NoThreshold","NoThreshold");
-    if (!fNTimeBins) fNTimeBins = new AliTPCCalPad("NTimeBins","NTimeBins");
-    if (!fNPads) fNPads = new AliTPCCalPad("NPads","NPads");
-    if (!fTimePosition) fTimePosition = new AliTPCCalPad("TimePosition","TimePosition");
-    if (!fOverThreshold10) fOverThreshold10 = new AliTPCCalPad("OverThreshold10","OverThreshold10");
-    if (!fOverThreshold20) fOverThreshold20 = new AliTPCCalPad("OverThreshold20","OverThreshold20");
-    if (!fOverThreshold30) fOverThreshold30 = new AliTPCCalPad("OverThreshold30","OverThreshold30");
-    if (!fHistQVsTimeSideA) {
-      fHistQVsTimeSideA  = new TProfile("hQVsTimeSideA", "Q vs time (side A); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
-      fHistQVsTimeSideA->SetDirectory(0);
-    }
-    if (!fHistQVsTimeSideC) {
-      fHistQVsTimeSideC  = new TProfile("hQVsTimeSideC", "Q vs time (side C); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
-      fHistQVsTimeSideC->SetDirectory(0);
-  }
-    if (!fHistQMaxVsTimeSideA) {
-      fHistQMaxVsTimeSideA  = new TProfile("hQMaxVsTimeSideA", "Q_{MAX} vs time (side A); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
-      fHistQMaxVsTimeSideA->SetDirectory(0);
-    }
-    if (!fHistQMaxVsTimeSideC) {
-      fHistQMaxVsTimeSideC  = new TProfile("hQMaxVsTimeSideC", "Q_{MAX} vs time (side C); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
-      fHistQMaxVsTimeSideC->SetDirectory(0);
-    }
-  } else { // DQM histograms and array
-    
-    if (!fHistOccVsSector) {
-      fHistOccVsSector  = new TProfile("hOccVsSector", "Occupancy vs sector; Sector; Occupancy", 72, 0, 72);
-      fHistOccVsSector->SetDirectory(0);
-
-      fHistOcc2dVsSector  = new TProfile2D("hOcc2dVsSector", "Occupancy vs sector and patch; Sector; Patch", 72, 0, 36, 6, 0, 6);
-      fHistOcc2dVsSector->SetDirectory(0);
-
-      fHistQVsSector  = new TProfile("hQVsSector", "Q vs sector; Sector; Q [ADC ch]", 72, 0, 72);
-      fHistQVsSector->SetDirectory(0);
-
-      fHistQmaxVsSector  = new TProfile("hQmaxVsSector", "Qmax vs sector; Sector; Qmax [ADC ch]", 72, 0, 72);
-      fHistQmaxVsSector->SetDirectory(0);
-
-      fOccVec = new TArrayD(72);
-      for(Int_t i = 0; i < 72; i++)
-       fOccVec->GetArray()[i] = 0;
-
-      fOccMaxVec = new TArrayD(72);
-      const Double_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
-      for(Int_t i = 0; i < 72; i++)
-       
-       if(i<36) // IROCs (5504 pads)
-         fOccMaxVec->GetArray()[i] = nTimeBins*5504;
-       else     // OROCs (9984 pads)
-         fOccMaxVec->GetArray()[i] = nTimeBins*9984;
-
-      // 12 branches for each full sector
-      const Int_t nBranches = 36*12;
-      fOccVecFine = new TArrayD(nBranches);
-      for(Int_t i = 0; i < nBranches; i++)
-       fOccVecFine->GetArray()[i] = 0;
-
-      // Pads per patch same for all sectors
-      Int_t nPads0[6] = {1152, 1536, 1152, 1280, 1280, 1280};
-      Int_t nPads1[6] = {1152, 1664, 1152, 1280, 1280, 1280};
-
-      fOccMaxVecFine = new TArrayD(nBranches);
-      for(Int_t i = 0; i < nBranches; i++) {
-       
-       const Int_t fullSector = Int_t(i/12);
-       Int_t branch = i - fullSector*12;
-       R__ASSERT(branch>=0 && branch<12);
-       
-       const Int_t patch = Int_t(branch/2);
-       branch -= patch*2;
-       
-       R__ASSERT(branch>=0 && branch<2);
-       if(branch == 0)
-         fOccMaxVecFine->GetArray()[i] = nTimeBins*nPads0[patch];
-       else     // OROCs (9984 pads)
-         fOccMaxVecFine->GetArray()[i] = nTimeBins*nPads1[patch];
-      }
-    }
-  }
-  // Make the arrays for expanding the data
-
-  if (!fAllBins)
-    MakeArrays();
-
-  //
-  // If Analyse has been previously called we need now to denormalize the data
-  // as more data is coming
-  //
-  if(fIsAnalysed == kTRUE && !fIsDQM) {
-    
-    const Int_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
-    const Float_t denormalization = Float_t(fEventCounter * nTimeBins);
-    fNoThreshold->Multiply(denormalization);  
-    
-    fMeanCharge->Multiply(fNLocalMaxima);
-    fMaxCharge->Multiply(fNLocalMaxima);
-    fNTimeBins->Multiply(fNLocalMaxima);
-    fNPads->Multiply(fNLocalMaxima);
-    fTimePosition->Multiply(fNLocalMaxima);
-    fIsAnalysed = kFALSE;
-  }
-
+  if (!fActiveChambers[iSector]) return 0;
   //
   // TimeBin cut
   //
@@ -761,7 +669,7 @@ Int_t AliTPCdataQA::Update(const Int_t iSector, /*FOLD00*/
   }
 
   // Require at least 3 ADC channels
-  if (signal < 3.0)
+  if (signal < fAdcMin)
     return 0;
 
   // if noise calibrations are loaded require at least 3*sigmaNoise
@@ -794,6 +702,8 @@ void AliTPCdataQA::FindLocalMaxima(const Int_t iSector)
   // calibration objects with the information
   //
 
+  if (!fActiveChambers[iSector]) return;
+  
   Int_t nLocalMaxima = 0;
   const Int_t maxTimeBin = fTimeBinsMax+4; // Used to step between neighboring pads 
                                            // Because we have tha pad-time data in a 
@@ -817,11 +727,11 @@ void AliTPCdataQA::FindLocalMaxima(const Int_t iSector)
       Float_t qMax = b[0];
 
       // First check that the charge is bigger than the threshold
-      if (qMax<5
+      if (qMax<fMinQMax
        continue;
       
       // Require at least one neighboring pad with signal
-      if (b[-maxTimeBin]+b[maxTimeBin]<=0) continue;
+      if (fRequireNeighbouringPad && (b[-maxTimeBin]+b[maxTimeBin]<=0) ) continue;
 
       // Require at least one neighboring time bin with signal
       if (b[-1]+b[1]<=0) continue;
@@ -844,7 +754,7 @@ void AliTPCdataQA::FindLocalMaxima(const Int_t iSector)
       //
       // Now we accept the local maximum and fill the calibration/data objects
       //
-      nLocalMaxima++;
+      ++nLocalMaxima;
 
       Int_t iPad, iTimeBin;
       GetPadAndTimeBin(bin, iPad, iTimeBin);
@@ -1215,3 +1125,163 @@ void AliTPCdataQA::ResetProfiles()
     for(Int_t i = 0; i < 36*12; i++)
       fOccVecFine->GetArray()[i] = 0.0;
 }
+
+//____________________________________________________________________________________________
+void AliTPCdataQA::Init()
+{
+  //
+  // Define the calibration objects the first time Update is called
+  // NB! This has to be done first even if the data is rejected by the time
+  // cut to make sure that the objects are available in Analyse
+  //
+  if(!fIsDQM) {
+    
+    if (!fNLocalMaxima){
+      TObjArray configArr(72);
+      fNLocalMaxima = new AliTPCCalPad(ConfigArrRocs(&configArr,"NLocalMaxima"));
+      fMaxCharge = new AliTPCCalPad(ConfigArrRocs(&configArr,"MaxCharge"));
+      fMeanCharge = new AliTPCCalPad(ConfigArrRocs(&configArr,"MeanCharge"));
+      fNoThreshold = new AliTPCCalPad(ConfigArrRocs(&configArr,"NoThreshold"));
+      fNTimeBins = new AliTPCCalPad(ConfigArrRocs(&configArr,"NTimeBins"));
+      fNPads = new AliTPCCalPad(ConfigArrRocs(&configArr,"NPads"));
+      fTimePosition = new AliTPCCalPad(ConfigArrRocs(&configArr,"TimePosition"));
+      fOverThreshold10 = new AliTPCCalPad(ConfigArrRocs(&configArr,"OverThreshold10"));
+      fOverThreshold20 = new AliTPCCalPad(ConfigArrRocs(&configArr,"OverThreshold20"));
+      fOverThreshold30 = new AliTPCCalPad(ConfigArrRocs(&configArr,"OverThreshold30"));
+
+      fHistQVsTimeSideA  = new TProfile("hQVsTimeSideA", "Q vs time (side A); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
+      fHistQVsTimeSideA->SetDirectory(0);
+      fHistQVsTimeSideC  = new TProfile("hQVsTimeSideC", "Q vs time (side C); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
+      fHistQVsTimeSideC->SetDirectory(0);
+      fHistQMaxVsTimeSideA  = new TProfile("hQMaxVsTimeSideA", "Q_{MAX} vs time (side A); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
+      fHistQMaxVsTimeSideA->SetDirectory(0);
+      fHistQMaxVsTimeSideC  = new TProfile("hQMaxVsTimeSideC", "Q_{MAX} vs time (side C); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
+      fHistQMaxVsTimeSideC->SetDirectory(0);
+    }
+  } else { // DQM histograms and array
+
+    if (!fHistOccVsSector) {
+      fHistOccVsSector  = new TProfile("hOccVsSector", "Occupancy vs sector; Sector; Occupancy", 72, 0, 72);
+      fHistOccVsSector->SetDirectory(0);
+
+      fHistOcc2dVsSector  = new TProfile2D("hOcc2dVsSector", "Occupancy vs sector and patch; Sector; Patch", 72, 0, 36, 6, 0, 6);
+      fHistOcc2dVsSector->SetDirectory(0);
+
+      fHistQVsSector  = new TProfile("hQVsSector", "Q vs sector; Sector; Q [ADC ch]", 72, 0, 72);
+      fHistQVsSector->SetDirectory(0);
+
+      fHistQmaxVsSector  = new TProfile("hQmaxVsSector", "Qmax vs sector; Sector; Qmax [ADC ch]", 72, 0, 72);
+      fHistQmaxVsSector->SetDirectory(0);
+
+      fOccVec = new TArrayD(72);
+      for(Int_t i = 0; i < 72; i++)
+        fOccVec->GetArray()[i] = 0;
+
+      fOccMaxVec = new TArrayD(72);
+      const Double_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
+      for(Int_t i = 0; i < 72; i++)
+
+        if(i<36) // IROCs (5504 pads)
+          fOccMaxVec->GetArray()[i] = nTimeBins*5504;
+        else     // OROCs (9984 pads)
+          fOccMaxVec->GetArray()[i] = nTimeBins*9984;
+
+      // 12 branches for each full sector
+        const Int_t nBranches = 36*12;
+        fOccVecFine = new TArrayD(nBranches);
+        for(Int_t i = 0; i < nBranches; i++)
+          fOccVecFine->GetArray()[i] = 0;
+
+      // Pads per patch same for all sectors
+        Int_t nPads0[6] = {1152, 1536, 1152, 1280, 1280, 1280};
+        Int_t nPads1[6] = {1152, 1664, 1152, 1280, 1280, 1280};
+
+        fOccMaxVecFine = new TArrayD(nBranches);
+        for(Int_t i = 0; i < nBranches; i++) {
+
+          const Int_t fullSector = Int_t(i/12);
+          Int_t branch = i - fullSector*12;
+          R__ASSERT(branch>=0 && branch<12);
+
+          const Int_t patch = Int_t(branch/2);
+          branch -= patch*2;
+
+          R__ASSERT(branch>=0 && branch<2);
+          if(branch == 0)
+            fOccMaxVecFine->GetArray()[i] = nTimeBins*nPads0[patch];
+          else     // OROCs (9984 pads)
+      fOccMaxVecFine->GetArray()[i] = nTimeBins*nPads1[patch];
+        }
+    }
+  }
+  // Make the arrays for expanding the data
+  
+  if (!fAllBins)
+    MakeArrays();
+  
+  //
+  // If Analyse has been previously called we need now to denormalize the data
+  // as more data is coming
+  //
+  if(fIsAnalysed == kTRUE && !fIsDQM) {
+
+    const Int_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
+    const Float_t denormalization = Float_t(fEventCounter * nTimeBins);
+    fNoThreshold->Multiply(denormalization);
+
+    fMeanCharge->Multiply(fNLocalMaxima);
+    fMaxCharge->Multiply(fNLocalMaxima);
+    fNTimeBins->Multiply(fNLocalMaxima);
+    fNPads->Multiply(fNLocalMaxima);
+    fTimePosition->Multiply(fNLocalMaxima);
+    fIsAnalysed = kFALSE;
+  }
+}
+
+//____________________________________________________________________________________________
+void AliTPCdataQA::ResetData()
+{
+  //
+  // reset all data
+  //
+  if(!fIsDQM) {
+    
+    if (fNLocalMaxima){
+      fNoThreshold->Reset();
+      fNLocalMaxima->Reset();
+      fMeanCharge->Reset();
+      fMaxCharge->Reset();
+      fNTimeBins->Reset();
+      fNPads->Reset();
+      fTimePosition->Reset();
+      fOverThreshold10->Reset();
+      fOverThreshold20->Reset();
+      fOverThreshold30->Reset();
+      
+      fHistQVsTimeSideA->Reset();
+      fHistQVsTimeSideC->Reset();
+      fHistQMaxVsTimeSideA->Reset();
+      fHistQMaxVsTimeSideC->Reset();
+
+      fIsAnalysed = kFALSE;
+      
+    }
+  }
+  
+  fEventCounter=0;
+  fClusterCounter=0;
+}
+
+TObjArray *AliTPCdataQA::ConfigArrRocs(TObjArray *arr, const Text_t* name)
+{
+  //
+  // GetArray with confiured ROCs
+  //
+
+  arr->Clear();
+  arr->SetName(name);
+  for (Int_t i=0; i<72; ++i){
+    if (fActiveChambers[i]) arr->AddAt(new AliTPCCalROC(i),i);
+  }
+  return arr;
+}
\ No newline at end of file
index 855ff6d4c6ca448f26e8b29900126ff0a4393af7..2dae644c7434a38811579febde563af32fe40ed9 100644 (file)
@@ -3,8 +3,7 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-
-
+#include <TBits.h>
 #include <TH1F.h>
 #include <TProfile.h>
 #include <TProfile2D.h>
@@ -20,7 +19,8 @@ class AliTPCRawStreamV3;
 class AliRawReader;
 class AliTPCAltroMapping;
 class AliTPCCalPad;
-class TMap; 
+class TMap;
+class TObjArray;
 struct eventHeaderStruct;
 
 class AliTPCdataQA : public TH1F {
@@ -46,6 +46,9 @@ public:
   void SetPedestal(AliTPCCalPad *const pedestalCal){ fPedestal = pedestalCal;}
   void SetNoise(AliTPCCalPad *const noiseCal){ fNoise = noiseCal;}
 
+  void SetMinQMax               (Float_t minQmax  ) { fMinQMax                = minQmax; }
+  void SetRequireNeighbouringPad(Bool_t  req=kTRUE) { fRequireNeighbouringPad = req;     }
+  
   // DQM methods
   void FillOccupancyProfile();
   void ResetProfiles();
@@ -92,6 +95,9 @@ public:
   Int_t  GetSignalCounter()  const { return fSignalCounter; }
   Int_t  GetClusterCounter() const { return fClusterCounter;}
 
+  Float_t GetMinQMax()                const { return fMinQMax;                }
+  Bool_t  GetRequireNeighbouringPad() const { return fRequireNeighbouringPad; }
+  
   // DQM getter
   Bool_t    GetIsDQM() const { return fIsDQM; }
 
@@ -103,6 +109,10 @@ public:
   // DQM setter
   void  SetIsDQM(Bool_t value) { fIsDQM = value; }
 
+  void ResetData();
+
+  void SetChamberStatus(UInt_t roc, Bool_t status) { fActiveChambers.SetBitNumber(roc,status); }
+  Bool_t GetChamberStatus(UInt_t roc) {return fActiveChambers.TestBitNumber(roc);}
 private:
   Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad,
               const Int_t iTimeBin, Float_t signal,
@@ -119,10 +129,17 @@ private:
               Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax) const;
   void UpdateEventHistograms();
 
+  void Init();
+
+  TObjArray *ConfigArrRocs(TObjArray *arr, const Text_t* name);
+
   Int_t fFirstTimeBin;              //  First Time bin needed for analysis
   Int_t fLastTimeBin;               //  Last Time bin needed for analysis
   Int_t fAdcMin;                    //  min adc channel of pedestal value
   Int_t fAdcMax;                    //  max adc channel of pedestal value
+  Float_t fMinQMax;                 //  Minimun charge for Maximum ADC in cluster
+  Bool_t fRequireNeighbouringPad;   //  If clusterer should require a neighbouring pad to accept it
+  
 
   AliTPCAltroMapping **fMapping;    //! Altro Mapping object
   //
@@ -155,6 +172,9 @@ private:
   Int_t fEventsPerBin;              // Events per bin for event histograms
   Int_t fSignalCounter;             // Signal counter
   Int_t fClusterCounter;            // Cluster counter
+
+  TBits fActiveChambers;           // configured ROCs
+
   //
   //  Expand buffer
   //
@@ -177,7 +197,7 @@ private:
   TArrayD* fOccMaxVecFine;         //!  "2D" occupancy help normlization for DQM
   
 
-  ClassDef(AliTPCdataQA, 5)  // Implementation of the TPC Raw QA
+  ClassDef(AliTPCdataQA, 6)  // Implementation of the TPC Raw QA
 };