3#include "MdcTrkRecon/MdcSeg.h"
6#include "MdcGeom/BesAngle.h"
7#include "MdcTrkRecon/mdcWrapAng.h"
8#include "MdcTrkRecon/mdcWrapWire.h"
9#include "MdcTrkRecon/MdcLine.h"
10#include "MdcTrkRecon/MdcSegParams.h"
11#include "MdcData/MdcHit.h"
12#include "MdcGeom/MdcSuperLayer.h"
13#include "MdcGeom/MdcLayer.h"
14#include "MdcTrkRecon/MdcSegInfoSterO.h"
15#include "MdcTrkRecon/MdcSegUsage.h"
16#include "MdcTrkRecon/MdcMap.h"
17#include "MdcData/MdcHitUse.h"
18#include "MdcData/MdcHitMap.h"
21#include "AIDA/IHistogram1D.h"
44 if (_info != 0)
delete _info;
50 GmsListLink(), _slayer(other._slayer), _phi(other._phi), _slope(other._slope), _chisq(other._chisq), _qual(other._qual), _pattern(other._pattern), _info(other._info), _bunchTime(other._bunchTime)
53 HepAListDeleteAll(_theList);
54 for(
int i=0; i<other.nHit(); i++){
55 _theList.append(other.hit(i));
57 for(
int j=0; j<3; j++){
58 _errmat[0] = other._errmat[0];
59 _errmat[1] = other._errmat[1];
60 _errmat[2] = other._errmat[2];
62 segParam = other.segParam;
71 HepAListDeleteAll(_theList);
72 for(
int i=0; i<other.nHit(); i++){
73 _theList.append(other.hit(i));
75 _slayer = other._slayer;
78 _errmat[0] = other._errmat[0];
79 _errmat[1] = other._errmat[1];
80 _errmat[2] = other._errmat[2];
81 _chisq = other._chisq;
83 _pattern = other._pattern;
85 _bunchTime = other._bunchTime;
86 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++) {
137 _errmat[0] = inError[0];
138 _errmat[1] = inError[1];
139 _errmat[2] = inError[2];
150 for (
int i = 0; i <
nHit(); i++) {
153 if ( usedHits.
get( alink->
mdcHit() ,
x) )
x->setUsedAmbig( alink->
ambig() );
163 for (
int ihit=0 ; ihit<
nHit() ; ihit++){
165 std::cout << setw(2)<<
hit(ihit)->
ambig()<<
" ";
168 cout<<setiosflags(ios::fixed);
170 std::cout<<
" phi " << setprecision(2) <<
phi()
171 <<
" slope " <<std::setw(2)<< setprecision(2) <<
slope()<<
" ";
173 std::cout <<setprecision (2) <<
"phi0="<<
info()->
par(0);
174 cout<<setprecision(5)<<
" cpa="<<
info()->
par(1);
176 std::cout <<setprecision(2)<<
"z0="<<
info()->
par(0)
177 <<setprecision(2)<<
" ct="<<
info()->
par(1);
179 if(fabs(
info()->arc())>0.0001){
180 std::cout<<setprecision(2)<<
" arc="<<
info()->
arc();
182 std::cout<<setprecision(3)<<
" chi2="<<_chisq;
184 std::cout<<
" phi " << setprecision(2) <<
phi()
185 <<
" slope " <<std::setw(2)<< setprecision(2) <<
slope()
186 <<
" chi2 "<<setprecision(3) <<
chisq();
189 cout<<setprecision(6);
190 cout<<setiosflags(ios::scientific);
197 for (
int ihit=0 ; ihit<
nHit() ; ihit++){
199 std::cout <<
hit(ihit)->
ambig()<<
" ";
242 int cell[2], ambig[2];
244 int cellused[4] = {0};
251 for (
int i = 0; i <
nHit(); i++) {
254 cellused[laynum - firstnum ] = dHit->
wirenumber();
261 int laynum = layer->
layNum();
264 double rinv = 1. / layer->
rMid();
265 double ncellinv = 1. / (double) layer->
nWires();
269 cell[0] = (int) floor(layer->
nWires() *
270 tmp.rad() /
twoPi + 0.5);
275 ambig[0] = (phiwire[0] < phiproj) ? 1 : -1;
278 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++) {
286 if (cellused[laynum - firstnum] == cell[iroad])
continue;
287 if(m_debug) std::cout<<
"possible wires "<<laynum<<
" "<<cell[iroad]<<std::endl;
288 if (map->
hitWire(laynum, cell[iroad]) != 0) {
292 if(m_debug) std::cout<<
"hit used continue " <<std::endl;
303 if (
g_nSigAdd && fabs(sigphi)>0.0001 ) {
g_nSigAdd->fill(fabs(phihit - phiproj) / sigphi); }
304 if ( fabs(phihit - phiproj) > sigphi * segParam->
nsigAddHit ) {
305 if(m_debug) std::cout<< fabs(phihit-phiproj) <<
"> add hit sigma "
312 span->
sigma[nhits] = sigphi;
334 _slope = span->
slope;
335 _chisq = span->
chisq;
336 _errmat[0] = span->
errmat[0];
337 _errmat[1] = span->
errmat[1];
338 _errmat[2] = span->
errmat[2];
348 HepAListDeleteAll( _theList );
355 _theList.append(theHitUse);
362 _theList.remove(theHitUse);
370 return _theList.length();
379 for (
int i=0; i<
nHit(); i++){
393 for (
int i=0; i<testSeg->
nHit(); i++){
402 return nSame/testSeg->
nHit();
409 double truthPt = -1.;
410 for (
int i=0; i<
nHit(); i++){
426 double truthTheta = -999.;
427 for (
int i=0; i<
nHit(); i++){
443 double truthPhi = -999.;
444 for (
int i=0; i<
nHit(); i++){
450 if (truthPhi<-998.){ truthPhi =
haveDigiPhi[l][w]; }
461 for (
int i=0; i<
nHit(); i++){
468 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)
int haveDigiAmbig[43][288]
double haveDigiPhi[43][288]
AIDA::IHistogram1D * g_nSigAdd
double haveDigiTheta[43][288]
double haveDigiPt[43][288]
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