Fork me on GitHub

source: git/modules/Delphes.cc@ 190cfa0

ImprovedOutputFile Timing
Last change on this file since 190cfa0 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
RevLine 
[b443089]1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
[1fa50c2]4 *
[b443089]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.
[1fa50c2]9 *
[b443089]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.
[1fa50c2]14 *
[b443089]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
[d7d2da3]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"
[341014c]36#include "ExRootAnalysis/ExRootFilter.h"
37#include "ExRootAnalysis/ExRootResult.h"
[d7d2da3]38#include "ExRootAnalysis/ExRootTreeWriter.h"
39
[341014c]40#include "TDatabasePDG.h"
[d7d2da3]41#include "TFolder.h"
42#include "TFormula.h"
43#include "TLorentzVector.h"
[341014c]44#include "TMath.h"
45#include "TObjArray.h"
46#include "TROOT.h"
47#include "TRandom3.h"
48#include "TString.h"
[d7d2da3]49
[341014c]50#include <algorithm>
[d7d2da3]51#include <iostream>
52#include <sstream>
[341014c]53#include <stdexcept>
[d7d2da3]54
55#include <stdio.h>
[341014c]56#include <string.h>
[d7d2da3]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 }
[2fedc72]85 if(fFactory) delete fFactory;
[d7d2da3]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
[4a9ec82]120 gRandom->SetSeed(confReader->GetInt("::RandomSeed", 0));
121
[d7d2da3]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.