FindMaker.h
Go to the documentation of this file.
1 #ifndef gallery_FindMaker_h
2 #define gallery_FindMaker_h
3 
4 // The primary reason for this class's existence is that I failed
5 // when I tried to call the FindOne contructor directly from pyROOT
6 // because of all the template complexities. (It might be possible
7 // and I just failed to find the correct insanely complex incantation ...)
8 // In pyROOT, it is much easier to call the functions defined below
9 // to construct a FindOne object and that is what makes them useful.
10 
11 // This class is also needed for ROOT scripts using FindOne. Even if
12 // the ROOT scripts do not directly use it, they rely on the fact that
13 // FindMaker has a dictionary and its existence pulls in the template
14 // definitions from FindOne.h, FindOneP.h, FindMany.h and FindManyP.h.
15 // If this class did not exist and one attempted to directly include
16 // the FindOne.h header in a ROOT script, the ROOT script would fail
17 // complaining about the complex templates that are used in FindOne.h
18 // and the other headers it includes.
19 
20 #include "canvas/Persistency/Common/FindMany.h"
21 #include "canvas/Persistency/Common/FindManyP.h"
22 #include "canvas/Persistency/Common/FindOne.h"
23 #include "canvas/Persistency/Common/FindOneP.h"
24 
25 namespace art {
26  class InputTag;
27 }
28 
29 namespace gallery {
30 
31  class Event;
32 
33  class FindMaker {
34  public:
35  FindMaker();
36 
37  template <typename PRODB, typename DATA, typename HANDLE>
38  art::FindOne<PRODB, DATA>
39  makeFindOne(HANDLE const& handle,
40  Event const& event,
41  art::InputTag const& inputTag)
42  {
43  return art::FindOne<PRODB, DATA>(handle, event, inputTag);
44  }
45 
46  template <typename PRODB, typename DATA, typename HANDLE>
47  art::FindOneP<PRODB, DATA>
48  makeFindOneP(HANDLE const& handle,
49  Event const& event,
50  art::InputTag const& inputTag)
51  {
52  return art::FindOneP<PRODB, DATA>(handle, event, inputTag);
53  }
54 
55  template <typename PRODB, typename DATA, typename HANDLE>
56  art::FindMany<PRODB, DATA>
57  makeFindMany(HANDLE const& handle,
58  Event const& event,
59  art::InputTag const& inputTag)
60  {
61  return art::FindMany<PRODB, DATA>(handle, event, inputTag);
62  }
63 
64  template <typename PRODB, typename DATA, typename HANDLE>
65  art::FindManyP<PRODB, DATA>
66  makeFindManyP(HANDLE const& handle,
67  Event const& event,
68  art::InputTag const& inputTag)
69  {
70  return art::FindManyP<PRODB, DATA>(handle, event, inputTag);
71  }
72  };
73 } // namespace gallery
74 #endif /* gallery_FindMaker_h */
75 
76 // Local Variables:
77 // mode: c++
78 // End:
art::FindManyP< PRODB, DATA > makeFindManyP(HANDLE const &handle, Event const &event, art::InputTag const &inputTag)
Definition: FindMaker.h:66
art::FindOneP< PRODB, DATA > makeFindOneP(HANDLE const &handle, Event const &event, art::InputTag const &inputTag)
Definition: FindMaker.h:48
art::FindMany< PRODB, DATA > makeFindMany(HANDLE const &handle, Event const &event, art::InputTag const &inputTag)
Definition: FindMaker.h:57
Event finding and building.
art::FindOne< PRODB, DATA > makeFindOne(HANDLE const &handle, Event const &event, art::InputTag const &inputTag)
Definition: FindMaker.h:39