DAS  3.0
Das Analysis System
Looper.cc File Reference
#include <boost/test/included/unit_test.hpp>
#include <boost/exception/all.hpp>
#include <TTree.h>
#include "Looper.h"
+ Include dependency graph for Looper.cc:

Macros

#define DOXYGEN_SHOULD_SKIP_THIS
 
#define BOOST_TEST_MODULE   testLooper
 

Functions

 BOOST_AUTO_TEST_CASE (shared)
 
 BOOST_AUTO_TEST_CASE (unique)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   testLooper

◆ DOXYGEN_SHOULD_SKIP_THIS

#define DOXYGEN_SHOULD_SKIP_THIS

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( shared  )
16  {
17  auto t = make_shared<TTree>("events", "events");
18 
19  // call empty tree
20  BOOST_REQUIRE_THROW( Looper looper(t), boost::wrapexcept<invalid_argument> );
21 
22  // normal call (filling 100 events in two steps)
23  for (Looper looper(100ll, {2,0}); looper(); ++looper) t->Fill();
24  for (Looper looper(100ll, {2,1}); looper(); ++looper) t->Fill();
25 
26  BOOST_REQUIRE( t->GetEntries() == 100 );
27  BOOST_REQUIRE_NO_THROW( Looper looper(t) );
28 
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
31  // normal call
32  BOOST_REQUIRE_NO_THROW( Looper(t, {10,5}) ); // 10 slices, take here the fifth, covering [50,60[
33 
34  // no slices
35  BOOST_REQUIRE_THROW( Looper(t, {0,0}), boost::wrapexcept<invalid_argument> );
36 
37  // wrong order (5 slices, 10th slice)
38  BOOST_REQUIRE_THROW( Looper(t, {5,10}), boost::wrapexcept<invalid_argument> );
39 
40  // too many slices (1000 > 100)
41  BOOST_REQUIRE_THROW( Looper(t, {1000,0}), boost::wrapexcept<invalid_argument> );
42 
43  {
44  Looper looper(t, {10,5});
45  BOOST_TEST( *looper == 50 );
46  BOOST_TEST( looper() );
47  ++looper;
48  BOOST_TEST( *looper == 51 );
49  }
50 
51  long long i = 50;
52  for (Looper looper(t, {10,5}); looper(); ++looper) {
53  BOOST_TEST( *looper == i );
54  ++i;
55  if (i == 54) break; // a warning should be printed
56  }
57 #pragma GCC diagnostic pop
58  }

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( unique  )
61  {
62  // Test constructor with a unique_ptr argument
63  auto t = make_unique<TTree>("events", "events");
64  BOOST_REQUIRE_THROW( Looper looper(t), boost::wrapexcept<invalid_argument> );
65  }
BOOST_TEST
BOOST_TEST(gendijet.Rapidity()==1.3573785791881385)
Darwin::Tools::Looper
Facility to loop over a n-tuple, including parallelisation and printing.
Definition: Looper.h:32