CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
TMDC Class Reference

#include <TMDC.h>

+ Inheritance diagram for TMDC:

Public Member Functions

std::string name (void) const
 returns name.
 
std::string version (void) const
 returns version.
 
std::string cdcVersion (void) const
 returns MDC version.
 
void dump (const std::string &message) const
 dumps debug information.
 
int debugLevel (void) const
 returns debug level.
 
float fudgeFactor (void) const
 returns fudge factor for drift time error.
 
void clear (void)
 clears all TMDC information.
 
void fastClear (void)
 clears TMDC information.
 
void update (bool mcAnalysis=true)
 updates TMDC information. clear() is called in this function.
 
int debugLevel (int)
 sets debug level.
 
float fudgeFactor (float)
 sets/returns fudge factor for drift time error.
 
const TMDCWire *const wire (unsigned wireId) const
 returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
 
const TMDCWire *const wire (unsigned layerId, int localId) const
 returns a pointer to a wire. 'localId' can be negative. 0 will be returned if 'layerId' is invalid.
 
const TMDCWire *const wire (const HepPoint3D &point) const
 returns a pointer to a wire.
 
const TMDCWire *const wire (float r, float phi) const
 returns a pointer to a wire.
 
const TMDCLayer *const layer (unsigned id) const
 returns a pointer to a layer. 0 will be returned if 'id' is invalid.
 
const AList< TMDCLayer > *const superLayer (unsigned id) const
 returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
 
unsigned nLocalLayer (unsigned superLayerId) const
 returns # of wire layers in a super layer. 0 will be returned if 'superLayerId' is invalid.
 
const AList< TMDCWireHit > & hits (unsigned mask=0) const
 returns a list of TMDCWireHit. 'update()' must be called before calling this function.
 
const AList< TMDCWireHit > & axialHits (unsigned mask=0) const
 returns a list of axial hits. 'update()' must be called before calling this function.
 
const AList< TMDCWireHit > & stereoHits (unsigned mask=0) const
 returns a list of stereo hits. 'update()' must be called before calling this function.
 
const AList< TMDCWireHitMC > & hitsMC (void) const
 returns a list of TMDCWireHitMC. 'updateMC()' must be called before calling this function.
 
const AList< TMDCWireHit > & badHits (void)
 returns bad hits(finding invalid hits).
 
unsigned nWires (void) const
 
unsigned nSuperLayers (void) const
 
unsigned nLayers (void) const
 
void classification (void)
 classify hits.
 
void updateMC (void)
 updates TMDC information for MC.
 

Static Public Member Functions

static TMDCgetTMDC (const std::string &cdcVersion)
 returns TMDC object.
 
static TMDCgetTMDC (void)
 
static std::string wireName (unsigned wireId)
 
static std::string wireName (const MdcGeoWire *const)
 
static std::string wireName (const MdcRec_wirhit &)
 
static unsigned layerId (unsigned wireId)
 
static unsigned layerId (const MdcGeoWire *const)
 
static unsigned localId (unsigned wireId)
 
static unsigned localId (const MdcGeoWire *const)
 
static unsigned superLayerId (unsigned wireId)
 
static unsigned superLayerId (const MdcGeoWire *const)
 
static unsigned superLayerId (const MdcGeoLayer *const)
 
static unsigned localLayerId (unsigned wireId)
 
static unsigned localLayerId (const MdcGeoWire *const)
 
static unsigned localLayerId (const MdcGeoLayer *const)
 
static unsigned axialStereoLayerId (const MdcGeoLayer *const)
 
static unsigned layerId (unsigned axialStereo, unsigned axialStereoLayerId)
 
static float phi (float phi)
 
static void driftDistance (TMLink &link, const TTrack &track, unsigned correctionFlag=0, float T0Offset=0.)
 calculates corrected drift time. correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation delay, 3:tan(lambda) correction)
 

Detailed Description

A class to represent MDC.

The instance of TMDC is a singleton. 'TMDC::getTMDC()' gives you a pointer to access the TMDC. Geometrical information is initialized automatically. Before accessing hit information, user has to call 'update()' to initialize hit information event by event.

Definition at line 61 of file TMDC.h.

Member Function Documentation

◆ axialHits()

const AList< TMDCWireHit > & TMDC::axialHits ( unsigned mask = 0) const

returns a list of axial hits. 'update()' must be called before calling this function.

Definition at line 518 of file TMDC.cxx.

518 {
519 if (! mask) return _axialHits;
520 else if (mask == WireHitFindingValid) return _axialHits;
521 std::cout << "TMDC::axialHits !!! unsupported mask given" << std::endl;
522 return _axialHits;
523}
#define WireHitFindingValid
Definition TMDCWireHit.h:28

Referenced by TrkReco::execute().

◆ axialStereoLayerId()

unsigned TMDC::axialStereoLayerId ( const MdcGeoLayer * const l)
static

Definition at line 991 of file TMDC.cxx.

991 {
992 if (! l) return 9999;
993 unsigned id = l->Id();
994
995 if (id < 8) return id;
996 else if (id < 20) return id-8;
997 else if (id < 36) return id-12;
998 else if (id < 43) return id-24;
999
1000 return 9999;
1001}

Referenced by TMDCLayer::TMDCLayer().

◆ badHits()

const AList< TMDCWireHit > & TMDC::badHits ( void )

returns bad hits(finding invalid hits).

Definition at line 542 of file TMDC.cxx.

542 {
543 if (! updated()) update();
544 if (_badHits.length()) return _badHits;
545
546 //...Loop over RECMDC_WIRHIT bank...
547// unsigned nReccdc = BsCouTab(RECMDC_WIRHIT);
548 unsigned nReccdc = MdcRecWirhitCol::getMdcRecWirhitCol()->size();
549 for (unsigned i = 0; i < nReccdc; i++) {
550// struct reccdc_wirhit * h =
551// (struct reccdc_wirhit *)
552// BsGetEnt(RECMDC_WIRHIT, i + 1, BBS_No_Index);
554
555 //...Check validity...
556 if (h->stat & WireHitFindingValid) continue;
557
558 //...Obtain a pointer to GEOMDC...
559// geocdc_wire * g =
560// (geocdc_wire *) BsGetEnt(GEOMDC_WIRE, h->m_geo, BBS_No_Index);
561 const MdcGeoWire* g = h->geo;
562
563 //...Get a pointer to a TMDCWire...
564// TMDCWire * w = _wires[g->m_ID - 1];
565 TMDCWire * w = _wires[g->Id()];
566
567 //...Create TMDCWireHit...
568 _badHits.append(new TMDCWireHit(w, h, _fudgeFactor));
569 }
570
571 return _badHits;
572}
static vector< MdcRec_wirhit > * getMdcRecWirhitCol(void)
const MdcGeoWire * geo
Definition MdcTables.h:335
A class to represent a wire in MDC.
Definition TMDCWire.h:55
virtual void update(void)
updates an object.
Definition TUpdater.cxx:37
virtual bool updated(void) const
returns true if an object is updated.
Definition TUpdater.cxx:57

◆ cdcVersion()

std::string TMDC::cdcVersion ( void ) const
inline

returns MDC version.

Definition at line 304 of file TMDC.h.

304 {
305 return std::string(_cdcVersion);
306}

Referenced by dump().

◆ classification()

void TMDC::classification ( void )

classify hits.

Definition at line 445 of file TMDC.cxx.

445 {
446 unsigned n = _hits.length();
447
448 for (unsigned i = 0; i < n; i++) {
449 TMDCWireHit * h = _hits[i];
450 const TMDCWire * w = h->wire();
451 unsigned state = h->state();
452
453 //...Cache pointers to a neighbor...
454 const TMDCWire * neighbor[6];
455 for (unsigned j = 0; j < 6; j++) neighbor[j] = w->neighbor(j);
456
457 //output to test ...
458// cout<<w->localId()<<endl;
459// if(neighbor[0]) cout<<"inner local:"<<neighbor[0]->localId()<<", "<<neighbor[1]->localId()<<endl;
460// if(neighbor[5]) cout<<"outer local:"<<neighbor[4]->localId()<<", "<<neighbor[5]->localId()<<endl;
461
462 //...Decide hit pattern...
463 unsigned pattern = 0;
464 for (unsigned j = 0; j < 6; j++) {
465 if (neighbor[j])
466 if (neighbor[j]->hit())
467 pattern += (1 << j);
468 }
469 state |= (pattern << WireHitNeighborHit);
470
471 //...Check isolation...
472 const TMDCWireHit * hr1 = neighbor[2]->hit();
473 const TMDCWireHit * hl1 = neighbor[3]->hit();
474 if ((hr1 == 0) && (hl1 == 0)) {
475 state |= WireHitIsolated;
476 }
477 else {
478 const TMDCWireHit * hr2 = neighbor[2]->neighbor(2)->hit();
479 const TMDCWireHit * hl2 = neighbor[3]->neighbor(3)->hit();
480 if ((hr2 == 0) && (hr1 != 0) && (hl1 == 0) ||
481 (hl2 == 0) && (hl1 != 0) && (hr1 == 0))
482 state |= WireHitIsolated;
483 }
484
485 //...Check continuation...
486 unsigned superLayer = w->superLayerId();
487 bool previous = false;
488 bool next = false;
489 if (neighbor[0] == 0) previous = true;
490 else {
491 if ((neighbor[0]->hit()) || neighbor[1]->hit())
492 previous = true;
493 }
494 if (neighbor[5] == 0) next = true;
495 else {
496 if ((neighbor[4]->hit()) || neighbor[5]->hit())
497 next = true;
498 }
499 // if (previous && next) state |= WireHitContinuous;
500 if (previous || next) state |= WireHitContinuous;
501
502 //...Solve LR locally...
503 if ((pattern == 34) || (pattern == 42) ||
504 (pattern == 40) || (pattern == 10) ||
505 (pattern == 35) || (pattern == 50))
506 state |= WireHitPatternRight;
507 else if ((pattern == 17) || (pattern == 21) ||
508 (pattern == 20) || (pattern == 5) ||
509 (pattern == 19) || (pattern == 49))
510 state |= WireHitPatternLeft;
511
512 //...Store it...
513 h->state(state);
514 }
515}
const Int_t n
#define WireHitContinuous
Definition TMDCWireHit.h:36
#define WireHitPatternLeft
Definition TMDCWireHit.h:33
#define WireHitPatternRight
Definition TMDCWireHit.h:34
#define WireHitNeighborHit
Definition TMDCWireHit.h:37
#define WireHitIsolated
Definition TMDCWireHit.h:35
unsigned state(void) const
returns state.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const TMDCWireHit *const hit(void) const
returns a pointer to a TMDCWireHit.
Definition TMDCWire.h:287
unsigned superLayerId(void) const
returns super layer id.
Definition TMDCWire.h:225
const TMDCWire *const neighbor(unsigned) const
returns a pointer to a neighbor wire.
Definition TMDCWire.cxx:95
const AList< TMDCLayer > *const superLayer(unsigned id) const
returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
Definition TMDC.h:271
Index next(Index i)

Referenced by update().

◆ clear()

void TMDC::clear ( void )
virtual

clears all TMDC information.

Reimplemented from TUpdater.

Definition at line 282 of file TMDC.cxx.

282 {
283 unsigned i = 0;
284 while (TMDCWire * w = _wires[i++])
285 w->clear();
286
287 _hitWires.removeAll();
288 _axialHits.removeAll();
289 _stereoHits.removeAll();
290 HepAListDeleteAll(_hits);
291 HepAListDeleteAll(_hitsMC);
292 HepAListDeleteAll(_badHits);
293
295}
virtual void clear(void)
clears an object.
Definition TUpdater.h:88

◆ debugLevel() [1/2]

int TMDC::debugLevel ( int a)
inline

sets debug level.

Definition at line 245 of file TMDC.h.

245 {
246 return _debugLevel = a;
247}

◆ debugLevel() [2/2]

int TMDC::debugLevel ( void ) const
inline

returns debug level.

Definition at line 239 of file TMDC.h.

239 {
240 return _debugLevel;
241}

◆ driftDistance()

void TMDC::driftDistance ( TMLink & link,
const TTrack & track,
unsigned correctionFlag = 0,
float T0Offset = 0. )
static

calculates corrected drift time. correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation delay, 3:tan(lambda) correction)

Definition at line 1029 of file TMDC.cxx.

1032 {
1033
1034 //...No correction...
1035 if (flag == 0) {
1036 if (l.hit()) {
1037 l.drift(0, l.hit()->drift(0));
1038 l.drift(1, l.hit()->drift(1));
1039 l.dDrift(0, l.hit()->dDrift(0));
1040 l.dDrift(1, l.hit()->dDrift(1));
1041 }
1042 else {
1043 l.drift(0, 0.);
1044 l.drift(1, 0.);
1045 l.dDrift(0, 0.);
1046 l.dDrift(1, 0.);
1047 }
1048
1049 return;
1050 }
1051
1052 //...TOF correction...
1053 float tof = 0.;
1054 if (flag && 1) {
1055 int imass = 3;
1056 float tl = t.helix().a()[4];
1057 float f = sqrt(1. + tl * tl);
1058 float s = fabs(t.helix().curv()) * fabs(l.dPhi()) * f;
1059 float p = f / fabs(t.helix().a()[2]);
1060//zsl calcdc_tof2_(& imass, & p, & s, & tof);
1061 }
1062
1063 //...T0 correction....
1064 if (! (flag && 2)) t0Offset = 0.;
1065
1066 //...Propagation corrections...
1067 const TMDCWireHit & h = * l.hit();
1068 int wire = h.wire()->id();
1069 HepVector3D tp = t.helix().momentum(l.dPhi());
1070 float p[3] = {tp.x(), tp.y(), tp.z()};
1071 const HepPoint3D & onWire = l.positionOnWire();
1072 float x[3] = {onWire.x(), onWire.y(), onWire.z()};
1073 float time = h.reccdc()->tdc + t0Offset - tof;
1074 float dist;
1075 float edist;
1076 int prop = (flag & 4);
1077
1078 //...Calculation with left side...
1079 int side = -1;
1080 if (side == 0) side = -1;
1081//zsl calcdc_driftdist_(& prop,
1082// & wire,
1083// & side,
1084// p,
1085// x,
1086// & time,
1087// & dist,
1088// & edist);
1089 l.drift(0, dist);
1090 l.dDrift(0, edist);
1091
1092 //...Calculation with left side...
1093 side = 1;
1094//zsl calcdc_driftdist_(& prop,
1095// & wire,
1096// & side,
1097// p,
1098// x,
1099// & time,
1100// & dist,
1101// & edist);
1102 l.drift(1, dist);
1103 l.dDrift(1, edist);
1104
1105 //...tan(lambda) correction...
1106 if (flag && 8) {
1107 float tanl = abs(p[2]) / tp.perp();
1108 float c;
1109 if ((tanl >= 0.0) && (tanl < 0.5)) c = -0.48 * tanl + 1.3;
1110 else if ((tanl >= 0.5) && (tanl < 1.0)) c = -0.28 * tanl + 1.2;
1111 else if ((tanl >= 1.0) && (tanl < 1.5)) c = -0.16 * tanl + 1.08;
1112 else c = 0.84;
1113
1114 l.dDrift(0, l.dDrift(0) * c);
1115 l.dDrift(1, l.dDrift(1) * c);
1116 }
1117}
Double_t x[10]
Double_t time
double abs(const EvtComplex &c)
XmlRpcServer s
struct MdcRec_wirhit * reccdc(void) const
returns a pointer to RECMDC_WIRHIT.
unsigned id(void) const
returns id.
Definition TMDCWire.h:207
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
Definition TMDC.h:277
int t()
Definition t.c:1

◆ dump()

void TMDC::dump ( const std::string & message) const

dumps debug information.

Definition at line 181 of file TMDC.cxx.

181 {
182// if ( msg.index("name") != -1
183// || msg.index("version") != -1
184// || msg.index("detail") != -1
185// || msg == "") {
186 if ( msg.find("name") != std::string::npos
187 || msg.find("version") != std::string::npos
188 || msg.find("detail") != std::string::npos
189 || msg == "") {
190 std::cout << name() << "(" << version() << ") ";
191 }
192 if (msg.find("detail") != std::string::npos || msg.find("state") != std::string::npos) {
193 std::cout << "Debug Level=" << _debugLevel;
194 }
195 std::cout << std::endl;
196
197 std::string tab(" ");
198
199 if (msg == "" || msg.find("geometry") != std::string::npos) {
200
201 //...Get information..."
202 unsigned nLayer = _layers.length();
203 std::cout << " version : " << version() << std::endl;
204 std::cout << " cdc version: " << cdcVersion() << std::endl;
205 std::cout << " # of wires : " << _wires.length() << std::endl;
206 std::cout << " # of layers: " << nLayer << std::endl;
207 std::cout << " super layer information" << std::endl;
208 std::cout << " # of super layers = " << _superLayers.length()
209 << std::endl;
210
211 std::cout << " layer information" << std::endl;
212 for (unsigned i = 0; i < _nLayers; i++)
213 _layers[i]->dump("", tab);
214
215 std::cout << " wire information" << std::endl;
216 for (unsigned i = 0; i < _nWires; i++)
217 (_wires[i])->dump("neighbor", tab);
218
219 return;
220 }
221 if (msg.find("hits") != std::string::npos) {
222 std::cout << " hits : " << _hits.length() << std::endl;
223 for (unsigned i = 0; i < _hits.length(); i++) {
224 _hits[i]->dump("state mc", tab);
225 }
226 }
227 if (msg.find("axialHits") != std::string::npos) {
228 std::cout << " hits : " << _axialHits.length() << std::endl;
229 for (unsigned i = 0; i < _axialHits.length(); i++) {
230 _axialHits[i]->dump("state mc", tab);
231 }
232 }
233 if (msg.find("stereoHits") != std::string::npos) {
234 std::cout << " hits : " << _stereoHits.length() << std::endl;
235 for (unsigned i = 0; i < _stereoHits.length(); i++) {
236 _stereoHits[i]->dump("state mc", tab);
237 }
238 }
239}
std::string cdcVersion(void) const
returns MDC version.
Definition TMDC.h:304
std::string name(void) const
returns name.
Definition TMDC.cxx:76
std::string version(void) const
returns version.
Definition TMDC.cxx:81
void dump(const std::string &message) const
dumps debug information.
Definition TMDC.cxx:181

Referenced by dump().

◆ fastClear()

void TMDC::fastClear ( void )

clears TMDC information.

Definition at line 298 of file TMDC.cxx.

298 {
299 unsigned i = 0;
300 while (TMDCWire * w = _hitWires[i++])
301 w->clear();
302 i = 0;
303 while (TMDCWireHit * h = _badHits[i++])
304 ((TMDCWire *) h->wire())->clear();
305
306 _hitWires.removeAll();
307 _axialHits.removeAll();
308 _stereoHits.removeAll();
309 HepAListDeleteAll(_hits);
310 HepAListDeleteAll(_hitsMC);
311 HepAListDeleteAll(_badHits);
312
314}

Referenced by TrkReco::finalize(), and update().

◆ fudgeFactor() [1/2]

float TMDC::fudgeFactor ( float a)
inline

sets/returns fudge factor for drift time error.

Definition at line 298 of file TMDC.h.

298 {
299 return _fudgeFactor = a;
300}

◆ fudgeFactor() [2/2]

float TMDC::fudgeFactor ( void ) const
inline

returns fudge factor for drift time error.

Definition at line 292 of file TMDC.h.

292 {
293 return _fudgeFactor;
294}

◆ getTMDC() [1/2]

TMDC * TMDC::getTMDC ( const std::string & cdcVersion)
static

returns TMDC object.

Definition at line 89 of file TMDC.cxx.

89 {
90 if (! _cdc) _cdc = new TMDC(version);
91 return _cdc;
92}
Definition TMDC.h:61

◆ getTMDC() [2/2]

TMDC * TMDC::getTMDC ( void )
static

Definition at line 95 of file TMDC.cxx.

95 {
96 if (! _cdc) _cdc = new TMDC("1.0");
97 return _cdc;
98}

Referenced by TBuilder0::buildStereo(), TConformalFinder::conformal2Wire(), TMDCTsf::createTsf(), TPerfectFinder::doit(), and TMDCWire::neighbor().

◆ hits()

const AList< TMDCWireHit > & TMDC::hits ( unsigned mask = 0) const

returns a list of TMDCWireHit. 'update()' must be called before calling this function.

Definition at line 534 of file TMDC.cxx.

534 {
535 if (! mask) return _hits;
536 else if (mask == WireHitFindingValid) return _hits;
537 std::cout << "TMDC::hits !!! unsupported mask given" << std::endl;
538 return _hits;
539}

Referenced by TrkReco::execute().

◆ hitsMC()

const AList< TMDCWireHitMC > & TMDC::hitsMC ( void ) const
inline

returns a list of TMDCWireHitMC. 'updateMC()' must be called before calling this function.

Definition at line 265 of file TMDC.h.

265 {
266 return _hitsMC;
267}

Referenced by TPerfectFinder::doit().

◆ layer()

const TMDCLayer *const TMDC::layer ( unsigned id) const
inline

returns a pointer to a layer. 0 will be returned if 'id' is invalid.

Definition at line 259 of file TMDC.h.

259 {
260 return _layers[id];
261}

Referenced by TMDCTsf::createTsf(), TMDCWire::neighbor(), and wire().

◆ layerId() [1/3]

unsigned TMDC::layerId ( const MdcGeoWire * const w)
static

Definition at line 661 of file TMDC.cxx.

661 {
662 if (! w) return 9999;
663 //zsl unsigned id = w->Id();
664 // return layerId(id);
665 return w->Layer();
666}

◆ layerId() [2/3]

unsigned TMDC::layerId ( unsigned axialStereo,
unsigned axialStereoLayerId )
static

Definition at line 1004 of file TMDC.cxx.

1004 {
1005
1006 //...Axial case...
1007 if (as == 0) {
1008 if (id < 12) return id + 8;
1009 else if (id < 19) return id + 24;
1010 return 9999;
1011 }
1012
1013 //...Stereo case...
1014 if (id < 8) return id;
1015 else if (id < 24) return id + 12;
1016 return 9999;
1017}

◆ layerId() [3/3]

unsigned TMDC::layerId ( unsigned wireId)
static

Definition at line 598 of file TMDC.cxx.

598 {
599// int length = _wires.length();
600// if(id < length) return _wires[id]->geocdc()->Layer();
601// return 9999;
602
603 if (id < 40) return 0;
604 else if (id < 84) return 1;
605 else if (id < 132) return 2;
606 else if (id < 188) return 3;
607
608 else if (id < 252) return 4;
609 else if (id < 324) return 5;
610 else if (id < 404) return 6;
611 else if (id < 484) return 7;
612
613 else if (id < 560) return 8;
614 else if (id < 636) return 9;
615 else if (id < 724) return 10;
616 else if (id < 812) return 11;
617
618 else if (id < 912) return 12;
619 else if (id < 1012) return 13;
620 else if (id < 1124) return 14;
621 else if (id < 1236) return 15;
622
623 else if (id < 1364) return 16;
624 else if (id < 1492) return 17;
625 else if (id < 1632) return 18;
626 else if (id < 1772) return 19;
627
628 else if (id < 1932) return 20;
629 else if (id < 2092) return 21;
630 else if (id < 2252) return 22;
631 else if (id < 2412) return 23;
632
633 else if (id < 2604) return 24;
634 else if (id < 2796) return 25;
635 else if (id < 2988) return 26;
636 else if (id < 3180) return 27;
637
638 else if (id < 3388) return 28;
639 else if (id < 3596) return 29;
640 else if (id < 3804) return 30;
641 else if (id < 4012) return 31;
642
643 else if (id < 4252) return 32;
644 else if (id < 4492) return 33;
645 else if (id < 4732) return 34;
646 else if (id < 4972) return 35;
647
648 else if (id < 5228) return 36;
649 else if (id < 5484) return 37;
650 else if (id < 5740) return 38;
651 else if (id < 5996) return 39;
652
653 else if (id < 6284) return 40;
654 else if (id < 6572) return 41;
655 else if (id < 6860) return 42;
656
657 return 9999;
658}

Referenced by localLayerId(), wire(), and wireName().

◆ localId() [1/2]

unsigned TMDC::localId ( const MdcGeoWire * const w)
static

Definition at line 750 of file TMDC.cxx.

750 {
751 if (! w) return 9999;
752// unsigned id = w->Id();
753// return localId(id);
754 return w->Cell();
755}

◆ localId() [2/2]

unsigned TMDC::localId ( unsigned wireId)
static

Definition at line 676 of file TMDC.cxx.

676 {
677 if (id < 40) return id;
678 else if (id < 84) return id-40;
679 else if (id < 132) return id-84;
680 else if (id < 188) return id-132;
681
682 else if (id < 252) return id-188;
683 else if (id < 324) return id-252;
684 else if (id < 404) return id-324;
685 else if (id < 484) return id-404;
686
687 else if (id < 560) return id-484;
688 else if (id < 636) return id-560;
689 else if (id < 724) return id-636;
690 else if (id < 812) return id-724;
691
692 else if (id < 912) return id-812;
693 else if (id < 1012) return id-912;
694 else if (id < 1124) return id-1012;
695 else if (id < 1236) return id-1124;
696
697 else if (id < 1364) return id-1236;
698 else if (id < 1492) return id-1364;
699 else if (id < 1632) return id-1492;
700 else if (id < 1772) return id-1632;
701
702 else if (id < 1932) return id-1772;
703 else if (id < 2092) return id-1932;
704 else if (id < 2252) return id-2092;
705 else if (id < 2412) return id-2252;
706
707 else if (id < 2604) return id-2412;
708 else if (id < 2796) return id-2604;
709 else if (id < 2988) return id-2796;
710 else if (id < 3180) return id-2988;
711
712 else if (id < 3388) return id-3180;
713 else if (id < 3596) return id-3388;
714 else if (id < 3804) return id-3596;
715 else if (id < 4012) return id-3804;
716
717 else if (id < 4252) return id-4012;
718 else if (id < 4492) return id-4252;
719 else if (id < 4732) return id-4492;
720 else if (id < 4972) return id-4732;
721
722 else if (id < 5228) return id-4972;
723 else if (id < 5484) return id-5228;
724 else if (id < 5740) return id-5484;
725 else if (id < 5996) return id-5740;
726
727 else if (id < 6284) return id-5996;
728 else if (id < 6572) return id-6284;
729 else if (id < 6860) return id-6572;
730
731 return 9999;
732
733/* if (id < 384) return id % 64;
734 else if (id < 624) return (id - 384) % 80;
735 else if (id < 1200) return (id - 624) % 96;
736 else if (id < 1584) return (id - 1200) % 128;
737 else if (id < 2304) return (id - 1584) % 144;
738 else if (id < 2944) return (id - 2304) % 160;
739 else if (id < 3904) return (id - 2944) % 176;
740 else if (id < 4736) return (id - 3904) % 208;
741 else if (id < 5936) return (id - 4736) % 240;
742 else if (id < 6960) return (id - 5936) % 256;
743 else if (id < 8400) return (id - 6960) % 288;
744
745 return 9999;
746*/
747}

Referenced by wire(), wire(), and wireName().

◆ localLayerId() [1/3]

unsigned TMDC::localLayerId ( const MdcGeoLayer * const l)
static

Definition at line 919 of file TMDC.cxx.

919 {
920 if (! l) return 9999;
921 unsigned id = l->Id();
922 if (id < 44) return id%4;
923 return 9999;
924
925/* if (id < 1) return 0;
926 else if (id < 2) return 1;
927 else if (id < 3) return 2;
928 else if (id < 4) return 3;
929 else if (id < 5) return 4;
930 else if (id < 6) return 5;
931
932 else if (id < 7) return 0;
933 else if (id < 8) return 1;
934 else if (id < 9) return 2;
935
936 else if (id < 10) return 0;
937 else if (id < 11) return 1;
938 else if (id < 12) return 2;
939 else if (id < 13) return 3;
940 else if (id < 14) return 4;
941 else if (id < 15) return 5;
942
943 else if (id < 16) return 0;
944 else if (id < 17) return 1;
945 else if (id < 18) return 2;
946
947 else if (id < 19) return 0;
948 else if (id < 20) return 1;
949 else if (id < 21) return 2;
950 else if (id < 22) return 3;
951 else if (id < 23) return 4;
952
953 else if (id < 24) return 0;
954 else if (id < 25) return 1;
955 else if (id < 26) return 2;
956 else if (id < 27) return 3;
957
958 else if (id < 28) return 0;
959 else if (id < 29) return 1;
960 else if (id < 30) return 2;
961 else if (id < 31) return 3;
962 else if (id < 32) return 4;
963
964 else if (id < 33) return 0;
965 else if (id < 34) return 1;
966 else if (id < 35) return 2;
967 else if (id < 36) return 3;
968
969 else if (id < 37) return 0;
970 else if (id < 38) return 1;
971 else if (id < 39) return 2;
972 else if (id < 40) return 3;
973 else if (id < 41) return 4;
974
975 else if (id < 42) return 0;
976 else if (id < 43) return 1;
977 else if (id < 44) return 2;
978 else if (id < 45) return 3;
979
980 else if (id < 46) return 0;
981 else if (id < 47) return 1;
982 else if (id < 48) return 2;
983 else if (id < 49) return 3;
984 else if (id < 50) return 4;
985
986 return 9999;
987*/
988}

◆ localLayerId() [2/3]

unsigned TMDC::localLayerId ( const MdcGeoWire * const w)
static

Definition at line 903 of file TMDC.cxx.

903 {
904 if (! w) return 9999;
905 return w->Layer()%4;
906
907// unsigned id = w->Id();
908// return localLayerId(id);
909}

◆ localLayerId() [3/3]

unsigned TMDC::localLayerId ( unsigned wireId)
static

Definition at line 833 of file TMDC.cxx.

833 {
834 if(id < 6860) return layerId(id)%4;
835 return 9999;
836
837/* if (id < 64) return 0;
838 else if (id < 128) return 1;
839 else if (id < 192) return 2;
840 else if (id < 256) return 3;
841 else if (id < 320) return 4;
842 else if (id < 384) return 5;
843
844 else if (id < 464) return 0;
845 else if (id < 544) return 1;
846 else if (id < 624) return 2;
847
848 else if (id < 720) return 0;
849 else if (id < 816) return 1;
850 else if (id < 912) return 2;
851 else if (id < 1008) return 3;
852 else if (id < 1104) return 4;
853 else if (id < 1200) return 5;
854
855 else if (id < 1328) return 0;
856 else if (id < 1456) return 1;
857 else if (id < 1584) return 2;
858
859 else if (id < 1728) return 0;
860 else if (id < 1872) return 1;
861 else if (id < 2016) return 2;
862 else if (id < 2160) return 3;
863 else if (id < 2304) return 4;
864
865 else if (id < 2464) return 0;
866 else if (id < 2624) return 1;
867 else if (id < 2784) return 2;
868 else if (id < 2944) return 3;
869
870 else if (id < 3136) return 0;
871 else if (id < 3328) return 1;
872 else if (id < 3520) return 2;
873 else if (id < 3712) return 3;
874 else if (id < 3904) return 4;
875
876 else if (id < 4112) return 0;
877 else if (id < 4320) return 1;
878 else if (id < 4528) return 2;
879 else if (id < 4736) return 3;
880
881 else if (id < 4976) return 0;
882 else if (id < 5216) return 1;
883 else if (id < 5456) return 2;
884 else if (id < 5696) return 3;
885 else if (id < 5936) return 4;
886
887 else if (id < 6192) return 0;
888 else if (id < 6448) return 1;
889 else if (id < 6704) return 2;
890 else if (id < 6960) return 3;
891
892 else if (id < 7248) return 0;
893 else if (id < 7536) return 1;
894 else if (id < 7824) return 2;
895 else if (id < 8112) return 3;
896 else if (id < 8400) return 4;
897
898 return 9999;
899*/
900}
static unsigned layerId(unsigned wireId)
Definition TMDC.cxx:598

Referenced by TMDCLayer::TMDCLayer().

◆ name()

std::string TMDC::name ( void ) const

returns name.

Definition at line 76 of file TMDC.cxx.

76 {
77 return "TMDC";
78}

Referenced by dump().

◆ nLayers()

unsigned TMDC::nLayers ( void ) const
inline

Definition at line 322 of file TMDC.h.

322 {
323 return _nLayers;
324}

Referenced by TMDCWire::neighbor().

◆ nLocalLayer()

unsigned TMDC::nLocalLayer ( unsigned superLayerId) const
inline

returns # of wire layers in a super layer. 0 will be returned if 'superLayerId' is invalid.

Definition at line 251 of file TMDC.h.

251 {
252 AList<TMDCLayer> * superLayer = _superLayers[superLayerId];
253 if (! superLayer) return 0;
254 return superLayer->length();
255}
static unsigned superLayerId(unsigned wireId)
Definition TMDC.cxx:765

◆ nSuperLayers()

unsigned TMDC::nSuperLayers ( void ) const
inline

Definition at line 316 of file TMDC.h.

316 {
317 return _nSuperLayers;
318}

◆ nWires()

unsigned TMDC::nWires ( void ) const
inline

Definition at line 310 of file TMDC.h.

310 {
311 return _nWires;
312}

◆ phi()

float TMDC::phi ( float phi)
inlinestatic

Definition at line 283 of file TMDC.h.

283 {
284 static const float pi2 = 2. * M_PI;
285 a = std::fmod(a, pi2);
286 if (a < 0.) return a + pi2;
287 return a;
288}
#define M_PI
Definition TConstant.h:4

Referenced by wire(), and wire().

◆ stereoHits()

const AList< TMDCWireHit > & TMDC::stereoHits ( unsigned mask = 0) const

returns a list of stereo hits. 'update()' must be called before calling this function.

Definition at line 526 of file TMDC.cxx.

526 {
527 if (! mask) return _stereoHits;
528 else if (mask == WireHitFindingValid) return _stereoHits;
529 std::cout << "TMDC::stereoHits !!! unsupported mask given" << std::endl;
530 return _stereoHits;
531}

Referenced by TrkReco::execute().

◆ superLayer()

const AList< TMDCLayer > *const TMDC::superLayer ( unsigned id) const
inline

returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.

Definition at line 271 of file TMDC.h.

271 {
272 return _superLayers[id];
273}

Referenced by TBuilder0::buildStereo(), classification(), and nLocalLayer().

◆ superLayerId() [1/3]

unsigned TMDC::superLayerId ( const MdcGeoLayer * const l)
static

Definition at line 810 of file TMDC.cxx.

810 {
811 if (! l) return 9999;
812 unsigned id = l->Id();
813
814 if(id < 44) return id/4;
815 return 9999;
816/* if (id < 6) return 0;
817 else if (id < 9) return 1;
818 else if (id < 15) return 2;
819 else if (id < 18) return 3;
820 else if (id < 23) return 4;
821 else if (id < 27) return 5;
822 else if (id < 32) return 6;
823 else if (id < 36) return 7;
824 else if (id < 41) return 8;
825 else if (id < 45) return 9;
826 else if (id < 50) return 10;
827
828 return 9999;
829*/
830}

◆ superLayerId() [2/3]

unsigned TMDC::superLayerId ( const MdcGeoWire * const w)
static

Definition at line 796 of file TMDC.cxx.

796 {
797 if (! w) return 9999;
798 unsigned id = w->Id();
799 return superLayerId(id);
800}

◆ superLayerId() [3/3]

unsigned TMDC::superLayerId ( unsigned wireId)
static

Definition at line 765 of file TMDC.cxx.

765 {
766 if (id < 188) return 0;
767 else if (id < 484) return 1;
768 else if (id < 812) return 2;
769 else if (id < 1236) return 3;
770 else if (id < 1772) return 4;
771 else if (id < 2412) return 5;
772 else if (id < 3180) return 6;
773 else if (id < 4012) return 7;
774 else if (id < 4972) return 8;
775 else if (id < 5996) return 9;
776 else if (id < 6860) return 10;
777
778 return 9999;
779/* if (id < 384) return 0;
780 else if (id < 624) return 1;
781 else if (id < 1200) return 2;
782 else if (id < 1584) return 3;
783 else if (id < 2304) return 4;
784 else if (id < 2944) return 5;
785 else if (id < 3904) return 6;
786 else if (id < 4736) return 7;
787 else if (id < 5936) return 8;
788 else if (id < 6960) return 9;
789 else if (id < 8400) return 10;
790
791 return 9999;
792*/
793}

Referenced by nLocalLayer(), superLayerId(), TMDCLayer::TMDCLayer(), and wireName().

◆ update()

void TMDC::update ( bool mcAnalysis = true)

updates TMDC information. clear() is called in this function.

Definition at line 317 of file TMDC.cxx.

317 {
318 //...Already updated?...
319//zsl if (updated()) return;
320
321 //...Clear old information...
322 fastClear();
323
324 //...Loop over RECMDC_WIRHIT bank...
325// unsigned nReccdc = BsCouTab(RECMDC_WIRHIT);
326 unsigned nReccdc = MdcRecWirhitCol::getMdcRecWirhitCol()->size();
327#ifdef TRKRECO_DEBUG
328 cout<<"size of MdcRecWirhit:"<<nReccdc<<endl;
329#endif
330 for (unsigned i = 0; i < nReccdc; i++) {
331// struct reccdc_wirhit * h =
332// (struct reccdc_wirhit *)
333// BsGetEnt(RECMDC_WIRHIT, i + 1, BBS_No_Index);
335 //...Check validity...
336//zsl if (! (h->stat & WireHitFindingValid)) continue;
337
338 //...Obtain a pointer to GEOMDC...
339// struct geocdc_wire * g =
340// (struct geocdc_wire *)
341// BsGetEnt(GEOMDC_WIRE, h->m_geo, BBS_No_Index);
342 const MdcGeoWire* g = h->geo;
343// if (_newCdc)
344// if (g->m_ID < 256)
345// continue;
346
347 //...Get a pointer to a TMDCWire...
348// TMDCWire * w = _wires[g->m_ID - 1];
349 TMDCWire * w = _wires[g->Id()];
350 _hitWires.append(w);
351
352 //...Create TMDCWireHit...
353 TMDCWireHit * hit = new TMDCWireHit(w, h, _fudgeFactor);
354 _hits.append(hit);
355
356 //... update the wirehit pointer in the TMDCWire (by zang shilei)
357 w->hit(hit);
358 //if (w->hit()) cout<<"test .......... right~~~~~"<<endl;
359
360 //...Axial or stereo...
361 if (w->axial()) _axialHits.append(hit);
362 else _stereoHits.append(hit);
363 }
364
365 //...Hit classfication...
367
368 //...MC information...
369 if (mcAnalysis) updateMC();
370
371 //...Update information...
373}
bool axial(void) const
returns true if this wire is in an axial layer.
Definition TMDCWire.h:348
void fastClear(void)
clears TMDC information.
Definition TMDC.cxx:298
void updateMC(void)
updates TMDC information for MC.
Definition TMDC.cxx:376
void classification(void)
classify hits.
Definition TMDC.cxx:445

Referenced by TrkReco::execute().

◆ updateMC()

void TMDC::updateMC ( void )

updates TMDC information for MC.

Definition at line 376 of file TMDC.cxx.

376 {
377
378 //...Create TTrackHEP...
379 TTrackHEP::update();
380
381 //...Loop over DATMDC_MCWIRHIT bank...
382 unsigned n = 0;
383// for (unsigned i = 0; i < BsCouTab(DATMDC_MCWIRHIT); i++) {
384 for (unsigned i = 0; i < MdcDatMcwirhitCol::getMdcDatMcwirhitCol()->size(); i++) {
385// struct datcdc_mcwirhit * h =
386// (struct datcdc_mcwirhit *)
387// BsGetEnt(DATMDC_MCWIRHIT, i + 1, BBS_No_Index);
389 //...Get a pointer to RECMDC_WIRHIT...
390// reccdc_wirhit * whp =
391// (reccdc_wirhit *) BsGetEnt(RECMDC_WIRHIT, h->m_dat, BBS_No_Index);
392 MdcRec_wirhit* whp = h->dat->rec;
393 //...Get TrkReco objects...
394 TMDCWireHit * wh = 0;
395 TMDCWire * w = 0;
396 if (whp) {
397 if (whp->stat & WireHitFindingValid) {
398 unsigned n = _hits.length();
399 unsigned j = (whp->id < n) ? whp->id : n;
400 while (j) {
401 --j;
402 if (_hits[j]->reccdc() == whp) {
403 wh = _hits[j];
404 w = _wires[wh->wire()->id()];
405 break;
406 }
407 }
408 }
409 }
410 if (! w) {
411// geocdc_wire * g =
412// (geocdc_wire *) BsGetEnt(GEOMDC_WIRE, h->m_geo, BBS_No_Index);
413// w = _wires[g->m_ID - 1];
414 const MdcGeoWire* g = h->geo;
415 }
416
417 //...Create TMDCWireHitMC...
418 TMDCWireHitMC * hit = new TMDCWireHitMC(w, wh, h);
419 _hitsMC.append(hit);
420 w->hit(hit);
421 if (wh) wh->mc(hit);
422
423 //...TTrackHEP...
424// TTrackHEP * hep = TTrackHEP::list()[h->m_hep - 1];
425 TTrackHEP * hep = TTrackHEP::list()[h->hep->id];
426 hit->_hep = hep;
427 if (hep) hep->_hits.append(hit);
428 else {
429 std::cout << "TMDC::updateMC !!! mission impossible" << std::endl;
430 std::cout << " This error will cause TrkReco crush";
431 std::cout << std::endl;
432#ifdef TRKRECO_DEBUG_DETAIL
433 //cout << " h->m_hep, h->m_hep -1 = " << h->m_hep;
434 //std::cout << ", " << h->m_hep - 1 << std::endl;
435 std::cout << " TTrackHEP list length = ";
436 std::cout << TTrackHEP::list().length() << std::endl;
437// BsShwDat(GEN_HEPEVT);
438// BsShwDat(DATMDC_MCWIRHIT);
439#endif
440 }
441 }
442}
static vector< MdcDat_mcwirhit > * getMdcDatMcwirhitCol(void)
const MdcGeoWire * geo
Definition MdcTables.h:659
const Gen_hepevt * hep
Definition MdcTables.h:661
MdcDat_wirhit * dat
Definition MdcTables.h:660
MdcRec_wirhit * rec
Definition MdcTables.h:78
A class to represent a MC wire hit in MDC.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
A class to represent a GEN_HEPEVT particle in tracking.
Definition TTrackHEP.h:37
static const AList< TTrackHEP > & list(void)
returns a list of TTrackHEP's.
Definition TTrackHEP.cxx:72

Referenced by update().

◆ version()

std::string TMDC::version ( void ) const

returns version.

Definition at line 81 of file TMDC.cxx.

81 {
82 return "2.18";
83}

Referenced by dump(), and getTMDC().

◆ wire() [1/4]

const TMDCWire *const TMDC::wire ( const HepPoint3D & point) const

returns a pointer to a wire.

Definition at line 250 of file TMDC.cxx.

250 {
251 float r = p.mag();
252 float phi = p.phi();
253 return wire(r, phi);
254}
static float phi(float phi)
Definition TMDC.h:283

◆ wire() [2/4]

const TMDCWire *const TMDC::wire ( float r,
float phi ) const

returns a pointer to a wire.

Definition at line 257 of file TMDC.cxx.

257 {
258
259 std::cout << "r,phi = " << r << "," << p << std::endl;
260
261 unsigned id = 25;
262 bool ok = false;
263 const TMDCLayer * l;
264 while (! ok) {
265 l = layer(id);
266 if (! l) return NULL;
267
268 const MdcGeoLayer * geo = l->geocdc();
269 if (geo->Radius()/10 + geo->RCSiz2()/10 < r) ++id;
270 else if (geo->Radius()/10 - geo->RCSiz1()/10 > r) --id;
271 else ok = true;
272 }
273// float dPhi = 2. * M_PI / float(l->nWires());
274// if (l->geocdc()->m_offset > 0.) p -= dPhi / 2.;
275 float dPhi = 2. * M_PI / float(l->nWires());
276 p -= l->geocdc()->Offset()/dPhi;
277 unsigned localId = unsigned(phi(p) / dPhi);
278 return l->wire(localId);
279}
A class to represent a wire layer.
Definition TMDCLayer.h:32
const TMDCWire *const wire(int id) const
returns a pointer to a wire. 'id' can be negative or 'id' can be greater than 'nWires()'.
Definition TMDCLayer.cxx:59
const MdcGeoLayer * geocdc(void) const
returns a pointer to GEOMDC_WIR.
Definition TMDCLayer.h:127
unsigned nWires(void) const
returns # of wires.
Definition TMDCLayer.h:139
static unsigned localId(unsigned wireId)
Definition TMDC.cxx:676
const TMDCLayer *const layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.
Definition TMDC.h:259

◆ wire() [3/4]

const TMDCWire *const TMDC::wire ( unsigned layerId,
int localId ) const

returns a pointer to a wire. 'localId' can be negative. 0 will be returned if 'layerId' is invalid.

Definition at line 242 of file TMDC.cxx.

242 {
243 if (layerId < _nLayers)
244 return _layers[layerId]->wire(localId);
245
246 return NULL;
247}

◆ wire() [4/4]

const TMDCWire *const TMDC::wire ( unsigned wireId) const
inline

returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.

Definition at line 277 of file TMDC.h.

277 {
278 return _wires[id];
279}

Referenced by TConformalFinder::conformal2Wire(), driftDistance(), TMDCWire::neighbor(), and wire().

◆ wireName() [1/3]

std::string TMDC::wireName ( const MdcGeoWire * const w)
static

Definition at line 583 of file TMDC.cxx.

583 {
584 if (! w) return std::string("no such a wire");
585// unsigned id = w->m_ID - 1;
586 unsigned id = w->Id();
587 return wireName(id);
588}
static std::string wireName(unsigned wireId)
Definition TMDC.cxx:575

◆ wireName() [2/3]

std::string TMDC::wireName ( const MdcRec_wirhit & h)
static

Definition at line 1020 of file TMDC.cxx.

1020 {
1021// geocdc_wire * g = (geocdc_wire *) BsGetEnt(GEOMDC_WIRE,
1022// h.m_geo,
1023// BBS_No_Index);
1024 const MdcGeoWire* g = h.geo;
1025 return wireName(g);
1026}

◆ wireName() [3/3]

std::string TMDC::wireName ( unsigned wireId)
static

Definition at line 575 of file TMDC.cxx.

575 {
576 if (superLayerId(wireId) % 2)
577 return itostring(layerId(wireId)) + "=" +
578 itostring(localId(wireId));
579 return itostring(layerId(wireId)) + "-" + itostring(localId(wireId));
580}

Referenced by wireName(), and wireName().


The documentation for this class was generated from the following files: