35 pt_bins_ =
pset.getUntrackedParameter<std::vector<double> >(
"ptBins");
38 eta_up_ =
pset.getUntrackedParameter<
double>(
"etaUp");
60 desc.addUntracked<
bool>(
"isCosmics",
false);
61 desc.addUntracked<
bool>(
"useGlobalMuon",
true);
62 desc.add<
bool>(
"useSkipLayer",
true);
63 desc.add<
bool>(
"useOnlyME11",
false);
64 desc.add<
double>(
"residualRPhiCut", 2.0);
65 desc.add<
bool>(
"usePropRErrorCut",
false);
66 desc.add<
double>(
"propRErrorCut", 1.0);
67 desc.add<
bool>(
"usePropPhiErrorCut",
false);
68 desc.add<
double>(
"propPhiErrorCut", 0.01);
69 desc.addUntracked<std::vector<double> >(
"ptBins", {20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
70 desc.addUntracked<
int>(
"etaNbins", 9);
71 desc.addUntracked<
double>(
"etaLow", 1.4);
72 desc.addUntracked<
double>(
"etaUp", 2.3);
78 descriptions.
add(
"gemEfficiencyAnalyzerDefault",
desc);
88 desc.addUntracked<
bool>(
"isCosmics",
true);
89 desc.addUntracked<
bool>(
"useGlobalMuon",
false);
90 desc.add<
bool>(
"useSkipLayer",
true);
91 desc.add<
bool>(
"useOnlyME11",
true);
92 desc.add<
double>(
"residualRPhiCut", 5.0);
93 desc.add<
bool>(
"usePropRErrorCut",
true);
94 desc.add<
double>(
"propRErrorCut", 1.0);
95 desc.add<
bool>(
"usePropPhiErrorCut",
true);
96 desc.add<
double>(
"propPhiErrorCut", 0.001);
97 desc.addUntracked<std::vector<double> >(
"ptBins", {0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
98 desc.addUntracked<
int>(
"etaNbins", 9);
99 desc.addUntracked<
double>(
"etaLow", 1.4);
100 desc.addUntracked<
double>(
"etaUp", 2.3);
106 descriptions.
add(
"gemEfficiencyAnalyzerCosmicsDefault",
desc);
116 if (not
gem.isValid()) {
131 TH1F*
hist = dynamic_cast<TH1F*>(
me->getTH1F()->Clone(
name.c_str()));
137 TH2F*
hist = dynamic_cast<TH2F*>(
me->getTH2F()->Clone(
name.c_str()));
145 const TString pt_x_title =
"Muon p_{T} [GeV]";
146 const int pt_nbinsx =
pt_bins_.size() - 1;
152 const int region_id =
station->region();
153 const int station_id =
station->station();
159 const TString&&
title =
name_.c_str() + title_suffix;
161 TH1F* h_muon_pt =
new TH1F(
"muon_pt" + name_suffix,
title, pt_nbinsx, &
pt_bins_[0]);
162 h_muon_pt->SetXTitle(pt_x_title);
181 const int region_id =
station->region();
182 const int station_id =
station->station();
184 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
190 const int num_chambers = superchambers.size();
192 const int layer_id =
chamber->id().layer();
199 ibooker.
book1D(
"chamber" + name_suffix,
name_.c_str() + title_suffix, num_chambers, 0.5, num_chambers + 0.5);
202 for (
int binx = 1; binx <= num_chambers; binx++) {
217 const int region_id =
station->region();
218 const int station_id =
station->station();
220 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
227 const int layer_id =
chamber->id().layer();
228 const int num_ieta =
chamber->nEtaPartitions();
234 me_ieta_[
key] = ibooker.
book1D(
"ieta" + name_suffix,
name_.c_str() + title_suffix, num_ieta, 0.5, num_ieta + 0.5);
236 me_ieta_[
key]->getTH1F()->SetNdivisions(-num_ieta,
"Y");
237 for (
int binx = 1; binx <= num_ieta; binx++) {
238 me_ieta_[
key]->setBinLabel(binx, std::to_string(binx));
251 const int region_id =
station->region();
252 const int station_id =
station->station();
254 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
260 const int num_ch = superchambers.size();
263 const int layer_id =
chamber->id().layer();
264 const int num_ieta =
chamber->nEtaPartitions();
271 name_.c_str() + title_suffix,
288 const int region_id =
station->region();
289 const int station_id =
station->station();
291 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
297 const std::vector<const GEMChamber*>&
chambers = superchambers[0]->chambers();
304 const int ieta = eta_partition->id().roll();
308 const TString&& name_suffix = TString::Format(
"_GE%+.2d_R%d", region_id * (station_id * 10 + 1),
ieta);
309 const TString&&
title =
310 name_.c_str() + TString::Format(
" : GE%+.2d Roll %d", region_id * (station_id * 10 + 1),
ieta);
328 me_prop_r_err_ = ibooker.
book1D(
"prop_r_err",
";Propagation Global R Error [cm];Entries", 20, 0.0, 20.0);
333 const int region_id =
station->region();
334 const int station_id =
station->station();
336 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
342 const int num_ch = superchambers.size();
356 if (not rechit_collection.
isValid()) {
371 if (not
gem.isValid()) {
380 if (not global_tracking_geometry.
isValid()) {
388 if (not transient_track_builder.
isValid()) {
400 if (rechit_collection->size() < 1) {
405 if (muon_view->empty()) {
414 if (
track ==
nullptr) {
420 if (not transient_track.
isValid()) {
431 const auto&& [start_state, start_id] =
getStartingState(transient_track,
layer, global_tracking_geometry);
433 if (not start_state.isValid()) {
445 if (not dest_state.
isValid()) {
458 if (eta_partition ==
nullptr) {
469 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
470 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
472 const GEMDetId&& gem_id = eta_partition->
id();
477 const int chamber_id = gem_id.chamber();
478 const int ieta = gem_id.ieta();
506 const auto&& [
hit, residual_rphi] =
findClosetHit(dest_global_pos, rechit_collection->get(gem_id), eta_partition);
508 if (
hit ==
nullptr) {
528 const LocalError&& hit_local_err =
hit->localPositionError();
530 const float residual_y = dest_local_pos.
y() - hit_local_pos.y();
531 const float pull_y = residual_y /
std::sqrt(dest_local_err.
yy() + hit_local_err.
yy());
542 std::vector<GEMLayerData> layer_vector;
545 const int region_id =
station->region();
546 const int station_id =
station->station();
547 const bool is_ge11 = station_id == 1;
550 std::map<std::pair<int, bool>, std::vector<const GEMChamber*> > chambers_per_layer;
554 const bool is_odd = is_ge11 ? super_chamber->id().chamber() % 2 == 1 :
false;
557 const int layer_id =
chamber->id().layer();
558 const std::pair<int, bool>
key{layer_id, is_odd};
560 if (chambers_per_layer.find(
key) == chambers_per_layer.end())
561 chambers_per_layer.insert({key, std::vector<const GEMChamber*>()});
563 chambers_per_layer.at(
key).push_back(
chamber);
567 for (
auto [
key, chamber_vector] : chambers_per_layer) {
568 const int layer_id =
key.first;
571 auto [rmin, rmax] = chamber_vector[0]->surface().rSpan();
572 auto [
zmin,
zmax] = chamber_vector[0]->surface().zSpan();
575 const float layer_z = chamber_vector[0]->position().z();
586 layer_vector.emplace_back(
layer, chamber_vector, region_id, station_id, layer_id);
597 if (
muon.outerTrack().isNonnull())
627 const DetId inner_id{(is_insideout ?
track.outerDetId() :
track.innerDetId())};
632 starting_id = inner_id;
640 return std::make_pair(starting_state, starting_id);
649 float min_distance = 1e12;
654 const DetId&& det_id = (*rechit)->geographicalId();
666 starting_point = global_position;
667 starting_id = det_id;
675 return std::make_pair(starting_state, starting_id);
682 return (csc_id.station() == 1)
or ((csc_id.ring() == 1)
or (csc_id.ring() == 4));
686 const bool is_same_region =
track->eta() *
layer.region > 0;
690 float p2_in =
track->innerMomentum().mag2();
691 float p2_out =
track->outerMomentum().mag2();
694 const bool is_outgoing = p2_in > p2_out;
696 skip = (is_outgoing xor is_same_region);
700 skip = not is_same_region;
708 const LocalPoint local_point_2d(local_point.
x(), local_point.
y(), 0.0f);
713 const std::vector<const GEMChamber*>& chamber_vector) {
720 if (
checkBounds(global_point, eta_partition->surface())) {
721 bound = eta_partition;
735 const float dest_local_x = dest_local_pos.
x();
736 const float dest_local_y = dest_local_pos.
y();
739 float min_residual_rphi = 1e6;
743 const float hit_local_phi = topology.
stripAngle(eta_partition->
strip(hit_local_pos));
745 const float residual_x = dest_local_x - hit_local_pos.
x();
746 const float residual_y = dest_local_y - hit_local_pos.
y();
747 const float residual_rphi =
std::cos(hit_local_phi) * residual_x +
std::sin(hit_local_phi) * residual_y;
750 min_residual_rphi = residual_rphi;
751 closest_hit = &(*hit);
755 return std::make_pair(closest_hit, min_residual_rphi);