:TObject()
,fGeo(0)
,fIsHLT(kFALSE)
- ,fMcmCorrectAngle(kFALSE)
,fCH2dOn(kFALSE)
,fPH2dOn(kFALSE)
,fPRF2dOn(kFALSE)
,fNumberTrack(0)
,fTimeMax(0)
,fSf(10.0)
- ,fNumberBinCharge(100)
- ,fNumberBinPRF(40)
- ,fNgroupprf(0)
+ ,fNumberBinCharge(50)
+ ,fNumberBinPRF(10)
+ ,fNgroupprf(3)
,fAmpTotal(0x0)
,fPHPlace(0x0)
,fPHValue(0x0)
:TObject(c)
,fGeo(0)
,fIsHLT(c.fIsHLT)
- ,fMcmCorrectAngle(c.fMcmCorrectAngle)
,fCH2dOn(c.fCH2dOn)
,fPH2dOn(c.fPH2dOn)
,fPRF2dOn(c.fPRF2dOn)
fCalibraVector->SetDetCha0(k,fCalibraMode->GetDetChamb0(k));
fCalibraVector->SetDetCha2(k,fCalibraMode->GetDetChamb2(k));
}
- TString namech("Nz");
- namech += fCalibraMode->GetNz(0);
- namech += "Nrphi";
- namech += fCalibraMode->GetNrphi(0);
- fCalibraVector->SetNameCH((const char* ) namech);
- TString nameph("Nz");
- nameph += fCalibraMode->GetNz(1);
- nameph += "Nrphi";
- nameph += fCalibraMode->GetNrphi(1);
- fCalibraVector->SetNamePH((const char* ) nameph);
- TString nameprf("Nz");
- nameprf += fCalibraMode->GetNz(2);
- nameprf += "Nrphi";
- nameprf += fCalibraMode->GetNrphi(2);
- nameprf += "Ngp";
- nameprf += fNgroupprf;
- fCalibraVector->SetNamePRF((const char* ) nameprf);
+ fCalibraVector->SetNzNrphi(0,fCalibraMode->GetNz(0),fCalibraMode->GetNrphi(0));
+ fCalibraVector->SetNzNrphi(1,fCalibraMode->GetNz(1),fCalibraMode->GetNrphi(1));
+ fCalibraVector->SetNzNrphi(2,fCalibraMode->GetNz(2),fCalibraMode->GetNrphi(2));
+ fCalibraVector->SetNbGroupPRF(fNgroupprf);
}
// Create the 2D histos corresponding to the pad groupCalibration mode
// Fill the stuffs if a good tracklet
////////////////////////////////////////
if (fGoodTracklet) {
-
+
// drift velocity unables to cut bad tracklets
Bool_t pass = FindP1TrackPHtrackletV1(tracklet, nbclusters);
+ //printf("pass %d and nbclusters %d\n",pass,nbclusters);
+
// Gain calibration
if (fCH2dOn) {
FillTheInfoOfTheTrackCH(nbclusters);
for(Int_t k = 0; k < npoints; k++){
//Take the cluster
AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
+ if(!cl) continue;
Short_t *signals = cl->GetSignals();
- Double_t time = cl->GetLocalTimeBin();
+ Double_t time = cl->GetPadTime();
//Calculate x if possible
Float_t xcenter = 0.0;
Bool_t echec1 = kTRUE;
//Take the cluster
AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
Short_t *signals = cl->GetSignals(); // signal
- Double_t time = cl->GetLocalTimeBin(); // time bin
+ Double_t time = cl->GetPadTime(); // time bin
Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
Float_t padPos = cl->GetPadCol(); // middle pad
Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
AliTRDcluster *cl = 0x0;
for(int ic=0; ic<AliTRDseedV1::kNtb; ic++){
// reject shared clusters on pad row
- if(((ic+AliTRDseedV1::kNtb) < AliTRDseedV1::kNclusters) && (cl = tracklet->GetClusters(ic+AliTRDseedV1::kNtb))) continue;
-
- Double_t time = cl->GetLocalTimeBin();
+ if((ic+AliTRDseedV1::kNtb) < AliTRDseedV1::kNclusters) {
+ if((cl = tracklet->GetClusters(ic+AliTRDseedV1::kNtb))) continue;
+ }
+ if(!(cl = tracklet->GetClusters(ic))) continue;
+ Double_t time = cl->GetPadTime();
if((time<=7) || (time>=21)) continue;
Short_t *signals = cl->GetSignals();
Float_t xcenter = 0.0;
if(!(cl = tracklet->GetClusters(ic))) continue;
Short_t *signals = cl->GetSignals(); // signal
- Double_t time = cl->GetLocalTimeBin(); // time bin
+ Double_t time = cl->GetPadTime(); // time bin
Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
Float_t padPos = cl->GetPadCol(); // middle pad
Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
// time bin of the cluster not corrected
Int_t time = cl->GetPadTime();
-
+ Float_t charge = TMath::Abs(cl->GetQ());
+
+ //printf("Store::time %d, amplitude %f\n",time,dqdl);
+
//Correct for the gain coefficient used in the database for reconstruction
Float_t correctthegain = 1.0;
if(fIsHLT) correctthegain = fCalDetGain->GetValue(fDetectorPreviousTrack);
// Fill the fAmpTotal with the charge
if (fCH2dOn) {
- if((!fLimitChargeIntegration) || (cl->IsInChamber())) fAmpTotal[(Int_t) group[0]] += correction;
+ if((!fLimitChargeIntegration) || (cl->IsInChamber())) {
+ //printf("Store::group %d, amplitude %f\n",group[0],correction);
+ fAmpTotal[(Int_t) group[0]] += correction;
+ }
}
// Fill the fPHPlace and value
if (fPH2dOn) {
fPHPlace[time] = group[1];
- fPHValue[time] = correction;
+ fPHValue[time] = charge;
}
}
Int_t fd = -1; // Premiere zone non nulle
Float_t totalcharge = 0.0; // Total charge for the supermodule histo
+ //printf("CH2d nbclusters %d, fNumberClusters %d, fNumberClustersf %d\n",nbclusters,fNumberClusters,fNumberClustersf);
+
if(nbclusters < fNumberClusters) return;
if(nbclusters > fNumberClustersf) return;
// Normalize with the number of clusters
Double_t normalizeCst = fRelativeScale;
if(fNormalizeNbOfCluster) normalizeCst = normalizeCst*nbclusters;
+
+ //printf("Number of groups in one detector %d\n",fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0));
// See if the track goes through different zones
for (Int_t k = 0; k < fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0); k++) {
+ //printf("fAmpTotal %f for %d\n",fAmpTotal[k],k);
if (fAmpTotal[k] > 0.0) {
totalcharge += fAmpTotal[k];
nb++;
}
}
+ //printf("CH2d: nb %d, fd %d, calibration group %d, amplitude %f, detector %d\n",nb,fd,fCalibraMode->GetXbins(0),fAmpTotal[fd]/normalizeCst,fDetectorPreviousTrack);
switch (nb)
{
Bool_t IsHLT() const { return fIsHLT; }
// Choice to fill or not the 2D
- void SetMcmCorrectAngle(Bool_t mcmcorrectangle = kTRUE) { fMcmCorrectAngle = mcmcorrectangle; }
- void SetPH2dOn(Bool_t ph2don = kTRUE) { fPH2dOn = ph2don; }
+ void SetPH2dOn(Bool_t ph2don = kTRUE) { fPH2dOn = ph2don; }
void SetCH2dOn(Bool_t ch2don = kTRUE) { fCH2dOn = ch2don; }
void SetPRF2dOn(Bool_t prf2don = kTRUE) { fPRF2dOn = prf2don; }
void SetHisto2d(Bool_t histo2d = kTRUE) { fHisto2d = histo2d; }
void SetLinearFitterDebugOn(Bool_t debug = kTRUE) { fLinearFitterDebugOn = debug; }
- Bool_t GetMcmCorrectAngle() const { return fMcmCorrectAngle; }
- Bool_t GetPH2dOn() const { return fPH2dOn; }
+ Bool_t GetPH2dOn() const { return fPH2dOn; }
Bool_t GetCH2dOn() const { return fCH2dOn; }
Bool_t GetPRF2dOn() const { return fPRF2dOn; }
Bool_t GetHisto2d() const { return fHisto2d; }
void SetPerSuperModule(Int_t i);
void SetProcent(Float_t procent) { fProcent = procent; }
void SetDifference(Short_t difference) { fDifference = difference; }
- void SetNumberClusters(Short_t numberClusters) { if(numberClusters > 0) fNumberClusters = numberClusters; }
+ void SetNumberClusters(Short_t numberClusters) { if(numberClusters >= 0) fNumberClusters = numberClusters; }
void SetNumberClustersf(Short_t numberClustersf) { fNumberClustersf = numberClustersf; }
void SetNumberBinCharge(Short_t numberBinCharge) { fNumberBinCharge = numberBinCharge; }
void SetNumberBinPRF(Short_t numberBinPRF) { fNumberBinPRF = numberBinPRF; }
Bool_t fIsHLT; // Now if HLT, the per detector
// Choice to fill or not the 2D
- Bool_t fMcmCorrectAngle; // Apply correction due to the mcmtrackletangle in the z direction (only) assuming from vertex
- Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration
+ Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration
Bool_t fPH2dOn; // Chose to fill the 2D histos or vectors for the drift velocity and T0
Bool_t fPRF2dOn; // Chose to fill the 2D histos or vectors for the pad response function calibration
Bool_t fHisto2d; // Chose to fill the 2D histos
// 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) {
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));
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) {
return rehist;
-}
-
-//_____________________________________________________________________________
-TH1F *AliTRDCalibraFit::CorrectTheError(const 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_____________________________________
AliTRDCalDet *MakeOutliersStatDet(const TObjArray *vectorFit, const char *name, Double_t &mean);
TObject *MakeOutliersStatPad(const TObjArray *vectorFit, const char *name, Double_t &mean);
-
- // Correct the error
- TH1F *CorrectTheError(const TGraphErrors *hist);
-
//
// Set or Get the variables
//
// AliTRDCalibraMode
AliTRDCalibraMode *GetCalibraMode() const { return fCalibraMode; }
+ class AliTRDFitInfo : public TObject {
+
+ public:
+
+ AliTRDFitInfo()
+ :TObject()
+ ,fCoef(0x0)
+ ,fDetector(-1) { }
+ AliTRDFitInfo(const AliTRDFitInfo &i)
+ :TObject(i)
+ ,fCoef(0x0)
+ ,fDetector(-1) { }
+ AliTRDFitInfo &operator=(const AliTRDFitInfo&) { return *this; }
+ virtual ~AliTRDFitInfo() { if(fCoef) { delete [] fCoef;} }
+
+ void SetCoef(Float_t *coef) { fCoef = coef; }
+ void SetDetector(Int_t detector) { fDetector = detector; }
+
+ Float_t *GetCoef() const { return fCoef; }
+ Int_t GetDetector() const { return fDetector; }
+
+ protected:
+
+ Float_t *fCoef; // Relative coefficient for each group of the detector
+ Int_t fDetector; // Detector number
+
+ };
+
+
protected:
// Geometry
Float_t *fCurrentCoefDetector; // Current values for the detector
Float_t *fCurrentCoefDetector2; // Current values for the detector
- class AliTRDFitInfo : public TObject {
-
- public:
-
- AliTRDFitInfo()
- :TObject()
- ,fCoef(0x0)
- ,fDetector(-1) { }
- AliTRDFitInfo(const AliTRDFitInfo &i)
- :TObject(i)
- ,fCoef(0x0)
- ,fDetector(-1) { }
- AliTRDFitInfo &operator=(const AliTRDFitInfo&) { return *this; }
- virtual ~AliTRDFitInfo() { if(fCoef) { delete [] fCoef;} }
-
- void SetCoef(Float_t *coef) { fCoef = coef; }
- void SetDetector(Int_t detector) { fDetector = detector; }
-
- Float_t *GetCoef() const { return fCoef; }
- Int_t GetDetector() const { return fDetector; }
-
- protected:
-
- Float_t *fCoef; // Relative coefficient for each group of the detector
- Int_t fDetector; // Detector number
-
- };
-
TObjArray fVectorFit; // Vectors to fit
TObjArray fVectorFit2; // Vectors to fit
Short_t GetRowMax(Int_t i) const { return fRowMax[i]; }
Short_t GetColMin(Int_t i) const { return fColMin[i]; }
Short_t GetColMax(Int_t i) const { return fColMax[i]; }
- Short_t GetXbins(Int_t i) const { return fXbins[i]; }
+ Int_t GetXbins(Int_t i) const { return fXbins[i]; }
Short_t GetDetChamb0(Int_t i) const { return fDetChamb0[i]; }
Short_t GetDetChamb2(Int_t i) const { return fDetChamb2[i]; }
#include <TGraphErrors.h>
#include <TH1F.h>
#include <TObjArray.h>
+#include <TObject.h>
#include <TMath.h>
#include <TDirectory.h>
#include <TROOT.h>
#include <TFile.h>
+#include <TString.h>
#include "AliLog.h"
#include "AliTRDCalibraVector.h"
#include "AliTRDCommonParam.h"
-#include "TArrayF.h"
-#include "TArrayI.h"
+#include "AliTRDCalibraMode.h"
+#include "AliTRDPhInfo.h"
+#include "AliTRDEntriesInfo.h"
+#include "AliTRDPrfInfo.h"
+#include "AliTRDgeometry.h"
ClassImp(AliTRDCalibraVector)
//______________________________________________________________________________________
AliTRDCalibraVector::AliTRDCalibraVector()
:TObject()
- ,fNameCH("CH2d")
- ,fNamePH("PH2d")
- ,fNamePRF("PRF2d")
+ ,fModeCH(0)
+ ,fModePH(0)
+ ,fModePRF(0)
+ ,fNbGroupPRF(0)
,fDetectorPH(-1)
,fDetectorCH(-1)
,fDetectorPRF(-1)
+ ,fStopFillCH(kFALSE)
+ ,fHisto(0x0)
+ ,fGraph(0x0)
+ ,fCalVector(0x0)
,fNumberBinCharge(0)
,fNumberBinPRF(0)
,fTimeMax(0)
for (Int_t idet = 0; idet < 540; idet++){
- fPHEntries[idet]=new TArrayI();
- fPHMean[idet]=new TArrayF();
- fPHSquares[idet]=new TArrayF();
+ fPHEntries[idet]= 0x0;
+ fPHMean[idet]= 0x0;
+ fPHSquares[idet]= 0x0;
- fPRFEntries[idet]=new TArrayI();
- fPRFMean[idet]=new TArrayF();
- fPRFSquares[idet]=new TArrayF();
+ fPRFEntries[idet]= 0x0;
+ fPRFMean[idet]= 0x0;
+ fPRFSquares[idet]= 0x0;
- fCHEntries[idet]=new TArrayI();
+ fCHEntries[idet]= 0x0;
}
//______________________________________________________________________________________
AliTRDCalibraVector::AliTRDCalibraVector(const AliTRDCalibraVector &c)
:TObject(c)
- ,fNameCH("CH2d")
- ,fNamePH("PH2d")
- ,fNamePRF("PRF2d")
+ ,fModeCH(c.fModeCH)
+ ,fModePH(c.fModePH)
+ ,fModePRF(c.fModePRF)
+ ,fNbGroupPRF(c.fNbGroupPRF)
,fDetectorPH(-1)
,fDetectorCH(-1)
,fDetectorPRF(-1)
+ ,fStopFillCH(kFALSE)
+ ,fHisto(0x0)
+ ,fGraph(0x0)
+ ,fCalVector(0x0)
,fNumberBinCharge(c.fNumberBinCharge)
,fNumberBinPRF(c.fNumberBinPRF)
,fTimeMax(c.fTimeMax)
//
// Copy constructor
//
+
+ for(Int_t k = 0; k < 3; k++){
+ fDetCha0[k] = c.fDetCha0[k];
+ fDetCha2[k] = c.fDetCha2[k];
+ }
+
for (Int_t idet = 0; idet < 540; idet++){
- const TArrayI *phEntries = (TArrayI*)c.fPHEntries[idet];
- const TArrayF *phMean = (TArrayF*)c.fPHMean[idet];
- const TArrayF *phSquares = (TArrayF*)c.fPHSquares[idet];
-
- const TArrayI *prfEntries = (TArrayI*)c.fPRFEntries[idet];
- const TArrayF *prfMean = (TArrayF*)c.fPRFMean[idet];
- const TArrayF *prfSquares = (TArrayF*)c.fPRFSquares[idet];
-
- const TArrayI *chEntries = (TArrayI*)c.fCHEntries[idet];
-
- if ( phEntries != 0x0 ) fPHEntries[idet]=new TArrayI(*phEntries);
- if ( phMean != 0x0 ) fPHMean[idet]=new TArrayF(*phMean);
- if ( phSquares != 0x0 ) fPHSquares[idet]=new TArrayF(*phSquares);
-
- if ( prfEntries != 0x0 ) fPRFEntries[idet]=new TArrayI(*prfEntries);
- if ( prfMean != 0x0 ) fPRFMean[idet]=new TArrayF(*prfMean);
- if ( prfSquares != 0x0 ) fPRFSquares[idet]=new TArrayF(*prfSquares);
+ const AliTRDEntriesInfo *phEntries = (AliTRDEntriesInfo*)c.fPHEntries[idet];
+ const AliTRDPhInfo *phMean = (AliTRDPhInfo *)c.fPHMean[idet];
+ const AliTRDPhInfo *phSquares = (AliTRDPhInfo *)c.fPHSquares[idet];
+ const AliTRDEntriesInfo *prfEntries = (AliTRDEntriesInfo*)c.fPRFEntries[idet];
+ const AliTRDPrfInfo *prfMean = (AliTRDPrfInfo *)c.fPRFMean[idet];
+ const AliTRDPrfInfo *prfSquares = (AliTRDPrfInfo *)c.fPRFSquares[idet];
- if ( chEntries != 0x0 ) fCHEntries[idet]=new TArrayI(*chEntries);
+ const AliTRDEntriesInfo *chEntries = (AliTRDEntriesInfo*)c.fCHEntries[idet];
- }
+ if ( chEntries != 0x0 ) fCHEntries[idet] = new AliTRDEntriesInfo(*chEntries);
+
+ if ( phEntries != 0x0 ) {
+ fPHMean[idet] = new AliTRDPhInfo(*phMean);
+ fPHSquares[idet] = new AliTRDPhInfo(*phSquares);
+ fPHEntries[idet] = new AliTRDEntriesInfo(*phEntries);
+ }
- for(Int_t k = 0; k < 3; k++){
- fDetCha0[k] = c.fDetCha0[k];
- fDetCha2[k] = c.fDetCha2[k];
+ if ( prfEntries != 0x0 ) {
+ fPRFEntries[idet] = new AliTRDEntriesInfo(*prfEntries);
+ fPRFMean[idet] = new AliTRDPrfInfo(*prfMean);
+ fPRFSquares[idet] = new AliTRDPrfInfo(*prfSquares);
+ }
+
}
-
}
//_____________________________________________________________________
if(fPRFMean) delete fPRFMean;
if(fPRFSquares) delete fPRFSquares;
if(fCHEntries) delete fCHEntries;
+ if(fHisto) delete fHisto;
+ if(fGraph) delete fGraph;
+ if(fCalVector) delete fCalVector;
+
+}
+//_____________________________________________________________________________
+void AliTRDCalibraVector::TestInit(Int_t i, Int_t detmax)
+{
+ //
+ // Init to see the size
+ //
+
+ for(Int_t det = 0; det < detmax; det++){
+
+ if(i==2) {
+
+ fPRFEntries[det] = ((AliTRDEntriesInfo *)GetPRFEntries(det,kTRUE));
+ fPRFMean[det] = ((AliTRDPrfInfo *)GetPRFMean(det,kTRUE));
+ fPRFSquares[det] = ((AliTRDPrfInfo *)GetPRFSquares(det,kTRUE));
+
+ }
+
+ if(i==1) {
+
+ fPHEntries[det] = ((AliTRDEntriesInfo *)GetPHEntries(det,kTRUE));
+ fPHMean[det] = ((AliTRDPhInfo *)GetPHMean(det,kTRUE));
+ fPHSquares[det] = ((AliTRDPhInfo *)GetPHSquares(det,kTRUE));
+
+ }
+
+ if(i==0) fCHEntries[det] = ((AliTRDEntriesInfo *)GetCHEntries(det,kTRUE));
+
+ }
}
//_____________________________________________________________________________
if(fDetectorCH != det){
- fCHEntries[det] = ((TArrayI *)GetCHEntries(det,kTRUE));
+ fCHEntries[det] = ((AliTRDEntriesInfo *)GetCHEntries(det,kTRUE));
}
- Int_t entries = ((TArrayI *)fCHEntries[det])->At(group*fNumberBinCharge+bin);
+ Int_t entries = ((AliTRDEntriesInfo *)fCHEntries[det])->At(group*fNumberBinCharge+bin);
Int_t entriesn = entries+1;
- ((TArrayI *)fCHEntries[det])->AddAt(entriesn,group*fNumberBinCharge+bin);
+
+ if(entriesn > 65535) {
+ fStopFillCH = kTRUE;
+ return kTRUE;
+ }
+
+ ((AliTRDEntriesInfo *)fCHEntries[det])->AddAt(entriesn,group*fNumberBinCharge+bin);
fDetectorCH = det;
if(fDetectorPRF != det){
- fPRFEntries[det] = ((TArrayI *)GetPRFEntries(det,kTRUE));
- fPRFMean[det] = ((TArrayF *)GetPRFMean(det,kTRUE));
- fPRFSquares[det] = ((TArrayF *)GetPRFSquares(det,kTRUE));
+ fPRFEntries[det] = ((AliTRDEntriesInfo *)GetPRFEntries(det,kTRUE));
+ fPRFMean[det] = ((AliTRDPrfInfo *)GetPRFMean(det,kTRUE));
+ fPRFSquares[det] = ((AliTRDPrfInfo *)GetPRFSquares(det,kTRUE));
}
- Int_t entries = ((TArrayI *)fPRFEntries[det])->At((Int_t)group*fNumberBinPRF+bin);
- Float_t mean = ((TArrayI *)fPRFMean[det])->At((Int_t)group*fNumberBinPRF+bin);
- Float_t square = ((TArrayI *)fPRFSquares[det])->At((Int_t)group*fNumberBinPRF+bin);
+ Int_t entries = ((AliTRDEntriesInfo *)fPRFEntries[det])->At((Int_t)group*fNumberBinPRF+bin);
+ Float_t mean = ((AliTRDPrfInfo *)fPRFMean[det])->At((Int_t)group*fNumberBinPRF+bin);
+ Float_t square = ((AliTRDPrfInfo *)fPRFSquares[det])->At((Int_t)group*fNumberBinPRF+bin);
Int_t entriesn = entries+1;
- ((TArrayI *)fPRFEntries[det])->AddAt(entriesn,(Int_t)group*fNumberBinPRF+bin);
+
+ if(entriesn > 65535) return kTRUE;
+
+ ((AliTRDEntriesInfo *)fPRFEntries[det])->AddAt(entriesn,(Int_t)group*fNumberBinPRF+bin);
Float_t meann = (mean*((Float_t)entries)+y)/((Float_t)entriesn);
- ((TArrayF *)fPRFMean[det])->AddAt(meann,(Int_t)group*fNumberBinPRF+bin);
+ ((AliTRDPrfInfo *)fPRFMean[det])->AddAt(meann,(Int_t)group*fNumberBinPRF+bin);
Float_t squaren = ((square*((Float_t)entries))+(y*y))/((Float_t)entriesn);
- ((TArrayF *)fPRFSquares[det])->AddAt(squaren,(Int_t)group*fNumberBinPRF+bin);
+ ((AliTRDPrfInfo *)fPRFSquares[det])->AddAt(squaren,(Int_t)group*fNumberBinPRF+bin);
fDetectorPRF = det;
if(fDetectorPH != det){
- fPHEntries[det] = ((TArrayI *)GetPHEntries(det,kTRUE));
- fPHMean[det] = ((TArrayF *)GetPHMean(det,kTRUE));
- fPHSquares[det] = ((TArrayF *)GetPHSquares(det,kTRUE));
+ fPHEntries[det] = ((AliTRDEntriesInfo *)GetPHEntries(det,kTRUE));
+ fPHMean[det] = ((AliTRDPhInfo *)GetPHMean(det,kTRUE));
+ fPHSquares[det] = ((AliTRDPhInfo *)GetPHSquares(det,kTRUE));
}
- Int_t entries = ((TArrayI *)fPHEntries[det])->At(group*fTimeMax+bin);
- Float_t mean = ((TArrayI *)fPHMean[det])->At(group*fTimeMax+bin);
- Float_t square = ((TArrayI *)fPHSquares[det])->At(group*fTimeMax+bin);
+ Int_t entries = ((AliTRDEntriesInfo *)fPHEntries[det])->At(group*fTimeMax+bin);
+ Float_t mean = ((AliTRDPhInfo *)fPHMean[det])->At(group*fTimeMax+bin);
+ Float_t square = ((AliTRDPhInfo *)fPHSquares[det])->AtS(group*fTimeMax+bin);
Int_t entriesn = entries+1;
- ((TArrayI *)fPHEntries[det])->AddAt(entriesn,group*fTimeMax+bin);
Float_t meann = (mean*((Float_t)entries)+value)/((Float_t)entriesn);
- ((TArrayF *)fPHMean[det])->AddAt(meann,group*fTimeMax+bin);
Float_t squaren = ((square*((Float_t)entries))+(value*value))/((Float_t)entriesn);
- ((TArrayF *)fPHSquares[det])->AddAt(squaren,group*fTimeMax+bin);
+
+ if(entriesn > 65535) return kTRUE;
+ //printf("meann %f, squaren %f\n",meann,squaren);
+ if((meann > 3000.0) || (meann < 0.0) || (squaren > (3000.0*3000.0)) || (squaren < 0.0)) return kFALSE;
+ ((AliTRDEntriesInfo *)fPHEntries[det])->AddAt(entriesn,group*fTimeMax+bin);
+ ((AliTRDPhInfo *)fPHMean[det])->AddAt(meann,group*fTimeMax+bin);
+ ((AliTRDPhInfo *)fPHSquares[det])->AddAtS(squaren,group*fTimeMax+bin);
+
+ fDetectorPH = det;
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+Bool_t AliTRDCalibraVector::FillVectorCH(Int_t det, Int_t group, Int_t bin, Int_t entries)
+{
+ //
+ // Fill the vector CH
+ //
+
+ if(entries > 65535) return kFALSE;
+
+ if(fDetectorCH != det){
+ fCHEntries[det] = ((AliTRDEntriesInfo *)GetCHEntries(det,kTRUE));
+ }
+
+ ((AliTRDEntriesInfo *)fCHEntries[det])->AddAt(entries,group*fNumberBinCharge+bin);
+
+ fDetectorCH = det;
+
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+Bool_t AliTRDCalibraVector::FillVectorPRF(Int_t det, Int_t group, Int_t bin, Int_t entries, Float_t mean, Float_t square)
+{
+ //
+ // Fill the vector PRF
+ //
+
+ if((entries > 65535) || (mean > 1.0) || (mean < 0.0) || (square > 1.0) || (square < 0.0)) return kFALSE;
+
+ if(fDetectorPRF != det){
+ fPRFEntries[det] = ((AliTRDEntriesInfo *)GetPRFEntries(det,kTRUE));
+ fPRFMean[det] = ((AliTRDPrfInfo *)GetPRFMean(det,kTRUE));
+ fPRFSquares[det] = ((AliTRDPrfInfo *)GetPRFSquares(det,kTRUE));
+ }
+
+ ((AliTRDEntriesInfo *)fPRFEntries[det])->AddAt(entries,(Int_t)group*fNumberBinPRF+bin);
+ ((AliTRDPrfInfo *)fPRFMean[det])->AddAt(mean,(Int_t)group*fNumberBinPRF+bin);
+ ((AliTRDPrfInfo *)fPRFSquares[det])->AddAt(square,(Int_t)group*fNumberBinPRF+bin);
+
+
+ fDetectorPRF = det;
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+Bool_t AliTRDCalibraVector::FillVectorPH(Int_t det, Int_t group, Int_t bin, Int_t entries, Float_t mean, Float_t square)
+{
+ //
+ // Fill the vector PH
+ //
+
+ if((entries > 65535) || (mean > 3000.0) || (mean < 0.0) || (square > (3000.0*3000.0)) || (square < 0.0)) return kFALSE;
+
+
+ if(fDetectorPH != det){
+ fPHEntries[det] = ((AliTRDEntriesInfo *)GetPHEntries(det,kTRUE));
+ fPHMean[det] = ((AliTRDPhInfo *)GetPHMean(det,kTRUE));
+ fPHSquares[det] = ((AliTRDPhInfo *)GetPHSquares(det,kTRUE));
+ }
+
+ ((AliTRDEntriesInfo *)fPHEntries[det])->AddAt(entries,group*fTimeMax+bin);
+ ((AliTRDPhInfo *)fPHMean[det])->AddAt(mean,group*fTimeMax+bin);
+ ((AliTRDPhInfo *)fPHSquares[det])->AddAtS(square,group*fTimeMax+bin);
fDetectorPH = det;
// Add a other AliTRCalibraVector to this one
//
+ Bool_t result = kTRUE;
+
// Check compatibility
if(fNumberBinCharge != calvect->GetNumberBinCharge()) return kFALSE;
if(fNumberBinPRF != calvect->GetNumberBinPRF()) return kFALSE;
if(fDetCha2[k] != calvect->GetDetCha2(k)) return kFALSE;
}
- //printf("pass0!\n");
+ //printf("All ok for variables before adding!\n");
// Add
for (Int_t idet = 0; idet < 540; idet++){
+
+ //printf("Detector %d\n",idet);
- const TArrayI *phEntriesvect = calvect->GetPHEntries(idet);
- const TArrayF *phMeanvect = calvect->GetPHMean(idet);
- const TArrayF *phSquaresvect = calvect->GetPHSquares(idet);
+ const AliTRDEntriesInfo *phEntriesvect = (AliTRDEntriesInfo *) calvect->GetPHEntries(idet);
+ const AliTRDPhInfo *phMeanvect = (AliTRDPhInfo *) calvect->GetPHMean(idet);
+ const AliTRDPhInfo *phSquaresvect = (AliTRDPhInfo *) calvect->GetPHSquares(idet);
- const TArrayI *prfEntriesvect = calvect->GetPRFEntries(idet);
- const TArrayF *prfMeanvect = calvect->GetPRFMean(idet);
- const TArrayF *prfSquaresvect = calvect->GetPRFSquares(idet);
+ const AliTRDEntriesInfo *prfEntriesvect = (AliTRDEntriesInfo *) calvect->GetPRFEntries(idet);
+ const AliTRDPrfInfo *prfMeanvect = (AliTRDPrfInfo *) calvect->GetPRFMean(idet);
+ const AliTRDPrfInfo *prfSquaresvect = (AliTRDPrfInfo *) calvect->GetPRFSquares(idet);
- const TArrayI *chEntriesvect = calvect->GetCHEntries(idet);
-
- //printf("idet %d!\n",idet);
-
- //printf("phEntriesvect %d\n",(Bool_t) phEntriesvect);
- //printf("phMeanvect %d\n",(Bool_t) phMeanvect);
- //printf("phSquaresvect %d\n",(Bool_t) phSquaresvect);
-
- //printf("prfEntriesvect %d\n",(Bool_t) prfEntriesvect);
- //printf("prfMeanvect %d\n",(Bool_t) prfMeanvect);
- //printf("prfSquaresvect %d\n",(Bool_t) prfSquaresvect);
-
- //printf("chEntriesvect %d\n",(Bool_t) chEntriesvect);
+ const AliTRDEntriesInfo *chEntriesvect = (AliTRDEntriesInfo *) calvect->GetCHEntries(idet);
if ( phEntriesvect != 0x0 ){
//Take the stuff
- fPHEntries[idet] = ((TArrayI *)GetPHEntries(idet,kTRUE));
- fPHMean[idet] = ((TArrayF *)GetPHMean(idet,kTRUE));
- fPHSquares[idet] = ((TArrayF *)GetPHSquares(idet,kTRUE));
- Int_t total = ((TArrayI *)fPHEntries[idet])->GetSize();
+ fPHEntries[idet] = ((AliTRDEntriesInfo *)GetPHEntries(idet,kTRUE));
+ fPHMean[idet] = ((AliTRDPhInfo *)GetPHMean(idet,kTRUE));
+ fPHSquares[idet] = ((AliTRDPhInfo *)GetPHSquares(idet,kTRUE));
+
+ Int_t total = fPHEntries[idet]->GetSize();
+ //printf("Total size PH %d\n",total);
// Add
for(Int_t k = 0; k < total; k++){
- Int_t entries = ((TArrayI *)fPHEntries[idet])->At(k);
- Float_t mean = ((TArrayF *)fPHMean[idet])->At(k);
- Float_t square = ((TArrayF *)fPHSquares[idet])->At(k);
-
- Int_t entriesn = entries+((TArrayI *)phEntriesvect)->At(k);
- if(entriesn <= 0) continue;
- ((TArrayI *)fPHEntries[idet])->AddAt(entriesn,k);
- Float_t meann = (mean*((Float_t)entries)+((TArrayF *)phMeanvect)->At(k)*((Float_t)((TArrayI *)phEntriesvect)->At(k)))/((Float_t)entriesn);
- ((TArrayF *)fPHMean[idet])->AddAt(meann,k);
- Float_t sq = ((TArrayF *)phSquaresvect)->At(k)*((Float_t)((TArrayI *)phEntriesvect)->At(k));
- Float_t squaren = ((square*((Float_t)entries))+sq)/((Float_t)entriesn);
- ((TArrayF *)fPHSquares[idet])->AddAt(squaren,k);
- //printf("test ph!\n");
+ Int_t entriesv = ((AliTRDEntriesInfo *)phEntriesvect)->At(k);
+ Float_t meanv = ((AliTRDPhInfo *)phMeanvect)->At(k);
+ Float_t squarev = ((AliTRDPhInfo *)phSquaresvect)->AtS(k);
+
+ Int_t entries = ((AliTRDEntriesInfo *)fPHEntries[idet])->At(k);
+ Float_t mean = ((AliTRDPhInfo *)fPHMean[idet])->At(k);
+ Float_t square = ((AliTRDPhInfo *)fPHSquares[idet])->AtS(k);
+
+ Int_t entriesn = entries+entriesv;
+ Float_t meann = (mean*((Float_t)entries)+meanv*((Float_t)entriesv))/((Float_t)entriesn);
+ Float_t squaren = ((square*((Float_t)entries))+(squarev*((Float_t)entriesv)))/((Float_t)entriesn);
+
+ if((entriesn > 0) && (entriesn <= 65535) && (meann >= 0) && (meann < 3000.0) && (squaren >= 0.0) && (squaren < (3000.0*3000.0))) {
+
+ ((AliTRDEntriesInfo *)fPHEntries[idet])->AddAt(entriesn,k);
+ ((AliTRDPhInfo *)fPHMean[idet])->AddAt(meann,k);
+ ((AliTRDPhInfo *)fPHSquares[idet])->AddAtS(squaren,k);
+
+ }
}
}
if ( prfEntriesvect != 0x0 ){
//Take the stuff
- fPRFEntries[idet] = ((TArrayI *)GetPRFEntries(idet,kTRUE));
- fPRFMean[idet] = ((TArrayF *)GetPRFMean(idet,kTRUE));
- fPRFSquares[idet] = ((TArrayF *)GetPRFSquares(idet,kTRUE));
- Int_t total = fPRFEntries[idet]->GetSize();
+ fPRFEntries[idet] = ((AliTRDEntriesInfo *)GetPRFEntries(idet,kTRUE));
+ fPRFMean[idet] = ((AliTRDPrfInfo *)GetPRFMean(idet,kTRUE));
+ fPRFSquares[idet] = ((AliTRDPrfInfo *)GetPRFSquares(idet,kTRUE));
+
+ Int_t total = fPRFEntries[idet]->GetSize();
+ //Int_t total0 = fPRFMean[idet]->GetSize();
+ //Int_t total1 = fPRFSquares[idet]->GetSize();
+ //printf("Total size PRF %d\n",total);
+ //printf("Total0 size PRF %d\n",total0);
+ //printf("Total1 size PRF %d\n",total1);
// Add
for(Int_t k = 0; k < total; k++){
- Int_t entries = ((TArrayI *)fPRFEntries[idet])->At(k);
- Float_t mean = ((TArrayF *)fPRFMean[idet])->At(k);
- Float_t square = ((TArrayF *)fPRFSquares[idet])->At(k);
- //printf("entries0 %d\n",entries);
- //printf("mean0 %f\n",mean);
- //printf("square0 %f\n",square);
- //printf("entries1 %d\n",prfEntriesvect->At(k));
- //printf("mean1 %f\n",prfMeanvect->At(k));
- //printf("square1 %f\n",prfSquaresvect->At(k));
+ Int_t entries = ((AliTRDEntriesInfo *)fPRFEntries[idet])->At(k);
+ Float_t mean = ((AliTRDPrfInfo *)fPRFMean[idet])->At(k);
+ Float_t square = ((AliTRDPrfInfo *)fPRFSquares[idet])->At(k);
+
+ Int_t entriesv = ((AliTRDEntriesInfo *)prfEntriesvect)->At(k);
+ Float_t meanv = ((AliTRDPrfInfo *)prfMeanvect)->At(k);
+ Float_t squarev = ((AliTRDPrfInfo *)prfSquaresvect)->At(k);
+
+ Int_t entriesn = entries + entriesv;
+
+ if((entriesn > 0) && (entriesn <= 65535)) {
+
+ ((AliTRDEntriesInfo *)fPRFEntries[idet])->AddAt(entriesn,k);
+
+ Float_t meann = (mean*((Float_t)entries)+meanv*((Float_t)entriesv))/((Float_t)entriesn);
+ //printf("test0\n");
+ ((AliTRDPrfInfo *)fPRFMean[idet])->AddAt(meann,k);
+ //printf("test1\n");
+
+ Float_t squaren = ((square*((Float_t)entries))+(squarev*((Float_t)entriesv)))/((Float_t)entriesn);
+ //printf("test2\n");
+ ((AliTRDPrfInfo *)fPRFSquares[idet])->AddAt(squaren,k);
+ //printf("test3\n");
+
+ }
+ }
+ }
+
+ if ( chEntriesvect != 0x0 ){
+ //Take the stuff
+ fCHEntries[idet] = ((AliTRDEntriesInfo *)GetCHEntries(idet,kTRUE));
+ //printf("TestAdd\n");
+ fStopFillCH = ((AliTRDEntriesInfo *)fCHEntries[idet])->TestAdd((AliTRDEntriesInfo *)chEntriesvect);
+ //
+ if(!fStopFillCH) {
+ fStopFillCH = kTRUE;
+ result = kFALSE;
+ }
+ else {
+
+ ((AliTRDEntriesInfo *)fCHEntries[idet])->Add(chEntriesvect);
+ //printf("Add\n");
+ }
+ }
+ }
+ return result;
+}
+//_____________________________________________________________________________________________________________________
+AliTRDCalibraVector *AliTRDCalibraVector::AddStatsPerDetectorCH()
+{
+ //
+ // Create a AliTRDCalibraVector detector wise
+ //
- //printf("entries0 size %d\n",fPRFEntries->GetSize());
- //printf("mean0 size %d\n",fPRFMean->GetSize());
- //printf("squares0 size %d\n",fPRFSquares->GetSize());
+ // Use a AliTRDCalibraMode to navigate in the calibration groups
+ AliTRDCalibraMode calibMode = AliTRDCalibraMode();
+ calibMode.SetNz(0,GetNz(0));
+ calibMode.SetNrphi(0,GetNrphi(0));
+ if(((calibMode.GetNz(0) == 100) && (calibMode.GetNrphi(0) == 100)) || ((calibMode.GetNz(0) == 10) && (calibMode.GetNrphi(0) == 10))) return 0x0;
+
+ Int_t nybins = 6*4*18*fDetCha0[0]+6*18*fDetCha2[0];
+ Int_t nxbins = fNumberBinCharge;
+
+ // Check
+ Int_t perChamber2 = 0;
+ Int_t perChamber0 = 0;
+ calibMode.ModePadCalibration(2,0);
+ calibMode.ModePadFragmentation(0,2,0,0);
+ calibMode.SetDetChamb2(0);
+ perChamber2 = (Int_t) calibMode.GetDetChamb2(0);
+ calibMode.ModePadCalibration(0,0);
+ calibMode.ModePadFragmentation(0,0,0,0);
+ calibMode.SetDetChamb0(0);
+ perChamber0 = (Int_t) calibMode.GetDetChamb0(0);
+ if(nybins != (6*18*perChamber2+6*4*18*perChamber0)) return 0x0;
+
+ // Create calvector
+ if(!fCalVector) fCalVector = new AliTRDCalibraVector();
+ else{
+ fCalVector->~AliTRDCalibraVector();
+ new(fCalVector) AliTRDCalibraVector();
+ }
+ fCalVector->SetNumberBinCharge(nxbins);
+ fCalVector->SetDetCha0(0,1);
+ fCalVector->SetDetCha2(0,1);
+ fCalVector->SetNzNrphi(0,0,0);
+
+
+ for(Int_t det = 0; det < 540; det++){
+
+ // Take
+ AliTRDEntriesInfo *entriesch = (AliTRDEntriesInfo *)GetCHEntries(det,kFALSE);
+ if(!entriesch) continue;
+
+ // Number of groups
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(det) == 2) numberofgroup = perChamber2;
+ else numberofgroup = perChamber0;
+
+ // Check if one can merge calibration groups for this chamber
+ // entries is the number of entries in each bin after adding the different the calibration group in the detector
+ fStopFillCH = kFALSE;
+ Int_t firstnumberofgroup = -1;
+ Int_t entries[500];
+ for(Int_t k = 0; k < nxbins; k++){
+ entries[k] = 0;
+ }
+ // Loop over group in the detector
+ for(Int_t k = 0; k < numberofgroup; k++){
+ // Loop over bins
+ for(Int_t nx = 0; nx < nxbins; nx++) {
+ Int_t binnumber = k*nxbins+nx;
+ entries[nx] += entriesch->At(binnumber);
+ // as soon as one bin is over threshold stop
+ if(!fStopFillCH) {
+ if(entries[nx] > 65535) {
+ firstnumberofgroup = k;
+ fStopFillCH = kTRUE;
+ }
+ }
+ else continue;
+ }
+ }
+ if(fStopFillCH && (firstnumberofgroup == 0)) return 0x0;
+ if(!fStopFillCH) firstnumberofgroup = numberofgroup;
+
+ // Now add up to possible
+ for(Int_t k = 0; k < nxbins; k++){
+ entries[k] = 0;
+ }
+ for(Int_t k = 0; k < firstnumberofgroup; k++){
+ for(Int_t nx = 0; nx < nxbins; nx++) {
+ Int_t binnumber = k*nxbins+nx;
+ entries[nx] += entriesch->At(binnumber);
+ }
+ }
- //printf("entries1 size %d\n",prfEntriesvect->GetSize());
- //printf("mean1 size %d\n",prfMeanvect->GetSize());
- //printf("squares1 size %d\n",prfSquaresvect->GetSize());
+ // Finally fill
+ for(Int_t nx = 0; nx < nxbins; nx++){
+ fCalVector->FillVectorCH(det,0,nx,(Int_t)entries[nx]);
+ }
+ }
+
+ return fCalVector;
+}
+//_____________________________________________________________________________________________________________________
+AliTRDCalibraVector *AliTRDCalibraVector::AddStatsPerDetectorPH()
+{
+ //
+ // Create a AliTRDCalibraVector detector wise
+ //
+ AliTRDCalibraMode calibMode = AliTRDCalibraMode();
+ calibMode.SetNz(1,GetNz(1));
+ calibMode.SetNrphi(1,GetNrphi(1));
+ if(((calibMode.GetNz(1) == 100) && (calibMode.GetNrphi(1) == 100)) || ((calibMode.GetNz(1) == 10) && (calibMode.GetNrphi(1) == 10))) return 0x0;
+
- Int_t entriesn = entries+((TArrayI *)prfEntriesvect)->At(k);
- if(entriesn <= 0) continue;
- ((TArrayI *)fPRFEntries[idet])->AddAt(entriesn,k);
- Float_t meann = (mean*((Float_t)entries)+((TArrayF *)prfMeanvect)->At(k)*((Float_t)((TArrayI *)prfEntriesvect)->At(k)))/((Float_t)entriesn);
- ((TArrayF *)fPRFMean[idet])->AddAt(meann,k);
- Float_t sq = ((TArrayF *)prfSquaresvect)->At(k)*((Float_t)((TArrayI *)prfEntriesvect)->At(k));
- Float_t squaren = ((square*((Float_t)entries))+sq)/((Float_t)entriesn);
- ((TArrayF *)fPRFSquares[idet])->AddAt(squaren,k);
- //printf("test prf!\n");
+ // Check
+ Int_t nybins = 6*4*18*fDetCha0[1]+6*18*fDetCha2[1];
+ Int_t nxbins = fTimeMax;
+
+ Int_t perChamber2 = 0;
+ Int_t perChamber0 = 0;
+ calibMode.ModePadCalibration(2,1);
+ calibMode.ModePadFragmentation(0,2,0,1);
+ calibMode.SetDetChamb2(1);
+ perChamber2 = (Int_t) calibMode.GetDetChamb2(1);
+ calibMode.ModePadCalibration(0,1);
+ calibMode.ModePadFragmentation(0,0,0,1);
+ calibMode.SetDetChamb0(1);
+ perChamber0 = (Int_t) calibMode.GetDetChamb0(1);
+
+ if(nybins != (6*18*perChamber2+6*4*18*perChamber0)) return 0x0;
+
+ // Create calvector
+ if(!fCalVector) fCalVector = new AliTRDCalibraVector();
+ else{
+ fCalVector->~AliTRDCalibraVector();
+ new(fCalVector) AliTRDCalibraVector();
+ }
+ fCalVector->SetTimeMax(nxbins);
+ fCalVector->SetDetCha0(1,1);
+ fCalVector->SetDetCha2(1,1);
+ fCalVector->SetNzNrphi(1,0,0);
+
+
+ for(Int_t det = 0; det < 540; det++){
+
+ // Take
+ AliTRDEntriesInfo *entriesph = (AliTRDEntriesInfo *)GetPHEntries(det,kFALSE);
+ if(!entriesph) continue;
+ AliTRDPhInfo *meanph = (AliTRDPhInfo *)GetPHMean(det,kFALSE);
+ AliTRDPhInfo *squaresph = (AliTRDPhInfo *)GetPHSquares(det,kFALSE);
+
+ // Number of groups
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(det) == 2) numberofgroup = perChamber2;
+ else numberofgroup = perChamber0;
+
+ // PH
+ for(Int_t nx = 0; nx < nxbins; nx++) {
+
+ Double_t entries = 0.0;
+ Double_t sumw2 = 0.0;
+ Double_t sumw = 0.0;
+
+ // Sum the contributions of the different calibration group in the detector
+ for(Int_t k = 0; k < numberofgroup; k++){
+
+ Int_t binnumber = k*nxbins+nx;
+
+ Int_t entriesv = ((AliTRDEntriesInfo *)entriesph)->At(binnumber);
+ Float_t sumw2v = ((AliTRDPhInfo *)squaresph)->AtS(binnumber)*entriesv;
+ Float_t sumwv = ((AliTRDPhInfo *)meanph)->At(binnumber)*entriesv;
+
+
+ if(((entries+entriesv) > 65535) || ((entries+entriesv) <= 0)) continue;
+
+ entries += entriesv;
+ sumw2 += sumw2v;
+ sumw += sumwv;
+
}
- }
- if ( chEntriesvect != 0x0 ){
- //Take the stuff
- fCHEntries[idet] = ((TArrayI *)GetCHEntries(idet,kTRUE));
- Int_t total = fCHEntries[idet]->GetSize();
- //if(idet == 180) printf("total %d\n",total);
- // Add
- for(Int_t k = 0; k < total; k++){
- Int_t entries = ((TArrayI *)fCHEntries[idet])->At(k);
- Int_t entriesn = entries+((TArrayI *)chEntriesvect)->At(k);
- //if((idet == 180) && ((entries != 0) || (entriesn != 0))) printf("for k %d we have entries %d and entriesn %d\n",k,entries,entriesn);
- if(entriesn <= 0) continue;
- ((TArrayI *)fCHEntries[idet])->AddAt(entriesn,k);
+ if(entries > 0) {
+ sumw2 = sumw2/((Float_t)entries);
+ sumw = sumw/((Float_t)entries);
}
- //printf("test ch!\n");
- }
+
+ fCalVector->FillVectorPH(det,0,nx,(Int_t)entries,(Float_t)sumw,(Float_t)sumw2);
+ }
}
+
+ return fCalVector;
- return kTRUE;
}
+//_____________________________________________________________________________________________________________________
+AliTRDCalibraVector *AliTRDCalibraVector::AddStatsPerDetectorPRF()
+{
+ //
+ // Create a AliTRDCalibraVector detector wise
+ //
+
+ AliTRDCalibraMode calibMode = AliTRDCalibraMode();
+ calibMode.SetNz(2,GetNz(2));
+ calibMode.SetNrphi(2,GetNrphi(2));
+ if(((calibMode.GetNz(2) == 100) && (calibMode.GetNrphi(2) == 100)) || ((calibMode.GetNz(2) == 10) && (calibMode.GetNrphi(2) == 10))) return 0x0;
+
+ // Check
+ Int_t nybins = 6*4*18*fDetCha0[2]+ 6*18*fDetCha2[2];
+ Int_t nxbins = fNumberBinPRF;
+
+ Int_t perChamber2 = 0;
+ Int_t perChamber0 = 0;
+ calibMode.ModePadCalibration(2,2);
+ calibMode.ModePadFragmentation(0,2,0,2);
+ calibMode.SetDetChamb2(2);
+ perChamber2 = (Int_t) calibMode.GetDetChamb2(2);
+ calibMode.ModePadCalibration(0,2);
+ calibMode.ModePadFragmentation(0,0,0,2);
+ calibMode.SetDetChamb0(2);
+ perChamber0 = (Int_t) calibMode.GetDetChamb0(2);
+
+ if(nybins != (6*18*perChamber2+6*4*18*perChamber0)) return 0x0;
+
+ // Create calvector
+ if(!fCalVector) fCalVector = new AliTRDCalibraVector();
+ else{
+ fCalVector->~AliTRDCalibraVector();
+ new(fCalVector) AliTRDCalibraVector();
+ }
+ fCalVector->SetNumberBinPRF(nxbins);
+ fCalVector->SetDetCha0(2,1);
+ fCalVector->SetDetCha2(2,1);
+ fCalVector->SetNzNrphi(2,0,0);
+ fCalVector->SetNbGroupPRF(fNbGroupPRF);
+
+
+ for(Int_t det = 0; det < 540; det++){
+
+ // Take
+ AliTRDEntriesInfo *entriesprf = (AliTRDEntriesInfo *) GetPRFEntries(det,kFALSE);
+ if(!entriesprf) continue;
+ AliTRDPrfInfo *meanprf = (AliTRDPrfInfo *) GetPRFMean(det,kFALSE);
+ AliTRDPrfInfo *squaresprf = (AliTRDPrfInfo *) GetPRFSquares(det,kFALSE);
+
+ // Number of groups
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(det) == 2) numberofgroup = perChamber2;
+ else numberofgroup = perChamber0;
+
+ for(Int_t nx = 0; nx < nxbins; nx++) {
+
+ Double_t entries = 0.0;
+ Double_t sumw2 = 0.0;
+ Double_t sumw = 0.0;
+
+ // Sum the contributions of the different groups in the detector for one bin
+ for(Int_t k = 0; k < numberofgroup; k++){
+
+ Int_t binnumber = k*nxbins+nx;
+
+ Int_t entriesv = ((AliTRDEntriesInfo *)entriesprf)->At(binnumber);
+ Float_t sumw2v = ((AliTRDPrfInfo *)squaresprf)->At(binnumber)*entriesv;
+ Float_t sumwv = ((AliTRDPrfInfo *)meanprf)->At(binnumber)*entriesv;
+
+ if(((entries+entriesv) > 65535) || ((entries+entriesv) <= 0)) continue;
+
+ entries += entriesv;
+ sumw2 += sumw2v;
+ sumw += sumwv;
+
+ }
+
+ if(entries > 0) {
+ sumw2 = sumw2/((Float_t)entries);
+ sumw = sumw/((Float_t)entries);
+ }
+
+ fCalVector->FillVectorPRF(det,0,nx,(Int_t)entries,(Float_t)sumw,(Float_t)sumw2);
+
+ }
+ }
+
+ return fCalVector;
+}
+//_______________________________________________________________________________
+Bool_t AliTRDCalibraVector::FindTheMaxEntries(Int_t i, Int_t &detectormax, Int_t &groupmax)
+{
+ //
+ // Find detectormax and groupmax with the biggest number of entries
+ //
+
+ Int_t numberofTB = 0;
+ if(i==0) numberofTB = (Int_t) GetNumberBinCharge();
+ if(i==1) numberofTB = GetTimeMax();
+ if(i==2) numberofTB = GetNumberBinPRF();
+ if((i!=0) && (i!=1) && (i!=2)) AliInfo("Didn't understand i");
+
+
+ // Init
+ Double_t entries [540];
+ for(Int_t idet = 0; idet < 540; idet++){
+ entries[idet] = 0.0;
+ }
+
+ AliTRDEntriesInfo *entriesd = 0x0;
+ // Take the number of entries per detector
+ for(Int_t idet = 0; idet < 540; idet++){
+
+ if(i==0) entriesd = (AliTRDEntriesInfo *) GetCHEntries(idet,kFALSE);
+ if(i==1) entriesd = (AliTRDEntriesInfo *) GetPHEntries(idet,kFALSE);
+ if(i==2) entriesd = (AliTRDEntriesInfo *) GetPRFEntries(idet,kFALSE);
+ if(!entriesd) continue;
+
+ entries[idet] = entriesd->GetSum();
+
+ }
+
+ // Search detector max
+ Double_t max = -10;
+ detectormax = -1;
+ for(Int_t idet = 0; idet < 540; idet++){
+ if(entries[idet] > max) {
+ max = entries[idet];
+ detectormax = idet;
+ }
+ }
+ if((max == 0.0) || (detectormax <0.0)) return kFALSE;
+
+ // Search group max
+ if(i==0) entriesd = (AliTRDEntriesInfo *) GetCHEntries(detectormax,kFALSE);
+ if(i==1) entriesd = (AliTRDEntriesInfo *) GetPHEntries(detectormax,kFALSE);
+ if(i==2) entriesd = (AliTRDEntriesInfo *) GetPRFEntries(detectormax,kFALSE);
+ if(!entriesd) return kFALSE;
+ // Number of groups
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(detectormax) == 2) numberofgroup = fDetCha2[i];
+ else numberofgroup = fDetCha0[i];
+ // Init
+ Double_t nbgroup [2304];
+ for(Int_t k = 0; k < 2304; k++){
+ nbgroup[k] = 0.0;
+ }
+ Int_t nxbins = 0;
+ if(i==0) nxbins = fNumberBinCharge;
+ if(i==1) nxbins = fTimeMax;
+ if(i==2) nxbins = fNumberBinPRF;
+ // Compute the number of entries per group
+ for(Int_t k = 0; k < numberofgroup; k++){
+ for(Int_t nx = 0; nx < nxbins; nx++) {
+ Int_t binnumber = k*nxbins+nx;
+ nbgroup[k] += ((AliTRDEntriesInfo *)entriesd)->At(binnumber);
+ }
+ }
+ max = -10.0;
+ groupmax = -1;
+ for(Int_t i = 0; i < numberofgroup; i++){
+ if(nbgroup[i] > max){
+ max = nbgroup[i];
+ groupmax = i;
+ }
+ }
+ if((max == 0.0) || (groupmax < 0.0) || (groupmax >= numberofgroup)) return kFALSE;
+
+ return kTRUE;
+
+}
//_____________________________________________________________________________
-TGraphErrors *AliTRDCalibraVector::ConvertVectorPHTGraphErrors(Int_t det, Int_t group
- , const Char_t * name)
+TGraphErrors *AliTRDCalibraVector::ConvertVectorPHTGraphErrors(Int_t det, Int_t group , const Char_t * name)
{
//
// Convert the fVectorPHMean, fVectorPHSquares and fVectorPHEntries in TGraphErrors
//
// Take the info
- fPHEntries[det] = ((TArrayI *)GetPHEntries(det,kTRUE));
- fPHMean[det] = ((TArrayF *)GetPHMean(det,kTRUE));
- fPHSquares[det] = ((TArrayF *)GetPHSquares(det,kTRUE));
+ fPHEntries[det] = ((AliTRDEntriesInfo *)GetPHEntries(det,kTRUE));
+ fPHMean[det] = ((AliTRDPhInfo *)GetPHMean(det,kTRUE));
+ fPHSquares[det] = ((AliTRDPhInfo *)GetPHSquares(det,kTRUE));
- // Init the stuff
- TGraphErrors *histo;
+ // Axis
Float_t sf = 10.0;
AliTRDCommonParam *parCom = AliTRDCommonParam::Instance();
if (!parCom) {
}
sf = parCom->GetSamplingFrequency();
// Axis
- Double_t *x;
- Double_t *y;
- Double_t *ex;
- Double_t *ey;
+ Double_t x[35]; // Xaxis
+ Double_t y[35]; // Sum/entries
+ Double_t ex[35]; // Nentries
+ Double_t ey[35]; // Sum of square/nentries
Double_t step = 0.0;
Double_t min = 0.0;
- x = new Double_t[fTimeMax]; // Xaxis
- y = new Double_t[fTimeMax]; // Sum/entries
- ex = new Double_t[fTimeMax]; // Nentries
- ey = new Double_t[fTimeMax]; // Sum of square/nentries
- step = 1.0 / sf;
+ if(sf > 0.0) step = 1.0 / sf;
min = 0.0;
Int_t offset = group*fTimeMax;
ey[k] = 0.0;
Int_t bin = offset+k;
// Fill only if there is more than 0 something
- if (fPHEntries[det]->At(bin) > 0) {
- ex[k] = ((TArrayI *)fPHEntries[det])->At(bin);
- y[k] = ((TArrayF *)fPHMean[det])->At(bin);
- ey[k] = ((TArrayF *)fPHSquares[det])->At(bin);
+ if (((AliTRDEntriesInfo *)fPHEntries[det])->At(bin) > 0) {
+ ex[k] = ((AliTRDEntriesInfo *)fPHEntries[det])->At(bin);
+ y[k] = ((AliTRDPhInfo *)fPHMean[det])->At(bin);
+ ey[k] = ((AliTRDPhInfo *)fPHSquares[det])->AtS(bin);
}
}
// Define the TGraphErrors
- histo = new TGraphErrors(fTimeMax,x,y,ex,ey);
- histo->SetTitle(name);
- return histo;
+ if(!fGraph) fGraph = new TGraphErrors(fTimeMax,&x[0],&y[0],&ex[0],&ey[0]);
+ else{
+ fGraph->~TGraphErrors();
+ new(fGraph) TGraphErrors(fTimeMax,&x[0],&y[0],&ex[0],&ey[0]);
+ }
+ fGraph->SetTitle(name);
+
+ return fGraph;
}
//_____________________________________________________________________________
-TGraphErrors *AliTRDCalibraVector::ConvertVectorPRFTGraphErrors(Int_t det, Int_t group
- , const Char_t * name)
+TGraphErrors *AliTRDCalibraVector::ConvertVectorPRFTGraphErrors(Int_t det, Int_t group , const Char_t * name)
{
//
// Convert the fVectorPRFMean, fVectorPRFSquares and fVectorPRFEntries in TGraphErrors
//
// Take the info
- fPRFEntries[det] = ((TArrayI *)GetPRFEntries(det,kTRUE));
- fPRFMean[det] = ((TArrayF *)GetPRFMean(det,kTRUE));
- fPRFSquares[det] = ((TArrayF *)GetPRFSquares(det,kTRUE));
+ fPRFEntries[det] = ((AliTRDEntriesInfo *)GetPRFEntries(det,kTRUE));
+ fPRFMean[det] = ((AliTRDPrfInfo *)GetPRFMean(det,kTRUE));
+ fPRFSquares[det] = ((AliTRDPrfInfo *)GetPRFSquares(det,kTRUE));
- // Init the stuff
- TGraphErrors *histo;
// Axis
- Double_t *x;
- Double_t *y;
- Double_t *ex;
- Double_t *ey;
+ Double_t x[200]; // Xaxis
+ Double_t y[200]; // Sum/entries
+ Double_t ex[200]; //Nentries
+ Double_t ey[200]; // Sum of square/nentries
Double_t step = 0.0;
Double_t min = 0.0;
- x = new Double_t[fNumberBinPRF]; // Xaxis
- y = new Double_t[fNumberBinPRF]; // Sum/entries
- ex = new Double_t[fNumberBinPRF]; // Nentries
- ey = new Double_t[fNumberBinPRF]; // Sum of square/nentries
- step = (2*TMath::Abs(fPRFRange)) / fNumberBinPRF;
+ if(fNumberBinPRF) step = (2*TMath::Abs(fPRFRange)) / fNumberBinPRF;
min = -TMath::Abs(fPRFRange) + step / 2.0;
Int_t offset = group*fNumberBinPRF;
//printf("number of total: %d\n",fNumberBinPRF);
ey[k] = 0.0;
Int_t bin = offset+k;
// Fill only if there is more than 0 something
- if (fPRFEntries[det]->At(bin) > 0) {
- ex[k] = ((TArrayF *)fPRFEntries[det])->At(bin);
- y[k] = ((TArrayF *)fPRFMean[det])->At(bin);
- ey[k] = ((TArrayF *)fPRFSquares[det])->At(bin);
+ if (((AliTRDEntriesInfo *)fPRFEntries[det])->At(bin) > 0) {
+ ex[k] = ((AliTRDEntriesInfo *)fPRFEntries[det])->At(bin);
+ y[k] = ((AliTRDPrfInfo *)fPRFMean[det])->At(bin);
+ ey[k] = ((AliTRDPrfInfo *)fPRFSquares[det])->At(bin);
}
//printf("Number of entries %f for %d\n",ex[k],k);
}
// Define the TGraphErrors
- histo = new TGraphErrors(fNumberBinPRF,x,y,ex,ey);
- histo->SetTitle(name);
- return histo;
+ if(!fGraph) fGraph = new TGraphErrors(fNumberBinPRF,&x[0],&y[0],&ex[0],&ey[0]);
+ else{
+ fGraph->~TGraphErrors();
+ new(fGraph) TGraphErrors(fNumberBinPRF,&x[0],&y[0],&ex[0],&ey[0]);
+ }
+ fGraph->SetTitle(name);
+
+ return fGraph;
+
+
+
+}
+//_____________________________________________________________________________
+TH1F *AliTRDCalibraVector::CorrectTheError(const TGraphErrors *hist, Int_t &nbEntries)
+{
+ //
+ // 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
+ //
+
+ 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();
+ nbEntries = 0;
+
+ if (nbins < 2) {
+ return 0x0;
+ }
+
+ Double_t step = x[1] - x[0];
+ Double_t minvalue = x[0] - step/2;
+ Double_t maxvalue = x[(nbins-1)] + step/2;
+
+ if(!fHisto) fHisto = new TH1F("projcorrecterror","",nbins,minvalue,maxvalue);
+ else{
+ fHisto->~TH1F();
+ new(fHisto) TH1F("projcorrecterror","",nbins,minvalue,maxvalue);
+ }
+
+ for (Int_t k = 0; k < nbins; k++) {
+ fHisto->SetBinContent(k+1,mean[k]);
+ if (entries[k] > 0.0) {
+ nbEntries += (Int_t) entries[k];
+ Double_t d = TMath::Abs(square[k] - (mean[k]*mean[k]));
+ fHisto->SetBinError(k+1,TMath::Sqrt(d/entries[k]));
+ }
+ else {
+ fHisto->SetBinError(k+1,0.0);
+ }
+ }
+ return fHisto;
+
}
//_____________________________________________________________________________
-TH1F *AliTRDCalibraVector::ConvertVectorCHHisto(Int_t det, Int_t group
- , const Char_t * name)
+TH1F *AliTRDCalibraVector::ConvertVectorCHHisto(Int_t det, Int_t group, const Char_t * name)
{
//
// Convert the fVectorCHEntries in TH1F
//
// Take the info
- fCHEntries[det] = ((TArrayI *)GetCHEntries(det,kTRUE));
+ fCHEntries[det] = ((AliTRDEntriesInfo *)GetCHEntries(det,kTRUE));
// Init the stuff
- TH1F *histo = new TH1F(name,name,fNumberBinCharge,0,300);
- histo->Sumw2();
+ if(!fHisto) fHisto = new TH1F(name,name,fNumberBinCharge,0,300);
+ else{
+ fHisto->~TH1F();
+ new(fHisto) TH1F(name,name,fNumberBinCharge,0,300);
+ }
+ fHisto->Sumw2();
Int_t offset = group*fNumberBinCharge;
// Fill histo
for (Int_t k = 0; k < fNumberBinCharge; k++) {
Int_t bin = offset+k;
- histo->SetBinContent(k+1,((TArrayI *)fCHEntries[det])->At(bin));
- histo->SetBinError(k+1,TMath::Sqrt(TMath::Abs(((TArrayI *)fCHEntries[det])->At(bin))));
+ fHisto->SetBinContent(k+1,((AliTRDEntriesInfo *)fCHEntries[det])->At(bin));
+ fHisto->SetBinError(k+1,TMath::Sqrt(TMath::Abs(((AliTRDEntriesInfo *)fCHEntries[det])->At(bin))));
}
- return histo;
+ return fHisto;
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetPHEntries(Int_t det
+TObject* AliTRDCalibraVector::GetPHEntries(Int_t det
, Bool_t force) /*FOLD00*/
{
//
// return pointer to Carge ROC Calibration
// if force is true create a new histogram if it doesn't exist allready
//
- TArrayI**arr = &fPHEntries[0];
- return GetEntriesPH(det, arr, force);
+ AliTRDEntriesInfo**arr = &fPHEntries[0];
+ return (TObject *) GetEntriesPH(det, arr, force);
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetPRFEntries(Int_t det
+TObject* AliTRDCalibraVector::GetPRFEntries(Int_t det
, Bool_t force) /*FOLD00*/
{
//
// return pointer to Carge ROC Calibration
// if force is true create a new histogram if it doesn't exist allready
//
- TArrayI**arr = &fPRFEntries[0];
- return GetEntriesPRF(det, arr, force);
+ AliTRDEntriesInfo**arr = &fPRFEntries[0];
+ return (TObject *) GetEntriesPRF(det, arr, force);
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetCHEntries(Int_t det
+TObject* AliTRDCalibraVector::GetCHEntries(Int_t det
, Bool_t force) /*FOLD00*/
{
//
// return pointer to Carge ROC Calibration
// if force is true create a new histogram if it doesn't exist allready
//
- TArrayI**arr = &fCHEntries[0];
- return GetEntriesCH(det, arr, force);
+ AliTRDEntriesInfo**arr = &fCHEntries[0];
+ return (TObject *) GetEntriesCH(det, arr, force);
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetPHMean(Int_t det
+TObject* AliTRDCalibraVector::GetPHMean(Int_t det
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to Carge ROC Calibration
- // if force is true create a new histogram if it doesn't exist allready
+ // return pointer to ROC Calibration
+ // if force is true create a new array
//
- TArrayF**arr = &fPHMean[0];
- return GetMeanSquaresPH(det, arr, force);
+ AliTRDPhInfo**arr = &fPHMean[0];
+ return (TObject *) GetMeanSquaresPH(det, arr, force);
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetPHSquares(Int_t det
+TObject* AliTRDCalibraVector::GetPHSquares(Int_t det
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to Carge ROC Calibration
- // if force is true create a new histogram if it doesn't exist allready
+ // return pointer to ROC Calibration
+ // if force is true create a new array
//
- TArrayF**arr = &fPHSquares[0];
- return GetMeanSquaresPH(det, arr, force);
+ AliTRDPhInfo**arr = &fPHSquares[0];
+ return (TObject *) GetMeanSquaresPH(det, arr, force);
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetPRFMean(Int_t det
+TObject* AliTRDCalibraVector::GetPRFMean(Int_t det
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to Carge ROC Calibration
- // if force is true create a new histogram if it doesn't exist allready
+ // return pointer to ROC Calibration
+ // if force is true create a new array
//
- TArrayF**arr = &fPRFMean[0];
- return GetMeanSquaresPRF(det, arr, force);
+ AliTRDPrfInfo**arr = &fPRFMean[0];
+ return (TObject *) GetMeanSquaresPRF(det, arr, force);
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetPRFSquares(Int_t det
+TObject* AliTRDCalibraVector::GetPRFSquares(Int_t det
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to Carge ROC Calibration
- // if force is true create a new histogram if it doesn't exist allready
+ // return pointer to ROC Calibration
+ // if force is true create a new array
//
- TArrayF**arr = &fPRFSquares[0];
- return GetMeanSquaresPRF(det, arr, force);
+ AliTRDPrfInfo**arr = &fPRFSquares[0];
+ return (TObject *) GetMeanSquaresPRF(det, arr, force);
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetEntriesCH(Int_t det
- , TArrayI** arr
- , Bool_t force) /*FOLD00*/
+AliTRDEntriesInfo* AliTRDCalibraVector::GetEntriesCH(Int_t det
+ , AliTRDEntriesInfo** arr
+ , Bool_t force) /*FOLD00*/
{
//
- // return pointer to TArrayI Entries
- // if force is true create a new TArrayI if it doesn't exist allready
+ // return pointer to UShort_t array Entries
+ // if force is true create a new UShort_t array if it doesn't exist allready
//
- if ( !force || (((TArrayI *)arr[det])->GetSize()>0))
- return (TArrayI*)arr[det];
+ if ( (!force) || (arr[det]))
+ return (AliTRDEntriesInfo*)arr[det];
- // if we are forced and TArrayI doesn't yes exist create it
- Int_t stack = GetStack(det);
- Int_t ngroup = 0;
- if(stack == 2) ngroup = fDetCha2[0]*fNumberBinCharge;
- else ngroup = fDetCha0[0]*fNumberBinCharge;
+ // if we are forced and TArrayI doesn't yes exist create it
+ Int_t ngroup = GetTotalNumberOfBinsInDetector(det,0,fNumberBinCharge);
// init
- ((TArrayI *)arr[det])->Set(ngroup);
- for(Int_t k = 0; k < ngroup; k++){
- ((TArrayI *)arr[det])->AddAt(0,k);
- }
- return (TArrayI*)arr[det];
+ arr[det] = new AliTRDEntriesInfo(ngroup);
+
+ return (AliTRDEntriesInfo*)arr[det];
+
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetEntriesPRF(Int_t det
- , TArrayI** arr
+AliTRDEntriesInfo* AliTRDCalibraVector::GetEntriesPRF(Int_t det
+ , AliTRDEntriesInfo** arr
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to TArrayI Entries
- // if force is true create a new TArrayI if it doesn't exist allready
+ // return pointer to UShort_t array Entries
+ // if force is true create a new UShort_t array if it doesn't exist allready
//
- if ( !force || (((TArrayI *)arr[det])->GetSize()>0))
- return (TArrayI*)arr[det];
+ if ( (!force) || (arr[det]))
+ return (AliTRDEntriesInfo*)arr[det];
// if we are forced and TArrayI doesn't yes exist create it
- Int_t stack = GetStack(det);
- Int_t ngroup = 0;
- if(stack == 2) ngroup = fDetCha2[2]*fNumberBinPRF;
- else ngroup = fDetCha0[2]*fNumberBinPRF;
+ Int_t ngroup = GetTotalNumberOfBinsInDetector(det,2,fNumberBinPRF);
// init
- ((TArrayI *)arr[det])->Set(ngroup);
- for(Int_t k = 0; k < ngroup; k++){
- ((TArrayI *)arr[det])->AddAt(0,k);
- }
- return (TArrayI*)arr[det];
+ arr[det] = new AliTRDEntriesInfo(ngroup);
+
+ return (AliTRDEntriesInfo*)arr[det];
}
//_____________________________________________________________________
-TArrayI* AliTRDCalibraVector::GetEntriesPH(Int_t det
- , TArrayI** arr
+AliTRDEntriesInfo *AliTRDCalibraVector::GetEntriesPH(Int_t det
+ , AliTRDEntriesInfo ** arr
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to TArrayI Entries
- // if force is true create a new TArrayI if it doesn't exist allready
+ // return pointer to UShort_t array Entries
+ // if force is true create a new UShort_t array if it doesn't exist allready
//
- if ( !force || (((TArrayI *)arr[det])->GetSize()>0))
- return (TArrayI*)arr[det];
-
- // if we are forced and TArrayI doesn't yes exist create it
- Int_t stack = GetStack(det);
- Int_t ngroup = 0;
- if(stack == 2) ngroup = fDetCha2[1]*fTimeMax;
- else ngroup = fDetCha0[1]*fTimeMax;
- // init
- ((TArrayI *)arr[det])->Set(ngroup);
- for(Int_t k = 0; k < ngroup; k++){
- ((TArrayI *)arr[det])->AddAt(0,k);
- }
- return (TArrayI*)arr[det];
+ if ( (!force) || (arr[det]))
+ return (AliTRDEntriesInfo *)arr[det];
+ // if we are forced and UShort_t doesn't yet exist create it
+ Int_t ngroup = GetTotalNumberOfBinsInDetector(det,1,fTimeMax);
+ // init
+ arr[det] = new AliTRDEntriesInfo(ngroup);
+
+ return (AliTRDEntriesInfo*)arr[det];
+
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetMeanSquaresPH(Int_t det
- , TArrayF** arr
+AliTRDPhInfo* AliTRDCalibraVector::GetMeanSquaresPH(Int_t det
+ , AliTRDPhInfo** arr
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to TArrayF Mean or Squares
- // if force is true create a new TArrayF if it doesn't exist allready
+ // return pointer to Float_t array Mean or Squares
+ // if force is true create a new Float_t array if it doesn't exist allready
//
- if ( !force || (((TArrayF *)arr[det])->GetSize()>0))
- return (TArrayF*)arr[det];
-
- // if we are forced and TArrayF doesn't yes exist create it
- Int_t stack = GetStack(det);
- Int_t ngroup = 0;
- if(stack == 2) ngroup = fDetCha2[1]*fTimeMax;
- else ngroup = fDetCha0[1]*fTimeMax;
+ if ( (!force) || (arr[det]))
+ return (AliTRDPhInfo*)arr[det];
+
+ // if we are forced and Float_t array doesn't yes exist create it
+ Int_t ngroup = GetTotalNumberOfBinsInDetector(det,1,fTimeMax);
// init
- ((TArrayF *)arr[det])->Set(ngroup);
- for(Int_t k = 0; k < ngroup; k++){
- ((TArrayF *)arr[det])->AddAt(0.0,k);
- }
- return ((TArrayF *)arr[det]);
+ arr[det] = new AliTRDPhInfo(ngroup);
+
+ return ((AliTRDPhInfo *)arr[det]);
}
//_____________________________________________________________________
-TArrayF* AliTRDCalibraVector::GetMeanSquaresPRF(Int_t det
- , TArrayF** arr
+AliTRDPrfInfo* AliTRDCalibraVector::GetMeanSquaresPRF(Int_t det
+ , AliTRDPrfInfo** arr
, Bool_t force) /*FOLD00*/
{
//
- // return pointer to TArrayF Mean or Squares
- // if force is true create a new TArrayF if it doesn't exist allready
+ // return pointer to Float_t array Mean or Squares
+ // if force is true create a new array if it doesn't exist allready
//
- if ( !force || (((TArrayF *)arr[det])->GetSize()>0))
+ if ( (!force) || (arr[det]))
return arr[det];
- // if we are forced and TArrayF doesn't yes exist create it
- Int_t stack = GetStack(det);
- Int_t ngroup = 0;
- if(stack == 2) ngroup = fDetCha2[2]*fNumberBinPRF;
- else ngroup = fDetCha0[2]*fNumberBinPRF;
+ // if we are forced and the array doesn't yet exist create it
+ Int_t ngroup = GetTotalNumberOfBinsInDetector(det,2,fNumberBinPRF);
// init
- ((TArrayF *)arr[det])->Set(ngroup);
- for(Int_t k = 0; k < ngroup; k++){
- ((TArrayF *)arr[det])->AddAt(0.0,k);
- }
- return ((TArrayF *)arr[det]);
+ arr[det] = new AliTRDPrfInfo(ngroup);
+
+ return (AliTRDPrfInfo*)arr[det];
+
}
//_____________________________________________________________________________
-Int_t AliTRDCalibraVector::GetStack(Int_t d) const
+Int_t AliTRDCalibraVector::GetTotalNumberOfBinsInDetector(Int_t det, Int_t i, Int_t nbBin) const
{
- //
- // Reconstruct the stack number from the detector number
- //
- return ((Int_t) (d % 30) / 6);
+ Int_t ngroup = 0;
+ Int_t stack = AliTRDgeometry::GetStack(det);
+ if(stack == 2) ngroup = fDetCha2[i]*nbBin;
+ else ngroup = fDetCha0[i]*nbBin;
+ return ngroup;
+
}
+//____________________________________________________________________________
+Int_t AliTRDCalibraVector::GetNz(Int_t i) const
+{
+ Int_t nz = 0;
+ if(i==0) nz = (Int_t)(fModeCH>>4);
+ if(i==1) nz = (Int_t)(fModePH>>4);
+ if(i==2) nz = (Int_t)(fModePRF>>4);
+
+ return nz;
+
+}
+//____________________________________________________________________________
+Int_t AliTRDCalibraVector::GetNrphi(Int_t i) const
+{
+
+ Int_t nrphi = 0;
+ if(i==0) nrphi = (Int_t)(fModeCH&15);
+ if(i==1) nrphi = (Int_t)(fModePH&15);
+ if(i==2) nrphi = (Int_t)(fModePRF&15);
+
+ return nrphi;
+
+}
+//_________________________________________________________________________________
+TString AliTRDCalibraVector::GetNamePH() const
+{
+
+ Int_t nz = GetNz(1);
+ Int_t nrphi = GetNrphi(1);
+
+ TString name("Nz");
+ name += nz;
+ name += "Nrphi";
+ name += nrphi;
+
+ return name;
+
+}
+//_________________________________________________________________________________
+TString AliTRDCalibraVector::GetNameCH() const
+{
+
+ Int_t nz = GetNz(0);
+ Int_t nrphi = GetNrphi(0);
+
+ TString name("Nz");
+ name += nz;
+ name += "Nrphi";
+ name += nrphi;
+
+ return name;
+
+}
+//_________________________________________________________________________________
+TString AliTRDCalibraVector::GetNamePRF() const
+{
+
+ Int_t nz = GetNz(2);
+ Int_t nrphi = GetNrphi(2);
+
+ TString name("Nz");
+ name += nz;
+ name += "Nrphi";
+ name += nrphi;
+ name += "Ngp";
+ name += fNbGroupPRF;
+
+ return name;
+
+}
+//____________________________________________________________________________
+void AliTRDCalibraVector::SetNzNrphi(Int_t i, Int_t nz, Int_t nrphi) {
+
+ if(i==0) {
+ fModeCH = nz;
+ fModeCH = fModeCH << 4;
+ fModeCH |= nrphi;
+ }
+ if(i==1) {
+ fModePH = nz;
+ fModePH = fModePH << 4;
+ fModePH |= nrphi;
+ }
+ if(i==2) {
+ fModePRF = nz;
+ fModePRF = fModePRF << 4;
+ fModePRF |= nrphi;
+ }
+
+}
class TH1F;
class TObjArray;
-class TArrayF;
-class TArrayI;
+class AliTRDPhInfo;
+class AliTRDEntriesInfo;
+class AliTRDPrfInfo;
class AliTRDCalibraVector : public TObject {
AliTRDCalibraVector& operator = (const AliTRDCalibraVector &source);
+ // Init
+ void TestInit(Int_t i, Int_t detmax);
+
// Fill
- Int_t SearchBin(Float_t value, Int_t i) const;
Bool_t UpdateVectorCH(Int_t det, Int_t group, Float_t value);
Bool_t UpdateVectorPRF(Int_t det, Int_t group, Float_t x, Float_t y);
Bool_t UpdateVectorPH(Int_t det, Int_t group, Int_t time, Float_t value);
-
+
+
+ Bool_t FillVectorCH(Int_t det, Int_t group, Int_t bin, Int_t entries);
+ Bool_t FillVectorPRF(Int_t det, Int_t group, Int_t bin, Int_t entries, Float_t mean, Float_t square);
+ Bool_t FillVectorPH(Int_t det, Int_t group, Int_t bin, Int_t entries, Float_t mean, Float_t square);
// Add
Bool_t Add(AliTRDCalibraVector *calvector);
+
+ AliTRDCalibraVector *AddStatsPerDetectorCH();
+ AliTRDCalibraVector *AddStatsPerDetectorPH();
+ AliTRDCalibraVector *AddStatsPerDetectorPRF();
+
// Fit
TGraphErrors *ConvertVectorPHTGraphErrors(Int_t det, Int_t group, const Char_t *name);
TGraphErrors *ConvertVectorPRFTGraphErrors(Int_t det, Int_t group, const Char_t *name);
+ TH1F *CorrectTheError(const TGraphErrors *hist, Int_t &nbEntries);
TH1F *ConvertVectorCHHisto(Int_t det, Int_t group, const Char_t *name);
+ // Find
+ Int_t SearchBin(Float_t value, Int_t i) const;
+ Bool_t FindTheMaxEntries(Int_t i, Int_t &detectormax, Int_t &groupmax);
+
//
// Set and Get methods
//
void SetPRFRange(Float_t prfrange) { fPRFRange = prfrange; }
void SetDetCha0(Int_t i, Short_t total) { fDetCha0[i] = total; }
void SetDetCha2(Int_t i, Short_t total) { fDetCha2[i] = total; }
- void SetNamePH(const char* name) { fNamePH = name; }
- void SetNamePRF(const char* name) { fNamePRF = name; }
- void SetNameCH(const char* name) { fNameCH = name; }
+ void SetNzNrphi(Int_t i, Int_t nz, Int_t nrphi);
+ void SetNbGroupPRF(Int_t nbGroup) { fNbGroupPRF = (UChar_t) nbGroup; }
Short_t GetNumberBinCharge()const { return fNumberBinCharge; }
Short_t GetNumberBinPRF()const { return fNumberBinPRF; }
Float_t GetPRFRange()const { return fPRFRange; }
Short_t GetDetCha0(Int_t i) const { return fDetCha0[i]; }
Short_t GetDetCha2(Int_t i) const { return fDetCha2[i]; }
- const char* GetNamePH() { return fNamePH; }
- const char* GetNamePRF() { return fNamePRF; }
- const char* GetNameCH() { return fNameCH; }
-
-
-
- TArrayI *GetPHEntries(Int_t det,Bool_t force = kFALSE);
- TArrayF *GetPHMean(Int_t det,Bool_t force = kFALSE);
- TArrayF *GetPHSquares(Int_t det,Bool_t force = kFALSE);
-
- TArrayI *GetPRFEntries(Int_t det,Bool_t force = kFALSE);
- TArrayF *GetPRFMean(Int_t det,Bool_t force = kFALSE);
- TArrayF *GetPRFSquares(Int_t det,Bool_t force = kFALSE);
-
- TArrayI *GetCHEntries(Int_t det,Bool_t force = kFALSE);
+ TString GetNamePH() const;
+ TString GetNamePRF() const;
+ TString GetNameCH() const;
+ Int_t GetNz(Int_t i) const;
+ Int_t GetNrphi(Int_t i) const;
+ Int_t GetNbGroupPRF() const { return (Int_t)fNbGroupPRF; }
+
+ Int_t GetTotalNumberOfBinsInDetector(Int_t det, Int_t i, Int_t nbBin) const;
+
+ TObject *GetPHEntries(Int_t det,Bool_t force = kFALSE);
+ TObject *GetPHMean(Int_t det,Bool_t force = kFALSE);
+ TObject *GetPHSquares(Int_t det,Bool_t force = kFALSE);
+
+ TObject *GetPRFEntries(Int_t det,Bool_t force = kFALSE);
+ TObject *GetPRFMean(Int_t det,Bool_t force = kFALSE);
+ TObject *GetPRFSquares(Int_t det,Bool_t force = kFALSE);
+
+ TObject *GetCHEntries(Int_t det,Bool_t force = kFALSE);
+
+
protected:
-
+
// Current data
-
- TArrayI *fPHEntries[540]; // Current AliTRDArrayI PH entries
- TArrayF *fPHMean[540]; // Current AliTRDArrayF PH Mean
- TArrayF *fPHSquares[540]; // Current AliTRDArrayF PH Squares
-
- TArrayI *fPRFEntries[540]; // Current AliTRDArrayI PH entries
- TArrayF *fPRFMean[540]; // Current AliTRDArrayF PH Mean
- TArrayF *fPRFSquares[540]; // Current AliTRDArrayF PH Squares
-
- TArrayI *fCHEntries[540]; // Current AliTRDArrayI PH entries
-
- const char *fNameCH; // Name for calibration mode
- const char *fNamePH; // Name for calibration mode
- const char *fNamePRF; // Name for calibration mode
-
- Int_t fDetectorPH; // Current detector
- Int_t fDetectorCH; // Current detector
- Int_t fDetectorPRF; // Current detector
-
+
+ AliTRDEntriesInfo *fPHEntries[540]; // PH entries
+ AliTRDPhInfo *fPHMean[540]; // PH Mean
+ AliTRDPhInfo *fPHSquares[540]; // PH Squares
+
+ AliTRDEntriesInfo *fPRFEntries[540]; // PRF entries
+ AliTRDPrfInfo *fPRFMean[540]; // PRF Mean
+ AliTRDPrfInfo *fPRFSquares[540]; // PRF Squares
+
+ AliTRDEntriesInfo *fCHEntries[540]; // CH entries
+
+ UChar_t fModeCH; // Calibration mode
+ UChar_t fModePH; // Calibration mode
+ UChar_t fModePRF; // Calibration mode
+ UChar_t fNbGroupPRF; // Nb of group PRD
+
+
+ Int_t fDetectorPH; //! Current detector
+ Int_t fDetectorCH; //! Current detector
+ Int_t fDetectorPRF; //! Current detector
+ Bool_t fStopFillCH; //! To know if we stop to fill
+ TH1F *fHisto; //! Histo to be fitted
+ TGraphErrors *fGraph; //! TGraphError
+ AliTRDCalibraVector *fCalVector; //! AliTRDCalibraVector
+
// Size of the infos
-
- Short_t fNumberBinCharge; // Number of bins for the gain factor
- Short_t fNumberBinPRF; // Number of bin for the PRF
- Int_t fTimeMax; // Number of time bins
- Float_t fPRFRange; // Range PRF
- Short_t fDetCha0[3]; // Number of XBins for chamber != 2
- Short_t fDetCha2[3]; // Number of Xbins for chamber 2
-
+
+ Short_t fNumberBinCharge; // Number of bins for the gain factor
+ Short_t fNumberBinPRF; // Number of bin for the PRF
+ Int_t fTimeMax; // Number of time bins
+ Float_t fPRFRange; // Range PRF
+ Short_t fDetCha0[3]; // Number of XBins for chamber != 2
+ Short_t fDetCha2[3]; // Number of Xbins for chamber 2
+
// Some functions
-
-
- TArrayI *GetEntriesPH(Int_t det, TArrayI** array, Bool_t force);
- TArrayF *GetMeanSquaresPH(Int_t det, TArrayF** array, Bool_t force);
-
- TArrayI *GetEntriesPRF(Int_t det, TArrayI** array, Bool_t force);
- TArrayF *GetMeanSquaresPRF(Int_t det, TArrayF** array, Bool_t force);
-
- TArrayI *GetEntriesCH(Int_t det, TArrayI** array, Bool_t force);
-
- // Some basic geometry function
- virtual Int_t GetStack(Int_t d) const;
- ClassDef(AliTRDCalibraVector,1) // TRD Calibration class
-
-};
+ AliTRDEntriesInfo *GetEntriesPH(Int_t det, AliTRDEntriesInfo** array, Bool_t force);
+ AliTRDPhInfo *GetMeanSquaresPH(Int_t det, AliTRDPhInfo** array, Bool_t force);
+
+ AliTRDEntriesInfo *GetEntriesPRF(Int_t det, AliTRDEntriesInfo** array, Bool_t force);
+ AliTRDPrfInfo *GetMeanSquaresPRF(Int_t det, AliTRDPrfInfo** array, Bool_t force);
+ AliTRDEntriesInfo *GetEntriesCH(Int_t det, AliTRDEntriesInfo** array, Bool_t force);
+
+ ClassDef(AliTRDCalibraVector,1) // TRD Calibration class
+
+ };
+
#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id: AliTRDEntriesInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Calibration base class for a single ROC //
+// Contains one UShort_t value per pad //
+// However, values are set and get as float, there are stored internally as //
+// (UShort_t) value * 10000 //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <TStyle.h>
+
+#include "AliTRDEntriesInfo.h"
+#include "TMath.h"
+#include "AliMathBase.h"
+#include "TLinearFitter.h"
+#include "TArrayI.h"
+#include "TH2F.h"
+#include "TH1F.h"
+#include "TArrayF.h"
+#include "TGraph2D.h"
+#include "TGraphDelaunay.h"
+#include "TList.h"
+
+#include "AliTRDCommonParam.h"
+#include "AliTRDpadPlane.h"
+#include "AliLog.h"
+
+ClassImp(AliTRDEntriesInfo)
+
+//_____________________________________________________________________________
+AliTRDEntriesInfo::AliTRDEntriesInfo()
+ :AliTRDUshortInfo()
+{
+ //
+ // Default constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDEntriesInfo::AliTRDEntriesInfo(Int_t n)
+ :AliTRDUshortInfo(n)
+{
+ //
+ // Constructor that initializes a given size
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDEntriesInfo::AliTRDEntriesInfo(const AliTRDEntriesInfo &c)
+ :AliTRDUshortInfo(c)
+{
+ //
+ // AliTRDEntriesInfo copy constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDEntriesInfo::~AliTRDEntriesInfo()
+{
+ //
+ // AliTRDEntriesInfo destructor
+ //
+
+
+}
+//_____________________________________________________________________________
+AliTRDEntriesInfo &AliTRDEntriesInfo::operator=(const AliTRDEntriesInfo &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((AliTRDEntriesInfo &) c).Copy(*this);
+ return *this;
+
+}
+//___________________________________________________________________________________
+Int_t AliTRDEntriesInfo::GetSum()
+{
+ //
+ // Calculate the sum of entries
+ //
+
+ Int_t total = 0;
+
+ for(Int_t k = 0; k < fSize; k++){
+ total += fData[k];
+ }
+
+
+ return total;
+
+}
+//____________________________________________________________________________________________
+Bool_t AliTRDEntriesInfo::TestAdd(const AliTRDEntriesInfo * info)
+{
+ //
+ // add values
+ //
+ for (Int_t idata = 0; idata< fSize; idata++){
+ if((At(idata)+info->At(idata)) > 65535) return kFALSE;
+ }
+ return kTRUE;
+}
+//____________________________________________________________________________________________
+void AliTRDEntriesInfo::Add(const AliTRDEntriesInfo * info)
+{
+ //
+ // add values
+ //
+ for (Int_t idata = 0; idata< fSize; idata++){
+ fData[idata] += info->At(idata);
+ }
+}
+//____________________________________________________________________________________________
+void AliTRDEntriesInfo::AddIf(const AliTRDEntriesInfo * info)
+{
+ //
+ // add values
+ //
+ for (Int_t idata = 0; idata< fSize; idata++){
+ if(((fData[idata]+info->At(idata)) <= 65535) && ((fData[idata]+info->At(idata)) >= 0)) fData[idata] += info->At(idata);
+ }
+}
--- /dev/null
+#ifndef ALITRDENTRIESINFO_H
+#define ALITRDENTRIESINFO_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDEntriesInfo.h 27946 2008-08-13 15:26:24Z cblume $ */
+
+//////////////////////////////////////////////////
+// //
+// TRD calibration base class for one ROC //
+// //
+//////////////////////////////////////////////////
+
+#include <AliTRDUshortInfo.h>
+
+//_____________________________________________________________________________
+class AliTRDEntriesInfo : public AliTRDUshortInfo
+{
+
+ public:
+
+ AliTRDEntriesInfo();
+ AliTRDEntriesInfo(Int_t n);
+ AliTRDEntriesInfo(const AliTRDEntriesInfo &c);
+ virtual ~AliTRDEntriesInfo();
+ AliTRDEntriesInfo &operator=(const AliTRDEntriesInfo &c);
+
+
+ Int_t At(Int_t bin) const { return (Int_t) fData[bin]; };
+
+ void AddAt(Int_t value, Int_t bin) { fData[bin] = (UShort_t) value; };
+
+ //
+ // statistic
+ //
+ Int_t GetSum();
+
+ // algebra
+ Bool_t TestAdd(const AliTRDEntriesInfo * info);
+ void Add(const AliTRDEntriesInfo *info);
+ void AddIf(const AliTRDEntriesInfo *info);
+
+ protected:
+
+ ClassDef(AliTRDEntriesInfo, 2)
+
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id: AliTRDPhInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Calibration base class for a single ROC //
+// Contains one UShort_t value per pad //
+// However, values are set and get as float, there are stored internally as //
+// (UShort_t) value * 10000 //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <TStyle.h>
+
+#include "AliTRDPhInfo.h"
+#include "TMath.h"
+#include "AliMathBase.h"
+#include "TLinearFitter.h"
+#include "TArrayI.h"
+#include "TH2F.h"
+#include "TH1F.h"
+#include "TArrayF.h"
+#include "TGraph2D.h"
+#include "TGraphDelaunay.h"
+#include "TList.h"
+
+#include "AliTRDCommonParam.h"
+#include "AliTRDpadPlane.h"
+#include "AliLog.h"
+
+ClassImp(AliTRDPhInfo)
+
+//_____________________________________________________________________________
+AliTRDPhInfo::AliTRDPhInfo()
+ :AliTRDUshortInfo()
+{
+ //
+ // Default constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDPhInfo::AliTRDPhInfo(Int_t n)
+ :AliTRDUshortInfo(n)
+{
+ //
+ // Constructor that initializes a given size
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDPhInfo::AliTRDPhInfo(const AliTRDPhInfo &c)
+ :AliTRDUshortInfo(c)
+{
+ //
+ // AliTRDPhInfo copy constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDPhInfo::~AliTRDPhInfo()
+{
+ //
+ // AliTRDPhInfo destructor
+ //
+
+
+}
+//_____________________________________________________________________________
+AliTRDPhInfo &AliTRDPhInfo::operator=(const AliTRDPhInfo &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((AliTRDPhInfo &) c).Copy(*this);
+ return *this;
+
+}
+
--- /dev/null
+#ifndef ALITRDPHINFO_H
+#define ALITRDPHINFO_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDPhInfo.h 27946 2008-08-13 15:26:24Z cblume $ */
+
+//////////////////////////////////////////////////
+// //
+// TRD calibration base class for one ROC //
+// //
+//////////////////////////////////////////////////
+
+#include <AliTRDUshortInfo.h>
+#include <TMath.h>
+
+//_____________________________________________________________________________
+class AliTRDPhInfo : public AliTRDUshortInfo
+{
+
+ public:
+
+ AliTRDPhInfo();
+ AliTRDPhInfo(Int_t n);
+ AliTRDPhInfo(const AliTRDPhInfo &c);
+ virtual ~AliTRDPhInfo();
+ AliTRDPhInfo &operator=(const AliTRDPhInfo &c);
+
+ Float_t At(Int_t bin) const { return (Float_t) (fData[bin]*3000.0/65535.0); };
+ Float_t AtS(Int_t bin) const { return (Float_t) (fData[bin]*3000.0/65535.0*fData[bin]*3000.0/65535.0); };
+
+ void AddAt(Float_t value, Int_t bin) { fData[bin] = (UShort_t) (value*65535.0/3000.0); };
+ void AddAtS(Float_t value, Int_t bin) { fData[bin] = (UShort_t) (TMath::Sqrt(TMath::Abs(value))*65535.0/3000.0); };
+
+
+ protected:
+
+ ClassDef(AliTRDPhInfo, 2)
+
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id: AliTRDPrfInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Calibration base class for a single ROC //
+// Contains one UShort_t value per pad //
+// However, values are set and get as float, there are stored internally as //
+// (UShort_t) value * 10000 //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <TStyle.h>
+
+#include "AliTRDPrfInfo.h"
+#include "TMath.h"
+#include "AliMathBase.h"
+#include "TLinearFitter.h"
+#include "TArrayI.h"
+#include "TH2F.h"
+#include "TH1F.h"
+#include "TArrayF.h"
+#include "TGraph2D.h"
+#include "TGraphDelaunay.h"
+#include "TList.h"
+
+#include "AliTRDCommonParam.h"
+#include "AliTRDpadPlane.h"
+#include "AliLog.h"
+
+ClassImp(AliTRDPrfInfo)
+
+//_____________________________________________________________________________
+AliTRDPrfInfo::AliTRDPrfInfo()
+ :TObject()
+ ,fSize(0)
+ ,fData(0)
+{
+ //
+ // Default constructor
+ //
+
+}
+
+//_____________________________________________________________________________
+AliTRDPrfInfo::AliTRDPrfInfo(Int_t n)
+ :TObject()
+ ,fSize(n)
+ ,fData(0)
+{
+ //
+ // Constructor that initializes a given size
+ //
+
+ fData = new UChar_t[n];
+ for(Int_t k = 0; k < fSize; k++){
+ fData[k] = 0;
+ }
+}
+//_____________________________________________________________________________
+AliTRDPrfInfo::AliTRDPrfInfo(const AliTRDPrfInfo &c)
+ :TObject(c)
+ ,fSize(c.fSize)
+ ,fData(0)
+{
+ //
+ // AliTRDPrfInfo copy constructor
+ //
+
+ Int_t iBin = 0;
+
+ fData = new UChar_t[fSize];
+ for (iBin = 0; iBin < fSize; iBin++) {
+ fData[iBin] = ((AliTRDPrfInfo &) c).fData[iBin];
+ }
+
+}
+//_____________________________________________________________________________
+AliTRDPrfInfo::~AliTRDPrfInfo()
+{
+ //
+ // AliTRDPrfInfo destructor
+ //
+
+ if (fData) {
+ delete [] fData;
+ fData = 0;
+ }
+
+}
+//_____________________________________________________________________________
+AliTRDPrfInfo &AliTRDPrfInfo::operator=(const AliTRDPrfInfo &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((AliTRDPrfInfo &) c).Copy(*this);
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDPrfInfo::Copy(TObject &c) const
+{
+ //
+ // Copy function
+ //
+
+ Int_t iBin = 0;
+
+ ((AliTRDPrfInfo &) c).fSize = fSize;
+
+ if (((AliTRDPrfInfo &) c).fData) delete [] ((AliTRDPrfInfo &) c).fData;
+ ((AliTRDPrfInfo &) c).fData = new UChar_t[fSize];
+ for (iBin = 0; iBin < fSize; iBin++) {
+ ((AliTRDPrfInfo &) c).fData[iBin] = fData[iBin];
+ }
+
+ TObject::Copy(c);
+
+}
+//_____________________________________________________________________________
+void AliTRDPrfInfo::SetSize(Int_t n)
+{
+ //
+ // Set the size
+ //
+
+ if(fData) delete [] fData;
+ fData = new UChar_t[n];
+
+ fSize = n;
+
+}
--- /dev/null
+#ifndef ALITRDPRFINFO_H
+#define ALITRDPRFINFO_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDPrfInfo.h 27946 2008-08-13 15:26:24Z cblume $ */
+
+//////////////////////////////////////////////////
+// //
+// TRD calibration base class for one ROC //
+// //
+//////////////////////////////////////////////////
+
+#include <TObject.h>
+
+
+//_____________________________________________________________________________
+class AliTRDPrfInfo : public TObject
+{
+
+ public:
+
+ AliTRDPrfInfo();
+ AliTRDPrfInfo(Int_t n);
+ AliTRDPrfInfo(const AliTRDPrfInfo &c);
+ virtual ~AliTRDPrfInfo();
+ AliTRDPrfInfo &operator=(const AliTRDPrfInfo &c);
+ virtual void Copy(TObject &c) const;
+
+ Int_t GetSize() const { return fSize; };
+ Float_t At(Int_t bin) const { return (Float_t) (fData[bin]/255.0); };
+
+ void AddAt(Float_t value, Int_t bin) { fData[bin] = (UChar_t) (value*255.0); };
+ void SetSize(Int_t size);
+
+ protected:
+
+ Int_t fSize; // Size
+ UChar_t *fData; //[fSize] Data
+
+ ClassDef(AliTRDPrfInfo, 2)
+
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id: AliTRDUshortInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Calibration base class for a single ROC //
+// Contains one UShort_t value per pad //
+// However, values are set and get as float, there are stored internally as //
+// (UShort_t) value * 10000 //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <TStyle.h>
+
+#include "AliTRDUshortInfo.h"
+#include "TMath.h"
+#include "AliMathBase.h"
+#include "TLinearFitter.h"
+#include "TArrayI.h"
+#include "TH2F.h"
+#include "TH1F.h"
+#include "TArrayF.h"
+#include "TGraph2D.h"
+#include "TGraphDelaunay.h"
+#include "TList.h"
+
+#include "AliTRDCommonParam.h"
+#include "AliTRDpadPlane.h"
+#include "AliLog.h"
+
+ClassImp(AliTRDUshortInfo)
+
+//_____________________________________________________________________________
+AliTRDUshortInfo::AliTRDUshortInfo()
+ :TObject()
+ ,fSize(0)
+ ,fData(0)
+{
+ //
+ // Default constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTRDUshortInfo::AliTRDUshortInfo(Int_t n)
+ :TObject()
+ ,fSize(n)
+ ,fData(0)
+{
+ //
+ // Constructor that initializes a given size
+ //
+
+ fData = new UShort_t[fSize];
+ for(Int_t k = 0; k < fSize; k++){
+ fData[k] = 0;
+ }
+}
+//_____________________________________________________________________________
+AliTRDUshortInfo::AliTRDUshortInfo(const AliTRDUshortInfo &c)
+ :TObject(c)
+ ,fSize(c.fSize)
+ ,fData(0)
+{
+ //
+ // AliTRDUshortInfo copy constructor
+ //
+
+ Int_t iBin = 0;
+
+ fData = new UShort_t[fSize];
+ for (iBin = 0; iBin < fSize; iBin++) {
+ fData[iBin] = ((AliTRDUshortInfo &) c).fData[iBin];
+ }
+
+}
+//_____________________________________________________________________________
+AliTRDUshortInfo::~AliTRDUshortInfo()
+{
+ //
+ // AliTRDUshortInfo destructor
+ //
+
+ if (fData) {
+ delete [] fData;
+ fData = 0;
+ }
+
+}
+//_____________________________________________________________________________
+AliTRDUshortInfo &AliTRDUshortInfo::operator=(const AliTRDUshortInfo &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((AliTRDUshortInfo &) c).Copy(*this);
+ return *this;
+
+}
+//_____________________________________________________________________________
+void AliTRDUshortInfo::Copy(TObject &c) const
+{
+ //
+ // Copy function
+ //
+
+ Int_t iBin = 0;
+
+ ((AliTRDUshortInfo &) c).fSize = fSize;
+
+ if (((AliTRDUshortInfo &) c).fData) delete [] ((AliTRDUshortInfo &) c).fData;
+ ((AliTRDUshortInfo &) c).fData = new UShort_t[fSize];
+ for (iBin = 0; iBin < fSize; iBin++) {
+ ((AliTRDUshortInfo &) c).fData[iBin] = fData[iBin];
+ }
+
+ TObject::Copy(c);
+
+}
+//_____________________________________________________________________________
+void AliTRDUshortInfo::SetSize(Int_t n)
+{
+ //
+ // Set the size
+ //
+
+ if(fData) delete [] fData;
+ fData = new UShort_t[n];
+
+ fSize = n;
+
+}
--- /dev/null
+#ifndef ALITRDUSHORTINFO_H
+#define ALITRDUSHORTINFO_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDUshortInfo.h 27946 2008-08-13 15:26:24Z cblume $ */
+
+//////////////////////////////////////////////////
+// //
+// TRD calibration base class for one ROC //
+// //
+//////////////////////////////////////////////////
+
+#include <TObject.h>
+
+//_____________________________________________________________________________
+class AliTRDUshortInfo : public TObject
+{
+
+ public:
+
+ AliTRDUshortInfo();
+ AliTRDUshortInfo(Int_t n);
+ AliTRDUshortInfo(const AliTRDUshortInfo &c);
+ virtual ~AliTRDUshortInfo();
+ AliTRDUshortInfo &operator=(const AliTRDUshortInfo &c);
+ virtual void Copy(TObject &c) const;
+
+ Int_t GetSize() const { return fSize; };
+
+ void SetSize(Int_t n);
+
+ protected:
+
+ Int_t fSize; // size
+ UShort_t *fData; //[fSize] Data
+
+ ClassDef(AliTRDUshortInfo, 2)
+
+};
+
+#endif
AliTRDCalibraVector.cxx
AliTRDCalibraVdriftLinearFit.cxx
AliTRDCalibPadStatus.cxx
+ AliTRDEntriesInfo.cxx
+ AliTRDPhInfo.cxx
+ AliTRDPrfInfo.cxx
+ AliTRDUshortInfo.cxx
AliTRDQAChecker.cxx
AliTRDPreprocessor.cxx
AliTRDSaxHandler.cxx
#pragma link C++ class AliTRDCalibraVdriftLinearFit+;
#pragma link C++ class AliTRDCalibPadStatus+;
+#pragma link C++ class AliTRDEntriesInfo+;
+#pragma link C++ class AliTRDPhInfo+;
+#pragma link C++ class AliTRDPrfInfo+;
+#pragma link C++ class AliTRDUshortInfo+;
+
#pragma link C++ class AliTRDPreprocessor+;
#pragma link C++ class AliTRDSaxHandler+;
AliTRDCalibraVector.cxx \
AliTRDCalibraVdriftLinearFit.cxx \
AliTRDCalibPadStatus.cxx \
+ AliTRDEntriesInfo.cxx \
+ AliTRDPhInfo.cxx \
+ AliTRDPrfInfo.cxx \
+ AliTRDUshortInfo.cxx \
AliTRDQAChecker.cxx \
AliTRDPreprocessor.cxx \
AliTRDSaxHandler.cxx \
#include "TObject.h"
#include "TFile.h"
#include "TObjArray.h"
+#include "TGraph.h"
+#include "TStyle.h"
+#include "TLegend.h"
+#include "TGraphErrors.h"
#include "AliTRDrecoTask.h"
#include "AliAnalysisManager.h"
#include "AliTRDcalibDB.h"
#include "AliTRDCalibraFillHisto.h"
+#include "AliTRDCalibraFit.h"
+#include "AliTRDCalibraVdriftLinearFit.h"
+#include "AliTRDCalibraMode.h"
+#include "AliTRDCalibraVector.h"
+#include "./Cal/AliTRDCalPad.h"
+#include "./Cal/AliTRDCalDet.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
#include "AliLog.h"
,ftrdTrack(0)
,fcl(0)
,fTRDCalibraFillHisto(0)
- ,fNbTRDTrackUsed(0)
+ ,fNbTRDTrack(0)
+ ,fNbTRDTrackOffline(0)
+ ,fNbTRDTrackStandalone(0)
+ ,fNbTRDTracklet(0)
+ ,fNbTRDTrackletOffline(0)
+ ,fNbTRDTrackletStandalone(0)
,fNbTimeBin(0x0)
+ ,fNbTimeBinOffline(0x0)
+ ,fNbTimeBinStandalone(0x0)
,fNbClusters(0)
+ ,fNbClustersOffline(0)
+ ,fNbClustersStandalone(0)
,fPHSum(0)
,fCHSum(0)
+ ,fDetSum(0)
+ ,fDetSumVector(0)
+ ,fHisto2d(kTRUE)
+ ,fVector2d(kFALSE)
+ ,fVdriftLinear(kTRUE)
,flow(0)
,fhigh(30)
,fNbTimeBins(30)
,ffillZero(kFALSE)
+ ,fnormalizeNbOfCluster(kFALSE)
+ ,fmaxCluster(0)
+ ,fOfflineTracks(kFALSE)
+ ,fStandaloneTracks(kFALSE)
+ ,fCompressPerDetector(kFALSE)
+ ,fRunNumber(0)
+ ,fNameDirectory("local://.")
+ ,fGraph(0x0)
+ ,fPostProcess(kFALSE)
{
// Constructor
+
+ fNRefFigures = 17;
+
+ for(Int_t k = 0; k < 3; k++)
+ {
+ fNz[k]=0;
+ fNrphi[k]=0;
+ }
+
}
+//________________________________________________________________________
+AliTRDcalibration::~AliTRDcalibration()
+{
+
+ if(fNbTRDTrack) delete fNbTRDTrack;
+ if(fNbTRDTrackOffline) delete fNbTRDTrackOffline;
+ if(fNbTRDTrackStandalone) delete fNbTRDTrackStandalone;
+ if(fNbTRDTracklet) delete fNbTRDTracklet;
+ if(fNbTRDTrackletOffline) delete fNbTRDTrackletOffline;
+ if(fNbTRDTrackletStandalone) delete fNbTRDTrackletStandalone;
+ if(fNbTimeBin) delete fNbTimeBin;
+ if(fNbTimeBinOffline) delete fNbTimeBinOffline;
+ if(fNbTimeBinStandalone) delete fNbTimeBinStandalone;
+ if(fNbClusters) delete fNbClusters;
+ if(fNbClustersOffline) delete fNbClustersOffline;
+ if(fNbClustersStandalone) delete fNbClustersStandalone;
+ if(fPHSum) delete fPHSum;
+ if(fCHSum) delete fCHSum;
+ if(fDetSum) delete fDetSum;
+ if(fDetSumVector) delete fDetSumVector;
+ if(fNameDirectory) delete fNameDirectory;
+ if(fGraph){fGraph->Delete(); delete fGraph;}
+}
//________________________________________________________________________
void AliTRDcalibration::CreateOutputObjects()
{
- OpenFile(0, "RECREATE");
+ OpenFile(0, "RECREATE");
+
// Number of time bins
AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
fNbTimeBins = cal->GetNumberOfTimeBins();
- // instance calibration
+ // instance calibration: what to calibrate
fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
- fTRDCalibraFillHisto->SetHisto2d(); // choose to use histograms
+ fTRDCalibraFillHisto->SetHisto2d(fHisto2d); // choose to use histograms
+ fTRDCalibraFillHisto->SetVector2d(fVector2d); // choose to use vectors
fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
fTRDCalibraFillHisto->SetPH2dOn(); // choose to calibrate the drift velocity
fTRDCalibraFillHisto->SetPRF2dOn(); // choose to look at the PRF
- fTRDCalibraFillHisto->Init2Dhistos(); // initialise the histos
- fTRDCalibraFillHisto->SetNumberClusters(flow); // At least 11 clusters
- fTRDCalibraFillHisto->SetNumberClustersf(fhigh); // At least 11 clusters
- fTRDCalibraFillHisto->SetFillWithZero(ffillZero); // Fill zeros
+ fTRDCalibraFillHisto->SetLinearFitterOn(fVdriftLinear); // Other possibility vdrift VDRIFT
+ fTRDCalibraFillHisto->SetLinearFitterDebugOn(fVdriftLinear); // Other possibility vdrift
+ // segmentation (should be per default the max and add at the end)
+ for(Int_t k = 0; k < 3; k++){
+ if(((fNz[k] != 10) && (fNrphi[k] != 10)) && ((fNz[k] != 100) && (fNrphi[k] != 100))) {
+ fTRDCalibraFillHisto->SetNz(k,fNz[k]); // Mode calibration
+ fTRDCalibraFillHisto->SetNrphi(k,fNrphi[k]); // Mode calibration
+ }
+ else {
+ if((fNz[k] == 100) && (fNrphi[k] == 100)) {
+ if(fVector2d) AliInfo("The mode all together is not supported by the vector method");
+ fTRDCalibraFillHisto->SetAllTogether(k);
+ }
+ if((fNz[k] == 10) && (fNrphi[k] == 10)) {
+ if(fVector2d) AliInfo("The mode per supermodule is not supported by the vector method");
+ fTRDCalibraFillHisto->SetPerSuperModule(k);
+ }
+ }
+ }
+
+ // Debug level
fTRDCalibraFillHisto->SetDebugLevel(fDebugLevel); //debug stuff
- fContainer = new TObjArray();
- fContainer->Add(fTRDCalibraFillHisto->GetCH2d()); //TH2I
- fContainer->Add(fTRDCalibraFillHisto->GetPH2d()); //TProfile2D
- fContainer->Add(fTRDCalibraFillHisto->GetPRF2d()); //TProfile2D
+ // Init the stuff
+ fTRDCalibraFillHisto->Init2Dhistos(); // initialise the histos
- //printf("create output objects 1\n");
+ // cuts
+ fTRDCalibraFillHisto->SetNumberClusters(flow); // At least flow clusters
+ fTRDCalibraFillHisto->SetNumberClustersf(fhigh); // The more fhigh clusters
+ fTRDCalibraFillHisto->SetFillWithZero(ffillZero); // Fill zeros
+ fTRDCalibraFillHisto->SetNormalizeNbOfCluster(fnormalizeNbOfCluster); // For iterations
- fNbTRDTrackUsed = new TH1F("TRDTrackUsed","TRDTrackUsed",50,0,50);
- fNbTRDTrackUsed->Sumw2();
- //
- fNbTimeBin = new TH1F("TimeBin","TimeBin",35,0,35);
- fNbTimeBin->Sumw2();
- //
- fNbClusters = new TH1F("NbClusters","",35,0,35);
- fNbClusters->Sumw2();
- //
- fPHSum = new TProfile2D("PH2dSum","Nz0Nrphi0"
- ,30,-0.05,(Double_t)fNbTimeBins/10.0-0.05
- ,540,0,540);
- fPHSum->SetYTitle("Det/pad groups");
- fPHSum->SetXTitle("time [#mus]");
- fPHSum->SetZTitle("<PH> [a.u.]");
- fPHSum->SetStats(0);
- //
- fCHSum = new TH2I("CH2dSum","Nz0Nrphi0",100,0,300,540,0,540);
- fCHSum->SetYTitle("Det/pad groups");
- fCHSum->SetXTitle("charge deposit [a.u]");
- fCHSum->SetZTitle("counts");
- fCHSum->SetStats(0);
- fCHSum->Sumw2();
+ // Add them to the container
+ fContainer = new TObjArray();
+ if(fHisto2d) {
+ fContainer->Add(fTRDCalibraFillHisto->GetCH2d()); //TH2I
+ fContainer->Add(fTRDCalibraFillHisto->GetPH2d()); //TProfile2D
+ fContainer->Add(fTRDCalibraFillHisto->GetPRF2d()); //TProfile2D
+ }
+ if(fVdriftLinear) fContainer->Add(fTRDCalibraFillHisto->GetVdriftLinearFit()); // Other drift velocity
+ if(fVector2d) fContainer->Add(fTRDCalibraFillHisto->GetCalibraVector()); //calibra vector
+
+ if(fDebugLevel) {
+
+ // Init the debug histos
+ fNbTRDTrack = new TH1F("TRDTrack","TRDTrack",500,0,500);
+ fNbTRDTrack->Sumw2();
+ fNbTRDTrackOffline = new TH1F("TRDTrackOffline","TRDTrackOffline",500,0,500);
+ fNbTRDTrackOffline->Sumw2();
+ fNbTRDTrackStandalone = new TH1F("TRDTrackStandalone","TRDTrackStandalone",500,0,500);
+ fNbTRDTrackStandalone->Sumw2();
+ //
+ fNbTRDTracklet = new TH1F("TRDTracklet","TRDTracklet",540,0.,540.);
+ fNbTRDTracklet->Sumw2();
+ fNbTRDTrackletOffline = new TH1F("TRDTrackletOffline","TRDTrackletOffline",540,0.,540.);
+ fNbTRDTrackletOffline->Sumw2();
+ fNbTRDTrackletStandalone = new TH1F("TRDTrackletStandalone","TRDTrackletStandalone",540,0.,540.);
+ fNbTRDTrackletStandalone->Sumw2();
+ //
+ fNbTimeBin = new TH1F("TimeBin","TimeBin",35,0,35);
+ fNbTimeBin->Sumw2();
+ fNbTimeBinOffline = new TH1F("TimeBinOffline","TimeBinOffline",35,0,35);
+ fNbTimeBinOffline->Sumw2();
+ fNbTimeBinStandalone = new TH1F("TimeBinStandalone","TimeBinStandalone",35,0,35);
+ fNbTimeBinStandalone->Sumw2();
+ //
+ fNbClusters = new TH1F("NbClusters","",35,0,35);
+ fNbClusters->Sumw2();
+ fNbClustersOffline = new TH1F("NbClustersOffline","",35,0,35);
+ fNbClustersOffline->Sumw2();
+ fNbClustersStandalone = new TH1F("NbClustersStandalone","",35,0,35);
+ fNbClustersStandalone->Sumw2();
+ //
+ fPHSum = new TProfile2D("PH2dSum","Nz0Nrphi0"
+ ,fNbTimeBins,-0.05,(Double_t)(fNbTimeBins/10.0)-0.05
+ ,540,0,540);
+ fPHSum->SetYTitle("Det/pad groups");
+ fPHSum->SetXTitle("time [#mus]");
+ fPHSum->SetZTitle("<PH> [a.u.]");
+ fPHSum->SetStats(0);
+ //
+ fCHSum = new TH2I("CH2dSum","Nz0Nrphi0",100,0,300,540,0,540);
+ fCHSum->SetYTitle("Det/pad groups");
+ fCHSum->SetXTitle("charge deposit [a.u]");
+ fCHSum->SetZTitle("counts");
+ fCHSum->SetStats(0);
+ fCHSum->Sumw2();
+
+ // Add them
+ fContainer->Add(fNbTRDTrack);
+ fContainer->Add(fNbTRDTrackOffline);
+ fContainer->Add(fNbTRDTrackStandalone);
+ fContainer->Add(fNbTRDTracklet);
+ fContainer->Add(fNbTRDTrackletOffline);
+ fContainer->Add(fNbTRDTrackletStandalone);
+ fContainer->Add(fNbTimeBin);
+ fContainer->Add(fNbTimeBinOffline);
+ fContainer->Add(fNbTimeBinStandalone);
+ fContainer->Add(fNbClusters);
+ fContainer->Add(fNbClustersOffline);
+ fContainer->Add(fNbClustersStandalone);
+ fContainer->Add(fPHSum);
+ fContainer->Add(fCHSum);
+
+ }
- fContainer->Add(fNbTRDTrackUsed);
- fContainer->Add(fNbTimeBin);
- fContainer->Add(fNbClusters);
- fContainer->Add(fPHSum);
- fContainer->Add(fCHSum);
- //printf("create output objects 2\n");
-
}
//________________________________________________________________________
void AliTRDcalibration::Exec(Option_t *)
{
+
+ if(!fTracks) return;
- Int_t nbTrdTracksUsed = 0;
+ // In total
+ Int_t nbTrdTracks = 0;
+ // standalone
+ Int_t nbTrdTracksStandalone = 0;
+ // offline
+ Int_t nbTrdTracksOffline = 0;
+
+ //
+ // Loop on track in the event
+ //
+ //printf("Total of %d\n",fTracks->GetEntriesFast());
for(Int_t itrk=0; itrk < fTracks->GetEntriesFast(); itrk++){
+ //printf("itrk %d\n",itrk);
+
fTrackInfo = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk);
ftrdTrack = fTrackInfo->GetTrack();
if(!ftrdTrack) continue;
- nbTrdTracksUsed++;
+
+ nbTrdTracks++;
+
fTRDCalibraFillHisto->UpdateHistogramsV1(ftrdTrack);
-
- const AliTRDseedV1 *tracklet = 0x0;
- for(Int_t itr = 0; itr < AliTRDgeometry::kNlayer; itr++){
- if(!(tracklet = ftrdTrack->GetTracklet(itr))) continue;
- if(!tracklet->IsOK()) continue;
- Int_t nbclusters = 0;
- // For PH
- Double_t phtb[AliTRDseedV1::kNtb];
- memset(phtb, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
-
- // For CH
- Double_t sum = 0.0;
- // normalisation
- Float_t normalisation = 6.67;
- Int_t detector = 0;
- for(int ic=0; ic<AliTRDseedV1::kNclusters; ic++){
- if(!(fcl = tracklet->GetClusters(ic))) continue;
- nbclusters++;
- Int_t time = fcl->GetPadTime();
- Float_t ch = tracklet->GetdQdl(ic);
- detector = fcl->GetDetector();
- if((time>-1) && (time<fNbTimeBins)) phtb[time]=ch/normalisation;
- sum += ch/normalisation;
- //printf("time %d\n",time);
- fNbTimeBin->Fill(time);
- }
- fNbClusters->Fill(nbclusters);
- if((nbclusters > flow) && (nbclusters < fhigh)){
- fCHSum->Fill(sum/20.0,0.0);
- for(int ic=0; ic<fNbTimeBins; ic++){
- if(ffillZero) fPHSum->Fill((Double_t)ic/10.0,0.0,(Double_t)phtb[ic]);
- else {
- if(phtb[ic] > 0.0) fPHSum->Fill((Double_t)ic/10.0,0.0,(Double_t)phtb[ic]);
- }
- }
+
+ if(fDebugLevel) {
+
+ Bool_t standalonetracklet = kFALSE;
+ const AliTRDseedV1 *tracklet = 0x0;
+ //
+ // Loop on tracklet in the event
+ //
+ for(Int_t itr = 0; itr < 6; itr++){
+ //printf("itr %d\n",itr);
+ if(!(tracklet = ftrdTrack->GetTracklet(itr))) continue;
+ if(!tracklet->IsOK()) continue;
+ // standalone
+ if(tracklet->IsStandAlone()) standalonetracklet = kTRUE;
+ Int_t nbclusters = 0;
+ // For PH
+ Double_t phtb[AliTRDseedV1::kNtb];
+ memset(phtb, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
+ // For CH
+ Double_t sum = 0.0;
+ // normalisation
+ Float_t normalisation = 6.67;
+ Int_t detector = 0;
+ Int_t crossrow = 0;
+ for(int ic=0; ic<AliTRDseedV1::kNtb; ic++){
+ // Check no shared clusters
+ for(int icc=AliTRDseedV1::kNtb; icc<AliTRDseedV1::kNclusters; icc++){
+ if((fcl = tracklet->GetClusters(icc))) crossrow = 1;
+ }
+ if(!(fcl = tracklet->GetClusters(ic))) continue;
+ nbclusters++;
+ Int_t time = fcl->GetPadTime();
+ Float_t ch = tracklet->GetdQdl(ic);
+ Float_t qcl = TMath::Abs(fcl->GetQ());
+ detector = fcl->GetDetector();
+ if((time>-1) && (time<fNbTimeBins)) phtb[time]=qcl;
+ sum += ch/normalisation;
+ fNbTimeBin->Fill(time);
+ if(tracklet->IsStandAlone()) fNbTimeBinStandalone->Fill(time);
+ else fNbTimeBinOffline->Fill(time);
+ }
+
+ fNbTRDTracklet->Fill(detector);
+ if(tracklet->IsStandAlone()) fNbTRDTrackletStandalone->Fill(detector);
+ else fNbTRDTrackletOffline->Fill(detector);
+
+ fNbClusters->Fill(nbclusters);
+ if(tracklet->IsStandAlone()) fNbClustersStandalone->Fill(nbclusters);
+ else fNbClustersOffline->Fill(nbclusters);
+
+ if((nbclusters > flow) && (nbclusters < fhigh)){
+ fCHSum->Fill(sum/20.0,0.0);
+ for(int ic=0; ic<fNbTimeBins; ic++){
+ //printf("ic %d and time %f and cluster %f \n",ic,(Double_t)(ic/10.0),(Double_t)phtb[ic]);
+ if(ffillZero) fPHSum->Fill((Double_t)(ic/10.0),0.0,(Double_t)phtb[ic]);
+ else {
+ if(phtb[ic] > 0.0) fPHSum->Fill((Double_t)(ic/10.0),0.0,(Double_t)phtb[ic]);
+ }
+ }
+ }
}
+
+ if(standalonetracklet) nbTrdTracksStandalone++;
+ else nbTrdTracksOffline++;
+
}
+
}
- //Fill Histos
- fNbTRDTrackUsed->Fill(nbTrdTracksUsed);
-
+ if(fDebugLevel) {
+
+ //Fill Histos
+ fNbTRDTrack->Fill(nbTrdTracks);
+ fNbTRDTrackStandalone->Fill(nbTrdTracksStandalone);
+ fNbTRDTrackOffline->Fill(nbTrdTracksOffline);
+
+ }
+
+ //printf("Nbof tracks %d\n",nbTrdTracks);
+ TFile *file = TFile::Open("test.root","RECREATE");
+ fContainer->Write();
+ file->Close();
+
// Post output data
PostData(0, fContainer);
+
+ //printf("post container\n");
}
//________________________________________________________________________
//printf("terminate\n");
if(fTRDCalibraFillHisto) fTRDCalibraFillHisto->DestroyDebugStreamer();
+
+}
+//________________________________________________________
+Bool_t AliTRDcalibration::GetRefFigure(Int_t ifig)
+{
- /*
- fContainer = dynamic_cast<TList*> (GetOutputData(0));
+ //
+ // Draw filled histos
+ //
+
+ gStyle->SetPalette(1);
+ gStyle->SetOptStat(1111);
+ gStyle->SetPadBorderMode(0);
+ gStyle->SetCanvasColor(10);
+ gStyle->SetPadLeftMargin(0.13);
+ gStyle->SetPadRightMargin(0.13);
+
+ if(!fContainer) return kFALSE;
+
+ switch(ifig){
+ case kNbTrack:{
+ TCanvas *c0 = new TCanvas("c0","c0",10,10,510,510);
+ TLegend *legNbTrack = new TLegend(.7, .7, .98, .98);
+ legNbTrack->SetBorderSize(1);
+ TH1F *h = 0x0;
+ TH1F *ho = 0x0;
+ TH1F *hs = 0x0;
+ if(!(h = (TH1F *)fContainer->FindObject("TRDTrack"))) break;
+ if(!(ho = (TH1F *)fContainer->FindObject("TRDTrackOffline"))) break;
+ if(!(hs = (TH1F *)fContainer->FindObject("TRDTrackStandalone"))) break;
+ c0->cd();
+ //gPad->SetLogy();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ h->Draw();
+ ho->Draw("same");
+ hs->Draw("same");
+ legNbTrack->AddEntry(h, "all", "p");
+ legNbTrack->AddEntry(ho, "offline", "p");
+ legNbTrack->AddEntry(hs, "standalone", "p");
+ legNbTrack->Draw("same");
+ return kTRUE;
+ }
+ case kNbTracklet:{
+ TLegend *legNbTracklet = new TLegend(.7, .7, .98, .98);
+ legNbTracklet->SetBorderSize(1);
+ TH1F *h = 0x0;
+ TH1F *ho = 0x0;
+ TH1F *hs = 0x0;
+ if(!(h = (TH1F *)fContainer->FindObject("TRDTracklet"))) break;
+ if(!(ho = (TH1F *)fContainer->FindObject("TRDTrackletOffline"))) break;
+ if(!(hs = (TH1F *)fContainer->FindObject("TRDTrackletStandalone"))) break;
+ h->Draw();
+ ho->Draw("same");
+ hs->Draw("same");
+ legNbTracklet->AddEntry(h, "all", "p");
+ legNbTracklet->AddEntry(ho, "offline", "p");
+ legNbTracklet->AddEntry(hs, "standalone", "p");
+ legNbTracklet->Draw("same");
+ gPad->SetLogy();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ return kTRUE;
+ }
+ case kNbTimeBin:{
+ TLegend *legNbTimeBin = new TLegend(.7, .7, .98, .98);
+ legNbTimeBin->SetBorderSize(1);
+ TH1F *h = 0x0;
+ TH1F *ho = 0x0;
+ TH1F *hs = 0x0;
+ if(!(h = (TH1F *)fContainer->FindObject("TimeBin"))) break;
+ if(!(ho = (TH1F *)fContainer->FindObject("TimeBinOffline"))) break;
+ if(!(hs = (TH1F *)fContainer->FindObject("TimeBinStandalone"))) break;
+ h->Draw();
+ ho->Draw("same");
+ hs->Draw("same");
+ legNbTimeBin->AddEntry(h, "all", "p");
+ legNbTimeBin->AddEntry(ho, "offline", "p");
+ legNbTimeBin->AddEntry(hs, "standalone", "p");
+ legNbTimeBin->Draw("same");
+ //gPad->SetLogy();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ return kTRUE;
+ }
+ case kNbClusters:{
+ TLegend *legNbClusters = new TLegend(.7, .7, .98, .98);
+ legNbClusters->SetBorderSize(1);
+ TH1F *h = 0x0;
+ TH1F *ho = 0x0;
+ TH1F *hs = 0x0;
+ if(!(h = (TH1F *)fContainer->FindObject("NbClusters"))) break;
+ if(!(ho = (TH1F *)fContainer->FindObject("NbClustersOffline"))) break;
+ if(!(hs = (TH1F *)fContainer->FindObject("NbClustersStandalone"))) break;
+ h->Draw();
+ ho->Draw("same");
+ hs->Draw("same");
+ legNbClusters->AddEntry(h, "all", "p");
+ legNbClusters->AddEntry(ho, "offline", "p");
+ legNbClusters->AddEntry(hs, "standalone", "p");
+ legNbClusters->Draw("same");
+ gPad->SetLogy();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ return kTRUE;
+ }
+ case kPHSum:{
+ TProfile2D *h = 0x0;
+ if(!(h = (TProfile2D *)fContainer->FindObject("PH2dSum"))) break;
+ TH1D *projh = h->ProjectionX("projh",1,1,"e");
+ projh->Draw();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ return kTRUE;
+ }
+ case kCHSum:{
+ TH2I *h = 0x0;
+ if(!(h = (TH2I *)fContainer->FindObject("CH2dSum"))) break;
+ TH1D *projh = h->ProjectionX("projhh",1,1,"e");
+ projh->Draw();
+ gPad->SetGridy();
+ gPad->SetGridx();
+ return kTRUE;
+ }
+ case kPH2D:{
+ if(!fHisto2d) {
+ AliInfo("Histo was not filled!");
+ break;
+ }
+ TProfile2D *h = 0x0;
+ if(!(h = (TProfile2D *)fContainer->FindObject("PH2d"))) break;
+ h->Draw("lego");
+ return kTRUE;
+ }
+ case kCH2D:{
+ if(!fHisto2d) {
+ AliInfo("Histo was not filled!");
+ break;
+ }
+ TH2I *h = 0x0;
+ if(!(h = (TH2I *)fContainer->FindObject("CH2d"))) break;
+ h->Draw("lego");
+ return kTRUE;
+ }
+ case kPRF2D:{
+ if(!fHisto2d) {
+ AliInfo("Histo was not filled!");
+ break;
+ }
+ TProfile2D *h = 0x0;
+ if(!(h = (TProfile2D *)fContainer->FindObject("PRF2d"))) break;
+ h->Draw("lego");
+ return kTRUE;
+ }
+ case kPH2DVector:{
+ if(!fVector2d) {
+ AliInfo("vector was not filled!");
+ break;
+ }
+ AliTRDCalibraVector *v = 0x0;
+ TGraphErrors *vdet = 0x0;
+ if(!(v = (AliTRDCalibraVector *)fContainer->FindObject("AliTRDCalibraVector"))) break;
+ Int_t detectormax = -1;
+ Int_t groupmax = -1;
+ if(!v->FindTheMaxEntries(1,detectormax,groupmax)) break;
+ if(!(vdet = v->ConvertVectorPHTGraphErrors((Int_t)detectormax,groupmax,"plotPH2dVector"))) break;
+ Int_t nbeentries = 0;
+ TH1F *ko = v->CorrectTheError(vdet,nbeentries);
+ ko->Draw();
+ AliInfo(Form("There are %d entries in the detector %d and group %d",nbeentries,detectormax,groupmax));
+ return kTRUE;
+ }
+case kCH2DVector:{
+ if(!fVector2d) {
+ AliInfo("vector was not filled!");
+ break;
+ }
+ AliTRDCalibraVector *v = 0x0;
+ TH1F *vdet = 0x0;
+ if(!(v = (AliTRDCalibraVector *)fContainer->FindObject("AliTRDCalibraVector"))) break;
+ Int_t detectormax = -1;
+ Int_t groupmax = -1;
+ if(!v->FindTheMaxEntries(0,detectormax,groupmax)) break;
+ if(!(vdet = v->ConvertVectorCHHisto((Int_t)detectormax,groupmax,"plotCH2dVector"))) break;
+ vdet->Draw();
+ AliInfo(Form("The detectormax and groupmax are %d and %d",detectormax,groupmax));
+ return kTRUE;
+ }
+ case kPRF2DVector:{
+ if(!fVector2d) {
+ AliInfo("vector was not filled!");
+ break;
+ }
+ AliTRDCalibraVector *v = 0x0;
+ TGraphErrors *vdet = 0x0;
+ if(!(v = (AliTRDCalibraVector *)fContainer->FindObject("AliTRDCalibraVector"))) break;
+ Int_t detectormax = -1;
+ Int_t groupmax = -1;
+ Int_t nbeentries = 0;
+ if(!v->FindTheMaxEntries(2,detectormax,groupmax)) break;
+ if(!(vdet = v->ConvertVectorPRFTGraphErrors((Int_t)detectormax,groupmax,"plotPRF2dVector"))) break;
+ TH1F *ko = v->CorrectTheError(vdet,nbeentries);
+ ko->Draw();
+ AliInfo(Form("The detectormax and groupmax are %d and %d",detectormax,groupmax));
+ return kTRUE;
+ }
+ case kLinearFitter:{
+ if(!fVdriftLinear) {
+ AliInfo("vdrift linear was not filled!");
+ break;
+ }
+ AliTRDCalibraVdriftLinearFit *h = 0x0;
+ TH2F *hdetector = 0x0;
+ if(!(h = (AliTRDCalibraVdriftLinearFit *)fContainer->FindObject("AliTRDCalibraVdriftLinearFit"))) break;
+ Double_t entries[540];
+ for(Int_t k = 0; k < 540; k++){
+ entries[k] = 0.0;
+ hdetector = 0x0;
+ if(!(hdetector = h->GetLinearFitterHisto(k,kFALSE))) continue;
+ entries[k] = hdetector->GetEntries();
+ }
+ Double_t max = -10.0;
+ Double_t detectormax = -1;
+ for(Int_t k = 0; k < 540; k++){
+ if(entries[k] > max) {
+ max = entries[k];
+ detectormax = k;
+ }
+ }
+ hdetector = 0x0;
+ if((max == 0.0) || (detectormax <0.0) || (detectormax >=540.0)) break;
+ if(!(hdetector = h->GetLinearFitterHisto((Int_t)detectormax,kFALSE))) break;
+ AliInfo(Form("The detector with the maximum of entries is %d",detectormax));
+ hdetector->Draw();
+ return kTRUE;
+ }
+ case kGainFactor:{
+ if(!fPostProcess){
+ if(!PostProcess()) break;
+ }
+ TGraph *fgain = (TGraph *) fGraph->At(0);
+ if(!fgain) break;
+ fgain->Draw("ALP");
+ return kTRUE;
+ }
+ case kVdriftT0Factor:{
+ if(!fPostProcess){
+ if(!PostProcess()) break;
+ }
+ TCanvas *c = new TCanvas("c","c",10,10,510,510);
+ c->Divide(2,1);
+ TGraph *fvd = (TGraph *) fGraph->At(1);
+ if(fvd){
+ c->cd(1);
+ fvd->Draw("ALP");
+ }
+ TGraph *ft0 = (TGraph *) fGraph->At(2);
+ if(ft0){
+ c->cd(2);
+ ft0->Draw("ALP");
+ }
+ return kTRUE;
+ }
+ case kVdriftLorentzAngleFactor:{
+ if(!fVdriftLinear) {
+ AliInfo("vdrift linear was not filled!");
+ break;
+ }
+ if(!fPostProcess){
+ if(!PostProcess()) break;
+ }
+ TCanvas *c = new TCanvas("c","c",10,10,510,510);
+ c->Divide(2,1);
+ TGraph *fvdl = (TGraph *) fGraph->At(3);
+ if(fvdl){
+ c->cd(1);
+ fvdl->Draw("ALP");
+ }
+ TGraph *flal = (TGraph *) fGraph->At(4);
+ if(flal){
+ c->cd(2);
+ flal->Draw("ALP");
+ }
+ return kTRUE;
+ }
+ case kPRFFactor:{
+ if(!fPostProcess){
+ if(!PostProcess()) break;
+ }
+ TGraph *fprf = (TGraph *) fGraph->At(5);
+ if(!fprf) break;
+ fprf->Draw("ALP");
+ return kTRUE;
+ }
+ }
+
+ return kFALSE;
+
+}
+//________________________________________________________________________
+Bool_t AliTRDcalibration::PostProcess()
+{
+
+ //
+ // Fit the filled histos
+ //
+ if(!fGraph){
+ fGraph = new TObjArray(6);
+ fGraph->SetOwner();
+ }
+ else {
+ delete fGraph;
+ PostProcess();
+ }
+
+ Bool_t storage[3] = {kFALSE,kFALSE,kFALSE};
+
+ // storage element
+ AliCDBManager *man = AliCDBManager::Instance();
+ man->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBStorage* storLoc = man->GetStorage(fNameDirectory);
+ if (!storLoc)
+ return kFALSE;
+ man->SetRun(fRunNumber);
+
+ // MetaData
+ AliCDBMetaData mdDet;
+ mdDet.SetObjectClassName("AliTRDCalDet");
+ AliCDBMetaData mdPad;
+ mdPad.SetObjectClassName("AliTRDCalPad");
+
+ // Objects for fitting
+ AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
+ calibra->SetDebugLevel(2); // 0 rien, 1 fitvoir, 2 debug files, 3 one detector
+
+ // Take the stuff
if (!fContainer) {
- Printf("ERROR: fList not available");
- return;
+ Printf("ERROR: list not available");
+ return kFALSE;
+ }
+
+ if(fHisto2d && fVector2d) AliInfo("We will only look at histos. Set fHisto2d off if you don't want");
+ AliTRDCalibraVector *calibraVector = 0x0;
+ if(fVector2d) calibraVector = (AliTRDCalibraVector *) fContainer->FindObject("CalibraVector");
+ //
+ // GAIN TH2I
+ //
+ Bool_t pass = kFALSE;
+ AliTRDCalibraVector *vvect = 0x0;
+ if(fHisto2d) {
+ TH2I *histogain = (TH2I *) fContainer->FindObject("CH2d");
+ if(histogain) {
+ histogain->SetDirectory(0);
+ calibra->SetMinEntries(20);
+ if(fCompressPerDetector){
+ if(AddStatsPerDetector(histogain)) pass = calibra->AnalyseCH(fCHSum);
+ }
+ else pass = calibra->AnalyseCH(histogain);
+ }
+ }
+ else {
+ if(fVector2d && calibraVector) {
+ calibra->SetMinEntries(20);
+ if(fCompressPerDetector){
+ if(!(vvect = calibraVector->AddStatsPerDetectorCH())) return kFALSE;
+ pass = calibra->AnalyseCH(vvect);
+ }
+ else pass = calibra->AnalyseCH(calibraVector);
+ }
+ }
+
+ if(pass)
+ {
+ Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0))
+ + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0));
+ Int_t nbfit = calibra->GetNumberFit(); //Number of fits
+ Int_t nbE = calibra->GetNumberEnt(); //Number of detector mit entries
+ // enough statistics
+ if ((nbtg > 0) &&
+ (nbfit >= 0.001*nbE))
+ {
+ // create the cal objects
+ calibra->PutMeanValueOtherVectorFit(1,kTRUE);
+ TObjArray object = calibra->GetVectorFit();
+ AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object);
+ TObject *objgainpad = calibra->CreatePadObjectGain();
+ // store
+ AliCDBId id1("TRD/Calib/ChamberGainFactor",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objgaindet, id1, &mdDet);
+ AliCDBId id2("TRD/Calib/LocalGainFactor",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objgainpad, id2, &mdPad);
+ storage[0] = kTRUE;
+ // Make graph
+ TGraph *graph = 0x0;
+ if(FillGraphIndex(&object,graph)){
+ fGraph->AddAt(graph,0);
+ }
+ }//if(enough statistics?)
+ calibra->ResetVectorFit();
+ }
+ else return kFALSE;
+
+ //
+ // VDRIFT average pulse height
+ //
+ pass = kFALSE;
+ if(fHisto2d) {
+ TProfile2D *histodriftvelocity = (TProfile2D *) fContainer->FindObject("PH2d");
+ if(histodriftvelocity) {
+ histodriftvelocity->SetDirectory(0);
+ calibra->SetMinEntries(20*20);
+ if(fCompressPerDetector){
+ if(AddStatsPerDetector(histodriftvelocity,1)) {
+ pass = calibra->AnalysePH(fDetSumVector);
+ }
+ }
+ else pass = calibra->AnalysePH(histodriftvelocity);
+ }
}
- */
+ else {
+ if(fVector2d && calibraVector) {
+ calibra->SetMinEntries(20*20);
+ if(fCompressPerDetector){
+ if(!(vvect = calibraVector->AddStatsPerDetectorPH())) return kFALSE;
+ pass = calibra->AnalysePH(vvect);
+ }
+ else pass = calibra->AnalysePH(calibraVector);
+ }
+ }
+
+ if(pass) {
+ Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
+ + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
+ Int_t nbfit = calibra->GetNumberFit();
+ Int_t nbE = calibra->GetNumberEnt();
+ // enough statistics
+ if ((nbtg > 0) &&
+ (nbfit >= 0.001*nbE))
+ {
+ // create the cal objects
+ calibra->PutMeanValueOtherVectorFit(1,kTRUE);
+ calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
+ TObjArray object = calibra->GetVectorFit();
+ AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
+ TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
+ TObjArray objectt = calibra->GetVectorFit2();
+ AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
+ TObject *objtime0pad = calibra->CreatePadObjectT0();
+ // store
+ AliCDBId id1("TRD/Calib/ChamberVdrift",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objdriftvelocitydet, id1, &mdDet);
+ AliCDBId id2("TRD/Calib/LocalVdrift",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objdriftvelocitypad, id2, &mdPad);
+ //
+ AliCDBId idd1("TRD/Calib/ChamberT0",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objtime0det, idd1, &mdDet);
+ AliCDBId idd2("TRD/Calib/LocalT0",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objtime0pad, idd2, &mdPad);
+ // Make graph
+ TGraph *graph = 0x0;
+ if(FillGraphIndex(&object,graph)){
+ fGraph->AddAt(graph,1);
+ }
+ TGraph *graphh = 0x0;
+ if(FillGraphIndex(&objectt,graphh)){
+ fGraph->AddAt(graphh,2);
+ }
+ }//if(enough statistics)
+ calibra->ResetVectorFit();
+ }
+ else return kFALSE;
+
+ //
+ // PRF
+ //
+ pass = kFALSE;
+ if(fHisto2d) {
+ TProfile2D *histoprf = (TProfile2D *) fContainer->FindObject("PRF2d");
+ if (histoprf) {
+ histoprf->SetDirectory(0);
+ calibra->SetMinEntries(600);
+ if(fCompressPerDetector){
+ if(AddStatsPerDetector(histoprf,2)) pass = calibra->AnalysePRFMarianFit(fDetSumVector);
+ }
+ else pass = calibra->AnalysePRFMarianFit(histoprf);
+ }
+ }
+ else {
+ if(fVector2d && calibraVector) {
+ calibra->SetMinEntries(600);
+ if(fCompressPerDetector){
+ if(!(vvect =calibraVector->AddStatsPerDetectorPRF())) return kFALSE;
+ pass = calibra->AnalysePRFMarianFit(vvect);
+ }
+ else pass = calibra->AnalysePRFMarianFit(calibraVector);
+ }
+ }
+
+ if(pass){
+ Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
+ + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
+ Int_t nbfit = calibra->GetNumberFit();
+ Int_t nbE = calibra->GetNumberEnt();
+ // enough statistics
+ if ((nbtg > 0) &&
+ (nbfit >= 0.001*nbE)) {
+ TObjArray object = calibra->GetVectorFit();
+ TObject *objPRFpad = calibra->CreatePadObjectPRF(&object);
+ // store
+ AliCDBId id2("TRD/Calib/PRFWidth",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objPRFpad, id2, &mdPad);
+ // Make graph
+ TGraph *graph = 0x0;
+ if(FillGraphIndex(&object,graph)){
+ fGraph->AddAt(graph,5);
+ }
+ }
+ calibra->ResetVectorFit();
+ }
+ else return kFALSE;
+
+ //
+ // VDRIFT linear fit
+ //
+ AliTRDCalibraVdriftLinearFit *vlinearfit = (AliTRDCalibraVdriftLinearFit *) fContainer->FindObject("LinearVdriftFit");
+ if (vlinearfit) {
+ calibra->SetMinEntries(20*20);
+ if(calibra->AnalyseLinearFitters(vlinearfit)) {
+
+ Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
+ + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
+ Int_t nbfit = calibra->GetNumberFit();
+ Int_t nbE = calibra->GetNumberEnt();
+ // enough statistics
+ if ((nbtg > 0) &&
+ (nbfit >= 0.001*nbE))
+ {
+ // create the cal objects
+ calibra->PutMeanValueOtherVectorFit(1,kTRUE);
+ calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
+ TObjArray object = calibra->GetVectorFit();
+ AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
+ TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
+ TObjArray objectt = calibra->GetVectorFit2();
+ AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
+ TObject *objtime0pad = calibra->CreatePadObjectT0();
+ // store dummy
+ AliCDBId id1("TRD/Calib/ChamberVdriftLinear",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objdriftvelocitydet, id1, &mdDet);
+ AliCDBId id2("TRD/Calib/LocalVdriftLinear",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objdriftvelocitypad, id2, &mdPad);
+ //
+ AliCDBId idd1("TRD/Calib/ChamberLorentzAngle",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objtime0det, idd1, &mdDet);
+ AliCDBId idd2("TRD/Calib/LocalLorentzAngle",fRunNumber, AliCDBRunRange::Infinity());
+ storLoc->Put((TObject *)objtime0pad, idd2, &mdPad);
+ // Make graph
+ TGraph *graph = 0x0;
+ if(FillGraphIndex(&object,graph)){
+ fGraph->AddAt(graph,3);
+ }
+ TGraph *graphh = 0x0;
+ if(FillGraphIndex(&objectt,graphh)){
+ fGraph->AddAt(graphh,4);
+ }
+ }//if(enough statistics)
+ }// if fit
+ calibra->ResetVectorFit();
+ }
+ else return kFALSE;
+
+ fPostProcess = kTRUE;
+
+ return kTRUE;
+
+}
+
+//________________________________________________________________________
+Bool_t AliTRDcalibration::FillGraphIndex(TObjArray *vectora,TGraph *graph) const
+{
+
+ //
+ // Fill one value (the first one) per detector
+ //
+
+ Int_t loop = (Int_t) vectora->GetEntriesFast();
+ if(loop != 540) {
+ AliInfo("The Vector Fit is not complete!");
+ return kFALSE;
+ }
+
+ Double_t x[540];
+ Double_t y[540];
+ for (Int_t k = 0; k < loop; k++) {
+ if(!vectora->At(k)){
+ x[k] = -1.0;
+ y[k] = -1.0;
+ continue;
+ }
+ x[k] = ((AliTRDCalibraFit::AliTRDFitInfo *) vectora->At(k))->GetDetector();
+ y[k] = ((Float_t *)((AliTRDCalibraFit::AliTRDFitInfo *) vectora->At(k))->GetCoef())[0];
+ }
+
+ if(!graph) graph = new TGraph(540,&x[0],&y[0]);
+ else{
+ graph->~TGraph();
+ new(graph) TGraph(540,&x[0],&y[0]);
+ }
+
+ return kTRUE;
+
+}
+//________________________________________________________________________
+Bool_t AliTRDcalibration::AddStatsPerDetector(TH2I *ch)
+{
+
+ // Use an AliTRDCalibraMode to know where we are
+ AliTRDCalibraMode calibMode = AliTRDCalibraMode();
+ const char *name = ch->GetTitle();
+ if(!SetNzFromTObject(name,0,&calibMode)) return 0x0;
+ if(!SetNrphiFromTObject(name,0,&calibMode)) return 0x0;
+ if(((calibMode.GetNz(0) == 100) && (calibMode.GetNrphi(0) == 100)) || ((calibMode.GetNz(0) == 10) && (calibMode.GetNrphi(0) == 10))) return kFALSE;
+
+ Int_t nybins = ch->GetNbinsY();// groups number
+ Int_t nxbins = ch->GetNbinsX();// number of bins X
+ TAxis *xaxis = ch->GetXaxis();
+ Double_t lowedge = xaxis->GetBinLowEdge(1);
+ Double_t upedge = xaxis->GetBinUpEdge(nxbins);
+
+ // number per chamber 2
+ calibMode.ModePadCalibration(2,0);
+ calibMode.ModePadFragmentation(0,2,0,0);
+ calibMode.SetDetChamb2(0);
+ Int_t perChamber2 = (Int_t) calibMode.GetDetChamb2(0);
+
+ // number per other chamber
+ calibMode.ModePadCalibration(0,0);
+ calibMode.ModePadFragmentation(0,0,0,0);
+ calibMode.SetDetChamb0(0);
+ Int_t perChamber0 = (Int_t) calibMode.GetDetChamb0(0);
+
+ if(nybins != (6*18*perChamber2+6*4*18*perChamber0)) return kFALSE;
+
+ // Create Histo
+ TString nname((const char *)ch->GetName());
+ nname += "PerDetector";
+ TString title("Nz");
+ title += 0;
+ title += "Nrphi";
+ title += 0;
+ if(!fCHSum) fCHSum = new TH2I((const char *)nname,(const char *)title
+ ,nxbins,lowedge,upedge,540,0,540);
+ else{
+ fCHSum->~TH2I();
+ new(fCHSum) TH2I((const Char_t *) nname,(const char *)title
+ ,nxbins,lowedge,upedge,540,0,540);
+ }
+ fCHSum->SetYTitle("Detector number");
+ fCHSum->SetXTitle("charge deposit [a.u]");
+ fCHSum->SetZTitle("counts");
+ fCHSum->SetStats(0);
+ fCHSum->Sumw2();
+
+ Int_t counter = 0;
+
+ for(Int_t det = 0; det < 540; det++){
+
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(det) == 2) numberofgroup = perChamber2;
+ else numberofgroup = perChamber0;
+ TH1I *projch = (TH1I *) ch->ProjectionX("projch",counter+1,counter+numberofgroup,(Option_t *)"e");
+ projch->SetDirectory(0);
+
+ for(Int_t nx = 0; nx <= nxbins; nx++) {
+ fCHSum->SetBinContent(nx,det+1,projch->GetBinContent(nx));
+ fCHSum->SetBinError(nx,det+1,projch->GetBinError(nx));
+ }
+
+ counter += numberofgroup;
+
+ delete projch;
+
+ }
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________________________________________________
+Bool_t AliTRDcalibration::AddStatsPerDetector(TProfile2D *ph,Int_t i)
+{
+ //
+ //
+ //
+
+ AliTRDCalibraMode calibMode = AliTRDCalibraMode();
+ const char *name = ph->GetTitle();
+ //printf("name %s\n",name);
+ if(!SetNzFromTObject(name,0,&calibMode)) return kFALSE;
+ if(!SetNrphiFromTObject(name,0,&calibMode)) return kFALSE;
+ if(((calibMode.GetNz(0) == 100) && (calibMode.GetNrphi(0) == 100)) || ((calibMode.GetNz(0) == 10) && (calibMode.GetNrphi(0) == 10))) return kFALSE;
+ //printf("Found mode Mz %d, Nrphi %d\n",calibMode.GetNz(0),calibMode.GetNrphi(0));
+
+
+ Int_t nybins = ph->GetNbinsY();// groups number
+ Int_t nxbins = ph->GetNbinsX();// number of bins X
+ TAxis *xaxis = ph->GetXaxis();
+ Double_t lowedge = xaxis->GetBinLowEdge(1);
+ Double_t upedge = xaxis->GetBinUpEdge(nxbins);
+
+ // number per chamber 2
+ calibMode.ModePadCalibration(2,0);
+ calibMode.ModePadFragmentation(0,2,0,0);
+ calibMode.SetDetChamb2(0);
+ Int_t perChamber2 = (Int_t) calibMode.GetDetChamb2(0);
+
+ // number per other chamber
+ calibMode.ModePadCalibration(0,0);
+ calibMode.ModePadFragmentation(0,0,0,0);
+ calibMode.SetDetChamb0(0);
+ Int_t perChamber0 = (Int_t) calibMode.GetDetChamb0(0);
+
+ if(nybins != (6*18*perChamber2+6*4*18*perChamber0)) return kFALSE;
+
+ // Create calvector
+ TString nbname((const char *)ph->GetName());
+ nbname += "PerDetectorVector";
+ if(!fDetSumVector) fDetSumVector = new AliTRDCalibraVector();
+ else{
+ fDetSumVector->~AliTRDCalibraVector();
+ new(fDetSumVector) AliTRDCalibraVector();
+ }
+ if(i==1){
+ fDetSumVector->SetTimeMax(nxbins);
+ }
+ if(i==2){
+ fDetSumVector->SetNumberBinPRF(nxbins);
+ fDetSumVector->SetPRFRange(TMath::Abs(lowedge));
+ }
+ fDetSumVector->SetDetCha0(i,1);
+ fDetSumVector->SetDetCha2(i,1);
+ fDetSumVector->SetNzNrphi(i,0,0);
+ if(i==2) {
+ Int_t nbg = GetNumberOfGroupsPRF((const char *)name);
+ fDetSumVector->SetNbGroupPRF(nbg);
+ }
+
+ // Create Histo
+ TString nname((const char *)ph->GetName());
+ nname += "PerDetector";
+ TString title("Nz");
+ title += 0;
+ title += "Nrphi";
+ title += 0;
+ if(!fDetSum) fDetSum = new TH2D((const char *)nname,(const Char_t *) title
+ ,nxbins,lowedge,upedge,540,0,540);
+ else{
+ fDetSum->~TH2D();
+ new(fDetSum) TH2D((const Char_t *) nname,(const Char_t *) title
+ ,nxbins,lowedge,upedge,540,0,540);
+ }
+ fDetSum->SetYTitle("Detector number");
+ fDetSum->SetXTitle(xaxis->GetTitle());
+ fDetSum->SetStats(0);
+
+ Int_t counter = 0;
+
+ for(Int_t det = 0; det < 540; det++){
+
+ Int_t numberofgroup = 0;
+ if(AliTRDgeometry::GetStack(det) == 2) numberofgroup = perChamber2;
+ else numberofgroup = perChamber0;
+
+ for(Int_t nx = 1; nx <= nxbins; nx++) {
+
+ Double_t entries = 0.0;
+ Double_t sumw2 = 0.0;
+ Double_t sumw = 0.0;
+
+ for(Int_t k = counter+1; k <= (counter+numberofgroup); k++){
+ Int_t binnumber = ph->GetBin(nx,k);
+ entries += ph->GetBinEntries(binnumber);
+ sumw2 += (ph->GetBinError(binnumber)*ph->GetBinError(binnumber)+ph->GetBinContent(binnumber)*ph->GetBinContent(binnumber))*ph->GetBinEntries(binnumber);
+ sumw += ph->GetBinContent(binnumber)*ph->GetBinEntries(binnumber);
+ }
+
+ Double_t mean = 0.0;
+ if(entries > 0.0) mean = sumw/entries;
+ Double_t squaremean = 0.0;
+ if(entries > 0.0) squaremean = sumw2/entries;
+ Double_t errorf = squaremean - mean*mean;
+ Double_t error = 0.0;
+ if(entries > 0.0) error = TMath::Sqrt(TMath::Abs(errorf)/entries);
+
+ fDetSum->SetBinContent(nx,det+1,mean);
+ fDetSum->SetBinError(nx,det+1,error);
+
+ if(i==1) fDetSumVector->FillVectorPH(det,0,nx-1,(Int_t)entries,(Float_t)mean,(Float_t)squaremean);
+ if(i==2) fDetSumVector->FillVectorPRF(det,0,nx-1,(Int_t)entries,(Float_t)mean,(Float_t)squaremean);
+
+ }
+
+ counter += numberofgroup;
+
+ }
+
+ return kTRUE;
+
+
+}
+//_____________________________________________________________________________
+Bool_t AliTRDcalibration::SetNrphiFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const
+{
+
+ // Some patterns
+ const Char_t *patternrphi0 = "Nrphi0";
+ const Char_t *patternrphi1 = "Nrphi1";
+ const Char_t *patternrphi2 = "Nrphi2";
+ const Char_t *patternrphi3 = "Nrphi3";
+ const Char_t *patternrphi4 = "Nrphi4";
+ const Char_t *patternrphi5 = "Nrphi5";
+ const Char_t *patternrphi6 = "Nrphi6";
+
+
+ const Char_t *patternrphi10 = "Nrphi10";
+ const Char_t *patternrphi100 = "Nrphi100";
+ const Char_t *patternz10 = "Nz10";
+ const Char_t *patternz100 = "Nz100";
+
+ // Nrphi mode
+ if ((strstr(name,patternrphi100)) && (strstr(name,patternz100))) {
+ calibMode->SetAllTogether(i);
+ return kTRUE;
+ }
+ if ((strstr(name,patternrphi10)) && (strstr(name,patternz10))) {
+ calibMode->SetPerSuperModule(i);
+ return kTRUE;
+ }
+
+ if (strstr(name,patternrphi0)) {
+ calibMode->SetNrphi(i ,0);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi1)) {
+ calibMode->SetNrphi(i, 1);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi2)) {
+ calibMode->SetNrphi(i, 2);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi3)) {
+ calibMode->SetNrphi(i, 3);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi4)) {
+ calibMode->SetNrphi(i, 4);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi5)) {
+ calibMode->SetNrphi(i, 5);
+ return kTRUE;
+ }
+ if (strstr(name,patternrphi6)) {
+ calibMode->SetNrphi(i, 6);
+ return kTRUE;
+ }
+
+ calibMode->SetNrphi(i ,0);
+ return kFALSE;
+
+}
+//_____________________________________________________________________________
+Bool_t AliTRDcalibration::SetNzFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const
+{
+ //
+ // Set fNz[i] of the AliTRDCalibraFit::Instance()
+ // corresponding to the given TObject
+ //
+
+ // Some patterns
+ const Char_t *patternz0 = "Nz0";
+ const Char_t *patternz1 = "Nz1";
+ const Char_t *patternz2 = "Nz2";
+ const Char_t *patternz3 = "Nz3";
+ const Char_t *patternz4 = "Nz4";
+
+ const Char_t *patternrphi10 = "Nrphi10";
+ const Char_t *patternrphi100 = "Nrphi100";
+ const Char_t *patternz10 = "Nz10";
+ const Char_t *patternz100 = "Nz100";
+
+ if ((strstr(name,patternrphi100)) && (strstr(name,patternz100))) {
+ calibMode->SetAllTogether(i);
+ return kTRUE;
+ }
+ if ((strstr(name,patternrphi10)) && (strstr(name,patternz10))) {
+ calibMode->SetPerSuperModule(i);
+ return kTRUE;
+ }
+ if (strstr(name,patternz0)) {
+ calibMode->SetNz(i, 0);
+ return kTRUE;
+ }
+ if (strstr(name,patternz1)) {
+ calibMode->SetNz(i ,1);
+ return kTRUE;
+ }
+ if (strstr(name,patternz2)) {
+ calibMode->SetNz(i ,2);
+ return kTRUE;
+ }
+ if (strstr(name,patternz3)) {
+ calibMode->SetNz(i ,3);
+ return kTRUE;
+ }
+ if (strstr(name,patternz4)) {
+ calibMode->SetNz(i ,4);
+ return kTRUE;
+ }
+
+ calibMode->SetNz(i ,0);
+ return kFALSE;
+}
+//____________________________________________________________________________________________________
+Int_t AliTRDcalibration::GetNumberOfGroupsPRF(const char* nametitle) const
+{
+ //
+ // Get numberofgroupsprf
+ //
+
+ // Some patterns
+ const Char_t *pattern0 = "Ngp0";
+ const Char_t *pattern1 = "Ngp1";
+ const Char_t *pattern2 = "Ngp2";
+ const Char_t *pattern3 = "Ngp3";
+ const Char_t *pattern4 = "Ngp4";
+ const Char_t *pattern5 = "Ngp5";
+ const Char_t *pattern6 = "Ngp6";
+
+ // Nrphi mode
+ if (strstr(nametitle,pattern0)) {
+ return 0;
+ }
+ if (strstr(nametitle,pattern1)) {
+ return 1;
+ }
+ if (strstr(nametitle,pattern2)) {
+ return 2;
+ }
+ if (strstr(nametitle,pattern3)) {
+ return 3;
+ }
+ if (strstr(nametitle,pattern4)) {
+ return 4;
+ }
+ if (strstr(nametitle,pattern5)) {
+ return 5;
+ }
+ if (strstr(nametitle,pattern6)){
+ return 6;
+ }
+ else return -1;
+
+
}
class TObject;
class TH1F;
class TProfile2D;
+class TGraph;
class TH2I;
+class TH2D;
class TTree;
class TObjArray;
class AliTRDtrackV1;
class AliTRDCalibraFillHisto;
-class AliTRDCalibraVLFDebug;
-class AliTRDCalibraPRFDebug;
+class AliTRDCalibraVector;
+class AliTRDCalibraMode;
class AliTRDcluster;
class AliTRDtrackInfo;
class AliTRDcalibration : public AliTRDrecoTask
{
+ // Plots registered for this task
+ enum{
+ kNbTrack = 0 // Nb tracks per event
+ ,kNbTracklet = 1 // Nb of traklets per detector
+ ,kNbTimeBin = 2 // Nb of clusters per timebin
+ ,kNbClusters = 3 // Nb of clusters per tracklet
+ ,kPHSum = 4 // All integrated PH
+ ,kCHSum = 5 // All integrated CH
+ ,kPH2D = 6 // PH2D
+ ,kCH2D = 7 // CH2D
+ ,kPRF2D = 8 // PRF2D
+ ,kPH2DVector = 9 // PH2D
+ ,kCH2DVector = 10 // CH2D
+ ,kPRF2DVector = 11 // PRF2D
+ ,kLinearFitter = 12 // For the one with the most stats
+ ,kGainFactor = 13 // Gain factor
+ ,kVdriftT0Factor = 14 // VdriftT0 average pulse height
+ ,kVdriftLorentzAngleFactor = 15 // VdriftLorentzAngle
+ ,kPRFFactor = 16 //PRF Factor
+ };
+
public:
AliTRDcalibration();
- virtual ~AliTRDcalibration(){;}
+ virtual ~AliTRDcalibration();
- virtual void CreateOutputObjects();
- virtual void Exec(Option_t *option);
- virtual void Terminate(Option_t *);
+ virtual void CreateOutputObjects();
+ virtual void Exec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ virtual Bool_t GetRefFigure(Int_t ifig);
+ virtual Bool_t PostProcess();
+
+ Bool_t FillGraphIndex(TObjArray *vectora, TGraph *graph) const;
+ Bool_t AddStatsPerDetector(TH2I *ch);
+ Bool_t AddStatsPerDetector(TProfile2D *ph, Int_t i);
+
+ Bool_t SetNrphiFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const;
+ Bool_t SetNzFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const;
+
+ Int_t GetNumberOfGroupsPRF(const char* nametitle) const;
+ TH2I *GetSumCH() const { return fCHSum; };
+ TH2D *GetSumDet() const { return fDetSum;};
+ AliTRDCalibraVector *GetSumDetVector() const { return fDetSumVector;};
+
+
+
+ void SetHisto2d(Bool_t histo2d) {fHisto2d=histo2d;};
+ void SetVector2d(Bool_t vector2d) {fVector2d=vector2d;};
+ void SetVdriftLinear(Bool_t vdriftLinear) {fVdriftLinear = vdriftLinear;};
+ void SetLow(Int_t low) {flow=low;};
+ void SetHigh(Int_t high) {fhigh=high;};
+ void SetNz(Short_t nz, Int_t i) {fNz[i]=nz;};
+ void SetNrphi(Short_t nrphi, Int_t i) {fNrphi[i]=nrphi;};
+ void SetFillZero(Bool_t fillZero) {ffillZero = fillZero;};
+ void SetNormalizeNbOfCluster(Bool_t normalizeNbOfCluster) {fnormalizeNbOfCluster = normalizeNbOfCluster;};
+ void SetMaxCluster(Float_t maxcluster) {fmaxCluster = maxcluster; };
+ void SetOfflineTracks() {fOfflineTracks=kTRUE; fStandaloneTracks=kFALSE; };
+ void SetStandaloneTracks() {fStandaloneTracks=kTRUE; fOfflineTracks=kFALSE; };
+ void SetCompressPerDetector(Bool_t compressPerDetector=kTRUE) {fCompressPerDetector=compressPerDetector; };
+ void SetRunNumber(Int_t runNumber) {fRunNumber=runNumber; };
+ void SetNameDirectoryOutput(const char *nameDirectory) {fNameDirectory=nameDirectory; };
- void SetLow(Int_t low) {flow=low;};
- void SetHigh(Int_t high) {fhigh=high;};
- void SetFillZero(Bool_t fillZero) {ffillZero = fillZero; };
+
+
private:
- AliTRDtrackInfo *fTrackInfo; // track info
+ AliTRDtrackInfo *fTrackInfo; //track info
AliTRDtrackV1 *ftrdTrack; //trdtrack
AliTRDcluster *fcl; //cluster
- AliTRDCalibraFillHisto *fTRDCalibraFillHisto; //calibration analyse object
- TH1F *fNbTRDTrackUsed; //nb ESD tracks used for calibration
- TH1F *fNbTimeBin; //nb Time Bin
- TH1F *fNbClusters; //nb Clusters
- TProfile2D *fPHSum; //sum PH
- TH2I *fCHSum; //sum CH
+ AliTRDCalibraFillHisto *fTRDCalibraFillHisto; //! calibration analyse object
+ TH1F *fNbTRDTrack; //! nb ESD tracks used
+ TH1F *fNbTRDTrackOffline; //! nb ESD tracks offline used
+ TH1F *fNbTRDTrackStandalone; //! nb ESD tracks standalone used
+ TH1F *fNbTRDTracklet; //! nb tracklets used
+ TH1F *fNbTRDTrackletOffline; //! nb tracklets offline used
+ TH1F *fNbTRDTrackletStandalone; //! nb tracklets standalone used
+ TH1F *fNbTimeBin; //! nb Time Bin
+ TH1F *fNbTimeBinOffline; //! nb Time Bin offline
+ TH1F *fNbTimeBinStandalone; //! nb Time Bin standalone
+ TH1F *fNbClusters; //! nb Clusters
+ TH1F *fNbClustersOffline; //! nb Clusters offline
+ TH1F *fNbClustersStandalone; //! nb Clusters standalone
+
+
+ TProfile2D *fPHSum; //! sum PH
+ TH2I *fCHSum; //! sum CH
+ TH2D *fDetSum; //! sum Det
+ AliTRDCalibraVector *fDetSumVector; //! sum Det Vect
- Int_t flow; //lower limit
- Int_t fhigh; //higher limit
- Int_t fNbTimeBins; //number of timebins
- Bool_t ffillZero; //fill zero
+ Bool_t fHisto2d; //! histo
+ Bool_t fVector2d; //! vector
+ Bool_t fVdriftLinear; //! vdrift Linear
+
+ Int_t flow; //! lower limit nb of clusters
+ Int_t fhigh; //! higher limit nb of clusters
+ Int_t fNbTimeBins; //! number of timebins
+ Bool_t ffillZero; //! fill zero
+ Short_t fNz[3]; //! Nz mode
+ Short_t fNrphi[3]; //! Nrphi mode
+ Bool_t fnormalizeNbOfCluster; //! normalize with number of clusters
+ Float_t fmaxCluster; //! maxcluster (noise at the end)
+ Bool_t fOfflineTracks; //! Offline refited tracks
+ Bool_t fStandaloneTracks; //! Take only standalone tracks
+
+ Bool_t fCompressPerDetector; //! Compress per detector
+
+ Int_t fRunNumber; //! Run number
+ const char *fNameDirectory; //! Name output directory fit parameters
+ TObjArray *fGraph; //! array of graphs filled in PostProcess
+ Bool_t fPostProcess; //Post process
AliTRDcalibration(const AliTRDcalibration&);
AliTRDcalibration& operator=(const AliTRDcalibration&);