Fork me on GitHub

source: svn/trunk/modules/Delphes.cc@ 1179

Last change on this file since 1179 was 1151, checked in by Pavel Demin, 11 years ago

add RandomSeed parameter

  • Property svn:keywords set to Id Revision Date
File size: 3.0 KB
Line 
1
2/** \class Delphes
3 *
4 * Main Delphes module.
5 * Controls execution of all other modules.
6 *
7 * $Date: 2013-06-27 14:57:56 +0000 (Thu, 27 Jun 2013) $
8 * $Revision: 1151 $
9 *
10 *
11 * \author P. Demin - UCL, Louvain-la-Neuve
12 *
13 */
14
15#include "modules/Delphes.h"
16
17#include "classes/DelphesClasses.h"
18#include "classes/DelphesFactory.h"
19#include "classes/DelphesFormula.h"
20
21#include "ExRootAnalysis/ExRootResult.h"
22#include "ExRootAnalysis/ExRootFilter.h"
23#include "ExRootAnalysis/ExRootClassifier.h"
24#include "ExRootAnalysis/ExRootConfReader.h"
25#include "ExRootAnalysis/ExRootTreeWriter.h"
26
27#include "TROOT.h"
28#include "TMath.h"
29#include "TFolder.h"
30#include "TString.h"
31#include "TFormula.h"
32#include "TRandom3.h"
33#include "TObjArray.h"
34#include "TDatabasePDG.h"
35#include "TLorentzVector.h"
36
37#include <algorithm>
38#include <stdexcept>
39#include <iostream>
40#include <sstream>
41
42#include <string.h>
43#include <stdio.h>
44
45using namespace std;
46
47Delphes::Delphes(const char *name) :
48 fFactory(0)
49{
50 TFolder *folder = new TFolder(name, "");
51 fFactory = new DelphesFactory("ObjectFactory");
52
53 SetName(name);
54 SetFolder(folder);
55
56 folder->Add(this);
57 folder->Add(fFactory);
58
59 gROOT->GetListOfBrowsables()->Add(folder);
60}
61
62//------------------------------------------------------------------------------
63
64Delphes::~Delphes()
65{
66 if(fFactory) delete fFactory;
67 TFolder *folder = GetFolder();
68 if(folder)
69 {
70 folder->Clear();
71 delete folder;
72 }
73}
74
75//------------------------------------------------------------------------------
76
77void Delphes::Clear()
78{
79 if(fFactory) fFactory->Clear();
80}
81
82//------------------------------------------------------------------------------
83
84void Delphes::SetTreeWriter(ExRootTreeWriter *treeWriter)
85{
86 treeWriter->SetName("TreeWriter");
87 GetFolder()->Add(treeWriter);
88}
89
90//------------------------------------------------------------------------------
91
92void Delphes::Init()
93{
94 stringstream message;
95 ExRootConfReader *confReader = GetConfReader();
96 confReader->SetName("ConfReader");
97 GetFolder()->Add(confReader);
98
99 TString name;
100 ExRootTask *task;
101 const ExRootConfReader::ExRootTaskMap *modules = confReader->GetModules();
102 ExRootConfReader::ExRootTaskMap::const_iterator itModules;
103
104 ExRootConfParam param = confReader->GetParam("::ExecutionPath");
105 Long_t i, size = param.GetSize();
106
107 gRandom->SetSeed(confReader->GetInt("::RandomSeed", 0));
108
109 for(i = 0; i < size; ++i)
110 {
111 name = param[i].GetString();
112 itModules = modules->find(name);
113 if(itModules != modules->end())
114 {
115 task = NewTask(itModules->second, itModules->first);
116 if(task)
117 {
118 task->SetFolder(GetFolder());
119 Add(task);
120 }
121 }
122 else
123 {
124 message << "module '" << name;
125 message << "' is specified in ExecutionPath but not configured.";
126 throw runtime_error(message.str());
127 }
128 }
129}
130
131//------------------------------------------------------------------------------
132
133void Delphes::Process()
134{
135}
136
137//------------------------------------------------------------------------------
138
139void Delphes::Finish()
140{
141}
142
143//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.