Fork me on GitHub

source: git/classes/DelphesFactory.cc@ e57c062

ImprovedOutputFile Timing dual_readout llp
Last change on this file since e57c062 was 0ccf6fd, checked in by Pavel Demin <pavel.demin@…>, 8 years ago

fix arguments in DelphesFactory::Clear()

  • Property mode set to 100644
File size: 3.3 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
20/** \class DelphesFactory
21 *
22 * Class handling creation of Candidate,
23 * TObjArray and all other objects.
24 *
25 * \author P. Demin - UCL, Louvain-la-Neuve
26 *
27 */
28
29#include "classes/DelphesFactory.h"
30#include "classes/DelphesClasses.h"
31
32#include "ExRootAnalysis/ExRootTreeBranch.h"
33
34#include "TClass.h"
35#include "TObjArray.h"
36
37using namespace std;
38
39//------------------------------------------------------------------------------
40
41DelphesFactory::DelphesFactory(const char *name) :
42 TNamed(name, ""), fObjArrays(0)
43{
44 fObjArrays = new ExRootTreeBranch("PermanentObjArrays", TObjArray::Class(), 0);
45}
46
47//------------------------------------------------------------------------------
48
49DelphesFactory::~DelphesFactory()
50{
51 if(fObjArrays) delete fObjArrays;
52
53 map< const TClass*, ExRootTreeBranch* >::iterator itBranches;
54 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches)
55 {
56 delete (itBranches->second);
57 }
58}
59
60//------------------------------------------------------------------------------
61
62void DelphesFactory::Clear(Option_t* option)
63{
64 set<TObject *>::iterator itPool;
65 for(itPool = fPool.begin(); itPool != fPool.end(); ++itPool)
66 {
67 (*itPool)->Clear();
68 }
69
70 TProcessID::SetObjectCount(0);
71
72 map< const TClass*, ExRootTreeBranch* >::iterator itBranches;
73 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches)
74 {
75 itBranches->second->Clear();
76 }
77}
78
79//------------------------------------------------------------------------------
80
81TObjArray *DelphesFactory::NewPermanentArray()
82{
83 TObjArray *array = static_cast<TObjArray *>(fObjArrays->NewEntry());
84 fPool.insert(array);
85 return array;
86}
87
88//------------------------------------------------------------------------------
89
90Candidate *DelphesFactory::NewCandidate()
91{
92 Candidate *object = New<Candidate>();
93 object->SetFactory(this);
94 TProcessID::AssignID(object);
95 return object;
96}
97
98//------------------------------------------------------------------------------
99
100TObject *DelphesFactory::New(TClass *cl)
101{
102 TObject *object = 0;
103 ExRootTreeBranch *branch = 0;
104 map<const TClass *, ExRootTreeBranch *>::iterator it = fBranches.find(cl);
105
106 if(it != fBranches.end())
107 {
108 branch = it->second;
109 }
110 else
111 {
112 branch = new ExRootTreeBranch(cl->GetName(), cl, 0);
113 fBranches.insert(make_pair(cl, branch));
114 }
115
116 object = branch->NewEntry();
117 object->Clear();
118 return object;
119}
120
121//------------------------------------------------------------------------------
122
Note: See TracBrowser for help on using the repository browser.