Changeset 12370


Ignore:
Timestamp:
11/04/11 13:06:58 (13 years ago)
Author:
neise
Message:
added method to remove peaks, which sit on a falling edge of another peak
Location:
fact/tools/rootmacros
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/zerosearch.C

    r12306 r12370  
    211211}
    212212
     213size_t removeRegionOnFallingEdge(
     214        vector<Region> &regions,
     215        unsigned int FallingEdgeWidth,
     216        int VerbosityLevel)
     217{
     218if ( FallingEdgeWidth < 1){
     219    if (VerbosityLevel > 0){
     220      cout << " removeRegionOnFallingEdge: FallingEdgeWidth  < 1" << endl;
     221      cout << " FallingEdgeWidth =" << FallingEdgeWidth << endl;
     222      cout << "returning." << endl;
     223    return regions.size();
     224    }
     225  }
     226        if (regions.size() < 1){
     227                if (VerbosityLevel > 3)
     228                        cout << "removeRegionOnFallingEdge: source vector empty." << endl;
     229                return 0;
     230        }
     231
     232 vector<Region>::reverse_iterator it = regions.rbegin();
     233  while( it != regions.rend()-1 )
     234  {
     235  if (VerbosityLevel >10)
     236                cout << it->maxPos << "\t" << (it+1)->maxPos << "\t" << it->maxPos - (it+1)->maxPos << endl;
     237
     238    if ( it->maxPos - (it+1)->maxPos < (int)FallingEdgeWidth) {
     239      if (VerbosityLevel > 3)
     240        cout << "erasing Region @ " << it->maxPos << endl;
     241       regions.erase( --it.base() ) ;
     242      ++it;
     243    }else
     244      ++it;
     245  }
     246
     247  return regions.size();
     248}
     249
    213250
    214251size_t removeReginWithMaximaOnEdge(
     
    218255{
    219256        if (EdgeWidth < 1){
    220                 if (VerbosityLevel > 0)
     257                if (VerbosityLevel > 0){
    221258                        cout << "removeReginWithMaximaOnEdge: EdgeWidth < 1" << endl;
    222259                        cout << "EdgeWidth=" << EdgeWidth << endl;
    223260                        cout << "returning." << endl;
    224261                return regions.size();
     262                }
    225263        }
    226264
  • fact/tools/rootmacros/zerosearch.h

    r12306 r12370  
    3232        int VerbosityLevel=0);
    3333
     34size_t removeRegionOnFallingEdge(
     35  vector<Region> &regions,
     36  unsigned int FallingEdgeWidth = 100,
     37  int VerbosityLevel=0);
     38
     39
    3440size_t removeReginWithMaximaOnEdge(
    3541        vector<Region> &regions,
Note: See TracChangeset for help on using the changeset viewer.