test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions | Variables
PatternRecognition.cc File Reference
#include "L1Trigger/L1TMuonEndCap/interface/PatternRecognition.h"

Go to the source code of this file.

Macros

#define PATTERN_SIZE   9
 

Functions

PatternOutput DetectPatterns (ZonesOutput Eout)
 
std::vector< PatternOutputPatterns (std::vector< ZonesOutput > Zones)
 
void PrintQuality (QualityOutput out)
 

Variables

PhiMemoryImage pattern1 (0x8000, 0, 0, 0x8000, 0, 0, 0x8000, 0, 0, 0x8000, 0, 0)
 
PhiMemoryImage pattern2 (0x10000, 0, 0, 0x8000, 0, 0, 0xc000, 0, 0, 0xc000, 0, 0)
 
PhiMemoryImage pattern3 (0x4000, 0, 0, 0x8000, 0, 0, 0x18000, 0, 0, 0x18000, 0, 0)
 
PhiMemoryImage pattern4 (0x60000, 0, 0, 0x8000, 0, 0, 0xe000, 0, 0, 0xe000, 0, 0)
 
PhiMemoryImage pattern5 (0x3000, 0, 0, 0x8000, 0, 0, 0x78000, 0, 0, 0x78000, 0, 0)
 
PhiMemoryImage pattern6 (0x780000, 0, 0, 0x8000, 0, 0, 0xff00, 0, 0, 0xff00, 0, 0)
 
PhiMemoryImage pattern7 (0xf00, 0, 0, 0x8000, 0, 0, 0x7f8000, 0, 0, 0x7f8000, 0, 0)
 
PhiMemoryImage pattern8 (0x7f800000, 0, 0, 0x8000, 0, 0, 0xff00, 0, 0, 0xff00, 0, 0)
 
PhiMemoryImage pattern9 (0xff, 0, 0, 0x8000, 0, 0, 0x7f8000, 0, 0, 0x7f8000, 0, 0)
 
PhiMemoryImage patterns [9] = {pattern8, pattern9, pattern6, pattern7, pattern4, pattern5, pattern2, pattern3, pattern1}
 

Macro Definition Documentation

#define PATTERN_SIZE   9

Definition at line 12 of file PatternRecognition.cc.

Referenced by DetectPatterns().

Function Documentation

PatternOutput DetectPatterns ( ZonesOutput  Eout)

variable declarations///

Definition at line 24 of file PatternRecognition.cc.

References a, b, PhiMemoryImage::BitShift(), ZonesOutput::convertedhits, PatternOutput::detected, PatternOutput::hits, i, relval_2017::k, QualityOutput::layer, convertSQLitetoXML_cfg::output, patt, PATTERN_SIZE, QualityOutput::rank, QualityOutput::straightness, tmp, detailsBasic3DVector::y, and ZonesOutput::zone.

Referenced by Patterns().

24  {
25 
27  //bool verbose = false;
28  std::vector<int> tmp (192, 0);//was 128
29  std::vector<std::vector<int>> lya (4, tmp), stra (4, tmp), ranka_t (4, tmp), ranka (4, tmp);
30  std::vector<PhiMemoryImage> Merged = Eout.zone;
32 
33 
34  for(int zone=0;zone<4;zone++){
35 
36  for(int b=0;b<192;b++){//loop over stips of detector zones//was 128 now 192 to accomodate
37  //larger phi scale used in neighboring sectors algorithm
38  int ly[PATTERN_SIZE] = {0}, srt[PATTERN_SIZE] = {0}, qu[PATTERN_SIZE] = {0};
40  for (int i=0; i<PATTERN_SIZE; i++) patt[i] = patterns[i];
41  for(int y=0;y != PATTERN_SIZE;y++){//loop over patterns
42 
43  bool zona[12] = {false}; //Clear out station presence
44 
45  if((b-15) < 63){
46  patt[y].BitShift(b-15);
47  }
48  else if((b-15) < 127){
49  patt[y].BitShift(63);patt[y].BitShift(1);patt[y].BitShift(b-79);
50  }
51  else{
52  patt[y].BitShift(63);patt[y].BitShift(1);patt[y].BitShift(63);patt[y].BitShift(1);patt[y].BitShift(b-143);
53  }
54 
55  for(int yy=0;yy != 12;yy++){//loop over 8 long integers of each pattern
56  zona[yy] = patt[y][yy] & Merged[zone][yy];
57  }
58 
59  if(zona[0] || zona[1] || zona[2]){ly[y] += 4;}//if station 1 is present
60  if(zona[3] || zona[4] || zona[5]){ly[y] += 2;}//if station 2 is present
61  if(zona[6] || zona[7] || zona[8] || zona[9] || zona[10] || zona[11]){ly[y] += 1;}//if station 3 or 4 is present
62  srt[y] = y/2;//straightness code::pattern specific
63 
64  if( (ly[y] != 0) && (ly[y] != 1) && (ly[y] != 2) && (ly[y] != 4) ){//Removes single and ME34 hit combinations//
65 
66  //creates quality code by interleving straightness and layer bit words///
67  if((srt[y] & 1) != 0){qu[y] += 2;}
68  if((srt[y] & 2) != 0){qu[y] += 8;}
69  if((srt[y] & 4) != 0){qu[y] += 32;}
70  if((ly[y] & 1) != 0){qu[y] += 1;}
71  if((ly[y] & 2) != 0){qu[y] += 4;}
72  if((ly[y] & 4) != 0){qu[y] += 16;}
74 
75  }
76 
77  }//pattern loop
78 
79  for(int a=0;a<PATTERN_SIZE;a++)
80  {
81  if(qu[a] > ranka_t[zone][b]){//take highest quality from all patterns at given key strip
82 
83  ranka_t[zone][b] = qu[a];
84  lya[zone][b] = ly[a];
85  stra[zone][b] = srt[a];
86  }
87  }//pattern loop to assign quality
88 
89  }//strip loop
90  }//zone loop
91 
95 
96  for(int zone=0;zone<4;zone++){
97 
98  for(int k=0;k<192;k++){//was 128
99 
100  int qr = 0, ql = 0, qc = ranka_t[zone][k];
101 
102  if(k>0){qr=ranka_t[zone][k-1];}
103  if(k<191){ql=ranka_t[zone][k+1];}//was 127
104 
105 
106  if((qc <= ql) || (qc < qr)){qc = 0;}
107 
108  ranka[zone][k] = qc;
109  }
110  }
111 
112  QualityOutput qout;
113  qout.rank = ranka;
114  qout.layer = lya;
115  qout.straightness = stra;
116 
118  output.detected = qout;
119  output.hits = Eout.convertedhits;
120 
121  return output;
122 
123 }
int i
Definition: DBlmapReader.cc:9
PhiMemoryImage patterns[9]
std::vector< PhiMemoryImage > zone
std::vector< ConvertedHit > convertedhits
#define PATTERN_SIZE
void BitShift(int nBits)
double b
Definition: hdecay.h:120
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
QualityOutput detected
std::vector< ConvertedHit > hits
float patt[4][130000]
Definition: HijingWrapper.h:38
std::vector<PatternOutput> Patterns ( std::vector< ZonesOutput Zones)

Definition at line 125 of file PatternRecognition.cc.

References DetectPatterns(), i, convertSQLitetoXML_cfg::output, and tmp.

Referenced by L1TMuonEndCapTrackProducer::produce().

125  {
126 
128  std::vector<PatternOutput> output (3,tmp);
129 
130  for(int i=0;i<3;i++)
132 
133  return output;
134 
135 }
int i
Definition: DBlmapReader.cc:9
PatternOutput DetectPatterns(ZonesOutput Eout)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< ZonesOutput > Zones(std::vector< std::vector< ConvertedHit >> Hits)
Definition: ZoneCreation.h:37
void PrintQuality ( QualityOutput  out)

Print Quality for comparison ///

Definition at line 138 of file PatternRecognition.cc.

References gather_cfg::cout, QualityOutput::layer, QualityOutput::rank, QualityOutput::straightness, and detailsBasic3DVector::z.

138  {
139 
143  for(int zz=0;zz<4;zz++){
144  for(int z = 0;z<192;z++){//was 128
145 
146  if((out.rank)[zz][z] && ((out.layer)[zz][z] || (out.straightness)[zz][z])){std::cout<<"Found Pattern Zone: "<<zz<<"::new "<<(z+1)<<": "<<(out.layer)[zz][z]<<", "<<(out.straightness)[zz][z]<<", "<<(out.rank)[zz][z]<<" ";std::cout<<"\n\n";}//changing zones to Merged
147 
148  }
149  }
150 }
float float float z
tuple cout
Definition: gather_cfg.py:145

Variable Documentation

PhiMemoryImage pattern1(0x8000, 0, 0, 0x8000, 0, 0, 0x8000, 0, 0, 0x8000, 0, 0)

Referenced by CSCCLCTDigi::operator>().

PhiMemoryImage pattern2(0x10000, 0, 0, 0x8000, 0, 0, 0xc000, 0, 0, 0xc000, 0, 0)

Referenced by CSCCLCTDigi::operator>().

PhiMemoryImage pattern3(0x4000, 0, 0, 0x8000, 0, 0, 0x18000, 0, 0, 0x18000, 0, 0)
PhiMemoryImage pattern4(0x60000, 0, 0, 0x8000, 0, 0, 0xe000, 0, 0, 0xe000, 0, 0)
PhiMemoryImage pattern5(0x3000, 0, 0, 0x8000, 0, 0, 0x78000, 0, 0, 0x78000, 0, 0)
PhiMemoryImage pattern6(0x780000, 0, 0, 0x8000, 0, 0, 0xff00, 0, 0, 0xff00, 0, 0)
PhiMemoryImage pattern7(0xf00, 0, 0, 0x8000, 0, 0, 0x7f8000, 0, 0, 0x7f8000, 0, 0)
PhiMemoryImage pattern8(0x7f800000, 0, 0, 0x8000, 0, 0, 0xff00, 0, 0, 0xff00, 0, 0)
PhiMemoryImage pattern9(0xff, 0, 0, 0x8000, 0, 0, 0x7f8000, 0, 0, 0x7f8000, 0, 0)