 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "GaudiKernel/SystemOfUnits.h"
14 using namespace Gaudi::Units;
18 , m_theEventInfo(
"TBEventInfo")
33 ATH_MSG_ERROR (
"Pcode should be in jO, if not PrimaryTrackOnly !" );
34 return StatusCode::FAILURE;
38 ATH_MSG_INFO (
"LArTBH6BeamInfo initialisation completed" );
39 return StatusCode::SUCCESS;
49 CLHEP::Hep3Vector
pos;
69 if(hit->GetSC() > 0)
continue;
71 if(hit->GetTrackID() != 1)
continue;
73 if(hit->GetPcode() !=
m_pcode)
continue;
77 v_x.push_back(
pos.x());
78 v_xz.push_back(
pos.z()+21600.*
mm);
81 v_y.push_back(
pos.y());
82 v_yz.push_back(
pos.z()+21600.*
mm);
89 if(v_x.size() < 2 || v_y.size() < 2) {
90 ATH_MSG_DEBUG (
"Could not fit, setting zero. "<<v_x.size()<<
"/"<<v_y.size() );
91 m_track = std::make_unique<TBTrack>(0,0);
103 return StatusCode::FAILURE;
108 std::vector<double> residual_x, residual_y;
115 check =
fitVect(v_x, v_xz, v_ex, a1_x, a2_x, chi2_x, residual_x);
119 return StatusCode::FAILURE;
122 check =
fitVect(v_y, v_yz, v_ey, a1_y, a2_y, chi2_y, residual_y);
125 return StatusCode::FAILURE;
133 m_track = std::make_unique<TBTrack>(v_x.size(), v_y.size());
141 for(
size_t i = 0;
i < v_x.size(); ++
i){
146 for(
size_t i = 0;
i < v_y.size(); ++
i){
162 return StatusCode::SUCCESS;
172 return StatusCode::SUCCESS;
201 int hitNum =
vec.size();
202 for(
i = 0;
i < hitNum; ++
i){
208 s += 1 / (vec_e[
i]*vec_e[
i]);
209 su +=
vec[
i] / (vec_e[
i]*vec_e[
i]);
210 sww += vec_z[
i]*vec_z[
i] / (vec_e[
i]*vec_e[
i]);
211 sw += vec_z[
i] / (vec_e[
i]*vec_e[
i]);
212 suw +=
vec[
i]*vec_z[
i] / (vec_e[
i]*vec_e[
i]);
215 const double denom = (
s*sww-sw*sw);
221 const double inv_denom = 1. /
denom;
222 a1 = (su*sww - sw*suw) * inv_denom;
223 a2 = (
s*suw - su*sw) * inv_denom;
224 ATH_MSG_DEBUG (
"Fit results:" <<
" intercept = " << a1 <<
" and slope = " << a2 );
228 for (
i = 0;
i < hitNum; ++
i) {
233 for(
i = 0;
i < hitNum; ++
i){
234 chi2 += (
vec[
i] - a1 - a2*vec_z[
i])*(
vec[
i] - a1 - a2*vec_z[
i])/(vec_e[
i]*vec_e[
i]);
void setChi2_v(double chi2v)
void setVslope(double vslope)
SG::ReadHandle< TBEventInfo > m_theEventInfo
void setVintercept(double vintercept)
LArTBH6BeamInfo(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute() override
SG::WriteHandle< TBTrack > m_track
void setCryoHitv(float cryov)
void setCryoHitu(float cryou)
std::vector< size_t > vec
void setUslope(double uslope)
bool fitVect(const dVect &vec_x, const dVect &vec_xz, const dVect &vec_ex, double &a1, double &a2, double &chi2, dVect &residual)
Fit data to the function u = a1 + a2*w.
std::vector< double > dVect
void setUintercept(double uintercept)
::StatusCode StatusCode
StatusCode definition for legacy code.
double chi2(TH1 *h0, TH1 *h1)
void setCryoHitw(float cryow)
virtual StatusCode initialize() override
void setResidualv(int ind, double residualv)
Gaudi::Property< std::vector< std::string > > m_HitsCollNames
Gaudi::Property< int > m_pcode
virtual StatusCode finalize() override
void setChi2_u(double chi2u)
void setResidualu(int ind, double residualu)
Gaudi::Property< bool > m_Primary
std::vector< SG::ReadHandle< AthenaHitsVector< LArG4H6FrontHit > > > m_hitcoll