CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
EcalTBHodoscopeRecInfoAlgo Class Reference

#include <EcalTBHodoscopeRecInfoAlgo.h>

Classes

class  BeamTrack
 Class to hold track information. More...
 

Public Member Functions

 EcalTBHodoscopeRecInfoAlgo ()
 
 EcalTBHodoscopeRecInfoAlgo (int fitMethod, const std::vector< double > &planeShift, const std::vector< double > &zPosition)
 
EcalTBHodoscopeRecInfo reconstruct (const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
 
 ~EcalTBHodoscopeRecInfoAlgo ()
 

Private Member Functions

void clusterPos (float &x, float &xQuality, const int &ipl, const int &xclus, const int &wclus) const
 
void fitHodo (float &x, float &xQuality, const int &ipl, const int &nclus, const std::vector< int > &xclus, const std::vector< int > &wclus) const
 
void fitLine (float &x, float &xSlope, float &xQuality, const int &ipl1, const int &nclus1, const std::vector< int > &xclus1, const std::vector< int > &wclus1, const int &ipl2, const int &nclus2, const std::vector< int > &xclus2, const std::vector< int > &wclus2) const
 

Private Attributes

int fitMethod_
 
EcalTBHodoscopeGeometrymyGeometry_
 
std::vector< double > planeShift_
 
std::vector< double > zPosition_
 

Detailed Description

Definition at line 12 of file EcalTBHodoscopeRecInfoAlgo.h.

Constructor & Destructor Documentation

EcalTBHodoscopeRecInfoAlgo::EcalTBHodoscopeRecInfoAlgo ( )
EcalTBHodoscopeRecInfoAlgo::EcalTBHodoscopeRecInfoAlgo ( int  fitMethod,
const std::vector< double > &  planeShift,
const std::vector< double > &  zPosition 
)
explicit

Definition at line 6 of file EcalTBHodoscopeRecInfoAlgo.cc.

References myGeometry_.

EcalTBHodoscopeRecInfoAlgo::~EcalTBHodoscopeRecInfoAlgo ( )
inline

Definition at line 19 of file EcalTBHodoscopeRecInfoAlgo.h.

References myGeometry_.

20  {
21  if (myGeometry_)
22  delete myGeometry_;
23  };
EcalTBHodoscopeGeometry * myGeometry_

Member Function Documentation

void EcalTBHodoscopeRecInfoAlgo::clusterPos ( float &  x,
float &  xQuality,
const int &  ipl,
const int &  xclus,
const int &  wclus 
) const
private

Definition at line 11 of file EcalTBHodoscopeRecInfoAlgo.cc.

References EcalTBHodoscopeGeometry::getFibreLp(), EcalTBHodoscopeGeometry::getFibreRp(), myGeometry_, and planeShift_.

Referenced by fitHodo(), and fitLine().

12 {
13  if ( width == 1 ) {
14  // Single fiber
15  x = (myGeometry_->getFibreLp(ipl,xclus) + myGeometry_->getFibreRp(ipl,xclus))/2.0 -
16  planeShift_[ipl];
17  xQuality = (myGeometry_->getFibreRp(ipl,xclus) - myGeometry_->getFibreLp(ipl,xclus));
18  } else if ( width == 2 ) {
19  // Two half overlapped fibers
20  x = (myGeometry_->getFibreLp(ipl,xclus+1) + myGeometry_->getFibreRp(ipl,xclus))/2.0 -
21  planeShift_[ipl];
22  xQuality =(myGeometry_->getFibreRp(ipl,xclus)-myGeometry_->getFibreLp(ipl,xclus+1));
23  } else {
24  // More then two fibers case
25  x = (myGeometry_->getFibreLp(ipl,xclus) +myGeometry_->getFibreRp(ipl,xclus+width-1))/2.0 -
26  planeShift_[ipl];
27  xQuality =(myGeometry_->getFibreRp(ipl,xclus+width-1) - myGeometry_->getFibreLp(ipl,xclus));
28  }
29 }
static float getFibreLp(int plane, int fibre)
static float getFibreRp(int plane, int fibre)
Definition: DDAxes.h:10
EcalTBHodoscopeGeometry * myGeometry_
void EcalTBHodoscopeRecInfoAlgo::fitHodo ( float &  x,
float &  xQuality,
const int &  ipl,
const int &  nclus,
const std::vector< int > &  xclus,
const std::vector< int > &  wclus 
) const
private

Definition at line 31 of file EcalTBHodoscopeRecInfoAlgo.cc.

References clusterPos().

Referenced by fitLine(), and reconstruct().

33 {
34  if ( nclus == 1 ) {
35  // Fill real x as mean position inside the cluster
36  // Quality - width of cluster
37  // To calculate sigma one can do sigma=sqrt(Quality**2/12.0)
38  clusterPos(x, xQuality, ipl, xclus[0], wclus[0]);
39  } else {
40  xQuality = -10 - nclus;
41  }
42 }
void clusterPos(float &x, float &xQuality, const int &ipl, const int &xclus, const int &wclus) const
Definition: DDAxes.h:10
void EcalTBHodoscopeRecInfoAlgo::fitLine ( float &  x,
float &  xSlope,
float &  xQuality,
const int &  ipl1,
const int &  nclus1,
const std::vector< int > &  xclus1,
const std::vector< int > &  wclus1,
const int &  ipl2,
const int &  nclus2,
const std::vector< int > &  xclus2,
const std::vector< int > &  wclus2 
) const
private

Definition at line 44 of file EcalTBHodoscopeRecInfoAlgo.cc.

References clusterPos(), fitHodo(), testEve_cfg::tracks, and zPosition_.

Referenced by reconstruct().

47 {
48  if ( nclus1 == 0 ) { // Fit with one plane
49  fitHodo(x, xQuality, ipl2,nclus2,xclus2,wclus2);
50  xSlope = 0.0; //?? Should we put another number indicating that is not fitted
51  return;
52  }
53  if ( nclus2 == 0 ) { // Fit with one plane
54  fitHodo(x, xQuality, ipl1,nclus1,xclus1,wclus1);
55  xSlope = 0.0; //?? Should we put another number indicating that is not fitted
56  return;
57  }
58 
59  // We have clusters in both planes
60 
61  float x1,x2,xQ1,xQ2;
62  float xs,x0,xq;
63 
64  std::list<BeamTrack> tracks;
65 
66  for(int i1=0;i1<nclus1;i1++) {
67  for(int i2=0;i2<nclus2;i2++) {
68  clusterPos(x1, xQ1, ipl1, xclus1[i1], wclus1[i1]);
69  clusterPos(x2, xQ2, ipl2, xclus2[i2], wclus2[i2]);
70 
71  xs = ( x2 - x1 ) /
72  ( zPosition_[ipl2] - zPosition_[ipl1] ); // slope
73  x0 = (( x2 + x1 ) - xs *
74  ( zPosition_[ipl2] + zPosition_[ipl1] ))/2.0; // x0
75  xq = (xQ1 + xQ2)/2.0; // Quality, how i can do better ?
76  tracks.push_back(BeamTrack(x0,xs,xq));
77  }
78  }
79 
80  // find track with minimal slope
81  tracks.sort();
82 
83  // Return results
84  x = tracks.begin()->x;
85  xSlope = tracks.begin()->xS;
86  xQuality = tracks.begin()->xQ;
87 }
void fitHodo(float &x, float &xQuality, const int &ipl, const int &nclus, const std::vector< int > &xclus, const std::vector< int > &wclus) const
void clusterPos(float &x, float &xQuality, const int &ipl, const int &xclus, const int &wclus) const
tuple tracks
Definition: testEve_cfg.py:39
Definition: DDAxes.h:10
EcalTBHodoscopeRecInfo EcalTBHodoscopeRecInfoAlgo::reconstruct ( const EcalTBHodoscopeRawInfo hodoscopeRawInfo) const

Fit 0

Fit 1

Fit 2

Definition at line 91 of file EcalTBHodoscopeRecInfoAlgo.cc.

References first, fitHodo(), fitLine(), fitMethod_, EcalTBHodoscopeGeometry::getNFibres(), EcalTBHodoscopeGeometry::getNPlanes(), prof2calltree::last, myGeometry_, x, and detailsBasic3DVector::y.

Referenced by EcalTBHodoscopeRecInfoProducer::produce().

91  {
92  // Reset Hodo data
93  float x,y= -100.0;
94  float xSlope,ySlope = 0.0;
95  float xQuality, yQuality = -100.0;
96 
97  int nclus[4];
98  std::vector<int> xclus[4];
99  std::vector<int> wclus[4];
100 
101  for(int ipl=0; ipl<myGeometry_->getNPlanes(); ipl++) {
102 
103  int nhits = hodoscopeRawInfo[ipl].numberOfFiredHits();
104  // Finding clusters
105  nclus[ipl] = 0;
106  if ( nhits > 0 )
107  {
108  int nh = nhits;
109  int first = 0;
110  int last = 0;
111  while ( nh > 0 )
112  {
113  while ( hodoscopeRawInfo[ipl][first] == 0 ) first++; // start
114  last = first+1; nh--;
115  do
116  {
117  while ( last < myGeometry_->getNFibres() && hodoscopeRawInfo[ipl][last] ) { last++;nh--;} //end
118  if ( last+1 < myGeometry_->getNFibres() && hodoscopeRawInfo[ipl][last+1] )
119  { //Skip 1 fibre hole
120  last+=2; nh--;
121  //std::cout << "Skip fibre " << ipl << " " << first << " "<< last << std::endl;
122  }
123  else
124  {
125  break;
126  }
127  }
128  while( nh>0 && last<myGeometry_->getNFibres() );
129  wclus[ipl].push_back(last - first);
130  xclus[ipl].push_back(first); // Left edge !!!
131  nclus[ipl]++;
132 
133  first = last + 1;
134  }
135  }
136  // printClusters(ipl);
137  }
138 
140  // Straight line fit for one axis
141  if ( fitMethod_ == 0 )
142  {
143  fitLine(x, xSlope, xQuality,
144  0,nclus[0],xclus[0],wclus[0], // X1
145  2,nclus[2],xclus[2],wclus[2]); // X2
146  fitLine(y, ySlope, yQuality,
147  1,nclus[1],xclus[1],wclus[1], // Y1
148  3,nclus[3],xclus[3],wclus[3]); // Y2
149  }
150  else if ( fitMethod_ == 1 )
151  {
153  // x1 and y2 hodoscope
154  fitHodo(x, xQuality, 0,nclus[0],xclus[0],wclus[0]); // X1
155  // if ( xQuality[1] < 0.0 ) {
156  // printFibres(0);
157  // printClusters(0);
158  // }
159  fitHodo(y, yQuality, 1,nclus[1],xclus[1],wclus[1]); // Y1
160  // if ( yQuality[1] < 0.0 ) {
161  // printFibres(1);
162  // printClusters(1);
163  // }
164  }
165  else if ( fitMethod_ == 2 )
166  {
168  //x2 and y2 hodoscope
169  fitHodo(x, xQuality, 2,nclus[2],xclus[2],wclus[2]); // X2
170  // if ( xQuality[2] < 0.0 ) {
171  // printFibres(2);
172  // printClusters(2);
173  // }
174  fitHodo(y, yQuality, 3,nclus[3],xclus[3],wclus[3]); // Y2
175  // if ( yQuality[2] < 0.0 ) {
176  // printFibres(3);
177  // printClusters(3);
178  // }
179  }
180 
181  return EcalTBHodoscopeRecInfo(x,y,xSlope,ySlope,xQuality,yQuality);
182 }
void fitHodo(float &x, float &xQuality, const int &ipl, const int &nclus, const std::vector< int > &xclus, const std::vector< int > &wclus) const
void fitLine(float &x, float &xSlope, float &xQuality, const int &ipl1, const int &nclus1, const std::vector< int > &xclus1, const std::vector< int > &wclus1, const int &ipl2, const int &nclus2, const std::vector< int > &xclus2, const std::vector< int > &wclus2) const
bool first
Definition: L1TdeRCT.cc:94
Definition: DDAxes.h:10
EcalTBHodoscopeGeometry * myGeometry_

Member Data Documentation

int EcalTBHodoscopeRecInfoAlgo::fitMethod_
private

Definition at line 58 of file EcalTBHodoscopeRecInfoAlgo.h.

Referenced by reconstruct().

EcalTBHodoscopeGeometry* EcalTBHodoscopeRecInfoAlgo::myGeometry_
private
std::vector<double> EcalTBHodoscopeRecInfoAlgo::planeShift_
private

Definition at line 60 of file EcalTBHodoscopeRecInfoAlgo.h.

Referenced by clusterPos().

std::vector<double> EcalTBHodoscopeRecInfoAlgo::zPosition_
private

Definition at line 61 of file EcalTBHodoscopeRecInfoAlgo.h.

Referenced by fitLine().