CMS 3D CMS Logo

TTStubBuilder.h
Go to the documentation of this file.
1 
17 #ifndef L1_TRACK_TRIGGER_STUB_BUILDER_H
18 #define L1_TRACK_TRIGGER_STUB_BUILDER_H
19 
28 
31 
34 
36 
37 #include <memory>
38 #include <map>
39 #include <vector>
40 
43 
44 template <typename T>
45 class TTStubBuilder : public edm::one::EDProducer<edm::one::WatchRuns> {
46 public:
48  explicit TTStubBuilder(const edm::ParameterSet& iConfig);
49 
51  ~TTStubBuilder() override;
52 
53  // TTStub bendOffset has this added to it, if stub truncated by FE, to indicate reason.
54  enum FEreject { CBCFailOffset = 500, CICFailOffset = 1000 };
55 
56 private:
64 
66  void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
67  void endRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
68  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
69 
72  static bool SortStubBendPairs(const std::pair<unsigned int, double>& left,
73  const std::pair<unsigned int, double>& right);
74  static bool SortStubsBend(const TTStub<T>& left, const TTStub<T>& right);
75 
77  template <typename TT>
78  void fill(edmNew::DetSetVector<TT>& outputEP, const DetId& detId, const std::vector<TT>& inputVec) const {
80  typename edmNew::DetSetVector<TT>::FastFiller outputFiller(outputEP, detId);
81  outputFiller.resize(inputVec.size());
82  std::copy(inputVec.begin(), inputVec.end(), outputFiller.begin());
83  }
84 
89 
91 
92  bool applyFE; // Turn ON (true) or OFF (false) the dynamic FE stub truncation.
93 
94  // Tuncation cut-offs
95  unsigned int maxStubs_2S; // CBC chip limit (in stubs/chip/BX)
96  unsigned int maxStubs_PS; // MPA chip limit (in stubs/chip/2BX)
97  unsigned int maxStubs_2S_CIC_5; // 2S 5G chip limit (in stubs/CIC/8BX)
98  unsigned int maxStubs_PS_CIC_5; // PS 5G chip limit (in stubs/CIC/8BX)
99  unsigned int maxStubs_PS_CIC_10; // PS 10G chip limit (in stubs/CIC/8BX)
100 
101  // Which modules read by 10Gb/s links instead of 5Gb/s
102  // (Unlike TkLayout, CMSSW starts ring count at 1 for the innermost physically present ring in each disk)
103  // sviret comment (221217): this info should be made available in conddb at some point
104  // (not in TrackerTopology, as modules may switch between 10G & 5G transmission schems during running?)
105  unsigned int high_rate_max_ring[5]; //Outermost ring with 10Gb/s link vs disk.
106  unsigned int high_rate_max_layer; // Outermost barrel layer with 10Gb/s link.
107 
109  int ievt;
110  std::unordered_map<int, std::vector<TTStub<Ref_Phase2TrackerDigi_>>> moduleStubs_CIC;
111  std::unordered_map<int, int> moduleStubs_MPA;
112  std::unordered_map<int, int> moduleStubs_CBC;
113 
114 };
115 
123 template <typename T>
126  clustersToken = consumes<edmNew::DetSetVector<TTCluster<T>>>(iConfig.getParameter<edm::InputTag>("TTClusters"));
127  tTopoToken = esConsumes<TrackerTopology, TrackerTopologyRcd>();
128  tGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
129  ttStubToken = esConsumes<TTStubAlgorithm<T>, TTStubAlgorithmRecord, edm::Transition::BeginRun>();
130  ForbidMultipleStubs = iConfig.getParameter<bool>("OnlyOnePerInputCluster");
131  applyFE = iConfig.getParameter<bool>("FEineffs");
132  maxStubs_2S = iConfig.getParameter<uint32_t>("CBClimit");
133  maxStubs_PS = iConfig.getParameter<uint32_t>("MPAlimit");
134  maxStubs_2S_CIC_5 = iConfig.getParameter<uint32_t>("SS5GCIClimit");
135  maxStubs_PS_CIC_5 = iConfig.getParameter<uint32_t>("PS5GCIClimit");
136  maxStubs_PS_CIC_10 = iConfig.getParameter<uint32_t>("PS10GCIClimit");
137  unsigned int tedd1_max10Gring = iConfig.getParameter<uint32_t>("TEDD1Max10GRing");
138  unsigned int tedd2_max10Gring = iConfig.getParameter<uint32_t>("TEDD2Max10GRing");
139  high_rate_max_layer = iConfig.getParameter<uint32_t>("BarrelMax10GLay");
140  // Stubs passing & failing FE chip cuts, plus associated clusters.
141  produces<edmNew::DetSetVector<TTCluster<T>>>("ClusterAccepted");
142  produces<edmNew::DetSetVector<TTCluster<T>>>("ClusterRejected");
143  produces<edmNew::DetSetVector<TTStub<T>>>("StubAccepted");
144  produces<edmNew::DetSetVector<TTStub<T>>>("StubRejected");
145 
146  high_rate_max_ring[0] = tedd1_max10Gring;
147  high_rate_max_ring[1] = tedd1_max10Gring;
148  high_rate_max_ring[2] = tedd2_max10Gring;
149  high_rate_max_ring[3] = tedd2_max10Gring;
150  high_rate_max_ring[4] = tedd2_max10Gring;
151 }
152 
154 template <typename T>
156 
158 template <typename T>
161  theStubFindingAlgoHandle = iSetup.getHandle(ttStubToken);
162  ievt = 0;
163  moduleStubs_CIC.clear();
164  moduleStubs_MPA.clear();
165  moduleStubs_CBC.clear();
166 }
167 
169 template <typename T>
170 void TTStubBuilder<T>::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {}
171 
173 template <typename T>
174 bool TTStubBuilder<T>::SortStubBendPairs(const std::pair<unsigned int, double>& left,
175  const std::pair<unsigned int, double>& right) {
176  return std::abs(left.second) < std::abs(right.second);
177 }
178 
180 template <typename T>
181 bool TTStubBuilder<T>::SortStubsBend(const TTStub<T>& left, const TTStub<T>& right) {
182  return std::abs(left.bendFE()) < std::abs(right.bendFE());
183 }
184 
186 template <>
188 
189 #endif
TTStubBuilder::ievt
int ievt
Temporary storage for stubs over several events for truncation use.
Definition: TTStubBuilder.h:109
TTStubAlgorithmRecord.h
EDProducer.h
TrackerGeometry.h
TTStubBuilder::tGeomToken
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken
Definition: TTStubBuilder.h:61
PixelTopology.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
ESHandle.h
edmNew::DetSetVector::FastFiller::begin
DataIter begin()
Definition: DetSetVectorNew.h:271
TTStubAlgorithm.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
TTStubBuilder::tTopoToken
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
Definition: TTStubBuilder.h:60
TTStubBuilder::updateStubs
void updateStubs(const edm::OrphanHandle< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ >>> &clusterHandle, const edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ >> &inputEDstubs, edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ >> &outputEDstubs) const
Update output stubs with Refs to cluster collection that is associated to stubs.
TTStubBuilder::maxStubs_2S
unsigned int maxStubs_2S
Definition: TTStubBuilder.h:95
edm::one::EDProducer
Definition: EDProducer.h:30
TTStubBuilder::ttStubToken
edm::ESGetToken< TTStubAlgorithm< T >, TTStubAlgorithmRecord > ttStubToken
Definition: TTStubBuilder.h:62
TTStubBuilder::moduleStubs_MPA
std::unordered_map< int, int > moduleStubs_MPA
Definition: TTStubBuilder.h:111
TTStubBuilder::CBCFailOffset
Definition: TTStubBuilder.h:54
ESGetToken.h
TTStubBuilder::endRun
void endRun(const edm::Run &run, const edm::EventSetup &iSetup) override
End run.
Definition: TTStubBuilder.h:170
TTStubBuilder
Plugin to load the Stub finding algorithm and produce the collection of Stubs that goes in the event ...
Definition: TTStubBuilder.h:45
TTStubBuilder::TTStubBuilder
TTStubBuilder(const edm::ParameterSet &iConfig)
Constructor.
Definition: TTStubBuilder.h:125
TTStubBuilder::beginRun
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
Mandatory methods.
Definition: TTStubBuilder.h:159
edmNew::DetSetVector::FastFiller::resize
void resize(size_type s)
Definition: DetSetVectorNew.h:259
DetId
Definition: DetId.h:17
MakerMacros.h
TrackerTopology.h
TTStubBuilder::maxStubs_PS_CIC_10
unsigned int maxStubs_PS_CIC_10
Definition: TTStubBuilder.h:99
TTStubBuilder::clustersToken
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< T > > > clustersToken
Definition: TTStubBuilder.h:59
TTStub
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
edm::ESHandle
Definition: DTSurvey.h:22
TTStub::bendFE
double bendFE() const
BendFE(): In FULL-STRIP units from FE! Rename of getTriggerBend()
Definition: TTStub.h:203
TTStubBuilder::fill
void fill(edmNew::DetSetVector< TT > &outputEP, const DetId &detId, const std::vector< TT > &inputVec) const
Fill output cluster & stub collections.
Definition: TTStubBuilder.h:78
TTStubBuilder::high_rate_max_layer
unsigned int high_rate_max_layer
Definition: TTStubBuilder.h:106
TTStubBuilder::maxStubs_PS_CIC_5
unsigned int maxStubs_PS_CIC_5
Definition: TTStubBuilder.h:98
TTStubBuilder::moduleStubs_CBC
std::unordered_map< int, int > moduleStubs_CBC
Definition: TTStubBuilder.h:112
TTStubBuilder::moduleStubs_CIC
std::unordered_map< int, std::vector< TTStub< Ref_Phase2TrackerDigi_ > > > moduleStubs_CIC
Definition: TTStubBuilder.h:110
TTStubBuilder::FEreject
FEreject
Definition: TTStubBuilder.h:54
edm::ParameterSet
Definition: ParameterSet.h:47
TTStubBuilder::~TTStubBuilder
~TTStubBuilder() override
Destructor;.
Definition: TTStubBuilder.h:155
Event.h
TTStubBuilder::applyFE
bool applyFE
FE truncation.
Definition: TTStubBuilder.h:92
TTStubBuilder::ForbidMultipleStubs
bool ForbidMultipleStubs
Definition: TTStubBuilder.h:63
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
edm::EventSetup
Definition: EventSetup.h:57
TTStubBuilder::SortStubsBend
static bool SortStubsBend(const TTStub< T > &left, const TTStub< T > &right)
Analogous sorting routine directly from stubs.
Definition: TTStubBuilder.h:181
TTStubBuilder::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
TTStubBuilder::maxStubs_2S_CIC_5
unsigned int maxStubs_2S_CIC_5
Definition: TTStubBuilder.h:97
TTStubAlgorithmRecord
Class to store the TTStubAlgorithm used in TTStubBuilder.
Definition: TTStubAlgorithmRecord.h:23
edmNew::DetSetVector
Definition: DetSetNew.h:13
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::OrphanHandle
Definition: EDProductfwd.h:39
Frameworkfwd.h
edm::Transition::BeginRun
PixelGeomDetUnit.h
TTStubBuilder::theStubFindingAlgoHandle
edm::ESHandle< TTStubAlgorithm< T > > theStubFindingAlgoHandle
Data members.
Definition: TTStubBuilder.h:58
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
TTStubBuilder::high_rate_max_ring
unsigned int high_rate_max_ring[5]
Definition: TTStubBuilder.h:105
edm::Event
Definition: Event.h:73
TTStubBuilder::maxStubs_PS
unsigned int maxStubs_PS
Definition: TTStubBuilder.h:96
DetSetVectorNew.h
edm::InputTag
Definition: InputTag.h:15
TTStubBuilder::CICFailOffset
Definition: TTStubBuilder.h:54
TTStubBuilder::SortStubBendPairs
static bool SortStubBendPairs(const std::pair< unsigned int, double > &left, const std::pair< unsigned int, double > &right)
Sort routine for stub ordering.
Definition: TTStubBuilder.h:174