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.});
78 descriptions.
add(
"gemEfficiencyAnalyzerDefault", desc);
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.});
106 descriptions.
add(
"gemEfficiencyAnalyzerCosmicsDefault", desc);
131 TH1F*
hist =
dynamic_cast<TH1F*
>(me->
getTH1F()->Clone(name.c_str()));
132 return ibooker.
book1D(name, hist);
137 TH2F*
hist =
dynamic_cast<TH2F*
>(me->
getTH2F()->Clone(name.c_str()));
138 return ibooker.
book2D(name, hist);
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);
201 me_chamber_[
key]->getTH1F()->SetNdivisions(-num_chambers,
"Y");
202 for (
int binx = 1; binx <= num_chambers; binx++) {
203 me_chamber_[
key]->setBinLabel(binx, std::to_string(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();
303 for (
const GEMEtaPartition* eta_partition : chambers[0]->etaPartitions()) {
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()) {
380 if (not global_tracking_geometry.
isValid()) {
388 if (not transient_track_builder.
isValid()) {
395 if (not propagator.
isValid()) {
400 if (rechit_collection->size() < 1) {
405 if (muon_view->empty()) {
410 const std::vector<GEMLayerData>&& layer_vector =
buildGEMLayers(gem);
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;
556 for (
const GEMChamber* chamber : super_chamber->chambers()) {
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);
620 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
629 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
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();
660 const GeomDet* det = geometry->idToDet(det_id);
663 if (distance < min_distance) {
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;
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) {
715 for (
const GEMChamber* chamber : chamber_vector) {
716 if (not
checkBounds(global_point, chamber->surface()))
719 for (
const GEMEtaPartition* eta_partition : chamber->etaPartitions()) {
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;
741 for (
auto hit = range.first;
hit != range.second; ++
hit) {
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);
T getUntrackedParameter(std::string const &, T const &) const
bool isInsideOut(const reco::Track &)
std::pair< const_iterator, const_iterator > range
iterator range
bool isNonnull() const
Checks for non-null.
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > trasientTrackToken_
GEMDetId getReStLaKey(const GEMDetId &)
static bool isCSC(unsigned int detId)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool skipLayer(const reco::Track *, const GEMLayerData &)
TString getSuffixName(Int_t region_id)
virtual float stripAngle(float strip) const =0
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
virtual void setCurrentFolder(std::string const &fullpath)
double prop_phi_error_cut_
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
bool isValid() const
Make the ReferenceCountingProxy method to check validity public.
void setAllowAnything()
allow any parameter label/value pairs
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Sin< T >::type sin(const T &t)
constexpr uint32_t rawId() const
get the raw id
GlobalPoint globalPosition() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
const std::string & getName() const
get name of ME
const Bounds & bounds() const
std::vector< GEMLayerData > buildGEMLayers(const edm::ESHandle< GEMGeometry > &)
Log< level::Error, false > LogError
TString getSuffixTitle(Int_t region_id)
MEMap me_muon_eta_matched_
const std::string kLogCategory_
void bookEfficiencyChamber(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
const Plane & surface() const
The nominal surface of the GeomDet.
void setDetLabelsEta(MonitorElement *, const GEMStation *)
MEMap me_muon_pt_matched_
LocalError positionError() const
void bookEfficiencyDetector(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
constexpr int ieta() const
TrajectoryStateOnSurface innermostMeasurementState() const
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globalGeomToken_
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
T phierr(const GlobalPoint &aPoint) const
void bookResolution(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
MEMap me_chamber_matched_
bool checkBounds(const GlobalPoint &, const Plane &)
bool checkRefs(const std::vector< T * > &)
double eta() const
pseudorapidity of momentum vector
static DiskPointer build(Args &&...args)
MonitorElement * me_prop_r_err_
std::pair< TrajectoryStateOnSurface, DetId > getStartingState(const reco::TransientTrack &, const GEMLayerData &, const edm::ESHandle< GlobalTrackingGeometry > &)
MEMap me_detector_matched_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
LocalPoint toLocal(const GlobalPoint &gp) const
void bookEfficiencyEtaPartition(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
Cos< T >::type cos(const T &t)
MonitorElement * me_all_abs_residual_rphi_
std::pair< const GEMRecHit *, float > findClosetHit(const GlobalPoint &, const GEMRecHitCollection::range &, const GEMEtaPartition *)
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
tuple key
prepare the HTCondor submission files and eventually submit them
Abs< T >::type abs(const T &t)
bool use_prop_r_error_cut_
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
T const * get() const
Returns C++ pointer to the item.
std::pair< TrajectoryStateOnSurface, DetId > findStartingState(const reco::TransientTrack &, const GEMLayerData &, const edm::ESHandle< GlobalTrackingGeometry > &)
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface outermostMeasurementState() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GEMEfficiencyAnalyzer(const edm::ParameterSet &)
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
GEMDetId getReStEtKey(const GEMDetId &)
void fillME(MEMap &me_map, const GEMDetId &key, const float x)
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken1_
Log< level::Info, false > LogInfo
const GEMEtaPartition * findEtaPartition(const GlobalPoint &, const std::vector< const GEMChamber * > &)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
const Track & track() const
static void fillDescriptions(edm::ConfigurationDescriptions &)
void bookEfficiencyMomentum(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
MEMap me_muon_phi_matched_
void bookMisc(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
constexpr int chamber() const
T rerr(const GlobalPoint &aPoint) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< GEMRecHitCollection > rechit_token_
static bool isGEM(unsigned int detId)
bool use_prop_phi_error_cut_
edm::EDGetTokenT< edm::View< reco::Muon > > muon_token_
bool isME11(const DetId &)
MonitorElement * me_prop_phi_err_
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
static int position[264][3]
GEMDetId getReStKey(const int, const int)
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken2_
MonitorElement * bookNumerator2D(DQMStore::IBooker &, MonitorElement *)
~GEMEfficiencyAnalyzer() override
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
const reco::Track * getTrack(const reco::Muon &)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
MonitorElement * bookNumerator1D(DQMStore::IBooker &, MonitorElement *)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static char chambers[264][20]
std::vector< double > pt_bins_
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
MuonServiceProxy * muon_service_
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)