CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCRecHit2DValidation Class Reference

#include <CSCRecHit2DValidation.h>

Inheritance diagram for CSCRecHit2DValidation:
CSCBaseValidation

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
 CSCRecHit2DValidation (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
 ~CSCRecHit2DValidation () 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 Member Functions

void plotResolution (const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
 

Private Attributes

edm::InputTag inputTag_
 
edm::EDGetTokenT
< CSCRecHit2DCollection
rechits_Token_
 
MonitorElementtheNPerEventPlot
 
MonitorElementthePullPlots [10]
 
MonitorElementtheRecHitPosInStrip [10]
 
MonitorElementtheResolutionPlots [10]
 
MonitorElementtheScatterPlots [10]
 
MonitorElementtheSimHitPosInStrip [10]
 
MonitorElementtheSimHitScatterPlots [10]
 
MonitorElementtheTPeaks [10]
 
MonitorElementtheYPullPlots [10]
 
MonitorElementtheYResolutionPlots [10]
 

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 8 of file CSCRecHit2DValidation.h.

Constructor & Destructor Documentation

CSCRecHit2DValidation::CSCRecHit2DValidation ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 of file CSCRecHit2DValidation.cc.

References edm::ParameterSet::getParameterSet(), inputTag_, TrackValidation_cff::pset, and rechits_Token_.

6  : CSCBaseValidation(ps), theNPerEventPlot(nullptr) {
7  const auto &pset = ps.getParameterSet("cscRecHit");
8  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
10 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CSCRecHit2DCollection > rechits_Token_
CSCBaseValidation(const edm::ParameterSet &ps)
ParameterSet const & getParameterSet(std::string const &) const
MonitorElement * theNPerEventPlot
CSCRecHit2DValidation::~CSCRecHit2DValidation ( )
override

Definition at line 12 of file CSCRecHit2DValidation.cc.

12 {}

Member Function Documentation

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

Implements CSCBaseValidation.

Definition at line 44 of file CSCRecHit2DValidation.cc.

References CSCLayer::chamber(), CSCChamberSpecs::chamberType(), Geom::Phi< T1, Range >::degrees(), PSimHitMap::detsWithHits(), CSCBaseValidation::doSim_, dqm::impl::MonitorElement::Fill(), CSCBaseValidation::findLayer(), edm::Event::getByToken(), PSimHitMap::hits(), mps_fire::i, phase1PixelTopology::layer, phase1PixelTopology::localX(), pixelTopology::localY(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), plotResolution(), edm::Handle< T >::product(), rechits_Token_, trackerHits::simHits, CSCChamber::specs(), theNPerEventPlot, theScatterPlots, CSCBaseValidation::theSimHitMap, theSimHitScatterPlots, theTPeaks, and GeomDet::toGlobal().

44  {
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 }
MonitorElement * theSimHitScatterPlots[10]
MonitorElement * theScatterPlots[10]
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T perp() const
Definition: PV3DBase.h:69
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
edm::EDGetTokenT< CSCRecHit2DCollection > rechits_Token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
constexpr std::array< uint8_t, layerIndexSize > layer
void Fill(long long x)
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:39
const PSimHitMap * theSimHitMap
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:29
T const * product() const
Definition: Handle.h:70
int chamberType() const
constexpr uint16_t localX(uint16_t px)
constexpr uint16_t localY(uint16_t py, uint16_t n)
tuple simHits
Definition: trackerHits.py:16
MonitorElement * theNPerEventPlot
MonitorElement * theTPeaks[10]
std::vector< PSimHit > PSimHitContainer
const CSCChamber * chamber() const
Definition: CSCLayer.h:49
const CSCLayer * findLayer(int detId) const
void CSCRecHit2DValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 14 of file CSCRecHit2DValidation.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), CSCDetId::chamberName(), mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, theNPerEventPlot, thePullPlots, theRecHitPosInStrip, theResolutionPlots, theScatterPlots, theSimHitPosInStrip, theSimHitScatterPlots, theTPeaks, theYPullPlots, and theYResolutionPlots.

14  {
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 }
MonitorElement * theSimHitScatterPlots[10]
MonitorElement * theYResolutionPlots[10]
MonitorElement * theScatterPlots[10]
MonitorElement * theResolutionPlots[10]
MonitorElement * theSimHitPosInStrip[10]
MonitorElement * theYPullPlots[10]
std::string chamberName() const
Definition: CSCDetId.cc:92
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
MonitorElement * theNPerEventPlot
MonitorElement * thePullPlots[10]
MonitorElement * theRecHitPosInStrip[10]
MonitorElement * theTPeaks[10]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void CSCRecHit2DValidation::plotResolution ( const PSimHit simHit,
const CSCRecHit2D recHit,
const CSCLayer layer,
int  chamberType 
)
private

Definition at line 92 of file CSCRecHit2DValidation.cc.

References PVValHelper::dy, dqm::impl::MonitorElement::Fill(), CSCLayer::geometry(), PSimHit::localPosition(), CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), mathSSE::sqrt(), CSCLayerGeometry::strip(), thePullPlots, theRecHitPosInStrip, theResolutionPlots, theSimHitPosInStrip, theYPullPlots, theYResolutionPlots, GeomDet::toGlobal(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by analyze().

95  {
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 }
MonitorElement * theYResolutionPlots[10]
float xx() const
Definition: LocalError.h:22
T perp() const
Definition: PV3DBase.h:69
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T y() const
Definition: PV3DBase.h:60
MonitorElement * theResolutionPlots[10]
void Fill(long long x)
MonitorElement * theSimHitPosInStrip[10]
MonitorElement * theYPullPlots[10]
float yy() const
Definition: LocalError.h:24
Local3DPoint localPosition() const
Definition: PSimHit.h:52
T sqrt(T t)
Definition: SSEVec.h:19
float strip(const LocalPoint &lp) const
LocalError localPositionError() const override
Definition: CSCRecHit2D.h:57
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:56
MonitorElement * thePullPlots[10]
MonitorElement * theRecHitPosInStrip[10]
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44

Member Data Documentation

edm::InputTag CSCRecHit2DValidation::inputTag_
private

Definition at line 17 of file CSCRecHit2DValidation.h.

Referenced by CSCRecHit2DValidation().

edm::EDGetTokenT<CSCRecHit2DCollection> CSCRecHit2DValidation::rechits_Token_
private

Definition at line 16 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and CSCRecHit2DValidation().

MonitorElement* CSCRecHit2DValidation::theNPerEventPlot
private

Definition at line 21 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::thePullPlots[10]
private

Definition at line 23 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theRecHitPosInStrip[10]
private

Definition at line 28 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theResolutionPlots[10]
private

Definition at line 22 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theScatterPlots[10]
private

Definition at line 26 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::theSimHitPosInStrip[10]
private

Definition at line 29 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theSimHitScatterPlots[10]
private

Definition at line 27 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::theTPeaks[10]
private

Definition at line 30 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::theYPullPlots[10]
private

Definition at line 25 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theYResolutionPlots[10]
private

Definition at line 24 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().