StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gl3Cylinder.cxx
1 #include "gl3Cylinder.h"
2 
3 #include "Stl3Util/base/FtfLog.h"
4 
5 gl3Cylinder::gl3Cylinder() : minNoOfHitsOnTrack(10)
6 {
7 }
8 
9 
10 //####################################################################
11 //
12 //####################################################################
13 int gl3Cylinder::setParameters(int GI1_in, int GI2_in,
14  int GI3_in, int GI4_in,
15  int GI5_in,
16  float GF1_in, float GF2_in,
17  float GF3_in, float GF4_in,
18  float GF5_in)
19 {
20  bool errorFlag = false;
21 
22  gl3Algorithm::setParameters(GI1_in, GI2_in, GI3_in, GI4_in, GI5_in,
23  GF1_in, GF2_in, GF3_in, GF4_in, GF5_in);
24 
25  float & minZ = GF1;
26  float & maxZ = GF2;
27  float & radius = GF3;
28 
29  int & minTracksInCylinder = GI1;
30 
31 
32  if (minZ >= maxZ) {
33  ftfLog("%s: invalid parameters: minZ >= maxZ (%f >= %f)\n",
34  getAlgorithmName(), minZ, maxZ);
35  errorFlag = true;
36  }
37 
38  if (radius < 0) {
39  ftfLog("%s: invalid parameters: negative radius (%f)\n",
40  getAlgorithmName(), radius);
41  errorFlag = true;
42  }
43 
44  if (minTracksInCylinder < 1) {
45  ftfLog("%s: invalid parameters: invalid min no. of tracks in cylinder (%f)\n",
46  getAlgorithmName(), minTracksInCylinder);
47  errorFlag = true;
48  }
49 
50  return errorFlag;
51 }
52 
53 //####################################################################
54 //
55 //####################################################################
56 int gl3Cylinder::decide ( )
57 {
58  int nTracksInCyl = 0;
59 
60  float & minZ = GF1;
61  float & maxZ = GF2;
62  float & radius = GF3;
63 
64  int & minTracksInCylinder = GI1;
65 
66 
67  // loop over global tracks
68  for (int trkcnt = 0 ; trkcnt<event->getNTracks(); trkcnt++ ) {
69  gl3Track *gTrack = event->getTrack(trkcnt);
70 
71  // acept only tracks with nHits more then minNoOfHitsOnTrack
72  if(gTrack->nHits > minNoOfHitsOnTrack) {
73  Ftf3DHit hit = gTrack->extraRadius(radius);
74  // fill histos with the coordinates of the closest point to x=y=0
75 
76  if ( hit.x != 0. || hit.y != 0. || hit.z != 0. ) {
77  //ftfLog("Extrapolated point: %d %d %d\n",
78  // hit.x, hit.y, hit.z);
79 
80  if ( hit.z >= minZ && hit.z <= maxZ) {
81  //ftfLog("Triggered!!!");
82 
83  // the track hits the cylinder
84  nTracksInCyl++;
85  }
86  }
87  }
88  }
89 
90  // DECISION
91  if( nTracksInCyl >= minTracksInCylinder )
92  return 1;
93  else
94  return 0;
95 }
96