31 pt_bins_ =
pset.getUntrackedParameter<std::vector<double> >(
"ptBins");
34 eta_up_ =
pset.getUntrackedParameter<
double>(
"etaUp");
54 desc.addUntracked<
bool>(
"isCosmics",
false);
55 desc.addUntracked<
bool>(
"useGlobalMuon",
true);
56 desc.add<
bool>(
"useSkipLayer",
false);
57 desc.add<
bool>(
"useOnlyME11",
false);
58 desc.add<
double>(
"residualRPhiCut", 2.0);
59 desc.add<
bool>(
"usePropRErrorCut",
false);
60 desc.add<
double>(
"propRErrorCut", 1.0);
61 desc.add<
bool>(
"usePropPhiErrorCut",
false);
62 desc.add<
double>(
"propPhiErrorCut", 0.01);
63 desc.addUntracked<std::vector<double> >(
"ptBins", {20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
64 desc.addUntracked<
int>(
"etaNbins", 9);
65 desc.addUntracked<
double>(
"etaLow", 1.4);
66 desc.addUntracked<
double>(
"etaUp", 2.3);
72 descriptions.
add(
"gemEfficiencyAnalyzerDefault",
desc);
82 desc.addUntracked<
bool>(
"isCosmics",
true);
83 desc.addUntracked<
bool>(
"useGlobalMuon",
false);
84 desc.add<
bool>(
"useSkipLayer",
false);
85 desc.add<
bool>(
"useOnlyME11",
true);
86 desc.add<
double>(
"residualRPhiCut", 5.0);
87 desc.add<
bool>(
"usePropRErrorCut",
true);
88 desc.add<
double>(
"propRErrorCut", 1.0);
89 desc.add<
bool>(
"usePropPhiErrorCut",
true);
90 desc.add<
double>(
"propPhiErrorCut", 0.001);
91 desc.addUntracked<std::vector<double> >(
92 "ptBins", {0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 220.});
93 desc.addUntracked<
int>(
"etaNbins", 9);
94 desc.addUntracked<
double>(
"etaLow", 1.4);
95 desc.addUntracked<
double>(
"etaUp", 2.3);
101 descriptions.
add(
"gemEfficiencyAnalyzerCosmicsDefault",
desc);
110 if (not
gem.isValid()) {
124 TH1F*
hist = dynamic_cast<TH1F*>(
me->getTH1F()->Clone(
name.c_str()));
130 TH2F*
hist = dynamic_cast<TH2F*>(
me->getTH2F()->Clone(
name.c_str()));
138 const TString pt_x_title =
"Muon p_{T} [GeV]";
139 const int pt_nbinsx =
pt_bins_.size() - 1;
145 const int region_id =
station->region();
146 const int station_id =
station->station();
149 const TString&& name_suffix =
getSuffixName(region_id, station_id);
150 const TString&& title_suffix =
getSuffixTitle(region_id, station_id);
152 const TString&&
title =
name_.c_str() + title_suffix;
154 TH1F* h_muon_pt =
new TH1F(
"muon_pt" + name_suffix,
title, pt_nbinsx, &
pt_bins_[0]);
155 h_muon_pt->SetXTitle(pt_x_title);
174 const int region_id =
station->region();
175 const int station_id =
station->station();
177 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
183 const int num_chambers = superchambers.size();
185 const int layer_id =
chamber->id().layer();
187 const TString&& name_suffix =
getSuffixName(region_id, station_id, layer_id);
188 const TString&& title_suffix =
getSuffixTitle(region_id, station_id, layer_id);
192 ibooker.
book1D(
"chamber" + name_suffix,
name_.c_str() + title_suffix, num_chambers, 0.5, num_chambers + 0.5);
195 for (
int binx = 1; binx <= num_chambers; binx++) {
210 const int region_id =
station->region();
211 const int station_id =
station->station();
214 const TString&& name_suffix =
getSuffixName(region_id, station_id);
215 const TString&& title_suffix =
getSuffixTitle(region_id, station_id);
217 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
223 const int num_ch = superchambers.size() * superchambers.front()->nChambers();
227 name_.c_str() + title_suffix,
242 const int region_id =
station->region();
243 const int station_id =
station->station();
245 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
251 const std::vector<const GEMChamber*>&
chambers = superchambers[0]->chambers();
258 const int ieta = eta_partition->id().roll();
262 const TString&& name_suffix = TString::Format(
"_GE%+.2d_R%d", region_id * (station_id * 10 + 1),
ieta);
263 const TString&&
title =
264 name_.c_str() + TString::Format(
" : GE%+.2d Roll %d", region_id * (station_id * 10 + 1),
ieta);
281 me_prop_r_err_ = ibooker.
book1D(
"prop_r_err",
";Propagation Global R Error [cm];Entries", 20, 0.0, 20.0);
286 const int region_id =
station->region();
287 const int station_id =
station->station();
289 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
295 const int num_ch = superchambers.size();
298 const TString&& name_suffix =
getSuffixName(region_id, station_id);
299 const TString&& title_suffix =
getSuffixTitle(region_id, station_id);
309 if (not rechit_collection.
isValid()) {
323 if (not
gem.isValid()) {
330 if (not global_tracking_geometry.
isValid()) {
337 if (not transient_track_builder.
isValid()) {
349 if (rechit_collection->size() < 1) {
354 if (muon_view->empty()) {
363 if (
track ==
nullptr) {
369 if (not transient_track.
isValid()) {
380 const auto&& [start_state, start_id] =
getStartingState(transient_track, layer, global_tracking_geometry);
382 if (not start_state.isValid()) {
394 if (not dest_state.
isValid()) {
401 if (not
checkBounds(dest_global_pos, (*layer.surface))) {
407 if (eta_partition ==
nullptr) {
418 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
419 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
421 const GEMDetId&& gem_id = eta_partition->
id();
427 const int ieta = gem_id.roll();
453 const auto&& [
hit, residual_rphi] =
findClosetHit(dest_global_pos, rechit_collection->get(gem_id), eta_partition);
455 if (
hit ==
nullptr) {
474 const LocalError&& hit_local_err =
hit->localPositionError();
476 const float residual_y = dest_local_pos.
y() - hit_local_pos.y();
477 const float pull_y = residual_y /
std::sqrt(dest_local_err.
yy() + hit_local_err.
yy());
488 std::vector<GEMLayerData> layer_vector;
491 const int region_id =
station->region();
492 const int station_id =
station->station();
495 std::map<int, std::vector<const GEMChamber*> > chambers_per_layer;
498 const int layer_id =
chamber->id().layer();
500 if (chambers_per_layer.find(layer_id) == chambers_per_layer.end())
501 chambers_per_layer.insert({layer_id, std::vector<const GEMChamber*>()});
503 chambers_per_layer[layer_id].push_back(
chamber);
507 for (
auto [layer_id, chamber_vector] : chambers_per_layer) {
508 auto [rmin, rmax] = chamber_vector[0]->surface().rSpan();
509 auto [
zmin,
zmax] = chamber_vector[0]->surface().zSpan();
512 const auto [chamber_rmin, chamber_rmax] =
chamber->surface().rSpan();
513 const auto [chamber_zmin, chamber_zmax] =
chamber->surface().zSpan();
515 rmin =
std::min(rmin, chamber_rmin);
516 rmax =
std::max(rmax, chamber_rmax);
523 const float layer_z = chamber_vector[0]->position().z();
534 layer_vector.emplace_back(layer, chamber_vector, region_id, station_id, layer_id);
546 if (
muon.outerTrack().isNonnull())
576 const DetId inner_id{(is_insideout ?
track.outerDetId() :
track.innerDetId())};
581 starting_id = inner_id;
589 return std::make_pair(starting_state, starting_id);
598 float min_distance = 1e12;
603 const DetId&& det_id = (*rechit)->geographicalId();
615 starting_point = global_position;
616 starting_id = det_id;
624 return std::make_pair(starting_state, starting_id);
631 return (csc_id.station() == 1)
or ((csc_id.ring() == 1)
or (csc_id.ring() == 4));
635 const bool is_same_region =
track->eta() * layer.
region > 0;
639 float p2_in =
track->innerMomentum().mag2();
640 float p2_out =
track->outerMomentum().mag2();
643 const bool is_outgoing = p2_in > p2_out;
645 skip = (is_outgoing xor is_same_region);
649 skip = not is_same_region;
657 const LocalPoint local_point_2d(local_point.
x(), local_point.
y(), 0.0f);
662 const std::vector<const GEMChamber*>& chamber_vector) {
669 if (
checkBounds(global_point, eta_partition->surface())) {
670 bound = eta_partition;
684 const float dest_local_x = dest_local_pos.
x();
685 const float dest_local_y = dest_local_pos.
y();
688 float min_residual_rphi = 1e6;
692 const float hit_local_phi =
topology.stripAngle(eta_partition->
strip(hit_local_pos));
694 const float residual_x = dest_local_x - hit_local_pos.
x();
695 const float residual_y = dest_local_y - hit_local_pos.
y();
696 const float residual_rphi =
std::cos(hit_local_phi) * residual_x +
std::sin(hit_local_phi) * residual_y;
699 min_residual_rphi = residual_rphi;
700 closest_hit = &(*hit);
704 return std::make_pair(closest_hit, min_residual_rphi);