CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1TMuonBarrelKalmanAlgo Class Reference

#include <L1TMuonBarrelKalmanAlgo.h>

Classes

class  StubSorter
 
class  TrackSorter
 

Public Types

typedef ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > CovarianceMatrix2
 
typedef ROOT::Math::SMatrix< double, 1, 3 > Matrix13
 
typedef ROOT::Math::SMatrix< double, 2, 3 > Matrix23
 
typedef ROOT::Math::SMatrix< double, 3, 1 > Matrix31
 
typedef ROOT::Math::SMatrix< double, 3, 2 > Matrix32
 
typedef ROOT::Math::SMatrix< double, 3, 3 > Matrix33
 
typedef ROOT::Math::SVector< double, 2 > Vector2
 

Public Member Functions

void addBMTFMuon (int, const L1MuKBMTrack &, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &)
 
std::pair< bool, L1MuKBMTrackchain (const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &)
 
L1MuKBMTrackCollection clean (const L1MuKBMTrackCollection &, uint)
 
L1MuKBMTrackCollection cleanAndSort (const L1MuKBMTrackCollection &, uint)
 
l1t::RegionalMuonCand convertToBMTF (const L1MuKBMTrack &track)
 
 L1TMuonBarrelKalmanAlgo (const edm::ParameterSet &settings)
 

Private Member Functions

void calculateEta (L1MuKBMTrack &track)
 
int correctedPhi (const L1MuKBMTCombinedStubRef &, int)
 
int correctedPhiB (const L1MuKBMTCombinedStubRef &)
 
int customBitmask (unsigned int, unsigned int, unsigned int, unsigned int)
 
int encode (bool ownwheel, int sector, bool tag)
 
void estimateChiSquare (L1MuKBMTrack &)
 
uint etaStubRank (const L1MuKBMTCombinedStubRef &)
 
int fp_product (float, int, uint)
 
bool getBit (int, int)
 
std::pair< bool, uint > getByCode (const L1MuKBMTrackCollection &tracks, int mask)
 
int hitPattern (const L1MuKBMTrack &)
 
std::pair< bool, uint > match (const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &, int)
 
int phiAt2 (const L1MuKBMTrack &track)
 
void propagate (L1MuKBMTrack &)
 
int ptLUT (int K)
 
bool punchThroughVeto (const L1MuKBMTrack &track)
 
int rank (const L1MuKBMTrack &)
 
void setFloatingPointValues (L1MuKBMTrack &, bool)
 
std::map< int, int > trackAddress (const L1MuKBMTrack &, int &)
 
uint twosCompToBits (int)
 
bool update (L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
 
void updateEta (L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
 
bool updateLUT (L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
 
bool updateOffline (L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
 
bool updateOffline1D (L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
 
void vertexConstraint (L1MuKBMTrack &)
 
void vertexConstraintLUT (L1MuKBMTrack &)
 
void vertexConstraintOffline (L1MuKBMTrack &)
 
int wrapAround (int, int)
 

Private Attributes

std::vector< double > aPhi_
 
std::vector< double > aPhiB_
 
std::vector< double > aPhiBNLO_
 
std::vector< double > bPhi_
 
std::vector< double > bPhiB_
 
std::vector< double > chiSquare_
 
std::vector< int > chiSquareCut_
 
std::vector< int > chiSquareCutCurv_
 
std::vector< int > chiSquareCutPattern_
 
std::vector< int > combos1_
 
std::vector< int > combos2_
 
std::vector< int > combos3_
 
std::vector< int > combos4_
 
std::vector< double > eLoss_
 
std::vector< double > etaLUT0_
 
std::vector< double > etaLUT1_
 
uint globalChi2Cut_
 
std::vector< double > initK2_
 
std::vector< double > initK_
 
L1TMuonBarrelKalmanLUTslutService_
 
std::vector< double > mScatteringPhi_
 
std::vector< double > mScatteringPhiB_
 
std::vector< double > phiAt2_
 
double pointResolutionPhi_
 
double pointResolutionPhiB_
 
double pointResolutionVertex_
 
bool useOfflineAlgo_
 
bool verbose_
 

Detailed Description

Definition at line 16 of file L1TMuonBarrelKalmanAlgo.h.

Member Typedef Documentation

typedef ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > L1TMuonBarrelKalmanAlgo::CovarianceMatrix2

Definition at line 19 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SMatrix<double,1,3> L1TMuonBarrelKalmanAlgo::Matrix13

Definition at line 22 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SMatrix<double,2,3> L1TMuonBarrelKalmanAlgo::Matrix23

Definition at line 21 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SMatrix<double,3,1> L1TMuonBarrelKalmanAlgo::Matrix31

Definition at line 23 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SMatrix<double,3,2> L1TMuonBarrelKalmanAlgo::Matrix32

Definition at line 20 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SMatrix<double,3,3> L1TMuonBarrelKalmanAlgo::Matrix33

Definition at line 24 of file L1TMuonBarrelKalmanAlgo.h.

typedef ROOT::Math::SVector<double,2> L1TMuonBarrelKalmanAlgo::Vector2

Definition at line 18 of file L1TMuonBarrelKalmanAlgo.h.

Constructor & Destructor Documentation

L1TMuonBarrelKalmanAlgo::L1TMuonBarrelKalmanAlgo ( const edm::ParameterSet settings)

Definition at line 5 of file L1TMuonBarrelKalmanAlgo.cc.

5  :
6  verbose_(settings.getParameter<bool>("verbose")),
8  initK_(settings.getParameter<std::vector<double> >("initialK")),
9  initK2_(settings.getParameter<std::vector<double> >("initialK2")),
10  eLoss_(settings.getParameter<std::vector<double> >("eLoss")),
11  aPhi_(settings.getParameter<std::vector<double> >("aPhi")),
12  aPhiB_(settings.getParameter<std::vector<double> >("aPhiB")),
13  aPhiBNLO_(settings.getParameter<std::vector<double> >("aPhiBNLO")),
14  bPhi_(settings.getParameter<std::vector<double> >("bPhi")),
15  bPhiB_(settings.getParameter<std::vector<double> >("bPhiB")),
16  phiAt2_(settings.getParameter<std::vector<double> >("phiAt2")),
17  globalChi2Cut_(settings.getParameter<unsigned int>("globalChi2Cut")),
18  chiSquare_(settings.getParameter<std::vector<double> >("chiSquare")),
19  chiSquareCutPattern_(settings.getParameter<std::vector<int> >("chiSquareCutPattern")),
20  chiSquareCutCurv_(settings.getParameter<std::vector<int> >("chiSquareCutCurvMax")),
21  chiSquareCut_(settings.getParameter<std::vector<int> >("chiSquareCut")),
22  combos4_(settings.getParameter<std::vector<int> >("combos4")),
23  combos3_(settings.getParameter<std::vector<int> >("combos3")),
24  combos2_(settings.getParameter<std::vector<int> >("combos2")),
25  combos1_(settings.getParameter<std::vector<int> >("combos1")),
26  useOfflineAlgo_(settings.getParameter<bool>("useOfflineAlgo")),
27  mScatteringPhi_(settings.getParameter<std::vector<double> >("mScatteringPhi")),
28  mScatteringPhiB_(settings.getParameter<std::vector<double> >("mScatteringPhiB")),
29  pointResolutionPhi_(settings.getParameter<double>("pointResolutionPhi")),
30  pointResolutionPhiB_(settings.getParameter<double>("pointResolutionPhiB")),
31  pointResolutionVertex_(settings.getParameter<double>("pointResolutionVertex"))
32 
33 {
34 
35 
36 
37 }
std::vector< double > bPhiB_
T getParameter(std::string const &) const
std::vector< double > aPhi_
std::vector< double > aPhiB_
std::vector< double > aPhiBNLO_
std::vector< double > mScatteringPhiB_
std::vector< double > phiAt2_
std::vector< double > chiSquare_
std::vector< double > initK2_
std::vector< double > mScatteringPhi_
L1TMuonBarrelKalmanLUTs * lutService_
std::vector< double > eLoss_
std::vector< double > bPhi_
std::vector< double > initK_
std::vector< int > chiSquareCutPattern_
std::vector< int > chiSquareCutCurv_

Member Function Documentation

void L1TMuonBarrelKalmanAlgo::addBMTFMuon ( int  bx,
const L1MuKBMTrack track,
std::unique_ptr< l1t::RegionalMuonCandBxCollection > &  out 
)

Definition at line 133 of file L1TMuonBarrelKalmanAlgo.cc.

References convertToBMTF().

Referenced by L1TMuonBarrelKalmanTrackProducer::produce().

133  {
134  out->push_back(bx,convertToBMTF(track));
135 }
l1t::RegionalMuonCand convertToBMTF(const L1MuKBMTrack &track)
void L1TMuonBarrelKalmanAlgo::calculateEta ( L1MuKBMTrack track)
private

Definition at line 1149 of file L1TMuonBarrelKalmanAlgo.cc.

References L1TMuonBarrelKalmanLUTs::coarseEta(), PVValHelper::eta, etaStubRank(), fp_product(), L1MuKBMTrack::hitPattern(), mps_fire::i, lutService_, RecoTauDiscriminantConfiguration::mask, listBenchmarks::pattern, rank(), L1MuKBMTrack::setCoarseEta(), L1MuKBMTrack::setFineEta(), Validation_hcalonly_cfi::sign, L1MuKBMTrack::stubs(), parallelization::uint(), and makeMuonMisalignmentScenario::wheel.

Referenced by chain().

1149  {
1150  uint pattern = track.hitPattern();
1151  int wheel = track.stubs()[0]->whNum();
1152  uint awheel=fabs(wheel);
1153  int sign=1;
1154  if (wheel<0)
1155  sign=-1;
1156  uint nstubs = track.stubs().size();
1157  uint mask=0;
1158  for (unsigned int i=0;i<track.stubs().size();++i) {
1159  if (fabs(track.stubs()[i]->whNum())!=awheel)
1160  mask=mask|(1<<i);
1161  }
1162  mask=(awheel<<nstubs)|mask;
1163  track.setCoarseEta(sign*lutService_->coarseEta(pattern,mask));
1164 
1165 
1166  int sumweights=0;
1167  int sums=0;
1168 
1169  for (const auto& stub : track.stubs()) {
1170  uint rank = etaStubRank(stub);
1171  if (rank==0)
1172  continue;
1173  // printf("Stub station=%d rank=%d values=%d %d\n",stub->stNum(),rank,stub->eta1(),stub->eta2());
1174  sumweights+=rank;
1175  sums+=rank*stub->eta1();
1176  }
1177 
1178  //0.5 0.332031 0.25 0.199219 0.164063
1179  float factor;
1180  if (sumweights==1)
1181  factor=1.0;
1182  else if (sumweights==2)
1183  factor = 0.5;
1184  else if (sumweights==3)
1185  factor=0.332031;
1186  else if (sumweights==4)
1187  factor=0.25;
1188  else if (sumweights==5)
1189  factor=0.199219;
1190  else if (sumweights==6)
1191  factor=0.164063;
1192  else
1193  factor=0.0;
1194 
1195 
1196 
1197 
1198  int eta=0;
1199  if (sums>0)
1200  eta=fp_product(factor,sums,10);
1201  else
1202  eta=-fp_product(factor,fabs(sums),10);
1203 
1204 
1205  //int eta=int(factor*sums);
1206  // printf("Eta debug %f *%d=%d\n",factor,sums,eta);
1207 
1208  if (sumweights>0)
1209  track.setFineEta(eta);
1210 }
int rank(const L1MuKBMTrack &)
int fp_product(float, int, uint)
L1TMuonBarrelKalmanLUTs * lutService_
void setCoarseEta(int)
void setFineEta(int)
const L1MuKBMTCombinedStubRefVector & stubs() const
def uint(string)
int hitPattern() const
Definition: L1MuKBMTrack.cc:86
uint etaStubRank(const L1MuKBMTCombinedStubRef &)
std::pair< bool, L1MuKBMTrack > L1TMuonBarrelKalmanAlgo::chain ( const L1MuKBMTCombinedStubRef seed,
const L1MuKBMTCombinedStubRefVector stubs 
)

Definition at line 688 of file L1TMuonBarrelKalmanAlgo.cc.

References calculateEta(), ALCARECOTkAlJpsiMuMu_cff::charge, clean(), combos1_, combos2_, combos3_, combos4_, correctedPhi(), correctedPhiB(), estimateChiSquare(), objects.autophobj::float, getBit(), globalChi2Cut_, hitPattern(), mps_fire::i, initK2_, initK_, createfilelist::int, RecoTauDiscriminantConfiguration::mask, match(), phiAt2(), pointResolutionPhi_, pointResolutionPhiB_, propagate(), punchThroughVeto(), rank(), setFloatingPointValues(), HiIsolationCommonParameters_cff::track, update(), verbose_, vertexConstraint(), and TriggerAnalyzer::veto.

Referenced by L1TMuonBarrelKalmanRegionModule::process().

688  {
689  L1MuKBMTrackCollection pretracks;
690  std::vector<int> combinatorics;
691  switch(seed->stNum()) {
692  case 1:
693  combinatorics=combos1_;
694  break;
695  case 2:
696  combinatorics=combos2_;
697  break;
698 
699  case 3:
700  combinatorics=combos3_;
701  break;
702 
703  case 4:
704  combinatorics=combos4_;
705  break;
706 
707  default:
708  printf("Something really bad happend\n");
709  }
710 
711  L1MuKBMTrack nullTrack(seed,correctedPhi(seed,seed->scNum()),correctedPhiB(seed));
712 
713  for( const auto& mask : combinatorics) {
714  L1MuKBMTrack track(seed,correctedPhi(seed,seed->scNum()),correctedPhiB(seed));
715  int phiB = correctedPhiB(seed);
716  int charge;
717  if (phiB==0)
718  charge = 0;
719  else
720  charge=phiB/fabs(phiB);
721 
722  int address=phiB;
723  if (track.step()>=3 && (fabs(seed->phiB())>63))
724  address=charge*63*8;
725  if (track.step()==2 && (fabs(seed->phiB())>127))
726  address=charge*127*8;
727  int initialK = int(initK_[seed->stNum()-1]*address/(1+initK2_[seed->stNum()-1]*charge*address));
728  if (initialK>8191)
729  initialK=8191;
730  if (initialK<-8191)
731  initialK=-8191;
732  track.setCoordinates(seed->stNum(),initialK,correctedPhi(seed,seed->scNum()),phiB);
733  if (seed->quality()<4) {
734  track.setCoordinates(seed->stNum(),0,correctedPhi(seed,seed->scNum()),0);
735  }
736 
737 
738 
739  track.setHitPattern(hitPattern(track));
740  //set covariance
741  L1MuKBMTrack::CovarianceMatrix covariance;
742 
743 
744  float DK=512*512.;
745  covariance(0,0)=DK;
746  covariance(0,1)=0;
747  covariance(0,2)=0;
748  covariance(1,0)=0;
749  covariance(1,1)=float(pointResolutionPhi_);
750  covariance(1,2)=0;
751  covariance(2,0)=0;
752  covariance(2,1)=0;
753  covariance(2,2)=float(pointResolutionPhiB_);
754  track.setCovariance(covariance);
755  //
756  if (verbose_) {
757  printf("New Kalman fit staring at step=%d, phi=%d,phiB=%d with curvature=%d\n",track.step(),track.positionAngle(),track.bendingAngle(),track.curvature());
758  printf("BITMASK:");
759  for (unsigned int i=0;i<4;++i)
760  printf("%d",getBit(mask,i));
761  printf("\n");
762  printf("------------------------------------------------------\n");
763  printf("------------------------------------------------------\n");
764  printf("------------------------------------------------------\n");
765  printf("stubs:\n");
766  for (const auto& stub: stubs)
767  printf("station=%d phi=%d phiB=%d qual=%d tag=%d sector=%d wheel=%d fineEta= %d %d\n",stub->stNum(),correctedPhi(stub,seed->scNum()),correctedPhiB(stub),stub->quality(),stub->tag(),stub->scNum(),stub->whNum(),stub->eta1(),stub->eta2());
768  printf("------------------------------------------------------\n");
769  printf("------------------------------------------------------\n");
770 
771  }
772 
773  int phiAtStation2=0;
774 
775  while(track.step()>0) {
776  // muon station 1
777  if (track.step()==1) {
778  track.setCoordinatesAtMuon(track.curvature(),track.positionAngle(),track.bendingAngle());
779  phiAtStation2=phiAt2(track);
783  //calculate coarse eta
785 
786 
787  if (verbose_)
788  printf ("Unconstrained PT in Muon System: pt=%f\n",track.ptUnconstrained());
789  }
790 
791  propagate(track);
792  if (verbose_)
793  printf("propagated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",track.step(),track.positionAngle(),track.bendingAngle(),track.curvature());
794 
795  if (track.step()>0)
796  if (getBit(mask,track.step()-1)) {
797  std::pair<bool,uint> bestStub = match(seed,stubs,track.step());
798  if ((!bestStub.first) || (!update(track,stubs[bestStub.second],mask)))
799  break;
800  if (verbose_) {
801  printf("updated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",track.step(),track.positionAngle(),track.bendingAngle(),track.curvature());
802  }
803  }
804 
805 
806  if (track.step()==0) {
807  track.setCoordinatesAtVertex(track.curvature(),track.positionAngle(),track.bendingAngle());
808  if (verbose_)
809  printf(" Coordinates before vertex constraint step:%d,phi=%d,dxy=%d,K=%d\n",track.step(),track.phiAtVertex(),track.dxy(),track.curvatureAtVertex());
810  if (verbose_)
811  printf("Chi Square = %d\n",track.approxChi2());
812 
813  if (fabs(track.approxChi2())>globalChi2Cut_)
814  break;
816  if (verbose_) {
817  printf(" Coordinates after vertex constraint step:%d,phi=%d,dxy=%d,K=%d maximum local chi2=%d\n",track.step(),track.phiAtVertex(),track.dxy(),track.curvatureAtVertex(),track.approxChi2());
818  printf("------------------------------------------------------\n");
819  printf("------------------------------------------------------\n");
820  }
822  //rset the coordinates at muon to include phi at station 2
823  track.setCoordinatesAtMuon(track.curvatureAtMuon(),phiAtStation2,track.phiBAtMuon());
824  track.setRank(rank(track));
825  if (verbose_)
826  printf ("Floating point coordinates at vertex: pt=%f, eta=%f phi=%f\n",track.pt(),track.eta(),track.phi());
827  pretracks.push_back(track);
828  }
829  }
830  }
831  //Now for all the pretracks we need only one
832  L1MuKBMTrackCollection cleaned = clean(pretracks,seed->stNum());
833 
834  if (!cleaned.empty()) {
835  bool veto = punchThroughVeto(cleaned[0]);
836  if (verbose_)
837  printf("Punch through veto=%d\n",veto);
838  if (!veto)
839  return std::make_pair(true,cleaned[0]);
840  }
841  return std::make_pair(false,nullTrack);
842 }
int correctedPhiB(const L1MuKBMTCombinedStubRef &)
std::pair< bool, uint > match(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &, int)
int phiAt2(const L1MuKBMTrack &track)
bool punchThroughVeto(const L1MuKBMTrack &track)
bool update(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
void estimateChiSquare(L1MuKBMTrack &)
int rank(const L1MuKBMTrack &)
std::vector< double > initK2_
void vertexConstraint(L1MuKBMTrack &)
std::vector< double > initK_
void setFloatingPointValues(L1MuKBMTrack &, bool)
L1MuKBMTrackCollection clean(const L1MuKBMTrackCollection &, uint)
void calculateEta(L1MuKBMTrack &track)
int hitPattern(const L1MuKBMTrack &)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:47
L1MuKBMTrackCollection L1TMuonBarrelKalmanAlgo::clean ( const L1MuKBMTrackCollection tracks,
uint  seed 
)

Definition at line 1092 of file L1TMuonBarrelKalmanAlgo.cc.

References mps_fire::i, MillePedeFileConverter_cfg::out, rank(), cond::persistency::search(), HiIsolationCommonParameters_cff::track, and parallelization::uint().

Referenced by chain().

1092  {
1094 
1095  std::map<uint,int> infoRank;
1096  std::map<uint,L1MuKBMTrack> infoTrack;
1097  for (uint i=3;i<=15;++i) {
1098  if (i==4 ||i==8)
1099  continue;
1100  infoRank[i]=-1;
1101  }
1102 
1103  for (const auto& track :tracks) {
1104  infoRank[track.hitPattern()] = rank(track);
1105  infoTrack[track.hitPattern()]=track;
1106  }
1107 
1108 
1109  int selected=15;
1110  if (seed==4) //station 4 seeded
1111  {
1112  int sel6 = infoRank[12]>= infoRank[10] ? 12 : 10;
1113  int sel5 = infoRank[14]>= infoRank[9] ? 14 : 9;
1114  int sel4 = infoRank[11]>= infoRank[13] ? 11 : 13;
1115  int sel3 = infoRank[sel6]>= infoRank[sel5] ? sel6 : sel5;
1116  int sel2 = infoRank[sel4]>= infoRank[sel3] ? sel4 : sel3;
1117  selected = infoRank[15]>= infoRank[sel2] ? 15 : sel2;
1118  }
1119  if (seed==3) //station 3 seeded
1120  {
1121  int sel2 = infoRank[5]>= infoRank[6] ? 5 : 6;
1122  selected = infoRank[7]>= infoRank[sel2] ? 7 : sel2;
1123  }
1124  if (seed==2) //station 3 seeded
1125  selected = 3;
1126 
1127  auto search = infoTrack.find(selected);
1128  if (search != infoTrack.end())
1129  out.push_back(search->second);
1130 
1131  return out;
1132 
1133 
1134 }
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:314
int rank(const L1MuKBMTrack &)
def uint(string)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection L1TMuonBarrelKalmanAlgo::cleanAndSort ( const L1MuKBMTrackCollection pretracks,
uint  keep 
)

Definition at line 902 of file L1TMuonBarrelKalmanAlgo.cc.

References mps_fire::i, createfilelist::int, MillePedeFileConverter_cfg::out, rank(), MCScenario_CRAFT1_22X::sorter(), parallelization::uint(), and verbose_.

Referenced by L1TMuonBarrelKalmanRegionModule::process(), and L1TMuonBarrelKalmanSectorProcessor::process().

902  {
904 
905  if (verbose_)
906  printf(" -----Preselected Kalman Tracks-----\n");
907 
908 
909  for(const auto& track1 : pretracks) {
910  if (verbose_)
911  printf("Pre Track charge=%d pt=%f eta=%f phi=%f curvature=%d curvature STA =%d stubs=%d bitmask=%d rank=%d chi=%d pts=%f %f\n",track1.charge(),track1.pt(),track1.eta(),track1.phi(),track1.curvatureAtVertex(),track1.curvatureAtMuon(),int(track1.stubs().size()),track1.hitPattern(),rank(track1),track1.approxChi2(),track1.pt(),track1.ptUnconstrained());
912 
913  bool keep=true;
914  for(const auto& track2 : pretracks) {
915  if (track1==track2)
916  continue;
917  if (!track1.overlapTrack(track2))
918  continue;
919  if (track1.rank()<track2.rank())
920  keep=false;
921  }
922  if (keep)
923  out.push_back(track1);
924  }
925 
926  if (verbose_) {
927  printf(" -----Algo Result Kalman Tracks-----\n");
928  for (const auto& track1 :out)
929  printf("Final Kalman Track charge=%d pt=%f eta=%f phi=%f curvature=%d curvature STA =%d stubs=%d chi2=%d pts=%f %f\n",track1.charge(),track1.pt(),track1.eta(),track1.phi(),track1.curvatureAtVertex(),track1.curvatureAtMuon(),int(track1.stubs().size()),track1.approxChi2(),track1.pt(),track1.ptUnconstrained());
930  }
931 
932 
933 
934  TrackSorter sorter;
935  if (!out.empty())
936  std::sort(out.begin(),out.end(),sorter);
937 
938 
939  L1MuKBMTrackCollection exported;
940  for (uint i=0;i<out.size();++i)
941  if (i<=keep)
942  exported.push_back(out[i]);
943  return exported;
944 }
int rank(const L1MuKBMTrack &)
const int keep
def uint(string)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
l1t::RegionalMuonCand L1TMuonBarrelKalmanAlgo::convertToBMTF ( const L1MuKBMTrack track)

Definition at line 52 of file L1TMuonBarrelKalmanAlgo.cc.

References funct::abs(), l1t::bmtf, L1MuKBMTrack::coarseEta(), L1MuKBMTrack::curvatureAtMuon(), L1MuKBMTrack::curvatureAtVertex(), L1MuKBMTrack::dxy(), PVValHelper::dxy, PVValHelper::eta, L1MuKBMTrack::fineEta(), L1MuKBMTrack::hasFineEta(), CaloTPGTranscoder_cfi::HF, createfilelist::int, M_PI, metsig::muon, phi, L1MuKBMTrack::phiAtMuon(), EnergyCorrector::pt, hiDetachedQuadStep_cff::pt2, ptLUT(), jets_cff::quality, rank(), L1MuKBMTrack::sector(), l1t::RegionalMuonCand::setDataword(), l1t::RegionalMuonCand::setHwDXY(), l1t::RegionalMuonCand::setHwHF(), l1t::RegionalMuonCand::setHwPt2(), Validation_hcalonly_cfi::sign, trackAddress(), twosCompToBits(), and L1MuKBMTrack::wheel().

Referenced by addBMTFMuon(), and L1TMuonBarrelKalmanSectorProcessor::makeWord().

52  {
53  int K = fabs(track.curvatureAtVertex());
54  //calibration
55  int sign,signValid;
56 
57  if (track.curvatureAtVertex()==0) {
58  sign=0;
59  signValid=0;
60  }
61  else if (track.curvatureAtVertex()>0) {
62  sign=0;
63  signValid=1;
64  }
65  else {
66  sign=1;
67  signValid=1;
68  }
69 
70  if (K<22)
71  K=22;
72 
73  if (K>4095)
74  K=4095;
75 
76  int pt = ptLUT(K);
77 
78 
79  int K2 = fabs(track.curvatureAtMuon());
80  if (K2<22)
81  K2=22;
82 
83  if (K2>4095)
84  K2=4095;
85  int pt2 = ptLUT(K2)/2;
86  int eta = track.hasFineEta() ? track.fineEta() : track.coarseEta();
87 
88  int phi=track.phiAtMuon()+1024;
89  int signPhi=1;
90  if (phi>=0) {
91  phi = phi>>1;
92  signPhi=1;
93  }
94  else {
95  phi = (-phi)>>1;
96  signPhi=-1;
97  }
98  phi =signPhi*int((phi*2*M_PI/(6.0*2048.0))/(0.625*M_PI/180.0));
99 
100  int processor=track.sector();
101  int HF = track.hasFineEta();
102 
103  int quality=12|(rank(track)>>6);
104 
105  int dxy=abs(track.dxy())>>9;
106 
107  int trackAddr;
108  std::map<int,int> addr = trackAddress(track,trackAddr);
109 
110  l1t::RegionalMuonCand muon(pt,phi,eta,sign,signValid,quality,processor,l1t::bmtf,addr);
111  muon.setHwHF(HF);
112  muon.setHwPt2(pt2);
113  muon.setHwDXY(dxy);
114 
115 
116  //nw the words!
117  uint32_t word1=pt;
118  word1=word1 | quality<<9;
119  word1=word1 | (twosCompToBits(eta))<<13;
120  word1=word1 | HF<<22;
121  word1=word1 | (twosCompToBits(phi))<<23;
122 
123  uint32_t word2=sign;
124  word2=word2 | signValid<<1;
125  word2=word2 | dxy<<2;
126  word2=word2 | trackAddr<<4;
127  word2=word2 | (twosCompToBits(track.wheel()))<<20;
128  word2=word2 | pt2<<23;
129  muon.setDataword(word2,word1);
130  return muon;
131 }
int fineEta() const
int coarseEta() const
Definition: L1MuKBMTrack.cc:78
int rank(const L1MuKBMTrack &)
int curvatureAtMuon() const
Definition: L1MuKBMTrack.cc:44
bool hasFineEta() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int phiAtMuon() const
Definition: L1MuKBMTrack.cc:47
#define M_PI
int wheel() const
Definition: L1MuKBMTrack.cc:96
int dxy() const
Definition: L1MuKBMTrack.cc:62
int curvatureAtVertex() const
Definition: L1MuKBMTrack.cc:54
int sector() const
Definition: L1MuKBMTrack.cc:93
std::map< int, int > trackAddress(const L1MuKBMTrack &, int &)
int L1TMuonBarrelKalmanAlgo::correctedPhi ( const L1MuKBMTCombinedStubRef stub,
int  sector 
)
private

Definition at line 169 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by chain(), estimateChiSquare(), match(), phiAt2(), updateLUT(), updateOffline(), and updateOffline1D().

169  {
170  if (stub->scNum()==sector) {
171  return stub->phi();
172  }
173  else if ((stub->scNum()==sector-1) || (stub->scNum()==11 && sector==0)) {
174  return stub->phi()-2144;
175  }
176  else if ((stub->scNum()==sector+1) || (stub->scNum()==0 && sector==11)) {
177  return stub->phi()+2144;
178  }
179  return stub->phi();
180 }
int L1TMuonBarrelKalmanAlgo::correctedPhiB ( const L1MuKBMTCombinedStubRef stub)
private

Definition at line 163 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by chain(), updateLUT(), and updateOffline().

163  {
164  //Promote phiB to 12 bits
165  return 8*stub->phiB();
166 
167 }
int L1TMuonBarrelKalmanAlgo::customBitmask ( unsigned int  bit1,
unsigned int  bit2,
unsigned int  bit3,
unsigned int  bit4 
)
private

Definition at line 193 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by rank().

193  {
194  return bit1*1+bit2*2+bit3*4+bit4*8;
195 }
int L1TMuonBarrelKalmanAlgo::encode ( bool  ownwheel,
int  sector,
bool  tag 
)
private

Definition at line 947 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by trackAddress().

947  {
948  if (ownwheel) {
949  if (sector==0) {
950  if (tag)
951  return 9;
952  else
953  return 8;
954  }
955  else if (sector==1) {
956  if (tag)
957  return 11;
958  else
959  return 10;
960 
961  }
962  else {
963  if (tag)
964  return 13;
965  else
966  return 12;
967  }
968 
969  }
970  else {
971  if (sector==0) {
972  if (tag)
973  return 1;
974  else
975  return 0;
976  }
977  else if (sector==1) {
978  if (tag)
979  return 3;
980  else
981  return 2;
982 
983  }
984  else {
985  if (tag)
986  return 5;
987  else
988  return 4;
989  }
990  }
991  return 15;
992 }
void L1TMuonBarrelKalmanAlgo::estimateChiSquare ( L1MuKBMTrack track)
private

Definition at line 849 of file L1TMuonBarrelKalmanAlgo.cc.

References chiSquare_, correctedPhi(), L1MuKBMTrack::curvatureAtMuon(), delta, fp_product(), L1MuKBMTrack::phiAtMuon(), L1MuKBMTrack::phiBAtMuon(), L1MuKBMTrack::sector(), L1MuKBMTrack::setApproxChi2(), L1MuKBMTrack::stubs(), and parallelization::uint().

Referenced by chain().

849  {
850  //here we have a simplification of the algorithm for the sake of the emulator - rsult is identical
851  // we apply cuts on the firmware as |u -u'|^2 < a+b *K^2
852  int K = track.curvatureAtMuon();
853 
854  int chi=0;
855  // printf("Starting Chi calculation\n");
856  int coords = (track.phiAtMuon()+track.phiBAtMuon())>>3;
857  for (const auto& stub: track.stubs()) {
858  int AK = fp_product(-chiSquare_[stub->stNum()-1],K>>3,8);
859  int stubCoords = (correctedPhi(stub,track.sector())>>3)+stub->phiB();
860  uint delta = fabs(stubCoords-coords+AK);
861  // printf("station=%d AK=%d delta=%d\n",stub->stNum(),AK,delta);
862 
863  chi=chi+fabs(delta);
864  }
865  // chi=chi/2;
866  if (chi>127)
867  chi=127;
868  track.setApproxChi2(chi);
869 }
dbl * delta
Definition: mlp_gen.cc:36
int phiBAtMuon() const
Definition: L1MuKBMTrack.cc:50
int fp_product(float, int, uint)
std::vector< double > chiSquare_
int curvatureAtMuon() const
Definition: L1MuKBMTrack.cc:44
const L1MuKBMTCombinedStubRefVector & stubs() const
int phiAtMuon() const
Definition: L1MuKBMTrack.cc:47
def uint(string)
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
int sector() const
Definition: L1MuKBMTrack.cc:93
void setApproxChi2(int)
uint L1TMuonBarrelKalmanAlgo::etaStubRank ( const L1MuKBMTCombinedStubRef stub)
private

Definition at line 1136 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by calculateEta().

1136  {
1137 
1138  if (stub->qeta1()!=0 && stub->qeta2()!=0) {
1139  return 0;
1140  }
1141  if (stub->qeta1()==0) {
1142  return 0;
1143  }
1144  // return (stub->qeta1()*4+stub->stNum());
1145  return (stub->qeta1());
1146 
1147 }
int L1TMuonBarrelKalmanAlgo::fp_product ( float  a,
int  b,
uint  bits 
)
private

Definition at line 1064 of file L1TMuonBarrelKalmanAlgo.cc.

References bits.

Referenced by calculateEta(), estimateChiSquare(), phiAt2(), propagate(), updateLUT(), and vertexConstraintLUT().

1064  {
1065  return long(a*(1<<bits)*b)>>bits;
1066 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
bool L1TMuonBarrelKalmanAlgo::getBit ( int  bitmask,
int  pos 
)
private

Definition at line 197 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by chain().

197  {
198  return (bitmask & ( 1 << pos )) >> pos;
199 }
std::pair< bool, uint > L1TMuonBarrelKalmanAlgo::getByCode ( const L1MuKBMTrackCollection tracks,
int  mask 
)
private

Definition at line 41 of file L1TMuonBarrelKalmanAlgo.cc.

References hitPattern(), mps_fire::i, and parallelization::uint().

41  {
42  for (uint i=0;i<tracks.size();++i) {
43  printf("Code=%d, track=%d\n",tracks[i].hitPattern(),mask);
44  if (tracks[i].hitPattern()==mask)
45  return std::make_pair(true,i);
46  }
47  return std::make_pair(false,0);
48 }
def uint(string)
int hitPattern(const L1MuKBMTrack &)
int L1TMuonBarrelKalmanAlgo::hitPattern ( const L1MuKBMTrack track)
private

Definition at line 183 of file L1TMuonBarrelKalmanAlgo.cc.

References RecoTauDiscriminantConfiguration::mask, funct::pow(), and L1MuKBMTrack::stubs().

Referenced by chain(), getByCode(), rank(), updateLUT(), updateOffline(), and updateOffline1D().

183  {
184  unsigned int mask = 0;
185  for (const auto& stub : track.stubs()) {
186  mask = mask+round(pow(2,stub->stNum()-1));
187  }
188  return mask;
189 }
const L1MuKBMTCombinedStubRefVector & stubs() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::pair< bool, uint > L1TMuonBarrelKalmanAlgo::match ( const L1MuKBMTCombinedStubRef seed,
const L1MuKBMTCombinedStubRefVector stubs,
int  step 
)
private

Definition at line 139 of file L1TMuonBarrelKalmanAlgo.cc.

References correctedPhi(), edmIntegrityCheck::d, SoftLeptonByDistance_cfi::distance, runEdmFileComparison::found, N, parallelization::uint(), and wrapAround().

Referenced by chain().

139  {
141 
142  bool found=false;
143  uint best=0;
144  int distance=100000;
145  uint N=0;
146  for (const auto& stub :stubs) {
147  N=N+1;
148  if (stub->stNum()!=step)
149  continue;
150 
151  int d = fabs(wrapAround(((correctedPhi(seed,seed->scNum())-correctedPhi(stub,seed->scNum()))>>3),1024));
152  if (d<distance) {
153  distance = d;
154  best=N-1;
155  found=true;
156  }
157  }
158  return std::make_pair(found,best);
159 }
std::vector< edm::Ref< L1MuKBMTCombinedStubCollection > > L1MuKBMTCombinedStubRefVector
#define N
Definition: blowfish.cc:9
def uint(string)
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
step
int L1TMuonBarrelKalmanAlgo::phiAt2 ( const L1MuKBMTrack track)
private

Definition at line 1213 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::bendingAngle(), correctedPhi(), L1MuKBMTrack::curvature(), fp_product(), phi, phiAt2_, L1MuKBMTrack::positionAngle(), L1MuKBMTrack::sector(), L1MuKBMTrack::stubs(), and verbose_.

Referenced by chain().

1213  {
1214 
1215  //If there is stub at station 2 use this else propagate from 1
1216  for (const auto& stub:track.stubs())
1217  if (stub->stNum()==2)
1218  return correctedPhi(stub,track.sector());
1219 
1220 
1221  int K = track.curvature();
1222  int phi = track.positionAngle();
1223  int phiB = track.bendingAngle();
1224 
1225  //phi propagation
1226  int phi11 = fp_product(phiAt2_[0],K,10);
1227  int phi12 = fp_product(phiAt2_[1],phiB,10);
1228 
1229  int phiNew =phi+phi11+phi12;
1230  if (phiNew>2047)
1231  phiNew=2047;
1232  if (phiNew<-2048)
1233  phiNew=-2048;
1234 
1235 
1236  if (verbose_) {
1237  printf("phi at station 2 = %d* %f = %d, %d* %f =%d , final=%d\n",K,phiAt2_[0],phi11,phiB,phiAt2_[1],phi12,phiNew);
1238  }
1239 
1240  return phiNew;
1241 
1242 }
int bendingAngle() const
Definition: L1MuKBMTrack.cc:74
std::vector< double > phiAt2_
int fp_product(float, int, uint)
const L1MuKBMTCombinedStubRefVector & stubs() const
int curvature() const
Definition: L1MuKBMTrack.cc:66
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
int sector() const
Definition: L1MuKBMTrack.cc:93
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
void L1TMuonBarrelKalmanAlgo::propagate ( L1MuKBMTrack track)
private

Definition at line 203 of file L1TMuonBarrelKalmanAlgo.cc.

References a, aPhi_, aPhiB_, aPhiBNLO_, b, L1MuKBMTrack::bendingAngle(), bPhi_, bPhiB_, ALCARECOTkAlJpsiMuMu_cff::charge, L1MuKBMTrack::covariance(), L1MuKBMTrack::curvature(), eLoss_, fp_product(), createfilelist::int, mScatteringPhi_, mScatteringPhiB_, phi, L1MuKBMTrack::positionAngle(), L1MuKBMTrack::setCoordinates(), L1MuKBMTrack::setCovariance(), L1MuKBMTrack::step(), verbose_, and wrapAround().

Referenced by chain().

203  {
204  int K = track.curvature();
205  int phi = track.positionAngle();
206  int phiB = track.bendingAngle();
207  unsigned int step = track.step();
208 
209  //energy loss term only for MU->VERTEX
210  //int offset=int(charge*eLoss_[step-1]*K*K);
211  // if (fabs(offset)>4096)
212  // offset=4096*offset/fabs(offset);
213 
214  int charge=1;
215  if (K!=0)
216  charge = K/fabs(K);
217 
218 
219 
220 
221  int KBound=K;
222  if (KBound>4095)
223  KBound=4095;
224  if (KBound<-4095)
225  KBound=-4095;
226 
227  int deltaK=0;
228  int KNew=0;
229  if (step==1) {
230  int addr = KBound/2;
231  if (addr<0)
232  addr=(-KBound)/2;
233  deltaK =2*addr-int(2*addr/(1+eLoss_[step-1]*addr));
234 
235  if (verbose_)
236  printf("propagate to vertex K=%d deltaK=%d addr=%d\n",K,deltaK,addr);
237  }
238 
239  if (K>=0)
240  KNew=K-deltaK;
241  else
242  KNew=K+deltaK;
243 
244 
245  //phi propagation
246  int phi11 = fp_product(aPhi_[step-1],K,10);
247  int phi12 = fp_product(-bPhi_[step-1],phiB,10);
248  if (verbose_) {
249  printf("phi prop = %d* %f = %d, %d* %f =%d\n",K,aPhi_[step-1],phi11,phiB,-bPhi_[step-1],phi12);
250  }
251  int phiNew =wrapAround(phi+phi11+phi12,8192);
252  //phiB propagation
253  int phiB11 = fp_product(aPhiB_[step-1],K,10);
254  int phiB12 = fp_product(bPhiB_[step-1],phiB,11);
255  int phiBNew = wrapAround(phiB11+phiB12,2048);
256  if (verbose_) {
257  printf("phiB prop = %d* %f = %d, %d* %f =%d\n",K,aPhiB_[step-1],phiB11,phiB,bPhiB_[step-1],phiB12);
258  }
259 
260 
261  //Only for the propagation to vertex we use the LUT for better precision and the full function
262  if (step==1) {
263  int addr = KBound/2;
264  phiBNew = wrapAround(int(aPhiB_[step-1]*addr/(1+charge*aPhiBNLO_[step-1]*addr))+int(bPhiB_[step-1]*phiB),2048);
265  }
267  //Rest of the stuff is for the offline version only
268  //where we want to check what is happening in the covariaznce matrix
269 
270  //Create the transformation matrix
271  double a[9];
272  a[0] = 1.;
273  a[1] = 0.0;
274  a[2] = 0.0;
275  a[3] = aPhi_[step-1];
276  // a[3] = 0.0;
277  a[4] = 1.0;
278  a[5] = -bPhi_[step-1];
279  //a[6]=0.0;
280  a[6] = aPhiB_[step-1];
281  a[7] = 0.0;
282  a[8] = bPhiB_[step-1];
283 
284 
285  ROOT::Math::SMatrix<double,3> P(a,9);
286 
287  const std::vector<double>& covLine = track.covariance();
288  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(),covLine.end());
289  cov = ROOT::Math::Similarity(P,cov);
290 
291 
292  //Add the multiple scattering
293  double phiRMS = mScatteringPhi_[step-1]*K*K;
294  double phiBRMS = mScatteringPhiB_[step-1]*K*K;
295 
296  std::vector<double> b(6);
297  b[0] = 0;
298  b[1] = 0;
299  b[2] =phiRMS;
300  b[3] =0;
301  b[4] = 0;
302  b[5] = phiBRMS;
303 
304  reco::Candidate::CovarianceMatrix MS(b.begin(),b.end());
305 
306  cov = cov+MS;
307 
308  if (verbose_) {
309  printf("Covariance term for phiB = %f\n",cov(2,2));
310  printf("Multiple scattering term for phiB = %f\n",MS(2,2));
311  }
312 
313 
314 
315  track.setCovariance(cov);
316  track.setCoordinates(step-1,KNew,phiNew,phiBNew);
317 
318 }
std::vector< double > bPhiB_
std::vector< double > aPhi_
std::vector< double > aPhiB_
std::vector< double > aPhiBNLO_
int step() const
Definition: L1MuKBMTrack.cc:90
std::vector< double > mScatteringPhiB_
int bendingAngle() const
Definition: L1MuKBMTrack.cc:74
int fp_product(float, int, uint)
void setCoordinates(int, int, int, int)
void setCovariance(const CovarianceMatrix &)
std::vector< double > mScatteringPhi_
std::vector< double > eLoss_
int curvature() const
Definition: L1MuKBMTrack.cc:66
std::vector< double > bPhi_
const std::vector< double > & covariance() const
double b
Definition: hdecay.h:120
std::pair< OmniClusterRef, TrackingParticleRef > P
double a
Definition: hdecay.h:121
step
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:47
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
int L1TMuonBarrelKalmanAlgo::ptLUT ( int  K)
private

Definition at line 1070 of file L1TMuonBarrelKalmanAlgo.cc.

References objects.autophobj::float, createfilelist::int, and EnergyCorrector::pt.

Referenced by convertToBMTF().

1070  {
1071  float lsb=1.25/float(1<<13);
1072  float ptF = (2*(1.0/(lsb*float(K))));
1073  float KF = 1.0/ptF;
1074  int pt=0;
1075  KF = 0.797*KF+0.454*KF*KF-5.679e-4;
1076  if (KF!=0)
1077  pt=int(1.0/KF);
1078  else
1079  pt=511;
1080 
1081  if (pt>511)
1082  pt=511;
1083  return pt;
1084 }
bool L1TMuonBarrelKalmanAlgo::punchThroughVeto ( const L1MuKBMTrack track)
private

Definition at line 893 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::approxChi2(), chiSquareCut_, chiSquareCutCurv_, chiSquareCutPattern_, L1MuKBMTrack::curvature(), L1MuKBMTrack::curvatureAtVertex(), L1MuKBMTrack::dxy(), L1MuKBMTrack::hitPattern(), mps_fire::i, and parallelization::uint().

Referenced by chain().

893  {
894  for (uint i=0;i<chiSquareCutPattern_.size();++i) {
895  if (track.hitPattern()==chiSquareCutPattern_[i] && fabs(track.curvatureAtVertex())<chiSquareCutCurv_[i] && track.approxChi2()>chiSquareCut_[i] && track.curvature()*track.dxy()<0)
896  return true;
897  }
898 
899  return false;
900 }
int approxChi2() const
Definition: L1MuKBMTrack.cc:82
int curvature() const
Definition: L1MuKBMTrack.cc:66
std::vector< int > chiSquareCutPattern_
int dxy() const
Definition: L1MuKBMTrack.cc:62
def uint(string)
int curvatureAtVertex() const
Definition: L1MuKBMTrack.cc:54
std::vector< int > chiSquareCutCurv_
int hitPattern() const
Definition: L1MuKBMTrack.cc:86
int L1TMuonBarrelKalmanAlgo::rank ( const L1MuKBMTrack track)
private

Definition at line 872 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::approxChi2(), customBitmask(), hitPattern(), and L1MuKBMTrack::stubs().

Referenced by calculateEta(), chain(), clean(), cleanAndSort(), and convertToBMTF().

872  {
873  // int offset=0;
874  if (hitPattern(track)==customBitmask(0,0,1,1))
875  return 60;
876  // return offset+(track.stubs().size()*2+track.quality())*80-track.approxChi2();
877  return 160+(track.stubs().size())*20-track.approxChi2();
878 
879 }
int approxChi2() const
Definition: L1MuKBMTrack.cc:82
int customBitmask(unsigned int, unsigned int, unsigned int, unsigned int)
const L1MuKBMTCombinedStubRefVector & stubs() const
int hitPattern(const L1MuKBMTrack &)
void L1TMuonBarrelKalmanAlgo::setFloatingPointValues ( L1MuKBMTrack track,
bool  vertex 
)
private

Definition at line 639 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::coarseEta(), L1MuKBMTrack::curvatureAtMuon(), L1MuKBMTrack::curvatureAtVertex(), PVValHelper::eta, L1MuKBMTrack::fineEta(), objects.autophobj::float, L1MuKBMTrack::hasFineEta(), M_PI, phi, L1MuKBMTrack::phiAtVertex(), EnergyCorrector::pt, L1MuKBMTrack::sector(), reco::LeafCandidate::setCharge(), L1MuKBMTrack::setPtEtaPhi(), and L1MuKBMTrack::setPtUnconstrained().

Referenced by chain().

639  {
640  int K,phiINT,etaINT;
641 
642  if (track.hasFineEta())
643  etaINT=track.fineEta();
644  else
645  etaINT=track.coarseEta();
646 
647 
648  double lsb = 1.25/float(1 << 13);
649  double lsbEta = 0.010875;
650 
651 
652  if (vertex) {
653  K = track.curvatureAtVertex();
654  if (K==0)
655  track.setCharge(1);
656  else
657  track.setCharge(K/fabs(K));
658 
659  phiINT = track.phiAtVertex();
660  double phi= track.sector()*M_PI/6.0+phiINT*M_PI/(6*2048.)-2*M_PI;
661  double eta = etaINT*lsbEta;
662  if (phi<-M_PI)
663  phi=phi+2*M_PI;
664  if (K==0)
665  K=1;
666 
667 
668  float FK=fabs(K);
669  if (FK<51)
670  FK=51;
671  double pt = 1.0/(lsb*(FK));
672 
673  track.setPtEtaPhi(pt,eta,phi);
674  }
675  else {
676  K=track.curvatureAtMuon();
677  if (K==0)
678  K=1;
679  if (fabs(K)<46)
680  K=46*K/fabs(K);
681  double pt = 1.0/(lsb*fabs(K));
682  track.setPtUnconstrained(pt);
683  }
684 }
int fineEta() const
int coarseEta() const
Definition: L1MuKBMTrack.cc:78
int phiAtVertex() const
Definition: L1MuKBMTrack.cc:58
void setPtUnconstrained(float)
void setPtEtaPhi(double, double, double)
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:93
int curvatureAtMuon() const
Definition: L1MuKBMTrack.cc:44
bool hasFineEta() const
#define M_PI
int curvatureAtVertex() const
Definition: L1MuKBMTrack.cc:54
int sector() const
Definition: L1MuKBMTrack.cc:93
std::map< int, int > L1TMuonBarrelKalmanAlgo::trackAddress ( const L1MuKBMTrack track,
int &  word 
)
private

Definition at line 997 of file L1TMuonBarrelKalmanAlgo.cc.

References encode(), l1t::RegionalMuonCand::kNumBmtfSubAddr, l1t::RegionalMuonCand::kSegSelStat1, l1t::RegionalMuonCand::kSegSelStat2, l1t::RegionalMuonCand::kSegSelStat3, l1t::RegionalMuonCand::kSegSelStat4, l1t::RegionalMuonCand::kStat1, l1t::RegionalMuonCand::kStat2, l1t::RegionalMuonCand::kStat3, l1t::RegionalMuonCand::kStat4, l1t::RegionalMuonCand::kWheelNum, l1t::RegionalMuonCand::kWheelSide, MillePedeFileConverter_cfg::out, L1MuKBMTrack::sector(), L1MuKBMTrack::stubs(), and L1MuKBMTrack::wheel().

Referenced by convertToBMTF().

997  {
998  std::map<int,int> out;
999  if (track.wheel()>=0)
1001  else
1003 
1004  out[l1t::RegionalMuonCand::kWheelNum] = fabs(track.wheel());
1014 
1015 
1016  for (const auto stub: track.stubs()) {
1017  bool ownwheel = stub->whNum() == track.wheel();
1018  int sector=0;
1019  if ((stub->scNum()==track.sector()+1) || (stub->scNum()==0 && track.sector()==11))
1020  sector=+1;
1021  if ((stub->scNum()==track.sector()-1) || (stub->scNum()==11 && track.sector()==0))
1022  sector=-1;
1023  int addr = encode(ownwheel,sector,stub->tag());
1024 
1025  if (stub->stNum()==4) {
1026  addr=addr & 3;
1028  }
1029  if (stub->stNum()==3) {
1030  out[l1t::RegionalMuonCand::kStat2]=addr;
1031  }
1032  if (stub->stNum()==2) {
1034  }
1035  if (stub->stNum()==1) {
1037  }
1038  }
1039 
1040  word=0;
1041  word = word | out[l1t::RegionalMuonCand::kStat1]<<12;
1042  word = word | out[l1t::RegionalMuonCand::kStat2]<<8;
1043  word = word | out[l1t::RegionalMuonCand::kStat3]<<4;
1044  word = word | out[l1t::RegionalMuonCand::kStat4];
1045 
1046 
1047 
1048  return out;
1049 }
const L1MuKBMTCombinedStubRefVector & stubs() const
int wheel() const
Definition: L1MuKBMTrack.cc:96
int encode(bool ownwheel, int sector, bool tag)
int sector() const
Definition: L1MuKBMTrack.cc:93
uint L1TMuonBarrelKalmanAlgo::twosCompToBits ( int  q)
private

Definition at line 1053 of file L1TMuonBarrelKalmanAlgo.cc.

References lumiQueryAPI::q.

Referenced by convertToBMTF().

1053  {
1054  if (q>=0)
1055  return q;
1056  else
1057  return (~q)+1;
1058 
1059 
1060 }
bool L1TMuonBarrelKalmanAlgo::update ( L1MuKBMTrack track,
const L1MuKBMTCombinedStubRef stub,
int  mask 
)
private

Definition at line 321 of file L1TMuonBarrelKalmanAlgo.cc.

References updateEta(), updateLUT(), updateOffline(), updateOffline1D(), and useOfflineAlgo_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), chain(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

321  {
322  updateEta(track,stub);
323  if (useOfflineAlgo_) {
324  if (mask==3 || mask ==5 || mask==9 ||mask==6|| mask==10 ||mask==12)
325  return updateOffline(track,stub);
326  else
327  return updateOffline1D(track,stub);
328 
329  }
330  else
331  return updateLUT(track,stub,mask);
332 
333 }
bool updateOffline1D(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
bool updateLUT(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
void updateEta(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
bool updateOffline(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
void L1TMuonBarrelKalmanAlgo::updateEta ( L1MuKBMTrack track,
const L1MuKBMTCombinedStubRef stub 
)
private

Definition at line 550 of file L1TMuonBarrelKalmanAlgo.cc.

Referenced by update().

550  {
551 
552 
553 
554 
555 }
bool L1TMuonBarrelKalmanAlgo::updateLUT ( L1MuKBMTrack track,
const L1MuKBMTCombinedStubRef stub,
int  mask 
)
private

Definition at line 477 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::addStub(), L1MuKBMTrack::bendingAngle(), correctedPhi(), correctedPhiB(), L1MuKBMTrack::curvature(), fp_product(), L1MuKBMTrack::hitPattern(), hitPattern(), lutService_, phi, L1MuKBMTrack::positionAngle(), L1MuKBMTrack::sector(), L1MuKBMTrack::setCoordinates(), L1MuKBMTrack::setHitPattern(), L1MuKBMTrack::setKalmanGain(), L1MuKBMTrack::step(), L1TMuonBarrelKalmanLUTs::trackGain(), L1TMuonBarrelKalmanLUTs::trackGain2(), reco::btau::trackPhi, parallelization::uint(), verbose_, and wrapAround().

Referenced by update().

477  {
478  int trackK = track.curvature();
479  int trackPhi = track.positionAngle();
480  int trackPhiB = track.bendingAngle();
481 
482 
483  int phi = correctedPhi(stub,track.sector());
484  int phiB = correctedPhiB(stub);
485  // if (stub->quality()<6)
486  // phiB=trackPhiB;
487 
488  Vector2 residual;
489  int residualPhi = wrapAround(phi-trackPhi,8192);
490  int residualPhiB = wrapAround(phiB-trackPhiB,2048);
491 
492 
493  if (verbose_)
494  printf("residuals %d %d\n",int(residualPhi),int(residualPhiB));
495 
496 
497  uint absK = fabs(trackK);
498  if (absK>4095)
499  absK = 4095;
500 
501  std::vector<float> GAIN;
502  //For the three stub stuff use only gains 0 and 4
503  if (!(mask==3 || mask ==5 || mask==9 ||mask==6|| mask==10 ||mask==12)) {
504  GAIN = lutService_->trackGain(track.step(),track.hitPattern(),absK/4);
505  GAIN[1]=0.0;
506  GAIN[3]=0.0;
507 
508  }
509  else {
510  GAIN = lutService_->trackGain2(track.step(),track.hitPattern(),absK/8);
511 
512 
513  }
514  if (verbose_)
515  printf("Gains:%d %f %f %f %f\n",absK/4,GAIN[0],GAIN[1],GAIN[2],GAIN[3]);
516  track.setKalmanGain(track.step(),fabs(trackK),GAIN[0],GAIN[1],1,0,GAIN[2],GAIN[3]);
517 
518  int k_0 = fp_product(GAIN[0],residualPhi,3);
519  int k_1 = fp_product(GAIN[1],residualPhiB,5);
520  int KNew = wrapAround(trackK+k_0+k_1,8192);
521 
522  if (verbose_)
523  printf("Kupdate: %d %d\n",k_0,k_1);
524 
525  int phiNew = phi;
526 
527  //different products for different firmware logic
528  int pbdouble_0 = fp_product(fabs(GAIN[2]),residualPhi,9);
529  int pb_0 = fp_product(GAIN[2],residualPhi,9);
530  int pb_1 = fp_product(GAIN[3],residualPhiB,9);
531 
532  if (verbose_)
533  printf("phiupdate: %d %d\n",pb_0,pb_1);
534 
535  int phiBNew;
536  if (!(mask==3 || mask ==5 || mask==9 ||mask==6|| mask==10 ||mask==12))
537  phiBNew = wrapAround(trackPhiB+pb_0,2048);
538  else
539  phiBNew = wrapAround(trackPhiB+pb_1-pbdouble_0,2048);
540 
541  track.setCoordinates(track.step(),KNew,phiNew,phiBNew);
542  track.addStub(stub);
543  track.setHitPattern(hitPattern(track));
544  return true;
545 }
int correctedPhiB(const L1MuKBMTCombinedStubRef &)
int step() const
Definition: L1MuKBMTrack.cc:90
int bendingAngle() const
Definition: L1MuKBMTrack.cc:74
std::vector< float > trackGain2(uint, uint, uint)
void setHitPattern(int)
int fp_product(float, int, uint)
void setCoordinates(int, int, int, int)
ROOT::Math::SVector< double, 2 > Vector2
L1TMuonBarrelKalmanLUTs * lutService_
int curvature() const
Definition: L1MuKBMTrack.cc:66
def uint(string)
int hitPattern(const L1MuKBMTrack &)
void setKalmanGain(unsigned int step, unsigned int K, float a1, float a2, float a3, float a4=0, float a5=0, float a6=0)
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
int sector() const
Definition: L1MuKBMTrack.cc:93
void addStub(const L1MuKBMTCombinedStubRef &)
int hitPattern() const
Definition: L1MuKBMTrack.cc:86
std::vector< float > trackGain(uint, uint, uint)
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
bool L1TMuonBarrelKalmanAlgo::updateOffline ( L1MuKBMTrack track,
const L1MuKBMTCombinedStubRef stub 
)
private

Definition at line 335 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::addStub(), L1MuKBMTrack::bendingAngle(), EnergyCorrector::c, correctedPhi(), correctedPhiB(), L1MuKBMTrack::covariance(), L1MuKBMTrack::curvature(), g4SimHits_cfi::Gain, class-composition::H, hitPattern(), createfilelist::int, phi, pointResolutionPhi_, pointResolutionPhiB_, L1MuKBMTrack::positionAngle(), dttmaxenums::R, S(), L1MuKBMTrack::sector(), L1MuKBMTrack::setCoordinates(), L1MuKBMTrack::setCovariance(), L1MuKBMTrack::setHitPattern(), L1MuKBMTrack::setKalmanGain(), L1MuKBMTrack::setResidual(), L1MuKBMTrack::step(), reco::btau::trackPhi, verbose_, and wrapAround().

Referenced by update().

335  {
336  int trackK = track.curvature();
337  int trackPhi = track.positionAngle();
338  int trackPhiB = track.bendingAngle();
339 
340  int phi = correctedPhi(stub,track.sector());
341  int phiB = correctedPhiB(stub);
342 
343 
344 
345 
346  Vector2 residual;
347  residual[0] = phi-trackPhi;
348  residual[1] = phiB-trackPhiB;
349 
350 
351 
352 
353  // if (stub->quality()<4)
354  // phiB=trackPhiB;
355 
356  Matrix23 H;
357  H(0,0)=0.0;
358  H(0,1)=1.0;
359  H(0,2)=0.0;
360  H(1,0)=0.0;
361  H(1,1)=0.0;
362  H(1,2)=1.0;
363 
364 
366  R(0,0) = pointResolutionPhi_;
367  R(0,1) = 0.0;
368  R(1,0) = 0.0;
369  R(1,1) = pointResolutionPhiB_;
370 
371  const std::vector<double>& covLine = track.covariance();
372  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(),covLine.end());
373 
374 
375  CovarianceMatrix2 S = ROOT::Math::Similarity(H,cov)+R;
376  if (!S.Invert())
377  return false;
378  Matrix32 Gain = cov*ROOT::Math::Transpose(H)*S;
379 
380  track.setKalmanGain(track.step(),fabs(trackK),Gain(0,0),Gain(0,1),Gain(1,0),Gain(1,1),Gain(2,0),Gain(2,1));
381 
382  int KNew = (trackK+int(Gain(0,0)*residual(0)+Gain(0,1)*residual(1)));
383  if (fabs(KNew)>8192)
384  return false;
385 
386  int phiNew = wrapAround(trackPhi+residual(0),8192);
387  int phiBNew = wrapAround(trackPhiB+int(Gain(2,0)*residual(0)+Gain(2,1)*residual(1)),2048);
388 
389  track.setResidual(stub->stNum()-1,fabs(phi-phiNew)+fabs(phiB-phiBNew)/8);
390 
391 
392  if (verbose_) {
393  printf(" K = %d + %f * %f + %f * %f\n",trackK,Gain(0,0),residual(0),Gain(0,1),residual(1));
394  printf(" phiB = %d + %f * %f + %f * %f\n",trackPhiB,Gain(2,0),residual(0),Gain(2,1),residual(1));
395  }
396 
397 
398  track.setCoordinates(track.step(),KNew,phiNew,phiBNew);
399  Matrix33 covNew = cov - Gain*(H*cov);
401 
402  c(0,0)=covNew(0,0);
403  c(0,1)=covNew(0,1);
404  c(0,2)=covNew(0,2);
405  c(1,0)=covNew(1,0);
406  c(1,1)=covNew(1,1);
407  c(1,2)=covNew(1,2);
408  c(2,0)=covNew(2,0);
409  c(2,1)=covNew(2,1);
410  c(2,2)=covNew(2,2);
411  if (verbose_) {
412  printf("Post Fit Covariance Matrix %f %f %f \n",cov(0,0),cov(1,1),cov(2,2));
413 
414  }
415 
416  track.setCovariance(c);
417  track.addStub(stub);
418  track.setHitPattern(hitPattern(track));
419 
420  return true;
421 }
int correctedPhiB(const L1MuKBMTCombinedStubRef &)
ROOT::Math::SMatrix< double, 3, 3 > Matrix33
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > CovarianceMatrix2
int step() const
Definition: L1MuKBMTrack.cc:90
int bendingAngle() const
Definition: L1MuKBMTrack.cc:74
void setHitPattern(int)
void setCoordinates(int, int, int, int)
ROOT::Math::SVector< double, 2 > Vector2
void setCovariance(const CovarianceMatrix &)
int curvature() const
Definition: L1MuKBMTrack.cc:66
ROOT::Math::SMatrix< double, 2, 3 > Matrix23
const std::vector< double > & covariance() const
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
int hitPattern(const L1MuKBMTrack &)
void setKalmanGain(unsigned int step, unsigned int K, float a1, float a2, float a3, float a4=0, float a5=0, float a6=0)
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
int sector() const
Definition: L1MuKBMTrack.cc:93
void addStub(const L1MuKBMTCombinedStubRef &)
void setResidual(uint, int)
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:47
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
ROOT::Math::SMatrix< double, 3, 2 > Matrix32
bool L1TMuonBarrelKalmanAlgo::updateOffline1D ( L1MuKBMTrack track,
const L1MuKBMTCombinedStubRef stub 
)
private

Definition at line 424 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::addStub(), L1MuKBMTrack::bendingAngle(), EnergyCorrector::c, correctedPhi(), L1MuKBMTrack::covariance(), L1MuKBMTrack::curvature(), g4SimHits_cfi::Gain, class-composition::H, hitPattern(), phi, pointResolutionPhi_, L1MuKBMTrack::positionAngle(), S(), L1MuKBMTrack::sector(), L1MuKBMTrack::setCoordinates(), L1MuKBMTrack::setCovariance(), L1MuKBMTrack::setHitPattern(), L1MuKBMTrack::setKalmanGain(), L1MuKBMTrack::step(), reco::btau::trackPhi, and wrapAround().

Referenced by update().

424  {
425  int trackK = track.curvature();
426  int trackPhi = track.positionAngle();
427  int trackPhiB = track.bendingAngle();
428 
429 
430  int phi = correctedPhi(stub,track.sector());
431 
432 
433  double residual= phi-trackPhi;
434 
435  Matrix13 H;
436  H(0,0)=0.0;
437  H(0,1)=1.0;
438  H(0,2)=0.0;
439 
440 
441  const std::vector<double>& covLine = track.covariance();
442  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(),covLine.end());
443 
444  double S = ROOT::Math::Similarity(H,cov)(0,0)+pointResolutionPhi_;
445 
446  if (S==0.0)
447  return false;
448  Matrix31 Gain = cov*ROOT::Math::Transpose(H)/S;
449 
450  track.setKalmanGain(track.step(),fabs(trackK),Gain(0,0),0.0,Gain(1,0),0.0,Gain(2,0),0.0);
451 
452  int KNew = wrapAround(trackK+int(Gain(0,0)*residual),8192);
453  int phiNew = wrapAround(trackPhi+residual,8192);
454  int phiBNew = wrapAround(trackPhiB+int(Gain(2,0)*residual),2048);
455  track.setCoordinates(track.step(),KNew,phiNew,phiBNew);
456  Matrix33 covNew = cov - Gain*(H*cov);
458 
459  c(0,0)=covNew(0,0);
460  c(0,1)=covNew(0,1);
461  c(0,2)=covNew(0,2);
462  c(1,0)=covNew(1,0);
463  c(1,1)=covNew(1,1);
464  c(1,2)=covNew(1,2);
465  c(2,0)=covNew(2,0);
466  c(2,1)=covNew(2,1);
467  c(2,2)=covNew(2,2);
468  track.setCovariance(c);
469  track.addStub(stub);
470  track.setHitPattern(hitPattern(track));
471 
472  return true;
473 }
ROOT::Math::SMatrix< double, 3, 3 > Matrix33
int step() const
Definition: L1MuKBMTrack.cc:90
int bendingAngle() const
Definition: L1MuKBMTrack.cc:74
void setHitPattern(int)
void setCoordinates(int, int, int, int)
void setCovariance(const CovarianceMatrix &)
int curvature() const
Definition: L1MuKBMTrack.cc:66
ROOT::Math::SMatrix< double, 1, 3 > Matrix13
const std::vector< double > & covariance() const
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
int hitPattern(const L1MuKBMTrack &)
void setKalmanGain(unsigned int step, unsigned int K, float a1, float a2, float a3, float a4=0, float a5=0, float a6=0)
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
int sector() const
Definition: L1MuKBMTrack.cc:93
void addStub(const L1MuKBMTCombinedStubRef &)
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:47
ROOT::Math::SMatrix< double, 3, 1 > Matrix31
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
void L1TMuonBarrelKalmanAlgo::vertexConstraint ( L1MuKBMTrack track)
private

Definition at line 562 of file L1TMuonBarrelKalmanAlgo.cc.

References useOfflineAlgo_, vertexConstraintLUT(), and vertexConstraintOffline().

Referenced by chain().

562  {
563  if (useOfflineAlgo_)
565  else
566  vertexConstraintLUT(track);
567 
568 }
void vertexConstraintLUT(L1MuKBMTrack &)
void vertexConstraintOffline(L1MuKBMTrack &)
void L1TMuonBarrelKalmanAlgo::vertexConstraintLUT ( L1MuKBMTrack track)
private

Definition at line 614 of file L1TMuonBarrelKalmanAlgo.cc.

References L1MuKBMTrack::curvature(), L1MuKBMTrack::dxy(), fp_product(), L1MuKBMTrack::hitPattern(), lutService_, L1MuKBMTrack::positionAngle(), L1MuKBMTrack::setCoordinatesAtVertex(), L1MuKBMTrack::setKalmanGain(), L1MuKBMTrack::step(), parallelization::uint(), verbose_, L1TMuonBarrelKalmanLUTs::vertexGain(), and wrapAround().

Referenced by vertexConstraint().

614  {
615  double residual = -track.dxy();
616  uint absK = fabs(track.curvature());
617  if (absK>2047)
618  absK = 2047;
619 
620 std::pair<float,float> GAIN = lutService_->vertexGain(track.hitPattern(),absK/2);
621  track.setKalmanGain(track.step(),fabs(track.curvature()),GAIN.first,GAIN.second,-1);
622 
623  int k_0 = fp_product(GAIN.first,int(residual),7);
624  int KNew = wrapAround(track.curvature()+k_0,8192);
625 
626  if (verbose_) {
627  printf("VERTEX GAIN(%d)= %f * %d = %d\n",absK/2,GAIN.first,int(residual),k_0);
628 
629  }
630 
631 
632  int p_0 = fp_product(GAIN.second,int(residual),7);
633  int phiNew = wrapAround(track.positionAngle()+p_0,8192);
634  track.setCoordinatesAtVertex(KNew,phiNew,-residual);
635 }
void setCoordinatesAtVertex(int, int, int)
int step() const
Definition: L1MuKBMTrack.cc:90
int fp_product(float, int, uint)
std::pair< float, float > vertexGain(uint, uint)
L1TMuonBarrelKalmanLUTs * lutService_
int curvature() const
Definition: L1MuKBMTrack.cc:66
int dxy() const
Definition: L1MuKBMTrack.cc:62
def uint(string)
void setKalmanGain(unsigned int step, unsigned int K, float a1, float a2, float a3, float a4=0, float a5=0, float a6=0)
int hitPattern() const
Definition: L1MuKBMTrack.cc:86
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
void L1TMuonBarrelKalmanAlgo::vertexConstraintOffline ( L1MuKBMTrack track)
private

Definition at line 571 of file L1TMuonBarrelKalmanAlgo.cc.

References EnergyCorrector::c, L1MuKBMTrack::covariance(), L1MuKBMTrack::curvature(), L1MuKBMTrack::dxy(), g4SimHits_cfi::Gain, class-composition::H, pointResolutionVertex_, L1MuKBMTrack::positionAngle(), S(), L1MuKBMTrack::setCoordinatesAtVertex(), L1MuKBMTrack::setCovariance(), L1MuKBMTrack::setKalmanGain(), L1MuKBMTrack::step(), verbose_, and wrapAround().

Referenced by vertexConstraint().

571  {
572  double residual = -track.dxy();
573  Matrix13 H;
574  H(0,0)=0;
575  H(0,1)=0;
576  H(0,2)=1;
577 
578  const std::vector<double>& covLine = track.covariance();
579  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(),covLine.end());
580 
581  double S = (ROOT::Math::Similarity(H,cov))(0,0)+pointResolutionVertex_;
582  S=1.0/S;
583  Matrix31 Gain = cov*(ROOT::Math::Transpose(H))*S;
584  track.setKalmanGain(track.step(),fabs(track.curvature()),Gain(0,0),Gain(1,0),Gain(2,0));
585 
586  if (verbose_) {
587  printf("sigma3=%f sigma6=%f\n",cov(0,3),cov(3,3));
588  printf(" K = %d + %f * %f\n",track.curvature(),Gain(0,0),residual);
589  }
590 
591  int KNew = wrapAround(int(track.curvature()+Gain(0,0)*residual),8192);
592  int phiNew = wrapAround(int(track.positionAngle()+Gain(1,0)*residual),8192);
593  int dxyNew = wrapAround(int(track.dxy()+Gain(2,0)*residual),8192);
594  if (verbose_)
595  printf("Post fit impact parameter=%d\n",dxyNew);
596  track.setCoordinatesAtVertex(KNew,phiNew,-residual);
597  Matrix33 covNew = cov - Gain*(H*cov);
599  c(0,0)=covNew(0,0);
600  c(0,1)=covNew(0,1);
601  c(0,2)=covNew(0,2);
602  c(1,0)=covNew(1,0);
603  c(1,1)=covNew(1,1);
604  c(1,2)=covNew(1,2);
605  c(2,0)=covNew(2,0);
606  c(2,1)=covNew(2,1);
607  c(2,2)=covNew(2,2);
608  track.setCovariance(c);
609  // track.covariance = track.covariance - Gain*H*track.covariance;
610 }
ROOT::Math::SMatrix< double, 3, 3 > Matrix33
void setCoordinatesAtVertex(int, int, int)
int step() const
Definition: L1MuKBMTrack.cc:90
void setCovariance(const CovarianceMatrix &)
int curvature() const
Definition: L1MuKBMTrack.cc:66
ROOT::Math::SMatrix< double, 1, 3 > Matrix13
const std::vector< double > & covariance() const
int dxy() const
Definition: L1MuKBMTrack.cc:62
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
void setKalmanGain(unsigned int step, unsigned int K, float a1, float a2, float a3, float a4=0, float a5=0, float a6=0)
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:47
ROOT::Math::SMatrix< double, 3, 1 > Matrix31
int positionAngle() const
Definition: L1MuKBMTrack.cc:70
int L1TMuonBarrelKalmanAlgo::wrapAround ( int  value,
int  maximum 
)
private

Definition at line 883 of file L1TMuonBarrelKalmanAlgo.cc.

References relativeConstraints::value.

Referenced by match(), propagate(), updateLUT(), updateOffline(), updateOffline1D(), vertexConstraintLUT(), and vertexConstraintOffline().

883  {
884  if (value>maximum-1)
885  return value-2*maximum;
886  if (value<-maximum)
887  return value+2*maximum;
888  return value;
889 
890 }
Definition: value.py:1

Member Data Documentation

std::vector<double> L1TMuonBarrelKalmanAlgo::aPhi_
private

Definition at line 87 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::aPhiB_
private

Definition at line 88 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::aPhiBNLO_
private

Definition at line 89 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::bPhi_
private

Definition at line 90 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::bPhiB_
private

Definition at line 91 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::chiSquare_
private

Definition at line 98 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by estimateChiSquare().

std::vector<int> L1TMuonBarrelKalmanAlgo::chiSquareCut_
private

Definition at line 101 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by punchThroughVeto().

std::vector<int> L1TMuonBarrelKalmanAlgo::chiSquareCutCurv_
private

Definition at line 100 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by punchThroughVeto().

std::vector<int> L1TMuonBarrelKalmanAlgo::chiSquareCutPattern_
private

Definition at line 99 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by punchThroughVeto().

std::vector<int> L1TMuonBarrelKalmanAlgo::combos1_
private

Definition at line 108 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<int> L1TMuonBarrelKalmanAlgo::combos2_
private

Definition at line 107 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<int> L1TMuonBarrelKalmanAlgo::combos3_
private

Definition at line 106 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<int> L1TMuonBarrelKalmanAlgo::combos4_
private

Definition at line 105 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<double> L1TMuonBarrelKalmanAlgo::eLoss_
private

Definition at line 86 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::etaLUT0_
private

Definition at line 93 of file L1TMuonBarrelKalmanAlgo.h.

std::vector<double> L1TMuonBarrelKalmanAlgo::etaLUT1_
private

Definition at line 94 of file L1TMuonBarrelKalmanAlgo.h.

uint L1TMuonBarrelKalmanAlgo::globalChi2Cut_
private

Definition at line 97 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<double> L1TMuonBarrelKalmanAlgo::initK2_
private

Definition at line 83 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

std::vector<double> L1TMuonBarrelKalmanAlgo::initK_
private

Definition at line 82 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain().

L1TMuonBarrelKalmanLUTs* L1TMuonBarrelKalmanAlgo::lutService_
private

Definition at line 76 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by calculateEta(), updateLUT(), and vertexConstraintLUT().

std::vector<double> L1TMuonBarrelKalmanAlgo::mScatteringPhi_
private

Definition at line 115 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::mScatteringPhiB_
private

Definition at line 116 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by propagate().

std::vector<double> L1TMuonBarrelKalmanAlgo::phiAt2_
private

Definition at line 92 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by phiAt2().

double L1TMuonBarrelKalmanAlgo::pointResolutionPhi_
private

Definition at line 118 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain(), updateOffline(), and updateOffline1D().

double L1TMuonBarrelKalmanAlgo::pointResolutionPhiB_
private

Definition at line 120 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by chain(), and updateOffline().

double L1TMuonBarrelKalmanAlgo::pointResolutionVertex_
private

Definition at line 122 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by vertexConstraintOffline().

bool L1TMuonBarrelKalmanAlgo::useOfflineAlgo_
private

Definition at line 114 of file L1TMuonBarrelKalmanAlgo.h.

Referenced by update(), and vertexConstraint().

bool L1TMuonBarrelKalmanAlgo::verbose_
private