CMS 3D CMS Logo

createPhase1TrackerGeometry.cc
Go to the documentation of this file.
1 //-------------------
2 // Phase1 tracker geometry
3 //-------------------
4 
5 #include "Config.h"
6 #include "Debug.h"
7 #include "TrackerInfo.h"
8 #include "mkFit/IterationConfig.h"
9 #include "mkFit/HitStructures.h"
10 
11 #include <functional>
12 
13 using namespace mkfit;
14 
15 namespace {
16 #include "createPhase1TrackerGeometryAutoGen.acc"
17 
18  void setupSteeringParamsIter0(IterationConfig &ic) {
19  ic.m_region_order[0] = TrackerInfo::Reg_Transition_Pos;
20  ic.m_region_order[1] = TrackerInfo::Reg_Transition_Neg;
21  ic.m_region_order[2] = TrackerInfo::Reg_Endcap_Pos;
22  ic.m_region_order[3] = TrackerInfo::Reg_Endcap_Neg;
23  ic.m_region_order[4] = TrackerInfo::Reg_Barrel;
24 
25  {
26  SteeringParams &sp = ic.m_steering_params[TrackerInfo::Reg_Endcap_Neg];
27  sp.reserve_plan(3 + 3 + 6 + 18); // BPix + FPix- + TID- + TEC-; BPix4 is out of acceptance
28  sp.fill_plan(0, 1, false, true); // bk-fit only
29  sp.append_plan(2, true); // pick-up only
30  sp.append_plan(45, false);
31  sp.append_plan(46, false);
32  sp.append_plan(47, false);
33  sp.fill_plan(48, 53); // TID, 6 disks (3 mono + 3 stereo)
34  sp.fill_plan(54, 71); // TEC, 18 disks (3 mono + 3 stereo)
35  sp.finalize_plan();
36  }
37  {
38  SteeringParams &sp = ic.m_steering_params[TrackerInfo::Reg_Transition_Neg];
39  sp.reserve_plan(4 + 3 + 6 + 6 + 8 + 18); // BPix + FPix- + TIB + TID- + TOB + TEC-
40  sp.fill_plan(0, 1, false, true); // bk-fit only
41  sp.append_plan(2, true);
42  sp.append_plan(3, false);
43  sp.append_plan(45, false);
44  sp.append_plan(46, false);
45  sp.append_plan(47, false);
46  sp.fill_plan(4, 9); // TIB, 6 layers (4 mono + 2 stereo)
47  sp.fill_plan(48, 53); // TID, 6 disks (3 mono + 3 stereo)
48  sp.fill_plan(10, 17); // TOB, 8 layers (6 mono + 2 stereo)
49  sp.fill_plan(54, 71); // TEC, 18 disks (9 mono + 9 stereo)
50  sp.finalize_plan();
51  }
52  {
53  SteeringParams &sp = ic.m_steering_params[TrackerInfo::Reg_Barrel];
54  sp.reserve_plan(4 + 6 + 8); // BPix + TIB + TOB
55  sp.fill_plan(0, 1, false, true); // bk-fit only
56  sp.append_plan(2, true); // pickup-only
57  sp.append_plan(3, false);
58  sp.fill_plan(4, 9); // TIB, 6 layers (4 mono + 2 stereo)
59  sp.fill_plan(10, 17); // TOB, 8 layers (6 mono + 2 stereo)
60  sp.finalize_plan();
61  }
62  {
63  SteeringParams &sp = ic.m_steering_params[TrackerInfo::Reg_Transition_Pos];
64  sp.reserve_plan(4 + 3 + 6 + 6 + 8 + 18); // BPix + FPix+ + TIB + TID+ + TOB + TEC+
65  sp.fill_plan(0, 1, false, true); // bk-fit only
66  sp.append_plan(2, true); // pickup-only
67  sp.append_plan(3, false);
68  sp.append_plan(18, false);
69  sp.append_plan(19, false);
70  sp.append_plan(20, false);
71  sp.fill_plan(4, 9); // TIB, 6 layers (4 mono + 2 stereo)
72  sp.fill_plan(21, 26); // TID, 6 disks (3 mono + 3 stereo)
73  sp.fill_plan(10, 17); // TOB, 8 layers (6 mono + 2 stereo)
74  sp.fill_plan(27, 44); // TEC, 18 disks (9 mono + 9 stereo)
75  sp.finalize_plan();
76  }
77  {
78  SteeringParams &sp = ic.m_steering_params[TrackerInfo::Reg_Endcap_Pos];
79  sp.reserve_plan(3 + 3 + 6 + 18); // BPix + FPix+ + TID+ + TEC+; BPix4 is out of acceptance
80  sp.fill_plan(0, 1, false, true); // bk-fit only
81  sp.append_plan(2, true); // pickup-only
82  sp.append_plan(18, false);
83  sp.append_plan(19, false);
84  sp.append_plan(20, false);
85  sp.fill_plan(21, 26); // TID, 6 disks (3 mono + 3 stereo)
86  sp.fill_plan(27, 44); // TEC, 18 disks (9 mono + 9 stereo)
87  sp.finalize_plan();
88  }
89  }
90 
91  void partitionSeeds0(const TrackerInfo &trk_info,
92  const TrackVec &in_seeds,
93  const EventOfHits &eoh,
94  IterationSeedPartition &part) {
95  // Seeds are placed into eta regions and sorted on region + eta.
96 
97  const int size = in_seeds.size();
98 
99  for (int i = 0; i < size; ++i) {
100  const Track &S = in_seeds[i];
101 
102  const bool z_dir_pos = S.pz() > 0;
103 
104  HitOnTrack hot = S.getLastHitOnTrack();
105  // MIMI ACHTUNG -- here we assume seed hits have already been remapped.
106  // This was true at that time :)
107  float eta = eoh[hot.layer].GetHit(hot.index).eta();
108  // float eta = S.momEta();
109 
110  // Region to be defined by propagation / intersection tests
112 
113  // Hardcoded for cms ... needs some lists of layers (hit/miss) for brl / ecp tests.
114  // MM: Check lambda functions/std::function
115  const LayerInfo &outer_brl = trk_info.outer_barrel_layer();
116 
117  const LayerInfo &tib1 = trk_info.m_layers[4];
118  const LayerInfo &tob1 = trk_info.m_layers[10];
119 
120  const LayerInfo &tecp1 = trk_info.m_layers[27];
121  const LayerInfo &tecn1 = trk_info.m_layers[54];
122 
123  const LayerInfo &tec_first = z_dir_pos ? tecp1 : tecn1;
124 
125  // If a track hits outer barrel ... it is in the barrel (for central, "outgoing" tracks).
126  // This is also true for cyl-cow.
127  // Better check is: hits outer TIB, misses inner TEC (but is +-z dependant).
128  // XXXX Calculate z ... then check is inside or less that first EC z.
129  // There are a lot of tracks that go through that crack.
130 
131  // XXXX trying a fix for low pT tracks that are in barrel after half circle
132  float maxR = S.maxReachRadius();
133  float z_at_maxr;
134 
135  bool can_reach_outer_brl = S.canReachRadius(outer_brl.m_rout);
136  float z_at_outer_brl;
137  bool misses_first_tec;
138  if (can_reach_outer_brl) {
139  z_at_outer_brl = S.zAtR(outer_brl.m_rout);
140  if (z_dir_pos)
141  misses_first_tec = z_at_outer_brl < tec_first.m_zmin;
142  else
143  misses_first_tec = z_at_outer_brl > tec_first.m_zmax;
144  } else {
145  z_at_maxr = S.zAtR(maxR);
146  if (z_dir_pos)
147  misses_first_tec = z_at_maxr < tec_first.m_zmin;
148  else
149  misses_first_tec = z_at_maxr > tec_first.m_zmax;
150  }
151 
152  if (/*can_reach_outer_brl &&*/ misses_first_tec)
153  // outer_brl.is_within_z_limits(S.zAtR(outer_brl.r_mean())))
154  {
155  reg = TrackerInfo::Reg_Barrel;
156  } else {
157  // This should be a list of layers
158  // CMS, first tib, tob: 4, 10
159 
160  if ((S.canReachRadius(tib1.m_rin) && tib1.is_within_z_limits(S.zAtR(tib1.m_rin))) ||
161  (S.canReachRadius(tob1.m_rin) && tob1.is_within_z_limits(S.zAtR(tob1.m_rin)))) {
162  // transition region ... we are still hitting barrel layers
163 
164  reg = z_dir_pos ? TrackerInfo::Reg_Transition_Pos : TrackerInfo::Reg_Transition_Neg;
165  } else {
166  // endcap ... no barrel layers will be hit anymore.
167 
168  reg = z_dir_pos ? TrackerInfo::Reg_Endcap_Pos : TrackerInfo::Reg_Endcap_Neg;
169  }
170  }
171 
172  part.m_region[i] = reg;
173  part.m_sort_score[i] = 5.0f * (reg - 2) + eta;
174  }
175  }
176 } // namespace
177 
178 namespace mkfit {
179  void createPhase1TrackerGeometry(TrackerInfo &ti, IterationsInfo &ii, bool verbose) {
180  // TODO: these writes to global variables need to be removed
181  Config::nTotalLayers = 18 + 2 * 27;
182 
183  Config::useCMSGeom = true;
184 
185  Config::finding_requires_propagation_to_hit_pos = true;
186  Config::finding_inter_layer_pflags = PropagationFlags(PF_use_param_b_field | PF_apply_material);
187  Config::finding_intra_layer_pflags = PropagationFlags(PF_none);
188  Config::backward_fit_pflags = PropagationFlags(PF_use_param_b_field | PF_apply_material);
189  Config::forward_fit_pflags = PropagationFlags(PF_use_param_b_field | PF_apply_material);
190  Config::seed_fit_pflags = PropagationFlags(PF_none);
191  Config::pca_prop_pflags = PropagationFlags(PF_none);
192 
193  ti.set_eta_regions(0.9, 1.7, 2.45, false);
194  ti.create_layers(18, 27, 27);
195 
196  ii.resize(10);
197  ii[0].set_iteration_index_and_track_algorithm(0, (int)TrackBase::TrackAlgorithm::initialStep);
198  ii[0].set_num_regions_layers(5, 72);
199 
200  createPhase1TrackerGeometryAutoGen(ti, ii);
201 
202  setupSteeringParamsIter0(ii[0]);
203  ii[0].m_partition_seeds = partitionSeeds0;
204 
205  ii[1].Clone(ii[0]);
206  ii[1].set_iteration_index_and_track_algorithm(1, (int)TrackBase::TrackAlgorithm::highPtTripletStep);
207 
208  ii[2].Clone(ii[0]);
209  ii[2].set_iteration_index_and_track_algorithm(2, (int)TrackBase::TrackAlgorithm::lowPtQuadStep);
210 
211  ii[3].Clone(ii[0]);
212  ii[3].set_iteration_index_and_track_algorithm(3, (int)TrackBase::TrackAlgorithm::lowPtTripletStep);
213 
214  ii[4].Clone(ii[0]);
215  ii[4].set_iteration_index_and_track_algorithm(4, (int)TrackBase::TrackAlgorithm::detachedQuadStep);
216 
217  ii[5].Clone(ii[0]);
218  ii[5].set_iteration_index_and_track_algorithm(5, (int)TrackBase::TrackAlgorithm::detachedTripletStep);
219 
220  ii[6].Clone(ii[0]);
221  ii[6].set_iteration_index_and_track_algorithm(6, (int)TrackBase::TrackAlgorithm::mixedTripletStep);
222 
223  ii[7].Clone(ii[0]);
224  ii[7].set_iteration_index_and_track_algorithm(7, (int)TrackBase::TrackAlgorithm::pixelLessStep);
225 
226  ii[8].Clone(ii[0]);
227  ii[8].set_iteration_index_and_track_algorithm(8, (int)TrackBase::TrackAlgorithm::tobTecStep);
228 
229  ii[9].Clone(ii[0]);
230  ii[9].set_iteration_index_and_track_algorithm(9, (int)TrackBase::TrackAlgorithm::pixelPairStep);
231 
232  // for iters [7] and [8]: investing in maxCand & stop condition (for time) + QF and Dupl. cleaning (for quality)
233 
234  // TODO: replace with MessageLogger
235  if (verbose) {
236  printf("==========================================================================================\n");
237  printf("Phase1 tracker -- Create_TrackerInfo finished\n");
238  printf("==========================================================================================\n");
239  for (auto &i : ti.m_layers)
240  i.print_layer();
241  printf("==========================================================================================\n");
242  }
243  }
244 } // namespace mkfit
TobTecStep_cff.tobTecStep
tobTecStep
Definition: TobTecStep_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
MixedTripletStep_cff.mixedTripletStep
mixedTripletStep
Definition: MixedTripletStep_cff.py:365
HcalHitValidation_cfi.LayerInfo
LayerInfo
Definition: HcalHitValidation_cfi.py:7
mkfit
Definition: MkFitEventOfHits.h:6
part
part
Definition: HCALResponse.h:20
fixedGridRhoProducer_cfi.EtaRegion
EtaRegion
Definition: fixedGridRhoProducer_cfi.py:5
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HighPtTripletStep_cff.highPtTripletStep
highPtTripletStep
Definition: HighPtTripletStep_cff.py:274
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
mkfit::createPhase1TrackerGeometry
void createPhase1TrackerGeometry(TrackerInfo &ti, IterationsInfo &ii, bool verbose)
Definition: createPhase1TrackerGeometry.cc:179
DetachedQuadStep_cff.detachedQuadStep
detachedQuadStep
Definition: DetachedQuadStep_cff.py:232
mkfit::TrackVec
std::vector< Track > TrackVec
Definition: MkFitOutputWrapper.h:8
InitialStep_cff.initialStep
initialStep
Definition: InitialStep_cff.py:323
DetachedTripletStep_cff.detachedTripletStep
detachedTripletStep
Definition: DetachedTripletStep_cff.py:278
LowPtQuadStep_cff.lowPtQuadStep
lowPtQuadStep
Definition: LowPtQuadStep_cff.py:223
S
Definition: CSCDBL1TPParametersExtended.h:16
PixelLessStep_cff.pixelLessStep
pixelLessStep
Definition: PixelLessStep_cff.py:364
LowPtTripletStep_cff.lowPtTripletStep
lowPtTripletStep
Definition: LowPtTripletStep_cff.py:296
PixelPairStep_cff.pixelPairStep
pixelPairStep
Definition: PixelPairStep_cff.py:360
cuy.ii
ii
Definition: cuy.py:589
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443