Fork me on GitHub

source: git/modules/Delphes.cc@ 1fa50c2

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 1fa50c2 was 1fa50c2, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

fix GPLv3 header

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20/** \class Delphes
21 *
22 * Main Delphes module.
23 * Controls execution of all other modules.
24 *
25 * $Date$
26 * $Revision$
27 *
28 *
29 * \author P. Demin - UCL, Louvain-la-Neuve
30 *
31 */
32
33#include "modules/Delphes.h"
34
35#include "classes/DelphesClasses.h"
36#include "classes/DelphesFactory.h"
37#include "classes/DelphesFormula.h"
38
39#include "ExRootAnalysis/ExRootResult.h"
40#include "ExRootAnalysis/ExRootFilter.h"
41#include "ExRootAnalysis/ExRootClassifier.h"
42#include "ExRootAnalysis/ExRootConfReader.h"
43#include "ExRootAnalysis/ExRootTreeWriter.h"
44
45#include "TROOT.h"
46#include "TMath.h"
47#include "TFolder.h"
48#include "TString.h"
49#include "TFormula.h"
50#include "TRandom3.h"
51#include "TObjArray.h"
52#include "TDatabasePDG.h"
53#include "TLorentzVector.h"
54
55#include <algorithm>
56#include <stdexcept>
57#include <iostream>
58#include <sstream>
59
60#include <string.h>
61#include <stdio.h>
62
63using namespace std;
64
65Delphes::Delphes(const char *name) :
66 fFactory(0)
67{
68 TFolder *folder = new TFolder(name, "");
69 fFactory = new DelphesFactory("ObjectFactory");
70
71 SetName(name);
72 SetFolder(folder);
73
74 folder->Add(this);
75 folder->Add(fFactory);
76
77 gROOT->GetListOfBrowsables()->Add(folder);
78}
79
80//------------------------------------------------------------------------------
81
82Delphes::~Delphes()
83{
84 if(fFactory) delete fFactory;
85 TFolder *folder = GetFolder();
86 if(folder)
87 {
88 folder->Clear();
89 delete folder;
90 }
91}
92
93//------------------------------------------------------------------------------
94
95void Delphes::Clear()
96{
97 if(fFactory) fFactory->Clear();
98}
99
100//------------------------------------------------------------------------------
101
102void Delphes::SetTreeWriter(ExRootTreeWriter *treeWriter)
103{
104 treeWriter->SetName("TreeWriter");
105 GetFolder()->Add(treeWriter);
106}
107
108//------------------------------------------------------------------------------
109
110void Delphes::Init()
111{
112 stringstream message;
113 ExRootConfReader *confReader = GetConfReader();
114 confReader->SetName("ConfReader");
115 GetFolder()->Add(confReader);
116
117 TString name;
118 ExRootTask *task;
119 const ExRootConfReader::ExRootTaskMap *modules = confReader->GetModules();
120 ExRootConfReader::ExRootTaskMap::const_iterator itModules;
121
122 ExRootConfParam param = confReader->GetParam("::ExecutionPath");
123 Long_t i, size = param.GetSize();
124
125 gRandom->SetSeed(confReader->GetInt("::RandomSeed", 0));
126
127 for(i = 0; i < size; ++i)
128 {
129 name = param[i].GetString();
130 itModules = modules->find(name);
131 if(itModules != modules->end())
132 {
133 task = NewTask(itModules->second, itModules->first);
134 if(task)
135 {
136 task->SetFolder(GetFolder());
137 Add(task);
138 }
139 }
140 else
141 {
142 message << "module '" << name;
143 message << "' is specified in ExecutionPath but not configured.";
144 throw runtime_error(message.str());
145 }
146 }
147}
148
149//------------------------------------------------------------------------------
150
151void Delphes::Process()
152{
153}
154
155//------------------------------------------------------------------------------
156
157void Delphes::Finish()
158{
159}
160
161//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.