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);
109 TH1F*
hist =
dynamic_cast<TH1F*
>(me->
getTH1F()->Clone(name.c_str()));
110 return ibooker.
book1D(name, hist);
115 TH2F*
hist =
dynamic_cast<TH2F*
>(me->
getTH2F()->Clone(name.c_str()));
116 return ibooker.
book2D(name, hist);
123 const TString pt_x_title =
"Muon p_{T} [GeV]";
124 const int pt_nbinsx =
pt_bins_.size() - 1;
130 const int region_id =
station->region();
131 const int station_id =
station->station();
141 const TString
title =
name_.c_str() + title_suffix;
143 TH1F* h_muon_pt =
new TH1F(
"muon_pt" + name_suffix, title, pt_nbinsx, &
pt_bins_[0]);
144 h_muon_pt->SetXTitle(pt_x_title);
163 const int region_id =
station->region();
164 const int station_id =
station->station();
170 const std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
176 const int num_chambers = superchambers.size();
178 const int layer_id = chamber->id().layer();
185 ibooker.
book1D(
"chamber" + name_suffix,
name_.c_str() + title_suffix, num_chambers, 0.5, num_chambers + 0.5);
187 me_chamber_[
key]->getTH1F()->SetNdivisions(-num_chambers,
"Y");
188 for (
int binx = 1; binx <= num_chambers; binx++) {
203 const int region_id =
station->region();
204 const int station_id =
station->station();
210 const std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
217 const int layer_id = chamber->id().layer();
218 const int num_ieta = chamber->nEtaPartitions();
224 me_ieta_[
key] = ibooker.
book1D(
"ieta" + name_suffix,
name_.c_str() + title_suffix, num_ieta, 0.5, num_ieta + 0.5);
226 me_ieta_[
key]->getTH1F()->SetNdivisions(-num_ieta,
"Y");
227 for (
int binx = 1; binx <= num_ieta; binx++) {
241 const int region_id =
station->region();
242 const int station_id =
station->station();
248 const std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
254 const int num_ch = superchambers.size();
257 const int layer_id = chamber->id().layer();
258 const int num_ieta = chamber->nEtaPartitions();
265 name_.c_str() + title_suffix,
282 const int region_id =
station->region();
283 const int station_id =
station->station();
289 const std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
295 const std::vector<const GEMChamber*>
chambers = superchambers[0]->chambers();
301 for (
const GEMEtaPartition* eta_partition : chambers[0]->etaPartitions()) {
302 const int ieta = eta_partition->id().roll();
306 const TString name_suffix = TString::Format(
"_GE%+.2d_R%d", region_id * (station_id * 10 + 1), ieta);
307 const TString
title =
308 name_.c_str() + TString::Format(
" : GE%+.2d Roll %d", region_id * (station_id * 10 + 1), ieta);
326 me_prop_r_err_ = ibooker.
book1D(
"prop_r_err",
";Propagation Global R Error [cm];Entries", 20, 0.0, 20.0);
331 const int region_id =
station->region();
332 const int station_id =
station->station();
338 const std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
344 const int num_ch = superchambers.size();
358 if (not rechit_collection.
isValid()) {
382 if (not global_tracking_geometry.
isValid()) {
390 if (not transient_track_builder.
isValid()) {
397 if (not propagator.
isValid()) {
402 if (rechit_collection->size() < 1) {
407 if (muon_view->empty()) {
412 const std::vector<GEMLayerData> layer_vector =
buildGEMLayers(gem);
416 if (track ==
nullptr) {
422 if (not transient_track.
isValid()) {
433 const auto [start_state, start_id] =
getStartingState(transient_track,
layer, global_tracking_geometry);
435 if (not start_state.isValid()) {
447 if (not dest_state.
isValid()) {
460 if (eta_partition ==
nullptr) {
471 const double dest_global_r_err =
std::sqrt(dest_global_err.
rerr(dest_global_pos));
472 const double dest_global_phi_err =
std::sqrt(dest_global_err.
phierr(dest_global_pos));
479 const int chamber_id = gem_id.chamber();
480 const int ieta = gem_id.ieta();
508 const auto [
hit, residual_rphi] =
findClosetHit(dest_global_pos, rechit_collection->get(gem_id), eta_partition);
510 if (
hit ==
nullptr) {
532 const float residual_y = dest_local_pos.
y() - hit_local_pos.y();
533 const float pull_y = residual_y /
std::sqrt(dest_local_err.
yy() + hit_local_err.
yy());
551 }
else if (station == 2) {
557 }
else if (station == 0) {
573 std::vector<GEMLayerData> layer_vector;
576 const int region_id =
station->region();
577 const int station_id =
station->station();
578 const bool is_ge11 = station_id == 1;
585 std::map<std::pair<int, bool>, std::vector<const GEMChamber*> > chambers_per_layer;
589 const bool is_odd = is_ge11 ? super_chamber->id().chamber() % 2 == 1 :
false;
591 for (
const GEMChamber* chamber : super_chamber->chambers()) {
592 const int layer_id = chamber->id().layer();
593 const std::pair<int, bool>
key{layer_id, is_odd};
595 if (chambers_per_layer.find(
key) == chambers_per_layer.end())
596 chambers_per_layer.insert({
key, std::vector<const GEMChamber*>()});
598 chambers_per_layer.at(
key).push_back(chamber);
602 for (
auto [
key, chamber_vector] : chambers_per_layer) {
603 const int layer_id =
key.first;
606 auto [rmin, rmax] = chamber_vector[0]->surface().rSpan();
607 auto [zmin, zmax] = chamber_vector[0]->surface().zSpan();
610 const float layer_z = chamber_vector[0]->position().z();
621 layer_vector.emplace_back(layer, chamber_vector, region_id, station_id, layer_id);
655 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
664 std::tie(starting_state, starting_id) =
findStartingState(transient_track, layer, geometry);
667 starting_id = inner_id;
675 return std::make_pair(starting_state, starting_id);
684 float min_distance = 1e12;
689 const DetId det_id = (*rechit)->geographicalId();
695 const GeomDet* det = geometry->idToDet(det_id);
698 if (distance < min_distance) {
701 starting_point = global_position;
702 starting_id = det_id;
710 return std::make_pair(starting_state, starting_id);
717 return (csc_id.station() == 1)
or ((csc_id.ring() == 1)
or (csc_id.ring() == 4));
721 const bool is_same_region = track->
eta() * layer.
region > 0;
729 const bool is_outgoing = p2_in > p2_out;
731 skip = (is_outgoing xor is_same_region);
735 skip = not is_same_region;
743 const LocalPoint local_point_2d(local_point.
x(), local_point.
y(), 0.0f);
748 const std::vector<const GEMChamber*>& chamber_vector) {
750 for (
const GEMChamber* chamber : chamber_vector) {
751 if (not
checkBounds(global_point, chamber->surface()))
754 for (
const GEMEtaPartition* eta_partition : chamber->etaPartitions()) {
755 if (
checkBounds(global_point, eta_partition->surface())) {
756 bound = eta_partition;
770 const float dest_local_x = dest_local_pos.
x();
771 const float dest_local_y = dest_local_pos.
y();
774 float min_residual_rphi = 1e6;
776 for (
auto hit = range.first;
hit != range.second; ++
hit) {
778 const float hit_local_phi = topology.
stripAngle(eta_partition->
strip(hit_local_pos));
780 const float residual_x = dest_local_x - hit_local_pos.
x();
781 const float residual_y = dest_local_y - hit_local_pos.
y();
782 const float residual_rphi =
std::cos(hit_local_phi) * residual_x +
std::sin(hit_local_phi) * residual_y;
785 min_residual_rphi = residual_rphi;
786 closest_hit = &(*hit);
790 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
std::string to_string(const V &value)
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)