CMS 3D CMS Logo

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

#include <L1TMuonBarrelKalmanRegionModule.h>

Classes

class  SeedSorter
 

Public Member Functions

 L1TMuonBarrelKalmanRegionModule (const edm::ParameterSet &, int wheel, int sector)
 
L1MuKBMTrackCollection process (L1TMuonBarrelKalmanAlgo *, const L1MuKBMTCombinedStubRefVector &stubs, int bx)
 
const int wheel () const
 
 ~L1TMuonBarrelKalmanRegionModule ()
 

Private Member Functions

L1MuKBMTrackCollection cleanHigher (const L1MuKBMTrackCollection &tracks1, const L1MuKBMTrackCollection &tracks2)
 
L1MuKBMTrackCollection cleanLower (const L1MuKBMTrackCollection &tracks1, const L1MuKBMTrackCollection &tracks2)
 
L1MuKBMTrackCollection cleanRegion (const L1MuKBMTrackCollection &, const L1MuKBMTrackCollection &, const L1MuKBMTrackCollection &)
 
L1MuKBMTrackCollection selfClean (const L1MuKBMTrackCollection &tracks)
 
L1MuKBMTrackCollection sort4 (const L1MuKBMTrackCollection &in)
 

Private Attributes

int nextSector_
 
int nextWheel_
 
int previousSector_
 
int sector_
 
int verbose_
 
int wheel_
 

Detailed Description

Definition at line 8 of file L1TMuonBarrelKalmanRegionModule.h.

Constructor & Destructor Documentation

L1TMuonBarrelKalmanRegionModule::L1TMuonBarrelKalmanRegionModule ( const edm::ParameterSet iConfig,
int  wheel,
int  sector 
)

Definition at line 5 of file L1TMuonBarrelKalmanRegionModule.cc.

References nextSector_, nextWheel_, and previousSector_.

5  :
6  verbose_(iConfig.getParameter<int>("verbose")),
7  sector_(sector),
9 {
10 
11  if (sector==11) {
12  nextSector_=0;
13  previousSector_ = 10;
14  }
15  else if (sector==0) {
16  nextSector_=1;
17  previousSector_ = 11;
18  }
19  else {
20  nextSector_= sector+1;
21  previousSector_ = sector-1;
22  }
23 
24  switch(wheel) {
25 
26  case -2:
27  nextWheel_=-1;
28  break;
29 
30  case -1:
31  nextWheel_=0;
32  break;
33 
34  case 0:
35  nextWheel_=999;
36  break;
37 
38  case 1:
39  nextWheel_=0;
40  break;
41 
42  case 2:
43  nextWheel_=1;
44  break;
45 
46  default:
47  nextWheel_=999;
48  break;
49  }
50 }
T getParameter(std::string const &) const
L1TMuonBarrelKalmanRegionModule::~L1TMuonBarrelKalmanRegionModule ( )

Definition at line 54 of file L1TMuonBarrelKalmanRegionModule.cc.

54 {}

Member Function Documentation

L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::cleanHigher ( const L1MuKBMTrackCollection tracks1,
const L1MuKBMTrackCollection tracks2 
)
private

Definition at line 154 of file L1TMuonBarrelKalmanRegionModule.cc.

References mps_fire::i, keep, MillePedeFileConverter_cfg::out, and parallelization::uint().

Referenced by cleanRegion().

154  {
156 
157  for (uint i=0;i<tracks1.size();++i) {
158  bool keep=true;
159 
160  for (uint j=0;j<tracks2.size();++j) {
161  if (tracks1[i].overlapTrack(tracks2[j])) {
162  if (tracks1[i].rank()<=tracks2[j].rank()) {
163  keep=false;
164  }
165  }
166  }
167  if (keep)
168  out.push_back(tracks1[i]);
169  }
170 
171  return out;
172 }
const int keep
def uint(string)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::cleanLower ( const L1MuKBMTrackCollection tracks1,
const L1MuKBMTrackCollection tracks2 
)
private

Definition at line 174 of file L1TMuonBarrelKalmanRegionModule.cc.

References mps_fire::i, keep, MillePedeFileConverter_cfg::out, and parallelization::uint().

Referenced by cleanRegion().

174  {
176 
177  for (uint i=0;i<tracks1.size();++i) {
178  bool keep=true;
179 
180  for (uint j=0;j<tracks2.size();++j) {
181  if (tracks1[i].overlapTrack(tracks2[j])) {
182  if (tracks1[i].rank()<tracks2[j].rank()) {
183  keep=false;
184  }
185  }
186  }
187  if (keep)
188  out.push_back(tracks1[i]);
189  }
190 
191  return out;
192 }
const int keep
def uint(string)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::cleanRegion ( const L1MuKBMTrackCollection tracks2,
const L1MuKBMTrackCollection tracks3,
const L1MuKBMTrackCollection tracks4 
)
private

Definition at line 294 of file L1TMuonBarrelKalmanRegionModule.cc.

References cleanHigher(), cleanLower(), MillePedeFileConverter_cfg::out, selfClean(), and sort4().

Referenced by process().

294  {
295 
296 
297  L1MuKBMTrackCollection cleaned2 = selfClean(tracks2);
298  L1MuKBMTrackCollection cleaned3 = selfClean(tracks3);
299 
300  L1MuKBMTrackCollection cleaned23 = cleanHigher(cleaned2,tracks3);
301  L1MuKBMTrackCollection cleaned32 = cleanLower(cleaned3,tracks2);
302 
303  //printf("Cleaned sizes = 2=%d 3=%d 23=%d 32=%d \n",int(cleaned2.size()),int(cleaned3.size()),int(cleaned23.size()),int(cleaned32.size()));
304 
305  //merge 2,3
307 
308  if (!cleaned32.empty())
309  step1.insert(step1.end(),cleaned32.begin(),cleaned32.end());
310  if (!cleaned23.empty())
311  step1.insert(step1.end(),cleaned23.begin(),cleaned23.end());
312 
313 
314  //take the best 2
315  L1MuKBMTrackCollection sorted23=sort4(step1);
316  // printf("Sorted 23 =%d\n",int(sorted23.size()));
317 
318  //Now clean the tracks 4 between them
319  L1MuKBMTrackCollection cleaned4 = selfClean(tracks4);
320  // printf("Cleaned4 =%d\n",int(cleaned4.size()));
321 
322  //Now clean the 23 tracks from tracks4
323  L1MuKBMTrackCollection cleanedSorted23 = cleanHigher(sorted23,tracks4);
324 
325  // printf("Cleaned23 from 4 =%d\n",int(cleanedSorted23.size()));
326 
327  //Now clean the tracks4 from sorted 23
328  L1MuKBMTrackCollection cleanedSorted4 = cleanLower(cleaned4,sorted23);
329  // printf("Cleaned4 from 23 =%d\n",int(cleanedSorted4.size()));
330 
331 
332  //Now merge all of those
334 
335  if (!cleanedSorted4.empty())
336  step2.insert(step2.end(),cleanedSorted4.begin(),cleanedSorted4.end());
337  if (!cleanedSorted23.empty())
338  step2.insert(step2.end(),cleanedSorted23.begin(),cleanedSorted23.end());
339 
341  return out;
342 
343 
344 }
L1MuKBMTrackCollection cleanLower(const L1MuKBMTrackCollection &tracks1, const L1MuKBMTrackCollection &tracks2)
L1MuKBMTrackCollection cleanHigher(const L1MuKBMTrackCollection &tracks1, const L1MuKBMTrackCollection &tracks2)
L1MuKBMTrackCollection sort4(const L1MuKBMTrackCollection &in)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection selfClean(const L1MuKBMTrackCollection &tracks)
L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::process ( L1TMuonBarrelKalmanAlgo trackMaker,
const L1MuKBMTCombinedStubRefVector stubs,
int  bx 
)

Definition at line 56 of file L1TMuonBarrelKalmanRegionModule.cc.

References L1TMuonBarrelKalmanAlgo::chain(), cleanRegion(), createfilelist::int, nextSector_, nextWheel_, MillePedeFileConverter_cfg::out, previousSector_, sector_, SurveyInfoScenario_cff::seed, jetUpdater_cfi::sort, MCScenario_CRAFT1_22X::sorter(), verbose_, and wheel_.

Referenced by wheel().

56  {
59  L1MuKBMTrackCollection pretracks2;
60  L1MuKBMTrackCollection pretracks3;
61  L1MuKBMTrackCollection pretracks4;
62  for (const auto& stub : stubsAll) {
63  if (stub->bxNum()!=bx)
64  continue;
65 
66  if ((stub->scNum()==nextSector_ && stub->phi()>=-112)||(stub->scNum()==previousSector_ && stub->phi()<=111))
67  continue;
68 
69  if (stub->whNum()==wheel_ && stub->scNum()==sector_) {
70  seeds.push_back(stub);
71  stubs.push_back(stub);
72  }
73  else if (stub->whNum()==wheel_ && (stub->scNum()==nextSector_||stub->scNum()==previousSector_ )) {
74  stubs.push_back(stub);
75  }
76  else if (stub->whNum()==nextWheel_ && (stub->scNum()==nextSector_||stub->scNum()==previousSector_||stub->scNum()==sector_) ) {
77  stubs.push_back(stub);
78  }
79  }
80 
81 
82  //Sort the seeds by tag so that the emulator is aligned like the firmware
83 
84  SeedSorter sorter;
85  if (seeds.size()>1) {
86  std::sort(seeds.begin(),seeds.end(),sorter);
87  }
88 
89 
90  for (const auto seed : seeds) {
91  std::pair<bool,L1MuKBMTrack> trackInfo = trackMaker->chain(seed,stubs);
92  if (trackInfo.first) {
93  if (seed->stNum()==2)
94  pretracks2.push_back(trackInfo.second);
95  if (seed->stNum()==3)
96  pretracks3.push_back(trackInfo.second);
97  if (seed->stNum()==4)
98  pretracks4.push_back(trackInfo.second);
99  }
100  }
101  //for (const auto& track1 :pretracks2)
102  // printf("SEED=2 Kalman Track charge=%d pt=%f eta=%f phi=%f curvature=%d curvature STA =%d stubs=%d chi2=%d pts=%f %f pattern=%d\n",track1.charge(),track1.pt(),track1.eta(),track1.phi(),track1.curvatureAtVertex(),track1.curvatureAtMuon(),int(track1.stubs().size()),track1.approxChi2(),track1.pt(),track1.ptUnconstrained(),track1.hitPattern());
103 
104  //for (const auto& track1 :pretracks3)
105  // printf("SEED=3 Kalman Track charge=%d pt=%f eta=%f phi=%f curvature=%d curvature STA =%d stubs=%d chi2=%d pts=%f %f pattern=%d\n",track1.charge(),track1.pt(),track1.eta(),track1.phi(),track1.curvatureAtVertex(),track1.curvatureAtMuon(),int(track1.stubs().size()),track1.approxChi2(),track1.pt(),track1.ptUnconstrained(),track1.hitPattern());
106 
107 
108  //for (const auto& track1 :pretracks4)
109  // printf("SEED=4 Kalman Track charge=%d pt=%f eta=%f phi=%f curvature=%d curvature STA =%d stubs=%d chi2=%d pts=%f %f pattern=%d\n",track1.charge(),track1.pt(),track1.eta(),track1.phi(),track1.curvatureAtVertex(),track1.curvatureAtMuon(),int(track1.stubs().size()),track1.approxChi2(),track1.pt(),track1.ptUnconstrained(),track1.hitPattern());
110 
111 
112 
113  // trackMaker->resolveEtaUnit(pretracks);
114  L1MuKBMTrackCollection out =cleanRegion(pretracks2,pretracks3,pretracks4);
115  if (verbose_) {
116  printf(" -----Sector Processor Kalman Tracks-----\n");
117  for (const auto& track1 :out)
118  printf("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());
119  }
120 
121  return out;
122 }
std::vector< edm::Ref< L1MuKBMTCombinedStubCollection > > L1MuKBMTCombinedStubRefVector
L1MuKBMTrackCollection cleanRegion(const L1MuKBMTrackCollection &, const L1MuKBMTrackCollection &, const L1MuKBMTrackCollection &)
std::pair< bool, L1MuKBMTrack > chain(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::selfClean ( const L1MuKBMTrackCollection tracks)
private

Definition at line 125 of file L1TMuonBarrelKalmanRegionModule.cc.

References mps_fire::i, keep, MillePedeFileConverter_cfg::out, and parallelization::uint().

Referenced by cleanRegion().

125  {
127 
128  for (uint i=0;i<tracks.size();++i) {
129  bool keep=true;
130 
131  for (uint j=0;j<tracks.size();++j) {
132  if (i==j)
133  continue;
134 
135  if (tracks[i].overlapTrack(tracks[j])) {
136  if (tracks[i].rank()<tracks[j].rank()) {
137  keep=false;
138  }
139  else if (tracks[i].rank()==tracks[j].rank()) { //if same rank prefer seed that is high
140  if (!tracks[j].stubs()[0]->tag())
141  keep=false;
142  }
143  }
144  }
145 
146  if (keep)
147  out.push_back(tracks[i]);
148  }
149 
150  return out;
151 }
const int keep
def uint(string)
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1MuKBMTrackCollection L1TMuonBarrelKalmanRegionModule::sort4 ( const L1MuKBMTrackCollection in)
private

Definition at line 195 of file L1TMuonBarrelKalmanRegionModule.cc.

References MillePedeFileConverter_cfg::out, EnergyCorrector::pt, and reco::LeafCandidate::pt().

Referenced by cleanRegion().

195  {
196 
198  //partial sort like in firmwarE (bitonic)
199  if (in.size()<=2)
200  return in;
201  else if (in.size()==3) {
202  //Step 1
203  L1MuKBMTrack s2_1;
204  L1MuKBMTrack s2_3;
205  if (in[2].pt()>=in[0].pt()) {
206  s2_1=in[2];
207  s2_3=in[0];
208  }
209  else {
210  s2_1=in[0];
211  s2_3=in[2];
212  }
213 
214  L1MuKBMTrack s2_2=in[1];
215  //Step 2;
216  L1MuKBMTrack s3_1=s2_1;
217  L1MuKBMTrack s3_2;
218  L1MuKBMTrack s3_3;
219 
220  if (s2_3.pt()>=s2_2.pt()) {
221  s3_2=s2_3;
222  s3_3=s2_2;
223  }
224  else {
225  s3_2=s2_2;
226  s3_3=s2_3;
227  }
228 
229  out.push_back(s3_1);
230  out.push_back(s3_2);
231 
232  }
233  else {
234  //Step 1
235  L1MuKBMTrack s2_1;
236  L1MuKBMTrack s2_2;
237  L1MuKBMTrack s2_3;
238  L1MuKBMTrack s2_4;
239 
240  if (in[2].pt()>=in[0].pt()) {
241  s2_1=in[2];
242  s2_3=in[0];
243  }
244  else {
245  s2_1=in[0];
246  s2_3=in[2];
247  }
248  if (in[3].pt()>=in[1].pt()) {
249  s2_2=in[3];
250  s2_4=in[1];
251  }
252  else {
253  s2_2=in[1];
254  s2_4=in[3];
255  }
256  //Step 2
257  L1MuKBMTrack s3_1;
258  L1MuKBMTrack s3_2;
259  L1MuKBMTrack s3_3;
260  L1MuKBMTrack s3_4;
261 
262 
263  if (s2_4.pt()>=s2_1.pt()) {
264  s3_1=s2_4;
265  s3_4=s2_1;
266  }
267  else {
268  s3_1=s2_1;
269  s3_4=s2_4;
270  }
271 
272  if (s2_3.pt()>=s2_2.pt()) {
273  s3_2=s2_3;
274  s3_3=s2_2;
275  }
276  else {
277  s3_2=s2_2;
278  s3_3=s2_3;
279  }
280 
281 
282 
283  out.push_back(s3_1);
284  out.push_back(s3_2);
285  }
286 
287  return out;
288 
289 
290 
291 
292 }
double pt() const final
transverse momentum
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
const int L1TMuonBarrelKalmanRegionModule::wheel ( ) const
inline

Definition at line 13 of file L1TMuonBarrelKalmanRegionModule.h.

References process(), and wheel_.

Referenced by geometryXMLparser.DTAlignable::index().

Member Data Documentation

int L1TMuonBarrelKalmanRegionModule::nextSector_
private

Definition at line 22 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by L1TMuonBarrelKalmanRegionModule(), and process().

int L1TMuonBarrelKalmanRegionModule::nextWheel_
private

Definition at line 24 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by L1TMuonBarrelKalmanRegionModule(), and process().

int L1TMuonBarrelKalmanRegionModule::previousSector_
private

Definition at line 23 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by L1TMuonBarrelKalmanRegionModule(), and process().

int L1TMuonBarrelKalmanRegionModule::sector_
private

Definition at line 20 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by process().

int L1TMuonBarrelKalmanRegionModule::verbose_
private

Definition at line 19 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by process().

int L1TMuonBarrelKalmanRegionModule::wheel_
private

Definition at line 21 of file L1TMuonBarrelKalmanRegionModule.h.

Referenced by process(), and wheel().