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