CMS 3D CMS Logo

KFin.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_KFin_h
2 #define L1Trigger_TrackFindingTracklet_KFin_h
3 
8 
9 #include <vector>
10 
11 namespace trklet {
12 
18  class KFin {
19  public:
20  KFin(const edm::ParameterSet& iConfig,
21  const tt::Setup* setup_,
22  const trackerTFP::DataFormats* dataFormats,
23  const trackerTFP::LayerEncoding* layerEncoding,
24  const ChannelAssignment* channelAssignment,
25  int region);
26  ~KFin() {}
27  // read in and organize input tracks and stubs
28  void consume(const tt::StreamsTrack& streamsTrack, const tt::StreamsStub& streamsStub);
29  // fill output products
30  void produce(tt::StreamsStub& accpetedStubs,
31  tt::StreamsTrack& acceptedTracks,
32  tt::StreamsStub& lostStubs,
34 
35  private:
36  // truncates double precision of val into base precision, +1.e-12 restores robustness of addition of 2 digitised values
37  double digi(double val, double base) const { return (floor(val / base + 1.e-12) + .5) * base; }
38  struct Stub {
39  Stub(const TTStubRef& ttStubRef, double r, double phi, double z, int layerId, bool psTilt, int channel)
40  : ttStubRef_(ttStubRef), r_(r), phi_(phi), z_(z), layerId_(layerId), psTilt_(psTilt), channel_(channel) {}
42  double r_;
43  double phi_;
44  double z_;
45  int layerId_;
46  bool psTilt_;
47  int channel_;
48  // phi uncertainty * sqrt(12) + additional terms in rad
49  double dPhi_;
50  // z uncertainty * sqrt(12) + additional terms in cm
51  double dZ_;
52  };
53  struct Track {
54  static constexpr int max_ = 7;
55  Track() { stubs_.reserve(max_); }
57  const std::vector<Stub*>& stubs,
58  double cot,
59  double zT,
60  double inv2R,
61  int sectorEta)
62  : frame_(frame), stubs_(stubs), cot_(cot), zT_(zT), inv2R_(inv2R), sectorEta_(sectorEta) {}
64  std::vector<Stub*> stubs_;
65  double cot_;
66  double zT_;
67  double inv2R_;
69  };
70  // remove and return first element of deque, returns nullptr if empty
71  template <class T>
72  T* pop_front(std::deque<T*>& ts) const;
73  // true if truncation is enbaled
75  // provides run-time constants
76  const tt::Setup* setup_;
77  // provides dataformats
79  // helper class to encode layer
81  // helper class to assign tracks to channel
83  // processing region (0 - 8) aka processing phi nonant
84  const int region_;
85  // storage of input tracks
86  std::vector<Track> tracks_;
87  // storage of input stubs
88  std::vector<Stub> stubs_;
89  // h/w liked organized pointer to input tracks
90  std::vector<std::vector<Track*>> input_;
91  };
92 
93 } // namespace trklet
94 
95 #endif
bool enableTruncation_
Definition: KFin.h:74
Class to emulate the data transformation happening betwwen DR and KF.
Definition: KFin.h:18
double dPhi_
Definition: KFin.h:49
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
bool psTilt_
Definition: KFin.h:46
double z_
Definition: KFin.h:44
double phi_
Definition: KFin.h:43
std::vector< Stub > stubs_
Definition: KFin.h:88
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
Track(const tt::FrameTrack &frame, const std::vector< Stub *> &stubs, double cot, double zT, double inv2R, int sectorEta)
Definition: KFin.h:56
void consume(const tt::StreamsTrack &streamsTrack, const tt::StreamsStub &streamsStub)
Definition: KFin.cc:29
double digi(double val, double base) const
Definition: KFin.h:37
const ChannelAssignment * channelAssignment_
Definition: KFin.h:82
Class to assign tracklet tracks and stubs to output channel based on their Pt or seed type as well as...
double zT_
Definition: KFin.h:66
std::pair< TTTrackRef, Frame > FrameTrack
Definition: TTTypes.h:62
tt::FrameTrack frame_
Definition: KFin.h:63
T * pop_front(std::deque< T *> &ts) const
Definition: KFin.cc:261
TTStubRef ttStubRef_
Definition: KFin.h:41
double r_
Definition: KFin.h:42
static constexpr int max_
Definition: KFin.h:54
const int region_
Definition: KFin.h:84
std::vector< Track > tracks_
Definition: KFin.h:86
std::vector< std::vector< Track * > > input_
Definition: KFin.h:90
double dZ_
Definition: KFin.h:51
~KFin()
Definition: KFin.h:26
std::vector< Stub * > stubs_
Definition: KFin.h:64
double cot_
Definition: KFin.h:65
double inv2R_
Definition: KFin.h:67
Class to encode layer ids for Kalman Filter Layers consitent with rough r-z track parameters are coun...
Definition: LayerEncoding.h:19
KFin(const edm::ParameterSet &iConfig, const tt::Setup *setup_, const trackerTFP::DataFormats *dataFormats, const trackerTFP::LayerEncoding *layerEncoding, const ChannelAssignment *channelAssignment, int region)
Definition: KFin.cc:14
Class to calculate and provide dataformats used by Track Trigger emulator.
Definition: DataFormats.h:216
const trackerTFP::DataFormats * dataFormats_
Definition: KFin.h:78
const tt::Setup * setup_
Definition: KFin.h:76
long double T
void produce(tt::StreamsStub &accpetedStubs, tt::StreamsTrack &acceptedTracks, tt::StreamsStub &lostStubs, tt::StreamsTrack &lostTracks)
Definition: KFin.cc:115
const trackerTFP::LayerEncoding * layerEncoding_
Definition: KFin.h:80
Stub(const TTStubRef &ttStubRef, double r, double phi, double z, int layerId, bool psTilt, int channel)
Definition: KFin.h:39