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 ***************************************************************************/
16 ///////////////////////////////////////////////////////////////
18 // This class provides TOF pass0/passX calibration tools //
20 ///////////////////////////////////////////////////////////////
22 #include "AliTOFAnalysisTaskCalibPass0.h"
23 #include "AliESDtrack.h"
24 #include "AliESDEvent.h"
25 #include "AliPhysicsSelection.h"
26 #include "AliESDtrackCuts.h"
27 #include "AliCDBManager.h"
28 #include "AliGRPManager.h"
29 #include "AliGRPObject.h"
30 #include "AliTOFcalib.h"
35 #include "TObjArray.h"
37 #include "TObjString.h"
42 #include "TTimeStamp.h"
43 #include "AliTOFRunParams.h"
44 #include "AliCDBStorage.h"
46 #include "AliCDBMetaData.h"
50 ClassImp(AliTOFAnalysisTaskCalibPass0)
52 //_______________________________________________________
54 const Int_t AliTOFAnalysisTaskCalibPass0::fgkMaxNumberOfPoints = 10000; // max number of points
55 const Double_t AliTOFAnalysisTaskCalibPass0::fgkMinVertexIntegral = 1000.;
56 const Double_t AliTOFAnalysisTaskCalibPass0::fgkMinDeltatIntegral = 20000.;
58 //_______________________________________________________
60 AliTOFAnalysisTaskCalibPass0::AliTOFAnalysisTaskCalibPass0() :
61 AliAnalysisTaskSE("TOFCalib-Pass0"),
63 fEventSelectionFlag(kFALSE),
64 fVertexSelectionFlag(kFALSE),
68 fEventCuts(new AliPhysicsSelection()),
69 fTrackCuts(new AliESDtrackCuts()),
75 fGRPManager(new AliGRPManager()),
77 fTOFcalib(new AliTOFcalib()),
78 fHistoList(new TList()),
79 fHistoVertexTimestamp(NULL),
80 fHistoDeltatTimestamp(NULL),
81 fHistoDeltazEta(NULL),
82 fHistoDeltazCosTheta(NULL),
83 fHistoAcceptedTracksEtaPt(NULL),
84 fHistoMatchedTracksEtaPt(NULL)
91 fHistoList->SetOwner(kTRUE);
92 DefineOutput(1, TList::Class());
95 //_______________________________________________________
97 AliTOFAnalysisTaskCalibPass0::~AliTOFAnalysisTaskCalibPass0()
103 if (fHistoList) delete fHistoList;
106 //_______________________________________________________
109 AliTOFAnalysisTaskCalibPass0::InitRun()
116 fESDEvent = dynamic_cast<AliESDEvent *>(InputEvent());
118 AliError("cannot get ESD event");
122 Int_t runNb = fESDEvent->GetRunNumber();
123 /* check run already initialized */
124 if (fInitFlag && fRunNumber == runNb) return kTRUE;
125 if (fInitFlag && fRunNumber != runNb) {
126 AliFatal(Form("run number has changed within same job and this is not allowed: %d -> %d", fRunNumber, runNb));
130 /* init cdb if not yet done */
131 AliCDBManager *cdb = AliCDBManager::Instance();
132 if (!cdb->IsDefaultStorageSet())
133 cdb->SetDefaultStorage("raw://");
134 if (cdb->GetRun() < 0)
137 if (!fTOFcalib->Init()) {
138 AliError("cannot init TOF calib");
142 if (!fGRPManager->ReadGRPEntry()) {
143 AliError("error while reading \"GRPEntry\" from OCDB");
146 fkGRPObject = fGRPManager->GetGRPData();
148 AliError("cannot get \"GRPData\" from GRP manager");
151 fStartTime = fkGRPObject->GetTimeStart();
152 fEndTime = fkGRPObject->GetTimeEnd();
153 AliInfo(Form("got \"GRPData\": startTime=%d, endTime=%d", fStartTime, fEndTime));
155 AliInfo(Form("initialized for run %d", runNb));
159 /* set histo title with run-number and start-time */
160 fHistoVertexTimestamp->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
161 fHistoDeltatTimestamp->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
162 fHistoDeltazEta->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
163 fHistoDeltazCosTheta->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
164 fHistoAcceptedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
165 fHistoMatchedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
170 //_______________________________________________________
173 AliTOFAnalysisTaskCalibPass0::InitEvent()
180 fESDEvent = dynamic_cast<AliESDEvent *>(InputEvent());
181 if (!fESDEvent) return kFALSE;
182 /* set event time and elapsed time */
183 fEventTime = fESDEvent->GetTimeStamp();
184 fElapsedTime = fESDEvent->GetTimeStamp() - fStartTime;
185 /* event selection */
186 if (fEventSelectionFlag && !fEventCuts->IsCollisionCandidate(fESDEvent)) return kFALSE;
187 /* vertex selection */
188 fkVertex = fESDEvent->GetPrimaryVertexTracks();
189 if (fVertexSelectionFlag && fkVertex->GetNContributors() < 1) {
190 fkVertex = fESDEvent->GetPrimaryVertexSPD();
191 if (fkVertex->GetNContributors() < 1) return kFALSE;
193 if (fVertexSelectionFlag && TMath::Abs(fkVertex->GetZ()) > fVertexCut) return kFALSE;
194 /* calibrate ESD if requested */
195 fTOFcalib->CalibrateESD(fESDEvent);
200 //_______________________________________________________
203 AliTOFAnalysisTaskCalibPass0::HasTOFMeasurement(const AliESDtrack *track) const
206 * has TOF measurement
209 /* check TOF status flags */
210 if (!(track->GetStatus() & AliESDtrack::kTOFout) ||
211 !(track->GetStatus() & AliESDtrack::kTIME)) return kFALSE;
212 /* check integrated length */
213 if (track->GetIntegratedLength() < 350.) return kFALSE;
215 /* TOF measurement ok */
219 //_______________________________________________________
222 AliTOFAnalysisTaskCalibPass0::UserCreateOutputObjects()
225 * user create output objects
229 Int_t timeBins = 288;
230 Float_t timeMin = 0.;
231 Float_t timeMax = 24. * 3600.;
233 Int_t vertexBins = 200;
234 Float_t vertexMin = -50.;
235 Float_t vertexMax = 50.;
237 Int_t deltatBins = 2000;
238 Float_t deltatMin = -24400.;
239 Float_t deltatMax = 24400.;
241 Int_t deltazBins = 200;
242 Float_t deltazMin = -10.;
243 Float_t deltazMax = 10.;
246 Float_t etaMin = -1.;
253 fHistoVertexTimestamp = new TH2F("hHistoVertexTimestamp", "Vertex position;elapsed time (s);z (cm);", timeBins, timeMin, timeMax, vertexBins, vertexMin, vertexMax);
254 fHistoList->Add(fHistoVertexTimestamp);
256 fHistoDeltatTimestamp = new TH2F("hHistoDeltatTimestamp", "Global time shift (T0-fill);elapsed time (s);t - t_{exp}^{(#pi)} (ps);", timeBins, timeMin, timeMax, deltatBins, deltatMin, deltatMax);
257 fHistoList->Add(fHistoDeltatTimestamp);
259 fHistoDeltazEta = new TH2F("hHistoDeltazEta", "Matching residuals (longitudinal);#eta;#Deltaz (cm);", etaBins, etaMin, etaMax, deltazBins, deltazMin, deltazMax);
260 fHistoList->Add(fHistoDeltazEta);
262 fHistoDeltazCosTheta = new TH2F("hHistoDeltazCosTheta", "Matching residuals (longitudinal);cos #theta;#Deltaz (cm);", etaBins, etaMin, etaMax, deltazBins, deltazMin, deltazMax);
263 fHistoList->Add(fHistoDeltazCosTheta);
265 fHistoAcceptedTracksEtaPt = new TH2F("hHistoAcceptedTracksEtaPt", "Accepted tracks;#eta;#p_{T} (GeV/c);", etaBins, etaMin, etaMax, pBins, pMin, pMax);
266 fHistoList->Add(fHistoAcceptedTracksEtaPt);
268 fHistoMatchedTracksEtaPt = new TH2F("hHistoMatchedTracksEtaPt", "Matched tracks;#eta;p_{T} (GeV/c);", etaBins, etaMin, etaMax, pBins, pMin, pMax);
269 fHistoList->Add(fHistoMatchedTracksEtaPt);
272 PostData(1, fHistoList);
275 //_______________________________________________________
278 AliTOFAnalysisTaskCalibPass0::UserExec(Option_t *)
285 if (!InitRun()) return;
287 if (!InitEvent()) return;
289 /*** ACCEPTED EVENT ***/
291 /* fill vertex histo */
292 fHistoVertexTimestamp->Fill(fElapsedTime, fkVertex->GetZ());
294 /* loop over ESD tracks */
295 Int_t nTracks = fESDEvent->GetNumberOfTracks();
297 Double_t eta, costheta, pt, time, timei[AliPID::kSPECIES], deltat, deltaz;
298 for (Int_t itrk = 0; itrk < nTracks; itrk++) {
300 track = fESDEvent->GetTrack(itrk);
301 if (!track) continue;
302 /* check accept track */
303 if (!fTrackCuts->AcceptTrack(track)) continue;
306 costheta = TMath::Cos(track->Theta());
308 /* fill accepted tracks histo */
309 fHistoAcceptedTracksEtaPt->Fill(eta, pt);
310 /* check TOF measurement */
311 if (!HasTOFMeasurement(track)) continue;
313 /*** ACCEPTED TRACK WITH TOF MEASUREMENT ***/
315 /* fill matched tracks histo */
316 fHistoMatchedTracksEtaPt->Fill(eta, pt);
318 time = track->GetTOFsignal();
319 track->GetIntegratedTimes(timei);
320 deltat = time - timei[AliPID::kPion];
321 deltaz = track->GetTOFsignalDz();
324 fHistoDeltatTimestamp->Fill(fElapsedTime, deltat);
325 fHistoDeltazEta->Fill(eta, deltaz);
326 fHistoDeltazCosTheta->Fill(costheta, deltaz);
328 } /* end of loop over ESD tracks */
331 PostData(1, fHistoList);
335 //_______________________________________________________
338 AliTOFAnalysisTaskCalibPass0::ProcessOutput(const Char_t *filename, const Char_t *dbString)
345 TFile *file = TFile::Open(filename);
346 if (!file || !file->IsOpen()) {
347 AliError(Form("cannot open output file %s", filename));
351 TList *list = (TList *)file->Get("Histos");
353 AliError(Form("cannot get \"Histos\" list from file %s", filename));
357 TH2F *histoVertexTimestamp = (TH2F *)list->FindObject("hHistoVertexTimestamp");
358 if (!histoVertexTimestamp) {
359 AliError(Form("cannot get \"hHistoVertexTimestamp\" object from file %s", filename));
362 TH2F *histoDeltatTimestamp = (TH2F *)list->FindObject("hHistoDeltatTimestamp");
363 if (!histoDeltatTimestamp) {
364 AliError(Form("cannot get \"hHistoDeltatTimestamp\" object from file %s", filename));
367 TH2F *histoDeltazEta = (TH2F *)list->FindObject("hHistoDeltazEta");
368 if (!histoDeltazEta) {
369 AliError(Form("cannot get \"hHistoDeltazEta\" object from file %s", filename));
372 TH2F *histoDeltazCosTheta = (TH2F *)list->FindObject("hHistoDeltazCosTheta");
373 if (!histoDeltazCosTheta) {
374 AliError(Form("cannot get \"hHistoDeltazCosTheta\" object from file %s", filename));
377 TH2F *histoAcceptedTracksEtaPt = (TH2F *)list->FindObject("hHistoAcceptedTracksEtaPt");
378 if (!histoAcceptedTracksEtaPt) {
379 AliError(Form("cannot get \"hHistoAccptedTracksEtaPt\" object from file %s", filename));
382 TH2F *histoMatchedTracksEtaPt = (TH2F *)list->FindObject("hHistoMatchedTracksEtaPt");
383 if (!histoMatchedTracksEtaPt) {
384 AliError(Form("cannot get \"hHistoMatchedTracksEtaPt\" object from file %s", filename));
387 /* check matching performance */
388 if (!CheckMatchingPerformance(histoDeltazEta, histoAcceptedTracksEtaPt, histoMatchedTracksEtaPt)) {
389 AliError("error while checking matching efficiency");
392 /* calibrate and store */
393 if (!CalibrateAndStore(histoVertexTimestamp, histoDeltatTimestamp, dbString)) {
394 AliError("error while calibrating and storing");
402 //_______________________________________________________
405 AliTOFAnalysisTaskCalibPass0::CheckMatchingPerformance(const TH2F *histoDeltazCosTheta, const TH2F *histoAcceptedTracksEtaPt, const TH2F *histoMatchedTracksEtaPt) const
408 * check matching performance
412 if (!histoDeltazCosTheta || !histoAcceptedTracksEtaPt || !histoMatchedTracksEtaPt)
414 /* dummy for the time being */
418 //_______________________________________________________
421 AliTOFAnalysisTaskCalibPass0::CalibrateAndStore(TH2F *histoVertexTimestamp, TH2F *histoDeltatTimestamp, const Char_t *dbString)
424 * calibrate and store
428 if (!histoVertexTimestamp || !histoDeltatTimestamp)
431 /*** GET RUN-NUMBER AND START-TIMESTAMP ***/
434 TObjArray *strarr = NULL;
435 TObjString *ostr = NULL;
436 str = histoVertexTimestamp->GetTitle();
437 strarr = str.Tokenize(",");
439 AliError("problems whith tokenize histogram title");
444 ostr = (TObjString *)strarr->At(0);
446 AliError("problems while getting run number from histogram title");
449 str = ostr->GetString();
450 if (!str.BeginsWith("run:")) {
451 AliError("problems while getting run number from histogram title");
455 Int_t runNb = atoi(str.Data());
457 AliError(Form("bad run number: %d", runNb));
460 AliInfo(Form("got run number: %d", runNb));
462 /* start timestamp */
463 ostr = (TObjString *)strarr->At(1);
465 AliError("problems while getting start timestamp from histogram title");
468 str = ostr->GetString();
469 str.Remove(0, 1); /* remove empty space at the beginning */
470 if (!str.BeginsWith("startTimestamp:")) {
471 AliError("problems while getting start timestamp from histogram title");
475 UInt_t startTimestamp = atoi(str.Data());
476 if (startTimestamp <= 0) {
477 AliError(Form("bad start timestamp: %d", startTimestamp));
480 TTimeStamp ts = startTimestamp;
481 AliInfo(Form("got start timestamp: %d (%s)", startTimestamp, ts.AsString()));
483 /*** CALIBRATION STAGE ***/
485 /* get fit function */
486 TF1 *fitFunc = (TF1 *)gROOT->GetFunction("gaus");
489 TH1D *histoVertexTimestamppx = histoVertexTimestamp->ProjectionX("histoVertexTimestamppx");
490 TH1D *histoDeltatTimestamppx = histoDeltatTimestamp->ProjectionX("histoDeltatTimestamppx");
492 /* define mix and max time bin */
493 Int_t minBin = histoVertexTimestamppx->FindFirstBinAbove(0);
494 Int_t maxBin = histoVertexTimestamppx->FindLastBinAbove(0);
495 Float_t minTime = histoVertexTimestamppx->GetBinLowEdge(minBin);
496 Float_t maxTime = histoVertexTimestamppx->GetBinLowEdge(maxBin + 1);
497 AliInfo(Form("min/max time defined: %d < t < %d s [%d, %d]", (Int_t)minTime, (Int_t)maxTime, minBin, maxBin));
499 /* loop over time bins */
501 Float_t time[fgkMaxNumberOfPoints], timeerr[fgkMaxNumberOfPoints];
502 Float_t vertexMean[fgkMaxNumberOfPoints], vertexMeanerr[fgkMaxNumberOfPoints];
503 Float_t vertexSigma[fgkMaxNumberOfPoints], vertexSigmaerr[fgkMaxNumberOfPoints];
504 Float_t timeZeroMean[fgkMaxNumberOfPoints], timeZeroMeanerr[fgkMaxNumberOfPoints];
505 Float_t timeZeroSigma[fgkMaxNumberOfPoints], timeZeroSigmaerr[fgkMaxNumberOfPoints];
506 Float_t averageTimeZero = 0.;
507 Float_t averageTimeSigma = 0.;
508 Float_t averageVertexSpread = 0.;
509 for (Int_t ibin = minBin; ibin <= maxBin; ibin++) {
511 /* define time window */
512 Int_t startBin = ibin;
514 while(histoVertexTimestamppx->Integral(startBin, endBin) < fgkMinVertexIntegral ||
515 histoDeltatTimestamppx->Integral(startBin, endBin) < fgkMinDeltatIntegral) {
516 if (endBin < maxBin) endBin++;
517 else if (startBin > minBin) startBin--;
520 if (histoVertexTimestamppx->Integral(startBin, endBin) <= 0 ||
521 histoDeltatTimestamppx->Integral(startBin, endBin) <= 0) continue;
522 Float_t startTime = histoVertexTimestamppx->GetBinLowEdge(startBin);
523 Float_t endTime = histoVertexTimestamppx->GetBinLowEdge(endBin + 1);
524 Float_t vertexIntegral = histoVertexTimestamppx->Integral(startBin, endBin);
525 Float_t deltatIntegral = histoDeltatTimestamppx->Integral(startBin, endBin);
526 AliInfo(Form("time window defined: %d < t < %d s [%d, %d]: %d vertices, %d tracks", (Int_t)startTime, (Int_t)endTime, startBin, endBin, (Int_t)vertexIntegral, (Int_t)deltatIntegral));
529 TH1D *histoVertexTimestamppy = histoVertexTimestamp->ProjectionY("histoVertexTimestamppy", startBin, endBin);
530 TH1D *histoDeltatTimestamppy = histoDeltatTimestamp->ProjectionY("histoDeltatTimestamppy", startBin, endBin);
533 histoVertexTimestamppx->GetXaxis()->SetRange(startBin, endBin);
534 time[nPoints] = histoVertexTimestamppx->GetMean();
535 timeerr[nPoints] = histoVertexTimestamppx->GetMeanError();
538 if (FitPeak(fitFunc, histoVertexTimestamppy, 10., 3., 3.) != 0) {
539 AliError("troubles fitting vertex, skip");
540 delete histoVertexTimestamppy;
541 delete histoDeltatTimestamppy;
544 vertexMean[nPoints] = fitFunc->GetParameter(1);
545 vertexMeanerr[nPoints] = fitFunc->GetParError(1);
546 vertexSigma[nPoints] = fitFunc->GetParameter(2);
547 vertexSigmaerr[nPoints] = fitFunc->GetParError(2);
548 averageVertexSpread += fitFunc->GetParameter(2);
551 if (FitPeak(fitFunc, histoDeltatTimestamppy, 500., 2., 1.) != 0) {
552 AliError("troubles fitting time-zero TRACKS, skip");
553 delete histoVertexTimestamppy;
554 delete histoDeltatTimestamppy;
557 timeZeroMean[nPoints] = fitFunc->GetParameter(1);
558 timeZeroMeanerr[nPoints] = fitFunc->GetParError(1);
559 timeZeroSigma[nPoints] = fitFunc->GetParameter(2);
560 timeZeroSigmaerr[nPoints] = fitFunc->GetParError(2);
561 averageTimeZero += fitFunc->GetParameter(1);
562 averageTimeSigma += fitFunc->GetParameter(2);
564 /* delete projection-y */
565 delete histoVertexTimestamppy;
566 delete histoDeltatTimestamppy;
568 /* increment n points */
571 /* set current bin */
574 } /* end of loop over time bins */
576 /* delete projection-x */
577 delete histoVertexTimestamppx;
578 delete histoDeltatTimestamppx;
582 AliError("no measurement available, quit");
585 AliInfo(Form("average time-zero = %f", averageTimeZero / nPoints));
586 AliInfo(Form("average time-sigma = %f", averageTimeSigma / nPoints));
587 AliInfo(Form("average v-spread = %f", averageVertexSpread / nPoints));
589 /*** CREATE RUN PARAMS OBJECT ***/
592 /* get start time from GRP */
593 TGrid::Connect("alien://", 0, 0, "t");
594 AliCDBManager *cdb = AliCDBManager::Instance();
595 cdb->SetDefaultStorage("raw://");
598 if (!grp.ReadGRPEntry()) {
599 AliError("error while reading GRP entry");
602 UInt_t startTimestamp = grp.GetGRPData()->GetTimeStart();
605 AliInfo(Form("got start time from GRP: %s", ts.AsString()));
609 UInt_t timestamp[fgkMaxNumberOfPoints];
610 Float_t t0[fgkMaxNumberOfPoints];
611 Float_t tofReso[fgkMaxNumberOfPoints];
612 Float_t t0Spread[fgkMaxNumberOfPoints];
613 for (Int_t ipoint = 0; ipoint < nPoints; ipoint++) {
614 timestamp[ipoint] = time[ipoint] + (Float_t)startTimestamp;
615 t0[ipoint] = timeZeroMean[ipoint];
616 tofReso[ipoint] = timeZeroSigma[ipoint];
617 t0Spread[ipoint] = vertexSigma[ipoint] / 2.99792457999999984e-02;
619 UInt_t run[1] = {runNb};
620 UInt_t runFirstPoint[1] = {0};
621 UInt_t runLastPoint[1] = {nPoints - 1};
623 /* create run params object */
624 AliTOFRunParams obj(nPoints, 1);
625 AliInfo(Form("create run params object for run %d with %d points", runNb, nPoints));
626 obj.SetTimestamp(timestamp);
628 obj.SetTOFResolution(tofReso);
629 obj.SetT0Spread(t0Spread);
631 obj.SetRunFirstPoint(runFirstPoint);
632 obj.SetRunLastPoint(runLastPoint);
634 /*** CREATE OCDB ENTRY ***/
637 AliError("cannot store object because of NULL string");
641 /* install run params object in OCDB */
642 AliCDBManager *cdb = AliCDBManager::Instance();
643 AliCDBStorage *sto = cdb->GetStorage(dbString);
645 AliError(Form("cannot get storage %s", dbString));
648 AliCDBId id("TOF/Calib/RunParams", runNb, runNb);
650 md.SetResponsible("Roberto Preghenella");
651 md.SetComment("offline TOF run parameters");
652 md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
654 if (!sto->Put(&obj, id, &md)) {
655 AliError(Form("error while putting object in storage %s", dbString));
662 //_____________________________________________________________
665 AliTOFAnalysisTaskCalibPass0::FitPeak(TF1 *fitFunc, TH1D *h, Float_t startSigma, Float_t nSigmaMin, Float_t nSigmaMax)
671 Double_t fitCent = h->GetBinCenter(h->GetMaximumBin());
672 Double_t fitMin = fitCent - nSigmaMin * startSigma;
673 Double_t fitMax = fitCent + nSigmaMax * startSigma;
674 if (fitMin < h->GetXaxis()->GetXmin()) fitMin = h->GetXaxis()->GetXmin();
675 if (fitMax > h->GetXaxis()->GetXmax()) fitMax = h->GetXaxis()->GetXmax();
676 fitFunc->SetParameter(1, fitCent);
677 fitFunc->SetParameter(2, startSigma);
678 Int_t fitres = h->Fit(fitFunc, "WWq0", "", fitMin, fitMax);
679 if (fitres != 0) return fitres;
680 /* refit with better range */
681 for (Int_t i = 0; i < 3; i++) {
682 fitCent = fitFunc->GetParameter(1);
683 fitMin = fitCent - nSigmaMin * fitFunc->GetParameter(2);
684 fitMax = fitCent + nSigmaMax * fitFunc->GetParameter(2);
685 if (fitMin < h->GetXaxis()->GetXmin()) fitMin = h->GetXaxis()->GetXmin();
686 if (fitMax > h->GetXaxis()->GetXmax()) fitMax = h->GetXaxis()->GetXmax();
687 fitres = h->Fit(fitFunc, "q0", "", fitMin, fitMax);
688 if (fitres != 0) return fitres;