Fork me on GitHub

source: git/classes/DelphesModule.cc@ 0f5bf9d

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 0f5bf9d 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
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
20/** \class DelphesModule
21 *
22 * Base class for all Delphes modules
23 *
24 * \author P. Demin - UCL, Louvain-la-Neuve
25 *
26 */
27
28#include "classes/DelphesModule.h"
29
30#include "classes/DelphesFactory.h"
31
32#include "ExRootAnalysis/ExRootTreeReader.h"
33#include "ExRootAnalysis/ExRootTreeBranch.h"
34#include "ExRootAnalysis/ExRootTreeWriter.h"
35#include "ExRootAnalysis/ExRootResult.h"
36
37#include "TROOT.h"
38#include "TClass.h"
39#include "TFolder.h"
40#include "TObjArray.h"
41
42#include <iostream>
43#include <stdexcept>
44#include <sstream>
45
46using namespace std;
47
48DelphesModule::DelphesModule() :
49 fTreeWriter(0), fFactory(0), fPlots(0),
50 fPlotFolder(0), fExportFolder(0)
51{
52}
53
54//------------------------------------------------------------------------------
55
56DelphesModule::~DelphesModule()
57{
58}
59
60//------------------------------------------------------------------------------
61
62void DelphesModule::Init()
63{
64}
65
66//------------------------------------------------------------------------------
67
68void DelphesModule::Process()
69{
70}
71
72//------------------------------------------------------------------------------
73
74void DelphesModule::Finish()
75{
76}
77
78//------------------------------------------------------------------------------
79
80TObjArray *DelphesModule::ImportArray(const char *name)
81{
82 stringstream message;
83 TObjArray *object;
84
85 object = static_cast<TObjArray *>(GetObject(Form("Export/%s", name), TObjArray::Class()));
86 if(!object)
87 {
88 message << "can't access input list '" << name;
89 message << "' in module '" << GetName() << "'";
90 throw runtime_error(message.str());
91 }
92
93 return object;
94}
95
96//------------------------------------------------------------------------------
97
98TObjArray *DelphesModule::ExportArray(const char *name)
99{
100 TObjArray *array;
101 if(!fExportFolder)
102 {
103 fExportFolder = NewFolder("Export");
104 }
105
106 array = GetFactory()->NewPermanentArray();
107
108 array->SetName(name);
109 fExportFolder->Add(array);
110
111 return array;
112}
113
114//------------------------------------------------------------------------------
115
116ExRootTreeBranch *DelphesModule::NewBranch(const char *name, TClass *cl)
117{
118 stringstream message;
119 if(!fTreeWriter)
120 {
121 fTreeWriter = static_cast<ExRootTreeWriter *>(GetObject("TreeWriter", ExRootTreeWriter::Class()));
122 if(!fTreeWriter)
123 {
124 message << "can't access access tree writer";
125 throw runtime_error(message.str());
126 }
127 }
128 return fTreeWriter->NewBranch(name, cl);
129}
130
131//------------------------------------------------------------------------------
132
133ExRootResult *DelphesModule::GetPlots()
134{
135 if(!fPlots)
136 {
137 fPlots = new ExRootResult();
138 fPlots->SetFolder(GetFolder());
139 }
140 return fPlots;
141}
142
143//------------------------------------------------------------------------------
144
145DelphesFactory *DelphesModule::GetFactory()
146{
147 stringstream message;
148 if(!fFactory)
149 {
150 fFactory = static_cast<DelphesFactory *>(GetObject("ObjectFactory", DelphesFactory::Class()));
151 if(!fFactory)
152 {
153 message << "can't access access object factory";
154 throw runtime_error(message.str());
155 }
156 }
157 return fFactory;
158}
159
160
Note: See TracBrowser for help on using the repository browser.