Changeset 13485 for fact/tools
- Timestamp:
- 05/01/12 12:02:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FPulseOverlay.C
r13472 r13485 143 143 144 144 // Temporary Objects 145 TH1F* debugHistos = NULL;145 TH1F* debugHistos = NULL; 146 146 //TH2F* hOverlayTemp = NULL; 147 147 //TH1D* hProjPeak = NULL; 148 TH1F* hTesthisto = NULL;149 TH2F* hTesthisto2 = NULL;148 TH1F* hTesthisto = NULL; 149 TH2F* hTesthisto2 = NULL; 150 150 151 151 //Histogram Parameters 152 Int_t gPixelOverlayXaxisLeft = 0;152 Int_t gPixelOverlayXaxisLeft = 0; 153 153 Int_t gPixelOverlayXaxisRight = 0; 154 154 155 155 //Root-File Objects 156 156 // TObjArray* hList[sampleSetSize] = {NULL}; 157 TObjArray* hRootList = NULL; 158 159 TCanvas** cgpPixelPulses = NULL; 160 TCanvas * cFiltered = NULL; 157 TObjArray* hRootList = NULL; 158 159 TCanvas** cgpPixelPulses = NULL; 160 TCanvas** cgpDistributions = NULL; 161 TCanvas* cFiltered = NULL; 162 TCanvas* cgpTestHistos = NULL; 161 163 162 164 //---------------------------------------------------------------------------- … … 165 167 166 168 void BookDebugHistos(int ); 167 //void BookPixelHistos(int, int, int, int );168 169 void BookTestHistos( int ); 169 170 … … 172 173 173 174 void FillHistograms(Pixel*, vector<Region>*, int, int, int, int); 174 //void DrawPulseHistograms(int);175 175 void DrawTestHistograms( int); 176 void ProduceDebugHistos( vector<Region> *pZXings); 176 177 177 178 void UpdateCanvases( int, int); … … 209 210 { 210 211 //---------------------------------------------------------------------------- 211 // set global variables 212 // Initialize Pixel 213 //---------------------------------------------------------------------------- 214 Pixel** pixel = new Pixel*[sampleSetSize]; 215 216 //---------------------------------------------------------------------------- 217 // Save-Root-File Settings 218 //---------------------------------------------------------------------------- 219 CreateRootFile( OutRootFileName, verbosityLevel ); 220 221 //---------------------------------------------------------------------------- 222 // root global Settings 212 223 //---------------------------------------------------------------------------- 213 224 214 225 gGainMean = GainMean; 215 226 gBSLMean = BSLMean; 216 217 //----------------------------------------------------------------------------218 // Initialize Pixel219 //----------------------------------------------------------------------------220 Pixel** pPixelSet = new Pixel*[sampleSetSize];221 222 //----------------------------------------------------------------------------223 // Save-Root-File Settings224 //----------------------------------------------------------------------------225 CreateRootFile( OutRootFileName, verbosityLevel );226 227 228 //----------------------------------------------------------------------------229 // root global Settings230 //----------------------------------------------------------------------------231 232 227 gPixelOverlayXaxisLeft = OverlayWindowLeft; 233 228 gPixelOverlayXaxisRight = OverlayWindowRight; … … 237 232 // gPad->SetGrid(); 238 233 234 //---------------------------------------------------------------------------- 235 // root Canvas Settings 236 //---------------------------------------------------------------------------- 237 //Canvas Pad numbering 239 238 int pulsesCanvasFrameNrs[4] = { 240 239 1, // Top left … … 244 243 }; 245 244 246 //Canvases 247 cgpPixelPulses = new TCanvas*[maxPulseOrder]; 248 TCanvas* cgpTestHistos = NULL; 245 //Canvas Pad numbering 246 int distributionCanvasFrameNrs[4] = { 247 1, // Top left 248 2, // Top right 249 3, // bottom left 250 4 // bootom right 251 }; 249 252 250 253 if (ProduceGraphic) 251 254 { 255 256 //Canvases 257 cgpPixelPulses = new TCanvas*[maxPulseOrder]; 258 cgpDistributions = new TCanvas*[maxPulseOrder]; 259 252 260 //TCanvas* gpcDevelopment = NULL; 253 261 TString cName = ""; 254 262 TString cTitle = ""; 255 263 264 //naming of pulse canvases 256 265 for ( 257 266 int pulse_order = maxPulseOrder - 1; … … 268 277 } 269 278 279 270 280 // Create (pointer to) Canvases, which are used in every run, 271 281 // also in 'non-debug' runs 272 282 // Canvases only need if spike Debug, but I want to deklare 273 283 // the pointers anyway ... 274 275 284 if (spikeDebug) 276 285 { … … 279 288 } 280 289 290 //additional Test histograms 281 291 cgpTestHistos = new TCanvas( "cgpTestHistos", "Test Histograms", 801, 0, 800, 800 ); 282 292 cgpTestHistos->Divide(2,0); 283 293 } 294 284 295 //----------------------------------------------------------------------------- 285 296 // Filter-Settings … … 357 368 } 358 369 359 // Book the histograms 370 //----------------------------------------------------------------------------- 371 // Book the histograms 372 //----------------------------------------------------------------------------- 373 360 374 BookDebugHistos(verbosityLevel ); 361 375 BookTestHistos( verbosityLevel ); 376 377 378 //----------------------------------------------------------------------------- 379 // Main Cycle 380 //----------------------------------------------------------------------------- 381 362 382 //------------------------------------- 363 383 // Loop over Pixel Sets … … 376 396 << firstPixelOfSample+sampleSetSize-1 << endl; 377 397 } 378 // BookPixelHistos(379 // sampleSetSize,380 // firstPixelOfSample,381 // maxPulseOrder,382 // verbosityLevel383 // );384 398 385 399 //-------------------------------------------------------------------- 386 // Loop s over Every Event of Pixel400 // Loop over every Event of Pixel Set 387 401 //-------------------------------------------------------------------- 388 402 for ( int ev = firstevent; ev < firstevent + nevents; ev++) … … 401 415 // Loops over every Pixel of a Set of Pixels 402 416 //-------------------------------------------------------------------- 403 for ( int pixel = firstPixelOfSample;404 pixel < sampleSetSize || pixel< firstpixel + npixel;405 pixel ++ )417 for ( int pixelID = firstPixelOfSample; 418 pixelID < sampleSetSize || pixelID < firstpixel + npixel; 419 pixelID++ ) 406 420 { 407 421 if (verbosityLevel > 0) 408 422 { 409 423 cout << "-------------------------------------" << endl 410 << "...processing Pixel: " << pixel 424 << "...processing Pixel: " << pixelID 411 425 << "/" << firstpixel + npixel << endl; 412 426 } 413 427 414 pPixelSet[pixel] = new Pixel( 415 pixel, 416 maxPulseOrder, 417 verbosityLevel, 418 gPixelOverlayXaxisLeft, 419 gPixelOverlayXaxisRight, 420 gBSLMean, 421 gGainMean, 422 histoOptions 423 ); 428 //------------------------------------- 429 // Create individual Pixel 430 //------------------------------------- 431 if (ev == firstevent) 432 { 433 pixel[pixelID] = new Pixel( 434 pixelID, 435 maxPulseOrder, 436 verbosityLevel, 437 gPixelOverlayXaxisLeft, 438 gPixelOverlayXaxisRight, 439 gBSLMean, 440 gGainMean, 441 histoOptions 442 ); 443 } 424 444 425 445 //------------------------------------- … … 429 449 applyDrsCalibration( 430 450 Ameas, 431 pixel ,451 pixelID, 432 452 12, 433 453 12, … … 487 507 //----------------------------------------------------------------------------- 488 508 FillHistograms( 489 p PixelSet[pixel],509 pixel[pixelID], 490 510 pZXings, 491 511 AmplWindowWidth, … … 500 520 if ( spikeDebug ) 501 521 { 502 // TODO do this correct. The vectors should be the rigt ones... this is just luck 503 debugHistos[Ameas_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 504 debugHistos[Vcorr_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 505 debugHistos[Vslide_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 506 debugHistos[Vcfd_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 507 debugHistos[Vcfd2_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 508 509 for ( unsigned int sl = 0; sl < gRegionOfInterest; sl++) 510 { 511 debugHistos[Ameas_].SetBinContent(sl, Ameas[sl]); 512 debugHistos[Vcorr_].SetBinContent(sl, Vcorr[sl]); 513 debugHistos[Vslide_].SetBinContent( sl, Vslide[sl] ); 514 debugHistos[Vcfd_].SetBinContent( sl, Vcfd[sl] ); 515 debugHistos[Vcfd2_].SetBinContent( sl, Vcfd2[sl] ); 516 } 517 518 519 cFiltered->cd(1); 520 gPad->SetGrid(); 521 debugHistos[Ameas_].Draw(); 522 523 cFiltered->cd(2); 524 gPad->SetGrid(); 525 debugHistos[Vcorr_].Draw(); 526 527 cFiltered->cd(3); 528 gPad->SetGrid(); 529 debugHistos[Vslide_].Draw(); 530 531 TBox *OneBox; 532 vector<TBox*> MyBoxes; 533 for (unsigned int i=0; i<pZXings->size(); i++){ 534 OneBox = new TBox( 535 pZXings->at(i).maxPos -10 , 536 pZXings->at(i).maxVal -0.5, 537 pZXings->at(i).maxPos +10 , 538 pZXings->at(i).maxVal +0.5); 539 OneBox->SetLineColor(kBlue); 540 OneBox->SetLineWidth(1); 541 OneBox->SetFillStyle(0); 542 OneBox->SetFillColor(kRed); 543 MyBoxes.push_back(OneBox); 544 OneBox->Draw(); 545 } 546 547 // cFiltered->cd(3); 548 // gPad->SetGrid(); 549 // debugHistos[Vcfd2_].Draw(); 550 // TLine *zeroline = new TLine(0, 0, 1024, 0); 551 // zeroline->SetLineColor(kBlue); 552 // zeroline->Draw(); 553 554 cFiltered->Update(); 555 556 557 //Process gui events asynchronously during input 558 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); 559 timer.TurnOn(); 560 TString input = Getline("Type 'q' to exit, <return> to go on: "); 561 timer.TurnOff(); 562 if (input=="q\n") { 563 breakout=true; 564 } 565 566 //TODO!!!!!!!!! 567 // do some Garbage collection ... 568 // all the Objects on the heap should be deleted here. 569 522 ProduceDebugHistos( pZXings ); 570 523 }// end of if(spikeDebug) 571 524 … … 586 539 ) 587 540 { 588 p PixelSet[pixel]->DrawHistograms(541 pixel[pixelID]->DrawHistograms( 589 542 cgpPixelPulses[order], 590 543 pulsesCanvasFrameNrs … … 626 579 //------------------------------------- 627 580 628 for ( int pixel = firstPixelOfSample;629 pixel < sampleSetSize || pixel< firstpixel + npixel;630 pixel ++ )581 for ( int pixelID = firstPixelOfSample; 582 pixelID < sampleSetSize || pixelID < firstpixel + npixel; 583 pixelID++ ) 631 584 { 632 585 //here is what happends at the end of each loop over all Events 633 // p PixelSet[pixel]->DrawHistograms(586 // pixel[pixelID]->DrawHistograms( 634 587 // cgpPixelPulses, 635 588 // pulsesCanvasFrameNrs … … 638 591 SaveHistograms( //save histograms of generell results into output root file 639 592 OutRootFileName, 640 CreateSubDirName(p PixelSet[pixel]->mChid),641 p PixelSet[pixel]->hList,593 CreateSubDirName(pixel[pixelID]->mChid), 594 pixel[pixelID]->hList, 642 595 verbosityLevel 643 596 ); … … 652 605 653 606 //Save Histograms of Pixels into Output rootfile 654 p PixelSet[pixel]->SavePixelHistograms( OutRootFileName );607 pixel[pixelID]->SavePixelHistograms( OutRootFileName ); 655 608 656 609 … … 668 621 } 669 622 670 delete p PixelSet[pixel];623 delete pixel[pixelID]; 671 624 672 625 if (verbosityLevel > 2) … … 759 712 760 713 761 void BookDebugHistos( int verbosityLevel ) 714 void 715 BookDebugHistos( int verbosityLevel ) 762 716 { 763 717 if (verbosityLevel > 2) cout << endl << "...book histograms" << endl; … … 788 742 789 743 790 void FillHistograms( 744 void 745 FillHistograms( 791 746 Pixel* CurrentPixel, 792 747 vector<Region>* pZXings, … … 877 832 //---------------------------------------------------------------------------- 878 833 879 void DrawTestHistograms( 834 void 835 DrawTestHistograms( 880 836 int verbosityLevel 881 837 ) … … 891 847 //---------------------------------------------------------------------------- 892 848 893 void UpdateCanvases( 849 void 850 UpdateCanvases( 894 851 int verbosityLevel, 895 852 int max_pulse_order 896 853 ) 897 854 { 898 if (verbosityLevel > 3) cout << endl << "...updating canvases TODO CANVAS" ;855 if (verbosityLevel > 3) cout << endl << "...updating canvases" ; 899 856 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++) 900 857 { 901 //cgpPixelPulses[pulse_order]->Modified();902 //cgpPixelPulses[pulse_order]->Update();903 //cgpTestHistos->Modified();904 //cgpTestHistos->Update();858 cgpPixelPulses[pulse_order]->Modified(); 859 cgpPixelPulses[pulse_order]->Update(); 860 cgpTestHistos->Modified(); 861 cgpTestHistos->Update(); 905 862 } 906 863 } … … 914 871 ) 915 872 { 916 if (verbosityLevel > 2) cout << endl << "...delete pixel Canvas TODO CANVAS" ; 917 // for (int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order ++) 918 // { 919 // delete cgpPixelPulses[pulse_order]; 920 // } 873 if (verbosityLevel > 2) cout << endl << "...delete pixel Canvases" ; 874 for (int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order ++) 875 { 876 delete cgpPixelPulses[pulse_order]; 877 } 878 delete[] cgpPixelPulses; 921 879 } 922 880 … … 924 882 //---------------------------------------------------------------------------- 925 883 926 884 void 885 ProduceDebugHistos( 886 vector<Region>* pZXings 887 ) 888 { 889 // TODO do this correct. The vectors should be the rigt ones... this is just luck 890 debugHistos[Ameas_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 891 debugHistos[Vcorr_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 892 debugHistos[Vslide_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 893 debugHistos[Vcfd_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 894 debugHistos[Vcfd2_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5); 895 896 for ( unsigned int sl = 0; sl < gRegionOfInterest; sl++) 897 { 898 debugHistos[Ameas_].SetBinContent(sl, Ameas[sl]); 899 debugHistos[Vcorr_].SetBinContent(sl, Vcorr[sl]); 900 debugHistos[Vslide_].SetBinContent( sl, Vslide[sl] ); 901 debugHistos[Vcfd_].SetBinContent( sl, Vcfd[sl] ); 902 debugHistos[Vcfd2_].SetBinContent( sl, Vcfd2[sl] ); 903 } 904 905 906 cFiltered->cd(1); 907 gPad->SetGrid(); 908 debugHistos[Ameas_].Draw(); 909 910 cFiltered->cd(2); 911 gPad->SetGrid(); 912 debugHistos[Vcorr_].Draw(); 913 914 cFiltered->cd(3); 915 gPad->SetGrid(); 916 debugHistos[Vslide_].Draw(); 917 918 TBox *OneBox; 919 vector<TBox*> MyBoxes; 920 for (unsigned int i=0; i<pZXings->size(); i++){ 921 OneBox = new TBox( 922 pZXings->at(i).maxPos -10 , 923 pZXings->at(i).maxVal -0.5, 924 pZXings->at(i).maxPos +10 , 925 pZXings->at(i).maxVal +0.5); 926 OneBox->SetLineColor(kBlue); 927 OneBox->SetLineWidth(1); 928 OneBox->SetFillStyle(0); 929 OneBox->SetFillColor(kRed); 930 MyBoxes.push_back(OneBox); 931 OneBox->Draw(); 932 } 933 934 // cFiltered->cd(3); 935 // gPad->SetGrid(); 936 // debugHistos[Vcfd2_].Draw(); 937 // TLine *zeroline = new TLine(0, 0, 1024, 0); 938 // zeroline->SetLineColor(kBlue); 939 // zeroline->Draw(); 940 941 cFiltered->Update(); 942 943 944 //Process gui events asynchronously during input 945 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); 946 timer.TurnOn(); 947 TString input = Getline("Type 'q' to exit, <return> to go on: "); 948 timer.TurnOff(); 949 if (input=="q\n") { 950 breakout=true; 951 } 952 953 //TODO!!!!!!!!! 954 // do some Garbage collection ... 955 // all the Objects on the heap should be deleted here. 956 957 }// end of if(spikeDebug)
Note:
See TracChangeset
for help on using the changeset viewer.