1
by Eric Conte
new entry |
1 |
////////////////////////////////////////////////////////////////////////////////
|
2 |
//
|
|
106
by Benjamin Fuks
Release of v1.3 |
3 |
// Copyright (C) 2012-2016 Eric Conte, Benjamin Fuks
|
1
by Eric Conte
new entry |
4 |
// The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
|
5 |
//
|
|
6 |
// This file is part of MadAnalysis 5.
|
|
45
by Eric Conte
changing the header |
7 |
// Official website: <https://launchpad.net/madanalysis5>
|
1
by Eric Conte
new entry |
8 |
//
|
9 |
// MadAnalysis 5 is free software: you can redistribute it and/or modify
|
|
10 |
// it under the terms of the GNU General Public License as published by
|
|
11 |
// the Free Software Foundation, either version 3 of the License, or
|
|
12 |
// (at your option) any later version.
|
|
13 |
//
|
|
14 |
// MadAnalysis 5 is distributed in the hope that it will be useful,
|
|
15 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 |
// GNU General Public License for more details.
|
|
18 |
//
|
|
19 |
// You should have received a copy of the GNU General Public License
|
|
20 |
// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
|
|
21 |
//
|
|
22 |
////////////////////////////////////////////////////////////////////////////////
|
|
23 |
||
24 |
||
25 |
#ifndef SAMPLE_DATAFORMAT_H
|
|
26 |
#define SAMPLE_DATAFORMAT_H
|
|
27 |
||
115.1.32
by Eric Conte
tune headers of h files |
28 |
|
1
by Eric Conte
new entry |
29 |
// STL headers
|
30 |
#include <map> |
|
31 |
#include <iostream> |
|
32 |
#include <vector> |
|
33 |
||
34 |
// SampleAnalyzer headers
|
|
72.1.29
by Eric Conte
new compilation structure |
35 |
#include "SampleAnalyzer/Commons/DataFormat/GeneratorInfo.h" |
36 |
#include "SampleAnalyzer/Commons/DataFormat/MCSampleFormat.h" |
|
37 |
#include "SampleAnalyzer/Commons/DataFormat/RecSampleFormat.h" |
|
38 |
#include "SampleAnalyzer/Commons/Service/LogService.h" |
|
112.1.40
by Eric Conte
fix bug with boost + exception |
39 |
#include "SampleAnalyzer/Commons/Service/ExceptionService.h" |
1
by Eric Conte
new entry |
40 |
|
115.1.32
by Eric Conte
tune headers of h files |
41 |
|
1
by Eric Conte
new entry |
42 |
namespace MA5 |
43 |
{
|
|
44 |
||
45 |
class LHEReader; |
|
46 |
class LHCOReader; |
|
47 |
class HEPMCReader; |
|
48 |
class SampleAnalyzer; |
|
49 |
||
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
50 |
|
1
by Eric Conte
new entry |
51 |
class SampleFormat |
52 |
{
|
|
53 |
friend class LHEReader; |
|
54 |
friend class LHCOReader; |
|
55 |
friend class SampleAnalyzer; |
|
56 |
||
57 |
// -------------------------------------------------------------
|
|
58 |
// data members
|
|
59 |
// -------------------------------------------------------------
|
|
60 |
private: |
|
61 |
||
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
62 |
std::string name_; /// file name |
115.1.60
by Eric Conte
add first version of Delphes checker |
63 |
MAuint64 nevents_; /// number of events in the file |
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
64 |
MCSampleFormat * mc_; |
65 |
RecSampleFormat * rec_; |
|
66 |
MA5GEN::GeneratorType sample_generator_; |
|
67 |
MA5FORMAT::SampleFormatType sample_format_; |
|
68 |
std::vector<std::string> header_; /// file header |
|
1
by Eric Conte
new entry |
69 |
|
70 |
||
71 |
// -------------------------------------------------------------
|
|
72 |
// method members
|
|
73 |
// -------------------------------------------------------------
|
|
74 |
public : |
|
75 |
||
76 |
/// Constructor withtout arguments
|
|
77 |
SampleFormat() |
|
78 |
{
|
|
79 |
rec_=0; |
|
80 |
mc_=0; |
|
81 |
nevents_=0; |
|
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
82 |
sample_generator_ = MA5GEN::UNKNOWN; |
83 |
sample_format_ = MA5FORMAT::UNKNOWN; |
|
84 |
header_.clear(); |
|
1
by Eric Conte
new entry |
85 |
}
|
86 |
||
87 |
/// Destructor
|
|
88 |
~SampleFormat() |
|
89 |
{
|
|
90 |
}
|
|
91 |
||
92 |
/// Accessor to Monte Carlo information (read-only)
|
|
93 |
const MCSampleFormat * mc() const |
|
94 |
{ return mc_; } |
|
95 |
||
96 |
/// Accessor to reconstruction information (read-only)
|
|
97 |
const RecSampleFormat * rec() const |
|
98 |
{ return rec_; } |
|
99 |
||
100 |
/// Accessor to Monte Carlo information
|
|
101 |
MCSampleFormat * mc() |
|
102 |
{ return mc_; } |
|
103 |
||
104 |
/// Accessor to reconstruction information
|
|
105 |
RecSampleFormat * rec() |
|
106 |
{ return rec_; } |
|
107 |
||
108 |
/// Accessor to the sample name
|
|
109 |
const std::string& name() const |
|
110 |
{ return name_; } |
|
111 |
||
112 |
/// Accessor to the number of events
|
|
109.1.45
by Eric Conte
no more Root first step |
113 |
const MAuint64& nevents() const |
1
by Eric Conte
new entry |
114 |
{ return nevents_; } |
115 |
||
116 |
/// Set the sample name
|
|
117 |
void setName(const std::string& name) |
|
118 |
{name_=name;} |
|
119 |
||
120 |
/// Set the number of events in the sample
|
|
109.1.45
by Eric Conte
no more Root first step |
121 |
void setNEvents(MAuint64 v) |
1
by Eric Conte
new entry |
122 |
{nevents_=v;} |
123 |
||
124 |
/// Initialize MonteCarlo part
|
|
125 |
void InitializeMC() |
|
126 |
{
|
|
112.1.40
by Eric Conte
fix bug with boost + exception |
127 |
try
|
1
by Eric Conte
new entry |
128 |
{
|
112.1.40
by Eric Conte
fix bug with boost + exception |
129 |
if (mc_!=0) throw EXCEPTION_WARNING("MC part of the SampleFormat is already initialized.","",0); |
130 |
mc_=new MCSampleFormat(&sample_generator_); |
|
1
by Eric Conte
new entry |
131 |
}
|
112.1.40
by Eric Conte
fix bug with boost + exception |
132 |
catch(const std::exception& e) |
133 |
{
|
|
134 |
MANAGE_EXCEPTION(e); |
|
135 |
}
|
|
1
by Eric Conte
new entry |
136 |
}
|
137 |
||
138 |
/// Initialize Rec part
|
|
139 |
void InitializeRec() |
|
140 |
{
|
|
112.1.40
by Eric Conte
fix bug with boost + exception |
141 |
try
|
1
by Eric Conte
new entry |
142 |
{
|
112.1.40
by Eric Conte
fix bug with boost + exception |
143 |
if (rec_!=0) throw EXCEPTION_WARNING("REC part of the SampleFormat is already initialized.","",0); |
144 |
rec_=new RecSampleFormat(); |
|
1
by Eric Conte
new entry |
145 |
}
|
112.1.40
by Eric Conte
fix bug with boost + exception |
146 |
catch(const std::exception& e) |
147 |
{
|
|
148 |
MANAGE_EXCEPTION(e); |
|
149 |
}
|
|
1
by Eric Conte
new entry |
150 |
}
|
151 |
||
152 |
/// Free allocates memory
|
|
153 |
void Delete() |
|
154 |
{
|
|
155 |
if (rec_!=0) delete rec_; |
|
156 |
if (mc_!=0) delete mc_; |
|
157 |
}
|
|
158 |
||
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
159 |
/// Set the Generator Format
|
160 |
void SetSampleGenerator(MA5GEN::GeneratorType value) |
|
161 |
{ sample_generator_ = value; } |
|
162 |
||
163 |
/// Set the Sample Format
|
|
164 |
void SetSampleFormat(MA5FORMAT::SampleFormatType value) |
|
165 |
{ sample_format_ = value; } |
|
166 |
||
167 |
/// Accessor to the Generator Format
|
|
168 |
const MA5GEN::GeneratorType& sampleGenerator() const |
|
169 |
{ return sample_generator_; } |
|
170 |
||
171 |
/// Accessor to the Sample Format
|
|
172 |
const MA5FORMAT::SampleFormatType& sampleFormat() const |
|
173 |
{ return sample_format_; } |
|
174 |
||
175 |
/// Displaying subtitle for file
|
|
176 |
void printSubtitle() const |
|
177 |
{
|
|
178 |
// Sample format
|
|
179 |
INFO << " => sample format: "; |
|
180 |
if (sample_format_==MA5FORMAT::UNKNOWN) INFO << "unknown-format"; |
|
181 |
else if (sample_format_==MA5FORMAT::LHE) INFO << "LHE"; |
|
182 |
else if (sample_format_==MA5FORMAT::SIMPLIFIED_LHE) INFO << "simplified LHE"; |
|
183 |
else if (sample_format_==MA5FORMAT::STDHEP) INFO << "STDHEP"; |
|
184 |
else if (sample_format_==MA5FORMAT::HEPMC) INFO << "HEPMC"; |
|
185 |
else if (sample_format_==MA5FORMAT::LHCO) INFO << "LHCO"; |
|
70.1.3
by econte at cern
adding hacked release of Delphes: delfes |
186 |
else if (sample_format_==MA5FORMAT::DELPHES) INFO << "Delphes-ROOT"; |
72.1.9
by Eric Conte
debug mode complete + system folder + renaming Delfes -> Delphes-MA5tune |
187 |
else if (sample_format_==MA5FORMAT::DELPHESMA5TUNE) INFO << "Delphes-MA5tune ROOT"; |
84.1.41
by Eric Conte
adding new Delphes reader + MA5card |
188 |
else if (sample_format_==MA5FORMAT::DELPHESMA5CARD) INFO << "Delphes-ROOT"; |
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
189 |
INFO << " file produced by "; |
190 |
||
191 |
// Generator
|
|
192 |
if (sample_generator_==MA5GEN::UNKNOWN) |
|
193 |
INFO << "an unknown generator " |
|
194 |
<< "(cross section assumed in pb)"; |
|
195 |
else if (sample_generator_==MA5GEN::MG5) INFO << "MadGraph5"; |
|
196 |
else if (sample_generator_==MA5GEN::MA5) INFO << "MadAnalysi5"; |
|
197 |
else if (sample_generator_==MA5GEN::PYTHIA6) INFO << "Pythia6"; |
|
198 |
else if (sample_generator_==MA5GEN::PYTHIA8) INFO << "Pythia8"; |
|
199 |
else if (sample_generator_==MA5GEN::HERWIG6) INFO << "Herwig6"; |
|
200 |
else if (sample_generator_==MA5GEN::HERWIGPP) INFO << "Herwig++"; |
|
201 |
else if (sample_generator_==MA5GEN::DELPHES) INFO << "Delphes"; |
|
72.1.9
by Eric Conte
debug mode complete + system folder + renaming Delfes -> Delphes-MA5tune |
202 |
else if (sample_generator_==MA5GEN::DELPHESMA5TUNE) INFO << "Delphes-MA5tune"; |
84.1.41
by Eric Conte
adding new Delphes reader + MA5card |
203 |
else if (sample_generator_==MA5GEN::DELPHESMA5CARD) INFO << "Delphes + MA5tuned-cards"; |
70.1.22
by Eric Conte
adding delfes card with PileUp |
204 |
else if (sample_generator_==MA5GEN::CALCHEP) INFO << "CalcHEP"; |
62.1.22
by Eric Conte
1. fixing pb with mother-daughter relation in simplified LHE (again) ... |
205 |
INFO << "." << endmsg; |
206 |
}
|
|
207 |
||
208 |
/// Accessor to the header
|
|
209 |
const std::vector<std::string>& header() const |
|
210 |
{ return header_; } |
|
211 |
||
212 |
/// Mutator relative to the header
|
|
213 |
void AddHeader(const std::string& line) |
|
214 |
{ header_.push_back(line); } |
|
215 |
||
216 |
||
1
by Eric Conte
new entry |
217 |
};
|
218 |
||
219 |
}
|
|
220 |
||
221 |
#endif
|