Fork me on GitHub

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

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