|
ATLAS Offline Software
|
Go to the documentation of this file.
3 #include <Eigen/StdVector>
30 m_missingPlane(missingPlane),
32 m_isIdealCoordFit(true)
34 std::ifstream geocfile(
fname);
35 if (not geocfile.is_open()) {
49 if (
sizeof(
float) * CHAR_BIT != 32)
50 ATH_MSG_WARNING(
"Floating points on this computer are not 32 bit. This may cause a problem for the hardware agreement. Be careful!");
65 for (
int i = 0;
i < 5; ++
i) getline(geocfile,
key);
116 for (
int ipar = 0; ipar <
m_npars; ++ipar)
120 for (
int icoord = 0; icoord <
m_ncoords; ++icoord)
124 ATH_MSG_WARNING(
"par loop (1) key=\"" <<
key <<
"\" ipar,icoord=" << ipar <<
"," << icoord);
133 assert(
key==
"kaverages");
143 assert(
key==
"kernel");
155 for (
int ipar=0;ipar<
m_npars;++ipar)
192 if (
det == 0)
continue;
202 if (
m_maj_kk(isec, ix, ix) == 0)
continue;
235 bool foundrow =
false;
236 bool foundcolumn =
false;
239 if (abs(thisMatrix(iy,ix)) >
MTX_TOLERANCE) foundcolumn =
true;
241 if (foundrow && foundcolumn)
m_WCs(isec,ix) = 0;
245 size_t nDimToUse = 0;
for (
int ix=0;ix!=
m_ncoords;++ix)
if(!
m_WCs(isec,ix)) ++nDimToUse;
247 Eigen::MatrixXf tempMatrix(nDimToUse, nDimToUse);
249 size_t counteri = 0, counterj = 0;
254 if (!
m_WCs(isec,j)) {
255 tempMatrix(counteri,counterj) = thisMatrix(
i,j);
264 Eigen::MatrixXf inverted = tempMatrix.inverse();
270 counteri = 0; counterj = 0;
275 if (!
m_WCs(isec,j)) {
276 fullInverted(
i,j) = inverted(counteri,counterj);
280 fullInverted(
i,j) = 0;
287 fullInverted(
i,j) = 0;
308 int nmissing =
track.getNMissing();
312 if (nmissing != guess_res)
return false;
330 std::vector<int> missid;
334 std::vector<int> missing_planes;
337 coordsmask[j] = (
track.getHitMap()>>j) & 1;
338 if (!coordsmask[j]) {
340 if(missing_planes.size() == 0) {
341 missing_planes.push_back(plane);
344 for (
unsigned k = 0;
k < missing_planes.size();
k++) {
345 if(plane == missing_planes[
k])
break;
346 if(
k == missing_planes.size() - 1) missing_planes.push_back(plane);
354 if(!doExtrapolation){
356 if(missing_planes.size() > 1){
357 ATH_MSG_WARNING(
"missing_point_guess() Can only guess 1 layer in the first stage");
361 ATH_MSG_WARNING(
"missing_point_guess() Cannot guess more than two coordinates in the first stage");
366 if(missing_planes.size() > 2){
367 ATH_MSG_WARNING(
"missing_point_guess() Can only guess 2 layers in the second stage");
371 ATH_MSG_WARNING(
"missing_point_guess() Cannot guess more than four coordinates in the second stage");
377 Eigen::MatrixXd
coef(nmissing,nmissing);
378 Eigen::VectorXd
a(nmissing);
380 for (
int i=0;
i<nmissing; ++
i)
386 if (!coordsmask[
col])
continue;
396 for (
int j=0; j<nmissing; ++j)
403 if (
coef.determinant()==0)
return -1;
404 Eigen::VectorXd missing_hits =
coef.inverse()*
a;
406 for(
int m=0;
m<nmissing;
m++){
422 double target_r =
track.getIdealRadius(missedplane);
423 newhit.
setX(target_r*TMath::Cos(missing_hits[
m]));
424 newhit.
setY(target_r*TMath::Sin(missing_hits[
m]));
430 track.setFPGATrackSimHit(missedplane, newhit);
444 double target_r =
track.getIdealRadius(missedplane);
445 newhit.
setX(target_r*TMath::Cos(missing_hits[
m]));
446 newhit.
setY(target_r*TMath::Sin(missing_hits[
m]));
447 newhit.
setZ(missing_hits[
m+1]);
455 track.setFPGATrackSimHit(missedplane, newhit);
469 for (
int ix = 0; ix !=
m_npixcy/2; ix++)
480 chi2 += chi_component * chi_component;
572 track.setFPGATrackSimHit(plane, hit);
float getPhiCoord(int ilayer) const
void setSection(unsigned v)
bool getDoDeltaGPhis() const
void readSectorInfo(std::ifstream &geocfile)
vector3D< float > m_kernel
void setPhiCoord(float v)
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
uint32_t getCoordLayer(uint32_t coord) const
uint32_t getDim(size_t logiLayer) const
void setPhi(float v, bool ForceRange=true)
FPGATrackSimFitConstantBank(FPGATrackSimPlaneMap const *pmap, int ncoords, std::string const &fname, bool isFirstStage, int missingPlane=-1)
void setDetType(SiliconTech detType)
void resize(size_t x1, size_t x2, size_t x3, T const &t=T())
void linfit_chisq(sector_t sector, FPGATrackSimTrack &trk) const
SiliconTech getDetType(size_t logiLayer) const
void setEtaCoord(float v)
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)
list of entries in a vector that are not in another
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
void setHitType(HitType type)