13#define TMDCWire_INLINE_DEFINE_HERE
14#include "CLHEP/String/Strings.h"
18#include "MdcGeomSvc/MdcGeomSvc.h"
19#include "TrkReco/TMDC.h"
20#include "TrkReco/TMDCWire.h"
21#include "TrkReco/TMDCTsf.h"
22#include "TrkReco/TMDCUtil.h"
33: _forwardPosition(
w->Backward()*0.1),
34 _backwardPosition(
w->Forward()*0.1),
35 _tension(
w->Tension()),
36 _direction(
w->Backward() -
w->Forward()) {
44 _layerId =
w->Layer();
48 _xyPosition = 0.5 * (_forwardPosition + _backwardPosition);
50 _direction = _direction.unit();
59 std::cout <<
"w " << _id;
60 std::cout <<
",local " << _localId;
61 std::cout <<
",layer " << _layerId;
64 std::cout << std::endl;
65 if (msg.find(
"neighbor") != std::string::npos || msg.find(
"detail") != std::string::npos) {
66 for (
unsigned i = 0; i < 6; i++)
70 if (msg.find(
"tsf") != std::string::npos || msg.find(
"detail") != std::string::npos) {
71 if (_tsf) _tsf->
dump(
"", pre +
" ");
77 double A=47.35E-6/_tension;
78 HepPoint3D x0 =(z - _backwardPosition.z()) /_direction.z() * _direction + _backwardPosition;
80 double zinit = x0.z();
82 wire.setX(_forwardPosition.x()-_backwardPosition.x());
83 wire.setY(_forwardPosition.y()-_backwardPosition.y());
84 wire.setZ(_forwardPosition.z()-_backwardPosition.z());
85 double lxz=sqrt(wire.z()*wire.z()+wire.x()*wire.x());
86 double Zp = (zinit - _backwardPosition.z())*lxz/wire.z();
87 double x=_direction.x()*(zinit-_backwardPosition.z())/_direction.z() + _backwardPosition.x();
88 double y=(A*(Zp-lxz)+wire.y()/lxz)*Zp+_backwardPosition.y();
97 static const unsigned nLayers = _cdc->
nLayers();
104 float phi = phi0 + local*2*
pi/nWir;
109 if (l == 0)
return 0;
114 local = (int)((phi-phi0)/(2*
pi/nWir));
127 else return _cdc->
wire(l, local + 1);
140 else return _cdc->
wire(l, local + 1);
143 if (l == nLayers - 1)
return 0;
148 local = (int)((phi-phi0)/(2*
pi/nWir));
160 else return _cdc->
wire(l, local + 1);
240 else return _localId;
246 else return _localId;
252 else return _localId;
258 else return _localId;
264 else return _localId;
270 else return _localId;
273 if(_layerId == 6 || _layerId == 7){
276 else return _localId;
279 if(_layerId == 8 || _layerId == 9){
282 else return _localId;
285 if(_layerId == 10 || _layerId == 11){
288 else return _localId;
291 if(_layerId == 12 || _layerId == 13){
294 else return _localId;
297 if(_layerId == 14 || _layerId == 15){
300 else return _localId;
303 if(_layerId == 16 || _layerId == 17){
306 else return _localId;
309 if(_layerId == 18 || _layerId == 19){
312 else return _localId;
315 if(_layerId >= 20 && _layerId <= 23){
318 else return _localId;
321 if(_layerId >= 24 && _layerId <= 27){
324 else return _localId;
327 if(_layerId >= 28 && _layerId <= 31){
330 else return _localId;
333 if(_layerId >= 32 && _layerId <= 35){
336 else return _localId;
339 if(_layerId >= 36 && _layerId <= 39){
342 else return _localId;
345 if(_layerId >= 40 && _layerId <= 42){
348 else return _localId;
427 else return _localId;
433 else return _localId;
439 else return _localId;
445 else return _localId;
451 else return _localId;
457 else return _localId;
460 if(_layerId == 6 || _layerId == 7){
463 else return _localId;
466 if(_layerId == 8 || _layerId == 9){
469 else return _localId;
472 if(_layerId == 10 || _layerId == 11){
475 else return _localId;
478 if(_layerId == 12 || _layerId == 13){
481 else return _localId;
484 if(_layerId == 14 || _layerId == 15){
487 else return _localId;
490 if(_layerId == 16 || _layerId == 17){
493 else return _localId;
496 if(_layerId == 18 || _layerId == 19){
499 else return _localId;
502 if(_layerId >= 20 && _layerId <= 23){
505 else return _localId;
508 if(_layerId >= 24 && _layerId <= 27){
511 else return _localId;
514 if(_layerId >= 28 && _layerId <= 31){
517 else return _localId;
520 if(_layerId >= 32 && _layerId <= 35){
523 else return _localId;
526 if(_layerId >= 36 && _layerId <= 39){
529 else return _localId;
532 if(_layerId >= 40 && _layerId <= 42){
535 else return _localId;
545 back = _backwardPosition;
548 if (! (z > _backwardPosition.z() && z < _forwardPosition.z())) {
567 back.setY((
double) ybSag);
568 HepVector3D v_aux(_forwardPosition.x() - _backwardPosition.x(),
570 _forwardPosition.z() - _backwardPosition.z());
579#ifdef TRKRECO_DEBUG_DETAIL
581 std::cout <<
"TMDCWire::localIdDifference !!!";
582 std::cout <<
"super layer assumption violation" << std::endl;
589 int difR = nWires - diff;
590 if (diff < difR)
return diff;
594 int difR = nWires + diff;
595 if (- diff < difR)
return diff;
A class to represent a wire layer.
unsigned superLayerId(void) const
returns super layer id.
float offset(void) const
returns offset.
unsigned nWires(void) const
returns # of wires.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
A class to represent a wire in MDC.
unsigned id(void) const
returns id.
unsigned localLayerId(void) const
returns local layer id in a super layer.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.
virtual ~TMDCWire()
Destructor.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
TMDCWire(const MdcGeoWire *, TMDCLayer *)
Constructor.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
unsigned superLayerId(void) const
returns super layer id.
const TMDCWire *const neighbor(unsigned) const
returns a pointer to a neighbor wire.
int localIdForMinus(void) const
returns localId but if 0, return maxLocalId + 1.
int localIdDifference(const TMDCWire &) const
returns local id difference.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
int localIdForPlus(void) const
returns localId but if maxLocalId, return -1.
void wirePosition(float zPosition, HepPoint3D &xyPosition, HepPoint3D &backwardPosition, HepVector3D &direction) const
calculates position and direction vector with sag correction.
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
unsigned nLayers(void) const
static TMDC * getTMDC(void)
const TMDCLayer *const layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.