Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cppdefs.pxd
Go to the documentation of this file.
1 #**** This file is a part of the HAMMER library
2 #**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
3 #**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
4 #**** Please note the MCnet academic guidelines; see GUIDELINES for details
5 
6 ## \file hammerlib.pxd
7 # \brief Cython class to import classes from hammer library
8 #
9 
10 from libcpp.map cimport map
11 from libcpp.set cimport set as cset
12 from libcpp.string cimport string
13 from libcpp.pair cimport pair
14 from libcpp.vector cimport vector
15 from libcpp.unordered_map cimport unordered_map
16 from libcpp cimport bool
17 from libc.stdint cimport uintptr_t, uint32_t, uint8_t, uint16_t
18 
19 cdef extern from "<array>" namespace "std" nogil:
20  cdef cppclass array4 "std::array<double, 4>":
21  array4() except+
22  double& operator[](size_t)
23 
24  cdef cppclass array3 "std::array<double, 3>":
25  array3() except+
26  double& operator[](size_t)
27 
28 cdef extern from "Hammer/Tools/Utils.hh" namespace "Hammer":
29 
30  cdef cppclass UMap[T, U]:
31  ctypedef T key_type
32  ctypedef U mapped_type
33  ctypedef pair[const T, U] value_type
34  cppclass iterator:
35  pair[T, U]& operator*()
36  iterator operator++()
37  iterator operator--()
38  bint operator==(iterator)
39  bint operator!=(iterator)
40  cppclass reverse_iterator:
41  pair[T, U]& operator*()
42  iterator operator++()
43  iterator operator--()
44  bint operator==(reverse_iterator)
45  bint operator!=(reverse_iterator)
46  cppclass const_iterator(iterator):
47  pass
48  cppclass const_reverse_iterator(reverse_iterator):
49  pass
50  UMap() except +
51  UMap(UMap&) except +
52  #UMap(key_compare&)
53  U& operator[](T&)
54  #UMap& operator=(UMap&)
55  bint operator==(UMap&, UMap&)
56  bint operator!=(UMap&, UMap&)
57  bint operator<(UMap&, UMap&)
58  bint operator>(UMap&, UMap&)
59  bint operator<=(UMap&, UMap&)
60  bint operator>=(UMap&, UMap&)
61  U& at(const T&)
62  const U& const_at "at"(const T&)
63  iterator begin()
64  const_iterator const_begin "begin"()
65  void clear()
66  size_t count(T&)
67  bint empty()
68  iterator end()
69  const_iterator const_end "end"()
70  pair[iterator, iterator] equal_range(T&)
71  pair[const_iterator, const_iterator] const_equal_range "equal_range"(const T&)
72  iterator erase(iterator)
73  iterator erase(iterator, iterator)
74  size_t erase(T&)
75  iterator find(T&)
76  const_iterator const_find "find"(T&)
77  pair[iterator, bint] insert(pair[T, U]) # XXX pair[T,U]&
78  iterator insert(iterator, pair[T, U]) # XXX pair[T,U]&
79  iterator insert(iterator, iterator)
80  #key_compare key_comp()
81  iterator lower_bound(T&)
82  const_iterator const_lower_bound "lower_bound"(T&)
83  size_t max_size()
84  reverse_iterator rbegin()
85  const_reverse_iterator const_rbegin "rbegin"()
86  reverse_iterator rend()
87  const_reverse_iterator const_rend "rend"()
88  size_t size()
89  void swap(UMap&)
90  iterator upper_bound(T&)
91  const_iterator const_upper_bound "upper_bound"(T&)
92  #value_compare value_comp()
93  void max_load_factor(float)
94  float max_load_factor()
95  void rehash(size_t)
96  void reserve(size_t)
97  size_t bucket_count()
98  size_t max_bucket_count()
99  size_t bucket_size(size_t)
100  size_t bucket(const T&)
101 
102 cdef extern from "Hammer/Math/FourMomentum.hh" namespace "Hammer":
103 
104  ## wrapper of `Hammer::FourMomentum` class
105  cdef cppclass FourMomentum:
106  FourMomentum()
107  FourMomentum(array4)
108  FourMomentum(double, double, double, double)
109  @staticmethod
110  FourMomentum fromPtEtaPhiM(double, double, double, double)
111  @staticmethod
112  FourMomentum fromEtaPhiME(double, double, double, double) except +
113  @staticmethod
114  FourMomentum fromPM(double, double, double, double)
115  double E()
116  double px()
117  double py()
118  double pz()
119  void setE(double)
120  void setPx(double)
121  void setPy(double)
122  void setPz(double)
123  double mass() except +
124  double mass2()
125  double p()
126  double p2()
127  double pt()
128  double rapidity()
129  double phi()
130  double eta()
131  double theta()
132  array3 pVec()
133  double gamma() except +
134  double beta() except +
135  array3 boostVector() except +
136 
137 
138 cdef extern from "Hammer/Particle.hh" namespace "Hammer":
139 
140  ## wrapper of `Hammer::Particle` class
141  cdef cppclass Particle:
142  Particle()
143  Particle(FourMomentum, int)
144  Particle& setMomentum(FourMomentum)
145  Particle& setPdgId(int)
146  int pdgId()
147  FourMomentum& momentum()
148  FourMomentum& p()
149 
150 cdef extern from "Hammer/Process.hh" namespace "Hammer":
151 
152  ## wrapper of `Hammer::Process` class
153  cdef cppclass Process:
154  Process()
155  size_t addParticle(Particle)
156  void addVertex(size_t, vector[size_t])
157  void removeVertex(size_t, bool)
158  vector[size_t]& getDaughtersIds(size_t) except +
159  size_t getParentId(size_t)
160  vector[size_t]& getSiblingsIds(size_t)
161  Particle& getParticle(size_t) except +
162  vector[Particle] getDaughters(size_t, bool) except +
163  vector[Particle] getSiblings(size_t, bool)
164  Particle& getParent(size_t)
165  bool isParent(size_t)
166  size_t getFirstVertex()
167  size_t getId()
168  cset[size_t] fullId()
169  size_t getVertexId(string)
170  size_t numParticles(bool)
171 
172 cdef extern from "Hammer/Tools/Logging.hh" namespace "Hammer":
173 
174  ## wrapper of `Hammer::Log` class
175  cdef cppclass Log:
176  @staticmethod
177  void setLevel(string, int)
178  @staticmethod
179  void setLevels(map[string, int])
180  @staticmethod
181  void setShowTimestamp(bool)
182  @staticmethod
183  void setShowLevel(bool)
184  @staticmethod
185  void setShowLoggerName(bool)
186  @staticmethod
187  void setUseColors(bool)
188  @staticmethod
189  void setWarningMaxCount(string, int)
190  @staticmethod
191  void resetWarningCounters()
192 
193 
194 cdef extern from "Hammer/Tools/Utils.hh" namespace "Hammer":
195  string version()
196 
197 cdef extern from "Hammer/Tools/IOTypes.hh" namespace "Hammer":
198 
199  ## wrapper of `Hammer::IOBuffer` struct
200  cdef cppclass IOBuffer:
201  char kind
202  uint32_t length
203  uint8_t* start
204 
205  ## wrapper of `Hammer::BinContents` struct
206  cdef cppclass BinContents:
207  double sumWi
208  double sumWi2
209  size_t n
210 
211  ctypedef enum RecordType:
212  UNDEFINED = b'u'
213  HEADER = b'b'
214  EVENT = b'e'
215  HISTOGRAM = b'h'
216  RATE = b'r'
217  HISTOGRAM_DEFINITION = b'd'
218 
219  ## wrapper of `Hammer::IOBuffers` class
220  cdef cppclass IOBuffers:
221  IOBuffers() except +
222  IOBuffers(IOBuffers&&) except +
223  cppclass iterator:
224  IOBuffer operator*()
225  iterator operator++()
226  bint operator==(iterator)
227  bint operator!=(iterator)
228  iterator begin()
229  iterator end()
230  IOBuffer& at(size_t)
231  IOBuffer& front()
232  IOBuffer& back()
233  size_t size()
234  bool empty()
235  void clear()
236 
237  ## wrapper of `Hammer::HistoInfo` struct
238  cdef cppclass HistoInfo:
239  string name
240  string scheme
241  cset[cset[size_t]] eventGroupId
242 
243 
244 cdef extern from "Hammer/IndexTypes.hh" namespace "Hammer":
245 
246  ## wrapper of `Hammer::WTerm` enum class
247  ctypedef enum WTerm:
251 
252 cdef extern from "Hammer/Hammer.hh" namespace "Hammer":
253 
254  ## wrapper of `Hammer::Hammer` class
255  cdef cppclass Hammer:
256  Hammer() except +
257  void initRun()
258  void initEvent(double)
259  size_t addProcess(Process)
260  void removeProcess(size_t)
261  void setEventHistogramBin(string, vector[uint16_t])
262  void fillEventHistogram(string, vector[double])
263  void setEventBaseWeight(double)
264  void processEvent()
265  bool loadEventWeights(IOBuffer, bool)
266  IOBuffer saveEventWeights()
267  bool loadRunHeader(IOBuffer, bool)
268  IOBuffer saveRunHeader()
269  string loadHistogramDefinition(IOBuffer, bool)
270  HistoInfo loadHistogram(IOBuffer, bool)
271  IOBuffers saveHistogram(HistoInfo)
272  IOBuffers saveHistogram(string)
273  IOBuffers saveHistogram(string, string)
274  IOBuffers saveHistogram(string, cset[cset[size_t]])
275  IOBuffers saveHistogram(string, string, cset[cset[size_t]])
276  bool loadRates(IOBuffer, bool)
277  IOBuffer saveRates()
278  void readCards(string, string)
279  void saveOptionCard(string, bool)
280  void saveHeaderCard(string)
281  void saveReferences(string)
282  void setOptions(string)
283  void setHeader(string)
284  void addTotalSumOfWeights(bool, bool)
285  void addHistogram(string, vector[uint16_t], bool, vector[pair[double, double]])
286  void addHistogram(string, vector[vector[double]], bool)
287  void collapseProcessesInHistogram(string)
288  void keepErrorsInHistogram(string, bool)
289  void specializeWCInWeights(string, vector[double complex])
290  void specializeWCInWeights(string, map[string, double complex])
291  void specializeWCInHistogram(string, string, vector[double complex])
292  void resetSpecializeWCInWeights(string)
293  void specializeWCInHistogram(string, string, map[string, double complex])
294  void specializeFFInHistogram(string, string, string, vector[double])
295  void specializeFFInHistogram(string, string, string, map[string, double])
296  void resetSpecializationInHistogram(string)
297  void createProjectedHistogram(string, string, cset[uint16_t])
298  void removeHistogram(string)
299  void addFFScheme(string, map[string, string])
300  void setFFInputScheme(map[string, string])
301  vector[string] getFFSchemeNames()
302  void includeDecay(vector[string])
303  void includeDecay(string)
304  void forbidDecay(vector[string])
305  void forbidDecay(string)
306  void addPurePSVertices(cset[string], WTerm)
307  void clearPurePSVertices(WTerm)
308  void setUnits(string)
309  void setWilsonCoefficients(string, vector[double complex], WTerm)
310  void setWilsonCoefficients(string, map[string, double complex], WTerm)
311  void setWilsonCoefficientsLocal(string, vector[double complex])
312  void setWilsonCoefficientsLocal(string, map[string, double complex])
313  void resetWilsonCoefficients(string, WTerm)
314  void setFFEigenvectors(string, string, vector[double])
315  void setFFEigenvectors(string, string, map[string, double])
316  void setFFEigenvectorsLocal(string, string, vector[double])
317  void setFFEigenvectorsLocal(string, string, map[string, double])
318  void resetFFEigenvectors(string, string)
319  double getWeight(string, vector[size_t])
320  double getWeight(string, vector[vector[string]])
321  map[size_t, double] getWeights(string)
322  double getRate(size_t, string)
323  double getRate(int, vector[int], string)
324  double getRate(string, string)
325  double getDenominatorRate(size_t)
326  double getDenominatorRate(int, vector[int])
327  double getDenominatorRate(string)
328  vector[BinContents] getHistogram(string, string)
329  UMap[cset[cset[size_t]], vector[BinContents]] getHistograms(string, string)
330  cset[cset[size_t]] getHistogramEventIds(string, string)
331  vector[uint16_t] getHistogramShape(string)
332  vector[vector[double]] getHistogramBinEdges(string)
333  bool histogramHasUnderOverFlows(string)
std::string version()
Definition: Tools/Utils.hh:34
from libcpp map cimport map from libcpp set cimport set as cset from libcpp string cimport string from libcpp pair cimport pair from libcpp vector cimport vector from libcpp unordered_map cimport unordered_map from libcpp cimport bool from libc stdint cimport uint32_t
Definition: cppdefs.pxd:17
std::unordered_map< K, V, boost::hash< K >> UMap
Definition: Tools/Utils.hh:104
RecordType
Definition: IOTypes.hh:30
auto begin(reversion_wrapper< T > w)
Definition: Tools/Utils.hh:79
from libcpp map cimport map from libcpp set cimport set as cset from libcpp string cimport string from libcpp pair cimport pair from libcpp vector cimport vector from libcpp unordered_map cimport unordered_map from libcpp cimport bool from libc stdint cimport uintptr_t
Definition: cppdefs.pxd:17
from libcpp map cimport map from libcpp set cimport set as cset from libcpp string cimport string from libcpp pair cimport pair from libcpp vector cimport vector from libcpp unordered_map cimport unordered_map from libcpp cimport bool from libc stdint cimport uint8_t
Definition: cppdefs.pxd:17
auto end(reversion_wrapper< T > w)
Definition: Tools/Utils.hh:84