Changeset 14962 for fact/tools/rootmacros/PulseTemplates
- Timestamp:
- 02/27/13 12:25:30 (12 years ago)
- Location:
- fact/tools/rootmacros/PulseTemplates
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
r14943 r14962 102 102 // TString InRootFileName = "20120802_200mV_Stacking_G13B-2AWW8.root", 103 103 TString InputPath = "analysis/PulsTemplateAnalysis/20120802/", 104 TString OutputRootFileName = "20120802_0mV_Extraction_G11B-2AWW8_model 2.root",104 TString OutputRootFileName = "20120802_0mV_Extraction_G11B-2AWW8_model1.root", 105 105 // TString OutputRootFileName = "20120802_200mV_Extraction_G13B-2AWW8_model0.root", 106 106 TString OutPutPath = "analysis/PulsTemplateAnalysis/20120802/", … … 113 113 int npixel = 1, 114 114 int pixelSetSize = 200, 115 int maxPulseOrder = 6,115 int maxPulseOrder = 1, 116 116 // ------------{ analysis parameters }------------ 117 117 float meanGain = 11., 118 118 float meanBsl = -2.5, 119 119 int bootstrapIt = 10, 120 int pulseModell = 0,120 int pulseModell = 1, 121 121 float pixelOverlayXaxisLeft = 0, 122 122 float pixelOverlayXaxisRight = 400, … … 381 381 title += i; 382 382 hMedianErrors[i].SetNameTitle(title, title); 383 hMedianErrors[i].SetBins(roi, -0.5, roi +0.5);383 hMedianErrors[i].SetBins(roi, -0.5, roi - 0.5); 384 384 385 385 //hMeanErrors … … 388 388 title += i; 389 389 hMeanErrors[i].SetNameTitle(title, title); 390 hMeanErrors[i].SetBins(roi, -0.5, roi +0.5);390 hMeanErrors[i].SetBins(roi, -0.5, roi - 0.5); 391 391 392 392 //hMaxErrors … … 395 395 title += i; 396 396 hMaxErrors[i].SetNameTitle(title, title); 397 hMaxErrors[i].SetBins(roi, -0.5, roi +0.5);397 hMaxErrors[i].SetBins(roi, -0.5, roi - 0.5); 398 398 } 399 399 … … 547 547 } 548 548 549 // shifting stacking in y TEST 550 //------------------------------------- 551 552 TH2* temporary = pixel[pixelID]->hEdgeOverlay[pulse_order]; 553 temporary->GetYaxis()->UnZoom(); 554 temporary->GetYaxis()->SetLimits( 555 temporary->GetYaxis()->GetBinLowEdge( temporary->GetYaxis()->GetFirst() ) - 0.25, 556 temporary->GetYaxis()->GetBinUpEdge( temporary->GetYaxis()->GetLast() ) - 0.25 557 ); 558 559 549 560 // Calculate Max Prop. Value of each slice 550 561 //------------------------------------- -
fact/tools/rootmacros/PulseTemplates/Sample.C
r14952 r14962 217 217 for (int i=0;i<nbins;i++) 218 218 { 219 value = inputHisto->GetBinLowEdge(i); 219 // value = inputHisto->GetBinLowEdge(i); 220 value = inputHisto->GetBinCenter(i); 220 221 quantity = inputHisto->GetBinContent(i); 221 222 //Loop over bin quantities -
fact/tools/rootmacros/PulseTemplates/pulse.C
r14946 r14962 245 245 mModel->SetParNames("BSL", "A0", "t0", "t1", "Tau1", "Tau2", "PhE"); 246 246 mModel->SetLineColor(kRed); 247 mModel->FixParameter(0, bsl); 247 248 248 249 mFitResultPtr = mHisto->Fit(mModel, fitOptions); … … 340 341 341 342 342 double para[] = {bsl, 2*amplitude+gain, start, tau*0. 1, tau, phe};343 double para[] = {bsl, 2*amplitude+gain, start, tau*0.5, tau, phe}; 343 344 mModel->SetParameters(para); 344 345 mModel->SetParNames("BSL", "A0", "t0", "Tau1", "Tau2", "PhE"); 345 346 mModel->SetLineColor(kBlue); 347 mModel->FixParameter(0, bsl); 348 mModel->FixParameter(1, 2*amplitude+gain); 346 349 347 350 // cout startvalues -
fact/tools/rootmacros/PulseTemplates/templateextractors.C
r14946 r14962 121 121 //---------------------------------------------------------------------------- 122 122 123 Double_t MedianOfH1 ( 124 TH1 * inputHisto123 double MedianOfH1 ( //THE PROBLEM MUST BE HERE!!!!!!! 124 TH1D* inputHisto 125 125 ) 126 126 { 127 127 //compute the median for 1-d histogram h1 128 128 Int_t nbins = inputHisto->GetXaxis()->GetNbins(); 129 Double_t *x = new Double_t[nbins];130 Double_t *y = new Double_t[nbins];129 double *x = new double[nbins]; 130 double *y = new double[nbins]; 131 131 for (Int_t i=0;i<nbins;i++) { 132 x[i] = inputHisto->GetXaxis()->GetBinCenter(i +1);133 y[i] = inputHisto->GetBinContent(i +1);132 x[i] = inputHisto->GetXaxis()->GetBinCenter(i); 133 y[i] = inputHisto->GetBinContent(i); 134 134 } 135 Double_tmedian = TMath::Median(nbins,x,y);135 double median = TMath::Median(nbins,x,y); 136 136 delete [] x; 137 137 delete [] y; … … 189 189 double Median[numIt]; 190 190 double Max[numIt]; 191 double parameter[3]; 192 double parameterErr[3]; 191 double parameter[3] = {0,0,0}; 192 double parameterErr[3] = {0,0,0}; 193 for (int i = 0; i < numIt; i++) 194 { 195 Mean[i] = 0; 196 Median[i] = 0; 197 Max[i] = 0; 198 } 193 199 194 200 // TCanvas test_canvas; … … 196 202 // test_canvas.cd(1); 197 203 // inputHisto->Draw(); 204 198 205 for (int i = 0; i < numIt; i++) 199 206 { 200 207 // test_canvas.cd(2); 201 TH1 * tempHisto = (TH1*)inputHisto->Clone("tempHisto");208 TH1D* tempHisto = (TH1D*)inputHisto->Clone("tempHisto"); 202 209 // "", 203 210 // "", … … 207 214 // ); 208 215 tempHisto->Reset(); 216 sample.SetSeed(sample.GetSeed()+1); 209 217 sample.BootstrapTH1(inputHisto, tempHisto); 210 218 211 219 Mean[i] = tempHisto->GetMean(); 212 220 Median[i] = MedianOfH1 ( tempHisto ); 213 214 221 Max[i] = tempHisto->GetBinCenter( tempHisto->GetMaximumBin() ); 215 222 216 //improved determination of m aximum223 //improved determination of modus 217 224 // TF1 gaus("fgaus", "gaus", Max[i]-10, Max[i]+10); 218 225 // tempHisto->Fit("fgaus", "WWQRN0"); … … 540 547 TH1F* hOutputMeanHisto = NULL; 541 548 TH1F* hOutputMedianHisto = NULL; 542 TH1D* hTempHisto 549 TH1D* hTempHisto = NULL; 543 550 double max_prop = 0; 544 551 double median = 0; … … 600 607 int slice_max = hInputHisto->GetXaxis()->GetLast(); 601 608 609 if (verbosityLevel > 2) 610 { 611 cout << "\t...looping over slice range " << slice_min 612 << " to " << slice_max << endl; 613 } 614 602 615 for (Int_t slice=slice_min;slice<=slice_max;slice++) 603 616 { 604 617 605 hTempHisto = hInputHisto->ProjectionY("",slice,slice );618 hTempHisto = hInputHisto->ProjectionY("",slice,slice,"o"); 606 619 607 620 //containers for errors 608 double slMean[3] ;609 double slError[3] ;621 double slMean[3] ={0,0,0}; 622 double slError[3] ={0,0,0}; 610 623 611 624 //calculate Errors with bootstrapping -
fact/tools/rootmacros/PulseTemplates/templateextractors.h
r14761 r14962 54 54 ); 55 55 56 Double_t MedianOfH1(57 TH1 *inputHisto56 double MedianOfH1( 57 TH1D* inputHisto 58 58 ); 59 59
Note:
See TracChangeset
for help on using the changeset viewer.