#include <Riostream.h>
#include <sstream>
+#include <cstdio>
#define NFITPARAMS 4
if(nInit==1)
stream<<"// "<< nEntries <<" DAC values fit: "<< fnbpf1 << " pts (1st order) " << nbpf2 << " pts (2nd order) DAC=0 excluded" << endl;
stream<<"// * nInit = " << nInit << " * f1nbp = " << fnbpf1 << " * f2nbp = " << nbpf2 << endl;
- stream<<"//" << endl;
stream<<"// RUN DAC " << endl;
stream<<"//-----------------" << endl;
Double_t goodA1Max = 2.;
// Double_t goodA2Min = -0.5E-03;
// Double_t goodA2Max = 1.E-03;
- Double_t goodA2Min = -0.5E-01; // changed 28/10/2009 (JLC) <=> no condition on a2
+ Double_t goodA2Min = -0.5E-01; // changed 28/10/2009 (JLC) <=> enlarged condition on a2
Double_t goodA2Max = 1.E-01;
// Table for uncalibrated buspatches and manus
THashList* uncalBuspatchManuTable = new THashList(1000,2);
// plot out
- TFile* gainFile = 0x0;
TTree* tg = 0x0;
if(fPlotLevel>0)
{
fHistoFileName=Form("%s.root",fPrefixDA.Data());
- gainFile = new TFile(fHistoFileName.Data(),"RECREATE","MUON Tracking gains");
+ new TFile(fHistoFileName.Data(),"RECREATE","MUON Tracking gains");
tg = new TTree("tg","TTree avec class Manu_DiMu");
tg->Branch("bp",&busPatchId, "busPatchId/I");
Double_t xp[11], xpErr[11], yp[11], ypErr[11];
Int_t uncalcountertotal=0 ;
+ Int_t unparabolicfit=0;
while ( ( p = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
{
ped[0] = p;
+ unparabolicfit=0;
busPatchId = p->ID0();
manuId = p->ID1();
n++;
}
-
// print_peak_mean_values
if(fPrintLevel>1)
{
Int_t fitproceed=1;
Int_t nbpf2Dynamic=nbpf2;
+ Int_t adcLimit=4090; // when RMS < 0.5 (in other cases mean values forced to 4095, see DA_PED)
for (Int_t j = 0; j < nbs; ++j)
{
Int_t k = j + fnInit;
x[j] = pedMean[k];
if(x[j]<=0.){fitproceed=0; break;}
- if(x[j]== ADCMax())
+ // if(x[j]>= ADCMax())
+ if(x[j]>= adcLimit)
{
if(j < nbs-1){fitproceed=0; break;}
- else nbpf2Dynamic=nbpf2-1;
+ else { nbpf2Dynamic=nbpf2-1; break;}
}
xErr[j] = pedSigma[k];
y[j] = injCharge[k];
a1 = par[1];
// 2. - Translation : new origin (xLim, yLim) + parabolic fit over nbf2 points
-
- if(nbpf2Dynamic > 1)
+ //checking: if(busPatchId ==1841 && manuId==4)nbpf2Dynamic=2;
+ if(nbpf2Dynamic > 2)
{
for (Int_t j = 0; j < nbpf2Dynamic; j++)
{
prChi2P2 = TMath::Prob(chi2P2, nbpf2Dynamic-1);
a2 = par[0];
}
+ else
+ {
+ unparabolicfit++;
+ (*fFilcout) << " Warning : BP = " << busPatchId << " Manu = " << manuId << " Channel = " << channelId <<": parabolic fit not possible (nbpf2=" << nbpf2Dynamic << ") => a2=0 and linear fit OK" << std::endl;
+ if(unparabolicfit==1) std::cout << " Warning : BP = " << busPatchId << " Manu = " << manuId << ": no parabolic fit for some channels (nbpf2=" << nbpf2Dynamic << "), linear fit is OK (see .log for details)" << std::endl;
+ a2=0. ; prChi2P2=0. ;
+ }
par[0] = a0;
par[1] = a1;
char bpmanuname[256];
AliMUONErrorCounter* uncalcounter;
- sprintf(bpmanuname,"bp%dmanu%d",busPatchId,manuId);
+ snprintf(bpmanuname,256,"bp%dmanu%d",busPatchId,manuId);
if (!(uncalcounter = (AliMUONErrorCounter*)uncalBuspatchManuTable->FindObject(bpmanuname)))
{
// New buspatch_manu name
graphErr = new TGraphErrors(nEntries,pedMean,injCharge,pedSigma,injChargeErr);
- sprintf(graphName,"BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
+ snprintf(graphName,256,"BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
graphErr->SetTitle(graphName);
graphErr->SetMarkerColor(3);
graphErr->SetMarkerStyle(12);
graphErr->Write(graphName);
- sprintf(graphName,"f2_BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
+ snprintf(graphName,256,"f2_BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
f2Calib->SetTitle(graphName);
f2Calib->SetLineColor(4);
f2Calib->SetParameters(par);
delete f2Calib;
}
}
-
-
tg->Fill();
}
-
-
pfilew << WriteGainData(busPatchId,manuId,channelId,par[1],par[2],threshold,q);
}
nmanu++;
- if(nmanu % 500 == 0)std::cout << " Nb manu = " << nmanu << std::endl;
+ Int_t step=500;
+ if(nmanu % step == 0)std::cout << " Nb manu = " << nmanu << std::endl;
}
// print in logfile