Fill tree branches for a given event.
101 std::vector<bool>
isCSC;
102 std::vector<bool> isME11;
104 std::vector<float> innermost_x;
105 std::vector<float> innermost_y;
106 std::vector<float> innermost_z;
108 std::vector<float> outermost_x;
109 std::vector<float> outermost_y;
110 std::vector<float> outermost_z;
112 unsigned int nProp{0};
114 std::vector<uint32_t> propagated_muIdx;
116 std::vector<bool> propagated_isincoming;
117 std::vector<bool> propagated_isinsideout;
118 std::vector<int16_t> propagated_region;
119 std::vector<int16_t> propagated_layer;
120 std::vector<int16_t> propagated_chamber;
121 std::vector<int16_t> propagated_etaP;
123 std::vector<float> propagatedLoc_x;
124 std::vector<float> propagatedLoc_y;
125 std::vector<float> propagatedLoc_z;
126 std::vector<float> propagatedLoc_r;
127 std::vector<float> propagatedLoc_phi;
128 std::vector<float> propagatedLoc_dirX;
129 std::vector<float> propagatedLoc_dirY;
130 std::vector<float> propagatedLoc_dirZ;
131 std::vector<float> propagatedLoc_errX;
132 std::vector<float> propagatedLoc_errY;
134 std::vector<float> propagatedGlb_x;
135 std::vector<float> propagatedGlb_y;
136 std::vector<float> propagatedGlb_z;
137 std::vector<float> propagatedGlb_r;
138 std::vector<float> propagatedGlb_phi;
139 std::vector<float> propagatedGlb_errX;
140 std::vector<float> propagatedGlb_errY;
141 std::vector<float> propagatedGlb_phierr;
142 std::vector<float> propagatedGlb_rerr;
144 std::vector<float> propagated_EtaPartition_centerX;
145 std::vector<float> propagated_EtaPartition_centerY;
146 std::vector<float> propagated_EtaPartition_phiMax;
147 std::vector<float> propagated_EtaPartition_phiMin;
148 std::vector<float> propagated_EtaPartition_rMax;
149 std::vector<float> propagated_EtaPartition_rMin;
151 std::vector<int16_t> propagated_nME1hits;
152 std::vector<int16_t> propagated_nME2hits;
153 std::vector<int16_t> propagated_nME3hits;
154 std::vector<int16_t> propagated_nME4hits;
159 auto&& propagator_any =
m_muonSP->propagator(
"SteppingHelixPropagatorAny");
160 auto&& propagator_along =
m_muonSP->propagator(
"SteppingHelixPropagatorAlong");
161 auto&& propagator_opposite =
m_muonSP->propagator(
"SteppingHelixPropagatorOpposite");
163 if (!propagator_any.isValid() || !propagator_along.isValid() || !propagator_opposite.isValid()) {
173 bool is_me11 =
false;
175 if (!
muon.outerTrack().isNull()) {
176 const auto track =
muon.outerTrack().get();
177 const auto outerTrackRef =
muon.outerTrack();
179 float p2_in =
track->innerMomentum().mag2();
180 float p2_out =
track->outerMomentum().mag2();
181 float pos_out =
track->outerPosition().mag2();
182 float pos_in =
track->innerPosition().mag2();
184 bool is_insideout = pos_in > pos_out;
191 bool is_incoming = p2_out > p2_in;
194 const auto& htp = transient_track.
hitPattern();
196 if (transient_track.isValid()) {
197 const auto innerPosGlb{transient_track.innermostMeasurementState().globalPosition()};
198 const auto outerPosGlb{transient_track.outermostMeasurementState().globalPosition()};
200 innermost_x.push_back(innerPosGlb.x());
201 innermost_y.push_back(innerPosGlb.y());
202 innermost_z.push_back(innerPosGlb.z());
203 outermost_x.push_back(outerPosGlb.x());
204 outermost_y.push_back(outerPosGlb.y());
205 outermost_z.push_back(outerPosGlb.z());
216 const auto&& start_state = transient_track.innermostMeasurementState();
219 auto recHitMu = outerTrackRef->recHitsBegin();
220 auto recHitMuEnd = outerTrackRef->recHitsEnd();
223 for (; recHitMu != recHitMuEnd; ++recHitMu) {
232 if (csc_id.station() == 1 && ((csc_id.ring() == 1) || (csc_id.ring() == 4)))
240 int16_t nME1_hits = 0;
241 int16_t nME2_hits = 0;
242 int16_t nME3_hits = 0;
243 int16_t nME4_hits = 0;
245 int nHits{htp.numberOfAllHits(htp.TRACK_HITS)};
248 uint32_t
hit = htp.getHitPattern(htp.TRACK_HITS,
i);
249 int substructure = htp.getSubStructure(
hit);
250 int hittype = htp.getHitType(
hit);
252 if (substructure == 2 && hittype == 0) {
253 int CSC_station = htp.getMuonStation(
hit);
255 switch (CSC_station) {
276 if (eta_partition->id().station() != 1) {
279 const GEMDetId&& gem_id = eta_partition->id();
281 bool is_opposite_region =
muon.eta() * gem_id.
region() < 0;
282 if (is_incoming xor is_opposite_region) {
285 const BoundPlane& bound_plane = eta_partition->surface();
287 const auto& dest_state =
propagator->propagate(start_state, bound_plane);
288 if (!dest_state.isValid()) {
292 const GlobalPoint&& dest_global_pos = dest_state.globalPosition();
293 const LocalPoint&& local_point = eta_partition->toLocal(dest_global_pos);
294 const LocalPoint local_point_2d{local_point.
x(), local_point.
y(), 0.0f};
296 if (eta_partition->surface().bounds().inside(local_point_2d)) {
299 double xx = dest_state.curvilinearError().matrix()(3, 3);
300 double yy = dest_state.curvilinearError().matrix()(4, 4);
301 double xy = dest_state.curvilinearError().matrix()(4, 3);
306 const LocalPoint&& dest_local_pos = eta_partition->toLocal(dest_global_pos);
307 const LocalError&& dest_local_err = dest_state.localError().positionError();
310 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
311 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
315 propagated_muIdx.push_back(
nMuons - 1);
317 propagated_nME1hits.push_back(nME1_hits);
318 propagated_nME2hits.push_back(nME2_hits);
319 propagated_nME3hits.push_back(nME3_hits);
320 propagated_nME4hits.push_back(nME4_hits);
322 const auto& eta_partition_pos{eta_partition->position()};
323 const auto& eta_partition_surf{eta_partition->surface()};
324 propagated_EtaPartition_centerX.push_back(eta_partition_pos.x());
325 propagated_EtaPartition_centerY.push_back(eta_partition_pos.y());
326 propagated_EtaPartition_rMin.push_back(eta_partition_surf.rSpan().first);
327 propagated_EtaPartition_rMax.push_back(eta_partition_surf.rSpan().second);
328 propagated_EtaPartition_phiMin.push_back(eta_partition_surf.phiSpan().first);
329 propagated_EtaPartition_phiMax.push_back(eta_partition_surf.phiSpan().second);
331 propagatedGlb_x.push_back(dest_global_pos.
x());
332 propagatedGlb_y.push_back(dest_global_pos.
y());
333 propagatedGlb_z.push_back(dest_global_pos.
z());
334 propagatedGlb_r.push_back(dest_global_pos.
perp());
335 propagatedGlb_phi.push_back(dest_global_pos.
phi());
337 const auto dest_local_dir{dest_state.localDirection()};
338 propagatedLoc_x.push_back(dest_local_pos.
x());
339 propagatedLoc_y.push_back(dest_local_pos.
y());
340 propagatedLoc_z.push_back(dest_local_pos.
z());
341 propagatedLoc_r.push_back(dest_local_pos.
perp());
342 propagatedLoc_phi.push_back(dest_local_pos.
phi());
343 propagatedLoc_dirX.push_back(dest_local_dir.x());
344 propagatedLoc_dirY.push_back(dest_local_dir.y());
345 propagatedLoc_dirZ.push_back(dest_local_dir.z());
347 propagatedLoc_errX.push_back(dest_local_err.
xx());
348 propagatedLoc_errY.push_back(dest_local_err.
yy());
350 propagatedGlb_errX.push_back(dest_glob_error_x);
351 propagatedGlb_errY.push_back(dest_glob_error_y);
352 propagatedGlb_rerr.push_back(dest_global_r_err);
353 propagatedGlb_phierr.push_back(dest_global_phi_err);
355 propagated_region.push_back(gem_id.
region());
356 propagated_layer.push_back(gem_id.
layer());
357 propagated_chamber.push_back(gem_id.
chamber());
358 propagated_etaP.push_back(gem_id.
roll());
360 propagated_isinsideout.push_back(is_insideout);
361 propagated_isincoming.push_back(is_incoming);
374 isCSC.push_back(is_csc);
375 isME11.push_back(is_me11);
394 auto tabProp = std::make_unique<nanoaod::FlatTable>(nProp,
m_name +
"_propagated",
false,
false);
396 addColumn(tabProp,
"propagated_muIdx", propagated_muIdx,
"");
399 "propagated_nME1hits",
401 "number of hits in the CSC ME1 station" 402 "in the STA muon track extrapolated to GE11");
404 "propagated_nME2hits",
406 "number of hits in the CSC ME2 station" 407 "in the STA muon track extrapolated to GE11");
409 "propagated_nME3hits",
411 "number of hits in the CSC ME3 station" 412 "in the STA muon track extrapolated to GE11");
414 "propagated_nME4hits",
416 "number of hits in the CSC ME4 station" 417 "in the STA muon track extrapolated to GE11");
420 tabProp,
"propagated_isincoming", propagated_isincoming,
"bool, condition on the muon STA track direction");
422 tabProp,
"propagated_isinsideout", propagated_isinsideout,
"bool, condition on the muon STA track direction");
426 "GE11 region where the extrapolated muon track falls" 427 "<br />(int, positive endcap: +1, negative endcap: -1");
431 "GE11 layer where the extrapolated muon track falls" 432 "<br />(int, layer1: 1, layer2: 2");
434 "propagated_chamber",
436 "GE11 superchamber where the extrapolated muon track falls" 437 "<br />(int, chambers numbered from 0 to 35");
441 "GE11 eta partition where the extrapolated muon track falls" 442 "<br />(int, partitions numbered from 1 to 8");
447 "expected position of muon track extrapolated to GE11 surface" 448 "<br />(float, local layer x coordinates, cm)");
452 "expected position of muon track extrapolated to GE11 surface" 453 "<br />(float, local layer y coordinates, cm)");
457 "expected position of muon track extrapolated to GE11 surface" 458 "<br />(float, local layer z coordinates, cm)");
462 "expected position of muon track extrapolated to GE11 surface" 463 "<br />(float, local layer radial coordinate, cm)");
467 "expected position of muon track extrapolated to GE11 surface" 468 "<br />(float, local layer phi coordinates, rad)");
471 "propagatedLoc_dirX",
473 "direction cosine of angle between local x axis and GE11 plane" 474 "<br />(float, dir. cosine)");
476 "propagatedLoc_dirY",
478 "direction cosine of angle between local y axis and GE11 plane" 479 "<br />(float, dir. cosine)");
481 "propagatedLoc_dirZ",
483 "direction cosine of angle between local z axis and GE11 plane" 484 "<br />(float, dir. cosine)");
487 "propagatedLoc_errX",
489 "uncertainty on expected position of muon track extrapolated to GE11 surface" 490 "<br />(float, local layer x coordinates, cm)");
492 "propagatedLoc_errY",
494 "uncertainty on expected position of muon track extrapolated to GE11 surface" 495 "<br />(float, local layer y coordinates, cm)");
500 "expected position of muon track extrapolated to GE11 surface" 501 "<br />(float, global x coordinates, cm)");
505 "expected position of muon track extrapolated to GE11 surface" 506 "<br />(float, global y coordinates, cm)");
510 "expected position of muon track extrapolated to GE11 surface" 511 "<br />(float, global z coordinates, cm)");
515 "expected position of muon track extrapolated to GE11 surface" 516 "<br />(float, global radial (r) coordinates, cm)");
520 "expected position of muon track extrapolated to GE11 surface" 521 "<br />(float, global phi coordinates, rad)");
523 "propagatedGlb_errX",
525 "uncertainty on position of muon track extrapolated to GE11 surface" 526 "<br />(float, global x coordinates, cm)");
528 "propagatedGlb_errY",
530 "uncertainty on position of muon track extrapolated to GE11 surface" 531 "<br />(float, global y coordinates, cm)");
533 "propagatedGlb_rerr",
535 "uncertainty on position of muon track extrapolated to GE11 surface" 536 "<br />(float, global radial (r) coordinates, cm)");
538 "propagatedGlb_phierr",
539 propagatedGlb_phierr,
540 "uncertainty on position of muon track extrapolated to GE11 surface" 541 "<br />(float, global phi coordinates, rad)");
544 "propagated_EtaPartition_centerX",
545 propagated_EtaPartition_centerX,
546 "global X coordinate of the center of the etaPartition" 547 "<br />where the extrapolated muon track position falls" 548 "<br />(float, global x coordinates, cm)");
550 "propagated_EtaPartition_centerY",
551 propagated_EtaPartition_centerY,
552 "global Y coordinate of the center of the etaPartition" 553 "<br />where the extrapolated muon track position falls" 554 "<br />(float, global x coordinates, cm)");
556 "propagated_EtaPartition_phiMax",
557 propagated_EtaPartition_phiMax,
558 "upper edge in phi global coordinates of the etaPartition" 559 "<br />where the extrapolated muon track position falls" 560 "<br />(float, global phi coordinates, rad)");
562 "propagated_EtaPartition_phiMin",
563 propagated_EtaPartition_phiMin,
564 "lower edge in phi global coordinates of the etaPartition" 565 "<br />where the extrapolated muon track position falls" 566 "<br />(float, global phi coordinates, rad)");
568 "propagated_EtaPartition_rMax",
569 propagated_EtaPartition_rMax,
570 "upper edge in r global coordinates of the etaPartition" 571 "<br />where the extrapolated muon track position falls" 572 "<br />(float, global radial (r) coordinates, cm)");
574 "propagated_EtaPartition_rMin",
575 propagated_EtaPartition_rMin,
576 "lower edge in r global coordinates of the etaPartition" 577 "<br />where the extrapolated muon track position falls" 578 "<br />(float, global radial (r) coordinates, cm)");
std::unique_ptr< MuonServiceProxy > m_muonSP
Muon service proxy.
constexpr int region() const
Geom::Phi< T > phi() const
const HitPattern & hitPattern() const
auto conditionalGet(const edm::Event &ev) const
constexpr int layer() const
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
static constexpr double DEFAULT_DOUBLE_VAL
Definition of default values for float variables.
constexpr int chamber() const
void swap(Association< C > &lhs, Association< C > &rhs)
T phierr(const GlobalPoint &aPoint) const
reco::TransientTrack build(const reco::Track *p) const
void addColumn(std::unique_ptr< nanoaod::FlatTable > &table, const std::string name, const std::vector< T > &vec, const std::string descr)
nano_mu::ESTokenHandle< TransientTrackBuilder, TransientTrackRecord > m_transientTrackBuilder
Transient Track Builder.
bool m_fillPropagated
Fill matches table.
nano_mu::ESTokenHandle< GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun > m_gemGeometry
GEM Geometry.
bool isValid()
Check validity.
std::string m_name
The label name of the FlatTableProducer.
constexpr int roll() const
bool isCSC(GeomDetEnumerators::SubDetector m)
T rerr(const GlobalPoint &aPoint) const
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
nano_mu::EDTokenHandle< edm::View< reco::Muon > > m_token
The RECO mu token.
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.