CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCStubResolutionValidation Class Reference

#include <CSCStubResolutionValidation.h>

Inheritance diagram for CSCStubResolutionValidation:
CSCBaseValidation

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
 CSCStubResolutionValidation (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~CSCStubResolutionValidation () override
 
- Public Member Functions inherited from CSCBaseValidation
 CSCBaseValidation (const edm::ParameterSet &ps)
 
void setGeometry (const CSCGeometry *geom)
 
void setSimHitMap (const PSimHitMap *simHitMap)
 
virtual ~CSCBaseValidation ()
 

Private Attributes

MonitorElementbendresCLCT [10]
 
std::unique_ptr< CSCStubMatchercscStubMatcher_
 
MonitorElementposresCLCT_es [10]
 
MonitorElementposresCLCT_hs [10]
 
MonitorElementposresCLCT_qs [10]
 
edm::EDGetTokenT< edm::SimTrackContainersimTrackInput_
 
edm::EDGetTokenT< edm::SimVertexContainersimVertexInput_
 

Additional Inherited Members

- Public Types inherited from CSCBaseValidation
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from CSCBaseValidation
const CSCLayerfindLayer (int detId) const
 
bool isSimTrackGood (const SimTrack &t) const
 
- Protected Attributes inherited from CSCBaseValidation
bool doSim_
 
double simTrackMaxEta_
 
double simTrackMinEta_
 
double simTrackMinPt_
 
const CSCGeometrytheCSCGeometry
 
const PSimHitMaptheSimHitMap
 

Detailed Description

Definition at line 10 of file CSCStubResolutionValidation.h.

Constructor & Destructor Documentation

◆ CSCStubResolutionValidation()

CSCStubResolutionValidation::CSCStubResolutionValidation ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)

Definition at line 6 of file CSCStubResolutionValidation.cc.

References cscStubMatcher_, eostools::move(), muonDTDigis_cfi::pset, cscDigiValidation_cfi::simTrack, simTrackInput_, ecalDetailedTimeRecHit_cfi::simVertex, and simVertexInput_.

8  const auto& simVertex = pset.getParameter<edm::ParameterSet>("simVertex");
10  const auto& simTrack = pset.getParameter<edm::ParameterSet>("simTrack");
11  simTrackInput_ = iC.consumes<edm::SimTrackContainer>(simTrack.getParameter<edm::InputTag>("inputTag"));
12 
13  // Initialize stub matcher
14  cscStubMatcher_ = std::make_unique<CSCStubMatcher>(pset, std::move(iC));
15 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::SimVertexContainer > simVertexInput_
CSCBaseValidation(const edm::ParameterSet &ps)
edm::EDGetTokenT< edm::SimTrackContainer > simTrackInput_
std::vector< SimVertex > SimVertexContainer
std::unique_ptr< CSCStubMatcher > cscStubMatcher_
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:511

◆ ~CSCStubResolutionValidation()

CSCStubResolutionValidation::~CSCStubResolutionValidation ( )
override

Definition at line 17 of file CSCStubResolutionValidation.cc.

17 {}

Member Function Documentation

◆ analyze()

void CSCStubResolutionValidation::analyze ( const edm::Event e,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements CSCBaseValidation.

Definition at line 46 of file CSCStubResolutionValidation.cc.

References bendresCLCT, CSCDetId::chamber(), cscStubMatcher_, MillePedeFileConverter_cfg::e, CSCDetId::endcap(), options_cfi::eventSetup, dqm::impl::MonitorElement::Fill(), mps_fire::i, globals_cff::id2, CSCBaseValidation::isSimTrackGood(), CSCConstants::MAX_HALF_STRIP_ME1B, CSCConstants::NUM_STRIPS_ME1B, or, posresCLCT_es, posresCLCT_hs, posresCLCT_qs, edm::Handle< T >::product(), CSCDetId::ring(), relativeConstraints::ring, simTrackInput_, simVertexInput_, CSCDetId::station(), and submitPVValidationJobs::t.

46  {
47  // Define handles
50 
51  // Use token to retreive event information
52  e.getByToken(simTrackInput_, sim_tracks);
53  e.getByToken(simVertexInput_, sim_vertices);
54 
55  // Initialize StubMatcher
57 
58  const edm::SimTrackContainer& sim_track = *sim_tracks.product();
59  const edm::SimVertexContainer& sim_vert = *sim_vertices.product();
60 
61  // select simtracks for true muons
62  edm::SimTrackContainer sim_track_selected;
63  for (const auto& t : sim_track) {
64  if (!isSimTrackGood(t))
65  continue;
66  sim_track_selected.push_back(t);
67  }
68 
69  // Skip events with no selected simtracks
70  if (sim_track_selected.empty())
71  return;
72 
73  // Loop through good tracks, use corresponding vertex to match stubs, then fill hists of chambers where the stub appears.
74  for (const auto& t : sim_track_selected) {
75  std::vector<bool> hitCLCT(10);
76 
77  std::vector<float> delta_fhs_clct(10);
78  std::vector<float> delta_fqs_clct(10);
79  std::vector<float> delta_fes_clct(10);
80 
81  std::vector<float> dslope_clct(10);
82 
83  // Match track to stubs with appropriate vertex
84  cscStubMatcher_->match(t, sim_vert[t.vertIndex()]);
85 
86  // Store matched stubs.
87  // Key: ChamberID, Value : CSCStubDigiContainer
88  const auto& clcts = cscStubMatcher_->clcts();
89 
90  // CLCTs
91  for (auto& [id, container] : clcts) {
92  const CSCDetId cscId(id);
93 
94  // get the best clct in chamber
95  const auto& clct = cscStubMatcher_->bestClctInChamber(id);
96  if (!clct.isValid())
97  continue;
98 
99  // ME1a CLCTs are saved in ME1b container. So the DetId need to be specified
100  const bool isME11(cscId.station() == 1 and (cscId.ring() == 4 or cscId.ring() == 1));
101  const bool isME1a(isME11 and clct.getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B);
102  int ring = cscId.ring();
103  if (isME1a)
104  ring = 4;
105  else if (isME11)
106  ring = 1;
107  CSCDetId cscId2(cscId.endcap(), cscId.station(), ring, cscId.chamber(), 0);
108  auto id2 = cscId2.rawId();
109 
110  // calculate deltastrip for ME1/a. Basically, we need to subtract 64 from the CLCT key strip to
111  // compare with key strip as obtained through the fit to simhits positions.
112  int deltaStrip = 0;
113  if (isME1a)
114  deltaStrip = CSCConstants::NUM_STRIPS_ME1B;
115 
116  // fractional strip
117  const float fhs_clct = clct.getFractionalStrip(2);
118  const float fqs_clct = clct.getFractionalStrip(4);
119  const float fes_clct = clct.getFractionalStrip(8);
120 
121  // in half-strips per layer
122  const float slopeHalfStrip(clct.getFractionalSlope());
123  const float slopeStrip(slopeHalfStrip / 2.);
124 
125  // get the fit hits in chamber for true value
126  float stripIntercept, stripSlope;
127  cscStubMatcher_->cscDigiMatcher()->muonSimHitMatcher()->fitHitsInChamber(id2, stripIntercept, stripSlope);
128 
129  // add offset of +0.25 strips for non-ME1/1 chambers
130  if (!isME11) {
131  stripIntercept -= 0.25;
132  }
133 
134  const float strip_csc_sh = stripIntercept;
135  const float bend_csc_sh = stripSlope;
136 
137  const unsigned chamberType(cscId2.iChamberType());
138  hitCLCT[chamberType - 1] = true;
139 
140  delta_fhs_clct[chamberType - 1] = fhs_clct - deltaStrip - strip_csc_sh;
141  delta_fqs_clct[chamberType - 1] = fqs_clct - deltaStrip - strip_csc_sh;
142  delta_fes_clct[chamberType - 1] = fes_clct - deltaStrip - strip_csc_sh;
143 
144  dslope_clct[chamberType - 1] = slopeStrip - bend_csc_sh;
145  }
146 
147  for (int i = 0; i < 10; i++) {
148  if (hitCLCT[i]) {
149  //fill histograms
150  posresCLCT_hs[i]->Fill(delta_fhs_clct[i]);
151  posresCLCT_qs[i]->Fill(delta_fqs_clct[i]);
152  posresCLCT_es[i]->Fill(delta_fes_clct[i]);
153 
154  bendresCLCT[i]->Fill(dslope_clct[i]);
155  }
156  }
157  }
158 }
T const * product() const
Definition: Handle.h:70
void Fill(long long x)
bool isSimTrackGood(const SimTrack &t) const
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::EDGetTokenT< edm::SimVertexContainer > simVertexInput_
edm::EDGetTokenT< edm::SimTrackContainer > simTrackInput_
std::vector< SimVertex > SimVertexContainer
std::unique_ptr< CSCStubMatcher > cscStubMatcher_
std::vector< SimTrack > SimTrackContainer

◆ bookHistograms()

void CSCStubResolutionValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 20 of file CSCStubResolutionValidation.cc.

References bendresCLCT, dqm::implementation::IBooker::book1D(), CSCDetId::chamberName(), mps_fire::i, dqmiolumiharvest::j, posresCLCT_es, posresCLCT_hs, posresCLCT_qs, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, RandomServiceHelper::t1, RandomServiceHelper::t2, and RandomServiceHelper::t3.

20  {
21  for (int i = 1; i <= 10; ++i) {
22  int j = i - 1;
24 
25  //Position resolution; CLCT
26  std::string t1 = "CLCTPosRes_hs_" + cn;
27  std::string t2 = "CLCTPosRes_qs_" + cn;
28  std::string t3 = "CLCTPosRes_es_" + cn;
29 
30  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/CLCT/Resolution/");
31  posresCLCT_hs[j] = iBooker.book1D(
32  t1, cn + " CLCT Position Resolution (1/2-strip prec.); Strip_{L1T} - Strip_{SIM}; Entries", 50, -1, 1);
33  posresCLCT_qs[j] = iBooker.book1D(
34  t2, cn + " CLCT Position Resolution (1/4-strip prec.); Strip_{L1T} - Strip_{SIM}; Entries", 50, -1, 1);
35  posresCLCT_es[j] = iBooker.book1D(
36  t3, cn + " CLCT Position Resolution (1/8-strip prec.); Strip_{L1T} - Strip_{SIM}; Entries", 50, -1, 1);
37 
38  //Slope resolution; CLCT
39  std::string t4 = "CLCTBendRes_" + cn;
40 
41  bendresCLCT[j] =
42  iBooker.book1D(t4, cn + " CLCT Bend Resolution; Slope_{L1T} - Slope_{SIM}; Entries", 50, -0.5, 0.5);
43  }
44 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::string chamberName() const
Definition: CSCDetId.cc:92
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

Member Data Documentation

◆ bendresCLCT

MonitorElement* CSCStubResolutionValidation::bendresCLCT[10]
private

Definition at line 26 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and bookHistograms().

◆ cscStubMatcher_

std::unique_ptr<CSCStubMatcher> CSCStubResolutionValidation::cscStubMatcher_
private

Definition at line 19 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and CSCStubResolutionValidation().

◆ posresCLCT_es

MonitorElement* CSCStubResolutionValidation::posresCLCT_es[10]
private

Definition at line 24 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and bookHistograms().

◆ posresCLCT_hs

MonitorElement* CSCStubResolutionValidation::posresCLCT_hs[10]
private

Definition at line 22 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and bookHistograms().

◆ posresCLCT_qs

MonitorElement* CSCStubResolutionValidation::posresCLCT_qs[10]
private

Definition at line 23 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and bookHistograms().

◆ simTrackInput_

edm::EDGetTokenT<edm::SimTrackContainer> CSCStubResolutionValidation::simTrackInput_
private

Definition at line 29 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and CSCStubResolutionValidation().

◆ simVertexInput_

edm::EDGetTokenT<edm::SimVertexContainer> CSCStubResolutionValidation::simVertexInput_
private

Definition at line 28 of file CSCStubResolutionValidation.h.

Referenced by analyze(), and CSCStubResolutionValidation().