CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
trklet::TrackDerTable Class Reference

#include <TrackDerTable.h>

Public Member Functions

void addEntry (unsigned int layermask, unsigned int diskmask, int multiplicity, int nrinv)
 
void fillTable ()
 
const TrackDergetDerivatives (int index) const
 
const TrackDergetDerivatives (unsigned int layermask, unsigned int diskmask, unsigned int alphaindex, unsigned int rinvindex) const
 
int getEntries () const
 
int getIndex (unsigned int layermask, unsigned int diskmask) const
 
void readPatternFile (std::string fileName)
 
 TrackDerTable (Settings const &settings)
 
 ~TrackDerTable ()=default
 

Static Public Member Functions

static void calculateDerivatives (Settings const &settings, unsigned int nlayers, double r[N_LAYER], unsigned int ndisks, double z[N_DISK], double alpha[N_DISK], double t, double rinv, double D[N_FITPARAM][N_FITSTUB *2], int iD[N_FITPARAM][N_FITSTUB *2], double MinvDt[N_FITPARAM][N_FITSTUB *2], int iMinvDt[N_FITPARAM][N_FITSTUB *2], double sigma[N_FITSTUB *2], double kfactor[N_FITSTUB *2])
 
static void invert (double M[4][8], unsigned int n)
 
static void invert (std::vector< std::vector< double > > &M, unsigned int n)
 
static double tpar (Settings const &settings, int diskmask, int layermask)
 

Private Attributes

unsigned int alphaBits_
 
std::vector< TrackDerderivatives_
 
std::vector< int > DiskMem_
 
unsigned int DiskMemBits_
 
int lastMultiplicity_
 
std::vector< int > LayerDiskMem_
 
unsigned int LayerDiskMemBits_
 
std::vector< int > LayerMem_
 
unsigned int LayerMemBits_
 
unsigned int Ndisk_
 
int nextDiskValue_
 
int nextLayerDiskValue_
 
int nextLayerValue_
 
unsigned int Nlay_
 
Settings const & settings_
 

Detailed Description

Definition at line 18 of file TrackDerTable.h.

Constructor & Destructor Documentation

◆ TrackDerTable()

TrackDerTable::TrackDerTable ( Settings const &  settings)

Definition at line 10 of file TrackDerTable.cc.

10  : settings_(settings) {
11  Nlay_ = N_LAYER;
12  Ndisk_ = N_DISK;
13 
14  LayerMemBits_ = 6;
15  DiskMemBits_ = 7;
16  LayerDiskMemBits_ = 18;
17 
19 
20  nextLayerValue_ = 0;
21  nextDiskValue_ = 0;
23  lastMultiplicity_ = (1 << (3 * alphaBits_));
24 
25  for (int i = 0; i < (1 << Nlay_); i++) {
26  LayerMem_.push_back(-1);
27  }
28 
29  for (int i = 0; i < (1 << (2 * Ndisk_)); i++) {
30  DiskMem_.push_back(-1);
31  }
32 
33  for (int i = 0; i < (1 << (LayerMemBits_ + DiskMemBits_)); i++) {
34  LayerDiskMem_.push_back(-1);
35  }
36 }

References alphaBits_, trklet::Settings::alphaBitsTable(), DiskMem_, DiskMemBits_, mps_fire::i, lastMultiplicity_, LayerDiskMem_, LayerDiskMemBits_, LayerMem_, LayerMemBits_, trklet::N_DISK, trklet::N_LAYER, Ndisk_, nextDiskValue_, nextLayerDiskValue_, nextLayerValue_, Nlay_, and settings_.

◆ ~TrackDerTable()

trklet::TrackDerTable::~TrackDerTable ( )
default

Member Function Documentation

◆ addEntry()

void TrackDerTable::addEntry ( unsigned int  layermask,
unsigned int  diskmask,
int  multiplicity,
int  nrinv 
)

Definition at line 89 of file TrackDerTable.cc.

89  {
90  assert(multiplicity <= (1 << (3 * alphaBits_)));
91 
92  assert(layermask < (unsigned int)(1 << Nlay_));
93 
94  assert(diskmask < (unsigned int)(1 << (2 * Ndisk_)));
95 
96  if (LayerMem_[layermask] == -1) {
97  LayerMem_[layermask] = nextLayerValue_++;
98  }
99  if (DiskMem_[diskmask] == -1) {
100  DiskMem_[diskmask] = nextDiskValue_++;
101  }
102 
103  int layercode = LayerMem_[layermask];
104  int diskcode = DiskMem_[diskmask];
105 
106  assert(layercode >= 0);
107  assert(layercode < (1 << LayerMemBits_));
108  assert(diskcode >= 0);
109  assert(diskcode < (1 << DiskMemBits_));
110 
111  int layerdiskaddress = layercode + (diskcode << LayerMemBits_);
112 
113  assert(layerdiskaddress >= 0);
114  assert(layerdiskaddress < (1 << (LayerMemBits_ + DiskMemBits_)));
115 
116  int address = LayerDiskMem_[layerdiskaddress];
117 
118  if (address != -1) {
119  edm::LogPrint("Tracklet") << "Duplicate entry: layermask=" << layermask << " diskmaks=" << diskmask;
120  }
121 
122  assert(address == -1);
123 
124  LayerDiskMem_[layerdiskaddress] = nextLayerDiskValue_;
125 
126  nextLayerDiskValue_ += multiplicity * nrinv;
127 
128  lastMultiplicity_ = multiplicity * nrinv;
129 
130  for (int i = 0; i < multiplicity; i++) {
131  for (int irinv = 0; irinv < nrinv; irinv++) {
132  TrackDer tmp;
133  tmp.setIndex(layermask, diskmask, i, irinv);
134  derivatives_.push_back(tmp);
135  }
136  }
137 }

References alphaBits_, cms::cuda::assert(), derivatives_, DiskMem_, DiskMemBits_, mps_fire::i, lastMultiplicity_, LayerDiskMem_, LayerMem_, LayerMemBits_, Ndisk_, nextDiskValue_, nextLayerDiskValue_, nextLayerValue_, Nlay_, and createJobs::tmp.

Referenced by readPatternFile().

◆ calculateDerivatives()

void TrackDerTable::calculateDerivatives ( Settings const &  settings,
unsigned int  nlayers,
double  r[N_LAYER],
unsigned int  ndisks,
double  z[N_DISK],
double  alpha[N_DISK],
double  t,
double  rinv,
double  D[N_FITPARAM][N_FITSTUB *2],
int  iD[N_FITPARAM][N_FITSTUB *2],
double  MinvDt[N_FITPARAM][N_FITSTUB *2],
int  iMinvDt[N_FITPARAM][N_FITSTUB *2],
double  sigma[N_FITSTUB *2],
double  kfactor[N_FITSTUB *2] 
)
static

Definition at line 755 of file TrackDerTable.cc.

768  {
769  double sigmax = settings.stripPitch(true) / sqrt(12.0);
770  double sigmaz = settings.stripLength(true) / sqrt(12.0);
771  double sigmaz2 = settings.stripLength(false) / sqrt(12.0);
772 
773  double sigmazpsbarrel = sigmaz; //This is a bit of a hack - these weights should be properly determined
774  if (std::abs(t) > 2.0)
775  sigmazpsbarrel = sigmaz * std::abs(t) / 2.0;
776  if (std::abs(t) > 3.8)
777  sigmazpsbarrel = sigmaz * std::abs(t);
778 
779  double sigmax2sdisk = settings.stripPitch(false) / sqrt(12.0);
780  double sigmaz2sdisk = settings.stripLength(false) / sqrt(12.0);
781 
782  double sigmaxpsdisk = settings.stripPitch(true) / sqrt(12.0);
783  double sigmazpsdisk = settings.stripLength(true) / sqrt(12.0);
784 
785  unsigned int n = nlayers + ndisks;
786 
787  assert(n <= N_FITSTUB);
788 
789  double rnew[N_FITSTUB];
790 
791  int j = 0;
792 
793  //here we handle a barrel hit
794  for (unsigned int i = 0; i < nlayers; i++) {
795  double ri = r[i];
796 
797  rnew[i] = ri;
798 
799  //first we have the phi position
800  D[0][j] = -0.5 * ri * ri / sqrt(1 - 0.25 * ri * ri * rinv * rinv) / sigmax;
801  D[1][j] = ri / sigmax;
802  D[2][j] = 0.0;
803  D[3][j] = 0.0;
804  sigma[j] = sigmax;
805  kfactor[j] = settings.kphi1();
806  j++;
807  //second the z position
808  D[0][j] = 0.0;
809  D[1][j] = 0.0;
810  if (ri < settings.rPS2S()) {
811  D[2][j] = (2 / rinv) * asin(0.5 * ri * rinv) / sigmazpsbarrel;
812  D[3][j] = 1.0 / sigmazpsbarrel;
813  sigma[j] = sigmazpsbarrel;
814  kfactor[j] = settings.kz();
815  } else {
816  D[2][j] = (2 / rinv) * asin(0.5 * ri * rinv) / sigmaz2;
817  D[3][j] = 1.0 / sigmaz2;
818  sigma[j] = sigmaz2;
819  kfactor[j] = settings.kz();
820  }
821 
822  j++;
823  }
824 
825  for (unsigned int i = 0; i < ndisks; i++) {
826  double zi = z[i];
827 
828  double z0 = 0.0;
829 
830  double rmultiplier = alpha[i] * zi / t;
831 
832  double phimultiplier = zi / t;
833 
834  double drdrinv = -2.0 * sin(0.5 * rinv * (zi - z0) / t) / (rinv * rinv) +
835  (zi - z0) * cos(0.5 * rinv * (zi - z0) / t) / (rinv * t);
836  double drdphi0 = 0;
837  double drdt = -(zi - z0) * cos(0.5 * rinv * (zi - z0) / t) / (t * t);
838  double drdz0 = -cos(0.5 * rinv * (zi - z0) / t) / t;
839 
840  double dphidrinv = -0.5 * (zi - z0) / t;
841  double dphidphi0 = 1.0;
842  double dphidt = 0.5 * rinv * (zi - z0) / (t * t);
843  double dphidz0 = 0.5 * rinv / t;
844 
845  double r = (zi - z0) / t;
846 
847  rnew[i + nlayers] = r;
848 
849  sigma[j] = sigmax2sdisk;
850  if (std::abs(alpha[i]) < 1e-10) {
851  sigma[j] = sigmaxpsdisk;
852  }
853 
854  D[0][j] = (phimultiplier * dphidrinv + rmultiplier * drdrinv) / sigma[j];
855  D[1][j] = (phimultiplier * dphidphi0 + rmultiplier * drdphi0) / sigma[j];
856  D[2][j] = (phimultiplier * dphidt + rmultiplier * drdt) / sigma[j];
857  D[3][j] = (phimultiplier * dphidz0 + rmultiplier * drdz0) / sigma[j];
858  kfactor[j] = settings.kphi();
859 
860  j++;
861 
862  if (std::abs(alpha[i]) < 1e-10) {
863  D[0][j] = drdrinv / sigmazpsdisk;
864  D[1][j] = drdphi0 / sigmazpsdisk;
865  D[2][j] = drdt / sigmazpsdisk;
866  D[3][j] = drdz0 / sigmazpsdisk;
867  sigma[j] = sigmazpsdisk;
868  kfactor[j] = settings.kr();
869  } else {
870  D[0][j] = drdrinv / sigmaz2sdisk;
871  D[1][j] = drdphi0 / sigmaz2sdisk;
872  D[2][j] = drdt / sigmaz2sdisk;
873  D[3][j] = drdz0 / sigmaz2sdisk;
874  sigma[j] = sigmaz2sdisk;
875  kfactor[j] = settings.kr();
876  }
877 
878  j++;
879  }
880 
881  double M[4][8];
882 
883  for (unsigned int i1 = 0; i1 < 4; i1++) {
884  for (unsigned int i2 = 0; i2 < 4; i2++) {
885  M[i1][i2] = 0.0;
886  for (unsigned int j = 0; j < 2 * n; j++) {
887  M[i1][i2] += D[i1][j] * D[i2][j];
888  }
889  }
890  }
891 
892  invert(M, 4);
893 
894  for (unsigned int j = 0; j < N_FITSTUB * 2; j++) {
895  for (unsigned int i1 = 0; i1 < N_FITPARAM; i1++) {
896  MinvDt[i1][j] = 0.0;
897  iMinvDt[i1][j] = 0;
898  }
899  }
900 
901  for (unsigned int j = 0; j < 2 * n; j++) {
902  for (unsigned int i1 = 0; i1 < 4; i1++) {
903  for (unsigned int i2 = 0; i2 < 4; i2++) {
904  MinvDt[i1][j] += M[i1][i2 + 4] * D[i2][j];
905  }
906  }
907  }
908 
909  for (unsigned int i = 0; i < n; i++) {
910  iD[0][2 * i] =
911  D[0][2 * i] * (1 << settings.chisqphifactbits()) * settings.krinvpars() / (1 << settings.fitrinvbitshift());
912  iD[1][2 * i] =
913  D[1][2 * i] * (1 << settings.chisqphifactbits()) * settings.kphi0pars() / (1 << settings.fitphi0bitshift());
914  iD[2][2 * i] =
915  D[2][2 * i] * (1 << settings.chisqphifactbits()) * settings.ktpars() / (1 << settings.fittbitshift());
916  iD[3][2 * i] =
917  D[3][2 * i] * (1 << settings.chisqphifactbits()) * settings.kz0pars() / (1 << settings.fitz0bitshift());
918 
919  iD[0][2 * i + 1] =
920  D[0][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.krinvpars() / (1 << settings.fitrinvbitshift());
921  iD[1][2 * i + 1] =
922  D[1][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.kphi0pars() / (1 << settings.fitphi0bitshift());
923  iD[2][2 * i + 1] =
924  D[2][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.ktpars() / (1 << settings.fittbitshift());
925  iD[3][2 * i + 1] =
926  D[3][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.kz0pars() / (1 << settings.fitz0bitshift());
927 
928  //First the barrel
929  if (i < nlayers) {
930  MinvDt[0][2 * i] *= rnew[i] / sigmax;
931  MinvDt[1][2 * i] *= rnew[i] / sigmax;
932  MinvDt[2][2 * i] *= rnew[i] / sigmax;
933  MinvDt[3][2 * i] *= rnew[i] / sigmax;
934 
935  iMinvDt[0][2 * i] =
936  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i] * settings.kphi1() / settings.krinvpars();
937  iMinvDt[1][2 * i] =
938  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i] * settings.kphi1() / settings.kphi0pars();
939  iMinvDt[2][2 * i] = (1 << settings.fittbitshift()) * MinvDt[2][2 * i] * settings.kphi1() / settings.ktpars();
940  iMinvDt[3][2 * i] = (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i] * settings.kphi1() / settings.kz0pars();
941 
942  if (rnew[i] < settings.rPS2S()) {
943  MinvDt[0][2 * i + 1] /= sigmazpsbarrel;
944  MinvDt[1][2 * i + 1] /= sigmazpsbarrel;
945  MinvDt[2][2 * i + 1] /= sigmazpsbarrel;
946  MinvDt[3][2 * i + 1] /= sigmazpsbarrel;
947 
948  iMinvDt[0][2 * i + 1] =
949  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * settings.kz() / settings.krinvpars();
950  iMinvDt[1][2 * i + 1] =
951  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * settings.kz() / settings.kphi0pars();
952  iMinvDt[2][2 * i + 1] =
953  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * settings.kz() / settings.ktpars();
954  iMinvDt[3][2 * i + 1] =
955  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * settings.kz() / settings.kz0pars();
956  } else {
957  MinvDt[0][2 * i + 1] /= sigmaz2;
958  MinvDt[1][2 * i + 1] /= sigmaz2;
959  MinvDt[2][2 * i + 1] /= sigmaz2;
960  MinvDt[3][2 * i + 1] /= sigmaz2;
961 
962  int fact = (1 << (settings.nzbitsstub(0) - settings.nzbitsstub(5)));
963 
964  iMinvDt[0][2 * i + 1] =
965  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * fact * settings.kz() / settings.krinvpars();
966  iMinvDt[1][2 * i + 1] =
967  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * fact * settings.kz() / settings.kphi0pars();
968  iMinvDt[2][2 * i + 1] =
969  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * fact * settings.kz() / settings.ktpars();
970  iMinvDt[3][2 * i + 1] =
971  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * fact * settings.kz() / settings.kz0pars();
972  }
973  }
974 
975  //Secondly the disks
976  else {
977  double denom = (std::abs(alpha[i - nlayers]) < 1e-10) ? sigmaxpsdisk : sigmax2sdisk;
978 
979  MinvDt[0][2 * i] *= (rnew[i] / denom);
980  MinvDt[1][2 * i] *= (rnew[i] / denom);
981  MinvDt[2][2 * i] *= (rnew[i] / denom);
982  MinvDt[3][2 * i] *= (rnew[i] / denom);
983 
984  assert(MinvDt[0][2 * i] == MinvDt[0][2 * i]);
985 
986  iMinvDt[0][2 * i] = (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i] * settings.kphi() / settings.krinvpars();
987  iMinvDt[1][2 * i] = (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i] * settings.kphi() / settings.kphi0pars();
988  iMinvDt[2][2 * i] = (1 << settings.fittbitshift()) * MinvDt[2][2 * i] * settings.kphi() / settings.ktpars();
989  iMinvDt[3][2 * i] = (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i] * settings.kphi() / settings.kz();
990 
991  denom = (std::abs(alpha[i - nlayers]) < 1e-10) ? sigmazpsdisk : sigmaz2sdisk;
992 
993  MinvDt[0][2 * i + 1] /= denom;
994  MinvDt[1][2 * i + 1] /= denom;
995  MinvDt[2][2 * i + 1] /= denom;
996  MinvDt[3][2 * i + 1] /= denom;
997 
998  iMinvDt[0][2 * i + 1] =
999  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * settings.krprojshiftdisk() / settings.krinvpars();
1000  iMinvDt[1][2 * i + 1] =
1001  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * settings.krprojshiftdisk() / settings.kphi0pars();
1002  iMinvDt[2][2 * i + 1] =
1003  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * settings.krprojshiftdisk() / settings.ktpars();
1004  iMinvDt[3][2 * i + 1] =
1005  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * settings.krprojshiftdisk() / settings.kz();
1006  }
1007  }
1008 }

References funct::abs(), zMuMuMuonUserData::alpha, cms::cuda::assert(), trklet::Settings::chisqphifactbits(), trklet::Settings::chisqzfactbits(), funct::cos(), makePileupJSON::denom, MillePedeFileConverter_cfg::e, fact, trklet::Settings::fitphi0bitshift(), trklet::Settings::fitrinvbitshift(), trklet::Settings::fittbitshift(), trklet::Settings::fitz0bitshift(), mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, invert(), dqmiolumiharvest::j, kfactor, trklet::Settings::kphi(), trklet::Settings::kphi0pars(), trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::krinvpars(), trklet::Settings::krprojshiftdisk(), trklet::Settings::ktpars(), trklet::Settings::kz(), trklet::Settings::kz0pars(), dqmiodumpmetadata::n, trklet::N_FITPARAM, trklet::N_FITSTUB, nlayers, trklet::Settings::nzbitsstub(), alignCSCRings::r, trklet::rinv(), trklet::Settings::rPS2S(), funct::sin(), mathSSE::sqrt(), trklet::Settings::stripLength(), trklet::Settings::stripPitch(), submitPVValidationJobs::t, and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by fillTable(), and trklet::FitTrack::trackFitChisq().

◆ fillTable()

void TrackDerTable::fillTable ( )

Definition at line 184 of file TrackDerTable.cc.

184  {
185  int nentries = getEntries();
186 
187  for (int i = 0; i < nentries; i++) {
188  TrackDer& der = derivatives_[i];
189  int layermask = der.layerMask();
190  int diskmask = der.diskMask();
191  int alphamask = der.alphaMask();
192  int irinv = der.irinv();
193 
194  double rinv = (irinv - ((1 << (settings_.nrinvBitsTable() - 1)) - 0.5)) * settings_.rinvmax() /
195  (1 << (settings_.nrinvBitsTable() - 1));
196 
197  bool print = false;
198 
199  if (print) {
200  edm::LogVerbatim("Tracklet") << "PRINT i " << i << " " << layermask << " " << diskmask << " " << alphamask << " "
201  << print;
202  }
203 
204  int nlayers = 0;
205  double r[N_LAYER];
206 
207  for (unsigned l = 0; l < N_LAYER; l++) {
208  if (layermask & (1 << (N_LAYER - 1 - l))) {
209  r[nlayers] = settings_.rmean(l);
210  nlayers++;
211  }
212  }
213 
214  int ndisks = 0;
215  double z[N_DISK];
216  double alpha[N_DISK];
217 
218  double t = tpar(settings_, diskmask, layermask);
219 
220  for (unsigned d = 0; d < N_DISK; d++) {
221  if (diskmask & (3 << (2 * (N_DISK - 1 - d)))) {
222  z[ndisks] = settings_.zmean(d);
223  alpha[ndisks] = 0.0;
224  double r = settings_.zmean(d) / t;
225  double r2 = r * r;
226  if (diskmask & (1 << (2 * (N_DISK - 1 - d)))) {
227  if (alphaBits_ == 3) {
228  int ialpha = alphamask & 7;
229  alphamask = alphamask >> 3;
230  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 3.5) / 4.0 / r2;
231  if (print)
232  edm::LogVerbatim("Tracklet") << "PRINT 3 alpha ialpha : " << alpha[ndisks] << " " << ialpha;
233  }
234  if (alphaBits_ == 2) {
235  int ialpha = alphamask & 3;
236  alphamask = alphamask >> 2;
237  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 1.5) / 2.0 / r2;
238  }
239  if (alphaBits_ == 1) {
240  int ialpha = alphamask & 1;
241  alphamask = alphamask >> 1;
242  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 0.5) / r2;
243  if (print)
244  edm::LogVerbatim("Tracklet") << "PRINT 1 alpha ialpha : " << alpha[ndisks] << " " << ialpha;
245  }
246  }
247  ndisks++;
248  }
249  }
250 
251  double D[N_FITPARAM][N_FITSTUB * 2];
252  int iD[N_FITPARAM][N_FITSTUB * 2];
253  double MinvDt[N_FITPARAM][N_FITSTUB * 2];
254  double MinvDtDelta[N_FITPARAM][N_FITSTUB * 2];
255  int iMinvDt[N_FITPARAM][N_FITSTUB * 2];
256  double sigma[N_FITSTUB * 2];
257  double kfactor[N_FITSTUB * 2];
258 
259  if (print) {
260  edm::LogVerbatim("Tracklet") << "PRINT ndisks alpha[0] z[0] t: " << ndisks << " " << alpha[0] << " " << z[0]
261  << " " << t;
262  for (int iii = 0; iii < nlayers; iii++) {
263  edm::LogVerbatim("Tracklet") << "PRINT iii r: " << iii << " " << r[iii];
264  }
265  }
266 
267  calculateDerivatives(settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDt, iMinvDt, sigma, kfactor);
268 
269  double delta = 0.1;
270 
271  for (int i = 0; i < nlayers; i++) {
272  if (r[i] > settings_.rPS2S())
273  continue;
274 
275  r[i] += delta;
276 
278  settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDtDelta, iMinvDt, sigma, kfactor);
279 
280  for (int ii = 0; ii < nlayers; ii++) {
281  if (r[ii] > settings_.rPS2S())
282  continue;
283  double tder = (MinvDtDelta[2][2 * ii + 1] - MinvDt[2][2 * ii + 1]) / delta;
284  int itder = (1 << (settings_.fittbitshift() + settings_.rcorrbits())) * tder * settings_.kr() * settings_.kz() /
285  settings_.ktpars();
286  double zder = (MinvDtDelta[3][2 * ii + 1] - MinvDt[3][2 * ii + 1]) / delta;
287  int izder = (1 << (settings_.fitz0bitshift() + settings_.rcorrbits())) * zder * settings_.kr() *
289  der.settdzcorr(i, ii, tder);
290  der.setz0dzcorr(i, ii, zder);
291  der.setitdzcorr(i, ii, itder);
292  der.setiz0dzcorr(i, ii, izder);
293  }
294 
295  r[i] -= delta;
296  }
297 
298  if (print) {
299  edm::LogVerbatim("Tracklet") << "iMinvDt table build : " << iMinvDt[0][10] << " " << iMinvDt[1][10] << " "
300  << iMinvDt[2][10] << " " << iMinvDt[3][10] << " " << t << " " << nlayers << " "
301  << ndisks;
302 
303  std::string oss = "alpha :";
304  for (int iii = 0; iii < ndisks; iii++) {
305  oss += " ";
306  oss += std::to_string(alpha[iii]);
307  }
308  edm::LogVerbatim("Tracklet") << oss;
309  oss = "z :";
310  for (int iii = 0; iii < ndisks; iii++) {
311  oss += " ";
312  oss += std::to_string(z[iii]);
313  }
314  edm::LogVerbatim("Tracklet") << oss;
315  }
316 
317  if (print) {
318  edm::LogVerbatim("Tracklet") << "PRINT nlayers ndisks : " << nlayers << " " << ndisks;
319  }
320 
321  for (int j = 0; j < nlayers + ndisks; j++) {
322  der.settpar(t);
323 
324  //integer
325  assert(std::abs(iMinvDt[0][2 * j]) < (1 << 23));
326  assert(std::abs(iMinvDt[0][2 * j + 1]) < (1 << 23));
327  assert(std::abs(iMinvDt[1][2 * j]) < (1 << 23));
328  assert(std::abs(iMinvDt[1][2 * j + 1]) < (1 << 23));
329  assert(std::abs(iMinvDt[2][2 * j]) < (1 << 19));
330  assert(std::abs(iMinvDt[2][2 * j + 1]) < (1 << 19));
331  assert(std::abs(iMinvDt[3][2 * j]) < (1 << 19));
332  assert(std::abs(iMinvDt[3][2 * j + 1]) < (1 << 19));
333 
334  if (print) {
335  edm::LogVerbatim("Tracklet") << "PRINT i " << i << " " << j << " " << iMinvDt[1][2 * j] << " "
336  << std::abs(iMinvDt[1][2 * j]);
337  }
338 
339  der.setirinvdphi(j, iMinvDt[0][2 * j]);
340  der.setirinvdzordr(j, iMinvDt[0][2 * j + 1]);
341  der.setiphi0dphi(j, iMinvDt[1][2 * j]);
342  der.setiphi0dzordr(j, iMinvDt[1][2 * j + 1]);
343  der.setitdphi(j, iMinvDt[2][2 * j]);
344  der.setitdzordr(j, iMinvDt[2][2 * j + 1]);
345  der.setiz0dphi(j, iMinvDt[3][2 * j]);
346  der.setiz0dzordr(j, iMinvDt[3][2 * j + 1]);
347  //floating point
348  der.setrinvdphi(j, MinvDt[0][2 * j]);
349  der.setrinvdzordr(j, MinvDt[0][2 * j + 1]);
350  der.setphi0dphi(j, MinvDt[1][2 * j]);
351  der.setphi0dzordr(j, MinvDt[1][2 * j + 1]);
352  der.settdphi(j, MinvDt[2][2 * j]);
353  der.settdzordr(j, MinvDt[2][2 * j + 1]);
354  der.setz0dphi(j, MinvDt[3][2 * j]);
355  der.setz0dzordr(j, MinvDt[3][2 * j + 1]);
356  }
357  }
358 
359  if (settings_.writeTable()) {
360  ofstream outL("FitDerTableNew_LayerMem.txt");
361  for (unsigned int i = 0; i < LayerMem_.size(); i++) {
362  FPGAWord tmp;
363  int tmp1 = LayerMem_[i];
364  if (tmp1 < 0)
365  tmp1 = (1 << 6) - 1;
366  edm::LogVerbatim("Tracklet") << "i LayerMem_ : " << i << " " << tmp1;
367  tmp.set(tmp1, 6, true, __LINE__, __FILE__);
368  outL << tmp.str() << endl;
369  }
370  outL.close();
371 
372  ofstream outD("FitDerTableNew_DiskMem.txt");
373  for (int tmp1 : DiskMem_) {
374  if (tmp1 < 0)
375  tmp1 = (1 << 7) - 1;
376  FPGAWord tmp;
377  tmp.set(tmp1, 7, true, __LINE__, __FILE__);
378  outD << tmp.str() << endl;
379  }
380  outD.close();
381 
382  ofstream outLD("FitDerTableNew_LayerDiskMem.txt");
383  for (int tmp1 : LayerDiskMem_) {
384  if (tmp1 < 0)
385  tmp1 = (1 << 10) - 1;
386  FPGAWord tmp;
387  tmp.set(tmp1, 10, true, __LINE__, __FILE__);
388  outLD << tmp.str() << endl;
389  }
390  outLD.close();
391 
392  unsigned int nderivatives = derivatives_.size();
393  edm::LogVerbatim("Tracklet") << "nderivatives = " << nderivatives;
394 
395  const std::array<string, N_TRKLSEED> seedings = {{"L1L2", "L3L4", "L5L6", "D1D2", "D3D4", "D1L1", "D1L2"}};
396  const string prefix = "FitDerTableNew_";
397 
398  // open files for derivative tables
399  ofstream outrinvdphi[N_TRKLSEED];
400  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
401  const string fname = prefix + "Rinvdphi_" + seedings[i] + ".txt";
402  outrinvdphi[i].open(fname.c_str());
403  }
404 
405  ofstream outrinvdzordr[N_TRKLSEED];
406  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
407  const string fname = prefix + "Rinvdzordr_" + seedings[i] + ".txt";
408  outrinvdzordr[i].open(fname.c_str());
409  }
410 
411  ofstream outphi0dphi[N_TRKLSEED];
412  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
413  const string fname = prefix + "Phi0dphi_" + seedings[i] + ".txt";
414  outphi0dphi[i].open(fname.c_str());
415  }
416 
417  ofstream outphi0dzordr[N_TRKLSEED];
418  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
419  const string fname = prefix + "Phi0dzordr_" + seedings[i] + ".txt";
420  outphi0dzordr[i].open(fname.c_str());
421  }
422 
423  ofstream outtdphi[N_TRKLSEED];
424  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
425  const string fname = prefix + "Tdphi_" + seedings[i] + ".txt";
426  outtdphi[i].open(fname.c_str());
427  }
428 
429  ofstream outtdzordr[N_TRKLSEED];
430  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
431  const string fname = prefix + "Tdzordr_" + seedings[i] + ".txt";
432  outtdzordr[i].open(fname.c_str());
433  }
434 
435  ofstream outz0dphi[N_TRKLSEED];
436  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
437  const string fname = prefix + "Z0dphi_" + seedings[i] + ".txt";
438  outz0dphi[i].open(fname.c_str());
439  }
440 
441  ofstream outz0dzordr[N_TRKLSEED];
442  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
443  string fname = prefix + "Z0dzordr_" + seedings[i] + ".txt";
444  outz0dzordr[i].open(fname.c_str());
445  }
446 
447  for (auto& der : derivatives_) {
448  unsigned int layerhits = der.layerMask(); // 6 bits layer hit pattern
449  unsigned int diskmask = der.diskMask(); // 10 bits disk hit pattern
450  unsigned int diskhits = 0;
451  if (diskmask & (3 << 8))
452  diskhits += 16;
453  if (diskmask & (3 << 6))
454  diskhits += 8;
455  if (diskmask & (3 << 4))
456  diskhits += 4;
457  if (diskmask & (3 << 2))
458  diskhits += 2;
459  if (diskmask & (3 << 0))
460  diskhits += 1;
461  assert(diskhits < 32); // 5 bits
462  unsigned int hits = (layerhits << 5) + diskhits; // 11 bits hit pattern
463  assert(hits < 4096);
464 
465  // loop over all seedings
466  int i = 0; // seeding index
467  for (const string& seed : seedings) {
468  unsigned int iseed1 = 0;
469  unsigned int iseed2 = 0;
470  // check if the seeding is good for the current hit pattern
471  if (seed == "L1L2") {
472  iseed1 = 1;
473  iseed2 = 2;
474  }
475  if (seed == "L3L4") {
476  iseed1 = 3;
477  iseed2 = 4;
478  }
479  if (seed == "L5L6") {
480  iseed1 = 5;
481  iseed2 = 6;
482  }
483  if (seed == "D1D2") {
484  iseed1 = 7;
485  iseed2 = 8;
486  }
487  if (seed == "D3D4") {
488  iseed1 = 9;
489  iseed2 = 10;
490  }
491  if (seed == "D1L1") {
492  iseed1 = 7;
493  iseed2 = 1;
494  }
495  if (seed == "D1L2") {
496  iseed1 = 7;
497  iseed2 = 2;
498  }
499 
500  bool goodseed = (hits & (1 << (11 - iseed1))) and (hits & (1 << (11 - iseed2)));
501 
502  int itmprinvdphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
503  int itmprinvdzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
504  int itmpphi0dphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
505  int itmpphi0dzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
506  int itmptdphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
507  int itmptdzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
508  int itmpz0dphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
509  int itmpz0dzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
510 
511  // loop over bits in hit pattern
512  int ider = 0;
513  if (goodseed) {
514  for (unsigned int ihit = 1; ihit < N_FITSTUB * 2; ++ihit) {
515  // skip seeding layers
516  if (ihit == iseed1 or ihit == iseed2) {
517  ider++;
518  continue;
519  }
520  // skip if no hit
521  if (not(hits & (1 << (11 - ihit))))
522  continue;
523 
524  int inputI = -1;
525  if (seed == "L1L2") {
526  if (ihit == 3 or ihit == 10)
527  inputI = 0; // L3 or D4
528  if (ihit == 4 or ihit == 9)
529  inputI = 1; // L4 or D3
530  if (ihit == 5 or ihit == 8)
531  inputI = 2; // L5 or D2
532  if (ihit == 6 or ihit == 7)
533  inputI = 3; // L6 or D1
534  } else if (seed == "L3L4") {
535  if (ihit == 1)
536  inputI = 0; // L1
537  if (ihit == 2)
538  inputI = 1; // L2
539  if (ihit == 5 or ihit == 8)
540  inputI = 2; // L5 or D2
541  if (ihit == 6 or ihit == 7)
542  inputI = 3; // L6 or D1
543  } else if (seed == "L5L6") {
544  if (ihit == 1)
545  inputI = 0; // L1
546  if (ihit == 2)
547  inputI = 1; // L2
548  if (ihit == 3)
549  inputI = 2; // L3
550  if (ihit == 4)
551  inputI = 3; // L4
552  } else if (seed == "D1D2") {
553  if (ihit == 1)
554  inputI = 0; // L1
555  if (ihit == 9)
556  inputI = 1; // D3
557  if (ihit == 10)
558  inputI = 2; // D4
559  if (ihit == 2 or ihit == 11)
560  inputI = 3; // L2 or D5
561  } else if (seed == "D3D4") {
562  if (ihit == 1)
563  inputI = 0; // L1
564  if (ihit == 7)
565  inputI = 1; // D1
566  if (ihit == 8)
567  inputI = 2; // D2
568  if (ihit == 2 or ihit == 11)
569  inputI = 3; // L2 or D5
570  } else if (seed == "D1L1" or "D1L2") {
571  if (ihit == 8)
572  inputI = 0; // D2
573  if (ihit == 9)
574  inputI = 1; // D3
575  if (ihit == 10)
576  inputI = 2; // D4
577  if (ihit == 11)
578  inputI = 3; // D5
579  }
580  if (inputI >= 0 and inputI < (int)N_PROJ) {
581  itmprinvdphi[inputI] = der.irinvdphi(ider);
582  itmprinvdzordr[inputI] = der.irinvdzordr(ider);
583  itmpphi0dphi[inputI] = der.iphi0dphi(ider);
584  itmpphi0dzordr[inputI] = der.iphi0dzordr(ider);
585  itmptdphi[inputI] = der.itdphi(ider);
586  itmptdzordr[inputI] = der.itdzordr(ider);
587  itmpz0dphi[inputI] = der.iz0dphi(ider);
588  itmpz0dzordr[inputI] = der.iz0dzordr(ider);
589  }
590 
591  ider++;
592 
593  } // for (unsigned int ihit = 1; ihit < 12; ++ihit)
594  } // if (goodseed)
595 
596  FPGAWord tmprinvdphi[N_PROJ];
597  for (unsigned int j = 0; j < N_PROJ; ++j) {
598  if (itmprinvdphi[j] > (1 << 13))
599  itmprinvdphi[j] = (1 << 13) - 1;
600  tmprinvdphi[j].set(itmprinvdphi[j], 14, false, __LINE__, __FILE__);
601  }
602  outrinvdphi[i] << tmprinvdphi[0].str() << tmprinvdphi[1].str() << tmprinvdphi[2].str() << tmprinvdphi[3].str()
603  << endl;
604 
605  FPGAWord tmprinvdzordr[N_PROJ];
606  for (unsigned int j = 0; j < N_PROJ; ++j) {
607  if (itmprinvdzordr[j] > (1 << 15))
608  itmprinvdzordr[j] = (1 << 15) - 1;
609  tmprinvdzordr[j].set(itmprinvdzordr[j], 16, false, __LINE__, __FILE__);
610  }
611  outrinvdzordr[i] << tmprinvdzordr[0].str() << tmprinvdzordr[1].str() << tmprinvdzordr[2].str()
612  << tmprinvdzordr[3].str() << endl;
613 
614  FPGAWord tmpphi0dphi[N_PROJ];
615  for (unsigned int j = 0; j < N_PROJ; ++j) {
616  if (itmpphi0dphi[j] > (1 << 13))
617  itmpphi0dphi[j] = (1 << 13) - 1;
618  tmpphi0dphi[j].set(itmpphi0dphi[j], 14, false, __LINE__, __FILE__);
619  }
620  outphi0dphi[i] << tmpphi0dphi[0].str() << tmpphi0dphi[1].str() << tmpphi0dphi[2].str() << tmpphi0dphi[3].str()
621  << endl;
622 
623  FPGAWord tmpphi0dzordr[N_PROJ];
624  for (unsigned int j = 0; j < N_PROJ; ++j) {
625  if (itmpphi0dzordr[j] > (1 << 15))
626  itmpphi0dzordr[j] = (1 << 15) - 1;
627  tmpphi0dzordr[j].set(itmpphi0dzordr[j], 16, false, __LINE__, __FILE__);
628  }
629  outphi0dzordr[i] << tmpphi0dzordr[0].str() << tmpphi0dzordr[1].str() << tmpphi0dzordr[2].str()
630  << tmpphi0dzordr[3].str() << endl;
631 
632  FPGAWord tmptdphi[N_PROJ];
633  for (unsigned int j = 0; j < N_PROJ; ++j) {
634  if (itmptdphi[j] > (1 << 13))
635  itmptdphi[j] = (1 << 13) - 1;
636  tmptdphi[j].set(itmptdphi[j], 14, false, __LINE__, __FILE__);
637  }
638  outtdphi[i] << tmptdphi[0].str() << tmptdphi[1].str() << tmptdphi[2].str() << tmptdphi[3].str() << endl;
639 
640  FPGAWord tmptdzordr[N_PROJ];
641  for (unsigned int j = 0; j < N_PROJ; ++j) {
642  if (itmptdzordr[j] > (1 << 15))
643  itmptdzordr[j] = (1 << 15) - 1;
644  tmptdzordr[j].set(itmptdzordr[j], 16, false, __LINE__, __FILE__);
645  }
646  outtdzordr[i] << tmptdzordr[0].str() << tmptdzordr[1].str() << tmptdzordr[2].str() << tmptdzordr[3].str()
647  << endl;
648 
649  FPGAWord tmpz0dphi[N_PROJ];
650  for (unsigned int j = 0; j < N_PROJ; ++j) {
651  if (itmpz0dphi[j] > (1 << 13))
652  itmpz0dphi[j] = (1 << 13) - 1;
653  tmpz0dphi[j].set(itmpz0dphi[j], 14, false, __LINE__, __FILE__);
654  }
655  outz0dphi[i] << tmpz0dphi[0].str() << tmpz0dphi[1].str() << tmpz0dphi[2].str() << tmpz0dphi[3].str() << endl;
656 
657  FPGAWord tmpz0dzordr[N_PROJ];
658  for (unsigned int j = 0; j < N_PROJ; ++j) {
659  if (itmpz0dzordr[j] > (1 << 15))
660  itmpz0dzordr[j] = (1 << 15) - 1;
661  tmpz0dzordr[j].set(itmpz0dzordr[j], 16, false, __LINE__, __FILE__);
662  }
663  outz0dzordr[i] << tmpz0dzordr[0].str() << tmpz0dzordr[1].str() << tmpz0dzordr[2].str() << tmpz0dzordr[3].str()
664  << endl;
665 
666  i++;
667  } // for (const string & seed : seedings)
668 
669  } // for (auto & der : derivatives_)
670 
671  // close files
672  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
673  outrinvdphi[i].close();
674  outrinvdzordr[i].close();
675  outphi0dphi[i].close();
676  outphi0dzordr[i].close();
677  outtdphi[i].close();
678  outtdzordr[i].close();
679  outz0dphi[i].close();
680  outz0dzordr[i].close();
681  }
682 
683  } // if (writeFitDerTable)
684 }

References funct::abs(), zMuMuMuonUserData::alpha, alphaBits_, trklet::TrackDer::alphaMask(), cms::cuda::assert(), calculateDerivatives(), ztail::d, dumpMFGeometry_cfg::delta, derivatives_, trklet::TrackDer::diskMask(), DiskMem_, trklet::Settings::fittbitshift(), trklet::Settings::fitz0bitshift(), alignmentValidation::fname, getEntries(), trklet::Settings::half2SmoduleWidth(), hfClusterShapes_cfi::hits, mps_fire::i, cuy::ii, trklet::TrackDer::irinv(), dqmiolumiharvest::j, kfactor, trklet::Settings::kr(), trklet::Settings::ktpars(), trklet::Settings::kz(), trklet::Settings::kz0pars(), cmsLHEtoEOSManager::l, LayerDiskMem_, trklet::TrackDer::layerMask(), LayerMem_, trklet::N_DISK, trklet::N_FITPARAM, trklet::N_FITSTUB, trklet::N_LAYER, trklet::N_PROJ, trklet::N_TRKLSEED, nlayers, trklet::Settings::nrinvBitsTable(), or, ZMuMuAnalysisNtupler_cff::prefix, print(), alignCSCRings::r, diffTwoXMLs::r2, trklet::Settings::rcorrbits(), trklet::rinv(), trklet::Settings::rinvmax(), trklet::Settings::rmean(), trklet::Settings::rPS2S(), fileCollector::seed, trklet::FPGAWord::set(), trklet::TrackDer::setiphi0dphi(), trklet::TrackDer::setiphi0dzordr(), trklet::TrackDer::setirinvdphi(), trklet::TrackDer::setirinvdzordr(), trklet::TrackDer::setitdphi(), trklet::TrackDer::setitdzcorr(), trklet::TrackDer::setitdzordr(), trklet::TrackDer::setiz0dphi(), trklet::TrackDer::setiz0dzcorr(), trklet::TrackDer::setiz0dzordr(), trklet::TrackDer::setphi0dphi(), trklet::TrackDer::setphi0dzordr(), trklet::TrackDer::setrinvdphi(), trklet::TrackDer::setrinvdzordr(), trklet::TrackDer::settdphi(), trklet::TrackDer::settdzcorr(), trklet::TrackDer::settdzordr(), settings_, trklet::TrackDer::settpar(), trklet::TrackDer::setz0dphi(), trklet::TrackDer::setz0dzcorr(), trklet::TrackDer::setz0dzordr(), trklet::FPGAWord::str(), AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, createJobs::tmp, tpar(), trklet::Settings::writeTable(), and trklet::Settings::zmean().

Referenced by trklet::FitTrack::trackFitChisq().

◆ getDerivatives() [1/2]

const TrackDer* trklet::TrackDerTable::getDerivatives ( int  index) const
inline

Definition at line 24 of file TrackDerTable.h.

24 { return &derivatives_[index]; }

References derivatives_.

Referenced by trklet::FitTrack::trackFitChisq().

◆ getDerivatives() [2/2]

const TrackDer * TrackDerTable::getDerivatives ( unsigned int  layermask,
unsigned int  diskmask,
unsigned int  alphaindex,
unsigned int  rinvindex 
) const

Definition at line 38 of file TrackDerTable.cc.

41  {
42  int index = getIndex(layermask, diskmask);
43  if (index < 0) {
44  return nullptr;
45  }
46  return &derivatives_[index + alphaindex * (1 << settings_.nrinvBitsTable()) + rinvindex];
47 }

References derivatives_, getIndex(), trklet::Settings::nrinvBitsTable(), and settings_.

◆ getEntries()

int trklet::TrackDerTable::getEntries ( ) const
inline

Definition at line 37 of file TrackDerTable.h.

37 { return nextLayerDiskValue_; }

References nextLayerDiskValue_.

Referenced by fillTable(), and trklet::FitTrack::trackFitChisq().

◆ getIndex()

int TrackDerTable::getIndex ( unsigned int  layermask,
unsigned int  diskmask 
) const

Definition at line 49 of file TrackDerTable.cc.

49  {
50  assert(layermask < LayerMem_.size());
51 
52  assert(diskmask < DiskMem_.size());
53 
54  int layercode = LayerMem_[layermask];
55  int diskcode = DiskMem_[diskmask];
56 
57  if (diskcode < 0 || layercode < 0) {
58  if (settings_.warnNoDer()) {
59  edm::LogPrint("Tracklet") << "layermask diskmask : " << layermask << " " << diskmask;
60  }
61  return -1;
62  }
63 
64  assert(layercode >= 0);
65  assert(layercode < (1 << LayerMemBits_));
66  assert(diskcode >= 0);
67  assert(diskcode < (1 << DiskMemBits_));
68 
69  int layerdiskaddress = layercode + (diskcode << LayerMemBits_);
70 
71  assert(layerdiskaddress >= 0);
72  assert(layerdiskaddress < (1 << (LayerMemBits_ + DiskMemBits_)));
73 
74  int address = LayerDiskMem_[layerdiskaddress];
75 
76  if (address < 0) {
77  if (settings_.warnNoDer()) {
78  edm::LogVerbatim("Tracklet") << "layermask diskmask : " << layermask << " " << diskmask;
79  }
80  return -1;
81  }
82 
83  assert(address >= 0);
84  assert(address < (1 << LayerDiskMemBits_));
85 
86  return address;
87 }

References cms::cuda::assert(), DiskMem_, DiskMemBits_, LayerDiskMem_, LayerDiskMemBits_, LayerMem_, LayerMemBits_, settings_, and trklet::Settings::warnNoDer().

Referenced by getDerivatives().

◆ invert() [1/2]

void TrackDerTable::invert ( double  M[4][8],
unsigned int  n 
)
static

Definition at line 686 of file TrackDerTable.cc.

686  {
687  assert(n <= 4);
688 
689  unsigned int i, j, k;
690  double ratio, a;
691 
692  for (i = 0; i < n; i++) {
693  for (j = n; j < 2 * n; j++) {
694  if (i == (j - n))
695  M[i][j] = 1.0;
696  else
697  M[i][j] = 0.0;
698  }
699  }
700 
701  for (i = 0; i < n; i++) {
702  for (j = 0; j < n; j++) {
703  if (i != j) {
704  ratio = M[j][i] / M[i][i];
705  for (k = 0; k < 2 * n; k++) {
706  M[j][k] -= ratio * M[i][k];
707  }
708  }
709  }
710  }
711 
712  for (i = 0; i < n; i++) {
713  a = M[i][i];
714  for (j = 0; j < 2 * n; j++) {
715  M[i][j] /= a;
716  }
717  }
718 }

References a, cms::cuda::assert(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, dqmiodumpmetadata::n, and particleFlowDisplacedVertex_cfi::ratio.

Referenced by calculateDerivatives().

◆ invert() [2/2]

void TrackDerTable::invert ( std::vector< std::vector< double > > &  M,
unsigned int  n 
)
static

Definition at line 720 of file TrackDerTable.cc.

720  {
721  assert(M.size() == n);
722  assert(M[0].size() == 2 * n);
723 
724  unsigned int i, j, k;
725  double ratio, a;
726 
727  for (i = 0; i < n; i++) {
728  for (j = n; j < 2 * n; j++) {
729  if (i == (j - n))
730  M[i][j] = 1.0;
731  else
732  M[i][j] = 0.0;
733  }
734  }
735 
736  for (i = 0; i < n; i++) {
737  for (j = 0; j < n; j++) {
738  if (i != j) {
739  ratio = M[j][i] / M[i][i];
740  for (k = 0; k < 2 * n; k++) {
741  M[j][k] -= ratio * M[i][k];
742  }
743  }
744  }
745  }
746 
747  for (i = 0; i < n; i++) {
748  a = M[i][i];
749  for (j = 0; j < 2 * n; j++) {
750  M[i][j] /= a;
751  }
752  }
753 }

References a, cms::cuda::assert(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, dqmiodumpmetadata::n, particleFlowDisplacedVertex_cfi::ratio, and findQualityFiles::size.

◆ readPatternFile()

void TrackDerTable::readPatternFile ( std::string  fileName)

Definition at line 139 of file TrackDerTable.cc.

139  {
140  ifstream in(fileName.c_str());
141  if (settings_.debugTracklet()) {
142  edm::LogVerbatim("Tracklet") << "reading fit pattern file " << fileName;
143  edm::LogVerbatim("Tracklet") << " flags (good/eof/fail/bad): " << in.good() << " " << in.eof() << " " << in.fail()
144  << " " << in.bad();
145  }
146 
147  while (in.good()) {
148  std::string layerstr, diskstr;
149  int multiplicity;
150 
151  in >> layerstr >> diskstr >> multiplicity;
152 
153  //correct multiplicity if you dont want 3 bits of alpha.
154  if (alphaBits_ == 2) {
155  if (multiplicity == 8)
156  multiplicity = 4;
157  if (multiplicity == 64)
158  multiplicity = 16;
159  if (multiplicity == 512)
160  multiplicity = 64;
161  }
162 
163  if (alphaBits_ == 1) {
164  if (multiplicity == 8)
165  multiplicity = 2;
166  if (multiplicity == 64)
167  multiplicity = 4;
168  if (multiplicity == 512)
169  multiplicity = 8;
170  }
171 
172  if (!in.good())
173  continue;
174 
175  char** tmpptr = nullptr;
176 
177  int layers = strtol(layerstr.c_str(), tmpptr, 2);
178  int disks = strtol(diskstr.c_str(), tmpptr, 2);
179 
180  addEntry(layers, disks, multiplicity, (1 << settings_.nrinvBitsTable()));
181  }
182 }

References addEntry(), alphaBits_, trklet::Settings::debugTracklet(), alignBH_cfg::disks, MillePedeFileConverter_cfg::fileName, recoMuon::in, hgcalTopologyTester_cfi::layers, trklet::Settings::nrinvBitsTable(), settings_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by trklet::FitTrack::trackFitChisq().

◆ tpar()

double TrackDerTable::tpar ( Settings const &  settings,
int  diskmask,
int  layermask 
)
static

Definition at line 1010 of file TrackDerTable.cc.

1010  {
1011  if (diskmask == 0)
1012  return 0.0;
1013 
1014  double tmax = 1000.0;
1015  double tmin = 0.0;
1016 
1017  for (int d = 1; d <= (int)N_DISK; d++) {
1018  if (diskmask & (1 << (2 * (5 - d) + 1))) { //PS hit
1019  double dmax = settings.zmean(d - 1) / 22.0;
1020  if (dmax > sinh(2.4))
1021  dmax = sinh(2.4);
1022  double dmin = settings.zmean(d - 1) / 65.0;
1023  if (dmax < tmax)
1024  tmax = dmax;
1025  if (dmin > tmin)
1026  tmin = dmin;
1027  }
1028 
1029  if (diskmask & (1 << (2 * (5 - d)))) { //2S hit
1030  double dmax = settings.zmean(d - 1) / 65.0;
1031  double dmin = settings.zmean(d - 1) / 105.0;
1032  if (dmax < tmax)
1033  tmax = dmax;
1034  if (dmin > tmin)
1035  tmin = dmin;
1036  }
1037  }
1038 
1039  for (int l = 1; l <= (int)N_LAYER; l++) {
1040  if (layermask & (1 << (6 - l))) {
1041  double lmax = settings.zlength() / settings.rmean(l - 1);
1042  if (lmax < tmax)
1043  tmax = lmax;
1044  }
1045  }
1046 
1047  return 0.5 * (tmax + tmin) * 1.07;
1048 }

References ztail::d, createfilelist::int, cmsLHEtoEOSManager::l, trklet::N_DISK, trklet::N_LAYER, trklet::Settings::rmean(), tmax, muonTiming_cfi::tmin, trklet::Settings::zlength(), and trklet::Settings::zmean().

Referenced by fillTable(), and trklet::FitTrack::trackFitChisq().

Member Data Documentation

◆ alphaBits_

unsigned int trklet::TrackDerTable::alphaBits_
private

Definition at line 72 of file TrackDerTable.h.

Referenced by addEntry(), fillTable(), readPatternFile(), and TrackDerTable().

◆ derivatives_

std::vector<TrackDer> trklet::TrackDerTable::derivatives_
private

Definition at line 77 of file TrackDerTable.h.

Referenced by addEntry(), fillTable(), and getDerivatives().

◆ DiskMem_

std::vector<int> trklet::TrackDerTable::DiskMem_
private

Definition at line 66 of file TrackDerTable.h.

Referenced by addEntry(), fillTable(), getIndex(), and TrackDerTable().

◆ DiskMemBits_

unsigned int trklet::TrackDerTable::DiskMemBits_
private

Definition at line 70 of file TrackDerTable.h.

Referenced by addEntry(), getIndex(), and TrackDerTable().

◆ lastMultiplicity_

int trklet::TrackDerTable::lastMultiplicity_
private

Definition at line 82 of file TrackDerTable.h.

Referenced by addEntry(), and TrackDerTable().

◆ LayerDiskMem_

std::vector<int> trklet::TrackDerTable::LayerDiskMem_
private

Definition at line 67 of file TrackDerTable.h.

Referenced by addEntry(), fillTable(), getIndex(), and TrackDerTable().

◆ LayerDiskMemBits_

unsigned int trklet::TrackDerTable::LayerDiskMemBits_
private

Definition at line 71 of file TrackDerTable.h.

Referenced by getIndex(), and TrackDerTable().

◆ LayerMem_

std::vector<int> trklet::TrackDerTable::LayerMem_
private

Definition at line 65 of file TrackDerTable.h.

Referenced by addEntry(), fillTable(), getIndex(), and TrackDerTable().

◆ LayerMemBits_

unsigned int trklet::TrackDerTable::LayerMemBits_
private

Definition at line 69 of file TrackDerTable.h.

Referenced by addEntry(), getIndex(), and TrackDerTable().

◆ Ndisk_

unsigned int trklet::TrackDerTable::Ndisk_
private

Definition at line 75 of file TrackDerTable.h.

Referenced by addEntry(), and TrackDerTable().

◆ nextDiskValue_

int trklet::TrackDerTable::nextDiskValue_
private

Definition at line 80 of file TrackDerTable.h.

Referenced by addEntry(), and TrackDerTable().

◆ nextLayerDiskValue_

int trklet::TrackDerTable::nextLayerDiskValue_
private

Definition at line 81 of file TrackDerTable.h.

Referenced by addEntry(), getEntries(), and TrackDerTable().

◆ nextLayerValue_

int trklet::TrackDerTable::nextLayerValue_
private

Definition at line 79 of file TrackDerTable.h.

Referenced by addEntry(), and TrackDerTable().

◆ Nlay_

unsigned int trklet::TrackDerTable::Nlay_
private

Definition at line 74 of file TrackDerTable.h.

Referenced by addEntry(), and TrackDerTable().

◆ settings_

Settings const& trklet::TrackDerTable::settings_
private

Definition at line 63 of file TrackDerTable.h.

Referenced by fillTable(), getDerivatives(), getIndex(), readPatternFile(), and TrackDerTable().

alignBH_cfg.disks
tuple disks
Definition: alignBH_cfg.py:13
trklet::TrackDer::settdphi
void settdphi(int i, double tdphi)
Definition: TrackDer.h:49
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
trklet::TrackDerTable::calculateDerivatives
static void calculateDerivatives(Settings const &settings, unsigned int nlayers, double r[N_LAYER], unsigned int ndisks, double z[N_DISK], double alpha[N_DISK], double t, double rinv, double D[N_FITPARAM][N_FITSTUB *2], int iD[N_FITPARAM][N_FITSTUB *2], double MinvDt[N_FITPARAM][N_FITSTUB *2], int iMinvDt[N_FITPARAM][N_FITSTUB *2], double sigma[N_FITSTUB *2], double kfactor[N_FITSTUB *2])
Definition: TrackDerTable.cc:755
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
trklet::FPGAWord::str
std::string str() const
Definition: FPGAWord.cc:54
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
trklet::TrackDer
Definition: TrackDer.h:20
makePileupJSON.denom
denom
Definition: makePileupJSON.py:147
trklet::Settings::ktpars
double ktpars() const
Definition: Settings.h:332
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
trklet::Settings::fittbitshift
int fittbitshift() const
Definition: Settings.h:317
trklet::TrackDerTable::nextLayerDiskValue_
int nextLayerDiskValue_
Definition: TrackDerTable.h:81
muonTiming_cfi.tmin
tmin
Definition: muonTiming_cfi.py:24
trklet::TrackDer::setiz0dzcorr
void setiz0dzcorr(int i, int j, int iz0dzcorr)
Definition: TrackDer.h:43
trklet::Settings::fitz0bitshift
int fitz0bitshift() const
Definition: Settings.h:318
trklet::TrackDer::setz0dzcorr
void setz0dzcorr(int i, int j, double z0dzcorr)
Definition: TrackDer.h:55
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
trklet::TrackDerTable::settings_
Settings const & settings_
Definition: TrackDerTable.h:63
trklet::TrackDerTable::getEntries
int getEntries() const
Definition: TrackDerTable.h:37
trklet::TrackDerTable::LayerMem_
std::vector< int > LayerMem_
Definition: TrackDerTable.h:65
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
trklet::TrackDer::setrinvdphi
void setrinvdphi(int i, double rinvdphi)
Definition: TrackDer.h:45
trklet::TrackDer::setitdzcorr
void setitdzcorr(int i, int j, int itdzcorr)
Definition: TrackDer.h:42
trklet::TrackDer::itdphi
double itdphi(int i) const
Definition: TrackDer.h:73
cms::cuda::assert
assert(be >=bs)
trklet::FPGAWord::set
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
Definition: FPGAWord.cc:14
trklet::TrackDer::irinvdzordr
double irinvdzordr(int i) const
Definition: TrackDer.h:70
trklet::Settings::rmean
double rmean(unsigned int iLayer) const
Definition: Settings.h:128
trklet::TrackDer::setiphi0dphi
void setiphi0dphi(int i, int iphi0dphi)
Definition: TrackDer.h:35
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::TrackDer::iphi0dzordr
double iphi0dzordr(int i) const
Definition: TrackDer.h:72
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
trklet::TrackDerTable::Ndisk_
unsigned int Ndisk_
Definition: TrackDerTable.h:75
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::Settings::half2SmoduleWidth
double half2SmoduleWidth() const
Definition: Settings.h:108
trklet::Settings::kz0pars
double kz0pars() const
Definition: Settings.h:333
trklet::Settings::writeTable
bool writeTable() const
Definition: Settings.h:153
trklet::N_FITSTUB
constexpr unsigned int N_FITSTUB
Definition: Settings.h:735
tmax
static const double tmax[3]
Definition: CastorTimeSlew.cc:7
trklet::TrackDerTable::LayerDiskMem_
std::vector< int > LayerDiskMem_
Definition: TrackDerTable.h:67
trklet::TrackDerTable::LayerMemBits_
unsigned int LayerMemBits_
Definition: TrackDerTable.h:69
trklet::TrackDer::setiz0dzordr
void setiz0dzordr(int i, int iz0dzordr)
Definition: TrackDer.h:40
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
trklet::TrackDer::setitdzordr
void setitdzordr(int i, int itdzordr)
Definition: TrackDer.h:38
fileCollector.seed
seed
Definition: fileCollector.py:127
trklet::TrackDer::setphi0dzordr
void setphi0dzordr(int i, double phi0dzordr)
Definition: TrackDer.h:48
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
trklet::Settings::rinvmax
double rinvmax() const
Definition: Settings.h:173
trklet::TrackDerTable::DiskMemBits_
unsigned int DiskMemBits_
Definition: TrackDerTable.h:70
trklet::TrackDerTable::tpar
static double tpar(Settings const &settings, int diskmask, int layermask)
Definition: TrackDerTable.cc:1010
trklet::TrackDerTable::getIndex
int getIndex(unsigned int layermask, unsigned int diskmask) const
Definition: TrackDerTable.cc:49
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
trklet::TrackDerTable::LayerDiskMemBits_
unsigned int LayerDiskMemBits_
Definition: TrackDerTable.h:71
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::TrackDerTable::DiskMem_
std::vector< int > DiskMem_
Definition: TrackDerTable.h:66
trklet::Settings::zmean
double zmean(unsigned int iDisk) const
Definition: Settings.h:131
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
dqmdumpme.k
k
Definition: dqmdumpme.py:60
trklet::TrackDer::settpar
void settpar(double t)
Definition: TrackDer.h:81
trklet::TrackDer::setiphi0dzordr
void setiphi0dzordr(int i, int iphi0dzordr)
Definition: TrackDer.h:36
trklet::FPGAWord
Definition: FPGAWord.h:9
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trklet::Settings::kr
double kr() const
Definition: Settings.h:250
trklet::TrackDer::iz0dphi
double iz0dphi(int i) const
Definition: TrackDer.h:75
trklet::TrackDer::setz0dphi
void setz0dphi(int i, double z0dphi)
Definition: TrackDer.h:51
trklet::Settings::rcorrbits
int rcorrbits() const
Definition: Settings.h:321
trklet::TrackDerTable::invert
static void invert(double M[4][8], unsigned int n)
Definition: TrackDerTable.cc:686
trklet::TrackDer::setz0dzordr
void setz0dzordr(int i, double z0dzordr)
Definition: TrackDer.h:52
a
double a
Definition: hdecay.h:119
trklet::TrackDerTable::nextDiskValue_
int nextDiskValue_
Definition: TrackDerTable.h:80
trklet::rinv
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:167
trklet::TrackDer::settdzordr
void settdzordr(int i, double tdzordr)
Definition: TrackDer.h:50
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
trklet::N_FITPARAM
constexpr unsigned int N_FITPARAM
Definition: Settings.h:734
trklet::N_PROJ
constexpr unsigned int N_PROJ
Definition: Settings.h:731
recoMuon::in
Definition: RecoMuonEnumerators.h:6
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
trklet::TrackDer::settdzcorr
void settdzcorr(int i, int j, double tdzcorr)
Definition: TrackDer.h:54
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
createfilelist.int
int
Definition: createfilelist.py:10
trklet::TrackDerTable::nextLayerValue_
int nextLayerValue_
Definition: TrackDerTable.h:79
kfactor
const unsigned int kfactor
Definition: FileRandomMultiParticlePGunProducer.cc:19
trklet::TrackDer::layerMask
int layerMask() const
Definition: TrackDer.h:28
trklet::TrackDer::alphaMask
int alphaMask() const
Definition: TrackDer.h:30
trklet::TrackDer::iz0dzordr
double iz0dzordr(int i) const
Definition: TrackDer.h:76
trklet::TrackDer::setphi0dphi
void setphi0dphi(int i, double phi0dphi)
Definition: TrackDer.h:47
trklet::TrackDerTable::addEntry
void addEntry(unsigned int layermask, unsigned int diskmask, int multiplicity, int nrinv)
Definition: TrackDerTable.cc:89
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
alignCSCRings.r
r
Definition: alignCSCRings.py:93
trklet::TrackDer::diskMask
int diskMask() const
Definition: TrackDer.h:29
trklet::N_TRKLSEED
constexpr unsigned int N_TRKLSEED
Definition: Settings.h:730
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
trklet::TrackDer::iphi0dphi
double iphi0dphi(int i) const
Definition: TrackDer.h:71
trklet::Settings::warnNoDer
bool warnNoDer() const
Definition: Settings.h:150
trklet::TrackDer::setrinvdzordr
void setrinvdzordr(int i, double rinvdzordr)
Definition: TrackDer.h:46
trklet::TrackDer::setirinvdzordr
void setirinvdzordr(int i, int irinvdzordr)
Definition: TrackDer.h:34
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
trklet::Settings::kz
double kz() const
Definition: Settings.h:249
trklet::TrackDer::irinv
int irinv() const
Definition: TrackDer.h:31
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:146
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
trklet::Settings::nrinvBitsTable
int nrinvBitsTable() const
Definition: Settings.h:178
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::TrackDer::irinvdphi
double irinvdphi(int i) const
Definition: TrackDer.h:69
ztail.d
d
Definition: ztail.py:151
trklet::TrackDerTable::derivatives_
std::vector< TrackDer > derivatives_
Definition: TrackDerTable.h:77
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::TrackDer::itdzordr
double itdzordr(int i) const
Definition: TrackDer.h:74
trklet::Settings::rPS2S
double rPS2S() const
Definition: Settings.h:267
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
trklet::TrackDer::setitdphi
void setitdphi(int i, int itdphi)
Definition: TrackDer.h:37
cuy.ii
ii
Definition: cuy.py:590
trklet::Settings::alphaBitsTable
int alphaBitsTable() const
Definition: Settings.h:177
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
trklet::TrackDerTable::alphaBits_
unsigned int alphaBits_
Definition: TrackDerTable.h:72
trklet::TrackDerTable::lastMultiplicity_
int lastMultiplicity_
Definition: TrackDerTable.h:82
trklet::TrackDer::setiz0dphi
void setiz0dphi(int i, int iz0dphi)
Definition: TrackDer.h:39
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
nlayers
Definition: HIMultiTrackSelector.h:48
ZMuMuAnalysisNtupler_cff.prefix
prefix
Definition: ZMuMuAnalysisNtupler_cff.py:14
trklet::TrackDerTable::Nlay_
unsigned int Nlay_
Definition: TrackDerTable.h:74
trklet::TrackDer::setirinvdphi
void setirinvdphi(int i, int irinvdphi)
Definition: TrackDer.h:33