45 return StatusCode::SUCCESS;
53 const EventContext& ctx = Gaudi::Hive::currentContext();
57 "Using FillRandomHit method to get data");
65 if ( checkOut.isFailure() )
68 return StatusCode::FAILURE;
72 if (evtType != 1)
return StatusCode::SUCCESS;
77 unsigned int thisrun=ctx.eventID().run_number();
95 setFilterPassed(
false);
96 return StatusCode::SUCCESS;
99 int hitPlaneNumU, hitPlaneNumV;
103 if( (hitPlaneNumU < 2) || (hitPlaneNumV < 2) ){
105 <<
"Not enough hits in one or both planes, "
106 <<
"Cannot make track.");
108 setFilterPassed(
false);
109 return StatusCode::SUCCESS;
115 std::vector<double> residual_u, residual_v;
125 setFilterPassed(
false);
126 return StatusCode::SUCCESS;
132 setFilterPassed(
false);
133 return StatusCode::SUCCESS;
140 track->setUintercept(a1_u);
141 track->setVintercept(a1_v);
142 track->setUslope(a2_u);
143 track->setVslope(a2_v);
146 for(
int i = 0;
i < hitPlaneNumU;
i++){
147 track->setResidualu(
i, residual_u[
i]);
151 for(
int i = 0;
i < hitPlaneNumV;
i++){
152 track->setResidualv(
i, residual_v[
i]);
159 track->setChi2_u(chi2_u);
160 track->setChi2_v(chi2_v);
165 if (
sc.isFailure( ) ) {
170 setFilterPassed(
true);
171 return StatusCode::SUCCESS;
179 return StatusCode::SUCCESS;
184 double &a1,
double &a2,
double &
chi2, std::vector<double> &
residual)
188 int hitPlaneNum = hitPlaneCont->
size();
190 ATH_MSG_DEBUG (
"The hit plane container size is: " << hitPlaneNum);
192 std::vector<double> vec_u;
193 std::vector<double> vec_w;
194 std::vector<double> err_vec_u;
195 std::vector<double> err_vec_w;
202 vec_u.push_back(hp->getPosu());
203 vec_w.push_back(hp->getPosw());
204 err_vec_u.push_back(hp->getErroru());
205 err_vec_w.push_back(hp->getErrorw());
208 if(vec_u.size() != vec_w.size()){
225 <<
" intercept = " << a1
226 <<
" and slope = " << a2);
229 for (
int i = 0;
i < hitPlaneNum;
i++) {
237 const std::vector<double> & v_w,
238 const std::vector<double> & v_eu,
240 double &a1,
double &a2)
263 int numHits = v_u.size();
264 for(
int i = 0;
i < numHits;
i++){
265 m_s += 1 / (v_eu[
i]*v_eu[
i]);
266 m_su += v_u[
i] / (v_eu[
i]*v_eu[
i]);
267 m_sww += v_w[
i]*v_w[
i] / (v_eu[
i]*v_eu[
i]);
268 m_sw += v_w[
i] / (v_eu[
i]*v_eu[
i]);
269 m_suw += v_u[
i]*v_w[
i] / (v_eu[
i]*v_eu[
i]);
272 const double denom = (m_s*m_sww-m_sw*m_sw);
277 const double inv_denom = 1. /
denom;
278 a1 = (m_su*m_sww - m_sw*m_suw) * inv_denom;
279 a2 = (m_s*m_suw - m_su*m_sw) * inv_denom;
284 ,
const double &a1,
const double &a2)
287 return (
u - a1 - a2*
w);
292 const std::vector<double> &v_w,
293 const std::vector<double> &v_eu,
295 const double &a1,
const double &a2)
303 int numX = v_u.size();
306 for(
int i = 0;
i < numX;
i++){
307 chi2 += (v_u[
i] - a1 - a2*v_w[
i])*(v_u[
i] - a1 - a2*v_w[
i])/(v_eu[
i]*v_eu[
i]);
333 if ( sc1.isFailure( ) ) {
346 if ( sc2.isFailure( ) ) {
366 for (
const TBBPC* bpc : *bpcCont) {
367 std::string
name = bpc->getDetectorName();
384 if(!(bpc->isXPosOverflow()||bpc->isXPulseOverflow())){
393 hitu->
setValidFlag(bpc->isXPosOverflow()&&bpc->isYPosOverflow());
397 if(!(bpc->isYPosOverflow()||bpc->isYPulseOverflow())){
406 hitv->
setValidFlag(bpc->isXPosOverflow()&&bpc->isYPosOverflow());
411 return StatusCode::SUCCESS;
447 std::ifstream calibfile;
450 if(!calibfile.good()){
452 return StatusCode::FAILURE;
458 pos = calibfile.tellg();
463 pos = calibfile.tellg();
465 for(
int j=0;j<bpcnumber+1;j++) calibfile.ignore(5000,
'\n');
479 calibfile.seekg(
pos);
481 for(
int j=0;j<bpcnumber;j++)
510 return StatusCode::SUCCESS;