31 pt_bins_ =
pset.getUntrackedParameter<std::vector<double> >(
"ptBins");
34 eta_up_ =
pset.getUntrackedParameter<
double>(
"etaUp");
56 desc.addUntracked<
bool>(
"isCosmics",
false);
57 desc.addUntracked<
bool>(
"useGlobalMuon",
true);
58 desc.add<
bool>(
"useSkipLayer",
true);
59 desc.add<
bool>(
"useOnlyME11",
false);
60 desc.add<
double>(
"residualRPhiCut", 2.0);
61 desc.add<
bool>(
"usePropRErrorCut",
false);
62 desc.add<
double>(
"propRErrorCut", 1.0);
63 desc.add<
bool>(
"usePropPhiErrorCut",
false);
64 desc.add<
double>(
"propPhiErrorCut", 0.01);
65 desc.addUntracked<std::vector<double> >(
"ptBins", {20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
66 desc.addUntracked<
int>(
"etaNbins", 9);
67 desc.addUntracked<
double>(
"etaLow", 1.4);
68 desc.addUntracked<
double>(
"etaUp", 2.3);
74 descriptions.
add(
"gemEfficiencyAnalyzerDefault",
desc);
84 desc.addUntracked<
bool>(
"isCosmics",
true);
85 desc.addUntracked<
bool>(
"useGlobalMuon",
false);
86 desc.add<
bool>(
"useSkipLayer",
true);
87 desc.add<
bool>(
"useOnlyME11",
true);
88 desc.add<
double>(
"residualRPhiCut", 5.0);
89 desc.add<
bool>(
"usePropRErrorCut",
true);
90 desc.add<
double>(
"propRErrorCut", 2.0);
91 desc.add<
bool>(
"usePropPhiErrorCut",
true);
92 desc.add<
double>(
"propPhiErrorCut", 0.01);
93 desc.addUntracked<std::vector<double> >(
"ptBins", {0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
94 desc.addUntracked<
int>(
"etaNbins", 9);
95 desc.addUntracked<
double>(
"etaLow", 1.4);
96 desc.addUntracked<
double>(
"etaUp", 2.3);
102 descriptions.
add(
"gemEfficiencyAnalyzerCosmicsDefault",
desc);
111 if (not
gem.isValid()) {
126 TH1F*
hist = dynamic_cast<TH1F*>(
me->getTH1F()->Clone(
name.c_str()));
132 TH2F*
hist = dynamic_cast<TH2F*>(
me->getTH2F()->Clone(
name.c_str()));
140 const TString pt_x_title =
"Muon p_{T} [GeV]";
141 const int pt_nbinsx =
pt_bins_.size() - 1;
147 const int region_id =
station->region();
148 const int station_id =
station->station();
154 const TString&&
title =
name_.c_str() + title_suffix;
156 TH1F* h_muon_pt =
new TH1F(
"muon_pt" + name_suffix,
title, pt_nbinsx, &
pt_bins_[0]);
157 h_muon_pt->SetXTitle(pt_x_title);
176 const int region_id =
station->region();
177 const int station_id =
station->station();
179 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
185 const int num_chambers = superchambers.size();
187 const int layer_id =
chamber->id().layer();
194 ibooker.
book1D(
"chamber" + name_suffix,
name_.c_str() + title_suffix, num_chambers, 0.5, num_chambers + 0.5);
197 for (
int binx = 1; binx <= num_chambers; binx++) {
212 const int region_id =
station->region();
213 const int station_id =
station->station();
215 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
222 const int layer_id =
chamber->id().layer();
223 const int num_ieta =
chamber->nEtaPartitions();
229 me_ieta_[
key] = ibooker.
book1D(
"ieta" + name_suffix,
name_.c_str() + title_suffix, num_ieta, 0.5, num_ieta + 0.5);
231 me_ieta_[
key]->getTH1F()->SetNdivisions(-num_ieta,
"Y");
232 for (
int binx = 1; binx <= num_ieta; binx++) {
233 me_ieta_[
key]->setBinLabel(binx, std::to_string(binx));
246 const int region_id =
station->region();
247 const int station_id =
station->station();
249 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
255 const int num_ch = superchambers.size();
258 const int layer_id =
chamber->id().layer();
259 const int num_ieta =
chamber->nEtaPartitions();
266 name_.c_str() + title_suffix,
283 const int region_id =
station->region();
284 const int station_id =
station->station();
286 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
292 const std::vector<const GEMChamber*>&
chambers = superchambers[0]->chambers();
299 const int ieta = eta_partition->id().roll();
303 const TString&& name_suffix = TString::Format(
"_GE%+.2d_R%d", region_id * (station_id * 10 + 1),
ieta);
304 const TString&&
title =
305 name_.c_str() + TString::Format(
" : GE%+.2d Roll %d", region_id * (station_id * 10 + 1),
ieta);
323 me_prop_r_err_ = ibooker.
book1D(
"prop_r_err",
";Propagation Global R Error [cm];Entries", 20, 0.0, 20.0);
328 const int region_id =
station->region();
329 const int station_id =
station->station();
331 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
337 const int num_ch = superchambers.size();
351 if (not rechit_collection.
isValid()) {
365 if (not
gem.isValid()) {
372 if (not global_tracking_geometry.
isValid()) {
379 if (not transient_track_builder.
isValid()) {
391 if (rechit_collection->size() < 1) {
396 if (muon_view->empty()) {
405 if (
track ==
nullptr) {
411 if (not transient_track.
isValid()) {
422 const auto&& [start_state, start_id] =
getStartingState(transient_track,
layer, global_tracking_geometry);
424 if (not start_state.isValid()) {
436 if (not dest_state.
isValid()) {
449 if (eta_partition ==
nullptr) {
460 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
461 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
463 const GEMDetId&& gem_id = eta_partition->
id();
468 const int chamber_id = gem_id.chamber();
469 const int ieta = gem_id.roll();
497 const auto&& [
hit, residual_rphi] =
findClosetHit(dest_global_pos, rechit_collection->get(gem_id), eta_partition);
499 if (
hit ==
nullptr) {
519 const LocalError&& hit_local_err =
hit->localPositionError();
521 const float residual_y = dest_local_pos.
y() - hit_local_pos.y();
522 const float pull_y = residual_y /
std::sqrt(dest_local_err.
yy() + hit_local_err.
yy());
533 std::vector<GEMLayerData> layer_vector;
536 const int region_id =
station->region();
537 const int station_id =
station->station();
538 const bool is_ge11 = station_id == 1;
541 std::map<std::pair<int, bool>, std::vector<const GEMChamber*> > chambers_per_layer;
545 const bool is_odd = is_ge11 ? super_chamber->id().chamber() % 2 == 1 :
false;
548 const int layer_id =
chamber->id().layer();
549 const std::pair<int, bool>
key{layer_id, is_odd};
551 if (chambers_per_layer.find(
key) == chambers_per_layer.end())
552 chambers_per_layer.insert({key, std::vector<const GEMChamber*>()});
554 chambers_per_layer.at(
key).push_back(
chamber);
558 for (
auto [
key, chamber_vector] : chambers_per_layer) {
559 const int layer_id =
key.first;
562 auto [rmin, rmax] = chamber_vector[0]->surface().rSpan();
563 auto [
zmin,
zmax] = chamber_vector[0]->surface().zSpan();
566 const float layer_z = chamber_vector[0]->position().z();
577 layer_vector.emplace_back(
layer, chamber_vector, region_id, station_id, layer_id);
588 if (
muon.outerTrack().isNonnull())
618 const DetId inner_id{(is_insideout ?
track.outerDetId() :
track.innerDetId())};
623 starting_id = inner_id;
631 return std::make_pair(starting_state, starting_id);
640 float min_distance = 1e12;
645 const DetId&& det_id = (*rechit)->geographicalId();
657 starting_point = global_position;
658 starting_id = det_id;
666 return std::make_pair(starting_state, starting_id);
673 return (csc_id.station() == 1) and ((csc_id.ring() == 1)
or (csc_id.ring() == 4));
677 const bool is_same_region =
track->eta() *
layer.region > 0;
681 float p2_in =
track->innerMomentum().mag2();
682 float p2_out =
track->outerMomentum().mag2();
685 const bool is_outgoing = p2_in > p2_out;
687 skip = (is_outgoing xor is_same_region);
691 skip = not is_same_region;
699 const LocalPoint local_point_2d(local_point.
x(), local_point.
y(), 0.0f);
704 const std::vector<const GEMChamber*>& chamber_vector) {
711 if (
checkBounds(global_point, eta_partition->surface())) {
712 bound = eta_partition;
726 const float dest_local_x = dest_local_pos.
x();
727 const float dest_local_y = dest_local_pos.
y();
730 float min_residual_rphi = 1e6;
734 const float hit_local_phi = topology.
stripAngle(eta_partition->
strip(hit_local_pos));
736 const float residual_x = dest_local_x - hit_local_pos.
x();
737 const float residual_y = dest_local_y - hit_local_pos.
y();
738 const float residual_rphi =
std::cos(hit_local_phi) * residual_x +
std::sin(hit_local_phi) * residual_y;
741 min_residual_rphi = residual_rphi;
742 closest_hit = &(*hit);
746 return std::make_pair(closest_hit, min_residual_rphi);