65 desc.
add<
bool>(
"useSkipLayer",
true);
66 desc.
add<
bool>(
"useOnlyME11",
false);
67 desc.
add<
double>(
"residualRPhiCut", 2.0);
68 desc.
add<
bool>(
"usePropRErrorCut",
false);
69 desc.
add<
double>(
"propRErrorCut", 1.0);
70 desc.
add<
bool>(
"usePropPhiErrorCut",
false);
71 desc.
add<
double>(
"propPhiErrorCut", 0.01);
72 desc.
addUntracked<std::vector<double> >(
"ptBins", {20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
84 descriptions.
add(
"gemEfficiencyAnalyzerDefault", desc);
96 desc.
add<
bool>(
"useSkipLayer",
true);
97 desc.
add<
bool>(
"useOnlyME11",
true);
98 desc.
add<
double>(
"residualRPhiCut", 5.0);
99 desc.
add<
bool>(
"usePropRErrorCut",
true);
100 desc.
add<
double>(
"propRErrorCut", 1.0);
101 desc.
add<
bool>(
"usePropPhiErrorCut",
true);
102 desc.
add<
double>(
"propPhiErrorCut", 0.001);
103 desc.
addUntracked<std::vector<double> >(
"ptBins", {0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 120.});
115 descriptions.
add(
"gemEfficiencyAnalyzerCosmicsDefault", desc);
140 TH1F*
hist =
dynamic_cast<TH1F*
>(me->
getTH1F()->Clone(name.c_str()));
141 return ibooker.
book1D(name, hist);
146 TH2F*
hist =
dynamic_cast<TH2F*
>(me->
getTH2F()->Clone(name.c_str()));
147 return ibooker.
book2D(name, hist);
154 const TString pt_x_title =
"Muon p_{T} [GeV]";
155 const int pt_nbinsx =
pt_bins_.size() - 1;
161 const int region_id =
station->region();
162 const int station_id =
station->station();
172 const TString&&
title =
name_.c_str() + title_suffix;
174 TH1F* h_muon_pt =
new TH1F(
"muon_pt" + name_suffix, title, pt_nbinsx, &
pt_bins_[0]);
175 h_muon_pt->SetXTitle(pt_x_title);
194 const int region_id =
station->region();
195 const int station_id =
station->station();
201 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
207 const int num_chambers = superchambers.size();
209 const int layer_id = chamber->id().layer();
216 ibooker.
book1D(
"chamber" + name_suffix,
name_.c_str() + title_suffix, num_chambers, 0.5, num_chambers + 0.5);
218 me_chamber_[
key]->getTH1F()->SetNdivisions(-num_chambers,
"Y");
219 for (
int binx = 1; binx <= num_chambers; binx++) {
220 me_chamber_[
key]->setBinLabel(binx, std::to_string(binx));
234 const int region_id =
station->region();
235 const int station_id =
station->station();
241 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
248 const int layer_id = chamber->id().layer();
249 const int num_ieta = chamber->nEtaPartitions();
255 me_ieta_[
key] = ibooker.
book1D(
"ieta" + name_suffix,
name_.c_str() + title_suffix, num_ieta, 0.5, num_ieta + 0.5);
257 me_ieta_[
key]->getTH1F()->SetNdivisions(-num_ieta,
"Y");
258 for (
int binx = 1; binx <= num_ieta; binx++) {
259 me_ieta_[
key]->setBinLabel(binx, std::to_string(binx));
272 const int region_id =
station->region();
273 const int station_id =
station->station();
279 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
285 const int num_ch = superchambers.size();
288 const int layer_id = chamber->id().layer();
289 const int num_ieta = chamber->nEtaPartitions();
296 name_.c_str() + title_suffix,
313 const int region_id =
station->region();
314 const int station_id =
station->station();
320 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
326 const std::vector<const GEMChamber*>&
chambers = superchambers[0]->chambers();
332 for (
const GEMEtaPartition* eta_partition : chambers[0]->etaPartitions()) {
333 const int ieta = eta_partition->id().roll();
337 const TString&& name_suffix = TString::Format(
"_GE%+.2d_R%d", region_id * (station_id * 10 + 1), ieta);
338 const TString&&
title =
339 name_.c_str() + TString::Format(
" : GE%+.2d Roll %d", region_id * (station_id * 10 + 1), ieta);
357 me_prop_r_err_ = ibooker.
book1D(
"prop_r_err",
";Propagation Global R Error [cm];Entries", 20, 0.0, 20.0);
362 const int region_id =
station->region();
363 const int station_id =
station->station();
369 const std::vector<const GEMSuperChamber*>&& superchambers =
station->superChambers();
375 const int num_ch = superchambers.size();
389 if (not rechit_collection.
isValid()) {
413 if (not global_tracking_geometry.
isValid()) {
421 if (not transient_track_builder.
isValid()) {
428 if (not propagator.
isValid()) {
433 if (muon_view->empty()) {
438 const std::vector<GEMLayerData>&& layer_vector =
buildGEMLayers(gem);
442 if (track ==
nullptr) {
448 if (not transient_track.
isValid()) {
459 const auto&& [start_state, start_id] =
getStartingState(transient_track,
layer, global_tracking_geometry);
461 if (not start_state.isValid()) {
473 if (not dest_state.
isValid()) {
486 if (eta_partition ==
nullptr) {
497 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
498 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
500 const GEMDetId&& gem_id = eta_partition->
id();
505 const int chamber_id = gem_id.chamber();
506 const int ieta = gem_id.ieta();
534 const auto&& [
hit, residual_rphi] =
findClosetHit(dest_global_pos, rechit_collection->get(gem_id), eta_partition);
536 if (
hit ==
nullptr) {
556 const LocalError&& hit_local_err =
hit->localPositionError();
558 const float residual_y = dest_local_pos.
y() - hit_local_pos.y();
559 const float pull_y = residual_y /
std::sqrt(dest_local_err.
yy() + hit_local_err.
yy());
577 }
else if (station == 2) {
583 }
else if (station == 0) {
599 std::vector<GEMLayerData> layer_vector;
602 const int region_id =
station->region();
603 const int station_id =
station->station();
604 const bool is_ge11 = station_id == 1;
611 std::map<std::pair<int, bool>, std::vector<const GEMChamber*> > chambers_per_layer;
615 const bool is_odd = is_ge11 ? super_chamber->id().chamber() % 2 == 1 :
false;
617 for (
const GEMChamber* chamber : super_chamber->chambers()) {
618 const int layer_id = chamber->id().layer();
619 const std::pair<int, bool>
key{layer_id, is_odd};
621 if (chambers_per_layer.find(
key) == chambers_per_layer.end())
622 chambers_per_layer.insert({
key, std::vector<const GEMChamber*>()});
624 chambers_per_layer.at(
key).push_back(chamber);
628 for (
auto [
key, chamber_vector] : chambers_per_layer) {
629 const int layer_id =
key.first;
632 auto [rmin, rmax] = chamber_vector[0]->surface().rSpan();
633 auto [zmin, zmax] = chamber_vector[0]->surface().zSpan();
636 const float layer_z = chamber_vector[0]->position().z();
647 layer_vector.emplace_back(layer, chamber_vector, region_id, station_id, layer_id);
681 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
690 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
693 starting_id = inner_id;
701 return std::make_pair(starting_state, starting_id);
710 float min_distance = 1e12;
715 const DetId&& det_id = (*rechit)->geographicalId();
721 const GeomDet* det = geometry->idToDet(det_id);
724 if (distance < min_distance) {
727 starting_point = global_position;
728 starting_id = det_id;
736 return std::make_pair(starting_state, starting_id);
743 return (csc_id.station() == 1)
or ((csc_id.ring() == 1)
or (csc_id.ring() == 4));
747 const bool is_same_region = track->
eta() * layer.
region > 0;
755 const bool is_outgoing = p2_in > p2_out;
757 skip = (is_outgoing xor is_same_region);
761 skip = not is_same_region;
769 const LocalPoint local_point_2d(local_point.
x(), local_point.
y(), 0.0f);
774 const std::vector<const GEMChamber*>& chamber_vector) {
776 for (
const GEMChamber* chamber : chamber_vector) {
777 if (not
checkBounds(global_point, chamber->surface()))
780 for (
const GEMEtaPartition* eta_partition : chamber->etaPartitions()) {
781 if (
checkBounds(global_point, eta_partition->surface())) {
782 bound = eta_partition;
796 const float dest_local_x = dest_local_pos.
x();
797 const float dest_local_y = dest_local_pos.
y();
800 float min_residual_rphi = 1e6;
802 for (
auto hit = range.first;
hit != range.second; ++
hit) {
804 const float hit_local_phi = topology.
stripAngle(eta_partition->
strip(hit_local_pos));
806 const float residual_x = dest_local_x - hit_local_pos.
x();
807 const float residual_y = dest_local_y - hit_local_pos.
y();
808 const float residual_rphi =
std::cos(hit_local_phi) * residual_x +
std::sin(hit_local_phi) * residual_y;
811 min_residual_rphi = residual_rphi;
812 closest_hit = &(*hit);
816 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)
bool skipGEMStation(const int)
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)