- Timestamp:
- 01/31/13 12:27:57 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FPulseOverlay_filelist.C
r14782 r14809 179 179 //void SaveHistograms( const char*, const char*, TObjArray*, int ); 180 180 181 void FillHistograms(Pixel*, vector<Region>*, int, int, int , int);181 void FillHistograms(Pixel*, vector<Region>*, int, int, int , bool , int verbosityLevel ); 182 182 void DrawTestHistograms( int); 183 183 bool ProduceDebugHistos( vector<Region> *pZXings); 184 bool UseThisPulse( int, int, int, float, int, int);184 bool UseThisPulse( int, int, int, float, float bslMean, int maxPulseOrder, int verbosityLevel); 185 185 void UpdateCanvases( int, int, bool); 186 186 void DeletePixelCanvases( int, int ); … … 211 211 //---------------------------------------------------------------------------- 212 212 int FPulseOverlay_filelist( 213 TString inputPath = "raw/2012/03/09/", 214 TString sequenzFileName = "/home/jbuss/macros/isdc_rootmacros/PulseTemplates/seq", 215 // TString dataFileSuffix = ".fits.gz", 213 TString inputPath = "raw/2012/08/02/", 214 TString sequenzFileName = "/home_nfs/isdc/jbbuss/analysis/pulseShape/lists/20120802templ_vs_0mV.csv", 216 215 // int firstRunId = 18, 217 // int nRuns = 50,216 int nRuns = -1, 218 217 // TString drsfilename = "20120309_012.drs.fits.gz", 219 TString OutputPath = "analysis/ FPulseTemplate/20120309_018/Overlay/",220 TString OutRootFileName = "20120 309_018.root",218 TString OutputPath = "analysis/pulseShape/", 219 TString OutRootFileName = "20120802_0mV_newSelectAlg.root", 221 220 int firstevent = 1, // Hast to be between 1 and infinity NOT 0!!!! 222 int nevents = 100,221 int nevents = -1, 223 222 int firstpixel = 0, 224 int npixel = 2,223 int npixel = 1, 225 224 int pixelSetSize = 150, 226 int maxPulseOrder = 1,227 int verbosityLevel = 6, // different verbosity levels can be implemented here225 int maxPulseOrder = 6, 226 int verbosityLevel = 0, // different verbosity levels can be implemented here 228 227 TString histoOptions = "SRM", 229 int AmplWindowWidth = 14, //Width of Window for selection of pulses to histograms230 float GainMean = 9,231 float BSLMean = - 1, //4 Histogramms will be drawn, decide how far pulsehights differ from eachother228 int AmplWindowWidth = 7, //Width of Window for selection of pulses to histograms 229 float GainMean = 11, 230 float BSLMean = -2, //4 Histogramms will be drawn, decide how far pulsehights differ from eachother 232 231 int avg1 = 8, 233 232 int avg2 = 8, 234 int OverlayWindowLeft = 70, 235 int OverlayWindowRight = 230, 236 bool ProduceGraphic = true, 233 int OverlayWindowLeft = 1024, 234 int OverlayWindowRight = 1024, 235 bool select_pulses = false, 236 bool ProduceGraphic = false, 237 237 bool spikeDebug = false, 238 238 bool debugPixel = false, 239 bool stats = false,240 bool saveResults = false,239 bool stats = true, 240 bool saveResults = true, 241 241 bool testmode = false, 242 242 int refresh_rate = 500 //refresh rate for canvases … … 244 244 { 245 245 //----------------------------------------------------------------------------- 246 // configuration 247 //----------------------------------------------------------------------------- 248 249 float minPulseAmplitude = 0.3*(GainMean-BSLMean); 250 float maxPulseAmplitude = 2*(GainMean-BSLMean)*maxPulseOrder; 251 int timeLineEdgeWidth = 2; 252 int FallingEdgeWidth = 200; 253 int beginRisingEdge = 5; 254 int endRisingEdge = 10; 255 float risingEdgeMinSlope = 0.5; 256 257 //----------------------------------------------------------------------------- 246 258 // prepare datafiles 247 259 //----------------------------------------------------------------------------- 248 260 249 261 inputPath = SetHostsPaths(false, inputPath ); 262 263 TString fitsFileSuffix = ".fits.gz"; 264 TString drsFileSuffix = ".drs.fits.gz"; 250 265 251 266 // declare the data file … … 260 275 vector<TString> drsFileNames; 261 276 277 cout << "...reading sequnezfile" << endl; 262 278 ReadSequenzFile( 263 279 sequenzFileName, … … 270 286 //fill vector of fits files to read 271 287 cout << "generating file list:" << endl; 288 if(nRuns < fitsFileNames.size() && nRuns != -1) 289 { 290 fitsFileNames.resize( nRuns); 291 drsFileNames.resize( nRuns); 292 } 293 272 294 for (unsigned int fileNr = 0; fileNr < fitsFileNames.size(); fileNr++) 273 295 { … … 288 310 TString fits_filename = inputPath; 289 311 fits_filename.Append(fitsFileNames.at(fileNr)); 312 fits_filename.Append(fitsFileSuffix); 290 313 TString drs_filename = inputPath; 291 314 drs_filename.Append(drsFileNames.at(fileNr)); 315 drs_filename.Append(drsFileSuffix); 292 316 cout << "\n\t fits:\t" << fits_filename; 293 317 cout << "\n\t drs:\t" << drs_filename << endl; … … 321 345 << " drs: " 322 346 << drsFileNames.size() << endl; 347 348 if (fitsFileNames.size() < 1) return 1; 323 349 324 350 //---------------------------------------------------------------------------- … … 462 488 // Main Cycle 463 489 //----------------------------------------------------------------------------- 490 cout << "------------------Main cylcle------------------------------" << endl; 491 492 if(npixel == -1) npixel = 1439; 464 493 465 494 if ( pixelSetSize == -1 ) … … 468 497 } 469 498 int lastPixelOfSet = 0; 499 cout << "check " << npixel << endl; 470 500 //------------------------------------- 471 501 // Loop over Pixel Sets … … 497 527 //------------------------------------- 498 528 529 cout << "loop over files" << endl; 499 530 for( unsigned int fileId = 0; fileId < fitsFileNames.size(); fileId++ ) 500 531 { … … 597 628 } 598 629 599 cout << "\t\t success!" << endl;600 630 //-------------------------------------------------------------------- 601 631 // Loops over every Pixel of a Set of Pixels … … 622 652 // Create individual Pixel 623 653 //------------------------------------- 624 if (ev == firstevent )654 if (ev == firstevent && fileId == 0) 625 655 { 626 656 pixel[pixelID] = new Pixel( … … 680 710 681 711 //------------------------------------- 682 // Sea gRCh vor Zero crossings712 // Search vor Zero crossings 683 713 //------------------------------------- 684 714 if (verbosityLevel > 2) cout << endl << "...seagRChing zero crossings" ; … … 691 721 EnlargeRegion(*pZXings, 10, 10); 692 722 findAbsMaxInRegions(*pZXings, gVslide); 693 removeMaximaBelow( *pZXings, 3.0); 694 removeRegionWithMaxOnEdge( *pZXings, 2); 695 removeRegionOnFallingEdge( *pZXings, 100); 696 findTimeOfHalfMaxLeft(*pZXings, gVslide, gBSLMean, 5, 10, verbosityLevel ); 697 removeRegionWithToFlatSlope(*pZXings, 0.5); 723 removeMaximaBelow( *pZXings, minPulseAmplitude); 724 removeMaximaAbove( *pZXings, maxPulseAmplitude); 725 removeRegionWithMaxOnEdge( *pZXings, timeLineEdgeWidth); 726 removeRegionOnFallingEdge( *pZXings, FallingEdgeWidth); 727 // Calculate the position (sample) of a pulses half maximum 728 findTimeOfHalfMaxLeft(*pZXings, gVslide, gBSLMean, beginRisingEdge, endRisingEdge, verbosityLevel ); 729 //sometimes pulses where found with a very flat slope, DISMISS them 730 removeRegionWithToFlatSlope(*pZXings, risingEdgeMinSlope); 698 731 if (verbosityLevel > 2) cout << "...done" << endl; 699 732 … … 713 746 // histoOptions, 714 747 maxPulseOrder, 748 select_pulses, 715 749 verbosityLevel 716 750 ); … … 994 1028 int eventNumber, 995 1029 int maxPulseOrder, 1030 bool select_pulses, 996 1031 int verbosityLevel 997 1032 ) 998 1033 { 1034 //entry counters 1035 int maxOverlayEntries = 0; 1036 int edgeOverlayEntries = 0; 1037 int maxProfileEntries = 0; 1038 int edgeProfileEntries = 0; 1039 1040 1041 1042 999 1043 if (verbosityLevel > 2) cout << endl << "...filling pulse histograms" ; 1000 1044 if (verbosityLevel > 3) cout << endl << "...EventNR " << eventNumber ; … … 1020 1064 if (Left < 0) Left = 0; 1021 1065 if (EdgeLeft < 0) EdgeLeft = 0; 1022 if (Right > (int)g Ameas.size() ) Right = gAmeas.size();1023 if (EdgeRight > (int)g Ameas.size() ) EdgeRight = gAmeas.size();1066 if (Right > (int)gVcorr.size() ) Right = gVcorr.size(); 1067 if (EdgeRight > (int)gVcorr.size() ) EdgeRight = gVcorr.size(); 1024 1068 1025 1069 … … 1033 1077 AmplWindowWidth, 1034 1078 gGainMean, 1079 gBSLMean, 1035 1080 maxPulseOrder, 1036 1081 verbosityLevel … … 1042 1087 } 1043 1088 } 1089 if (select_pulses){ 1090 order_of_pulse = 0; 1091 use_this_peak = true; 1092 } 1044 1093 //Fill histograms 1045 1094 if (use_this_peak) 1046 1095 { 1096 //get number of entries of used histograms 1097 maxOverlayEntries = CurrentPixel->hMaxOverlay[order_of_pulse]->GetEntries(); 1098 edgeOverlayEntries = CurrentPixel->hEdgeOverlay[order_of_pulse]->GetEntries(); 1099 maxProfileEntries = CurrentPixel->hMaxProfile[order_of_pulse]->GetEntries(); 1100 edgeProfileEntries = CurrentPixel->hEdgeProfile[order_of_pulse]->GetEntries(); 1101 1102 1047 1103 //Histograms for Distributions 1048 1104 if (CurrentPixel->mOptions.Contains("S") ) … … 1070 1126 for ( int pos = Left; pos < Right; pos++) 1071 1127 { 1072 CurrentPixel->hMaxOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), g Ameas[pos]) ;1073 CurrentPixel->hMaxProfile[order_of_pulse]->Fill( pos - (reg->maxPos), g Ameas[pos]) ;1128 CurrentPixel->hMaxOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), gVcorr[pos]) ; 1129 CurrentPixel->hMaxProfile[order_of_pulse]->Fill( pos - (reg->maxPos), gVcorr[pos]) ; 1074 1130 } 1075 1131 //Histograms for Edge Overlay 1076 1132 for ( int pos = EdgeLeft; pos < EdgeRight; pos++) 1077 1133 { 1078 CurrentPixel->hEdgeOverlay[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), g Ameas[pos]) ;1079 CurrentPixel->hEdgeProfile[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), g Ameas[pos]) ;1134 CurrentPixel->hEdgeOverlay[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), gVcorr[pos]) ; 1135 CurrentPixel->hEdgeProfile[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), gVcorr[pos]) ; 1080 1136 } 1137 1138 //set histogram entries 1139 CurrentPixel->hMaxOverlay[order_of_pulse]->SetEntries( maxOverlayEntries +1 ); 1140 CurrentPixel->hEdgeOverlay[order_of_pulse]->SetEntries( edgeOverlayEntries +1 ); 1141 CurrentPixel->hMaxProfile[order_of_pulse]->SetEntries( maxProfileEntries +1 ); 1142 CurrentPixel->hEdgeProfile[order_of_pulse]->SetEntries( edgeProfileEntries +1 ); 1081 1143 1082 1144 if (verbosityLevel > 2) cout << "...done" << endl; … … 1099 1161 int AmplWindowWidth, 1100 1162 float gainMean, 1163 float bslMean, 1101 1164 int maxPulseOrder, 1102 1165 int verbosityLevel … … 1105 1168 //determine if pulse is of given order 1106 1169 bool use_this_peak = false; 1107 if (g Ameas[maxPos] >= ((gainMean*(order+1))- (AmplWindowWidth/2))1108 && g Ameas[maxPos] < ((gainMean*(order+1))+ AmplWindowWidth/2))1170 if (gVcorr[maxPos] >= ((gainMean*(order+1)) - bslMean - (AmplWindowWidth/2)) 1171 && gVcorr[maxPos] < ((gainMean*(order+1)) -bslMean + AmplWindowWidth/2)) 1109 1172 { 1110 1173 if (verbosityLevel > 3) cout << "...#" << order ;
Note:
See TracChangeset
for help on using the changeset viewer.