Changeset 14943 for fact/tools/rootmacros/PulseTemplates
- Timestamp:
- 02/21/13 14:53:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
r14811 r14943 96 96 //---------------------------------------------------------------------------- 97 97 int FCalcPulseTemplate( 98 TString InRootFileName = "20120802templ_0mV_entries.root", 99 // TString InRootFileName = "20120309_032.root", 100 // TString InputPath = "analysis/analysis/FPulseTemplate/20120309_017/Overlay/", 101 TString InputPath = "", 102 // TString InputPath = "analysis/analysis/FPulseTemplate/20120309_032/Overlay/", 103 TString OutputRootFileName = "test.root", 104 TString OutPutPath = "", 105 int firstpixel = 0, 106 int npixel = 1, 107 int pixelSetSize = 200, 108 int maxPulseOrder = 1, 109 // TString histoOptions = "SRM", 110 bool ProduceGraphic = true, 111 bool stats = true, 112 bool saveResults = false, 113 // bool fitdata = false, 114 bool debugPixel = true, 115 // int refresh_rate = 500, //refresh rate for canvases 116 int verbosityLevel = 1 // different verbosity levels can be implemented here 98 99 // ------------{ Files }------------ 100 // TString InRootFileName = "20120802_0mV_newSelectAlg.root", 101 TString InRootFileName = "20120802_0mV_Stacking_G11B-2AWW8.root", 102 // TString InRootFileName = "20120802_200mV_Stacking_G13B-2AWW8.root", 103 TString InputPath = "analysis/PulsTemplateAnalysis/20120802/", 104 TString OutputRootFileName = "20120802_0mV_Extraction_G11B-2AWW8_model2.root", 105 // TString OutputRootFileName = "20120802_200mV_Extraction_G13B-2AWW8_model0.root", 106 TString OutPutPath = "analysis/PulsTemplateAnalysis/20120802/", 107 // TString InRootFileName = "20120309_032.root", 108 // TString InRootFileName = "20120309_017.root", 109 // TString InputPath = "analysis/analysis/FPulseTemplate/20120309_017/Overlay/", 110 // TString InputPath = "analysis/analysis/FPulseTemplate/20120309_032/Overlay/", 111 // ------------{ data quantity }------------ 112 int firstpixel = 0, 113 int npixel = 1, 114 int pixelSetSize = 200, 115 int maxPulseOrder = 6, 116 // ------------{ analysis parameters }------------ 117 float meanGain = 11., 118 float meanBsl = -2.5, 119 int bootstrapIt = 10, 120 int pulseModell = 0, 121 float pixelOverlayXaxisLeft = 0, 122 float pixelOverlayXaxisRight = 400, 123 124 // ------------{ program options }------------ 125 // TString histoOptions = "SRM", 126 127 // show graphical output 128 bool ProduceGraphic = true, 129 130 // show stats in plots 131 bool stats = true, 132 133 // save data 134 bool saveResults = false, 135 // bool fitdata = false, 136 137 //pause after each pixel 138 bool debugPixel = true, 139 140 //refresh rate for canvases 141 // int refresh_rate = 500, 142 143 TString fitOption = "Q", 144 145 // different verbosity levels can be set here 146 int verbosityLevel = 1 117 147 ) 118 148 { … … 265 295 TH1D hAmplitude[maxPulseOrder]; 266 296 TH1D hRiseTime[maxPulseOrder]; 297 TList* histoList = new TList(); 267 298 268 299 //Lopp over pulse order configure distribution histograms … … 272 303 TString title; 273 304 title = "hBSL"; 274 title.Append(i); 305 title += "_"; 306 title += i; 275 307 hBsl[i].SetNameTitle(title, title); 276 hBsl[i].SetBins( 400, -2-0.005, 2-0.005);277 308 hBsl[i].SetBins(800, -4-0.005, 4-0.005); 309 histoList->Add( &hBsl[i] ); 278 310 //Asymptote 279 311 title = "hAsymptote"; 280 title.Append(i); 312 title += "_"; 313 title += i; 281 314 hAsymptote[i].SetNameTitle(title, title); 282 315 hAsymptote[i].SetBins(60, -10.5, 49.5); 316 histoList->Add( &hAsymptote[i] ); 283 317 284 318 //T0 285 319 title = "hT0"; 286 title.Append(i); 320 title += "_"; 321 title += i; 287 322 hT0[i].SetNameTitle(title, title); 288 323 hT0[i].SetBins(80, 39.5, 119.5); 324 histoList->Add( &hT0[i] ); 289 325 290 326 //Tau1 291 327 title = "hTau1"; 292 title.Append(i); 328 title += "_"; 329 title += i; 293 330 hTau1[i].SetNameTitle(title, title); 294 331 hTau1[i].SetBins(10, -10.5, 9.5); 332 histoList->Add( &hTau1[i] ); 295 333 296 334 //Tau2 297 335 title = "hTau2"; 298 title.Append(i); 336 title += "_"; 337 title += i; 299 338 hTau2[i].SetNameTitle(title, title); 300 339 hTau2[i].SetBins(40, 19.5, 59.5); 340 histoList->Add( &hTau2[i] ); 301 341 302 342 //Integral 303 343 title = "hIntegral"; 304 title.Append(i); 344 title += "_"; 345 title += i; 305 346 hIntegral[i].SetNameTitle(title, title); 306 347 hIntegral[i].SetBins(500, (i+1)*-0.5, (i+1)*499.5); 348 histoList->Add( &hIntegral[i] ); 307 349 308 350 //Amplitude 309 351 title = "hAmplitude"; 310 title.Append(i); 352 title += "_"; 353 title += i; 311 354 hAmplitude[i].SetNameTitle(title, title); 312 355 hAmplitude[i].SetBins(400, (i+1)*4.95, (i+1)*24.95); 356 histoList->Add( &hAmplitude[i] ); 313 357 314 358 //hRiseTime 315 359 title = "hRiseTime"; 316 title.Append(i); 360 title += "_"; 361 title += i; 317 362 hRiseTime[i].SetNameTitle(title, title); 318 363 hRiseTime[i].SetBins(20, -0, 10); 364 histoList->Add( &hRiseTime[i] ); 319 365 } 320 366 … … 326 372 327 373 //Lopp over pulse order configure distribution histograms 374 float roi = 1024.; 328 375 for (int i = 0; i<maxPulseOrder; i++) 329 376 { … … 331 378 TString title; 332 379 title = "hMedianErrors"; 333 title.Append(i); 380 title += "_"; 381 title += i; 334 382 hMedianErrors[i].SetNameTitle(title, title); 335 hMedianErrors[i].SetBins( 300, -0.5, 300.5);383 hMedianErrors[i].SetBins(roi, -0.5, roi + 0.5); 336 384 337 385 //hMeanErrors 338 386 title = "hMeanErrors"; 339 title.Append(i); 387 title += "_"; 388 title += i; 340 389 hMeanErrors[i].SetNameTitle(title, title); 341 hMeanErrors[i].SetBins( 300, -0.5, 300.5);390 hMeanErrors[i].SetBins(roi, -0.5, roi + 0.5); 342 391 343 392 //hMaxErrors 344 393 title = "hMaxErrors"; 345 title.Append(i); 394 title += "_"; 395 title += i; 346 396 hMaxErrors[i].SetNameTitle(title, title); 347 hMaxErrors[i].SetBins( 300, -0.5, 300.5);397 hMaxErrors[i].SetBins(roi, -0.5, roi + 0.5); 348 398 } 349 399 … … 355 405 grPheVsAmpl.SetNameTitle("grPheVsAmpl", "Distribution of Pulse Amplitude vs. Photon equivalent"); 356 406 grPheVsAmpl.SetMarkerStyle(21); 407 histoList->Add( &grPheVsAmpl ); 357 408 358 409 TGraphErrors grPheVsIntegral; 359 410 grPheVsIntegral.SetNameTitle("grPheVsIntegral", "Distribution of Pulse Integral vs. Photon equivalent"); 360 411 grPheVsIntegral.SetMarkerStyle(21); 412 histoList->Add( &grPheVsIntegral ); 361 413 362 414 TGraphErrors grPheVsTau2; 363 415 grPheVsTau2.SetNameTitle("grPheVsTau2", "Distribution of Tau2 vs. Photon equivalent"); 364 416 grPheVsTau2.SetMarkerStyle(21); 417 histoList->Add( &grPheVsTau2 ); 365 418 //----------------------------------------------------------------------------- 366 419 // Variables … … 462 515 stats, 463 516 "L", 464 70, //pixelOverlayXaxisLeft/TODO: get it from the root file465 230, //pixelOverlayXaxisRight/TODO: get it from the root file466 -1, //bslMean/TODO: get it from the root file467 9, //gain mean /TODO: get it from the root file517 pixelOverlayXaxisLeft, //TODO: get it from the root file 518 pixelOverlayXaxisRight, //TODO: get it from the root file 519 meanBsl, //bslMean /TODO: get it from the root file 520 meanGain, //gain mean /TODO: get it from the root file 468 521 inputRootFile, 469 522 outputRootFile … … 472 525 if (breakout) break; 473 526 474 //Preparing Camera475 if (first_pass)476 {477 if (verbosityLevel > 0)478 {479 cout << endl << "...preparing camera" << endl;480 }481 482 wholeCamera = new PixelSum(483 "AllPixel",484 1440,485 maxPulseOrder,486 verbosityLevel,487 stats,488 "C",489 pixel[pixelID]->mPixelOverlayXaxisLeft,490 pixel[pixelID]->mPixelOverlayXaxisRight ,491 pixel[pixelID]->mBSLMean ,492 pixel[pixelID]->mGainMean ,493 outputRootFile494 );495 496 first_pass = false;497 }498 527 //------------------------------------- 499 528 // Histogramms of Maximas in Overlay Spectra … … 521 550 //------------------------------------- 522 551 552 // pixel[pixelID]->Normalize2Dhistos(pulse_order); 553 523 554 //from Maximum Overlay 524 555 if (verbosityLevel > 2) … … 550 581 ); 551 582 583 pixel[pixelID]->SetRangeUser(pixelOverlayXaxisLeft, pixelOverlayXaxisRight, pulse_order); 584 585 552 586 PixelCsv.WritePointSet( 553 587 pixel[pixelID], … … 618 652 619 653 // pulses.cd(1); 620 Pulse maxMaxPulse("maxMaxPulse", pixel[pixelID]->hPixelMax[pulse_order], "Q", 1,pulse_order);654 Pulse maxMaxPulse("maxMaxPulse", pixel[pixelID]->hPixelMax[pulse_order], fitOption, pulseModell,pulse_order); 621 655 pulseFits[0] = &maxMaxPulse; 622 656 623 657 // pulses.cd(2); 624 Pulse maxMedianPulse("maxMedianPulse", pixel[pixelID]->hPixelMedian[pulse_order], "Q",1,pulse_order);658 Pulse maxMedianPulse("maxMedianPulse", pixel[pixelID]->hPixelMedian[pulse_order], fitOption,pulseModell,pulse_order); 625 659 pulseFits[1] = &maxMedianPulse; 626 660 627 661 // pulses.cd(3); 628 Pulse maxMeanPulse("maxMeanPulse", pixel[pixelID]->hPixelMean[pulse_order], "Q",1,pulse_order);662 Pulse maxMeanPulse("maxMeanPulse", pixel[pixelID]->hPixelMean[pulse_order], fitOption,pulseModell,pulse_order); 629 663 pulseFits[2] = &maxMeanPulse; 630 664 631 Pulse edgeMaxPulse("edgeMaxPulse", pixel[pixelID]->hPixelEdgeMax[pulse_order], "Q",1,pulse_order);665 Pulse edgeMaxPulse("edgeMaxPulse", pixel[pixelID]->hPixelEdgeMax[pulse_order], fitOption,pulseModell,pulse_order); 632 666 pulseFits[3] = &edgeMaxPulse; 633 667 634 Pulse edgeMedianPulse("edgeMedianPulse", pixel[pixelID]->hPixelEdgeMedian[pulse_order], "Q",1,pulse_order);668 Pulse edgeMedianPulse("edgeMedianPulse", pixel[pixelID]->hPixelEdgeMedian[pulse_order], fitOption,pulseModell,pulse_order); 635 669 pulseFits[4] = &edgeMedianPulse; 636 670 637 Pulse edgeMeanPulse("edgeMeanPulse", pixel[pixelID]->hPixelEdgeMean[pulse_order], "Q",1,pulse_order);671 Pulse edgeMeanPulse("edgeMeanPulse", pixel[pixelID]->hPixelEdgeMean[pulse_order], fitOption,pulseModell,pulse_order); 638 672 pulseFits[5] = &edgeMeanPulse; 639 673 … … 754 788 // verbosityLevel 755 789 // ); 790 791 //Preparing Camera 792 if (first_pass) 793 { 794 if (verbosityLevel > 0) 795 { 796 cout << endl << "...preparing camera" << endl; 797 } 798 799 wholeCamera = new PixelSum( 800 "AllPixel", 801 1440, 802 maxPulseOrder, 803 verbosityLevel, 804 stats, 805 "C", 806 pixel[pixelID]->mPixelOverlayXaxisLeft, 807 pixel[pixelID]->mPixelOverlayXaxisRight , 808 pixel[pixelID]->mBSLMean , 809 pixel[pixelID]->mGainMean , 810 outputRootFile 811 ); 812 813 first_pass = false; 814 } 815 756 816 //------------------------------------- 757 817 // Fill Histogramms of Camera … … 897 957 "Maximum", 898 958 pulse_order, 899 10,959 bootstrapIt, 900 960 verbosityLevel 901 961 ); … … 916 976 "Edge", 917 977 pulse_order, 918 10,978 bootstrapIt, 919 979 verbosityLevel 920 980 ); … … 959 1019 960 1020 pulses.cd(1); 961 Pulse maxCamMaxPulse("maxMaxPulse", wholeCamera->hPixelMax[pulse_order], "Q", 1);1021 Pulse maxCamMaxPulse("maxMaxPulse", wholeCamera->hPixelMax[pulse_order], "Q", pulseModell); 962 1022 allPulseFits[0] = &maxCamMaxPulse; 963 1023 964 1024 pulses.cd(2); 965 Pulse maxCamMedianPulse("maxMedianPulse", wholeCamera->hPixelMedian[pulse_order], "Q", 1);1025 Pulse maxCamMedianPulse("maxMedianPulse", wholeCamera->hPixelMedian[pulse_order], "Q", pulseModell); 966 1026 allPulseFits[1] = &maxCamMedianPulse; 967 1027 968 1028 pulses.cd(3); 969 Pulse maxCamMeanPulse("maxMeanPulse", wholeCamera->hPixelMean[pulse_order],"Q", 1);1029 Pulse maxCamMeanPulse("maxMeanPulse", wholeCamera->hPixelMean[pulse_order],"Q", pulseModell); 970 1030 allPulseFits[2] = &maxCamMeanPulse; 971 1031 972 Pulse edgeCamMaxPulse("edgeMaxPulse", wholeCamera->hPixelEdgeMax[pulse_order], "Q", 1);1032 Pulse edgeCamMaxPulse("edgeMaxPulse", wholeCamera->hPixelEdgeMax[pulse_order], "Q", pulseModell); 973 1033 allPulseFits[3] = &edgeCamMaxPulse; 974 1034 975 Pulse edgeCamMedianPulse("edgeMedianPulse", wholeCamera->hPixelEdgeMedian[pulse_order],"Q", 1);1035 Pulse edgeCamMedianPulse("edgeMedianPulse", wholeCamera->hPixelEdgeMedian[pulse_order],"Q", pulseModell); 976 1036 allPulseFits[4] = &edgeCamMedianPulse; 977 1037 978 Pulse edgeCamMeanPulse("edgeMeanPulse", wholeCamera->hPixelEdgeMean[pulse_order], "Q", 1);1038 Pulse edgeCamMeanPulse("edgeMeanPulse", wholeCamera->hPixelEdgeMean[pulse_order], "Q", pulseModell); 979 1039 allPulseFits[5] = &edgeCamMeanPulse; 980 1040 … … 1061 1121 saveResults 1062 1122 ); 1123 1124 SaveList( 1125 outFile, 1126 "", 1127 histoList, 1128 saveResults, 1129 verbosityLevel 1130 ); 1131 1132 1063 1133 } 1064 1134 … … 1090 1160 delete inputRootFile; 1091 1161 delete outputRootFile; 1162 delete histoList; 1092 1163 1093 1164 return( 0 );
Note:
See TracChangeset
for help on using the changeset viewer.