CMS 3D CMS Logo

CSCRecHit2DValidation.cc
Go to the documentation of this file.
4 
6  : CSCBaseValidation(ps), theNPerEventPlot(nullptr) {
7  const auto &pset = ps.getParameterSet("cscRecHit");
8  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
10 }
11 
13 
15  theNPerEventPlot = iBooker.book1D("CSCRecHitsPerEvent", "Number of CSC Rec Hits per event", 100, 0, 500);
16  // 10 chamber types, if you consider ME1/a and ME1/b separate
17  for (int i = 1; i <= 10; ++i) {
19  const std::string t1("CSCRecHitResolution_" + cn);
20  const std::string t2("CSCRecHitPull_" + cn);
21  const std::string t3("CSCRecHitYResolution_" + cn);
22 
23  const std::string t4("CSCRecHitYPull_" + cn);
24  const std::string t5("CSCRecHitPosInStrip_" + cn);
25  const std::string t6("CSCSimHitPosInStrip_" + cn);
26 
27  const std::string t7("CSCRecHit_" + cn);
28  const std::string t8("CSCSimHit_" + cn);
29  const std::string t9("CSCTPeak_" + cn);
30 
31  theResolutionPlots[i - 1] = iBooker.book1D(t1, t1 + ";R*dPhi Resolution [cm];Entries", 100, -0.2, 0.2);
32  thePullPlots[i - 1] = iBooker.book1D(t2, t2 + ";dPhi Pull;Entries", 100, -3, 3);
33  theYResolutionPlots[i - 1] = iBooker.book1D(t3, t3 + ";Local Y Resolution [cm];Entries", 100, -5, 5);
34  theYPullPlots[i - 1] = iBooker.book1D(t4, t4 + ";Local Y Pull;Entries", 100, -3, 3);
35  theRecHitPosInStrip[i - 1] = iBooker.book1D(t5, t5 + ";Position in Strip;Entries", 100, -2, 2);
36  theSimHitPosInStrip[i - 1] = iBooker.book1D(t6, t6 + ";Position in Strip;Entries", 100, -2, 2);
37 
38  theScatterPlots[i - 1] = iBooker.book2D(t7, t7 + ";Local Phi;Local Y [cm]", 200, -20, 20, 200, -250, 250);
39  theSimHitScatterPlots[i - 1] = iBooker.book2D(t8, t8 + ";Local Phi;Local Y [cm]", 200, -20, 20, 200, -250, 250);
40  theTPeaks[i - 1] = iBooker.book1D(t9, t9 + ";Peak Time [ns];Entries", 200, 0, 400);
41  }
42 }
43 
45  // get the collection of CSCRecHrecHitItrD
47  e.getByToken(rechits_Token_, hRecHits);
48  const CSCRecHit2DCollection *cscRecHits = hRecHits.product();
49 
50  unsigned nPerEvent = 0;
51 
52  for (auto recHitItr = cscRecHits->begin(); recHitItr != cscRecHits->end(); recHitItr++) {
53  ++nPerEvent;
54  int detId = (*recHitItr).cscDetId().rawId();
56  const CSCLayer *layer = findLayer(detId);
57  int chamberType = layer->chamber()->specs()->chamberType();
58  theTPeaks[chamberType - 1]->Fill(recHitItr->tpeak());
59  if (simHits.size() == 1) {
60  plotResolution(simHits[0], *recHitItr, layer, chamberType);
61  }
62  float localX = recHitItr->localPosition().x();
63  float localY = recHitItr->localPosition().y();
64  // find a local phi
65  float globalR = layer->toGlobal(LocalPoint(0., 0., 0.)).perp();
66  GlobalPoint axisThruChamber(globalR + localY, localX, 0.);
67  float localPhi = axisThruChamber.phi().degrees();
68  theScatterPlots[chamberType - 1]->Fill(localPhi, localY);
69  }
70  theNPerEventPlot->Fill(nPerEvent);
71 
72  if (doSim_) {
73  // fill sim hits
74  std::vector<int> layersWithSimHits = theSimHitMap->detsWithHits();
75  for (unsigned i = 0; i < layersWithSimHits.size(); ++i) {
76  edm::PSimHitContainer simHits = theSimHitMap->hits(layersWithSimHits[i]);
77  for (auto hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
78  const CSCLayer *layer = findLayer(layersWithSimHits[i]);
79  int chamberType = layer->chamber()->specs()->chamberType();
80  float localX = hitItr->localPosition().x();
81  float localY = hitItr->localPosition().y();
82  // find a local phi
83  float globalR = layer->toGlobal(LocalPoint(0., 0., 0.)).perp();
84  GlobalPoint axisThruChamber(globalR + localY, localX, 0.);
85  float localPhi = axisThruChamber.phi().degrees();
86  theSimHitScatterPlots[chamberType - 1]->Fill(localPhi, localY);
87  }
88  }
89  }
90 }
91 
93  const CSCRecHit2D &recHit,
94  const CSCLayer *layer,
95  int chamberType) {
96  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
97  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
98 
99  double dphi = recHitPos.phi() - simHitPos.phi();
100  double rdphi = recHitPos.perp() * dphi;
101  theResolutionPlots[chamberType - 1]->Fill(rdphi);
102  thePullPlots[chamberType - 1]->Fill(rdphi / sqrt(recHit.localPositionError().xx()));
103  double dy = recHit.localPosition().y() - simHit.localPosition().y();
104  theYResolutionPlots[chamberType - 1]->Fill(dy);
105  theYPullPlots[chamberType - 1]->Fill(dy / sqrt(recHit.localPositionError().yy()));
106 
107  const CSCLayerGeometry *layerGeometry = layer->geometry();
108  float recStrip = layerGeometry->strip(recHit.localPosition());
109  float simStrip = layerGeometry->strip(simHit.localPosition());
110  theRecHitPosInStrip[chamberType - 1]->Fill(recStrip - int(recStrip));
111  theSimHitPosInStrip[chamberType - 1]->Fill(simStrip - int(simStrip));
112 }
CSCRecHit2DValidation::~CSCRecHit2DValidation
~CSCRecHit2DValidation() override
Definition: CSCRecHit2DValidation.cc:12
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
CSCRecHit2DCollection
mps_fire.i
i
Definition: mps_fire.py:428
CSCRecHit2DValidation::theNPerEventPlot
MonitorElement * theNPerEventPlot
Definition: CSCRecHit2DValidation.h:21
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
phase1PixelTopology::localY
constexpr uint16_t localY(uint16_t py)
Definition: phase1PixelTopology.h:151
CSCRecHit2DValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &)
Definition: CSCRecHit2DValidation.cc:14
CSCRecHit2DValidation::theYResolutionPlots
MonitorElement * theYResolutionPlots[10]
Definition: CSCRecHit2DValidation.h:24
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
DQMStore.h
CSCLayer
Definition: CSCLayer.h:24
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
edm::Handle< CSCRecHit2DCollection >
CSCRecHit2DValidation::theSimHitPosInStrip
MonitorElement * theSimHitPosInStrip[10]
Definition: CSCRecHit2DValidation.h:29
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
CSCRecHit2DValidation::theResolutionPlots
MonitorElement * theResolutionPlots[10]
Definition: CSCRecHit2DValidation.h:22
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
CSCBaseValidation::doSim_
bool doSim_
Definition: CSCBaseValidation.h:26
CSCRecHit2DValidation::theScatterPlots
MonitorElement * theScatterPlots[10]
Definition: CSCRecHit2DValidation.h:26
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
CSCLayerGeometry
Definition: CSCLayerGeometry.h:25
CSCRecHit2DValidation::plotResolution
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
Definition: CSCRecHit2DValidation.cc:92
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
CSCRecHit2DValidation::theRecHitPosInStrip
MonitorElement * theRecHitPosInStrip[10]
Definition: CSCRecHit2DValidation.h:28
CSCBaseValidation::findLayer
const CSCLayer * findLayer(int detId) const
Definition: CSCBaseValidation.cc:7
Point3DBase< float, GlobalTag >
RandomServiceHelper.t3
t3
Definition: RandomServiceHelper.py:258
CSCRecHit2DValidation::theYPullPlots
MonitorElement * theYPullPlots[10]
Definition: CSCRecHit2DValidation.h:25
CSCRecHit2DValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: CSCRecHit2DValidation.cc:44
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCBaseValidation::theSimHitMap
const PSimHitMap * theSimHitMap
Definition: CSCBaseValidation.h:28
phase1PixelTopology::localX
constexpr uint16_t localX(uint16_t px)
Definition: phase1PixelTopology.h:142
CSCRecHit2DValidation::theSimHitScatterPlots
MonitorElement * theSimHitScatterPlots[10]
Definition: CSCRecHit2DValidation.h:27
CSCRecHit2DValidation::theTPeaks
MonitorElement * theTPeaks[10]
Definition: CSCRecHit2DValidation.h:30
edm::ParameterSet
Definition: ParameterSet.h:47
CSCRecHit2D
Definition: CSCRecHit2D.h:18
CSCRecHit2DValidation.h
Geom::Phi::degrees
T1 degrees() const
Definition: Phi.h:107
PSimHitMap::detsWithHits
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:29
CSCRecHit2DValidation::rechits_Token_
edm::EDGetTokenT< CSCRecHit2DCollection > rechits_Token_
Definition: CSCRecHit2DValidation.h:16
PVValHelper::dy
Definition: PVValidationHelpers.h:50
edm::EventSetup
Definition: EventSetup.h:58
CSCRecHit2DValidation::CSCRecHit2DValidation
CSCRecHit2DValidation(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
Definition: CSCRecHit2DValidation.cc:5
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCLayerGeometry::strip
float strip(const LocalPoint &lp) const
Definition: CSCLayerGeometry.h:183
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
CSCDetId::chamberName
std::string chamberName() const
Definition: CSCDetId.cc:86
PSimHitMap::hits
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
CSCRecHit2DValidation::thePullPlots
MonitorElement * thePullPlots[10]
Definition: CSCRecHit2DValidation.h:23
dqm::implementation::IBooker
Definition: DQMStore.h:43
CSCBaseValidation
Definition: CSCBaseValidation.h:14
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
PSimHit
Definition: PSimHit.h:15
edm::Event
Definition: Event.h:73
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
CSCRecHit2DValidation::inputTag_
edm::InputTag inputTag_
Definition: CSCRecHit2DValidation.h:17
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37