DESY Hbb Analysis Framework
Definitions.cc
Go to the documentation of this file.
1 
8 //
9 // Original Author: Roberval Walsh Bastos Rangel
10 // Created: Mon, 20 Oct 2014 14:24:08 GMT
11 //
12 //
13 
14 // system include files
15 #include <iostream>
16 //
17 // user include files
18 #include "FWCore/Framework/interface/Event.h"
19 //
20 #include "FWCore/ParameterSet/interface/ParameterSet.h"
21 
23 
24 
25 //
26 // class declaration
27 //
28 
29 using namespace analysis;
30 using namespace analysis::ntuple;
31 
32 //
33 // constructors and destructor
34 //
36 {
37  // default constructor
38 }
39 
40 Definitions::Definitions(edm::Service<TFileService> & fs)
41 {
42  std::string category = "Definitions";
43  tree_ = fs->make<TTree>(category.c_str(),category.c_str());
44 
45 }
46 
47 Definitions::Definitions(edm::Service<TFileService> & fs, const std::string & category )
48 {
49  TFileDirectory subDir = fs->mkdir( "Definitions" );
50  tree_ = subDir.make<TTree>(category.c_str(),category.c_str());
51 }
52 
53 Definitions::Definitions(TFileDirectory & subDir)
54 {
55  std::string category = "Definitions";
56  tree_ = subDir.make<TTree>(category.c_str(),category.c_str());
57 
58 }
59 
60 Definitions::Definitions(TFileDirectory & subDir, const std::string & category )
61 {
62  TFileDirectory subSubDir = subDir.mkdir( "Definitions" );
63  tree_ = subSubDir.make<TTree>(category.c_str(),category.c_str());
64 
65 }
66 
68 {
69  // do anything here that needs to be done at desctruction time
70  // (e.g. close files, deallocate resources etc.)
71 }
72 
73 
74 //
75 // member functions
76 //
77 
78 // ------------ method called for each event ------------
80 {
81  tree_ -> Fill();
82 }
83 
84 // ------------ method called once each job just before starting event loop ------------
86 {
87 }
88 
89 void Definitions::Add(const std::vector<std::string> & names, const std::vector<std::string> & aliases)
90 {
91  for ( size_t i = 0 ; i < names.size() ; ++i )
92  this -> Add(names[i],aliases[i]);
93 }
94 
95 void Definitions::Add(const std::string & name, const std::string & alias)
96 {
97  tree_ ->Branch(alias.c_str(),(void*)name.c_str(),"string/C",1024);
98 }
99 
100 // ------------ other methods ----------------
102 {
103  return tree_;
104 }
105 
void Add(const std::vector< std::string > &, const std::vector< std::string > &)
Definition: Definitions.cc:89