a/ AliTRDCalibraFillHisto.cxx and .h: can set the range of the gain histo
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Dec 2012 15:56:52 +0000 (15:56 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Dec 2012 15:56:52 +0000 (15:56 +0000)
b/ AliTRDCalibraVdriftLinearFit.cxx .h:
   can set the range and number of bins of the histos
   can add all histos together
   can see the fit (function public)

c/ AliTRDCalibTask.cxx .h: can set the range and number of bins of the histos

d/ AliTRDCalibraFit.cxx:
   No requirement of the three time but only two if we do not see the end of the signal

e/ AliTRDPreprocessorOffline.cxx .h:
   Can set the time constant shift due to the cut of the end of the signal before

TRD/AliTRDCalibTask.cxx
TRD/AliTRDCalibTask.h
TRD/AliTRDCalibraFillHisto.cxx
TRD/AliTRDCalibraFillHisto.h
TRD/AliTRDCalibraFit.cxx
TRD/AliTRDCalibraVdriftLinearFit.cxx
TRD/AliTRDCalibraVdriftLinearFit.h
TRD/AliTRDPreprocessorOffline.cxx
TRD/AliTRDPreprocessorOffline.h

index 185a18b..c1e947c 100644 (file)
@@ -88,88 +88,93 @@ using namespace std;
 ClassImp(AliTRDCalibTask)
 
 //________________________________________________________________________
-  AliTRDCalibTask::AliTRDCalibTask(const char *name) 
-    : AliAnalysisTaskSE(name), fESD(0),
-      fkEsdTrack(0),
-      fFriendTrack(0),
-      fCalibObject(0),
-      fTrdTrack(0),
-      fCl(0),
-      fListHist(0),
-      fTRDCalibraFillHisto(0),
-      fTRDChamberStatus(0),
-      fNEvents(0),
-      fNEventsInput(0),
-      fNbTRDTrack(0),
-      fNbTRDTrackOffline(0),
-      fNbTRDTrackStandalone(0),
-      fNbTPCTRDtrack(0),
-      fNbGoodTracks(0),
-      fNbTimeBin(0),
-      fNbTimeBinOffline(0),
-      fNbTimeBinStandalone(0),
-      fNbClusters(0),
-      fNbClustersOffline(0),
-      fNbClustersStandalone(0),
-      fNbTracklets(0),
-      fNbTrackletsOffline(0),
-      fNbTrackletsStandalone(0),
-      fAbsoluteGain(0),
-      fCH2dSum(0),
-      fPH2dSum(0),
-      fCH2dSM(0),
-      fPH2dSM(0),
-      fCH2dTest(0),
-      fPH2dTest(0),
-      fLinearVdriftTest(0),
-      fOnInstance(kTRUE),
-      fHisto2d(kTRUE),
-      fVector2d(kFALSE),
-      fVdriftLinear(kTRUE),
-      fExbAlt(kFALSE),
-      fDebugLevelTRDCalibraFillHisto(0),
-      fNbTimeBins(0),
-      fNumberBinCharge(50),
-      fSelectTrigger(kTRUE),
-      fSelectedTrigger(new TObjArray()),
-      fRejected(kTRUE),
-      fEsdTrackCuts(0),
-      fRequirePrimaryVertex(kFALSE),
-      fVtxTPC(kFALSE),
-      fVtxSPD(kFALSE),
-      fMinNbContributors(0),
-      fRangePrimaryVertexZ(9999999.0),
-      fMinNbTracks(9),
-      fMaxNbTracks(999999999),
-      fCutWithVdriftCalib(kFALSE),
-      fMinNbTRDtracklets(0),
-      fMinTRDMomentum(0),
-      fScaleGainWithTPCSignal(kFALSE),
-      fLow(0),
-      fHigh(30),
-      fFillZero(kFALSE),
-      fNormalizeNbOfCluster(kFALSE),
-      fRelativeScale(0.0),
-      fMaxCluster(100.0),
-      fNbMaxCluster(2),
-      fOfflineTracks(kFALSE),
-      fStandaloneTracks(kFALSE),
-      fFirstRunGain(-1),
-      fVersionGainUsed(-1),
-      fSubVersionGainUsed(-1),
-      fFirstRunGainLocal(-1),
-      fVersionGainLocalUsed(-1),
-      fSubVersionGainLocalUsed(-1),
-      fFirstRunVdrift(-1),
-      fVersionVdriftUsed(-1), 
-      fSubVersionVdriftUsed(-1),
-      fFirstRunExB(-1),
-      fVersionExBUsed(-1), 
-      fSubVersionExBUsed(-1),
-      fCalDetGain(0x0),
-      fMaxEvent(0),
-      fCounter(0),
-      fPHQon(kTRUE)
+AliTRDCalibTask::AliTRDCalibTask(const char *name) 
+: AliAnalysisTaskSE(name), fESD(0),
+  fkEsdTrack(0),
+  fFriendTrack(0),
+  fCalibObject(0),
+  fTrdTrack(0),
+  fCl(0),
+  fListHist(0),
+  fTRDCalibraFillHisto(0),
+  fTRDChamberStatus(0),
+  fNEvents(0),
+  fNEventsInput(0),
+  fNbTRDTrack(0),
+  fNbTRDTrackOffline(0),
+  fNbTRDTrackStandalone(0),
+  fNbTPCTRDtrack(0),
+  fNbGoodTracks(0),
+  fNbTimeBin(0),
+  fNbTimeBinOffline(0),
+  fNbTimeBinStandalone(0),
+  fNbClusters(0),
+  fNbClustersOffline(0),
+  fNbClustersStandalone(0),
+  fNbTracklets(0),
+  fNbTrackletsOffline(0),
+  fNbTrackletsStandalone(0),
+  fAbsoluteGain(0),
+  fCH2dSum(0),
+  fPH2dSum(0),
+  fCH2dSM(0),
+  fPH2dSM(0),
+  fCH2dTest(0),
+  fPH2dTest(0),
+  fLinearVdriftTest(0),
+  fOnInstance(kTRUE),
+  fHisto2d(kTRUE),
+  fVector2d(kFALSE),
+  fVdriftLinear(kTRUE),
+  fExbAlt(kFALSE),
+  fDebugLevelTRDCalibraFillHisto(0),
+  fNbTimeBins(0),
+  fNumberBinCharge(100),
+  fRangeCharge(150),
+  fVdBindx(32), 
+  fVdBindy(70), 
+  fVdRangex(0.8),
+  fVdRangey(1.4),
+  fSelectTrigger(kTRUE),
+  fSelectedTrigger(new TObjArray()),
+  fRejected(kTRUE),
+  fEsdTrackCuts(0),
+  fRequirePrimaryVertex(kFALSE),
+  fVtxTPC(kFALSE),
+  fVtxSPD(kFALSE),
+  fMinNbContributors(0),
+  fRangePrimaryVertexZ(9999999.0),
+  fMinNbTracks(9),
+  fMaxNbTracks(999999999),
+  fCutWithVdriftCalib(kFALSE),
+  fMinNbTRDtracklets(0),
+  fMinTRDMomentum(0),
+  fScaleGainWithTPCSignal(kFALSE),
+  fLow(0),
+  fHigh(30),
+  fFillZero(kFALSE),
+  fNormalizeNbOfCluster(kFALSE),
+  fRelativeScale(0.0),
+  fMaxCluster(100.0),
+  fNbMaxCluster(2),
+  fOfflineTracks(kFALSE),
+  fStandaloneTracks(kFALSE),
+  fFirstRunGain(-1),
+  fVersionGainUsed(-1),
+  fSubVersionGainUsed(-1),
+  fFirstRunGainLocal(-1),
+  fVersionGainLocalUsed(-1),
+  fSubVersionGainLocalUsed(-1),
+  fFirstRunVdrift(-1),
+  fVersionVdriftUsed(-1), 
+  fSubVersionVdriftUsed(-1),
+  fFirstRunExB(-1),
+  fVersionExBUsed(-1), 
+  fSubVersionExBUsed(-1),
+  fCalDetGain(0x0),
+  fMaxEvent(0),
+  fCounter(0),
+  fPHQon(kTRUE)
 {
   //
   // Default constructor
@@ -321,7 +326,16 @@ void AliTRDCalibTask::UserCreateOutputObjects()
       fListHist->Add(fTRDCalibraFillHisto->GetPH2d()); 
       fListHist->Add(fTRDCalibraFillHisto->GetPRF2d());
     } 
-    if(fVdriftLinear) fListHist->Add((TObject *)fTRDCalibraFillHisto->GetVdriftLinearFit());
+    if(fVdriftLinear) {
+      AliTRDCalibraVdriftLinearFit *fvdl = fTRDCalibraFillHisto->GetVdriftLinearFit();
+      if(fvdl){
+       fvdl->SetNbBindx(fVdBindx);
+       fvdl->SetNbBindy(fVdBindy); 
+       fvdl->SetRangedx(fVdRangex); 
+       fvdl->SetRangedy(fVdRangey);  
+      }
+      fListHist->Add((TObject *)fTRDCalibraFillHisto->GetVdriftLinearFit());
+    }
     if(fVector2d) fListHist->Add((TObject *) fTRDCalibraFillHisto->GetCalibraVector()); //calibra vector
     if(fExbAlt) fListHist->Add((TObject *)fTRDCalibraFillHisto->GetExbAltFit());
   }
index 0645047..d25097c 100644 (file)
@@ -57,6 +57,11 @@ class AliTRDCalibTask : public AliAnalysisTaskSE {
   void SetExbAlt(Bool_t exbalt)                                     {fExbAlt = exbalt;};
   void SetNbTimeBins(Int_t nbTimeBins)                              {fNbTimeBins=nbTimeBins;};  
   void SetNumberBinCharge(Short_t nbBinCharge)                      {fNumberBinCharge=nbBinCharge;};  
+  void SetRangeCharge(Float_t rangeCharge)                          {fRangeCharge=rangeCharge;};
+  void SetVdBindx(Short_t vdBindx)                                  {fVdBindx=vdBindx;};  
+  void SetVdBindy(Short_t vdBindy)                                  {fVdBindy=vdBindy;};    
+  void SetVdRangedx(Double_t vdRangex)                               {fVdRangex=vdRangex;};  
+  void SetVdRangedy(Double_t vdRangey)                               {fVdRangey=vdRangey;};    
   void SetDebugLevelTRDCalibraFillHisto(Short_t debugLevelTRDCalibraFillHisto) {fDebugLevelTRDCalibraFillHisto = debugLevelTRDCalibraFillHisto;};
 
   
@@ -157,6 +162,11 @@ class AliTRDCalibTask : public AliAnalysisTaskSE {
   Short_t     fDebugLevelTRDCalibraFillHisto;    // Debug Level Fill Histo
   Int_t       fNbTimeBins;                       // number of timebins 
   Short_t     fNumberBinCharge;                  // Number of bins for the gain factor
+  Float_t     fRangeCharge;                      // Range Charge
+  Short_t     fVdBindx;                          // Nb of bin in vd histos x
+  Short_t     fVdBindy;                          // Nb of bin in vd histos y
+  Double_t    fVdRangex;                         // Range vd histos x
+  Double_t    fVdRangey;                         // Range vd histos y
 
   Short_t     fNz[3];                            // Nz mode 
   Short_t     fNrphi[3];                         // Nrphi mode
@@ -211,7 +221,7 @@ class AliTRDCalibTask : public AliAnalysisTaskSE {
   AliTRDCalibTask(const AliTRDCalibTask&); 
   AliTRDCalibTask& operator=(const AliTRDCalibTask&); 
 
-  ClassDef(AliTRDCalibTask, 3); 
+  ClassDef(AliTRDCalibTask, 4); 
 };
 
 #endif
index a783dde..e3ce45a 100644 (file)
@@ -182,6 +182,7 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto()
   ,fNumberTrack(0)
   ,fTimeMax(0)
   ,fSf(10.0)
+  ,fRangeHistoCharge(150)
   ,fNumberBinCharge(50)
   ,fNumberBinPRF(10)
   ,fNgroupprf(3)
@@ -273,6 +274,7 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c)
   ,fNumberTrack(c.fNumberTrack)
   ,fTimeMax(c.fTimeMax)
   ,fSf(c.fSf)
+  ,fRangeHistoCharge(c.fRangeHistoCharge)
   ,fNumberBinCharge(c.fNumberBinCharge)
   ,fNumberBinPRF(c.fNumberBinPRF)
   ,fNgroupprf(c.fNgroupprf)
@@ -2728,7 +2730,7 @@ void AliTRDCalibraFillHisto::CreateCH2d(Int_t nn)
   name += fCalibraMode->GetNrphi(0);
   
   fCH2d = new TH2I("CH2d",(const Char_t *) name
-                  ,fNumberBinCharge,0,300,nn,0,nn);
+                  ,(Int_t)fNumberBinCharge,0,fRangeHistoCharge,nn,0,nn);
   fCH2d->SetYTitle("Det/pad groups");
   fCH2d->SetXTitle("charge deposit [a.u]");
   fCH2d->SetZTitle("counts");
@@ -2744,7 +2746,7 @@ void AliTRDCalibraFillHisto::SetRelativeScale(Float_t RelativeScale)
 {
   //
   // Set the factor that will divide the deposited charge
-  // to fit in the histo range [0,300]
+  // to fit in the histo range [0,fRangeHistoCharge]
   //
  
   if (RelativeScale > 0.0) {
@@ -2766,10 +2768,11 @@ void  AliTRDCalibraFillHisto::FillCH2d(Int_t x, Float_t y)
   // 
   
   //skip simply the value out of range
-  if((y>=300.0) || (y<0.0)) return;
+  if((y>=fRangeHistoCharge) || (y<0.0)) return;
+  if(fRangeHistoCharge < 0.0) return;
   
   //Calcul the y place
-  Int_t yplace = (Int_t) (fNumberBinCharge*y/300.0)+1;
+  Int_t yplace = (Int_t) (fNumberBinCharge*y/fRangeHistoCharge)+1;
   Int_t place = (fNumberBinCharge+2)*(x+1)+yplace;
   
   //Fill
index 8169f97..3d13043 100644 (file)
@@ -163,6 +163,7 @@ class AliTRDCalibraFillHisto : public TObject {
          void     SetThresholdClustersDAQ(Float_t thresholdClustersDAQ)     { fThresholdClustersDAQ = thresholdClustersDAQ;                         }
          void     SetNumberRowDAQ(Short_t numberRowDAQ)                     { fNumberRowDAQ         = numberRowDAQ;         }
          void     SetNumberColDAQ(Short_t numberColDAQ)                     { fNumberColDAQ         = numberColDAQ;         }
+         void     SetRangeHistoCharge(Float_t rangeHistoCharge)             { fRangeHistoCharge     = rangeHistoCharge;     }
          void     SetNumberBinCharge(Short_t numberBinCharge)               { fNumberBinCharge      = numberBinCharge;      }
           void     SetNumberBinPRF(Short_t numberBinPRF)                     { fNumberBinPRF         = numberBinPRF;         }
          void     SetNumberGroupsPRF(Short_t numberGroupsPRF);
@@ -262,6 +263,7 @@ AliTRDCalibraVector *GetCalibraVector() const                                { r
           Int_t    fNumberUsedPh[2];        // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference)
          Int_t    fTimeMax;                // Number of time bins
           Float_t  fSf;                     // Sampling frequence
+         Float_t  fRangeHistoCharge;       // Range of the histo for the charge
          Short_t  fNumberBinCharge;        // Number of bins for the gain factor
          Short_t  fNumberBinPRF;           // Number of bin for the PRF
          Short_t  fNgroupprf;              // Number of groups in tnp bins for PRF /2.0
@@ -346,7 +348,7 @@ AliTRDCalibraVector *GetCalibraVector() const                                { r
   AliTRDCalibraFillHisto();
   virtual ~AliTRDCalibraFillHisto(); 
     
-  ClassDef(AliTRDCalibraFillHisto,6)                         // TRD Calibration class
+  ClassDef(AliTRDCalibraFillHisto,7)                         // TRD Calibration class
 
 };
   
index 2c9429b..57ae295 100644 (file)
@@ -1734,9 +1734,9 @@ void AliTRDCalibraFit::RemoveOutliers(Int_t type, Bool_t perdetector){
   // Initialisation
   ////////////////////////
   Double_t meanAll = 0.0;
-   Double_t rmsAll = 0.0;
-   Int_t countAll = 0;
-   ////////////
+  Double_t rmsAll = 0.0;
+  Int_t countAll = 0;
+  ////////////
   // compute
   ////////////
   for (Int_t k = 0; k < loop; k++) {
@@ -4787,7 +4787,9 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
   
   Bool_t put = kTRUE;
 
+  ///////////////////////////////
   // Beginning of the signal
+  //////////////////////////////
   TH1D *pentea = new TH1D("pentea","pentea",projPH->GetNbinsX(),0,(Float_t) limit);
   for (Int_t k = 1; k <  projPH->GetNbinsX(); k++) {
     pentea->SetBinContent(k,(Double_t) (projPH->GetBinContent(k+1) - projPH->GetBinContent(k)));
@@ -4898,7 +4900,9 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     fPhd[0] = placemaximum;
   }
   
+  /////////////////////////////
   // Amplification region
+  /////////////////////////////
   binmax = 0;
   ju     = 0;
   for (Int_t kbin = 1; kbin < projPH->GetNbinsX(); kbin ++) {
@@ -5020,8 +5024,11 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     }
     fPhd[1] = placemaximum;
   }
-  
+
+  //////////////////  
   // Drift region
+  //////////////////
+  Bool_t putd = kTRUE;
   TH1D *pente = new TH1D("pente","pente", projPH->GetNbinsX(),0,(Float_t) limit);
   for (Int_t k = TMath::Min(binmax+4, projPH->GetNbinsX()); k <  projPH->GetNbinsX(); k++) {
     pente->SetBinContent(k,(Double_t) (projPH->GetBinContent(k+1) - projPH->GetBinContent(k)));
@@ -5032,18 +5039,18 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
   //should not happen
   if (binmin <= 1) {
     binmin = 2;
-    put = 1;
+    putd = 1;
     //AliInfo("Put the binmax from 1 to 2 to enable the fit");
   }
   
   //check
   if((projPH->GetBinContent(binmin)-projPH->GetBinError(binmin)) < (projPH->GetBinContent(binmin+1))) {
     //AliInfo("Too many fluctuations at the end!");
-    put = kFALSE;
+    putd = kFALSE;
   }
   if((projPH->GetBinContent(binmin)+projPH->GetBinError(binmin)) > (projPH->GetBinContent(binmin-1))) {
     //AliInfo("Too many fluctuations at the end!");
-    put = kFALSE;
+    putd = kFALSE;
   }
   if(TMath::Abs(pente->GetBinContent(binmin+1)) <= 0.0000000000001){
     //AliInfo("No entries for the next bin!");
@@ -5090,14 +5097,14 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     if((pente->GetBinContent(binmin+2) <= pente->GetBinContent(binmin+1)) &&
        (pente->GetBinContent(binmin-2) <= pente->GetBinContent(binmin-1))) {
       //AliInfo("polynome 4 false 1");
-      put = kFALSE;
+      putd = kFALSE;
     }
     if(((binmin+3) <= (nbins-1)) &&
        (pente->GetBinContent(binmin+3) <= pente->GetBinContent(binmin+2)) &&
        ((binmin-3) >= TMath::Min(binmax+4, projPH->GetNbinsX())) &&
        (pente->GetBinContent(binmin-3) <= pente->GetBinContent(binmin-2))) {
       //AliInfo("polynome 4 false 2");
-      put = kFALSE;
+      putd = kFALSE;
     }
     // poly 3
     if((pente->GetBinContent(binmin+2) <= pente->GetBinContent(binmin+1)) &&
@@ -5171,7 +5178,7 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     //richtung +
     if((pente->GetBinContent(binmin+2) <= pente->GetBinContent(binmin+1))) {
       //AliInfo("polynome 2+ false");
-      put = kFALSE;
+      putd = kFALSE;
     }
   }
   //pol2 case 2
@@ -5209,26 +5216,26 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     //richtung -
     if((pente->GetBinContent(binmin-2) <= pente->GetBinContent(binmin-1))) {
       //AliInfo("polynome 2- false ");
-      put = kFALSE;
+      putd = kFALSE;
     }
   }
   if((binmin == (nbins-1)) && ((binmin-2) < TMath::Min(binmax+4, projPH->GetNbinsX()))) {
-    put = kFALSE;
+    putd = kFALSE;
     //AliInfo("At the limit for the drift and not usable!");
   }
 
   //pass
   if((binmin == (nbins-2)) && ((binmin-1) < TMath::Min(binmax+4, projPH->GetNbinsX()))){
-    put = kFALSE;
+    putd = kFALSE;
     //AliInfo("For the drift...problem!");
   }
   //pass but should not happen
   if((binmin <= (nbins-3)) && (binmin < TMath::Min(binmax+6, projPH->GetNbinsX()))){
-    put = kFALSE;
+    putd = kFALSE;
     //AliInfo("For the drift...problem!");
   }
   
-  if(put) {
+  if(putd) {
     polynome = new TF1("pol","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",min,max);
     polynome->SetParameters(c0,c1,c2,c3,c4);
     //AliInfo(Form("GetMinimum of the function %f",polynome->GetMinimumX()));
@@ -5264,7 +5271,8 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
   if ((fPhd[2] > fPhd[0]) && 
       (fPhd[2] > fPhd[1]) && 
       (fPhd[1] > fPhd[0]) &&
-      (put)) {
+      (put) &&
+      (putd)) {
     fCurrentCoef[0] = (kDrWidth) / (fPhd[2]-fPhd[1]);
     if(fCurrentCoef[0] > 2.5) fCurrentCoef[0] =  -TMath::Abs(fCurrentCoef[1]);
     else fNumberFitSuccess++;
@@ -5290,6 +5298,7 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
        if (fCurrentCoef2[0] < -3.0) {
          fCurrentCoef2[0] = fCurrentCoef2[1] + 100.0;
        }
+       else fNumberFitSuccess++;
       }
       else {
        fCurrentCoef2[0] = fCurrentCoef2[1] + 100.0;
@@ -5305,6 +5314,7 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     TCanvas *cpentei = new TCanvas("cpentei","cpentei",50,50,600,800);
     cpentei->cd();
     projPH->Draw();
+    if(polynomea) polynomea->Draw("same");
     line->SetLineColor(2);
     line->DrawLine(fPhd[0],0,fPhd[0],projPH->GetMaximum());
     line->DrawLine(fPhd[1],0,fPhd[1],projPH->GetMaximum());
@@ -5312,7 +5322,8 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
     AliInfo(Form("fPhd[0] (beginning of the signal): %f"                  ,(Float_t) fPhd[0]));
     AliInfo(Form("fPhd[1] (end of the amplification region): %f"          ,(Float_t) fPhd[1]));
     AliInfo(Form("fPhd[2] (end of the drift region): %f"                  ,(Float_t) fPhd[2]));
-    AliInfo(Form("fVriftCoef[3] (with only the drift region(default)): %f",(Float_t) fCurrentCoef[0]));
+    AliInfo(Form("Vdrift (with only the drift region(default)): %f",(Float_t) fCurrentCoef[0]));
+    AliInfo(Form("Timeoffset (with only the drift region(default)): %f",(Float_t) fCurrentCoef2[0]));
     TCanvas *cpentei2 = new TCanvas("cpentei2","cpentei2",50,50,600,800);
     cpentei2->cd();
     pentea->Draw();
index ffe83e8..855fceb 100644 (file)
@@ -57,6 +57,10 @@ AliTRDCalibraVdriftLinearFit::AliTRDCalibraVdriftLinearFit() : /*FOLD00*/
   fLinearFitterEArray(540),
   fRobustFit(kTRUE),
   fMinNpointsFit(11),
+  fNbBindx(32),
+  fNbBindy(70),
+  fRangedx(0.8),
+  fRangedy(1.4),
   fDebugStreamer(0x0),
   fDebugLevel(0),
   fSeeDetector(0)
@@ -75,6 +79,10 @@ AliTRDCalibraVdriftLinearFit::AliTRDCalibraVdriftLinearFit(const AliTRDCalibraVd
   fLinearFitterEArray(540),
   fRobustFit(kTRUE),
   fMinNpointsFit(10),
+  fNbBindx(32),
+  fNbBindy(70),
+  fRangedx(0.8),
+  fRangedy(1.4),
   fDebugStreamer(0x0),
   fDebugLevel(0),
   fSeeDetector(0)
@@ -107,6 +115,10 @@ AliTRDCalibraVdriftLinearFit::AliTRDCalibraVdriftLinearFit(const TObjArray &obja
   fLinearFitterEArray(540),
   fRobustFit(kTRUE),
   fMinNpointsFit(10),
+  fNbBindx(32),
+  fNbBindy(70),
+  fRangedx(0.8),
+  fRangedy(1.4),
   fDebugStreamer(0x0),
   fDebugLevel(0),
   fSeeDetector(0)
@@ -230,6 +242,26 @@ void AliTRDCalibraVdriftLinearFit::Add(const AliTRDCalibraVdriftLinearFit *ped)
   }
 }
 //______________________________________________________________________________________
+TH2S* AliTRDCalibraVdriftLinearFit::AddAll() 
+{
+    //
+    // return pointer to TH2S of all added histos 
+  //
+
+  TH2S *histo = 0x0;
+  for(Int_t k=0; k < 540; k++) {
+    TH2S * u = GetLinearFitterHistoForce(k);
+    if(k == 0) {
+      histo = new TH2S(*u);
+      histo->SetName("sum");
+    }
+    else histo->Add(u);
+  }
+
+  return histo;
+
+}
+//______________________________________________________________________________________
 TH2S* AliTRDCalibraVdriftLinearFit::GetLinearFitterHisto(Int_t detector, Bool_t force)
 {
     //
@@ -261,8 +293,8 @@ TH2S* AliTRDCalibraVdriftLinearFit::GetLinearFitterHistoForce(Int_t detector)
   name +=  fVersion;
   
   TH2S *lfdv = new TH2S((const Char_t *)name,(const Char_t *) name
-                       ,36,-0.9,0.9,48
-                       ,-1.2,1.2);
+                       ,(Int_t)fNbBindx,-fRangedx,fRangedx,(Int_t)fNbBindy
+                       ,-fRangedy,fRangedy);
   lfdv->SetXTitle("tan(phi_{track})");
   lfdv->SetYTitle("dy/dt");
   lfdv->SetZTitle("Number of clusters");
index c621ac5..ea053d9 100644 (file)
@@ -50,6 +50,8 @@ class AliTRDCalibraVdriftLinearFit : public TObject {
   Bool_t          GetParam(Int_t detector, TVectorD *param);
   Bool_t          GetError(Int_t detector, TVectorD *error);
   Int_t           GetMinNumberOfPointsForFit() const         { return fMinNpointsFit;};
+  TH2S           *AddAll();
+  TGraphErrors   *DrawMS(const TH2 *const h2, Int_t &nEntries);
 
   TObjArray      *GetPArray()                    { return &fLinearFitterPArray;       };
   TObjArray      *GetEArray()                    { return &fLinearFitterEArray;       };
@@ -57,12 +59,17 @@ class AliTRDCalibraVdriftLinearFit : public TObject {
   void            SetRobustFit(Bool_t robustFit) { fRobustFit = robustFit;            };
   void            SetMinNumberOfPointsForFit(Int_t minNpointsFit) { fMinNpointsFit = minNpointsFit;};
 
+  void            SetNbBindx(Short_t nbBindx)    { fNbBindx = nbBindx;                };
+  void            SetNbBindy(Short_t nbBindy)    { fNbBindy = nbBindy;                }
+  void            SetRangedx(Double_t rangedx)   { fRangedx = rangedx;                };
+  void            SetRangedy(Double_t rangedy)   { fRangedy = rangedy;                };
+
   // Debug
   void     SetDebugLevel(Short_t level)          { fDebugLevel = level;               };
   void     SetSeeDetector(Int_t seeDetector)     { fSeeDetector = seeDetector;        };
 
 private:
-  TGraphErrors   *DrawMS(const TH2 *const h2, Int_t &nEntries);
+  
 
   Int_t           fVersion;                 // Version of the object
   TString         fNameCalibUsed;           // Info of the version, subversion, firstrun of the calib used
@@ -73,12 +80,18 @@ private:
   Bool_t          fRobustFit;               // Robust fit or not
   Int_t           fMinNpointsFit;           // Min number of points for the fit  
 
+  Short_t         fNbBindx;                 // Nb of bin in x
+  Short_t         fNbBindy;                 // Nb of bin in y
+  Double_t        fRangedx;                 // Range in x
+  Double_t        fRangedy;                 // Range in y
+  
+
  //For debugging
   TTreeSRedirector *fDebugStreamer;         //!Debug streamer
   Short_t           fDebugLevel;            // Flag for debugging
   Int_t             fSeeDetector;           // Detector to see
  
-  ClassDef(AliTRDCalibraVdriftLinearFit,4)  // Online Vdrift calibration
+  ClassDef(AliTRDCalibraVdriftLinearFit,5)  // Online Vdrift calibration
 
 };
 
index cd860f8..5653331 100644 (file)
@@ -129,6 +129,8 @@ ClassImp(AliTRDPreprocessorOffline)
   fOutliersFitChargeLow(0.03),
   fOutliersFitChargeHigh(0.7),
   fBeginFitCharge(3.5),
+  fT0Shift0(0.124797),
+  fT0Shift1(0.267451),
   fPHQon(kTRUE),
   fDebugPHQon(kFALSE)
 {
@@ -726,8 +728,11 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
   //
 
   AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
+  calibra->SetT0Shift0(fT0Shift0);
+  calibra->SetT0Shift1(fT0Shift1);
   calibra->SetMinEntries(fMinStatsVdriftT0PH); // If there is less than 1000 entries in the histo: no fit
-  calibra->AnalysePH(fPH2d);
+  calibra->AnalysePH(fPH2d); 
+  //calibra->SetDebugLevel(2);
 
   Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
     + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
@@ -740,6 +745,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
   Bool_t ok = kFALSE;
   if ((nbtg >                  0) && 
       (nbfit        >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
+    //printf("nbtg %d, nbfit %d, nbE %d, nbfitSucess %d\n",nbtg,nbfit,nbE,nbfitSuccess);
     //printf("Pass the cut for VdriftT0\n");
     // create the cal objects
     calibra->RemoveOutliers(1,kFALSE);
@@ -790,7 +796,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftLinearFit(){
   AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
   calibra->SetCalDetVdriftExB(fCalDetVdriftUsed,fCalDetExBUsed);
   calibra->SetMinEntries(fMinStatsVdriftLinear); // If there is less than 1000 entries in the histo: no fit
-  printf("The mean stat is by %d for VdriftLinear\n",fMinStatsVdriftLinear);
+  //printf("The mean stat is by %d for VdriftLinear\n",fMinStatsVdriftLinear);
   //fAliTRDCalibraVdriftLinearFit->SetSeeDetector(0);
   //fAliTRDCalibraVdriftLinearFit->SetDebugLevel(1);
   //printf("Fill PE Array\n");
@@ -1529,7 +1535,7 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun
      Double_t rmsdet = calDet->GetRMSRobust();
      Double_t meanpad = calPad->GetMean();
      //Double_t rmspad = calPad->GetRMS();
-     //printf("T0::minimum %f, rmsdet %f,meanpad %f, rmspad %f\n",meandet,rmsdet,meanpad,rmspad);
+     printf("T0::meandet %f, rmsdet %f,meanpad %f\n",meandet,rmsdet,meanpad);
      if((meandet >   fMinTimeOffsetValidate) && (meandet < 5.0) && (rmsdet < 4.0) && (meanpad < 5.0) && (meanpad > -0.5)) return kTRUE;
      else {
        fStatusPos = fStatusPos | kTimeOffsetErrorRange;
index d61dc3f..e8d8be6 100644 (file)
@@ -88,6 +88,8 @@ public:
   void     SetOutliersFitChargeLow(Float_t outliersFitChargeLow)     { fOutliersFitChargeLow = outliersFitChargeLow; }
   void     SetOutliersFitChargeHigh(Float_t outliersFitChargeHigh)   { fOutliersFitChargeHigh = outliersFitChargeHigh; }
   void     SetBeginFitCharge(Float_t beginFitCharge)                 { fBeginFitCharge = beginFitCharge;};
+  void     SetT0Shift0(Float_t t0Shift0)                             { fT0Shift0 = t0Shift0;};
+  void     SetT0Shift1(Float_t t0Shift1)                             { fT0Shift1 = t0Shift1;};
 
 
 
@@ -260,6 +262,8 @@ public:
   Float_t  fOutliersFitChargeLow;         // The fit starts at fOutliersFitChargeLow procent number of entries
   Float_t  fOutliersFitChargeHigh;        // The fit starts at fOutliersFitChargeHigh procent number of entries
   Float_t  fBeginFitCharge;               // Fit Begin Charge starts at mean/fBeginFitCharge
+  Float_t  fT0Shift0;                    // T0 Shift with the maximum positive slope
+  Float_t  fT0Shift1;                    // T0 Shift with the maximum of the amplification region
 
   Int_t GetSubVersion(TString name) const;
   Int_t GetVersion(TString name) const;