CMS 3D CMS Logo

TrackletConfigBuilder.h
Go to the documentation of this file.
1 //
2 // Class to build the configuration for the tracklet based track finding
3 //
4 //
5 //
6 #ifndef L1Trigger_TrackFindingTracklet_interface_TrackletConfigBuilder_h
7 #define L1Trigger_TrackFindingTracklet_interface_TrackletConfigBuilder_h
8 
10 
11 #include <vector>
12 #include <utility>
13 #include <set>
14 #include <iostream>
15 #include <fstream>
16 #include <cstdlib>
17 
18 namespace trklet {
19 
21  public:
22  //Builds the configuration for the tracklet based track finding
23  TrackletConfigBuilder(const Settings& settings);
24 
25  //This method writes out the configuration as files
26  void writeAll(std::ostream& wires, std::ostream& memories, std::ostream& modules);
27 
28  //
29  // The next group of fcn formats a string to write out names of different
30  // memories and processing modules
31  //
32 
33  //Seed string, eg. L1L2
34  std::string iSeedStr(unsigned int iSeed);
35 
36  //Return unsigned as string
37  static std::string numStr(unsigned int i);
38 
39  //Retunr iTC as string - ie A, B, C, etc
40  std::string iTCStr(unsigned int iTC);
41 
42  //The region string A, B, C etc for layers and disks; X, Y, Z etc for overlap
43  std::string iRegStr(unsigned int iReg, unsigned int iSeed);
44 
45  //TC Name
46  std::string TCName(unsigned int iSeed, unsigned int iTC);
47 
48  //Name of layer or disk, e.g. L1 or D1
49  static std::string LayerName(unsigned int ilayer);
50 
51  //Tracklet projection name
52  std::string TPROJName(unsigned int iSeed, unsigned int iTC, unsigned int ilayer, unsigned int ireg);
53 
54  //Projection router name
55  std::string PRName(unsigned int ilayer, unsigned int ireg);
56 
57  private:
58  //
59  // Method to initialize the regions and VM in each layer
60  //
61  void initGeom();
62 
63  //
64  // Builds the list of TE for each seeding combination
65  //
66  void buildTE();
67 
68  //
69  // Builds the lists of TC for each seeding combination
70  //
71  void buildTC();
72 
73  //
74  // Finds the projections needed for each seeding combination
75  //
76  void buildProjections();
77 
78  //
79  // Helper function to determine if a pair of VM memories form valid TE
80  //
81  bool validTEPair(unsigned int iseed, unsigned int iTE1, unsigned int iTE2);
82 
83  //
84  // Helper fcn. to get the layers/disks for a seed
85  //
86  std::pair<unsigned int, unsigned int> seedLayers(unsigned int iSeed);
87 
88  //
89  // Helper fcn to get the radii of the two layers in a seed
90  //
91  std::pair<double, double> seedRadii(unsigned int iseed);
92 
93  //
94  // Helper fcn to return the phi range of a projection of a tracklet from a TC
95  //
96  std::pair<double, double> seedPhiRange(double rproj, unsigned int iSeed, unsigned int iTC);
97 
98  //
99  // Helper function to calculate the phi position of a seed at radius r that is formed
100  // by two stubs at (r1,phi1) and (r2, phi2)
101  //
102  double phi(double r1, double phi1, double r2, double phi2, double r);
103 
104  //
105  // Helper function to calculate rinv for two stubs at (r1,phi1) and (r2,phi2)
106  //
107  double rinv(double r1, double phi1, double r2, double phi2);
108 
109  //StubPair Name
110  std::string SPName(unsigned int l1,
111  unsigned int ireg1,
112  unsigned int ivm1,
113  unsigned int l2,
114  unsigned int ireg2,
115  unsigned int ivm2,
116  unsigned int iseed);
117 
118  //StubPaur displaced name
119  std::string SPDName(unsigned int l1,
120  unsigned int ireg1,
121  unsigned int ivm1,
122  unsigned int l2,
123  unsigned int ireg2,
124  unsigned int ivm2,
125  unsigned int l3,
126  unsigned int ireg3,
127  unsigned int ivm3,
128  unsigned int iseed);
129 
130  //Stub Triplet name
131  std::string STName(unsigned int l1,
132  unsigned int ireg1,
133  unsigned int l2,
134  unsigned int ireg2,
135  unsigned int l3,
136  unsigned int ireg3,
137  unsigned int iseed,
138  unsigned int count);
139 
140  //TrackletEngine name
141  std::string TEName(unsigned int l1,
142  unsigned int ireg1,
143  unsigned int ivm1,
144  unsigned int l2,
145  unsigned int ireg2,
146  unsigned int ivm2,
147  unsigned int iseed);
148 
149  //Triplet engine name
150  std::string TREName(unsigned int l1,
151  unsigned int ireg1,
152  unsigned int l2,
153  unsigned int ireg2,
154  unsigned int iseed,
155  unsigned int count);
156 
157  //TrackletEngine displaced name
158  std::string TEDName(unsigned int l1,
159  unsigned int ireg1,
160  unsigned int ivm1,
161  unsigned int l2,
162  unsigned int ireg2,
163  unsigned int ivm2,
164  unsigned int iseed);
165 
166  //Tracklet parameter memory name
167  std::string TParName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc);
168 
169  //TrackletCalculator displaced name
170  std::string TCDName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc);
171 
172  //TrackletProjection name
173  std::string TPROJName(unsigned int l1,
174  unsigned int l2,
175  unsigned int l3,
176  unsigned int itc,
177  unsigned int projlay,
178  unsigned int projreg);
179 
180  //FitTrack module name
181  std::string FTName(unsigned int l1, unsigned int l2, unsigned int l3);
182 
183  //TrackletCalculator name
184  std::string TCNAme(unsigned int iseed, unsigned int iTC);
185 
186  //
187  // This group of methods are used to print out the configuration as a file
188  //
189  void writeProjectionMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
190 
191  void writeSPMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
192 
193  void writeSPDMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
194 
195  void writeAPMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
196 
197  void writeCMMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
198 
199  void writeVMPROJMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
200 
201  void writeFMMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
202 
203  void writeASMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
204 
205  void writeVMSMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
206 
207  void writeTPARMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
208 
209  void writeTFMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
210 
211  void writeCTMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
212 
213  void writeILMemories(std::ostream& os, std::ostream& memories, std::ostream& modules);
214 
215  //
216  // Store constants extracted from Settings
217  //
218  unsigned int NSector_; //Number of sectors
219  double rcrit_; //critical radius that defines the sector
220 
221  bool combinedmodules_; //if true write configuration for combined modules
222 
223  bool extended_; //if true write configuration for extended configuration
224 
225  double rinvmax_; //Max value for valid rinv
226  double rmaxdisk_; //Maximim disk radius
227  double zlength_; //Maximim (abslute) z-positon in barrel
228  double rmean_[N_LAYER]; //Mean layer radius
229  double zmean_[N_DISK]; //Mean disk z-position
230 
231  double dphisectorHG_; //Full sector width
232 
233  unsigned int NTC_[N_SEED_PROMPT]; //Number of TC per seeding combination
234 
235  unsigned int NRegions_[N_LAYER + N_DISK]; //Regions (all stubs memories 6 layers +5 disks
236  unsigned int NVMME_[N_LAYER + N_DISK]; //Number of MEs (all stubs memories 6 layers +5 disks
237  std::pair<unsigned int, unsigned int> NVMTE_[N_SEED_PROMPT]; //number of TEs for each seeding combination
238 
239  //Min and max phi for a phi region (e.g. all stubs)
240  std::vector<std::pair<double, double> > allStubs_[N_LAYER + N_DISK];
241 
242  //Min and max phi for VM bin
243  std::vector<std::pair<double, double> > VMStubsME_[N_LAYER + N_DISK];
244 
245  //Phi ranges for the stubs in the VM bins used in the pair in th TE
246  std::pair<std::vector<std::pair<double, double> >, std::vector<std::pair<double, double> > >
248 
249  //List of the TEs and the VM bins for each TE
250  std::vector<std::pair<unsigned int, unsigned int> > TE_[N_SEED_PROMPT];
251 
252  //The TCs for each seeding combination
253  std::vector<std::vector<unsigned int> > TC_[N_SEED_PROMPT];
254 
255  //The projections to each layer/disk from a seed and TC
256  std::vector<std::vector<std::pair<unsigned int, unsigned int> > > projections_[N_LAYER + N_DISK];
257 
258  //Which matches are used for each seeding layer
259  // L1 L2 L3 L4 L5 L6 D1 D2 D3 D4 D5
260  int matchport_[N_SEED_PROMPT][N_LAYER + N_DISK] = {{-1, -1, 1, 2, 3, 4, 4, 3, 2, 1, -1}, //L1L2
261  {1, -1, -1, 2, 3, -1, 4, 3, 2, 1, -1}, //L2L3
262  {1, 2, -1, -1, 3, 4, 4, 3, -1, -1, -1}, //L3L4
263  {1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1}, //L5L6
264  {1, 2, -1, -1, -1, -1, -1, -1, 2, 3, 4}, //D1D2
265  {1, -1, -1, -1, -1, -1, 2, 3, -1, -1, 4}, //D3D4
266  {-1, -1, -1, -1, -1, -1, -1, 1, 2, 3, 4}, //L1D1
267  {1, -1, -1, -1, -1, -1, -1, 2, 3, 4, -1}}; //L2D1
268 
269  //Settings
271  };
272 } // namespace trklet
273 #endif
Settings.h
trklet::TrackletConfigBuilder::NRegions_
unsigned int NRegions_[N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:235
trklet::TrackletConfigBuilder::buildProjections
void buildProjections()
Definition: TrackletConfigBuilder.cc:216
mps_fire.i
i
Definition: mps_fire.py:428
trklet::TrackletConfigBuilder::seedLayers
std::pair< unsigned int, unsigned int > seedLayers(unsigned int iSeed)
Definition: TrackletConfigBuilder.cc:58
trklet::TrackletConfigBuilder::PRName
std::string PRName(unsigned int ilayer, unsigned int ireg)
Definition: TrackletConfigBuilder.cc:312
trklet::TrackletConfigBuilder::iTCStr
std::string iTCStr(unsigned int iTC)
Definition: TrackletConfigBuilder.cc:267
trklet::TrackletConfigBuilder::writeVMPROJMemories
void writeVMPROJMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:622
trklet::TrackletConfigBuilder::VMStubsTE_
std::pair< std::vector< std::pair< double, double > >, std::vector< std::pair< double, double > > > VMStubsTE_[N_SEED_PROMPT]
Definition: TrackletConfigBuilder.h:247
trklet::TrackletConfigBuilder::rinvmax_
double rinvmax_
Definition: TrackletConfigBuilder.h:225
modules
Definition: MuonCleanerBySegments.cc:35
trklet::TrackletConfigBuilder::writeFMMemories
void writeFMMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:639
trklet::TrackletConfigBuilder::TPROJName
std::string TPROJName(unsigned int iSeed, unsigned int iTC, unsigned int ilayer, unsigned int ireg)
Definition: TrackletConfigBuilder.cc:305
DigiDM_cff.wires
wires
Definition: DigiDM_cff.py:33
trklet::TrackletConfigBuilder::writeProjectionMemories
void writeProjectionMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:320
trklet::Settings
Definition: Settings.h:52
trklet::TrackletConfigBuilder::rmean_
double rmean_[N_LAYER]
Definition: TrackletConfigBuilder.h:228
trklet::TrackletConfigBuilder::writeSPMemories
void writeSPMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:423
trklet::TrackletConfigBuilder::NSector_
unsigned int NSector_
Definition: TrackletConfigBuilder.h:218
trklet::TrackletConfigBuilder::iRegStr
std::string iRegStr(unsigned int iReg, unsigned int iSeed)
Definition: TrackletConfigBuilder.cc:274
trklet::TrackletConfigBuilder::SPName
std::string SPName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
Definition: TrackletConfigBuilder.cc:337
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:22
trklet::TrackletConfigBuilder::rcrit_
double rcrit_
Definition: TrackletConfigBuilder.h:219
trklet::TrackletConfigBuilder::TREName
std::string TREName(unsigned int l1, unsigned int ireg1, unsigned int l2, unsigned int ireg2, unsigned int iseed, unsigned int count)
Definition: TrackletConfigBuilder.cc:402
trklet::TrackletConfigBuilder::buildTE
void buildTE()
Definition: TrackletConfigBuilder.cc:153
trklet::TrackletConfigBuilder::writeAll
void writeAll(std::ostream &wires, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:1286
trklet::TrackletConfigBuilder::TCNAme
std::string TCNAme(unsigned int iseed, unsigned int iTC)
Definition: TrackletConfigBuilder.cc:419
trklet::TrackletConfigBuilder::numStr
static std::string numStr(unsigned int i)
Definition: TrackletConfigBuilder.cc:259
trklet::TrackletConfigBuilder::writeASMemories
void writeASMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:673
trklet::TrackletConfigBuilder
Definition: TrackletConfigBuilder.h:20
trklet::TrackletConfigBuilder::initGeom
void initGeom()
Definition: TrackletConfigBuilder.cc:62
trklet::TrackletConfigBuilder::extended_
bool extended_
Definition: TrackletConfigBuilder.h:223
trklet::TrackletConfigBuilder::dphisectorHG_
double dphisectorHG_
Definition: TrackletConfigBuilder.h:231
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:21
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
trklet::TrackletConfigBuilder::writeILMemories
void writeILMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:1026
trklet::TrackletConfigBuilder::writeCMMemories
void writeCMMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:604
trklet::TrackletConfigBuilder::allStubs_
std::vector< std::pair< double, double > > allStubs_[N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:240
trklet::TrackletConfigBuilder::TCName
std::string TCName(unsigned int iSeed, unsigned int iTC)
Definition: TrackletConfigBuilder.cc:293
trklet::TrackletConfigBuilder::LayerName
static std::string LayerName(unsigned int ilayer)
Definition: TrackletConfigBuilder.cc:301
iseed
int iseed
Definition: AMPTWrapper.h:134
trklet::TrackletConfigBuilder::buildTC
void buildTC()
Definition: TrackletConfigBuilder.cc:166
trklet::TrackletConfigBuilder::NTC_
unsigned int NTC_[N_SEED_PROMPT]
Definition: TrackletConfigBuilder.h:233
trklet::TrackletConfigBuilder::writeTFMemories
void writeTFMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:1009
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
trklet::TrackletConfigBuilder::NVMME_
unsigned int NVMME_[N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:236
trklet::TrackletConfigBuilder::writeCTMemories
void writeCTMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:1017
trklet::TrackletConfigBuilder::TParName
std::string TParName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc)
Definition: TrackletConfigBuilder.cc:384
trklet::TrackletConfigBuilder::phi
double phi(double r1, double phi1, double r2, double phi2, double r)
Definition: TrackletConfigBuilder.cc:239
trklet::TrackletConfigBuilder::seedPhiRange
std::pair< double, double > seedPhiRange(double rproj, unsigned int iSeed, unsigned int iTC)
Definition: TrackletConfigBuilder.cc:190
trklet
Definition: AllInnerStubsMemory.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trklet::TrackletConfigBuilder::writeSPDMemories
void writeSPDMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:452
alignCSCRings.r
r
Definition: alignCSCRings.py:93
trklet::N_SEED_PROMPT
constexpr unsigned int N_SEED_PROMPT
Definition: Settings.h:25
trklet::TrackletConfigBuilder::projections_
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > projections_[N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:256
trklet::TrackletConfigBuilder::rmaxdisk_
double rmaxdisk_
Definition: TrackletConfigBuilder.h:226
trklet::TrackletConfigBuilder::TEName
std::string TEName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
Definition: TrackletConfigBuilder.cc:362
trklet::TrackletConfigBuilder::combinedmodules_
bool combinedmodules_
Definition: TrackletConfigBuilder.h:221
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
trklet::TrackletConfigBuilder::VMStubsME_
std::vector< std::pair< double, double > > VMStubsME_[N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:243
trklet::TrackletConfigBuilder::matchport_
int matchport_[N_SEED_PROMPT][N_LAYER+N_DISK]
Definition: TrackletConfigBuilder.h:260
trklet::TrackletConfigBuilder::settings_
const Settings & settings_
Definition: TrackletConfigBuilder.h:270
trklet::TrackletConfigBuilder::TrackletConfigBuilder
TrackletConfigBuilder(const Settings &settings)
Definition: TrackletConfigBuilder.cc:16
trklet::TrackletConfigBuilder::seedRadii
std::pair< double, double > seedRadii(unsigned int iseed)
Definition: TrackletConfigBuilder.cc:103
trklet::TrackletConfigBuilder::writeTPARMemories
void writeTPARMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:987
trklet::TrackletConfigBuilder::zlength_
double zlength_
Definition: TrackletConfigBuilder.h:227
trklet::TrackletConfigBuilder::NVMTE_
std::pair< unsigned int, unsigned int > NVMTE_[N_SEED_PROMPT]
Definition: TrackletConfigBuilder.h:237
trklet::TrackletConfigBuilder::TE_
std::vector< std::pair< unsigned int, unsigned int > > TE_[N_SEED_PROMPT]
Definition: TrackletConfigBuilder.h:250
trklet::TrackletConfigBuilder::writeAPMemories
void writeAPMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:588
trklet::TrackletConfigBuilder::SPDName
std::string SPDName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int l3, unsigned int ireg3, unsigned int ivm3, unsigned int iseed)
Definition: TrackletConfigBuilder.cc:348
trklet::TrackletConfigBuilder::TC_
std::vector< std::vector< unsigned int > > TC_[N_SEED_PROMPT]
Definition: TrackletConfigBuilder.h:253
trklet::TrackletConfigBuilder::writeVMSMemories
void writeVMSMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
Definition: TrackletConfigBuilder.cc:868
trklet::TrackletConfigBuilder::validTEPair
bool validTEPair(unsigned int iseed, unsigned int iTE1, unsigned int iTE2)
Definition: TrackletConfigBuilder.cc:126
trklet::TrackletConfigBuilder::TCDName
std::string TCDName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc)
Definition: TrackletConfigBuilder.cc:388
trklet::TrackletConfigBuilder::TEDName
std::string TEDName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
Definition: TrackletConfigBuilder.cc:373
trklet::TrackletConfigBuilder::FTName
std::string FTName(unsigned int l1, unsigned int l2, unsigned int l3)
Definition: TrackletConfigBuilder.cc:398
trklet::TrackletConfigBuilder::STName
std::string STName(unsigned int l1, unsigned int ireg1, unsigned int l2, unsigned int ireg2, unsigned int l3, unsigned int ireg3, unsigned int iseed, unsigned int count)
Definition: TrackletConfigBuilder.cc:407
trklet::TrackletConfigBuilder::iSeedStr
std::string iSeedStr(unsigned int iSeed)
Definition: TrackletConfigBuilder.cc:252
trklet::TrackletConfigBuilder::zmean_
double zmean_[N_DISK]
Definition: TrackletConfigBuilder.h:229
trklet::TrackletConfigBuilder::rinv
double rinv(double r1, double phi1, double r2, double phi2)
Definition: TrackletConfigBuilder.cc:247