HardwareMapperService.h
Go to the documentation of this file.
1 // HardwareMapperService.h
2 //
3 // Jonathan Davies j.p.davies@sussex.ac.uk
4 // August 2016
5 //
6 // Description: Dish out vectors of raw::ChannelID_t to the user for requested hardware element
7 
8 #ifndef HARDWAREMAPPERSERVICE_H
9 #define HARDWAREMAPPERSERVICE_H
10 
11 //The service declaration macros are defined in here
13 //Needed to get a service handle
15 //We need the geometry service for the hardwaremapper to work -- how else would it know what detector it was?!
17 //We need this for the preBeginRun thingy
19 
20 //We define some useful data structures (classes) in here
22 
23 #include <vector>
24 #include <set>
25 #include <iostream>
26 #ifndef __GCCXML__
27 #include <iosfwd> // std::ostream
28 #endif
29 
30 //Forward Class Declarations
31 namespace fhicl {
32  class ParameterSet;
33 }
34 
35 namespace art {
36  class ActivityRegistry;
37 }
38 
39 //......................................................
41  public:
43 
44  void printASICMap(unsigned int num_asics_to_print=20);
45  void printBoardMap(unsigned int num_boards_to_print=20);
46  void printTPCMap(unsigned int num_tpcs_to_print=20);
47  void printAPAMap(unsigned int num_apas_to_print=20);
48  void printHardwareMaps(); //jpd -- prints both the tpc and apa maps
49 
50  void printGeometryInfo(); //jpd -- testing function to print geometry information once loaded
51 
52  unsigned int getNASICs() const { return fASICMap.size();}
53  unsigned int getNBoards() const { return fBoardMap.size();}
54  unsigned int getNAPAs() const { return fAPAMap.size();}
55  unsigned int getNTPCs() const { return fTPCMap.size();}
56 
57 
58  //jpd -- These are the main user accessible functions - dish out vectors of channel ids
59  std::vector<raw::ChannelID_t> const& getTPCChannels(Hardware::ID tpc_id);
60  std::vector<raw::ChannelID_t> const& getAPAChannels(Hardware::ID apa_id);
61 
62  //jpd -- For users that prefer a std::set
63  std::set<raw::ChannelID_t> const& getTPCChannelsSet(Hardware::ID tpc_id);
64  std::set<raw::ChannelID_t> const& getAPAChannelsSet(Hardware::ID apa_id);
65 
66  //jpd -- We register this such that it gets called just before we process a new run
67  // -- It double checks that the geometry we filled with is the same as that used
68  // -- to produce this run
69  void checkGeomVsFileDetectorName(art::Run const& run);
70 
71  private:
72 
73  unsigned int fLogLevel;
74  unsigned int fNASICsPerBoard;
75  unsigned int fNBoardsPerAPA;
77 
79 
82 
83  //jpd -- these read in the geometry information and fill internal maps of ID->Hardware::Element
84  void fillASICMap();
85  void fillBoardMap();
86  void fillTPCMap();
87  void fillAPAMap();
88  void fillHardwareMaps();
89 
94 };
95 
96 //......................................................
98 
99 #endif
unsigned int getNBoards() const
art::ServiceHandle< geo::Geometry > fGeometryService
Hardware::BoardMap fBoardMap
std::string string
Definition: nybbler.cc:12
unsigned int ID
unsigned int getNAPAs() const
art framework interface to geometry description
Definition: Run.h:17
unsigned int getNASICs() const
#define DECLARE_ART_SERVICE(svc, scope)
std::map< ID, std::shared_ptr< TPC >> TPCMap
std::map< ID, std::shared_ptr< ASIC >> ASICMap
unsigned int getNTPCs() const
std::map< ID, std::shared_ptr< APA >> APAMap
Hardware::ASICMap fASICMap
std::map< ID, std::shared_ptr< Board >> BoardMap