Changeset 13558 for fact/tools/rootmacros/PulseTemplates/FPulseOverlay.C
- Timestamp:
- 05/04/12 16:27:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FPulseOverlay.C
r13547 r13558 157 157 158 158 //Root-File Objects 159 // TObjArray* hList[ sampleSetSize] = {NULL};159 // TObjArray* hList[pixelSetSize] = {NULL}; 160 160 TObjArray* hRootList = NULL; 161 161 … … 175 175 //void SaveHistograms( const char*, const char*, TObjArray*, int ); 176 176 177 void FillHistograms(Pixel*, vector<Region>*, int, int, TString, int, int);177 void FillHistograms(Pixel*, vector<Region>*, int, int, int , int ); 178 178 void DrawTestHistograms( int); 179 179 void ProduceDebugHistos( vector<Region> *pZXings); 180 180 bool UseThisPulse( int, int, int, int, int, int); 181 181 void UpdateCanvases( int, int); 182 182 void DeletePixelCanvases( int, int ); … … 190 190 const char* datafilename = "/fact/raw/2011/11/09/20111109_006.fits.gz", 191 191 const char* drsfilename = "/fact/raw/2011/11/09/20111109_003.drs.fits.gz", 192 const char* OutRootFileName = " test.root",193 bool ProduceGraphic = false,192 const char* OutRootFileName = "/home_nfs/isdc/jbbuss/analysis/FPulseTemplate/test.root", 193 bool ProduceGraphic = true, 194 194 bool spikeDebug = false, 195 bool debugPixel = false,195 bool debugPixel = true, 196 196 bool testmode = false, 197 197 bool saveResults = false, 198 198 int verbosityLevel = 1, // different verbosity levels can be implemented here 199 199 int firstevent = 1, // Hast to be between 1 and infinity NOT 0!!!! 200 int nevents = 100 ,201 int firstpixel = 0,202 int npixel = -1,203 int sampleSetSize = 40,204 int maxPulseOrder = 3,200 int nevents = 1000, 201 int firstpixel = 15, 202 int npixel = 3, 203 int pixelSetSize = 40, 204 int maxPulseOrder = 4, 205 205 int AmplWindowWidth = 14, //Width of Window for selection of pulses to histograms 206 206 TString histoOptions = "S", 207 float GainMean = 8,207 float GainMean = 9, 208 208 float BSLMean = -1, //4 Histogramms will be drawn, decide how far pulsehights differ from eachother 209 209 int avg1 = 8, … … 275 275 cName ="cgpDistributions"; 276 276 cName += pulse_order; 277 cTitle =" Pulses of Order: ";277 cTitle ="Distributions of Pulses with Order of: "; 278 278 cTitle += pulse_order; 279 279 cgpDistributions[pulse_order] = new TCanvas(cName,cTitle, 0,pulse_order*20,800,800); … … 281 281 cName ="cgpPixelPulses"; 282 282 cName += pulse_order; 283 cTitle =" Pulses of Order: ";283 cTitle ="Overlays of Pulses with Order of: "; 284 284 cTitle += pulse_order; 285 285 cgpPixelPulses[pulse_order] = new TCanvas(cName,cTitle, 0,pulse_order*20,800,800); … … 405 405 // Loop over Pixel Sets 406 406 //------------------------------------- 407 for ( int firstPixelOfS ample= firstpixel;408 firstPixelOfS ample< firstpixel + npixel;409 firstPixelOfS ample += sampleSetSize )407 for ( int firstPixelOfSet = firstpixel; 408 firstPixelOfSet < firstpixel + npixel; 409 firstPixelOfSet += pixelSetSize ) 410 410 { 411 411 … … 413 413 { 414 414 cout << "------------------------------------------------" << endl 415 << "...processing S amplefrom Pixel "416 << firstPixelOfS ample415 << "...processing Set from Pixel " 416 << firstPixelOfSet 417 417 << " to Pixel " 418 << firstPixelOfS ample+sampleSetSize-1 << endl;418 << firstPixelOfSet+pixelSetSize-1 << endl; 419 419 } 420 420 … … 425 425 { 426 426 // Get an Event --> consists of 1440 Pixel ...erm....data 427 cout << endl << "processing event " << ev << endl;428 427 datafile->GetRow( ev - 1 ); 429 428 … … 431 430 { 432 431 cout << "-------------------------------------" << endl 433 << "...processing S amplefrom Pixel "434 << firstPixelOfS ample432 << "...processing Set from Pixel " 433 << firstPixelOfSet 435 434 << " to Pixel " 436 << firstPixelOfS ample+sampleSetSize-1435 << firstPixelOfSet+pixelSetSize-1 437 436 << "... Event: " << CurrentEventID 438 437 << "/" << nevents << endl; … … 442 441 // Loops over every Pixel of a Set of Pixels 443 442 //-------------------------------------------------------------------- 444 for ( int pixelID = firstPixelOfS ample;445 pixelID < firstPixelOfS ample + sampleSetSize443 for ( int pixelID = firstPixelOfSet; 444 pixelID < firstPixelOfSet + pixelSetSize 446 445 && pixelID < firstpixel + npixel; 447 446 pixelID++ ) … … 450 449 { 451 450 cout << "-------------------------------------" << endl 452 << "...processing S amplefrom Pixel "453 << firstPixelOfS ample451 << "...processing Set from Pixel " 452 << firstPixelOfSet 454 453 << " to Pixel " 455 << firstPixelOfS ample+sampleSetSize-1454 << firstPixelOfSet+pixelSetSize-1 456 455 << "... Event: " << CurrentEventID 457 456 << "/" << nevents << endl … … 550 549 AmplWindowWidth, 551 550 ev, 552 histoOptions,551 // histoOptions, 553 552 maxPulseOrder, 554 553 verbosityLevel … … 573 572 if (debugPixel) 574 573 { 575 for ( int order = 0;576 order < maxPulseOrder;577 order++578 )579 {580 pixel[ pixelID]->DrawHistograms(581 cgpPixelPulses [order],574 // for ( int order = 0; 575 // order < maxPulseOrder; 576 // order++ 577 // ) 578 // { 579 pixel[firstPixelOfSet]->DrawHistograms( 580 cgpPixelPulses, 582 581 pulsesCanvasFrameNrs 583 582 ); 584 }583 // } 585 584 if (testmode) 586 585 { … … 605 604 << endl << "-------------------------------------"<< endl; 606 605 } 607 }//End of Loop over S ample608 //------------------------------------- 609 // end of Loops over S ample606 }//End of Loop over Set 607 //------------------------------------- 608 // end of Loops over Set 610 609 //------------------------------------- 611 610 … … 621 620 //------------------------------------- 622 621 623 for ( int pixelID = firstPixelOfS ample;624 pixelID < firstPixelOfS ample + sampleSetSize622 for ( int pixelID = firstPixelOfSet; 623 pixelID < firstPixelOfSet + pixelSetSize 625 624 && pixelID < firstpixel + npixel; 626 625 pixelID++ ) 627 626 { 628 627 //here is what happends at the end of each loop over all Events 629 // pixel[pixelID]->DrawHistograms(630 // cgpPixelPulses,631 // pulsesCanvasFrameNrs632 // );633 634 // SaveHistograms( //save histograms of generell results into output root file635 // OutRootFileName,636 // CreateSubDirName(pixel[pixelID]->mChid),637 // pixel[pixelID]->hList,638 // saveResults,639 // verbosityLevel640 // );641 628 642 629 if (ProduceGraphic) 643 630 { 644 UpdateCanvases( 645 verbosityLevel, 646 maxPulseOrder 647 ); 631 pixel[pixelID]->DrawHistograms( 632 cgpPixelPulses, 633 pulsesCanvasFrameNrs 634 ); 635 636 UpdateCanvases( 637 verbosityLevel, 638 maxPulseOrder 639 ); 648 640 } 649 641 … … 717 709 verbosityLevel 718 710 ); 719 } 720 721 delete datafile; 722 delete[] pixel; 711 delete cgpTestHistos; 712 713 if (spikeDebug) 714 delete cFiltered; 715 } 716 717 delete datafile; 718 delete[] pixel; 719 720 723 721 return( 0 ); 724 722 } … … 813 811 int AmplWindowWidth, 814 812 int eventNumber, 815 TString histoOptions,816 813 int maxPulseOrder, 817 814 int verbosityLevel … … 819 816 { 820 817 if (verbosityLevel > 2) cout << endl << "...filling pulse histograms" ; 818 if (verbosityLevel > 3) cout << endl << "...EventNR " << eventNumber ; 821 819 bool use_this_peak=false; 822 820 int order_of_pulse=0; … … 831 829 continue; 832 830 } 831 833 832 // Define axis range of Histogram 834 833 int Left = reg->maxPos - gPixelOverlayXaxisLeft; … … 843 842 844 843 845 // hTesthisto2->Fill( eventNumber, reg->slopeOfRisingEdge ) ;846 847 844 if (verbosityLevel > 2) cout << endl << "\t...choosing Histogram" ; 848 849 845 //determine order of pulse and which histogram shall be filled 850 for (int order = 0; order < maxPulseOrder; order++)846 for ( int order = 0; order < maxPulseOrder; order++) 851 847 { 852 if (Ameas[reg->maxPos] >= ((gGainMean*(order+1)) - (AmplWindowWidth/2)) 853 && Ameas[reg->maxPos] < ((gGainMean*(order+1)) + AmplWindowWidth/2)) 854 { 855 if (verbosityLevel > 2) cout << "...#" << order ; 848 use_this_peak = UseThisPulse( 849 reg->maxPos, 850 order, 851 AmplWindowWidth, 852 gGainMean, 853 maxPulseOrder, 854 verbosityLevel 855 ); 856 if ( use_this_peak) 857 { 856 858 order_of_pulse = order; 857 use_this_peak = true;858 859 break; 859 860 } 860 else if (order >= (maxPulseOrder - 1)) 861 { 862 use_this_peak = false; 863 if (verbosityLevel > 2) cout << "...NONE" << endl ; 861 } 862 //Fill histograms 863 if (use_this_peak) 864 { 865 //Histograms for Distributions 866 if (CurrentPixel->mOptions.Contains("S") ) 867 { 868 if (verbosityLevel > 2) 869 cout << endl << "\t...filling Edge Histogram" ; 870 CurrentPixel->hSlopeRisingEdge[order_of_pulse]->Fill( reg->slopeOfRisingEdge ) ; 864 871 } 865 if (use_this_peak) 866 { 867 if ( histoOptions.Contains("S") ) 868 { 869 // if (verbosityLevel > 2) 870 cout << endl << "\t...filling Edge Histogram" ; 871 CurrentPixel->hSlopeRisingEdge[order]->Fill( reg->slopeOfRisingEdge ) ; 872 } 872 873 //Histograms for Maximum Overlay 874 for ( int pos = Left; pos < Right; pos++) 875 { 876 CurrentPixel->hMaxOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ; 877 CurrentPixel->hMaxProfile[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ; 873 878 } 874 } 875 //Fill overlay und profile histograms 876 if (use_this_peak){ 877 for ( int pos = Left; pos < Right; pos++){ 878 // if (); 879 CurrentPixel->hMaxOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ; 880 CurrentPixel->hMaxProfile[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ; 881 } 882 for ( int pos = EdgeLeft; pos < EdgeRight; pos++){ 879 //Histograms for Edge Overlay 880 for ( int pos = EdgeLeft; pos < EdgeRight; pos++) 881 { 883 882 CurrentPixel->hEdgeOverlay[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), Ameas[pos]) ; 884 883 CurrentPixel->hEdgeProfile[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), Ameas[pos]) ; 885 886 884 } 885 887 886 if (verbosityLevel > 2) cout << "...done" << endl; 888 887 } 888 889 889 //Breakout option 890 890 if (breakout) 891 break; 891 { 892 break; 893 } 892 894 } 893 895 if (verbosityLevel > 2) cout << "...done" << endl; … … 895 897 // end of FillHistograms 896 898 //---------------------------------------------------------------------------- 899 900 bool UseThisPulse( 901 int maxPos, 902 int order, 903 int AmplWindowWidth, 904 int gGainMean, 905 int maxPulseOrder, 906 int verbosityLevel 907 ) 908 { 909 //determine if pulse is of given order 910 bool use_this_peak = false; 911 if (Ameas[maxPos] >= ((gGainMean*(order+1)) - (AmplWindowWidth/2)) 912 && Ameas[maxPos] < ((gGainMean*(order+1)) + AmplWindowWidth/2)) 913 { 914 if (verbosityLevel > 3) cout << "...#" << order ; 915 use_this_peak = true; 916 } 917 else 918 { 919 if (verbosityLevel > 3) 920 { 921 if (order >= (maxPulseOrder - 1)) 922 { 923 cout << "...NONE" << endl ; 924 } 925 } 926 use_this_peak = false; 927 } 928 929 return use_this_peak; 930 } 931 897 932 898 933 void
Note:
See TracChangeset
for help on using the changeset viewer.