MDetector/Counter.h
Go to the documentation of this file.
1 #ifndef _mdet_Counter_h
2 #define _mdet_Counter_h
3 
4 #include <det/VManager.h>
5 #include <det/MPositionable.h>
6 //
7 #include <mdet/MComponentGroup.h>
8 #include <mdet/MDetectorComponent.h>
9 #include <mdet/Module.h>
10 //
11 #include <utl/ShadowPtr.h>
12 #include <utl/CoordinateSystemPtr.h>
13 
14 namespace sdet {
15  class Station;
16 };
17 
18 namespace mdet {
19 
20  class MDetector;
34  class Counter :
35  public MDetectorComponent<Counter>::Type,
36  public det::MPositionable<Counter>
37  {
38  private:
44  public:
49  typedef ModuleGroup::ConstIterator ModuleConstIterator;
50  /*
51  * Name of the component, as of the needs of MDetectorComponent
52  * template class.
53  */
54  static const char* const kComponentName;
55 
56  static const char* const kComponentId;
62  return GetModules().Begin();
63  }
69  return GetModules().End();
70  }
74  const Module& GetModule(const int mId) const {
75  return GetModules().Get(mId);
76  }
80  bool ExistsModule(const int mId) const {
81  return GetModules().Exists(mId);
82  }
87  int GetAssociatedTankId() const;
92  const sdet::Station& GetAssociatedTank() const;
93 
94  //Segmentation getter
95  unsigned int GetSegmentation() const { return fSegmentation; }
96 
97  //check if station is a dense station
98  bool IsDense() const {return fDense;};
99 
100  // Get the counter area in square metres
101  double GetArea() const;
102 
103  private:
108  void Update(bool invalidateData, bool invalidateComponents);
125  Counter(int cId);
129  ~Counter() { }
133  const ModuleGroup& GetModules() const {
134  if (! fModulesUpdated) {
137  else
138  fModules.Update(GetIdsMap());
139  fModulesUpdated = true; // Modifies data.
140  }
141  return fModules;
142  }
150  friend struct det::IdOnlyCreator;
156  template<class T>
157  friend void boost::checked_delete(T*) BOOST_NOEXCEPT;
161  friend struct det::ComponentUpdater;
162 
163  mutable utl::Validated<int> fAssociatedTankId;
174  mutable bool fModulesUpdated;
175  // Auxiliary flags to use in delayed updating (reflect the parameters of Update).
178  // To indicate whether the "invalidate" flags are usable or need to be ignored.
187 
188  unsigned int fSegmentation;
189  //Calculate segmentation of a given Counter
190  void Segmentation() {
191  fSegmentation = 0;
192  typedef ModuleConstIterator mIt;
194  for ( mIt mod = ModulesBegin(), mend = ModulesEnd(); mod!=mend; ++mod )
195  for (sIt sci = mod->ScintillatorsBegin(), send = mod->ScintillatorsEnd(); sci != send; ++sci)
196  ++fSegmentation;
197  }
198 
199  bool fDense;
200 
201  };
202 
203 }
204 
205 #endif // _mdet_Counter_h
206 
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
The reference is the local coordinate system of the associated sdet::Station.
Defines within it the common (templated) type for muon detector hierarchy components groups...
const Module & GetModule(const int mId) const
Retrieve by id a constant module.
Detector description interface for Station-related data.
bool fModulesUpdated
Lazy update flag.
The child doesn&#39;t actually receive the information from its parent upon construction.
utl::Validated< int > fAssociatedTankId
Mixin class to be inherited from objects that have a position.
Defines within it the common (templated) type for muon detector hierarchy components.
const VManager::IndexMap & GetIdsMap() const
The id identifying this component within its detector hierarhy.
ModuleConstIterator ModulesEnd() const
Begin iterator for the Modules contained in the Counter.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
unsigned int fSegmentation
double GetArea() const
Array of Scintillator.
bool ExistsModule(const int mId) const
Check existence.
void Update(bool invalidateData, bool invalidateComponents)
Perform update in this component and forward to subcomponents.
int GetAssociatedTankId() const
Retrieve the id of the associated surface tank.
friend void boost::checked_delete(T *) BOOST_NOEXCEPT
Friendship for destruction.
ScintillatorGroup::ConstIterator ScintillatorConstIterator
Scintillator handling.
MComponentGroup< Counter, Module, det::ParentCreator >::Type ModuleGroup
Type for the set of associated Modules.
static const char *const kComponentName
Root detector of the muon detector hierarchy.
bool IsDense() const
const ModuleGroup & GetModules() const
Accesor for delayed update.
static const char *const kComponentId
ModuleConstIterator ModulesBegin() const
Begin iterator for the Modules contained in the Counter.
ModuleGroup fModules
Modules.
const sdet::Station & GetAssociatedTank() const
Retrieve the associated tank.
ModuleGroup::ConstIterator ModuleConstIterator
Convenience typedef for const iterator over the contained Module instances.
unsigned int GetSegmentation() const
Counter(int cId)
Contructs a Counter with the given id.
double mod(const double d, const double periode)
Type
The type of file that we are acutally opening.
Definition: IoCodes.h:33
Definition: XbArray.h:7

, generated on Tue Sep 26 2023.