,fCalROC(0x0)
,fCalDet2(0x0)
,fCalROC2(0x0)
+ ,fCalDetVdriftUsed(0x0)
+ ,fCalDetExBUsed(0x0)
,fCurrentCoefDetector(0x0)
,fCurrentCoefDetector2(0x0)
,fVectorFit(0)
,fCalROC(0x0)
,fCalDet2(0x0)
,fCalROC2(0x0)
+,fCalDetVdriftUsed(0x0)
+,fCalDetExBUsed(0x0)
,fCurrentCoefDetector(0x0)
,fCurrentCoefDetector2(0x0)
,fVectorFit(0)
if(c.fCalROC) fCalROC = new AliTRDCalROC(*c.fCalROC);
if(c.fCalROC2) fCalROC = new AliTRDCalROC(*c.fCalROC2);
+ if(c.fCalDetVdriftUsed) fCalDetVdriftUsed = new AliTRDCalDet(*c.fCalDetVdriftUsed);
+ if(c.fCalDetExBUsed) fCalDetExBUsed = new AliTRDCalDet(*c.fCalDetExBUsed);
+
fVectorFit.SetName(c.fVectorFit.GetName());
for(Int_t k = 0; k < c.fVectorFit.GetEntriesFast(); k++){
AliTRDFitInfo *fitInfo = new AliTRDFitInfo();
if ( fCalDet2 ) delete fCalDet2;
if ( fCalROC ) delete fCalROC;
if ( fCalROC2 ) delete fCalROC2;
+ if ( fCalDetVdriftUsed) delete fCalDetVdriftUsed;
+ if ( fCalDetExBUsed) delete fCalDetExBUsed;
if( fCurrentCoefDetector ) delete [] fCurrentCoefDetector;
if( fCurrentCoefDetector2 ) delete [] fCurrentCoefDetector2;
fVectorFit.Delete();
// CalculDatabaseVdriftandTan
CalculVdriftLorentzCoef();
+ //printf("AliTRDCalibraFit::AnalyzeVdriftLinearFit detector %d, vdrift %f and %f and exB %f and %f\n",idet,fCalDetVdriftUsed->GetValue(idet),fCurrentCoef[1],fCalDetExBUsed->GetValue(idet),fCurrentCoef2[1]);
// Statistics
fNumberFitSuccess ++;
}
//____________Functions fit Online CH2d________________________________________
-Double_t AliTRDCalibraFit::AnalyseLinearFittersAllTogether(AliTRDCalibraVdriftLinearFit *calivdli)
+void AliTRDCalibraFit::AnalyseLinearFittersAllTogether(AliTRDCalibraVdriftLinearFit *calivdli, Double_t &vdriftoverall, Double_t &exboverall)
{
//
// The linear method
//
+ // Get the mean vdrift and exb used
+ Double_t meanvdriftused = 0.0;
+ Double_t meanexbused = 0.0;
+ Double_t counterdet = 0.0;
+ if((!fCalDetVdriftUsed) || (!fCalDetExBUsed)) {
+ vdriftoverall = -100.0;
+ exboverall = 100.0;
+ return;
+ }
+
// Add histos
TH2S *linearfitterhisto = 0x0;
for(Int_t idet = 0; idet < 540; idet++){
TH2S * u = calivdli->GetLinearFitterHistoForce(idet);
+ Double_t detectorentries = u->Integral();
+ meanvdriftused += fCalDetVdriftUsed->GetValue(idet)*detectorentries;
+ meanexbused += fCalDetExBUsed->GetValue(idet)*detectorentries;
+ counterdet += detectorentries;
+
+ //printf("detectorentries %f\n",detectorentries);
+
+ //printf("AliTRDCalibraFit::AnalyzeVdriftLinearFitsAllTogether detector %d, vdrift %f and exB %f\n",idet,fCalDetVdriftUsed->GetValue(idet),fCalDetExBUsed->GetValue(idet));
+
if(idet == 0) linearfitterhisto = u;
else linearfitterhisto->Add(u);
}
+ if(counterdet > 0.0){
+ meanvdriftused = meanvdriftused/counterdet;
+ meanexbused = meanexbused/counterdet;
+ }
+ else {
+ vdriftoverall = -100.0;
+ exboverall = 100.0;
+ return;
+ }
+
+
+ //printf("AliTRDCalibraFit::AnalyzeVdriftLinearFitsAllTogether MEAN vdrift %f and exB %f\n",meanvdriftused,meanexbused);
// Fit
//printf("AnalyseLinearFittersAllTogether::Find %d entries\n",entries);
//printf("Minstats %d\n",fMinEntries);
- // Eval the linear fitter
+
+
+ // Eval the linear fitter
if(entries > fMinEntries){
TVectorD par = TVectorD(2);
//printf("Fit\n");
//printf("Take the param\n");
linearfitter.GetParameters(par);
//printf("Done\n");
- par.Print();
+ //par.Print();
//printf("Finish\n");
// Put the fCurrentCoef
fCurrentCoef[0] = -par[1];
// here the database must be the one of the reconstruction for the lorentz angle....
- fCurrentCoef2[0] = (par[0]+fCurrentCoef[1]*fCurrentCoef2[1])/fCurrentCoef[0];
+ if(fCurrentCoef[0] > 0.0) fCurrentCoef2[0] = (par[0]+meanvdriftused*meanexbused)/fCurrentCoef[0];
+ else fCurrentCoef2[0] = 100.0;
+
+ }
+ else {
+
+ fCurrentCoef[0] = -100.0;
+ fCurrentCoef2[0] = 100.0;
- return fCurrentCoef[0];
}
- else return -100.0;
}
else {
- return -100.0;
+
+ fCurrentCoef[0] = -100.0;
+ fCurrentCoef2[0] = 100.0;
+
}
+ vdriftoverall = fCurrentCoef[0];
+ exboverall = fCurrentCoef2[0];
+
+
delete linearfitterhisto;
delete fDebugStreamer;
fDebugStreamer = 0x0;
for (Int_t col = 0; col < colMax; col++) {
value = coef[(Int_t)(col*rowMax+row)];
if(value > 70.0) {
- if((ofwhat == 0) && (meanAll > -1.5) && (countAll > 15)) coef[(Int_t)(col*rowMax+row)] = meanAll+100.0;
+ if((ofwhat == 0) && (meanAll > -3.0) && (countAll > 15)) coef[(Int_t)(col*rowMax+row)] = meanAll+100.0;
if(ofwhat == 1){
- if((meanDetector[detector] > -1.5) && (countDetector[detector] > 20)) coef[(Int_t)(col*rowMax+row)] = meanDetector[detector]+100.0;
- else if((meanSupermodule[sector] > -1.5) && (countSupermodule[sector] > 15)) coef[(Int_t)(col*rowMax+row)] = meanSupermodule[sector]+100.0;
- else if((meanAll > -1.5) && (countAll > 15)) coef[(Int_t)(col*rowMax+row)] = meanAll+100.0;
+ if((meanDetector[detector] > -3.0) && (countDetector[detector] > 20)) coef[(Int_t)(col*rowMax+row)] = meanDetector[detector]+100.0;
+ else if((meanSupermodule[sector] > -3.0) && (countSupermodule[sector] > 15)) coef[(Int_t)(col*rowMax+row)] = meanSupermodule[sector]+100.0;
+ else if((meanAll > -3.0) && (countAll > 15)) coef[(Int_t)(col*rowMax+row)] = meanAll+100.0;
}
}
// Debug
if(count > 0) mean = mean/count;
*/
value = ((AliTRDFitInfo *) vectorFit->At(k))->GetCoef()[0];
- object->SetValue(detector,-TMath::Abs(value));
+ if(value > 70.0) value = value-100.0;
+ object->SetValue(detector,value);
}
return object;
fCurrentCoefDetector2[k] = 0.0;
}
- //printf("test0\n");
-
- AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
- if (!cal) {
- AliInfo("Could not get calibDB");
- return kFALSE;
- }
-
- //Get the CalDet object
- if(fAccCDB){
- if(fCalDet) delete fCalDet;
- if(fCalDet2) delete fCalDet2;
- fCalDet = new AliTRDCalDet(*(cal->GetVdriftDet()));
- //printf("test1\n");
- fCalDet2 = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
- //printf("test2\n");
- for(Int_t k = 0; k < 540; k++){
- fCalDet2->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(fCalDet->GetValue(k)));
- }
- //printf("test3\n");
- }
- else{
- Float_t devalue = 1.5;
- Float_t devalue2 = AliTRDCommonParam::Instance()->GetOmegaTau(1.5);
- if(fCalDet) delete fCalDet;
- if(fCalDet2) delete fCalDet2;
- //printf("test1\n");
- fCalDet = new AliTRDCalDet("ChamberVdrift","TRD drift velocities (detector value)");
- fCalDet2 = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
- //printf("test2\n");
- for(Int_t k = 0; k < 540; k++){
- fCalDet->SetValue(k,devalue);
- fCalDet2->SetValue(k,devalue2);
- }
- //printf("test3\n");
- }
+ if((!fCalDetVdriftUsed) || (!fCalDetExBUsed)) return kFALSE;
+
return kTRUE;
}
-
//____________Functions for initialising the AliTRDCalibraFit in the code_________
void AliTRDCalibraFit::InitfCountDetAndfCount(Int_t i)
{
else if (fNbDet > 0){
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted"
- ,idect,firstdetector,lastdetector));
+ //AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
}
else {
- AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted"
- ,idect-(fCount-(fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0))),fCountDet));
+//AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted",idect-(fCount-(fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0))),fCountDet));
// Calcul the coef from the database choosen
CalculChargeCoefMean(kFALSE);
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted"
- ,idect,firstdetector,lastdetector));
+//AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
}
else {
- AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted"
- ,idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1))),fCountDet));
+//AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted",idect-(fCount-(fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1))),fCountDet));
CalculVdriftCoefMean();
CalculT0CoefMean();
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted"
- ,idect,firstdetector,lastdetector));
+// AliInfo(Form("The element %d containing the detectors %d to %d has not enough statistic to be fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
}
else {
- AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted"
- ,idect-(fCount-(fCalibraMode->GetNfragZ(2)*fCalibraMode->GetNfragRphi(2))),fCountDet));
+// AliInfo(Form("The element %d in this detector %d has not enough statistic to be fitted",idect-(fCount-(fCalibraMode->GetNfragZ(2)*fCalibraMode->GetNfragRphi(2))),fCountDet));
CalculPRFCoefMean();
for (Int_t k = 0; k < factor; k++) {
fCurrentCoefDetector[k] = -TMath::Abs(fCurrentCoef[1]);
// should be negative
- fCurrentCoefDetector2[k] = +TMath::Abs(fCurrentCoef2[1]);
+ fCurrentCoefDetector2[k] = fCurrentCoef2[1]+100.0;
}
- //Put default opposite sign
+ //Put default opposite sign only for vdrift
fCurrentCoef[0] = -TMath::Abs(fCurrentCoef[1]);
fCurrentCoefE = 0.0;
- fCurrentCoef2[0] = +TMath::Abs(fCurrentCoef2[1]);
+ fCurrentCoef2[0] = fCurrentCoef2[1]+100.0;
fCurrentCoefE2 = 0.0;
FillFillLinearFitter();
if (fNbDet > 0){
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has been fitted"
- ,idect,firstdetector,lastdetector));
+ // AliInfo(Form("The element %d containing the detectors %d to %d has been fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has been fitted"
- ,idect,firstdetector,lastdetector));
+// AliInfo(Form("The element %d containing the detectors %d to %d has been fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
Int_t firstdetector = fCountDet;
Int_t lastdetector = fCountDet+fNbDet;
- AliInfo(Form("The element %d containing the detectors %d to %d has been fitted"
- ,idect,firstdetector,lastdetector));
+// AliInfo(Form("The element %d containing the detectors %d to %d has been fitted",idect,firstdetector,lastdetector));
// loop over detectors
for(Int_t det = firstdetector; det < lastdetector; det++){
// For the detector fCountDet, mean drift velocity and tan lorentzangle
//
- fCurrentCoef[1] = fCalDet->GetValue(fCountDet);
- fCurrentCoef2[1] = fCalDet2->GetValue(fCountDet);
+ fCurrentCoef[1] = fCalDetVdriftUsed->GetValue(fCountDet);
+ fCurrentCoef2[1] = fCalDetExBUsed->GetValue(fCountDet);
return kTRUE;
}