StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiTpcDetectorBuilder.h
1 #ifndef StiTpcDetectorBuilder_H
2 #define StiTpcDetectorBuilder_H
3 
4 #include <set>
5 
6 #include "Sti/StiDetectorBuilder.h"
7 #include "StDetectorDbMaker/StiHitErrorCalculator.h"
8 
9 
10 
12 {
13 
14 public:
15  StiTpcDetectorBuilder(bool active) : StiTpcDetectorBuilder(active, false) {}
16  StiTpcDetectorBuilder(bool active, bool active_iTpc);
17  virtual ~StiTpcDetectorBuilder();
18  virtual void buildDetectors(StMaker&s);
19  void useVMCGeometry();
20 
21  static std::pair<int, int> toStiLayer(const int tpc_sector, const int tpc_padrow);
22 
23  protected:
24 
26  bool _active_iTpc = false;
27 
28 private:
29 
30  class StiLayer;
31 
32  StiPlanarShape* constructTpcPadrowShape(StiLayer stiLayer) const;
33  StiDetector* constructTpcPadrowDetector(StiLayer stiLayer, StiPlanarShape* pShape) const;
34 
35  friend std::ostream& operator<< (std::ostream& os, const StiLayer& stiLayer);
36 
38  static void buildStiLayerMap();
39 
40  static std::set<StiLayer> sStiLayers;
41 };
42 
43 
49 {
50  enum TpcHalf { West = 0, East = 1 };
51 
52  StiLayer(int tpc_sector, int tpc_padrow, bool split = false) :
53  sti_split_in_half(split),
54  sti_sector_id(tpc_sector <= 12 ? tpc_sector-1 : 12 - (tpc_sector-12)%12 - 1),
55  sti_padrow_id(0)
56  {
57  TpcHalf tpc_half_id = (tpc_sector <= 12 ? West : East);
58  tpc_sector_id[tpc_half_id] = tpc_sector;
59  tpc_padrow_id[tpc_half_id] = tpc_padrow;
60  }
61 
62  bool sti_split_in_half = false;
63  int sti_sector_id = -1;
64  mutable int sti_padrow_id = -1;
65  mutable int tpc_sector_id[2] = {-1, -1};
66  mutable int tpc_padrow_id[2] = {-1, -1};
67 
68  void update_tpc_id(int tpc_sector, int tpc_padrow) const {
69  TpcHalf tpc_half_id = (tpc_sector <= 12 ? West : East);
70  tpc_sector_id[tpc_half_id] = tpc_sector;
71  tpc_padrow_id[tpc_half_id] = tpc_padrow;
72  }
73  int tpc_sector() const { return tpc_sector_id[West] > 0 ? tpc_sector_id[West] : tpc_sector_id[East]; }
74  int tpc_padrow() const { return tpc_padrow_id[West] > 0 ? tpc_padrow_id[West] : tpc_padrow_id[East]; }
75  int tpc_sector(TpcHalf half) const { return tpc_sector_id[half]; }
76  bool represents_only(TpcHalf half) const { return (half == East && tpc_sector_id[West] < 0) ||
77  (half == West && tpc_sector_id[East] < 0); }
78  double radial_distance() const;
79 
80  bool operator< (const StiLayer& other) const;
81 };
82 
83 
84 #endif
int tpc_sector_id[2]
East and/or West if available.
int tpc_padrow_id[2]
East and/or West if available.
virtual void buildDetectors(StMaker &s)
bool sti_split_in_half
Split Sti layer in East and West halves.
bool _active_iTpc
Option to use iTPC hits in Sti tracking. By default hits are not used in Sti tracking.