//
//////////////////////////////////////////////////////////////////////////////////////
-#include <TTree.h>
#include <TLine.h>
#include <TH1I.h>
#include <TStyle.h>
#include <TProfile2D.h>
-#include <TFile.h>
#include <TCanvas.h>
#include <TGraphErrors.h>
-#include <TGraph.h>
#include <TObjArray.h>
#include <TH1.h>
#include <TH1F.h>
#include <TF1.h>
-#include <TH2F.h>
#include <TAxis.h>
-#include <TStopwatch.h>
#include <TMath.h>
-#include <TLegend.h>
#include <TDirectory.h>
#include <TROOT.h>
#include <TTreeStream.h>
#include <TArrayF.h>
#include "AliLog.h"
-#include "AliCDBManager.h"
#include "AliMathBase.h"
#include "AliTRDCalibraFit.h"
,fMethod(0)
,fBeginFitCharge(3.5)
,fFitPHPeriode(1)
- ,fTakeTheMaxPH(kFALSE)
- ,fT0Shift(0.124797)
+ ,fTakeTheMaxPH(kTRUE)
+ ,fT0Shift0(0.124797)
+ ,fT0Shift1(0.267451)
,fRangeFitPRF(1.0)
,fAccCDB(kFALSE)
,fMinEntries(800)
,fBeginFitCharge(c.fBeginFitCharge)
,fFitPHPeriode(c.fFitPHPeriode)
,fTakeTheMaxPH(c.fTakeTheMaxPH)
-,fT0Shift(c.fT0Shift)
+,fT0Shift0(c.fT0Shift0)
+,fT0Shift1(c.fT0Shift1)
,fRangeFitPRF(c.fRangeFitPRF)
,fAccCDB(c.fAccCDB)
,fMinEntries(c.fMinEntries)
fgInstance = 0x0;
}
+}
+//__________________________________________________________________________________
+void AliTRDCalibraFit::RangeChargeIntegration(Float_t vdrift, Float_t t0, Int_t &begin, Int_t &peak, Int_t &end)
+{
+ //
+ // From the drift velocity and t0
+ // return the position of the peak and maximum negative slope
+ //
+
+ const Float_t kDrWidth = AliTRDgeometry::DrThick(); // drift region
+ Double_t widbins = 0.1; // 0.1 mus
+
+ //peak and maxnegslope in mus
+ Double_t begind = t0*widbins + fT0Shift0;
+ Double_t peakd = t0*widbins + fT0Shift1;
+ Double_t maxnegslope = (kDrWidth + vdrift*peakd)/vdrift;
+
+ // peak and maxnegslope in timebin
+ begin = TMath::Nint(begind*widbins);
+ peak = TMath::Nint(peakd*widbins);
+ end = TMath::Nint(maxnegslope*widbins);
+
}
//____________Functions fit Online CH2d________________________________________
Bool_t AliTRDCalibraFit::AnalyseCH(TH2I *ch)
}
//_____________________________________________________________________________
-void AliTRDCalibraFit::SetT0Shift(Float_t t0Shift)
+void AliTRDCalibraFit::SetT0Shift0(Float_t t0Shift)
{
//
- // The t0 calculated with the maximum positif slope is shift from t0Shift
- // You can here set t0Shift
+ // The t0 calculated with the maximum positif slope is shift from t0Shift0
+ // You can here set t0Shift0
//
if (t0Shift > 0) {
- fT0Shift = t0Shift;
+ fT0Shift0 = t0Shift;
+ }
+ else {
+ AliInfo("t0Shift0 must be strict positif!");
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalibraFit::SetT0Shift1(Float_t t0Shift)
+{
+ //
+ // The t0 calculated with the maximum of the amplification region is shift from t0Shift1
+ // You can here set t0Shift1
+ //
+
+ if (t0Shift > 0) {
+ fT0Shift1 = t0Shift;
}
else {
AliInfo("t0Shift must be strict positif!");
Float_t gfs = fCurrentCoef[1];
Float_t gfE = fCurrentCoefE;
- (*fDebugStreamer) << "GAIN" <<
+ (*fDebugStreamer) << "FillFillCH" <<
"detector=" << detector <<
"caligroup=" << caligroup <<
"rowmin=" << rowmin <<
- (* fDebugStreamer) << "PH"<<
+ (* fDebugStreamer) << "FillFillPH"<<
"detector="<<detector<<
"caligroup="<<caligroup<<
"rowmin="<<rowmin<<
Float_t wids = fCurrentCoef[1];
Float_t widfE = fCurrentCoefE;
- (* fDebugStreamer) << "PRF"<<
+ (* fDebugStreamer) << "FillFillPRF"<<
"detector="<<detector<<
"plane="<<plane<<
"caligroup="<<caligroup<<
Float_t vs = fCurrentCoef[1];
Float_t vfE = fCurrentCoefE;
Float_t lorentzangler = fCurrentCoef2[0];
- Float_t Elorentzangler = fCurrentCoefE2;
+ Float_t elorentzangler = fCurrentCoefE2;
Float_t lorentzangles = fCurrentCoef2[1];
- (* fDebugStreamer) << "LinearFitter"<<
+ (* fDebugStreamer) << "FillFillLinearFitter"<<
"detector="<<detector<<
"chamber="<<chamber<<
"plane="<<plane<<
"vs="<<vs<<
"vfE="<<vfE<<
"lorentzangler="<<lorentzangler<<
- "Elorentzangler="<<Elorentzangler<<
+ "Elorentzangler="<<elorentzangler<<
"lorentzangles="<<lorentzangles<<
"\n";
}
if((l3P1dr != 0.0) && (l3P2dr != 0.0)){
fCurrentCoefE += (l3P1drE/l3P1dr + l3P2drE/l3P2dr)*fPhd[2];
}
- Float_t fPhdt0 = 0.0;
- if(fTakeTheMaxPH) fPhdt0 = fPhd[1];
- else fPhdt0 = fPhd[0];
+ Float_t fPhdt0 = 0.0;
+ Float_t t0Shift = 0.0;
+ if(fTakeTheMaxPH) {
+ fPhdt0 = fPhd[1];
+ t0Shift = fT0Shift1;
+ }
+ else {
+ fPhdt0 = fPhd[0];
+ t0Shift = fT0Shift0;
+ }
if ((fPhd[2] > fPhd[0]) &&
(fPhd[2] > fPhd[1]) &&
fNumberFitSuccess++;
if (fPhdt0 >= 0.0) {
- fCurrentCoef2[0] = (fPhdt0 - fT0Shift) / widbins;
+ fCurrentCoef2[0] = (fPhdt0 - t0Shift) / widbins;
if (fCurrentCoef2[0] < -1.0) {
fCurrentCoef2[0] = fCurrentCoef2[1];
}
fPhd[2] = placeminimum;
}
- Float_t fPhdt0 = 0.0;
- if(fTakeTheMaxPH) fPhdt0 = fPhd[1];
- else fPhdt0 = fPhd[0];
+ Float_t fPhdt0 = 0.0;
+ Float_t t0Shift = 0.0;
+ if(fTakeTheMaxPH) {
+ fPhdt0 = fPhd[1];
+ t0Shift = fT0Shift1;
+ }
+ else {
+ fPhdt0 = fPhd[0];
+ t0Shift = fT0Shift0;
+ }
if ((fPhd[2] > fPhd[0]) &&
(fPhd[2] > fPhd[1]) &&
fCurrentCoef[0] = (kDrWidth) / (fPhd[2]-fPhd[1]);
fNumberFitSuccess++;
if (fPhdt0 >= 0.0) {
- fCurrentCoef2[0] = (fPhdt0 - fT0Shift) / widbins;
+ fCurrentCoef2[0] = (fPhdt0 - t0Shift) / widbins;
if (fCurrentCoef2[0] < -1.0) {
fCurrentCoef2[0] = fCurrentCoef2[1];
}
Float_t wid = fCurrentCoef[0];
Float_t widfE = fCurrentCoefE;
- (* fDebugStreamer) << "FitTnpRangeFill"<<
+ (* fDebugStreamer) << "FitTnpRange0"<<
"detector="<<detector<<
"plane="<<plane<<
"nbtotal="<<nbtotal<<
Double_t colsize[6] = {0.635,0.665,0.695,0.725,0.755,0.785};
Double_t sigmax = TMath::Sqrt(TMath::Abs(pars0[2]))*10000*colsize[plane];
- (* fDebugStreamer) << "FitTnpRangeFit"<<
+ (* fDebugStreamer) << "FitTnpRange1"<<
"detector="<<detector<<
"plane="<<plane<<
"nbtotal="<<nbtotal<<
//Some parameters to initialise
- Double_t widthLandau, widthGaus, MPV, Integral;
+ Double_t widthLandau, widthGaus, mPV, integral;
Double_t chisquarel = 0.0;
Double_t chisquareg = 0.0;
projch->Fit("landau","0M+",""
widthGaus = projch->GetFunction("gaus")->GetParameter(2);
chisquareg = projch->GetFunction("gaus")->GetChisquare();
- MPV = (projch->GetFunction("landau")->GetParameter(1))/2;
- Integral = (projch->GetFunction("gaus")->Integral(0.3*mean,3*mean)+projch->GetFunction("landau")->Integral(0.3*mean,3*mean))/2;
+ mPV = (projch->GetFunction("landau")->GetParameter(1))/2;
+ integral = (projch->GetFunction("gaus")->Integral(0.3*mean,3*mean)+projch->GetFunction("landau")->Integral(0.3*mean,3*mean))/2;
// Setting fit range and start values
Double_t fr[2];
//Double_t sv[4] = { l3P2, fChargeCoef[1], projch->Integral("width"), fG3P2 };
//Double_t sv[4] = { fL3P2, fChargeCoef[1], fL3P0, fG3P2 };
- Double_t sv[4] = { widthLandau, MPV, Integral, widthGaus};
+ Double_t sv[4] = { widthLandau, mPV, integral, widthGaus};
Double_t pllo[4] = { 0.001, 0.001, projch->Integral()/3, 0.001};
Double_t plhi[4] = { 300.0, 300.0, 30*projch->Integral(), 300.0};
Double_t fp[4] = { 1.0, 1.0, 1.0, 1.0 };
}
}
//_____________________________________________________________________________
-Double_t *AliTRDCalibraFit::CalculPolynomeLagrange2(Double_t *x, Double_t *y)
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange2(Double_t *x, Double_t *y) const
{
//
// Calcul the coefficients of the polynome passant par ces trois points de degre 2
}
//_____________________________________________________________________________
-Double_t *AliTRDCalibraFit::CalculPolynomeLagrange3(Double_t *x, Double_t *y)
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange3(Double_t *x, Double_t *y) const
{
//
// Calcul the coefficients of the polynome passant par ces quatre points de degre 3
}
//_____________________________________________________________________________
-Double_t *AliTRDCalibraFit::CalculPolynomeLagrange4(Double_t *x, Double_t *y)
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange4(Double_t *x, Double_t *y) const
{
//
// Calcul the coefficients of the polynome passant par ces cinqs points de degre 4
fDebugStreamer = new TTreeSRedirector("TRDDebugFit.root");
if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
}
- (* fDebugStreamer) << "ScaleFactor"<<
+ (* fDebugStreamer) << "NormierungCharge"<<
"scalefactor="<<scalefactor<<
"\n";
}
//_______________________________________________________________________________
void AliTRDCalibraFit::ResetVectorFit()
{
+ //
+ // Reset the VectorFits
+ //
+
fVectorFit.SetOwner();
fVectorFit.Clear();
fVectorFit2.SetOwner();
TF1 *AliTRDCalibraFit::LanGauFit(TH1 *his, Double_t *fitrange, Double_t *startvalues
, Double_t *parlimitslo, Double_t *parlimitshi
, Double_t *fitparams, Double_t *fiterrors
- , Double_t *chiSqr, Int_t *ndf)
+ , Double_t *chiSqr, Int_t *ndf) const
{
//
// Function for the fit
// Gaus with identical mean
//
- Double_t Gauss = par[0] * TMath::Gaus(x[0],0.0,par[1])+par[2];
+ Double_t gauss = par[0] * TMath::Gaus(x[0],0.0,par[1])+par[2];
- return Gauss;
+ return gauss;
}