CMS 3D CMS Logo

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

#include <StripCPEfromTemplate.h>

Inheritance diagram for StripCPEfromTemplate:
StripCPE StripClusterParameterEstimator ClusterParameterEstimator< SiStripCluster >

Public Member Functions

StripClusterParameterEstimator::LocalValues localParameters (const SiStripCluster &, const GeomDetUnit &, const LocalTrajectoryParameters &) const
 
 StripCPEfromTemplate (edm::ParameterSet &conf, const MagneticField &mag, const TrackerGeometry &geom, const SiStripLorentzAngle &lorentz, const SiStripConfObject &confObj, const SiStripLatency &latency)
 
- Public Member Functions inherited from StripCPE
LocalVector driftDirection (const StripGeomDetUnit *det) const
 
StripClusterParameterEstimator::LocalValues localParameters (const SiStripCluster &cl, const GeomDetUnit &) const
 
 StripCPE (edm::ParameterSet &conf, const MagneticField &, const TrackerGeometry &, const SiStripLorentzAngle &, const SiStripConfObject &, const SiStripLatency &)
 
- Public Member Functions inherited from StripClusterParameterEstimator
virtual MeasurementValues measurementParameters (const SiStripCluster &, const GeomDetUnit &) const
 
virtual MeasurementValues measurementParameters (const SiStripCluster &cluster, const GeomDetUnit &gd, const LocalTrajectoryParameters &ltp) const
 
float templateProbability () const
 
void templateProbability (float stp)
 
int templateQbin () const
 
void templateQbin (int stqb)
 
- Public Member Functions inherited from ClusterParameterEstimator< SiStripCluster >
virtual void clearParameters () const
 
virtual void enterLocalParameters (unsigned int id, std::pair< int, int > &row_col, LocalValues pos_err_info) const
 
virtual void enterLocalParameters (uint32_t id, uint16_t firstStrip, LocalValues pos_err_info) const
 
virtual LocalValues localParameters (const SiStripCluster &cluster, const GeomDetUnit &gd, const TrajectoryStateOnSurface &tsos) const
 
virtual VLocalValues localParametersV (const SiStripCluster &cluster, const GeomDetUnit &gd) const
 
virtual VLocalValues localParametersV (const SiStripCluster &cluster, const GeomDetUnit &gd, const TrajectoryStateOnSurface &tsos) const
 
virtual ~ClusterParameterEstimator ()
 

Private Attributes

SiStripTemplate templ
 
int template_reco_speed
 
bool use_strip_split_cluster_errors
 
bool use_template_reco
 

Additional Inherited Members

- Public Types inherited from StripClusterParameterEstimator
typedef std::pair
< MeasurementPoint,
MeasurementError
MeasurementValues
 
- Public Types inherited from ClusterParameterEstimator< SiStripCluster >
typedef std::pair< LocalPoint,
LocalError
LocalValues
 
typedef std::vector< LocalValuesVLocalValues
 
- Public Attributes inherited from StripClusterParameterEstimator
float stripCPEtemplateProbability_
 
int stripCPEtemplateQbin_
 
- Protected Member Functions inherited from StripCPE
Param const & param (const GeomDetUnit &det) const
 
- Protected Attributes inherited from StripCPE
const TrackerGeometrygeom_
 
const SiStripLorentzAngleLorentzAngleMap_
 
const MagneticFieldmagfield_
 
const bool peakMode_
 
std::vector< double > shift
 
std::vector< double > xtalk1
 
std::vector< double > xtalk2
 

Detailed Description

Definition at line 10 of file StripCPEfromTemplate.h.

Constructor & Destructor Documentation

StripCPEfromTemplate::StripCPEfromTemplate ( edm::ParameterSet conf,
const MagneticField mag,
const TrackerGeometry geom,
const SiStripLorentzAngle lorentz,
const SiStripConfObject confObj,
const SiStripLatency latency 
)
inline

Definition at line 19 of file StripCPEfromTemplate.h.

References SiStripTemplate::pushfile(), and templ.

25  : StripCPE(conf, mag, geom, lorentz, confObj, latency ),
26  use_template_reco( conf.getParameter<bool>("UseTemplateReco") ),
27  template_reco_speed( conf.getParameter<int>("TemplateRecoSpeed") ),
28  use_strip_split_cluster_errors( conf.getParameter<bool>("UseStripSplitClusterErrors") )
29  {
30  templ.pushfile( 11 );
31  templ.pushfile( 12 );
32  templ.pushfile( 13 );
33  templ.pushfile( 14 );
34  templ.pushfile( 15 );
35  templ.pushfile( 16 );
36 
37  //cout << "STRIPS: (int)use_template_reco = " << (int)use_template_reco << endl;
38  //cout << "template_reco_speed = " << template_reco_speed << endl;
39  //cout << "(int)use_strip_split_cluster_errors = " << (int)use_strip_split_cluster_errors << endl;
40  }
StripCPE(edm::ParameterSet &conf, const MagneticField &, const TrackerGeometry &, const SiStripLorentzAngle &, const SiStripConfObject &, const SiStripLatency &)
Definition: StripCPE.cc:11
T getParameter(std::string const &) const
bool pushfile(int filenum)

Member Function Documentation

StripClusterParameterEstimator::LocalValues StripCPEfromTemplate::localParameters ( const SiStripCluster cluster,
const GeomDetUnit det,
const LocalTrajectoryParameters ltp 
) const
virtual

Reimplemented from ClusterParameterEstimator< SiStripCluster >.

Definition at line 23 of file StripCPEfromTemplate.cc.

References SiStripCluster::amplitudes(), SiStripCluster::barycenter(), StripCPE::Param::coveredStrips(), StripCPE::Param::drift, f, SiStripCluster::firstStrip(), GeomDet::geographicalId(), SiStripCluster::getSplitClusterError(), i, MagneticField::inTesla(), StripTopology::localError(), StripTopology::localPitch(), StripTopology::localPosition(), PV3DBase< T, PVType, FrameType >::mag(), StripCPE::magfield_, StripCPE::Param::maxLength, StripCPE::Param::moduleGeom, LocalTrajectoryParameters::momentum(), AlCaHLTBitMon_ParallelJobs::p, StripCPE::param(), GloballyPositioned< T >::position(), LocalTrajectoryParameters::position(), StripCPE::shift, findQualityFiles::size, SiStripDetId::stereo(), strip(), SiStripTemplateReco::StripTempReco1D(), GeomDet::surface(), templ, template_reco_speed, StripCPE::Param::thickness, toLocal(), StripCPE::Param::topology, use_strip_split_cluster_errors, use_template_reco, LocalTrajectoryParameters::vector(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

26 {
28 
29  LocalPoint final_lp;
30  LocalError final_le;
31 
32  // Default reconstruction (needed if template reco fails)
33 
34  StripCPE::Param const& p = param( det );
35 
36  LocalVector track = ltp.momentum();
37  track *=
38  ( track.z()<0 ) ? fabs( p.thickness/track.z() ) :
39  ( track.z()>0 ) ? -fabs( p.thickness/track.z() ) :
40  p.maxLength/track.mag() ;
41 
42  const unsigned N = cluster.amplitudes().size();
43 
44  const float fullProjection = p.coveredStrips( track+p.drift, ltp.position());
45 
46  const float strip = cluster.barycenter() - 0.5f*(1.f-shift[p.moduleGeom]) * fullProjection
47  + 0.5f*p.coveredStrips(track, ltp.position());
48 
49  LocalPoint default_lp = p.topology->localPosition( strip, ltp.vector() );
50 
51 
52 
53 
54 
55  // Get the error of the split cluster.
56  // If the cluster is not split, then the error is -99999.9.
57  // The split cluster error is in microns and it has to be transformed into centimeteres and then in measurement units
58 
59  float uerr2 = -99999.9;
60  float split_cluster_error = cluster.getSplitClusterError();
61 
62  float local_pitch = p.topology->localPitch( default_lp );
63 
64  if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors )
65  {
66  //cout << endl;
67  //cout << "Assign split rechit errors" << endl;
68  // go from microns to cm and then to strip units...
69 
70  uerr2 =
71  (split_cluster_error/10000.0 / local_pitch ) *
72  (split_cluster_error/10000.0 / local_pitch );
73  }
74  else
75  {
76  //cout << endl;
77  //cout << "Assign default rechit errors" << endl;
78  uerr2 = stripErrorSquared( N, fabs(fullProjection) );
79  }
80 
81 
82  LocalError default_le = p.topology->localError( strip, uerr2, ltp.vector() );
83 
84 
85 
86  // Template reconstruction
87 
88  int ierr = 9999999; // failed template reco ( if ierr = 0, then, template reco was successful )
89  float template_x_pos = -9999999.9;
90  float template_x_err = -9999999.9;
91 
92  // int cluster_size = (int)cluster.amplitudes().size();
93 
94  // do not use template reco for huge clusters
95  if ( use_template_reco )
96  {
97 
98  int id = -9999999;
99 
100  SiStripDetId ssdid = SiStripDetId( det.geographicalId() );
101 
102  int is_stereo = (int)( ssdid.stereo() );
103 
104  if ( p.moduleGeom == 1 ) // IB1
105  {
106  if ( !is_stereo )
107  id = 11;
108  else
109  id = 12;
110  }
111  else if ( p.moduleGeom == 2 ) // IB2
112  {
113  id = 13;
114  }
115  else if ( p.moduleGeom == 3 ) // OB1
116  {
117  id = 16;
118  }
119  else if ( p.moduleGeom == 4 ) // OB2
120  {
121  if ( !is_stereo )
122  id = 14;
123  else
124  id = 15;
125  }
126  //else
127  //cout << "Do not use templates for strip modules other than IB1, IB2, OB1 and OB2" << endl;
128 
129  StripGeomDetUnit* stripdet = (StripGeomDetUnit*)(&det);
130 
131  if ( (id > -9999999) && !(stripdet == 0) )
132  {
133  // Variables needed by template reco
134  float cotalpha = -9999999.9;
135  float cotbeta = -9999999.9;
136  float locBy = -9999999.9;
137  std::vector<float> vec_cluster_charge;
138 
139  // Variables returned by template reco
140  float xrec = -9999999.9;
141  float sigmax = -9999999.9;
142  float probx = -9999999.9;
143  int qbin = -9999999 ;
144  int speed = template_reco_speed ;
145  float probQ = -9999999.9;
146 
147 
148  LocalVector lbfield = ( stripdet->surface() ).toLocal( magfield_.inTesla( stripdet->surface().position() ) );
149  locBy = lbfield.y();
150 
151 
152  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
153  float locx = localDir.x();
154  float locy = localDir.y();
155  float locz = localDir.z();
156  cotalpha = locx/locz;
157  cotbeta = locy/locz;
158 
159 
160  int cluster_size = (int)( (cluster.amplitudes()).size() );
161  for (int i=0; i<cluster_size; ++i)
162  {
163  vec_cluster_charge.push_back( (float)( (cluster.amplitudes())[i] ) );
164  }
165 
166 
167  float measurement_position_first_strip_center = (float)(cluster.firstStrip()) + 0.5;
168 
169  LocalPoint local_position_first_strip_center
170  = p.topology->localPosition( measurement_position_first_strip_center, ltp.vector() );
171 
172 
174  cotalpha,
175  cotbeta,
176  locBy,
177  vec_cluster_charge,
178  templ,
179  xrec,
180  sigmax,
181  probx,
182  qbin,
183  speed,
184  probQ );
185 
186 
187 
188  // stripCPEtemplateProbability_ = probQ;
189  // stripCPEtemplateQbin_ = qbin;
190 
191 
192  template_x_pos = xrec / 10000.0 + local_position_first_strip_center.x();
193 
194  if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors )
195  {
196  template_x_err = split_cluster_error/10000.0;
197  }
198  else
199  {
200  template_x_err = sigmax/10000.0;
201  }
202 
203 
204  } // if ( id > -9999999 && !stripdet == 0 )
205 
206  } // if ( use_template_reco )
207 
208 
209  if ( use_template_reco && ierr == 0 )
210  {
211  //cout << "Use template reco " << ierr << endl;
212 
213  LocalPoint template_lp( template_x_pos , default_lp.y() , default_lp.z() );
214  LocalError template_le( template_x_err*template_x_err, default_le.xy(), default_le.yy() );
215 
216 
217  final_lv = std::make_pair( template_lp, template_le );
218 
219  }
220  else
221  {
222  //cout << "Use default reco " << ierr << endl;
223 
224  final_lv = std::make_pair( default_lp, default_le );
225  }
226 
227  return final_lv;
228 
229 
230 }
int i
Definition: DBlmapReader.cc:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
uint32_t stereo() const
Definition: SiStripDetId.h:162
LocalPoint position() const
Local x and y position coordinates.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
float thickness
Definition: StripCPE.h:43
StripTopology const * topology
Definition: StripCPE.h:41
T y() const
Definition: PV3DBase.h:62
uint16_t firstStrip() const
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
std::pair< LocalPoint, LocalError > LocalValues
float getSplitClusterError() const
AlgebraicVector5 vector() const
virtual float localPitch(const LocalPoint &) const =0
float xy() const
Definition: LocalError.h:25
T mag() const
Definition: PV3DBase.h:66
SiStripDetId::ModuleGeometry moduleGeom
Definition: StripCPE.h:45
float yy() const
Definition: LocalError.h:26
T z() const
Definition: PV3DBase.h:63
int StripTempReco1D(int id, float cotalpha, float cotbeta, float locBy, std::vector< float > &cluster, SiStripTemplate &templ, float &xrec, float &sigmax, float &probx, int &qbin, int speed, float &probQ)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
double f[11][100]
float barycenter() const
const MagneticField & magfield_
Definition: StripCPE.h:33
std::vector< double > shift
Definition: StripCPE.h:35
LocalVector momentum() const
Momentum vector in the local frame.
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:78
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
#define N
Definition: blowfish.cc:9
virtual LocalError localError(float strip, float stripErr2) const =0
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
float maxLength
Definition: StripCPE.h:43
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:48
LocalVector drift
Definition: StripCPE.h:42
virtual LocalPoint localPosition(float strip) const =0
T x() const
Definition: PV3DBase.h:61
const PositionType & position() const
tuple size
Write out results.
const std::vector< uint8_t > & amplitudes() const

Member Data Documentation

SiStripTemplate StripCPEfromTemplate::templ
mutableprivate

Definition at line 44 of file StripCPEfromTemplate.h.

Referenced by localParameters(), and StripCPEfromTemplate().

int StripCPEfromTemplate::template_reco_speed
private

Definition at line 47 of file StripCPEfromTemplate.h.

Referenced by localParameters().

bool StripCPEfromTemplate::use_strip_split_cluster_errors
private

Definition at line 48 of file StripCPEfromTemplate.h.

Referenced by localParameters().

bool StripCPEfromTemplate::use_template_reco
private

Definition at line 46 of file StripCPEfromTemplate.h.

Referenced by localParameters().