17#define HEP_SHORT_NAMES
18#include "CLHEP/Vector/ThreeVector.h"
26#include "CLHEP/Matrix/Vector.h"
28using CLHEP::HepVector;
74 std::cout <<
"tsf : " << _wires.length() <<
" : ";
75 for (
unsigned i = 0; i < _wires.length(); i++) {
77 std::cout <<
w->layerId() <<
"-" <<
w->localId() <<
", ";
79 std::cout << std::endl;
88 unsigned localId =
w->localLayerId();
89 unsigned superId =
w->superLayerId();
92 std::cout <<
"TMDCTsf::create !!! can not create TSF for wire ";
93 std::cout << superId <<
"-" << localId <<
" because of ";
94 std::cout <<
"lack of layer(s)." << std::endl;
97 availableLayer = (availableLayer > offset.length())
98 ? offset.length() : availableLayer;
101 bool offsetLayer =
false;
102 if (
w->layer()->offset() != 0.) offsetLayer =
true;
105 for (
unsigned l = 0; l < availableLayer; l++) {
106 unsigned absLayerId =
w->layerId() + l;
108 wireId[0] =
w->localId() + (* offset[l]);
109 wireId[1] =
w->localId() + (* offset[l]);
110 if (offsetLayer) ++wireId[1];
113 for (
unsigned j = 0; j < * (width[l]); j++) {
205 for (
int i=0; i<_all.length(); ++i) {
206 if (_all[i]->wire()->localLayerId() == 0) seeds1.append(_all[i]);
207 else if (_all[i]->wire()->localLayerId() == 1) seeds2.append(_all[i]);
211 unsigned n = list.length();
214 for (
unsigned i = 0; i < n; ++i) {
215 seedNeighbors.removeAll();
219 for (
int j=0; j<c->
links().length(); ++j){
220 if (c->
links()[j]->wire()->localLayerId() > 0)
continue;
221 unsigned seedId = c->
links()[j]->wire()->localId();
222 for (
int k=0; k<seeds1.length(); ++k){
223 if (seeds1[k]->wire()->localIdForPlus()+1 == seedId
224 || seeds1[k]->wire()->localIdForMinus()-1 == seedId) seedNeighbors.append(seeds1[k]);
232 if (newClusters.length() == 0)
continue;
233 list.append(newClusters);
235 list.remove(splitted);
236 HepAListDeleteAll(splitted);
243 for (
unsigned i = 0; i < n; ++i) {
244 seedNeighbors.removeAll();
248 for (
int j=0; j<c->
links().length(); ++j){
249 if (c->
links()[j]->wire()->localLayerId() != 1)
continue;
250 unsigned seedId = c->
links()[j]->wire()->localId();
251 for (
int k=0; k<seeds2.length(); ++k){
252 if (seeds2[k]->wire()->localIdForPlus()+1 == seedId
253 || seeds2[k]->wire()->localIdForMinus()-1 == seedId) seedNeighbors.append(seeds2[k]);
261 if (newClusters2.length() == 0)
continue;
262 list2.append(newClusters2);
264 list2.remove(splitted2);
265 HepAListDeleteAll(splitted2);
272 for(
int i = 0; i < list.length(); ++i){
273 for(
int j = i+1; j < list.length(); ++j){
276 for (
int k = 0; k < links.length(); ++k){
278 if (list[i]->links().hasMember(l)) multiLinks.append(l);
280 if (multiLinks.length() < 2)
continue;
281 unsigned minLength = links.length();
282 if (links.length() > list[i]->links().length()) minLength = list[i]->links().length();
283 if (minLength - multiLinks.length() > 1)
continue;
286 for (
int k = 0; k < multiLinks.length(); ++k)
287 ++nHits[multiLinks[k]->hit()->wire()->localLayerId()];
288 for (
int k = 0; k < 4; ++k)
289 if (nHits[k] > 0) ++multiLayers;
290 if(multiLayers >= 2 && (links.length() > list[i]->links().length())) badList.append(list[i]);
291 else if (multiLayers >= 2) badList.append(list[j]);
295 list.remove(badList);
298 for (
int i = 0; i < badList.length(); ++i) {
300 for (
int j = 0; j < bads.length(); ++j) {
301 unsigned n = bads[j]->tsfTag();
309 HepAListDeleteAll(badList);
322 unsigned n = _all.length();
323 if (n < 3)
return list;
324 if (seedlayer == 1 && _sl == 10)
return list;
326 for (
unsigned i = 0; i < n; ++i) {
333 for (
unsigned i = 0; i < seeds.length(); ++i) {
341 float phi = phi0 + local*2*
pi/nWir;
343 forSegment.append(seed);
346 int hitsOnLayer[3] = {0, 0, 0};
348 for (
unsigned m = 0; m < exhits.length(); ++ m) {
355 int localOffset = (int)((phi-phi0tmp)/(2*
pi/nWirtmp));
357 int diff =
abs(tmpLocal - localOffset);
359 if (diff > nWirtmp / 2) diff = nWirtmp - diff;
362 if (diff > lLayer + 2)
continue;
371 forSegment.append(l);
372 ++hitsOnLayer[lLayer - 1 - seedlayer];
378 for (
unsigned j = 0; j < 3; ++j) {
379 if (hitsOnLayer[j] > 0) ++fireLayers;
381 if (fireLayers < 2) {
384 list.append(
new TSegment(forSegment));
390TMDCTsf::alpha(
unsigned sl,
TMLink * seed)
const{
391 double radius[11] = { 11.525, 16.160, 24.555, 31.060, 37.455, 44.760, 51.370, 57.855, 64.165, 71.570, 76.345 };
394 if (sl < 2) rcell = 0.6;
396 pa.set(0, 2 / radius[sl], 0);
397 pb.set(-2*rcell/(rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 2*(radius[sl]+rcell)/(rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 0);
398 pc.set(2*rcell/(rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 2*(radius[sl]+rcell)/(rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 0);
399 cout<<
"sl = "<<sl<<
"alpha2 = "<<acos((pb - pa).
unit().dot((pc - pa).
unit()))/2<<endl;
401 pa2.set(0, 2 / radius[sl], 0);
402 pb2.set(-6*rcell/(9*rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 2*(radius[sl]+rcell)/(9*rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 0);
403 pc2.set(6*rcell/(9*rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 2*(radius[sl]+rcell)/(9*rcell*rcell + (radius[sl]+rcell)*(radius[sl]+rcell)), 0);
404 cout<<
"alpha22 = "<<acos((pb2 - pa2).
unit().dot((pc2 - pa2).
unit()))/2<<endl;
*******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 saves r n generator level $ !Flag for chat level in !Latex Output unit
#define TMDCTSF_MIN_LAYERS
float offset(void) const
returns offset.
unsigned nWires(void) const
returns # of wires.
TMDCTsf(unsigned sl)
Constructor of fixed shape.
AList< TSegment > createTsf(unsigned) const
AList< TSegment > segments(const AList< TMLink > &links)
finds segments.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void solveLeftRight(void)
solves left-right ambiguityies.
virtual ~TMDCTsf()
Destructor.
A class to represent a wire in MDC.
unsigned localLayerId(void) const
returns local layer id in a super layer.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
unsigned nLocalLayer(unsigned superLayerId) const
returns # of wire layers in a super layer. 0 will be returned if 'superLayerId' is invalid.
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
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.
A class to relate TMDCWireHit and TTrack objects.
const HepPoint3D & position(void) const
returns position.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
A class to relate TMDCWireHit and TTrack objects.
AList< TSegment > splitTsf(AList< TMLink > &)
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.