Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
3 #include <Eigen/StdVector>
31 m_missingPlane(missingPlane),
33 m_isIdealCoordFit(true)
35 std::ifstream geocfile(
fname);
36 if (not geocfile.is_open()) {
50 if (
sizeof(
float) * CHAR_BIT != 32)
51 ATH_MSG_WARNING(
"Floating points on this computer are not 32 bit. This may cause a problem for the hardware agreement. Be careful!");
66 for (
int i = 0;
i < 5; ++
i) getline(geocfile,
key);
117 for (
int ipar = 0; ipar <
m_npars; ++ipar)
121 for (
int icoord = 0; icoord <
m_ncoords; ++icoord)
125 ATH_MSG_WARNING(
"par loop (1) key=\"" <<
key <<
"\" ipar,icoord=" << ipar <<
"," << icoord);
134 assert(
key==
"kaverages");
144 assert(
key==
"kernel");
156 for (
int ipar=0;ipar<
m_npars;++ipar)
193 if (
det == 0)
continue;
203 if (
m_maj_kk(isec, ix, ix) == 0)
continue;
236 bool foundrow =
false;
237 bool foundcolumn =
false;
240 if (abs(thisMatrix(iy,ix)) >
MTX_TOLERANCE) foundcolumn =
true;
242 if (foundrow && foundcolumn)
m_WCs(isec,ix) = 0;
246 size_t nDimToUse = 0;
for (
int ix=0;ix!=
m_ncoords;++ix)
if(!
m_WCs(isec,ix)) ++nDimToUse;
248 Eigen::MatrixXf tempMatrix(nDimToUse, nDimToUse);
250 size_t counteri = 0, counterj = 0;
255 if (!
m_WCs(isec,j)) {
256 tempMatrix(counteri,counterj) = thisMatrix(
i,j);
265 Eigen::MatrixXf inverted = tempMatrix.inverse();
271 counteri = 0; counterj = 0;
276 if (!
m_WCs(isec,j)) {
277 fullInverted(
i,j) = inverted(counteri,counterj);
281 fullInverted(
i,j) = 0;
288 fullInverted(
i,j) = 0;
309 int nmissing =
track.getNMissing();
313 if (nmissing != guess_res)
return false;
331 std::vector<int> missid;
335 std::vector<int> missing_planes;
338 coordsmask[j] = (
track.getHitMap()>>j) & 1;
339 if (!coordsmask[j]) {
341 if(missing_planes.size() == 0) {
342 missing_planes.push_back(plane);
345 for (
unsigned k = 0;
k < missing_planes.size();
k++) {
346 if(plane == missing_planes[
k])
break;
347 if(
k == missing_planes.size() - 1) missing_planes.push_back(plane);
355 if(!doExtrapolation){
357 if(missing_planes.size() > 1){
358 ATH_MSG_WARNING(
"missing_point_guess() Can only guess 1 layer in the first stage");
362 ATH_MSG_WARNING(
"missing_point_guess() Cannot guess more than two coordinates in the first stage");
367 if(missing_planes.size() > 2){
368 ATH_MSG_WARNING(
"missing_point_guess() Can only guess 2 layers in the second stage");
372 ATH_MSG_WARNING(
"missing_point_guess() Cannot guess more than four coordinates in the second stage");
378 Eigen::MatrixXd
coef(nmissing,nmissing);
379 Eigen::VectorXd
a(nmissing);
381 for (
int i=0;
i<nmissing; ++
i)
387 if (!coordsmask[
col])
continue;
403 for (
int j=0; j<nmissing; ++j)
410 if (
coef.determinant()==0)
return -1;
411 Eigen::VectorXd missing_hits =
coef.inverse()*
a;
413 for(
int m=0;
m<nmissing;
m++){
429 double target_r =
track.getIdealRadius(missedplane);
430 newhit.
setX(target_r*TMath::Cos(missing_hits[
m]));
431 newhit.
setY(target_r*TMath::Sin(missing_hits[
m]));
437 track.setFPGATrackSimHit(missedplane, newhit);
451 double target_r =
track.getIdealRadius(missedplane);
452 newhit.
setX(target_r*TMath::Cos(missing_hits[
m]));
453 newhit.
setY(target_r*TMath::Sin(missing_hits[
m]));
454 newhit.
setZ(missing_hits[
m+1]);
462 track.setFPGATrackSimHit(missedplane, newhit);
493 chi2 += chi_component * chi_component;
593 track.setFPGATrackSimHit(plane, hit);
float getPhiCoord(int ilayer) const
void setSection(unsigned v)
unsigned getPhysLayer() const
bool getDoDeltaGPhis() const
void readSectorInfo(std::ifstream &geocfile)
void setEtaIndex(unsigned v)
vector3D< float > m_kernel
void invlinfit(sector_t sector, FPGATrackSimTrack &track, double const *constr) const
This method uses the track parameters and additional constraints to use the constants to calculate th...
void readHeader(std::ifstream &geocfile)
vector2D< float > m_maj_a
vector2D< float > m_fit_const
G4int m_nsectors
GU add phi min and phi span of overall volume.
vector3D< float > m_fit_pars
FPGATrackSimFitConstantBank(FPGATrackSimPlaneMap const *pmap, int ncoords, std::string const &fname, bool isFirstStage, float phishift, int missingPlane=-1)
uint32_t getCoordLayer(uint32_t coord) const
uint32_t getDim(size_t logiLayer) const
void setPhi(float v, bool ForceRange=true)
const std::vector< FPGATrackSimHit > & getFPGATrackSimHits() const
void setDetType(SiliconTech detType)
void resize(size_t x1, size_t x2, size_t x3, T const &t=T())
void setPhiIndex(unsigned v)
void linfit_chisq(sector_t sector, FPGATrackSimTrack &trk) const
SiliconTech getDetType(size_t logiLayer) const
double chi2(TH1 *h0, TH1 *h1)
Class to provide easy MsgStream access and capabilities.
float getEtaCoord(int ilayer) const
vector3D< float > m_maj_kk
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
void prepareInvFitConstants()
void linfit_pars_eval(sector_t sector, FPGATrackSimTrack &trk) const
int missing_point_guess(sector_t sector, FPGATrackSimTrack &track, bool isFirstStage, bool doExtrapolation) const
FPGATrackSimPlaneMap const * m_pmap
bool linfit(sector_t sector, FPGATrackSimTrack &track, bool isSecondStage) const
std::vector< Eigen::MatrixXf, Eigen::aligned_allocator< Eigen::MatrixXf > > m_invfit_consts
void setIdealCoordFit(bool v)
std::vector< bool > m_sector_good
void setLayer(unsigned v)
#define ATH_MSG_WARNING(x)
void resize(size_t x1, size_t x2, T const &t=T())
vector3D< float > m_maj_invkk
vector2D< float > m_kaverage
HitType getHitType() const
void setHitType(HitType type)