EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EtmDetectorStack.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EtmDetectorStack.h
1 
2 #include <map>
3 #include <vector>
4 
5 #include <TString.h>
6 
7 #ifndef _ETM_DETECTOR_STACK_
8 #define _ETM_DETECTOR_STACK_
9 
10 #include <EtmEtaBoundary.h>
11 #include <EtmDetector.h>
12 
13 class EtmDetectorStack: public TObject {
14  friend class EicToyModel;
15  friend class EtmAzimuthalScan;
16 
17  public:
18  EtmDetectorStack(const char *label = 0, double etamin = 0.0, double etamax = 0.0);
20 
21  // == User commands === just the shortcuts for the "interactive" ones ==========================
22  //
23  // Add the last detector (std::vector push_back); fill the stack starting from IP;
24  EtmDetector *add(const char *tag, double length);
25  EtmDetector *add(const char *tag, int color, double length);
26  // Two special types of "detectors";
27  EtmDetector *gap( double length) { return add("", length); };
28  // Useful for available space scans, etc;
29  EtmDetector *marker( void );
30  //
31  // Stick a detector *before* (?) a specified one;
32  EtmDetector *insert(const char *tag, double length, const char *after, unsigned order = 0);
33  //
34  // Remove the detector, either by name or by name+order;
35  void rm(const char *dname);
36  void rm(const char *dname, unsigned order);
37  //
38  // Reconfigure the stack starting distance and order;
39  void offset(double dstart = 0.0);
40  //
41  // Eta boundary getters;
42  double etamin( void ) const { return mEtaBoundaries[0]->GetEta(); };
43  double etamax( void ) const { return mEtaBoundaries[1]->GetEta(); };
44 
45  // Get detector by name & order (in case there is more than one of this type);
46  EtmDetector *get(const char *dname, unsigned order = 0) const;
47  // =============================================================================================
48 
49  void SetEtaBoundaries(double min, double max);
50 
51  /*const*/ EtmEtaBoundary *EtaBoundary(unsigned mm) const {
52  return (mm <= 1 ? mEtaBoundaries[mm] : 0);
53  };
54  const TVector2 &AlignmentAxis( void ) const { return mAlignmentAxis; };
55  const TString &GetLabel( void ) const { return mLabel; };
56  unsigned DetectorCount( void ) const { return mDetectors.size(); };
57  const EtmDetector *GetDetector(unsigned id) const {
58  return (id < mDetectors.size() ? mDetectors[id] : 0);
59  };
60 
61  private:
62  double FullLength( void ) const { return mFullLength; };
63  void CalculateAlignmentAxis( void );
64 
65  EtmDetector *CreateDetector(const char *tag, double length);
66 
67  void Build( void );
68  void CalculateActualDistances( void );
69 
70  TString mLabel;
71 
72  // Booked detectors; yes, prefer a vector rather than a set, in order to preserve the order;
73  // individual element removal is indeed more complicated then;
74  std::vector<EtmDetector*> mDetectors;
75 
78 
79  // Alignment axis however will be +Z for both horizontal and vertical views;
80  TVector2 mAlignmentAxis;
81 
82  // Useful not to crash user codes, and also indicate situations when stretch() call
83  // was not given relative to a particular detector; do not want to pollute mDetectors[];
85 
86  ClassDef(EtmDetectorStack, 1)
87 };
88 
89 #endif