Belle II Software  release-05-02-19
Wire.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Wire.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a wire in CDC.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCWire_FLAG_
15 #define TRGCDCWire_FLAG_
16 
17 #include <vector>
18 #include "CLHEP/Geometry/Vector3D.h"
19 #include "CLHEP/Geometry/Point3D.h"
20 #include "trg/trg/Signal.h"
21 #include "trg/cdc/Cell.h"
22 #include "trg/cdc/Layer.h"
23 
24 #ifdef TRGCDC_SHORT_NAMES
25 #define TCWire TRGCDCWire
26 #endif
27 
28 namespace Belle2 {
35  typedef HepGeom::Vector3D<double> Vector3D;
37 #define WireInnerLeft 0
38 #define WireInnerRight 1
40 #define WireLeft 2
42 #define WireRight 3
44 #define WireOuterLeft 4
46 #define WireOuterRight 5
48 #define MaxNeighbors 6
50 
51  class TRGCDC;
52  class TRGCDCWireHit;
53  class TRGCDCWireHitMC;
54  class TRGCDCTrackSegment;
55 
57  class TRGCDCWire : public TRGCDCCell {
58 
59  public:
61  TRGCDCWire(unsigned id,
62  unsigned localId,
63  const TRGCDCLayer&,
66  const TRGClock& clock);
67 
69  virtual ~TRGCDCWire();
70 
71  public:// Selectors
72 
74  const TRGCDCWireHit* hit(void) const;
75 
76 // /// returns a pointer to a TRGCDCTrackSegment.
77 // const TRGCDCTrackSegment * const segment(void) const;
78 
80  const TRGCDCWire* neighbor(unsigned) const;
81 
83  bool consective(const TRGCDCWire&) const;
84 
86  bool adjacent(const TRGCDCWire&) const;
87 
89  int localIdForPlus(void) const;
90 
92  int localIdForMinus(void) const;
93 
95  std::string name(void) const override;
96 
98  void dump(const std::string& message = std::string(""),
99  const std::string& prefix = std::string("")) const override;
100 
101  public:// Modifiers
102 
104  void clear(void) override;
105 
107  const TRGCDCWireHit* hit(const TRGCDCWireHit*);
108 
111 
113  void addSignal(TRGSignal& newSignal);
114 
115  public:// TRG
116 
118  const TRGSignal& signal(void) const override;
119 
120  private:
121 
123 // std::vector<const TRGCDCWireHitMC * const> _mcHits;
124  std::vector<const TRGCDCWireHitMC*> _mcHits;
125 
128 
130  friend class TRGCDC;
131  };
132 
133 //-----------------------------------------------------------------------------
134 
135  inline
136  const TRGCDCWireHit*
138  {
139  return (const TRGCDCWireHit*) TRGCDCCell::hit((const TRGCDCCellHit*) h);
140  }
141 
142  inline
143  const TRGCDCWireHit*
144  TRGCDCWire::hit(void) const
145  {
146  return (const TRGCDCWireHit*) TRGCDCCell::hit();
147  }
148 
149  inline
150  const TRGCDCWireHitMC*
152  {
153  _mcHits.push_back(a);
154  return a;
155  }
156 
157  inline
158  void
160  {
161  _signal |= newSignal;
162  }
163 
164  inline
165  bool
167  {
168  if (neighbor(2) == & w) return true;
169  else if (neighbor(3) == & w) return true;
170  return false;
171  }
172 
173  inline
174  bool
176  {
177  for (unsigned i = 0; i < 7; i++)
178  if (neighbor(i) == & w)
179  return true;
180  return false;
181  }
182 
183  inline
184  int
186  {
187  //
188  // used in curl finder
189  //
190  // new version by NK
191  //
192  //ho const TCDCLayer &l = *layer();
193  //ho const int nw = l.nWires();
194 
195  const TRGCDCLayer& l = this->layer();
196  const unsigned nw = l.nCells();
197  if (localId() + 1 == nw)
198  return -1;
199  else
200  return localId();
201  }
202 
203  inline
204  int
206  {
207  //
208  // used in curl finder
209  //
210  // new version by NK
211  //
212  //ho const TRGCDCLayer &l = *layer();
213  //ho const int nw = l.nWires();
214 
215  const TRGCDCLayer& l = this->layer();
216  const unsigned nw = l.nCells();
217  if (0 == localId())
218  return nw;
219  else
220  return localId();
221  }
222 
223  inline
224  const TRGSignal&
225  TRGCDCWire::signal(void) const
226  {
227  return _signal;
228  }
229 
231 } // namespace Belle2
232 
233 #endif /* TRGCDCWire_FLAG_ */
234 
Belle2::TRGCDCCell::backwardPosition
const HepGeom::Point3D< double > & backwardPosition(void) const
returns position in backward endplate.
Definition: Cell.h:322
Belle2::TRGCDCCell::localId
unsigned localId(void) const
returns local id in a layer.
Definition: Cell.h:205
Belle2::TRGSignal
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:28
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TRGCDCWire::clear
void clear(void) override
clears information.
Definition: Wire.cc:369
Belle2::TRGCDCCell::layer
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:233
Belle2::TRGCDCCell::hit
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:363
Belle2::TRGCDCWireHitMC
A class to represent a MC wire hit in CDC.
Definition: WireHitMC.h:35
Belle2::TRGCDCWire
A class to represent a wire in CDC.
Definition: Wire.h:57
Belle2::TRGCDCWire::_signal
TRGSignal _signal
Trigger output.
Definition: Wire.h:127
Belle2::TRGCDCWire::name
std::string name(void) const override
returns name.
Definition: Wire.cc:382
Belle2::TRGCDCWire::addSignal
void addSignal(TRGSignal &newSignal)
set signal |= newSignal
Definition: Wire.h:159
Belle2::TRGCDCWire::consective
bool consective(const TRGCDCWire &) const
returns true if a given wire is consective in a layer.
Definition: Wire.h:166
Belle2::TRGCDCLayer
A class to represent a cell layer.
Definition: Layer.h:34
Belle2::TRGCDCCell
A class to represent a wire in CDC.
Definition: Cell.h:41
Belle2::TRGCDCWire::dump
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Wire.cc:53
Belle2::TRGCDCCellHit
A class to represent a wire hit in CDC.
Definition: CellHit.h:75
Belle2::TRGCDCCell::forwardPosition
const HepGeom::Point3D< double > & forwardPosition(void) const
returns position in forward endplate.
Definition: Cell.h:315
Belle2::TRGCDCWire::adjacent
bool adjacent(const TRGCDCWire &) const
returns true if a given wire is adjacent.
Definition: Wire.h:175
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCWire::~TRGCDCWire
virtual ~TRGCDCWire()
Destructor.
Definition: Wire.cc:48
Belle2::TRGCDCWireHit
A class to represent a wire hit in CDC.
Definition: WireHit.h:34
Belle2::TRGCDCWire::hit
const TRGCDCWireHit * hit(void) const
returns a pointer to a TRGCDCWireHit.
Definition: Wire.h:144
Belle2::TRGCDC
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:70
Belle2::TRGCDCWire::_mcHits
std::vector< const TRGCDCWireHitMC * > _mcHits
MC wire hit.
Definition: Wire.h:124
Belle2::TRGCDCWire::localIdForPlus
int localIdForPlus(void) const
returns localId but if maxLocalId, return -1.
Definition: Wire.h:185
HepGeom::Point3D< double >
Belle2::TRGCDCWire::neighbor
const TRGCDCWire * neighbor(unsigned) const
returns a pointer to a neighbor wire. This function is expensive.
Definition: Wire.cc:74
Belle2::TRGCDCWire::localIdForMinus
int localIdForMinus(void) const
returns localId but if 0, return maxLocalId + 1.
Definition: Wire.h:205
Belle2::TRGCDCWire::signal
const TRGSignal & signal(void) const override
returns an input to the trigger. This is sync'ed to 1GHz clock.
Definition: Wire.h:225
Belle2::TRGCDCWire::TRGCDCWire
TRGCDCWire(unsigned id, unsigned localId, const TRGCDCLayer &, const HepGeom::Point3D< double > &forwardPosition, const HepGeom::Point3D< double > &backwardPosition, const TRGClock &clock)
Constructor.
Definition: Wire.cc:35
Belle2::Point3D
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:33
Belle2::TRGClock
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:43