Fork me on GitHub

source: git/modules/Delphes.cc@ 6182516

ImprovedOutputFile Timing
Last change on this file since 6182516 was 341014c, checked in by Pavel Demin <pavel-demin@…>, 6 years ago

apply .clang-format to all .h, .cc and .cpp files

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