1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 #include "AliMUONGain.h"
19 #include "AliMUONPedestal.h"
20 #include "AliMUONErrorCounter.h"
21 #include "AliMUON2DMap.h"
22 #include "AliMUONVCalibParam.h"
23 #include "AliMUONVStore.h"
24 #include "AliMpIntPair.h"
27 #include <THashList.h>
28 #include <TTimeStamp.h>
32 #include <TGraphErrors.h>
34 #include <Riostream.h>
40 //-----------------------------------------------------------------------------
41 /// \class AliMUONGain
43 /// Implementation of calibration computing
48 /// \author Alberto Baldisseri, JL Charvet
49 //-----------------------------------------------------------------------------
57 //______________________________________________________________________________
58 Double_t funcLin (const Double_t *x, const Double_t *par)
61 return par[0] + par[1]*x[0];
64 //______________________________________________________________________________
65 Double_t funcParabolic (const Double_t *x, const Double_t *par)
67 /// Parabolic function
68 return par[0]*x[0]*x[0];
71 //______________________________________________________________________________
72 Double_t funcCalib (const Double_t *x, const Double_t *par)
74 /// Calibration function
75 Double_t xLim= par[3];
77 if(x[0] <= xLim) return par[0] + par[1]*x[0];
79 Double_t yLim = par[0]+ par[1]*xLim;
80 return yLim + par[1]*(x[0] - xLim) + par[2]*(x[0] - xLim)*(x[0] - xLim);
88 //______________________________________________________________________________
89 AliMUONGain::AliMUONGain()
98 /// Default constructor
100 sprintf(fRootDataFileName," "); //Gain
102 // AliMUONPedestal& operator=(const AliMUONPedestal& other); Copy ctor
104 //______________________________________________________________________________
105 AliMUONGain::~AliMUONGain()
110 //______________________________________________________________________________
111 TString AliMUONGain::WriteDummyHeader(void)
115 ostringstream stream;
116 stream<<"//DUMMY FILE (to prevent Shuttle failure)"<< endl;
117 stream<<"//================================================" << endl;
118 stream<<"// MUONTRKda: Calibration run " << endl;
119 stream<<"//================================================" << endl;
120 stream<<"// * Run : " << fRunNumber << endl;
121 stream<<"// * Date : " << fDate->AsString("l") <<endl;
122 stream<<"// * DAC : " << fInjCharge << endl;
123 stream<<"//-------------------------------------------------" << endl;
125 return TString(stream.str().c_str());
128 //______________________________________________________________________________
129 void AliMUONGain::MakePedStoreForGain(TString shuttleFile)
135 Char_t flatFile[256]="";
138 // Store pedestal map in root file
141 // write dummy ascii file -> Shuttle
144 // fileout.open(shuttleFile.Data());
145 // tempstring = WriteDummyHeader();
146 // fileout << tempstring;
148 pfilew = fopen (shuttleFile,"w");
150 fprintf(pfilew,"//DUMMY FILE (to prevent Shuttle failure)\n");
151 fprintf(pfilew,"//================================================\n");
152 fprintf(pfilew,"// MUONTRKda: Calibration run \n");
153 fprintf(pfilew,"//=================================================\n");
154 fprintf(pfilew,"// * Run : %d \n",fRunNumber);
155 fprintf(pfilew,"// * Date : %s \n",fDate->AsString("l"));
156 fprintf(pfilew,"// * DAC : %d \n",fInjCharge);
157 fprintf(pfilew,"//-------------------------------------------------\n");
167 // compute and store mean DAC values (like pedestals)
168 sprintf(flatFile,"%s.ped",fprefixDA);
170 cout << "\n" << fprefixDA << " : Flat file generated : " << flatFile << "\n";
171 if (!outputFile.IsNull())
173 ofstream out(outputFile.Data());
174 MakeASCIIoutput(out);
179 TString mode("UPDATE");
184 TFile* histoFile = new TFile(fRootDataFileName, mode.Data(), "MUON Tracking Gains");
186 // second argument should be the injected charge, taken from config crocus file
187 // put also info about run number could be usefull
188 AliMpIntPair* pair = new AliMpIntPair(fRunNumber,fInjCharge );
190 if (mode.CompareTo("UPDATE") == 0) {
191 tree = (TTree*)histoFile->Get("t");
192 tree->SetBranchAddress("run",&pair);
193 tree->SetBranchAddress("ped",&fPedestalStore);
196 tree = new TTree("t","Pedestal tree");
197 tree->Branch("run", "AliMpIntPair",&pair);
198 tree->Branch("ped", "AliMUON2DMap",&fPedestalStore);
199 tree->SetBranchAddress("run",&pair);
200 tree->SetBranchAddress("ped",&fPedestalStore);
205 tree->Write("t", TObject::kOverwrite); // overwrite the tree
211 //______________________________________________________________________________
212 TString AliMUONGain::WriteGainHeader(Int_t nInit, Int_t nEntries, Int_t nbpf2, Int_t *numrun, Double_t *injCharge)
214 /// Header of the calibration output file
216 ostringstream stream;
219 stream<<"//=======================================================" << endl;
220 stream<<"// Calibration file calculated by " << fprefixDA <<endl;
221 stream<<"//=======================================================" << endl;
222 stream<<"// * Run : " << fRunNumber << endl;
223 stream<<"// * Date : " << fDate->AsString("l") <<endl;
224 stream<<"// * Statictics : " << fNEvents << endl;
226 stream<<"// * # of MANUS : " << fNManu_config << " read in the Det. config. " << endl;
227 stream<<"// * # of MANUS : " << fNManu << " read in raw data " << endl;
228 stream<<"// * # of MANUS : " << fNChannel/64 << " written in calibration file " << endl;
229 stream<<"// * # of channels : " << fNChannel << endl;
230 stream<<"//-------------------------------------------------------" << endl;
233 stream<<"// "<< nEntries <<" DAC values fit: "<< fnbpf1 << " pts (1st order) " << nbpf2 << " pts (2nd order)" << endl;
235 stream<<"// "<< nEntries <<" DAC values fit: "<< fnbpf1 << " pts (1st order) " << nbpf2 << " pts (2nd order) DAC=0 excluded" << endl;
237 stream<<"// RUN DAC " << endl;
238 stream<<"//-----------------" << endl;
239 for (Int_t i = 0; i < nEntries; ++i) {
240 stream<<Form("// %d %5.0f \n",numrun[i],injCharge[i]);
242 stream<<"//=======================================" << endl;
243 stream<<"// BP MANU CH. a1 a2 thres. q " << endl;
244 stream<<"//=======================================" << endl;
246 return TString(stream.str().c_str());
249 //______________________________________________________________________________
250 TString AliMUONGain::WriteGainData(Int_t BP, Int_t Manu, Int_t ch, Double_t p1, Double_t p2, Int_t threshold, Int_t q)
252 /// Write calibration parameters per channel
254 ostringstream stream("");
255 stream << Form("%4i %5i %2i %7.4f %10.3e %4i %2x\n",BP,Manu,ch,p1,p2,threshold,q);
256 return TString(stream.str().c_str());
260 //_______________________________________________________________________________
261 void AliMUONGain::MakeGainStore(TString shuttleFile)
263 /// Store gains in ASCII files
267 Char_t filename[256];
269 Double_t goodA1Min = 0.5;
270 Double_t goodA1Max = 2.;
271 // Double_t goodA1Min = 0.7;
272 // Double_t goodA1Max = 1.7;
273 Double_t goodA2Min = -0.5E-03;
274 Double_t goodA2Max = 1.E-03;
275 // Table for uncalibrated buspatches and manus
276 THashList* uncalBuspatchManuTable = new THashList(1000,2);
280 // open file MUONTRKda_gain_data.root
281 // read again the pedestal for the calibration runs (11 runs)
282 // need the injection charge from config file (to be done)
283 // For each channel make a TGraphErrors (mean, sigma) vs injected charge
284 // Fit with a polynomial fct
285 // store the result in a flat file.
287 if(fIndex==0)cout << " Root data file = " << fRootDataFileName << endl;
288 TFile* histoFile = new TFile(fRootDataFileName);
290 AliMUON2DMap* map[11];
291 AliMUONVCalibParam* ped[11];
292 AliMpIntPair* run[11];
294 //read back from root file
295 TTree* tree = (TTree*)histoFile->Get("t");
296 Int_t nEntries = tree->GetEntries();
298 Int_t nbpf2 = nEntries - (fnInit + fnbpf1) + 1; // nb pts used for 2nd order fit
301 for (Int_t i = 0; i < nEntries; ++i) {
304 tree->SetBranchAddress("ped",&map[i]);
305 tree->SetBranchAddress("run",&run[i]);
307 // std::cout << map[i] << " " << run[i] << std::endl;
309 // RunNumber extracted from Root data fil
310 if(fIndex==0)fRunNumber=(UInt_t)run[nEntries-1]->GetFirst();
311 // sscanf(getenv("DATE_RUN_NUMBER"),"%d",&gAliRunNumber);
313 Double_t pedMean[11];
314 Double_t pedSigma[11];
315 for ( Int_t i=0 ; i<11 ; i++) {pedMean[i]=0.;pedSigma[i]=1.;};
316 Double_t injCharge[11];
317 Double_t injChargeErr[11];
318 for ( Int_t i=0 ; i<11 ; i++) {injCharge[i]=0.;injChargeErr[i]=1.;};
321 cout<<"\n ******** MUONTRKda for Gain computing (Last Run = " << fRunNumber << ") ********\n" << endl;
322 cout<<" * Date : " << fDate->AsString("l") << "\n" << endl;
323 cout << " Entries = " << nEntries << " DAC values \n" << endl;
324 for (Int_t i = 0; i < nEntries; ++i) {
325 cout<< " Run = " << run[i]->GetFirst() << " DAC = " << run[i]->GetSecond() << endl;
326 numrun[i] = run[i]->GetFirst();
327 injCharge[i] = run[i]->GetSecond();
328 injChargeErr[i] = 0.01*injCharge[i];
329 if(injChargeErr[i] <= 1.) injChargeErr[i]=1.;
333 // print out in .log file
335 (*fFilcout)<<"\n\n//=================================================" << endl;
336 (*fFilcout)<<"// MUONTRKda: Gain Computing Run = " << fRunNumber << endl;
337 (*fFilcout)<<"// RootDataFile = "<< fRootDataFileName << endl;
338 (*fFilcout)<<"//=================================================" << endl;
339 (*fFilcout)<<"//* Date : " << fDate->AsString("l") << "\n" << endl;
343 // why 2 files ? (Ch. F.) => second file contains detailed results
347 sprintf(filename,"%s.param",fprefixDA);
348 cout << " Second fit parameter file = " << filename << "\n";
349 pfilen = fopen (filename,"w");
351 fprintf(pfilen,"//===================================================================\n");
352 fprintf(pfilen,"// BP MANU CH. par[0] [1] [2] [3] xlim P(chi2) p1 P(chi2)2 p2\n");
353 fprintf(pfilen,"//===================================================================\n");
354 fprintf(pfilen,"// * Run : %d \n",fRunNumber);
355 fprintf(pfilen,"//===================================================================\n");
359 // file outputs for gain
362 pfilew.open(shuttleFile.Data());
363 // Write Header Data of the .par file
364 pfilew << WriteGainHeader(fnInit,nEntries,nbpf2,numrun,injCharge);
366 // print mean and sigma values in file
370 sprintf(filename,"%s.peak",fprefixDA);
371 cout << " File containing Peak mean values = " << filename << "\n";
372 pfilep = fopen (filename,"w");
374 fprintf(pfilep,"//==============================================================================================================================\n");
375 fprintf(pfilep,"// * Run : %d \n",fRunNumber);
376 fprintf(pfilep,"//==============================================================================================================================\n");
377 fprintf(pfilep,"// BP MANU CH. Ped. <0> <1> <2> <3> <4> <5> <6> <7> <8> <9> <10> \n");
378 fprintf(pfilep,"//==============================================================================================================================\n");
379 fprintf(pfilep,"// DAC= %9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f fC\n",injCharge[0],injCharge[1],injCharge[2],injCharge[3],injCharge[4],injCharge[5],injCharge[6],injCharge[7],injCharge[8],injCharge[9],injCharge[10]);
380 fprintf(pfilep,"// %9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f\n",injChargeErr[0],injChargeErr[1],injChargeErr[2],injChargeErr[3],injChargeErr[4],injChargeErr[5],injChargeErr[6],injChargeErr[7],injChargeErr[8],injChargeErr[9],injChargeErr[10]);
381 fprintf(pfilep,"//==============================================================================================================================\n");
385 Double_t chi2P2 = 0.;
387 Double_t prChi2P2 =0;
388 Double_t a0=0.,a1=1.,a2=0.;
397 Double_t capa=0.2; // internal capacitor (pF)
401 TFile* gainFile = 0x0;
405 sprintf(fHistoFileName,"%s.root",fprefixDA);
406 gainFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking gains");
407 tg = new TTree("tg","TTree avec class Manu_DiMu");
409 tg->Branch("bp",&busPatchId, "busPatchId/I");
410 tg->Branch("manu",&manuId, "manuId/I");
411 tg->Branch("channel",&channelId, "channelId/I");
413 tg->Branch("a0",&a0, "a0/D");
414 tg->Branch("a1",&a1, "a1/D");
415 tg->Branch("a2",&a2, "a2/D");
416 tg->Branch("Pchi2",&prChi2, "prChi2/D");
417 tg->Branch("Pchi2_2",&prChi2P2, "prChi2P2/D");
418 tg->Branch("Threshold",&threshold, "threshold/I");
419 tg->Branch("q",&q, "q/I");
420 tg->Branch("p1",&p1, "p1/I");
421 tg->Branch("p2",&p2, "p2/I");
422 tg->Branch("gain",&gain, "gain/D");
427 // iterates over the first pedestal run
428 TIter next(map[0]->CreateIterator());
429 AliMUONVCalibParam* p;
432 Int_t nGoodChannel = 0;
433 Int_t nBadChannel = 0;
434 Int_t noFitChannel = 0;
436 Double_t sumProbChi2 = 0.;
438 Double_t sumProbChi2P2 = 0.;
441 Double_t x[11], xErr[11], y[11], yErr[11];
442 Double_t xp[11], xpErr[11], yp[11], ypErr[11];
444 Int_t uncalcountertotal=0 ;
446 while ( ( p = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
450 busPatchId = p->ID0();
453 // read back pedestal from the other runs for the given (bupatch, manu)
454 for (Int_t i = 1; i < nEntries; ++i) {
455 ped[i] = static_cast<AliMUONVCalibParam*>(map[i]->FindObject(busPatchId, manuId));
458 // compute for each channel the gain parameters
459 for ( channelId = 0; channelId < ped[0]->Size() ; ++channelId )
463 for (Int_t i = 0; i < nEntries; ++i) {
465 if (!ped[i]) continue; //shouldn't happen.
466 pedMean[i] = ped[i]->ValueAsDouble(channelId, 0);
467 pedSigma[i] = ped[i]->ValueAsDouble(channelId, 1);
469 if (pedMean[i] < 0) continue; // not connected
471 if (pedSigma[i] <= 0) pedSigma[i] = 1.; // should not happen.
476 // print_peak_mean_values
480 fprintf(pfilep,"%4i%5i%5i%10.3f",busPatchId,manuId,channelId,0.);
481 fprintf(pfilep,"%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f \n",pedMean[0],pedMean[1],pedMean[2],pedMean[3],pedMean[4],pedMean[5],pedMean[6],pedMean[7],pedMean[8],pedMean[9],pedMean[10]);
482 fprintf(pfilep," sig= %9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f \n",pedSigma[0],pedSigma[1],pedSigma[2],pedSigma[3],pedSigma[4],pedSigma[5],pedSigma[6],pedSigma[7],pedSigma[8],pedSigma[9],pedSigma[10]);
488 // Fit Method: Linear fit over gAlinbpf1 points + parabolic fit over nbpf2 points)
489 // nInit=1 : 1st pt DAC=0 excluded
491 // 1. - linear fit over gAlinbpf1 points
493 Double_t par[4] = {0.,0.5,0.,kADCMax};
494 Int_t nbs = nEntries - fnInit;
495 if(nbs < fnbpf1)fnbpf1=nbs;
498 for (Int_t j = 0; j < nbs; ++j)
500 Int_t k = j + fnInit;
502 if(x[j]<=0. || x[j]== kADCMax)fitproceed=0;
503 xErr[j] = pedSigma[k];
505 yErr[j] = injChargeErr[k];
509 TGraphErrors *graphErr;
510 if(!fitproceed) { p1=0; p2=0; noFitChannel++;}
515 TF1 *f1 = new TF1("f1",funcLin,0.,kADCMax,2);
516 graphErr = new TGraphErrors(fnbpf1, x, y, xErr, yErr);
518 f1->SetParameters(0,0);
520 graphErr->Fit("f1","RQ");
522 chi2 = f1->GetChisquare();
523 f1->GetParameters(par);
529 prChi2 = TMath::Prob(chi2, fnbpf1 - 2);
531 Double_t xLim = pedMean[fnInit + fnbpf1 - 1];
532 Double_t yLim = par[0]+par[1] * xLim;
537 // 2. - Translation : new origin (xLim, yLim) + parabolic fit over nbf2 points
541 for (Int_t j = 0; j < nbpf2; j++)
543 Int_t k = j + (fnInit + fnbpf1) - 1;
544 xp[j] = pedMean[k] - xLim;
545 xpErr[j] = pedSigma[k];
547 yp[j] = injCharge[k] - yLim - par[1]*xp[j];
548 ypErr[j] = injChargeErr[k];
551 TF1 *f2 = new TF1("f2",funcParabolic,0.,kADCMax,1);
552 graphErr = new TGraphErrors(nbpf2, xp, yp, xpErr, ypErr);
554 graphErr->Fit(f2,"RQ");
555 chi2P2 = f2->GetChisquare();
556 f2->GetParameters(par);
562 prChi2P2 = TMath::Prob(chi2P2, nbpf2-1);
571 if(prChi2>0.999999)prChi2=0.999999 ; if(prChi2P2>0.999999)prChi2P2=0.9999999; // avoiding Pr(Chi2)=1 value
572 p1 = TMath::Nint(floor(prChi2*15))+1; // round down value : floor(2.8)=2.
573 p2 = TMath::Nint(floor(prChi2P2*15))+1;
574 q = p1*16 + p2; // fit quality
576 Double_t x0 = -par[0]/par[1]; // value of x corresponding to à 0 fC
577 threshold = TMath::Nint(ceil(par[3]-x0)); // linear if x < threshold
581 fprintf(pfilen,"%4i %4i %2i",busPatchId,manuId,channelId);
582 fprintf(pfilen," %6.2f %6.4f %10.3e %4.2f %4i %8.6f %8.6f %x %8.6f %8.6f %x\n",
583 par[0], par[1], par[2], par[3], threshold, prChi2, floor(prChi2*15), p1, prChi2P2, floor(prChi2P2*15),p2);
588 if(par[1]< goodA1Min || par[1]> goodA1Max) p1=0;
589 if(par[2]< goodA2Min || par[2]> goodA2Max) p2=0;
593 if(fitproceed && p1>0 && p2>0)
596 sumProbChi2 += prChi2;
598 sumProbChi2P2 += prChi2P2;
601 else // bad calibration
605 par[1]=0.5; a1=0.5; p1=0;
606 par[2]=0.; a2=0.; p2=0;
609 // bad calibration counter
610 char bpmanuname[256];
611 AliMUONErrorCounter* uncalcounter;
613 sprintf(bpmanuname,"bp%dmanu%d",busPatchId,manuId);
614 if (!(uncalcounter = (AliMUONErrorCounter*)uncalBuspatchManuTable->FindObject(bpmanuname)))
616 // New buspatch_manu name
617 uncalcounter= new AliMUONErrorCounter (busPatchId,manuId);
618 uncalcounter->SetName(bpmanuname);
619 uncalBuspatchManuTable->Add(uncalcounter);
623 // Existing buspatch_manu name
624 uncalcounter->Increment();
626 // uncalcounter->Print_uncal()
627 uncalcountertotal ++;
629 gain=1./(par[1]*capa); // mv/fC
634 // if(q==0 and nplot < 100)
635 // if(p1>1 && p2==0 and nplot < 100)
636 if(p1>10 && p2>10 and nplot < 100)
637 // if(p1>=1 and p1<=2 and nplot < 100)
638 // if((p1==1 || p2==1) and nplot < 100)
641 // cout << " nplot = " << nplot << endl;
642 TF1 *f2Calib = new TF1("f2Calib",funcCalib,0.,kADCMax,NFITPARAMS);
644 graphErr = new TGraphErrors(nEntries,pedMean,injCharge,pedSigma,injChargeErr);
646 sprintf(graphName,"BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
648 graphErr->SetTitle(graphName);
649 graphErr->SetMarkerColor(3);
650 graphErr->SetMarkerStyle(12);
651 graphErr->Write(graphName);
653 sprintf(graphName,"f2_BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
654 f2Calib->SetTitle(graphName);
655 f2Calib->SetLineColor(4);
656 f2Calib->SetParameters(par);
657 f2Calib->Write(graphName);
670 pfilew << WriteGainData(busPatchId,manuId,channelId,par[1],par[2],threshold,q);
673 if(nmanu % 500 == 0)std::cout << " Nb manu = " << nmanu << std::endl;
677 if (uncalBuspatchManuTable->GetSize())
679 uncalBuspatchManuTable->Sort(); // use compare
680 TIterator* iter = uncalBuspatchManuTable->MakeIterator();
681 AliMUONErrorCounter* uncalcounter;
682 (*fFilcout) << "\n List of problematic BusPatch and Manu " << endl;
683 (*fFilcout) << " ========================================" << endl;
684 (*fFilcout) << " BP Manu Nb Channel " << endl ;
685 (*fFilcout) << " ========================================" << endl;
686 while((uncalcounter = (AliMUONErrorCounter*) iter->Next()))
688 (*fFilcout) << "\t" << uncalcounter->BusPatch() << "\t " << uncalcounter->ManuId() << "\t\t" << uncalcounter->Events() << endl;
690 (*fFilcout) << " ========================================" << endl;
692 (*fFilcout) << " Number of bad calibrated Manu = " << uncalBuspatchManuTable->GetSize() << endl ;
693 (*fFilcout) << " Number of bad calibrated channel = " << uncalcountertotal << endl;
698 (*fFilcout) << "\n Nb of channels in raw data = " << nmanu*64 << " (" << nmanu << " Manu)" << endl;
699 (*fFilcout) << " Nb of calibrated channel = " << nGoodChannel << " (" << goodA1Min << "<a1<" << goodA1Max
700 << " and " << goodA2Min << "<a2<" << goodA2Max << ") " << endl;
701 (*fFilcout) << " Nb of uncalibrated channel = " << nBadChannel << " (" << noFitChannel << " unfitted)" << endl;
703 cout << "\n Nb of channels in raw data = " << nmanu*64 << " (" << nmanu << " Manu)" << endl;
704 cout << " Nb of calibrated channel = " << nGoodChannel << " (" << goodA1Min << "<a1<" << goodA1Max
705 << " and " << goodA2Min << "<a2<" << goodA2Max << ") " << endl;
706 cout << " Nb of uncalibrated channel = " << nBadChannel << " (" << noFitChannel << " unfitted)" << endl;
708 Double_t meanA1 = sumA1/(nGoodChannel);
709 Double_t meanProbChi2 = sumProbChi2/(nGoodChannel);
710 Double_t meanA2 = sumA2/(nGoodChannel);
711 Double_t meanProbChi2P2 = sumProbChi2P2/(nGoodChannel);
713 Double_t capaManu = 0.2; // pF
714 (*fFilcout) << "\n linear fit : <a1> = " << meanA1 << "\t <gain> = " << 1./(meanA1*capaManu)
715 << " mV/fC (capa= " << capaManu << " pF)" << endl;
716 (*fFilcout) << " Prob(chi2)> = " << meanProbChi2 << endl;
717 (*fFilcout) << "\n parabolic fit: <a2> = " << meanA2 << endl;
718 (*fFilcout) << " Prob(chi2)> = " << meanProbChi2P2 << "\n" << endl;
720 cout << "\n <gain> = " << 1./(meanA1*capaManu)
721 << " mV/fC (capa= " << capaManu << " pF)"
722 << " Prob(chi2)> = " << meanProbChi2 << endl;
726 if(fPlotLevel>0){tg->Write();histoFile->Close();}
727 if(fPrintLevel>1){fclose(pfilep); fclose(pfilen);}