Changeset 2599 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 12/04/03 12:17:22 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc
r2525 r2599 69 69 70 70 // Create a large number of bins, later we will rebin 71 fB PQfirst = 0;72 fB PQlast = gkStartBlindPixelBinNr;73 fB PQnbins = gkStartBlindPixelBinNr;74 75 fHB PQ = new TH1I("HBPQ","Distribution of Summed FADC Slices",fBPQnbins,fBPQfirst,fBPQlast);76 fHB PQ->SetXTitle("Sum FADC Slices");77 fHB PQ->SetYTitle("Nr. of events");78 fHB PQ->Sumw2();79 80 fErrB PQfirst = 0.;81 fErrB PQlast = gkStartBlindPixelBinNr;82 fErrB PQnbins = gkStartBlindPixelBinNr;83 84 fHB PErrQ = new TH1F("HBPErrQ","Distribution of Variances of Summed FADC Slices",85 fErrB PQnbins,fErrBPQfirst,fErrBPQlast);86 fHB PErrQ->SetXTitle("Variance Summed FADC Slices");87 fHB PErrQ->SetYTitle("Nr. of events");88 fHB PErrQ->Sumw2();71 fBlindPixelQfirst = 0; 72 fBlindPixelQlast = gkStartBlindPixelBinNr; 73 fBlindPixelQnbins = gkStartBlindPixelBinNr; 74 75 fHBlindPixelQ = new TH1I("HBlindPixelQ","Distribution of Summed FADC Slices",fBlindPixelQnbins,fBlindPixelQfirst,fBlindPixelQlast); 76 fHBlindPixelQ->SetXTitle("Sum FADC Slices"); 77 fHBlindPixelQ->SetYTitle("Nr. of events"); 78 fHBlindPixelQ->Sumw2(); 79 80 fErrBlindPixelQfirst = 0.; 81 fErrBlindPixelQlast = gkStartBlindPixelBinNr; 82 fErrBlindPixelQnbins = gkStartBlindPixelBinNr; 83 84 fHBlindPixelErrQ = new TH1F("HBlindPixelErrQ","Distribution of Variances of Summed FADC Slices", 85 fErrBlindPixelQnbins,fErrBlindPixelQfirst,fErrBlindPixelQlast); 86 fHBlindPixelErrQ->SetXTitle("Variance Summed FADC Slices"); 87 fHBlindPixelErrQ->SetYTitle("Nr. of events"); 88 fHBlindPixelErrQ->Sumw2(); 89 89 90 90 Axis_t tfirst = -0.5; … … 92 92 Int_t nbins = 16; 93 93 94 fHB PT = new TH1I("HBPT","Distribution of Mean Arrival Times",nbins,tfirst,tlast);95 fHB PT->SetXTitle("Mean Arrival Times [FADC slice nr]");96 fHB PT->SetYTitle("Nr. of events");97 fHB PT->Sumw2();94 fHBlindPixelT = new TH1I("HBlindPixelT","Distribution of Mean Arrival Times",nbins,tfirst,tlast); 95 fHBlindPixelT->SetXTitle("Mean Arrival Times [FADC slice nr]"); 96 fHBlindPixelT->SetYTitle("Nr. of events"); 97 fHBlindPixelT->Sumw2(); 98 98 99 99 // We define a reasonable number and later enlarge it if necessary … … 102 102 Axis_t nlast = (Axis_t)nbins - 0.5; 103 103 104 fHB PQvsN = new TH1I("HBPQvsN","Sum of Charges vs. Event Number",nbins,nfirst,nlast);105 fHB PQvsN->SetXTitle("Event Nr.");106 fHB PQvsN->SetYTitle("Sum of FADC slices");104 fHBlindPixelQvsN = new TH1I("HBlindPixelQvsN","Sum of Charges vs. Event Number",nbins,nfirst,nlast); 105 fHBlindPixelQvsN->SetXTitle("Event Nr."); 106 fHBlindPixelQvsN->SetYTitle("Sum of FADC slices"); 107 107 108 108 fgSinglePheFitFunc = &gfKto8; … … 113 113 { 114 114 115 delete fHB PQ;116 delete fHB PT;117 delete fHB PErrQ;115 delete fHBlindPixelQ; 116 delete fHBlindPixelT; 117 delete fHBlindPixelErrQ; 118 118 119 119 if (fSinglePheFit) … … 127 127 void MHCalibrationBlindPixel::ResetBin(Int_t i) 128 128 { 129 fHB PQ->SetBinContent (i, 1.e-20);130 fHB PErrQ->SetBinContent (i, 1.e-20);131 fHB PT->SetBinContent(i, 1.e-20);129 fHBlindPixelQ->SetBinContent (i, 1.e-20); 130 fHBlindPixelErrQ->SetBinContent (i, 1.e-20); 131 fHBlindPixelT->SetBinContent(i, 1.e-20); 132 132 } 133 133 … … 209 209 gPad->SetTicks(); 210 210 211 fHB PQ->DrawCopy(opt);211 fHBlindPixelQ->DrawCopy(opt); 212 212 213 213 if (fSinglePheFit) … … 231 231 gPad->SetLogy(1); 232 232 gPad->SetBorderMode(0); 233 fHB PT->DrawCopy(opt);234 235 if (fHB PT->GetFunction("GausTime"))233 fHBlindPixelT->DrawCopy(opt); 234 235 if (fHBlindPixelT->GetFunction("GausTime")) 236 236 { 237 TF1 *tfit = fHB PT->GetFunction("GausTime");237 TF1 *tfit = fHBlindPixelT->GetFunction("GausTime"); 238 238 if (tfit->GetProb() < 0.01) 239 239 tfit->SetLineColor(kRed); … … 248 248 c->cd(4); 249 249 250 fHB PQvsN->DrawCopy(opt);250 fHBlindPixelQvsN->DrawCopy(opt); 251 251 252 252 c->Modified(); … … 260 260 gRandom->SetSeed(); 261 261 262 if (fHB PQ->GetEntries() != 0)262 if (fHBlindPixelQ->GetEntries() != 0) 263 263 { 264 *fLog << err << "Histogram " << fHB PQ->GetTitle() << " is already filled. " << endl;264 *fLog << err << "Histogram " << fHBlindPixelQ->GetTitle() << " is already filled. " << endl; 265 265 *fLog << err << "Create new class MHCalibrationBlindPixel for simulation! " << endl; 266 266 return kFALSE; … … 268 268 269 269 TF1 *simulateSinglePhe = new TF1("simulateSinglePhe",fgSinglePheFitFunc, 270 fB PQfirst,fBPQlast,fgSinglePheFitNPar);270 fBlindPixelQfirst,fBlindPixelQlast,fgSinglePheFitNPar); 271 271 272 272 simulateSinglePhe->SetParameters(lambda,mu0,mu1,sigma0,sigma1); 273 273 simulateSinglePhe->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1"); 274 simulateSinglePhe->SetNpx(fB PQnbins);274 simulateSinglePhe->SetNpx(fBlindPixelQnbins); 275 275 276 276 for (Int_t i=0;i<10000; i++) 277 277 { 278 fHB PQ->Fill(simulateSinglePhe->GetRandom());278 fHBlindPixelQ->Fill(simulateSinglePhe->GetRandom()); 279 279 } 280 280 … … 283 283 284 284 285 void MHCalibrationBlindPixel::ChangeFitFunc(B PFitFunc fitfunc, Int_t par)285 void MHCalibrationBlindPixel::ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par) 286 286 { 287 287 … … 303 303 // Get the fitting ranges 304 304 // 305 rmin = (rmin != 0.) ? rmin : fB PQfirst;306 rmax = (rmax != 0.) ? rmax : fB PQlast;305 rmin = (rmin != 0.) ? rmin : fBlindPixelQfirst; 306 rmax = (rmax != 0.) ? rmax : fBlindPixelQlast; 307 307 308 308 // … … 310 310 // otherwise the fit goes gaga because of high number of dimensions ... 311 311 // 312 const Stat_t entries = fHB PQ->GetSumOfWeights();312 const Stat_t entries = fHBlindPixelQ->GetSumOfWeights(); 313 313 const Double_t lambda_guess = 0.2; 314 const Double_t mu_0_guess = fHB PQ->GetBinCenter(fHBPQ->GetMaximumBin());315 const Double_t si_0_guess = mu_0_guess/ 500.;316 const Double_t mu_1_guess = mu_0_guess + 2.;314 const Double_t mu_0_guess = fHBlindPixelQ->GetBinCenter(fHBlindPixelQ->GetMaximumBin()); 315 const Double_t si_0_guess = mu_0_guess/10.; 316 const Double_t mu_1_guess = mu_0_guess + 50.; 317 317 const Double_t si_1_guess = si_0_guess + si_0_guess; 318 318 … … 325 325 fSinglePheFit->SetParLimits(3,1.0,rmax-rmin); 326 326 fSinglePheFit->SetParLimits(4,1.7,rmax-rmin); 327 fSinglePheFit->SetParLimits(5,0.,2. *entries);327 fSinglePheFit->SetParLimits(5,0.,2.5*entries); 328 328 // 329 329 // Normalize the histogram to facilitate faster fitting of the area … … 333 333 // ROOT gives us another nice example of user-unfriendly behavior: 334 334 // Although the normalization of the function fSinglePhe and the 335 // Histogram fHB PQ agree (!!), the fit does not normalize correctly INTERNALLY335 // Histogram fHBlindPixelQ agree (!!), the fit does not normalize correctly INTERNALLY 336 336 // in the fitting procedure !!! 337 337 // … … 342 342 // So, WE have to adapt to that internal flaw of ROOT: 343 343 // 344 const Int_t npx = fSinglePheFit->GetNpx();345 const Int_t bins = fHBPQ->GetXaxis()->GetLast()-fHBPQ->GetXaxis()->GetFirst();346 // fHB PQ->Scale(gkSq2Pi*(float)bins/npx/entries);344 // const Int_t npx = fSinglePheFit->GetNpx(); 345 // const Int_t bins = fHBlindPixelQ->GetXaxis()->GetLast()-fHBlindPixelQ->GetXaxis()->GetFirst(); 346 // fHBlindPixelQ->Scale(gkSq2Pi*(float)bins/npx/entries); 347 347 348 348 // … … 353 353 // fSinglePheFit->SetNpx(fQnbins); 354 354 355 fHB PQ->Fit("SinglePheFit",opt);355 fHBlindPixelQ->Fit(fSinglePheFit,opt); 356 356 357 357 fLambda = fSinglePheFit->GetParameter(0); … … 403 403 // If you find another solution which WORKS!!, please tell me!! 404 404 // 405 Int_t nbins = 100;406 407 *fLog << "New number of bins in HSinQ: " << CutEdges(fHB PQ,nbins) << endl;408 409 fB PQfirst = fHBPQ->GetBinLowEdge(fHBPQ->GetXaxis()->GetFirst());410 fB PQlast = fHBPQ->GetBinLowEdge(fHBPQ->GetXaxis()->GetLast())+fHBPQ->GetBinWidth(0);411 fB PQnbins = nbins;412 413 *fLog << "New number of bins in HErrQ: " << CutEdges(fHB PErrQ,30) << endl;414 fErrB PQfirst = fHBPErrQ->GetBinLowEdge(fHBPErrQ->GetXaxis()->GetFirst());415 fErrB PQlast = fHBPErrQ->GetBinLowEdge(fHBPErrQ->GetXaxis()->GetLast())+fHBPErrQ->GetBinWidth(0);416 fErrB PQnbins = nbins;417 418 CutEdges(fHB PQvsN,0);405 Int_t nbins = 50; 406 407 *fLog << "New number of bins in HSinQ: " << CutEdges(fHBlindPixelQ,nbins) << endl; 408 409 fBlindPixelQfirst = fHBlindPixelQ->GetBinLowEdge(fHBlindPixelQ->GetXaxis()->GetFirst()); 410 fBlindPixelQlast = fHBlindPixelQ->GetBinLowEdge(fHBlindPixelQ->GetXaxis()->GetLast())+fHBlindPixelQ->GetBinWidth(0); 411 fBlindPixelQnbins = nbins; 412 413 *fLog << "New number of bins in HErrQ: " << CutEdges(fHBlindPixelErrQ,30) << endl; 414 fErrBlindPixelQfirst = fHBlindPixelErrQ->GetBinLowEdge(fHBlindPixelErrQ->GetXaxis()->GetFirst()); 415 fErrBlindPixelQlast = fHBlindPixelErrQ->GetBinLowEdge(fHBlindPixelErrQ->GetXaxis()->GetLast())+fHBlindPixelErrQ->GetBinWidth(0); 416 fErrBlindPixelQnbins = nbins; 417 418 CutEdges(fHBlindPixelQvsN,0); 419 419 420 420 } … … 426 426 return kFALSE; 427 427 428 rmin = (rmin != 0.) ? rmin : 0.;429 rmax = (rmax != 0.) ? rmax : 16.;430 431 const Stat_t entries = fHB PT->GetEntries();432 const Double_t mu_guess = fHB PT->GetBinCenter(fHBPT->GetMaximumBin());428 rmin = (rmin != 0.) ? rmin : 4.; 429 rmax = (rmax != 0.) ? rmax : 9.; 430 431 const Stat_t entries = fHBlindPixelT->GetEntries(); 432 const Double_t mu_guess = fHBlindPixelT->GetBinCenter(fHBlindPixelT->GetMaximumBin()); 433 433 const Double_t sigma_guess = (rmax - rmin)/2.; 434 434 const Double_t area_guess = entries/gkSq2Pi; … … 441 441 fTimeGausFit->SetParLimits(2,0.,rmax-rmin); 442 442 443 fHBPT->Fit("GausTime",opt); 443 fHBlindPixelT->Fit(fTimeGausFit,opt); 444 445 rmin = fTimeGausFit->GetParameter(1) - 2.*fTimeGausFit->GetParameter(2); 446 rmax = fTimeGausFit->GetParameter(1) + 2.*fTimeGausFit->GetParameter(2); 447 fTimeGausFit->SetRange(rmin,rmax); 448 449 fHBlindPixelT->Fit(fTimeGausFit,opt); 450 444 451 445 452 fMeanT = fTimeGausFit->GetParameter(2); -
trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h
r2525 r2599 32 32 private: 33 33 34 TH1I* fHB PQ; //-> Histogram with the single Phe spectrum35 TH1F* fHB PErrQ; //-> Variance of summed FADC slices36 TH1I* fHB PT; //-> Variance of summed FADC slices37 TH1I* fHB PQvsN; //-> Summed Charge vs. Event Nr.34 TH1I* fHBlindPixelQ; //-> Histogram with the single Phe spectrum 35 TH1F* fHBlindPixelErrQ; //-> Variance of summed FADC slices 36 TH1I* fHBlindPixelT; //-> Variance of summed FADC slices 37 TH1I* fHBlindPixelQvsN; //-> Summed Charge vs. Event Nr. 38 38 39 39 TF1 *fSinglePheFit; 40 40 TF1 *fTimeGausFit; 41 41 42 Axis_t fB PQfirst;43 Axis_t fB PQlast;44 Int_t fB PQnbins;42 Axis_t fBlindPixelQfirst; 43 Axis_t fBlindPixelQlast; 44 Int_t fBlindPixelQnbins; 45 45 46 Axis_t fErrB PQfirst;47 Axis_t fErrB PQlast;48 Int_t fErrB PQnbins;46 Axis_t fErrBlindPixelQfirst; 47 Axis_t fErrBlindPixelQlast; 48 Int_t fErrBlindPixelQnbins; 49 49 50 50 void ResetBin(Int_t i); … … 54 54 Bool_t fFitOK; 55 55 56 B PFitFunc fgSinglePheFitFunc; // In the beginning,56 BlindPixelFitFunc fgSinglePheFitFunc; // In the beginning, 57 57 Int_t fgSinglePheFitNPar; // we want to be flexible using different functions 58 58 … … 83 83 ~MHCalibrationBlindPixel(); 84 84 85 Bool_t FillB PQ(Int_t q) { return fHBPQ->Fill(q) > -1; }86 Bool_t FillErrB PQ(Float_t errq) { return fHBPErrQ->Fill(errq) > -1; }87 Bool_t FillB PT(Int_t t) { return fHBPT->Fill(t) > -1; }88 Bool_t FillB PQvsN(Stat_t rq, Int_t t) { return fHBPQvsN->Fill(t,rq) > -1; }85 Bool_t FillBlindPixelQ(Int_t q) { return fHBlindPixelQ->Fill(q) > -1; } 86 Bool_t FillErrBlindPixelQ(Float_t errq) { return fHBlindPixelErrQ->Fill(errq) > -1; } 87 Bool_t FillBlindPixelT(Int_t t) { return fHBlindPixelT->Fill(t) > -1; } 88 Bool_t FillBlindPixelQvsN(Stat_t rq, Int_t t) { return fHBlindPixelQvsN->Fill(t,rq) > -1; } 89 89 90 90 const Double_t GetLambda() const { return fLambda; } … … 109 109 const Double_t GetSigmaTErr() const { return fSigmaTErr; } 110 110 111 const TH1F *GetHErrQ() { return fHB PErrQ; }112 const TH1F *GetHErrQ() const { return fHB PErrQ; }111 const TH1F *GetHErrQ() { return fHBlindPixelErrQ; } 112 const TH1F *GetHErrQ() const { return fHBlindPixelErrQ; } 113 113 114 114 Bool_t SimulateSinglePhe(Double_t lambda, … … 121 121 Bool_t FitT(Axis_t rmin=0., Axis_t rmax=0.,Option_t *opt="R0+"); 122 122 123 void ChangeFitFunc(B PFitFunc fitfunc, Int_t par=5);123 void ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par=5); 124 124 125 125 -
trunk/MagicSoft/Mars/mhist/MHCalibrationConfig.h
r2533 r2599 12 12 13 13 // Global rejection criteria for the acceptance of a fit: Prob=0.01 == 99% Probability 14 const Float_t gkProbLimit = 0.0 1;14 const Float_t gkProbLimit = 0.001; 15 15 16 16 // Starting number of bins for the histo: … … 30 30 31 31 // typedef to the fitting functions for the blind pixel 32 typedef Double_t (*B PFitFunc)(Double_t *, Double_t *);32 typedef Double_t (*BlindPixelFitFunc)(Double_t *, Double_t *); 33 33 34 34 #endif /* MARS_MHCalibrationBlindPixelConfig */ -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
r2581 r2599 60 60 // Default Constructor. 61 61 // 62 MHCalibrationPixel::MHCalibrationPixel( Int_t pix,const char *name, const char *title)63 : fPixId( pix),62 MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title) 63 : fPixId(-1), 64 64 fQGausFit(NULL), 65 65 fTGausFit(NULL), 66 66 fFitLegend(NULL), 67 67 fLowerFitRange(0.), 68 fFitOK(kFALSE) 68 fFitOK(kFALSE), 69 fQChisquare(-1.), 70 fQProb(-1.), 71 fQNdf(-1), 72 fTChisquare(-1.), 73 fTProb(-1.), 74 fTNdf(-1) 69 75 { 70 76 … … 72 78 fTitle = title ? title : "Fill the accumulated charges and times of all events and perform fits"; 73 79 74 TString qname = "HQ";75 80 TString qtitle = "Distribution of Summed FADC Slices Pixel "; 76 qname += pix;77 qtitle += pix;78 81 79 82 // Create a large number of bins, later we will rebin … … 82 85 fQnbins = gkStartPixelBinNr; 83 86 84 fHQ = new TH1I( qname.Data(),qtitle.Data(),87 fHQ = new TH1I("HQ",qtitle.Data(), 85 88 fQnbins,fQfirst,fQlast); 86 89 fHQ->SetXTitle("Sum FADC Slices"); … … 88 91 fHQ->Sumw2(); 89 92 90 TString tname = "HT"; 93 fHQ->SetDirectory(NULL); 94 91 95 TString ttitle = "Distribution of Mean Arrival Times Pixel "; 92 tname += pix;93 ttitle += pix;94 96 95 97 Axis_t tfirst = -0.5; … … 97 99 Int_t nbins = 16; 98 100 99 fHT = new TH1I( tname.Data(),ttitle.Data(),101 fHT = new TH1I("HT",ttitle.Data(), 100 102 nbins,tfirst,tlast); 101 103 fHT->SetXTitle("Mean Arrival Times [FADC slice nr]"); … … 103 105 fHT->Sumw2(); 104 106 105 TString qvsnname = "HQvsN"; 107 fHT->SetDirectory(NULL); 108 106 109 TString qvsntitle = "Sum of Charges vs. Event Number Pixel "; 107 qvsnname += pix;108 qvsntitle += pix;109 110 110 111 // We define a reasonable number and later enlarge it if necessary … … 113 114 Axis_t nlast = (Axis_t)nbins - 0.5; 114 115 115 fHQvsN = new TH1I( qvsnname.Data(),qvsntitle.Data(),116 fHQvsN = new TH1I("HQvsN",qvsntitle.Data(), 116 117 nbins,nfirst,nlast); 117 118 fHQvsN->SetXTitle("Event Nr."); 118 119 fHQvsN->SetYTitle("Sum of FADC slices"); 119 120 120 fQChisquare = -1.; 121 fQProb = -1.; 122 fQNdf = -1; 123 124 fTChisquare = -1.; 125 fTProb = -1.; 126 fTNdf = -1; 121 fHQvsN->SetDirectory(NULL); 127 122 128 123 } … … 144 139 } 145 140 141 142 void MHCalibrationPixel::ChangeHistId(Int_t id) 143 { 144 145 fPixId = id; 146 147 TString nameQ = TString(fHQ->GetName()); 148 nameQ += id; 149 fHQ->SetName(nameQ.Data()); 150 151 TString nameT = TString(fHT->GetName()); 152 nameT += id; 153 fHT->SetName(nameT.Data()); 154 155 TString nameQvsN = TString(fHQvsN->GetName()); 156 nameQvsN += id; 157 fHQvsN->SetName(nameQvsN.Data()); 158 } 159 160 146 161 void MHCalibrationPixel::Reset() 147 162 { … … 206 221 207 222 char line8[32]; 208 sprintf(line8,"Probability: %4. 2f ",fQProb);223 sprintf(line8,"Probability: %4.3f ",fQProb); 209 224 fFitLegend->AddText(line8); 210 225 … … 266 281 fHT->DrawCopy(opt); 267 282 268 if (f HT->GetFunction("GausTime"))283 if (fTGausFit) 269 284 { 270 TF1 *tfit = fHT->GetFunction("GausTime"); 271 if (tfit->GetProb() < 0.01) 272 tfit->SetLineColor(kRed); 285 if (fTChisquare > 1.) 286 fTGausFit->SetLineColor(kRed); 273 287 else 274 tfit->SetLineColor(kGreen);275 276 tfit->DrawCopy("same");288 fTGausFit->SetLineColor(kGreen); 289 290 fTGausFit->DrawCopy("same"); 277 291 c->Modified(); 278 292 c->Update(); … … 290 304 Bool_t MHCalibrationPixel::FitT(Axis_t rmin, Axis_t rmax, Option_t *option) 291 305 { 292 306 293 307 if (fTGausFit) 294 308 return kFALSE; 295 309 296 rmin = (rmin != 0.) ? rmin : -0.5;297 rmax = (rmax != 0.) ? rmax : 15.5;310 rmin = (rmin != 0.) ? rmin : 4.; 311 rmax = (rmax != 0.) ? rmax : 9.; 298 312 299 313 const Stat_t entries = fHT->GetEntries(); … … 302 316 const Double_t area_guess = entries/gkSq2Pi; 303 317 304 fTGausFit = new TF1("GausTime","gaus",rmin,rmax); 318 TString name = TString("GausTime"); 319 name += fPixId; 320 fTGausFit = new TF1(name.Data(),"gaus",rmin,rmax); 305 321 306 322 if (!fTGausFit) … … 314 330 fTGausFit->SetParLimits(0,0.,entries); 315 331 fTGausFit->SetParLimits(1,rmin,rmax); 316 fTGausFit->SetParLimits(2,0.,rmax-rmin); 317 318 fHT->Fit("GausTime",option); 332 fTGausFit->SetParLimits(2,0.,(rmax-rmin)/2.); 333 fTGausFit->SetRange(rmin,rmax); 334 335 fHT->Fit(fTGausFit,option); 336 337 rmin = fTGausFit->GetParameter(1) - 3.*fTGausFit->GetParameter(2); 338 rmax = fTGausFit->GetParameter(1) + 3.*fTGausFit->GetParameter(2); 339 fTGausFit->SetRange(rmin,rmax); 340 341 fHT->Fit(fTGausFit,option); 319 342 320 343 fTChisquare = fTGausFit->GetChisquare(); … … 324 347 fTSigma = fTGausFit->GetParameter(2); 325 348 326 if (fT Prob < gkProbLimit)349 if (fTChisquare > 1.) 327 350 { 328 351 *fLog << warn << "Fit of the Arrival times failed ! " << endl; … … 344 367 // 345 368 Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fQfirst; 369 Axis_t rmax = 0.; 346 370 347 371 // … … 352 376 const Double_t ar_guess = entries/gkSq2Pi; 353 377 const Double_t mu_guess = fHQ->GetBinCenter(fHQ->GetMaximumBin()); 354 const Double_t si_guess = mu_guess/500.; 355 356 fQGausFit = new TF1("QGausFit","gaus",rmin,fQlast); 378 const Double_t si_guess = mu_guess/50.; 379 380 TString name = TString("QGausFit"); 381 name += fPixId; 382 383 fQGausFit = new TF1(name.Data(),"gaus",rmin,fQlast); 357 384 358 385 if (!fQGausFit) … … 367 394 fQGausFit->SetParLimits(1,rmin,fQlast); 368 395 fQGausFit->SetParLimits(2,0.,fQlast-rmin); 369 370 fHQ->Fit("QGausFit",option); 396 fQGausFit->SetRange(rmin,fQlast); 397 fQGausFit->Update(); 398 399 fHQ->Fit(fQGausFit,option); 400 401 rmin = fQGausFit->GetParameter(1) - 3.*fQGausFit->GetParameter(2); 402 rmax = fQGausFit->GetParameter(1) + 3.*fQGausFit->GetParameter(2); 403 404 fQGausFit->SetRange(rmin,rmax); 405 fHQ->Fit(fQGausFit,option); 406 407 rmin = fQGausFit->GetParameter(1) - 3.5*fQGausFit->GetParameter(2); 408 rmax = fQGausFit->GetParameter(1) + 3.5*fQGausFit->GetParameter(2); 409 410 fQGausFit->SetRange(rmin,rmax); 411 fHQ->Fit(fQGausFit,option); 371 412 372 413 fQChisquare = fQGausFit->GetChisquare(); … … 399 440 { 400 441 401 // 402 // The number 100 is necessary because it is the internal binning 403 // of ROOT functions. A call to SetNpx() does NOT help 404 // If you find another solution which WORKS!!, please tell me!! 405 // 406 Int_t nbins = 100; 442 Int_t nbins = 50; 407 443 408 444 CutEdges(fHQ,nbins); -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
r2581 r2599 68 68 public: 69 69 70 MHCalibrationPixel( Int_t pix=-1,const char *name=NULL, const char *title=NULL);70 MHCalibrationPixel(const char *name=NULL, const char *title=NULL); 71 71 ~MHCalibrationPixel(); 72 73 void ChangeHistId(Int_t i); 72 74 73 75 Bool_t SetupFill(const MParList *pList); … … 105 107 const TH1I *GetHQvsN() const { return fHQvsN; } 106 108 107 Bool_t FitQ(Option_t *option="RQ0 +");108 Bool_t FitT(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0 +");109 Bool_t FitQ(Option_t *option="RQ0"); 110 Bool_t FitT(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 109 111 110 112 virtual void Draw(Option_t *option="");
Note:
See TracChangeset
for help on using the changeset viewer.