Fork me on GitHub

source: git/modules/Delphes.cc@ 7c66174

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

remove svn tags and fix formatting

  • Property mode set to 100644
File size: 3.8 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 * \author P. Demin - UCL, Louvain-la-Neuve
26 *
27 */
28
29#include "modules/Delphes.h"
30
31#include "classes/DelphesClasses.h"
32#include "classes/DelphesFactory.h"
33#include "classes/DelphesFormula.h"
34
35#include "ExRootAnalysis/ExRootResult.h"
36#include "ExRootAnalysis/ExRootFilter.h"
37#include "ExRootAnalysis/ExRootClassifier.h"
38#include "ExRootAnalysis/ExRootConfReader.h"
39#include "ExRootAnalysis/ExRootTreeWriter.h"
40
41#include "TROOT.h"
42#include "TMath.h"
43#include "TFolder.h"
44#include "TString.h"
45#include "TFormula.h"
46#include "TRandom3.h"
47#include "TObjArray.h"
48#include "TDatabasePDG.h"
49#include "TLorentzVector.h"
50
51#include <algorithm>
52#include <stdexcept>
53#include <iostream>
54#include <sstream>
55
56#include <string.h>
57#include <stdio.h>
58
59using namespace std;
60
61Delphes::Delphes(const char *name) :
62 fFactory(0)
63{
64 TFolder *folder = new TFolder(name, "");
65 fFactory = new DelphesFactory("ObjectFactory");
66
67 SetName(name);
68 SetFolder(folder);
69
70 folder->Add(this);
71 folder->Add(fFactory);
72
73 gROOT->GetListOfBrowsables()->Add(folder);
74}
75
76//------------------------------------------------------------------------------
77
78Delphes::~Delphes()
79{
80 if(fFactory) delete fFactory;
81 TFolder *folder = GetFolder();
82 if(folder)
83 {
84 folder->Clear();
85 delete folder;
86 }
87}
88
89//------------------------------------------------------------------------------
90
91void Delphes::Clear()
92{
93 if(fFactory) fFactory->Clear();
94}
95
96//------------------------------------------------------------------------------
97
98void Delphes::SetTreeWriter(ExRootTreeWriter *treeWriter)
99{
100 treeWriter->SetName("TreeWriter");
101 GetFolder()->Add(treeWriter);
102}
103
104//------------------------------------------------------------------------------
105
106void Delphes::Init()
107{
108 stringstream message;
109 ExRootConfReader *confReader = GetConfReader();
110 confReader->SetName("ConfReader");
111 GetFolder()->Add(confReader);
112
113 TString name;
114 ExRootTask *task;
115 const ExRootConfReader::ExRootTaskMap *modules = confReader->GetModules();
116 ExRootConfReader::ExRootTaskMap::const_iterator itModules;
117
118 ExRootConfParam param = confReader->GetParam("::ExecutionPath");
119 Long_t i, size = param.GetSize();
120
121 gRandom->SetSeed(confReader->GetInt("::RandomSeed", 0));
122
123 for(i = 0; i < size; ++i)
124 {
125 name = param[i].GetString();
126 itModules = modules->find(name);
127 if(itModules != modules->end())
128 {
129 task = NewTask(itModules->second, itModules->first);
130 if(task)
131 {
132 task->SetFolder(GetFolder());
133 Add(task);
134 }
135 }
136 else
137 {
138 message << "module '" << name;
139 message << "' is specified in ExecutionPath but not configured.";
140 throw runtime_error(message.str());
141 }
142 }
143}
144
145//------------------------------------------------------------------------------
146
147void Delphes::Process()
148{
149}
150
151//------------------------------------------------------------------------------
152
153void Delphes::Finish()
154{
155}
156
157//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.