Changeset 14803 for fact/tools/rootmacros
- Timestamp:
- 01/31/13 11:51:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/zerosearch.C
r13614 r14803 220 220 int VerbosityLevel) 221 221 { 222 if ( FallingEdgeWidth < 1){ 223 if (VerbosityLevel > 0){ 224 cout << " removeRegionOnFallingEdge: FallingEdgeWidth < 1" << endl; 225 cout << " FallingEdgeWidth =" << FallingEdgeWidth << endl; 226 cout << "returning." << endl; 227 return regions.size(); 228 } 229 } 222 //throw exceptions 223 if ( FallingEdgeWidth < 1){ 224 if (VerbosityLevel > 0){ 225 cout << " removeRegionOnFallingEdge: FallingEdgeWidth < 1" << endl; 226 cout << " FallingEdgeWidth =" << FallingEdgeWidth << endl; 227 cout << "returning." << endl; 228 return regions.size(); 229 } 230 } 231 //throw exceptions 230 232 if (regions.size() < 1){ 231 233 if (VerbosityLevel > 3) … … 260 262 if (EdgeWidth < 1){ 261 263 if (VerbosityLevel > 0){ 262 cout << "removeRegi nWithMaximaOnEdge: EdgeWidth < 1" << endl;264 cout << "removeRegionWithMaximaOnEdge: EdgeWidth < 1" << endl; 263 265 cout << "EdgeWidth=" << EdgeWidth << endl; 264 266 cout << "returning." << endl; … … 466 468 // ALARM check for out of range values... 467 469 468 470 bool passed = false; 471 for (int slice=reg->maxPos; 472 slice > 1; --slice) 473 { 474 if ( data[slice] < 0.9*data[reg->maxPos] && !passed) 475 { 476 beginRisingEdge = reg->maxPos - slice; 477 passed = true; 478 } 479 480 if ( data[slice] < 0.1*data[reg->maxPos]) 481 { 482 endRisingEdge = reg->maxPos - slice; 483 passed = false; 484 reg->lengthOfRisingEdge=endRisingEdge - beginRisingEdge; 485 break; 486 } 487 } 488 489 490 //calculate mean of x and y coordinate 469 491 for (int slice=reg->maxPos - beginRisingEdge; 470 492 slice > reg->maxPos - endRisingEdge; --slice) … … 478 500 xmean /= counter; 479 501 ymean /= counter; 502 480 503 if (VerbosityLevel > 2) cout << "## xmean: " << xmean << endl; 481 504 if (VerbosityLevel > 2) cout << "## ymean: " << ymean << endl; 482 505 506 cov = 0.0; 507 var = 0.0; 508 483 509 for (int slice=reg->maxPos - beginRisingEdge; 484 510 slice > reg->maxPos - endRisingEdge; --slice) 485 511 { 486 cov = (data[slice] - ymean) * (slice - xmean);487 var = (slice - xmean) * (slice - xmean);512 cov += (data[slice] - ymean) * (slice - xmean); 513 var += (slice - xmean) * (slice - xmean); 488 514 } 489 515 if (VerbosityLevel > 2) cout << "## cov: " << cov << endl; … … 492 518 slope = cov / var; 493 519 intercept = ymean - slope * xmean; 520 494 521 // now calculate, where the fittet line crosses the threshold 495 522 pos_of_thr_Xing = (thr - intercept) / slope;
Note:
See TracChangeset
for help on using the changeset viewer.