16#include "TrkReco/TCircle.h"
17#include "TrkReco/THistogram.h"
20 _binSize = 2. *
M_PI / (float)_nBins;
21 _bins = (
unsigned*)malloc( _nBins *
sizeof(
unsigned ) );
22 _masks = (
bool*)malloc( _nBins *
sizeof(
bool ) );
24 for (
unsigned i = 0; i < _nBins; i++ )
35 for (
unsigned i = 0; i < _nBins; i++ )
delete _links[i];
41 std::cout <<
"THistogram dump:#bins=" << _nBins << std::endl;
42 unsigned nLoops = _nBins / 15 + 1;
45 for (
unsigned i = 0; i < nLoops; i++ )
47 for (
unsigned j = 0; j < 15; j++ )
49 if ( n0 == _nBins )
break;
53 std::cout << std::endl;
54 for (
unsigned j = 0; j < 15; j++ )
56 if (
n1 == _nBins )
break;
57 if ( !_masks[
n1] ) printf(
"%4d", _bins[
n1] );
58 else printf(
"-%3d", _bins[
n1] );
61 std::cout << std::endl;
64 if ( msg.find(
"detail" ) != std::string::npos )
66 for (
unsigned i = 0; i < _nBins; i++ )
68 std::cout <<
"bin " << i <<
" : ";
69 for (
unsigned j = 0; j < _links[i]->length(); j++ )
70 { std::cout << ( *_links[i] )[j]->wire()->name() <<
","; }
71 std::cout << std::endl;
80 unsigned nLinks = links.length();
81 double offset = _binSize / 4.;
82 for (
unsigned i = 0; i < nLinks; i++ )
86 unsigned pos = (unsigned)floor( ( p.x() + offset ) / _binSize );
92 _links[pos]->append( l );
98 unsigned nLinks = links.length();
99 for (
unsigned i = 0; i < nLinks; i++ )
103 unsigned pos = (unsigned)floor( p.y() / _binSize );
109 _links[pos]->append( l );
115 unsigned nLinks = links.length();
116 double offset = _binSize / 4.;
117 for (
unsigned i = 0; i < nLinks; i++ )
121 float phi = atan2( p.y(), p.x() ) +
M_PI;
123 unsigned pos = (unsigned)floor( ( phi + offset ) / _binSize );
134 _links[pos]->append( l );
139 for (
unsigned i = 0; i < _nBins; i++ )
141 _links[i]->remove( links );
142 _bins[i] = _links[i]->length();
144 _all.remove( links );
149 for (
int i = -(
int)width; i <= (int)width; i++ )
150 { links.append( *
bin( (
int)center + i ) ); }
156 for (
int i = start; i <= end; i++ ) links.append( *
bin( i ) );
165 while ( _bins[begin] > 0 ) begin++;
166 if ( begin == _nBins )
return list;
170 while ( loop < _nBins )
173 unsigned id = ( begin + loop ) % _nBins;
180 if ( _bins[
id] ) ++size;
183 id = ( begin + loop ) % _nBins;
184 if ( loop == _nBins )
break;
196 unsigned n = list.length();
197 if (
n == 0 )
return list;
201 for (
unsigned i = 0; i <
n; i++ )
206 if ( newClusters.length() == 0 )
212 list.append( newClusters );
213 splitted.append( c );
214#ifdef TRKRECO_DEBUG_DETAIL
215 c->
dump(
"hits",
" " );
216 std::cout <<
" ... splitted as" << std::endl;
217 for (
unsigned j = 0; j < newClusters.length(); j++ )
219 std::cout <<
" " << j <<
" : ";
220 newClusters[j]->dump(
"hits" );
224 list.remove( splitted );
225 HepAListDeleteAll( splitted );
235 while ( _bins[begin] > 0 ) begin++;
236 if ( begin == _nBins )
return list;
240 while ( loop < _nBins )
243 unsigned id = ( begin + loop ) % _nBins;
250 if ( _bins[
id] ) ++size;
253 id = ( begin + loop ) % _nBins;
254 if ( loop == _nBins )
break;
271 unsigned n = list.length();
272 if (
n == 0 )
return list;
276 for (
unsigned i = 0; i <
n; i++ )
280#ifdef TRKRECO_DEBUG_DETAIL
281 std::cout <<
" base segment : ";
286 if ( newClusters.length() == 0 )
288#ifdef TRKRECO_DEBUG_DETAIL
289 std::cout <<
" ... Solving dual hits" << std::endl;
295 list.append( newClusters );
296 splitted.append( c );
297#ifdef TRKRECO_DEBUG_DETAIL
298 c->
dump(
"hits",
" " );
299 std::cout <<
" ... splitted as" << std::endl;
300 for (
unsigned j = 0; j < newClusters.length(); j++ )
302 std::cout <<
" " << j <<
" : ";
303 newClusters[j]->dump(
"hits" );
307 list.remove( splitted );
308 HepAListDeleteAll( splitted );
HepGeom::Point3D< double > HepPoint3D
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
const AList< TMLink > & contents(void) const
returns an AList<TMLink> of all contents.
virtual ~THistogram()
Destructor.
THistogram(unsigned nBins)
Constructor.
unsigned nBins(void) const
returns # of bins.
AList< TSegment0 > clusters0(void) const
returns an AList<TSegment0> of clusters.
void fillX(const AList< TMLink > &links)
fills with hits.
void remove(const AList< TMLink > &links)
removes links.
AList< TSegment > segments(void) const
returns an AList<TSegment0> using clusters() function.
AList< TSegment0 > segments0(void) const
returns an AList<TSegment0> using clusters() function.
const AList< TMLink > *const bin(unsigned i) const
returns a pointer to i'th AList<TMLink>.
void fillY(const AList< TMLink > &links)
fills with hits.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void fillPhi(const AList< TMLink > &links)
fills with hits.
AList< TSegment > clusters(void) const
returns an AList<TSegment0> of clusters.
A class to relate TMDCWireHit and TTrack objects.
const HepPoint3D & position(void) const
returns position.
A class to relate TMDCWireHit and TTrack objects.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
AList< TSegment0 > split(void) const
A class to relate TMDCWireHit and TTrack objects.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
AList< TSegment > split(void) const
void append(TMLink &)
appends a TMLink.