Skip to content

Commit 77aecd9

Browse files
Update gallerySetup.md to document v10
1 parent 70e11f3 commit 77aecd9

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

icaruscode_wiki/interfaces/python/gallerySetup.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Example
9898
--------
9999

100100
Assuming that the current area is already set up as described above,
101-
access to _art_/ROOT files can be achieved via `galleryUtils` module (provided in `icarusalg`).
101+
access to _art_/ROOT files can be achieved via `galleryUtils` module (provided by `sbnalg` from `v10` on, and before by `icarusalg`).
102102

103103
In an interactive `python` session (or equivalent),
104104
```py
@@ -116,7 +116,7 @@ LArG4tag = ROOT.art.InputTag("largeant")
116116

117117
for event in galleryUtils.forEach(sampleEvents):
118118

119-
particles = event.getValidHandle[ROOT.std.vector[ROOT.simb.MCParticle]](LArG4tag).product()
119+
particles = event.getProduct[ROOT.std.vector[ROOT.simb.MCParticle]](LArG4tag)
120120

121121
nMuons = sum(abs(part.PdgCode()) == 13 for part in particles)
122122
print(f"{event.eventAuxiliary().id()}: {nMuons} muons")
@@ -147,20 +147,22 @@ Known limitations
147147

148148
_gallery_ suffers some limitations compared to _art_:
149149
* it is not able to access `art::Run` and `art::SubRun` data products, but only `art::Event` ones.
150-
* its interface is behind compared to `art::Event`; for example, it does not yet support `art::Event::getProduct()`.
150+
* its interface is behind compared to `art::Event`.
151151

152152
`cppyy` also suffers severe limitations.
153153
* overload resolution is tricky; apparently `cppyy` attempts to call all the possible functions/methods with the same name
154154
in the attempt to figure out which one is the correct one, and captures the exceptions from errors.
155155
* The error message when failing to find the appropriate function is usually of not much use.
156-
* If the call itself throws an exception, it may be impossible to access it in Python.
156+
* If the call itself throws an exception, it may be impossible to access that exception in Python.
157+
* some template calls do not work (e.g. `for TPC in geom.Iterate[ROOT.geo.TPCGeo]():` does not iterate anything).
157158

158159

159160
Other resources
160161
----------------
161162

162163
A guide [SBN DocDB 4339](https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=4339), by now ancient,
163164
describes how to use _gallery_ in C++.
165+
An working example is [`galleryAnalysis.cpp`](https://github.com/SBNSoftware/icarusalg/blob/develop/icarusalg/gallery/examples/galleryAnalysis/C%2B%2B/galleryAnalysis.cpp) in `icarusalg` `v10_04_07`.
164166
Compared to using Python, C++ requires a careful and sometimes painstaking compilation of building instructions (e.g. Cmake);
165167
a middle ground is the use of ROOT interpreter (Cling), which does for C++ a good deal of the magic that `cppyy` does for Python.
166168

0 commit comments

Comments
 (0)