diff --git a/.aux/test_with_lcg b/.aux/test_with_lcg index 0998a031..e739d831 100755 --- a/.aux/test_with_lcg +++ b/.aux/test_with_lcg @@ -4,5 +4,5 @@ CMTCONFIG=$2 source /cvmfs/sft.cern.ch/lcg/views/${LCG}/${CMTCONFIG}/setup.sh source build/INSTALL/thisostap.sh cd build -ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j8 -R '(stat|frame|tool)' --output-on-failure +ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j8 -R '(stat|frame)' --output-on-failure diff --git a/source/src/StatVar.cpp b/source/src/StatVar.cpp index 4e7f99df..aadd6f9d 100644 --- a/source/src/StatVar.cpp +++ b/source/src/StatVar.cpp @@ -3559,16 +3559,18 @@ Ostap::StatVar::statVar .Define ( weight , no_cuts ? "1.0" : "1.0*(" + cuts + ")" ) ; // const unsigned int nSlots = + std::max ( 1u , #if ROOT_VERSION_CODE >= ROOT_VERSION(6,22,0) - ROOT::GetThreadPoolSize () ; + ROOT::GetThreadPoolSize () #else - ROOT::GetImplicitMTPoolSize () ; + ROOT::GetImplicitMTPoolSize () #endif + ) ; // std::vector _stat ( nSlots ? nSlots : 1 ) ; // - auto fun = [&_stat] ( unsigned int slot , double v , double w ) - { _stat[slot].add ( v , w ) ; } ; + auto fun = [&_stat,nSlots] ( unsigned int slot , double v , double w ) + { _stat [ slot % nSlots ].add ( v , w ) ; } ; t.ForeachSlot ( fun , { var , weight } ) ; // Statistic stat ; for ( const auto& s : _stat ) { stat += s ; } @@ -3634,27 +3636,28 @@ unsigned long Ostap::StatVar::statCov .Define ( var2 , "1.0*(" + exp2 + ")" ) .Define ( weight , no_cuts ? "1.0" : "1.0*(" + cuts + ")" ) ; /// - const unsigned int nSlots = + const unsigned int nSlots = std::max ( 1u , #if ROOT_VERSION_CODE >= ROOT_VERSION(6,22,0) - ROOT::GetThreadPoolSize () ; + ROOT::GetThreadPoolSize () #else - ROOT::GetImplicitMTPoolSize () ; + ROOT::GetImplicitMTPoolSize () #endif + ); // std::vector _sta1 ( nSlots ? nSlots : 1 ) ; std::vector _sta2 ( nSlots ? nSlots : 1 ) ; std::vector _cov2 ( nSlots ? nSlots : 1 ) ; // - auto fun = [&_sta1,&_sta2,&_cov2] + auto fun = [&_sta1,&_sta2,&_cov2,nSlots] ( unsigned int slot , double v1 , double v2 , double w ) { if ( w ) { - _sta1[slot].add ( v1 , w ) ; - _sta2[slot].add ( v2 , w ) ; - _cov2[slot]( 0 , 0 ) += w * v1 * v1 ; - _cov2[slot]( 0 , 1 ) += w * v1 * v2 ; - _cov2[slot]( 1 , 1 ) += w * v2 * v2 ; - } + _sta1 [ slot % nSlots ].add ( v1 , w ) ; + _sta2 [ slot % nSlots ].add ( v2 , w ) ; + _cov2 [ slot % nSlots ]( 0 , 0 ) += w * v1 * v1 ; + _cov2 [ slot % nSlots ]( 0 , 1 ) += w * v1 * v2 ; + _cov2 [ slot % nSlots ]( 1 , 1 ) += w * v2 * v2 ; + } } ; t.ForeachSlot ( fun , { var1 , var2 , weight } ); //