DAS  3.0
Das Analysis System
Variation.cc File Reference
#include <Event.h>
#include <Jet.h>
#include <MetaInfo.h>
#include <Variation.h>
#include <TList.h>
#include <TObjString.h>
#include <boost/test/included/unit_test.hpp>
#include <boost/exception/all.hpp>
+ Include dependency graph for Variation.cc:

Classes

struct  MyMetaInfo
 

Macros

#define BOOST_TEST_MODULE   Variation
 

Functions

 BOOST_AUTO_TEST_CASE (model_like)
 
 BOOST_AUTO_TEST_CASE (JES_like)
 
 BOOST_AUTO_TEST_CASE (replica_like)
 
 BOOST_AUTO_TEST_CASE (prefiring_like)
 
 BOOST_AUTO_TEST_CASE (bSF_like)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Variation

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/5]

BOOST_AUTO_TEST_CASE ( bSF_like  )
97  {
98  auto bSFstatbins = metainfo.AddVars(RecJet::WeightVar, {"bSFstat"}, symmetric | bits, 8);
99  BOOST_TEST( bSFstatbins.size() == 16 );
100  for (const auto& bSFstatbin: bSFstatbins)
101  cout << bSFstatbin << '\n';
102  cout << flush;
103 
104  BOOST_TEST( metainfo.GetVars(RecJet::WeightVar).size() == bSFstatbins.size() );
105  }

◆ BOOST_AUTO_TEST_CASE() [2/5]

BOOST_AUTO_TEST_CASE ( JES_like  )
48  {
49  auto JEC = metainfo.AddVars(RecJet::ScaleVar, {"FlavourQCD", "PtBalance"});
50  BOOST_TEST( JEC.size() == 4 );
51  for (const auto& jes: JEC)
52  cout << jes << '\n';
53  cout << flush;
54 
55  BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar, "JER").size() == 0 );
56  JEC.merge(metainfo.AddVars(RecJet::ScaleVar, {"JER"}));
57  BOOST_TEST( JEC.size() == 6 );
58 
59  BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar, "JER").size() == 2 );
60  BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar ).size() == JEC.size() );
61  BOOST_TEST( metainfo.GetVars( ).size() == JEC.size()+1 );
62  for (const auto& v: metainfo.GetVars())
63  cout << v << '\n';
64  cout << flush;
65 
66  BOOST_TEST_MESSAGE( "Testing an erroneous regex" );
67  BOOST_REQUIRE_THROW( metainfo.GetVars(RecJet::ScaleVar, "\\w{"), wrapexcept<regex_error> );
68 
69  BOOST_TEST_MESSAGE( "Testing a wrong number of members" );
70  BOOST_REQUIRE_THROW( metainfo.AddVars(RecJet::ScaleVar, {"JER"}, symmetric, 0), wrapexcept<invalid_argument> );
71  }

◆ BOOST_AUTO_TEST_CASE() [3/5]

BOOST_AUTO_TEST_CASE ( model_like  )
30  {
31  auto models = metainfo.AddVars(GenEvent::WeightVar, {"Pythia", "Herwig"}, single);
32  BOOST_TEST( models.size() == 2 );
33  for (const auto& model: models)
34  cout << model << '\n';
35  cout << flush;
36 
37  BOOST_REQUIRE_NO_THROW( metainfo.GetVars(GenEvent::WeightVar) );
38  BOOST_TEST( metainfo.GetVars(GenEvent::WeightVar).size() == models.size() );
39  BOOST_REQUIRE_THROW( metainfo.GetVars(RecEvent::WeightVar), wrapexcept<invalid_argument> );
40 
41  BOOST_REQUIRE_THROW( metainfo.AddVars(GenEvent::WeightVar, {"MadGraph"}, single, 2), wrapexcept<invalid_argument> );
42 
43  metainfo.Set<int>("variations", "GenEvtWgts", "Vincia", 0);
44  BOOST_REQUIRE_THROW( metainfo.GetVars(GenEvent::WeightVar, "Vincia"), wrapexcept<invalid_argument> );
45  }

◆ BOOST_AUTO_TEST_CASE() [4/5]

BOOST_AUTO_TEST_CASE ( prefiring_like  )
86  {
87  auto prefbins = metainfo.AddVars(RecEvent::WeightVar, {"Prefiring"}, symmetric | replicas, 20);
88  BOOST_TEST( prefbins.size() == 40 );
89  for (const auto& prefbin: prefbins)
90  cout << prefbin << '\n';
91  cout << flush;
92 
93  BOOST_TEST( metainfo.GetVars(RecEvent::WeightVar).size() == prefbins.size() );
94  }

◆ BOOST_AUTO_TEST_CASE() [5/5]

BOOST_AUTO_TEST_CASE ( replica_like  )
74  {
75  using enum Darwin::Physics::VarType;
76  auto replicae = metainfo.AddVars(GenEvent::WeightVar, {"Replica"}, replicas, 10);
77  BOOST_TEST( replicae.size() == 10 );
78  for (const auto& replica: replicae)
79  cout << replica << '\n';
80  cout << flush;
81 
82  BOOST_TEST( metainfo.GetVars(GenEvent::WeightVar).size() == replicae.size() );
83  }
Darwin::Physics::replicas
@ replicas
Definition: Variation.h:16
BOOST_TEST
BOOST_TEST(gendijet.Rapidity()==1.3573785791881385)
Darwin::Physics::bits
@ bits
Definition: Variation.h:17
Darwin::Physics::VarType
VarType
Definition: Variation.h:13
Darwin::Physics::single
@ single
Definition: Variation.h:14
Darwin::Physics::symmetric
@ symmetric
Definition: Variation.h:15