MDetector.h
Go to the documentation of this file.
1 #ifndef _mdet_MDetector_h_
2 #define _mdet_MDetector_h_
3 
4 #include <det/Detector.h>
5 #include <mdet/MComponentGroup.h>
6 #include <mdet/Counter.h>
7 #include <utl/ShadowPtr.h>
8 
9 #include <map>
10 
11 #include <boost/utility.hpp>
12 
13 namespace det {
14  class Detector;
15 }
16 
17 namespace sdet {
18  class Station;
19 }
20 
21 namespace mdet {
22 
23  class Counter;
32  class MDetector :
33  boost::noncopyable {
34  private:
40  public:
44  typedef CounterGroup::ConstIterator CounterConstIterator;
64  void Update(bool invalidateData = true, bool invalidateComponents = true);
68  const Counter& GetCounter(int id) const {
69  return fCounters.Get(id);
70  }
74  bool ExistsCounter(int id) const {
75  return fCounters.Exists(id);
76  }
81  return fCounters.Begin();
82  }
87  return fCounters.End();
88  }
93  // XXX Not much difference in commissioning or so.
94  return fCounters.Begin();
95  }
100  // See CountersBegin.
101  return fCounters.End();
102  }
103  private:
104  /*
105  * These two functions in station should be the only
106  * public interface for this link between tanks and Counters.
107  * Nevertheless, the information (so far) is handled by
108  * MDetector.
109  * So the following friend declaration allows Station to call
110  * this the associated two specific functions from
111  * MDetector.
112  * The are the funcs in Station that should call the corresponding
113  * ones defined here.
114  * int sdet::Station::GetAssociatedCounterId() const;
115  * bool sdet::Station::ExistsAssociatedCounter() const;
116  */
120  friend class sdet::Station;
124  int GetAssociatedCounterId(int tankId) const;
128  bool ExistsAssociatedCounter(int tankId) const;
132  friend class det::Detector;
133 
135  fCounters(*this)
136  { }
137 
145  const int * LookUpAssociatedCounter(int tankId) const;
150  /*
151  * Here there are another examples of ShadowPtr contained by
152  * and stl standard container.
153  * ./Framework/SEvent/StationSimData.h:147:
154  * std::map<utl::TimeStamp, utl::ShadowPtr<StationGPSData> > fGPSData;
155  *./Framework/SEvent/StationSimData.h:148:
156  * std::map<utl::TimeStamp, utl::ShadowPtr<StationTriggerData> > fTriggerData;
157  *./Framework/SEvent/PMTSimData.h:39:
158  * typedef std::map<utl::TimeStamp, utl::ShadowPtr<utl::MultiTraceI> > TimeTraceMap;
159  *./Framework/SEvent/PMTSimData.h:245:
160  * std::map<utl::TimeStamp, utl::ShadowPtr<utl::MultiTraceI> > fFADCTraces[PMTConstants::eNumberOfGains];
161  *
162  * The standard std::auto_ptr is by construction not allowed as content of an standard container:
163  * http://www.gotw.ca/publications/using_auto_ptr_effectively.htm
164  * http://www.gotw.ca/gotw/025.htm
165  * http://www.aristeia.com/BookErrata/auto_ptr-update.html
166  */
174  typedef std::map<int, utl::ShadowPtr<int> > AssociationMap;
179  };
180 
181 } // namespace mdet
182 #endif // _mdet_MDetector_h_
Defines within it the common (templated) type for muon detector hierarchy components groups...
Detector description interface for Station-related data.
CounterConstIterator CountersEnd() const
End iterator over the counters.
Definition: MDetector.h:99
CounterGroup fCounters
The child components.
Definition: MDetector.h:149
AssociationMap fAssociatedCountersIds
Cache of ids.
Definition: MDetector.h:178
Detector associated to muon detector hierarchy.
Definition: MDetector.h:32
std::map< int, utl::ShadowPtr< int > > AssociationMap
Typedef for ease of programming.
Definition: MDetector.h:174
const int * LookUpAssociatedCounter(int tankId) const
Resolve a pointer to the counter id.
Definition: MDetector.cc:38
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
CounterConstIterator AllCountersBegin() const
Begin iterator over all the counters.
Definition: MDetector.h:80
Root detector of the muon detector hierarchy.
bool ExistsAssociatedCounter(int tankId) const
Tells whether there&#39;s an associated counter for a sdet::Station.
Definition: MDetector.cc:31
CounterGroup::ConstIterator CounterConstIterator
Defines a more meaningful (and shorter) type for iterators.
Definition: MDetector.h:44
MComponentGroup< MDetector, Counter, det::IdOnlyCreator >::Type CounterGroup
Type for the associated Counters group.
Definition: MDetector.h:39
CounterConstIterator AllCountersEnd() const
End iterator over all the counters.
Definition: MDetector.h:86
int GetAssociatedCounterId(int tankId) const
Resolve the associated counter given an id for a sdet::Station.
Definition: MDetector.cc:23
CounterConstIterator CountersBegin() const
Begin iterator over the counters.
Definition: MDetector.h:92
const Counter & GetCounter(int id) const
Retrieve Counter by id.
Definition: MDetector.h:68
bool ExistsCounter(int id) const
Check Counter existence by id.
Definition: MDetector.h:74
Definition: XbArray.h:7
void Update(bool invalidateData=true, bool invalidateComponents=true)
Perform detector update.
Definition: MDetector.cc:13

, generated on Tue Sep 26 2023.