#include "AliTRDgeometry.h"
#include "AliTRDpadPlane.h"
#include "AliTRDgeometry.h"
+#include "AliTRDCommonParam.h"
#include "./Cal/AliTRDCalROC.h"
#include "./Cal/AliTRDCalPad.h"
#include "./Cal/AliTRDCalDet.h"
}
//__________________________________________________________________________________
-void AliTRDCalibraFit::RangeChargeIntegration(Float_t vdrift, Float_t t0, Int_t &begin, Int_t &peak, Int_t &end)
+void AliTRDCalibraFit::RangeChargeIntegration(Float_t vdrift, Float_t t0, Int_t &begin, Int_t &peak, Int_t &end) const
{
//
// From the drift velocity and t0
}
//____________Functions fit Online CH2d________________________________________
-Bool_t AliTRDCalibraFit::AnalyseCH(TH2I *ch)
+Bool_t AliTRDCalibraFit::AnalyseCH(const TH2I *ch)
{
//
// Fit the 1D histos, projections of the 2D ch on the Xaxis, for each
// Take the histo
Double_t nentries = 0.0;
Double_t mean = 0.0;
- TH1F *projch = 0x0;
- Bool_t something = kTRUE;
- if(!calvect->GetCHEntries(fCountDet)) something = kFALSE;
- if(something){
- TString tname("CH");
- tname += idect;
- projch = calvect->ConvertVectorCHHisto(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0)))),(const char *) tname);
- projch->SetDirectory(0);
- for (Int_t k = 0; k < calvect->GetNumberBinCharge(); k++) {
- nentries += projch->GetBinContent(k+1);
- mean += projch->GetBinCenter(k+1)*projch->GetBinContent(k+1);
- }
- if (nentries > 0) {
- fNumberEnt++;
- mean /= nentries;
- }
- //printf("The number of entries for the group %d is %f\n",idect,nentries);
- // Rebin
- if (fRebin > 1) {
- projch = ReBin((TH1F *) projch);
- }
+ if(!calvect->GetCHEntries(fCountDet)) {
+ NotEnoughStatisticCH(idect);
+ continue;
+ }
+
+ TString tname("CH");
+ tname += idect;
+ TH1F *projch = calvect->ConvertVectorCHHisto(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0)))),(const char *) tname);
+ projch->SetDirectory(0);
+ for (Int_t k = 0; k < calvect->GetNumberBinCharge(); k++) {
+ nentries += projch->GetBinContent(k+1);
+ mean += projch->GetBinCenter(k+1)*projch->GetBinContent(k+1);
+ }
+ if (nentries > 0) {
+ fNumberEnt++;
+ mean /= nentries;
+ }
+ //printf("The number of entries for the group %d is %f\n",idect,nentries);
+ // Rebin
+ if (fRebin > 1) {
+ projch = ReBin((TH1F *) projch);
}
// This detector has not enough statistics or was not found in VectorCH
if (nentries <= fMinEntries) {
NotEnoughStatisticCH(idect);
- if (fDebugLevel != 1) {
- if(projch) delete projch;
- }
continue;
}
// Statistic of the histos fitted
}
// Fill Infos Fit
FillInfosFitCH(idect);
- // Memory!!!
- if (fDebugLevel != 1) {
- delete projch;
- }
} // Boucle object
// Normierungcharge
if (fDebugLevel != 1) {
return kTRUE;
}
//________________functions fit Online PH2d____________________________________
-Bool_t AliTRDCalibraFit::AnalysePH(TProfile2D *ph)
+Bool_t AliTRDCalibraFit::AnalysePH(const TProfile2D *ph)
{
//
// Take the 1D profiles (average pulse height), projections of the 2D PH
UpdatefCountDetAndfCount(idect,1);
ReconstructFitRowMinRowMax(idect,1);
// Take the histo
- TH1F *projph = 0x0;
fEntriesCurrent = 0;
- Bool_t something = kTRUE;
- if(!calvect->GetPHEntries(fCountDet)) something = kFALSE;
- if(something){
- TString tname("PH");
- tname += idect;
- projph = CorrectTheError((TGraphErrors *) (calvect->ConvertVectorPHTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname)));
- projph->SetDirectory(0);
+ if(!calvect->GetPHEntries(fCountDet)) {
+ NotEnoughStatisticPH(idect,fEntriesCurrent);
+ continue;
}
+ TString tname("PH");
+ tname += idect;
+ TH1F *projph = calvect->CorrectTheError((TGraphErrors *) (calvect->ConvertVectorPHTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname)),fEntriesCurrent);
+ projph->SetDirectory(0);
+ if(fEntriesCurrent > 0) fNumberEnt++;
//printf("The number of entries for the group %d is %d\n",idect,fEntriesCurrent);
// This detector has not enough statistics or was off
if (fEntriesCurrent <= fMinEntries) {
//printf("Not enough stat!\n");
NotEnoughStatisticPH(idect,fEntriesCurrent);
- if (fDebugLevel != 1) {
- if(projph) delete projph;
- }
continue;
}
// Statistic of the histos fitted
}
// Fill the tree if end of a detector or only the pointer to the branch!!!
FillInfosFitPH(idect,fEntriesCurrent);
- // Memory!!!
- if (fDebugLevel != 1) {
- delete projph;
- }
} // Boucle object
-
+
// Mean Statistic
if (fNumberFit > 0) {
AliInfo(Form("There are %d with at least one entries. %d fits have been proceeded (sucessfully or not...). There is a mean statistic of: %d over these fitted histograms and %d successfulled fits",fNumberEnt, fNumberFit, (Int_t) fStatisticMean/fNumberFit,fNumberFitSuccess));
return kTRUE;
}
//____________Functions fit Online PRF2d_______________________________________
-Bool_t AliTRDCalibraFit::AnalysePRF(TProfile2D *prf)
+Bool_t AliTRDCalibraFit::AnalysePRF(const TProfile2D *prf)
{
//
// Take the 1D profiles (pad response function), projections of the 2D PRF
return kTRUE;
}
//____________Functions fit Online PRF2d_______________________________________
-Bool_t AliTRDCalibraFit::AnalysePRFMarianFit(TProfile2D *prf)
+Bool_t AliTRDCalibraFit::AnalysePRFMarianFit(const TProfile2D *prf)
{
//
// Take the 1D profiles (pad response function), projections of the 2D PRF
UpdatefCountDetAndfCount(idect,2);
ReconstructFitRowMinRowMax(idect,2);
// Take the histo
- TH1F *projprf = 0x0;
fEntriesCurrent = 0;
- Bool_t something = kTRUE;
- if(!calvect->GetPRFEntries(fCountDet)) something = kFALSE;
- if(something){
- TString tname("PRF");
- tname += idect;
- projprf = CorrectTheError((TGraphErrors *) (calvect->ConvertVectorPRFTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname)));
- projprf->SetDirectory(0);
+ if(!calvect->GetPRFEntries(fCountDet)) {
+ NotEnoughStatisticPRF(idect);
+ continue;
}
+ TString tname("PRF");
+ tname += idect;
+ TH1F *projprf = calvect->CorrectTheError((TGraphErrors *) (calvect->ConvertVectorPRFTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname)),fEntriesCurrent);
+ projprf->SetDirectory(0);
+ if(fEntriesCurrent > 0) fNumberEnt++;
// This detector has not enough statistics or was off
if (fEntriesCurrent <= fMinEntries) {
NotEnoughStatisticPRF(idect);
- if (fDebugLevel != 1) {
- if(projprf) delete projprf;
- }
continue;
}
// Statistic of the histos fitted
}
// Fill the tree if end of a detector or only the pointer to the branch!!!
FillInfosFitPRF(idect);
- // Memory!!!
- if (fDebugLevel != 1) {
- delete projprf;
- }
} // Boucle object
// Mean Statistics
if (fNumberFit > 0) {
UpdatefCountDetAndfCount(idect,2);
ReconstructFitRowMinRowMax(idect,2);
// Take the histo
- TGraphErrors *projprftree = 0x0;
fEntriesCurrent = 0;
- Bool_t something = kTRUE;
- if(!calvect->GetPRFEntries(fCountDet)) something = kFALSE;
- if(something){
- TString tname("PRF");
- tname += idect;
- projprftree = calvect->ConvertVectorPRFTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname);
- nbins = projprftree->GetN();
- arrayx = (Double_t *)projprftree->GetX();
- arraye = (Double_t *)projprftree->GetEX();
- arraym = (Double_t *)projprftree->GetY();
- arrayme = (Double_t *)projprftree->GetEY();
- Float_t step = arrayx[1]-arrayx[0];
- lowedge = arrayx[0] - step/2.0;
- upedge = arrayx[(nbins-1)] + step/2.0;
- //printf("nbins est %d\n",nbins);
- for(Int_t k = 0; k < nbins; k++){
- fEntriesCurrent += (Int_t)arraye[k];
- //printf("for %d we have %f, %f\n",k,arraye[k],((projprftree->GetEX())[k]));
- if(arraye[k]>0.0) arrayme[k] = TMath::Sqrt(TMath::Abs(arrayme[k]-arraym[k]*arraym[k])/arraye[k]);
- }
- if(fEntriesCurrent > 0) fNumberEnt++;
+ if(!calvect->GetPRFEntries(fCountDet)) {
+ NotEnoughStatisticPRF(idect);
+ continue;
}
+ TString tname("PRF");
+ tname += idect;
+ TGraphErrors *projprftree = calvect->ConvertVectorPRFTGraphErrors(fCountDet,(idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1)))),(const char *) tname);
+ nbins = projprftree->GetN();
+ arrayx = (Double_t *)projprftree->GetX();
+ arraye = (Double_t *)projprftree->GetEX();
+ arraym = (Double_t *)projprftree->GetY();
+ arrayme = (Double_t *)projprftree->GetEY();
+ Float_t step = arrayx[1]-arrayx[0];
+ lowedge = arrayx[0] - step/2.0;
+ upedge = arrayx[(nbins-1)] + step/2.0;
+ //printf("nbins est %d\n",nbins);
+ for(Int_t k = 0; k < nbins; k++){
+ fEntriesCurrent += (Int_t)arraye[k];
+ //printf("for %d we have %f, %f\n",k,arraye[k],((projprftree->GetEX())[k]));
+ if(arraye[k]>0.0) arrayme[k] = TMath::Sqrt(TMath::Abs(arrayme[k]-arraym[k]*arraym[k])/arraye[k]);
+ }
+ if(fEntriesCurrent > 0) fNumberEnt++;
//printf("The number of entries for the group %d is %d\n",idect,fEntriesCurrent);
// This detector has not enough statistics or was off
if (fEntriesCurrent <= fMinEntries) {
NotEnoughStatisticPRF(idect);
- if(projprftree) delete projprftree;
continue;
}
// Statistic of the histos fitted
}
// Fill the tree if end of a detector or only the pointer to the branch!!!
FillInfosFitPRF(idect);
- // Memory!!!
- if (fDebugLevel != 1) {
- delete projprftree;
- }
} // Boucle object
// Mean Statistics
if (fNumberFit > 0) {
}
//_____________________________________________________________________________
-AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectVdrift(TObjArray *vectorFit, Bool_t perdetector)
+AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectVdrift(const TObjArray *vectorFit, Bool_t perdetector)
{
//
// It creates the AliTRDCalDet object from the AliTRDFitInfo
return object;
}
//_____________________________________________________________________________
-AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectGain(TObjArray *vectorFit, Bool_t meanOtherBefore, Double_t scaleFitFactor, Bool_t perdetector)
+AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectGain(const TObjArray *vectorFit, Bool_t meanOtherBefore, Double_t scaleFitFactor, Bool_t perdetector)
{
//
// It creates the AliTRDCalDet object from the AliTRDFitInfo
return object;
}
//_____________________________________________________________________________
-AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectT0(TObjArray *vectorFit, Bool_t perdetector)
+AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectT0(const TObjArray *vectorFit, Bool_t perdetector)
{
//
// It creates the AliTRDCalDet object from the AliTRDFitInfo2
}
//_____________________________________________________________________________
-AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectLorentzAngle(TObjArray *vectorFit)
+AliTRDCalDet *AliTRDCalibraFit::CreateDetObjectLorentzAngle(const TObjArray *vectorFit)
{
//
// It creates the AliTRDCalDet object from the AliTRDFitInfo2
}
//_____________________________________________________________________________
-TObject *AliTRDCalibraFit::CreatePadObjectGain(TObjArray *vectorFit, Double_t scaleFitFactor, AliTRDCalDet *detobject)
+TObject *AliTRDCalibraFit::CreatePadObjectGain(const TObjArray *vectorFit, Double_t scaleFitFactor, const AliTRDCalDet *detobject)
{
//
// It Creates the AliTRDCalPad object from AliTRDFitInfo
return object;
}
//_____________________________________________________________________________
-TObject *AliTRDCalibraFit::CreatePadObjectVdrift(TObjArray *vectorFit, AliTRDCalDet *detobject)
+TObject *AliTRDCalibraFit::CreatePadObjectVdrift(const TObjArray *vectorFit, const AliTRDCalDet *detobject)
{
//
// It Creates the AliTRDCalPad object from AliTRDFitInfo
}
//_____________________________________________________________________________
-TObject *AliTRDCalibraFit::CreatePadObjectT0(TObjArray *vectorFit, AliTRDCalDet *detobject)
+TObject *AliTRDCalibraFit::CreatePadObjectT0(const TObjArray *vectorFit, const AliTRDCalDet *detobject)
{
//
// It Creates the AliTRDCalPad object from AliTRDFitInfo2
}
//_____________________________________________________________________________
-TObject *AliTRDCalibraFit::CreatePadObjectPRF(TObjArray *vectorFit)
+TObject *AliTRDCalibraFit::CreatePadObjectPRF(const TObjArray *vectorFit)
{
//
// It Creates the AliTRDCalPad object from AliTRDFitInfo
}
//_____________________________________________________________________________
-AliTRDCalDet *AliTRDCalibraFit::MakeOutliersStatDet(TObjArray *vectorFit, const char *name, Double_t &mean)
+AliTRDCalDet *AliTRDCalibraFit::MakeOutliersStatDet(const TObjArray *vectorFit, const char *name, Double_t &mean)
{
//
// It Creates the AliTRDCalDet object from AliTRDFitInfo
return object;
}
//_____________________________________________________________________________
-TObject *AliTRDCalibraFit::MakeOutliersStatPad(TObjArray *vectorFit, const char *name, Double_t &mean)
+TObject *AliTRDCalibraFit::MakeOutliersStatPad(const TObjArray *vectorFit, const char *name, Double_t &mean)
{
//
// It Creates the AliTRDCalPad object from AliTRDFitInfo
fCalDet2 = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
//printf("test2\n");
for(Int_t k = 0; k < 540; k++){
- fCalDet2->SetValue(k,cal->GetOmegaTau(fCalDet->GetValue(k),-fMagneticField));
+ fCalDet2->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(fCalDet->GetValue(k)));
}
//printf("test3\n");
}
else{
Float_t devalue = 1.5;
- Float_t devalue2 = cal->GetOmegaTau(1.5,-fMagneticField);
+ Float_t devalue2 = AliTRDCommonParam::Instance()->GetOmegaTau(1.5);
if(fCalDet) delete fCalDet;
if(fCalDet2) delete fCalDet2;
//printf("test1\n");
}
}
//_____________________________________________________________________________
-Double_t *AliTRDCalibraFit::CalculPolynomeLagrange2(Double_t *x, Double_t *y) const
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange2(const Double_t *x, const 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) const
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange3(const Double_t *x, const 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) const
+Double_t *AliTRDCalibraFit::CalculPolynomeLagrange4(const Double_t *x, const Double_t *y) const
{
//
// Calcul the coefficients of the polynome passant par ces cinqs points de degre 4
}
}
//_____________________________________________________________________________
-TH1I *AliTRDCalibraFit::ReBin(TH1I *hist) const
+TH1I *AliTRDCalibraFit::ReBin(const TH1I *hist) const
{
//
// Rebin of the 1D histo for the gain calibration if needed.
}
//_____________________________________________________________________________
-TH1F *AliTRDCalibraFit::ReBin(TH1F *hist) const
+TH1F *AliTRDCalibraFit::ReBin(const TH1F *hist) const
{
//
// Rebin of the 1D histo for the gain calibration if needed
return rehist;
-}
-
-//_____________________________________________________________________________
-TH1F *AliTRDCalibraFit::CorrectTheError(TGraphErrors *hist)
-{
- //
- // In the case of the vectors method the trees contains TGraphErrors for PH and PRF
- // to be able to add them after
- // We convert it to a TH1F to be able to applied the same fit function method
- // After having called this function you can not add the statistics anymore
- //
-
- TH1F *rehist = 0x0;
-
- Int_t nbins = hist->GetN();
- Double_t *x = hist->GetX();
- Double_t *entries = hist->GetEX();
- Double_t *mean = hist->GetY();
- Double_t *square = hist->GetEY();
- fEntriesCurrent = 0;
-
- if (nbins < 2) {
- return rehist;
- }
-
- Double_t step = x[1] - x[0];
- Double_t minvalue = x[0] - step/2;
- Double_t maxvalue = x[(nbins-1)] + step/2;
-
- rehist = new TH1F("projcorrecterror","",nbins,minvalue,maxvalue);
-
- for (Int_t k = 0; k < nbins; k++) {
- rehist->SetBinContent(k+1,mean[k]);
- if (entries[k] > 0.0) {
- fEntriesCurrent += (Int_t) entries[k];
- Double_t d = TMath::Abs(square[k] - (mean[k]*mean[k]));
- rehist->SetBinError(k+1,TMath::Sqrt(d/entries[k]));
- }
- else {
- rehist->SetBinError(k+1,0.0);
- }
- }
-
- if(fEntriesCurrent > 0) fNumberEnt++;
-
- return rehist;
-
}
//
//____________Some basic geometry function_____________________________________
//
//_____________________________________________________________________________
-Double_t AliTRDCalibraFit::PH(Double_t *x, Double_t *par)
+Double_t AliTRDCalibraFit::PH(const Double_t *x, const Double_t *par)
{
//
// Function for the fit
}
//_____________________________________________________________________________
-Double_t AliTRDCalibraFit::AsymmGauss(Double_t *x, Double_t *par)
+Double_t AliTRDCalibraFit::AsymmGauss(const Double_t *x, const Double_t *par)
{
//
// Function for the fit
}
//_____________________________________________________________________________
-Double_t AliTRDCalibraFit::FuncLandauGaus(Double_t *x, Double_t *par)
+Double_t AliTRDCalibraFit::FuncLandauGaus(const Double_t *x, const Double_t *par)
{
//
// Sum Landau + Gaus with identical mean
}
//_____________________________________________________________________________
-Double_t AliTRDCalibraFit::LanGauFun(Double_t *x, Double_t *par)
+Double_t AliTRDCalibraFit::LanGauFun(const Double_t *x, const Double_t *par)
{
//
// Function for the fit
}
//_____________________________________________________________________________
-TF1 *AliTRDCalibraFit::LanGauFit(TH1 *his, Double_t *fitrange, Double_t *startvalues
- , Double_t *parlimitslo, Double_t *parlimitshi
+TF1 *AliTRDCalibraFit::LanGauFit(TH1 *his, const Double_t *fitrange, const Double_t *startvalues
+ , const Double_t *parlimitslo, const Double_t *parlimitshi
, Double_t *fitparams, Double_t *fiterrors
, Double_t *chiSqr, Int_t *ndf) const
{
}
//_____________________________________________________________________________
-Int_t AliTRDCalibraFit::LanGauPro(Double_t *params, Double_t &maxx, Double_t &fwhm)
+Int_t AliTRDCalibraFit::LanGauPro(const Double_t *params, Double_t &maxx, Double_t &fwhm)
{
//
// Function for the fit
return (0);
}
//_____________________________________________________________________________
-Double_t AliTRDCalibraFit::GausConstant(Double_t *x, Double_t *par)
+Double_t AliTRDCalibraFit::GausConstant(const Double_t *x, const Double_t *par)
{
//
// Gaus with identical mean