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  // wrong order (5 slices, 10th slice)
35  BOOST_REQUIRE_THROW( Looper(t, {5,10}), boost::wrapexcept<invalid_argument> );
36 
37  // too many slices (1000 > 100)
38  BOOST_REQUIRE_THROW( Looper(t, {1000,0}), boost::wrapexcept<invalid_argument> );
39 
40  {
41  Looper looper(t, {10,5});
42  BOOST_TEST( *looper == 50 );
43  BOOST_TEST( looper() );
44  ++looper;
45  BOOST_TEST( *looper == 51 );
46  }
47 
48  long long i = 50;
49  for (Looper looper(t, {10,5}); looper(); ++looper) {
50  BOOST_TEST( *looper == i );
51  ++i;
52  if (i == 54) break; // a warning should be printed
53  }
54 #pragma GCC diagnostic pop
55  }

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( unique  )
58  {
59  // Test constructor with a unique_ptr argument
60  auto t = make_unique<TTree>("events", "events");
61  BOOST_REQUIRE_THROW( Looper looper(t), boost::wrapexcept<invalid_argument> );
62  }
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