3#include "MdcTrkRecon/MdcSeg.h"
4#include "MdcData/MdcHit.h"
5#include "MdcData/MdcHitMap.h"
6#include "MdcData/MdcHitUse.h"
7#include "MdcGeom/BesAngle.h"
8#include "MdcGeom/MdcLayer.h"
9#include "MdcGeom/MdcSuperLayer.h"
10#include "MdcTrkRecon/MdcLine.h"
11#include "MdcTrkRecon/MdcMap.h"
12#include "MdcTrkRecon/MdcSegInfoSterO.h"
13#include "MdcTrkRecon/MdcSegParams.h"
14#include "MdcTrkRecon/MdcSegUsage.h"
15#include "MdcTrkRecon/mdcWrapAng.h"
16#include "MdcTrkRecon/mdcWrapWire.h"
21#include "AIDA/IHistogram1D.h"
43 if ( _info != 0 )
delete _info;
50 , _slayer( other._slayer )
52 , _slope( other._slope )
53 , _chisq( other._chisq )
54 , _qual( other._qual )
55 , _pattern( other._pattern )
56 , _info( other._info )
57 , _bunchTime( other._bunchTime )
60 HepAListDeleteAll( _theList );
61 for (
int i = 0; i < other.nHit(); i++ ) { _theList.append( other.hit( i ) ); }
62 for (
int j = 0; j < 3; j++ )
64 _errmat[0] = other._errmat[0];
65 _errmat[1] = other._errmat[1];
66 _errmat[2] = other._errmat[2];
68 segParam = other.segParam;
77 HepAListDeleteAll( _theList );
78 for (
int i = 0; i < other.nHit(); i++ ) { _theList.append( other.hit( i ) ); }
79 _slayer = other._slayer;
81 _slope = other._slope;
82 _errmat[0] = other._errmat[0];
83 _errmat[1] = other._errmat[1];
84 _errmat[2] = other._errmat[2];
85 _chisq = other._chisq;
87 _pattern = other._pattern;
89 _bunchTime = other._bunchTime;
90 segParam = other.segParam;
110 _slope = span->
slope;
111 _chisq = span->
chisq;
112 _errmat[0] = span->
errmat[0];
113 _errmat[1] = span->
errmat[1];
114 _errmat[2] = span->
errmat[2];
117 for (
int i = 0; i < nhit; i++ )
136 _errmat[0] = inError[0];
137 _errmat[1] = inError[1];
138 _errmat[2] = inError[2];
148 for (
int i = 0; i <
nHit(); i++ )
162 for (
int ihit = 0; ihit <
nHit(); ihit++ )
165 std::cout << setw( 2 ) <<
hit( ihit )->
ambig() <<
" ";
169 if (
info() != NULL )
171 std::cout <<
" phi " << setprecision( 2 ) <<
phi() <<
" slope " << std::setw( 2 )
172 << setprecision( 2 ) <<
slope() <<
" ";
175 std::cout << setprecision( 2 ) <<
"phi0=" <<
info()->
par( 0 );
176 cout << setprecision( 5 ) <<
" cpa=" <<
info()->
par( 1 );
180 std::cout << setprecision( 2 ) <<
"z0=" <<
info()->
par( 0 ) << setprecision( 2 )
183 if ( fabs(
info()->arc() ) > 0.0001 )
184 { std::cout << setprecision( 2 ) <<
" arc=" <<
info()->
arc(); }
185 std::cout << setprecision( 3 ) <<
" chi2=" << _chisq;
189 std::cout <<
" phi " << setprecision( 2 ) <<
phi() <<
" slope " << std::setw( 2 )
190 << setprecision( 2 ) <<
slope() <<
" chi2 " << setprecision( 3 ) <<
chisq();
193 std::cout << std::defaultfloat;
201 for (
int ihit = 0; ihit <
nHit(); ihit++ )
204 std::cout <<
hit( ihit )->
ambig() <<
" ";
206 if (
info() != NULL ) { cout <<
" . "; }
243 int cell[2], ambig[2];
245 int cellused[4] = { 0 };
252 for (
int i = 0; i <
nHit(); i++ )
256 cellused[laynum - firstnum] = dHit->
wirenumber();
264 int laynum = layer->
layNum();
267 double rinv = 1. / layer->
rMid();
268 double ncellinv = 1. / (double)layer->
nWires();
271 BesAngle tmp( phiproj - layer->
phiOffset() );
272 cell[0] = (int)floor( layer->
nWires() * tmp.rad() /
twoPi + 0.5 );
276 ambig[0] = ( phiwire[0] < phiproj ) ? 1 : -1;
279 ambig[1] = -ambig[0];
283 if ( m_debug ) std::cout <<
" loop over the two possible wires " << std::endl;
285 for (
int iroad = 0; iroad < 2; iroad++ )
287 if ( cellused[laynum - firstnum] == cell[iroad] )
continue;
289 std::cout <<
"possible wires " << laynum <<
" " << cell[iroad] << std::endl;
290 if ( map->
hitWire( laynum, cell[iroad] ) != 0 )
292 MdcHit* ahit = map->
hitWire( laynum, cell[iroad] );
296 if ( m_debug ) std::cout <<
"hit used continue " << std::endl;
307 if (
g_nSigAdd && fabs( sigphi ) > 0.0001 )
308 {
g_nSigAdd->fill( fabs( phihit - phiproj ) / sigphi ); }
309 if ( fabs( phihit - phiproj ) > sigphi * segParam->nsigAddHit )
312 std::cout << fabs( phihit - phiproj ) <<
"> add hit sigma " << sigphi <<
"*"
313 << segParam->nsigAddHit <<
"=" << sigphi * segParam->nsigAddHit
320 span->
sigma[nhits] = sigphi;
325 MdcHitUse* alink =
new MdcHitUse( *ahit,
superlayer()->rad0(), ambig[iroad] );
342 _slope = span->
slope;
343 _chisq = span->
chisq;
344 _errmat[0] = span->
errmat[0];
345 _errmat[1] = span->
errmat[1];
346 _errmat[2] = span->
errmat[2];
353void MdcSeg::reset() {
355 HepAListDeleteAll( _theList );
361 _theList.append( theHitUse );
367 _theList.remove( theHitUse );
374 return _theList.length();
381 for (
int i = 0; i <
nHit(); i++ )
397 for (
int i = 0; i < testSeg->
nHit(); i++ )
405 return nSame / testSeg->
nHit();
411 double truthPt = -1.;
412 for (
int i = 0; i <
nHit(); i++ )
429 double truthTheta = -999.;
430 for (
int i = 0; i <
nHit(); i++ )
447 double truthPhi = -999.;
448 for (
int i = 0; i <
nHit(); i++ )
456 if ( truthPhi < -998. ) { truthPhi =
haveDigiPhi[l][
w]; }
466 for (
int i = 0; i <
nHit(); i++ )
474 return ambigOk /
nHit();
int haveDigiAmbig[43][288]
double haveDigiPhi[43][288]
AIDA::IHistogram1D * g_nSigAdd
double haveDigiTheta[43][288]
double haveDigiPt[43][288]
double mdcWrapAng(double phi1, double phi2)
int mdcWrapWire(int wireIn, int nCell)
const unsigned segFullFlag
static const double twoPi
MdcHit * hitWire(int lay, int wire) const
const MdcHit * mdcHit() const
unsigned layernumber() const
unsigned wirenumber() const
void print(std::ostream &o) const
double sigma(double, int, double, double, double) const
double driftDist(double, int, double, double, double) const
double phiOffset(void) const
bool get(const K &theKey, V &theAnswer) const
const MdcSuperLayer * superlayer() const
double testCombSegTheta() const
void setValues(int nInPatt, int nhit, MdcHit *hits[], MdcLine *span, const MdcSuperLayer *slay, int ambig[])
double testCombSegPhi() const
double testCombSegAmbig() const
double testCombSeg(const MdcSeg *) const
MdcSeg & operator=(const MdcSeg &)
MdcSegInfo * info() const
int addHits(MdcLine *span, MdcHit *hits[], const MdcHitMap *, double corr)
unsigned segPattern() const
double testCombSegPt() const
MdcHitUse * hit(int i) const
void setInfo(MdcSegInfo *ptr)
void markHits(const MdcMap< const MdcHit *, MdcSegUsage * > &usedHits) const
const MdcLayer * layer(int i) const
const MdcLayer * firstLayer(void) const