]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding possibility to use outlier map
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Feb 2008 17:14:39 +0000 (17:14 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Feb 2008 17:14:39 +0000 (17:14 +0000)
+
Checkeing estimated noise values

(Jens Viechula)

TPC/AliTPCCalibCE.cxx
TPC/AliTPCCalibPulser.cxx
TPC/AliTPCCalibPulser.h

index d0b12023d49f168070eac02f8ced979037ea70ca..f09af2b2f947ffc714434c6484e71a448b7cae8a 100644 (file)
@@ -543,7 +543,7 @@ AliTPCCalibCE::~AliTPCCalibCE()
 
     if ( fDebugStreamer) delete fDebugStreamer;
 //    if ( fHTime0 ) delete fHTime0;
-    delete fROC;
+//    delete fROC;
     delete fParam;
 }
 //_____________________________________________________________________
@@ -755,7 +755,7 @@ void AliTPCCalibCE::FindLocalMaxima(TVectorF &maxima)
     //
     // Find local maxima on the pad signal and Histogram them
     //
-    Float_t ceThreshold = 5.*fPadNoise;  // threshold for the signal
+  Float_t ceThreshold = 5.*TMath::Max(fPadNoise,Float_t(1.));  // threshold for the signal
     Int_t   count       = 0;
     Int_t   tminus      = 2;
     Int_t   tplus       = 3;
@@ -782,8 +782,6 @@ void AliTPCCalibCE::ProcessPad()
     FindLocalMaxima(maxima);
     if ( (fNevents == 0) || (fOldRunNumber!=fRunNumber) ) return;  // return because we don't have Time0 info for the CE yet
 
-
-
     TVectorD param(3);
     Float_t  qSum;
     FindCESignal(param, qSum, maxima);
@@ -1522,8 +1520,8 @@ void AliTPCCalibCE::Merge(AliTPCCalibCE *ce)
             arrPol2->Expand(fNevents+nCEevents);
        }
        if ( vMeanTimeCE && vMeanQCE ){
-           vMeanTime = GetTMeanEvents(iSec);
-           vMeanQCE  = GetQMeanEvents(iSec);
+           vMeanTime = GetTMeanEvents(iSec,kTRUE);
+           vMeanQ    = GetQMeanEvents(iSec,kTRUE);
            vMeanTime->ResizeTo(fNevents+nCEevents);
            vMeanQ->ResizeTo(fNevents+nCEevents);
        }
index 422613cea215fdb9b1e8f0eaa693b286a5dd88e2..3bf0fdd4b3addca4d5955112624b24a7d5319b59 100644 (file)
 #include "AliTPCCalibPulser.h"
 #include "AliTPCcalibDB.h"
 #include "AliMathBase.h"
+#include "AliLog.h"
 #include "TTreeStream.h"
 
 //date
@@ -218,6 +219,7 @@ AliTPCCalibPulser::AliTPCCalibPulser() :
     fParam(new AliTPCParam),
     fPedestalTPC(0x0),
     fPadNoiseTPC(0x0),
+    fOutliers(0x0),
     fPedestalROC(0x0),
     fPadNoiseROC(0x0),
     fCalRocArrayT0(72),
@@ -270,6 +272,7 @@ AliTPCCalibPulser::AliTPCCalibPulser(const AliTPCCalibPulser &sig) :
     fParam(new AliTPCParam),
     fPedestalTPC(0x0),
     fPadNoiseTPC(0x0),
+    fOutliers(0x0),
     fPedestalROC(0x0),
     fPadNoiseROC(0x0),
     fCalRocArrayT0(72),
@@ -352,6 +355,17 @@ AliTPCCalibPulser::~AliTPCCalibPulser()
     // destructor
     //
 
+    Reset();
+
+    if ( fDebugStreamer) delete fDebugStreamer;
+    delete fROC;
+    delete fParam;
+}
+void AliTPCCalibPulser::Reset()
+{
+    //
+    // Delete all information: Arrays, Histograms, CalRoc objects
+    //
     fCalRocArrayT0.Delete();
     fCalRocArrayQ.Delete();
     fCalRocArrayRMS.Delete();
@@ -365,10 +379,6 @@ AliTPCCalibPulser::~AliTPCCalibPulser()
     fPadQArrayEvent.Delete();
     fPadRMSArrayEvent.Delete();
     fPadPedestalArrayEvent.Delete();
-
-    if ( fDebugStreamer) delete fDebugStreamer;
-    delete fROC;
-    delete fParam;
 }
 //_____________________________________________________________________
 Int_t AliTPCCalibPulser::Update(const Int_t icsector,
@@ -384,6 +394,11 @@ Int_t AliTPCCalibPulser::Update(const Int_t icsector,
     //
     if ( (icTimeBin>fLastTimeBin) || (icTimeBin<fFirstTimeBin)   ) return 0;
 
+    if ( icRow<0 || icPad<0 ){
+       AliWarning("Wrong Pad or Row number, skipping!");
+       return 0;
+    }
+
     Int_t iChannel  = fROC->GetRowIndexes(icsector)[icRow]+icPad; //  global pad position in sector
 
     //init first pad and sector in this event
@@ -467,6 +482,7 @@ void AliTPCCalibPulser::FindPedestal(Float_t part)
        }
        // truncated mean
        //
+        // what if by chance histo[median] == 0 ?!?
        Float_t count=histo[median] ,mean=histo[median]*median,  rms=histo[median]*median*median ;
        //
        for (Int_t idelta=1; idelta<10; ++idelta){
@@ -502,12 +518,18 @@ void AliTPCCalibPulser::FindPulserSignal(TVectorD &param, Float_t &qSum)
 
     Float_t ceQmax  =0, ceQsum=0, ceTime=0, ceRMS=0;
     Int_t   cemaxpos       = fMaxTimeBin;
-    Float_t ceSumThreshold = 8.*fPadNoise;  // threshold for the signal sum
+    Float_t ceSumThreshold = 10.*TMath::Max(fPadNoise,Float_t(1.));  // threshold for the signal sum
+    Float_t ceMaxThreshold = 5.*TMath::Max(fPadNoise,Float_t(1.));  // threshold for the signal max
     const Int_t    kCemin  = 2;             // range for the analysis of the ce signal +- channels from the peak
     const Int_t    kCemax  = 7;
+    param[0] = ceQmax;
+    param[1] = ceTime;
+    param[2] = ceRMS;
+    qSum     = ceQsum;
 
-    if (cemaxpos!=0){
-        ceQmax = fPadSignal.GetMatrixArray()[cemaxpos]-fPadPedestal;
+    if (cemaxpos>0){
+       ceQmax = fPadSignal.GetMatrixArray()[cemaxpos]-fPadPedestal;
+        if ( ceQmax<ceMaxThreshold ) return;
        for (Int_t i=cemaxpos-kCemin; i<cemaxpos+kCemax; ++i){
             Float_t signal = fPadSignal.GetMatrixArray()[i]-fPadPedestal;
            if ( (i>fFirstTimeBin) && (i<fLastTimeBin) && (signal>0) ){
@@ -517,11 +539,19 @@ void AliTPCCalibPulser::FindPulserSignal(TVectorD &param, Float_t &qSum)
            }
        }
     }
-    if (ceQmax&&ceQsum>ceSumThreshold) {
+    if (ceQsum>ceSumThreshold) {
        ceTime/=ceQsum;
        ceRMS  = TMath::Sqrt(TMath::Abs(ceRMS/ceQsum-ceTime*ceTime));
-       fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime;   // mean time for each sector
-       fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++;
+        //only fill the Time0Offset if pad was not marked as an outlier!
+       if ( !fOutliers ){
+           fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime;   // mean time for each sector
+           fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++;
+       } else {
+           if ( !(fOutliers->GetCalROC(fCurrentSector)->GetValue(fCurrentChannel)) ){
+               fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime;   // mean time for each sector
+               fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++;
+           }
+       }
 
        //Normalise Q to the pad area
        Float_t norm = fParam->GetPadPitchWidth(fCurrentSector)*fParam->GetPadPitchLength(fCurrentSector,fCurrentRow);
@@ -553,6 +583,7 @@ void AliTPCCalibPulser::ProcessPad()
     Double_t meanT  = param[1];
     Double_t sigmaT = param[2];
 
+
     //Fill Event T0 counter
     (*GetPadTimesEvent(fCurrentSector,kTRUE)).GetMatrixArray()[fCurrentChannel] = meanT;
 
@@ -591,6 +622,7 @@ void AliTPCCalibPulser::EndEvent()
            Float_t time  = (*vTimes).GetMatrixArray()[iChannel];
 
             GetHistoT0(iSec,kTRUE)->Fill( time-time0,iChannel );
+            //GetHistoT0(iSec,kTRUE)->Fill( time,iChannel );
 
 
            //Debug start
index cc3aeef002a93e8b47dbc3f509db4e71e8a0a671..ea6a2068a67d04e0049edf72ebff2a3e991e0aef 100644 (file)
@@ -29,6 +29,8 @@ public:
     AliTPCCalibPulser(const AliTPCCalibPulser &sig);
     virtual ~AliTPCCalibPulser();
 
+    void Reset();
+
     AliTPCCalibPulser& operator = (const  AliTPCCalibPulser &source);
 
     Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
@@ -70,6 +72,7 @@ public:
     void  SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
 
     void  SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
+    void  SetOutliers(AliTPCCalPad *outliers)  {fOutliers = outliers;}
 
     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
     Int_t GetLastTimeBin()    const { return fLastTimeBin;   }
@@ -105,6 +108,7 @@ private:
 
     AliTPCCalPad *fPedestalTPC;       //! Pedestal Information
     AliTPCCalPad *fPadNoiseTPC;       //! Pad noise Information whole TPC
+    AliTPCCalPad *fOutliers;          //! Outlier information. Those will not be used for calculating the T0
     AliTPCCalROC *fPedestalROC;       //! Pedestal Information for current ROC
     AliTPCCalROC *fPadNoiseROC;       //! Pad noise Information for current ROC
 //    Bool_t fBpedestal;                //! are we running with pedestal substraction