CMS 3D CMS Logo

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< CSCRecHit2DCollectionrechits_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::CSCRecHit2DValidation ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 of file CSCRecHit2DValidation.cc.

References edm::ParameterSet::getParameterSet(), inputTag_, muonDTDigis_cfi::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_
ParameterSet const & getParameterSet(std::string const &) const
CSCBaseValidation(const edm::ParameterSet &ps)
MonitorElement * theNPerEventPlot

◆ ~CSCRecHit2DValidation()

CSCRecHit2DValidation::~CSCRecHit2DValidation ( )
override

Definition at line 12 of file CSCRecHit2DValidation.cc.

12 {}

Member Function Documentation

◆ analyze()

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

Implements CSCBaseValidation.

Definition at line 44 of file CSCRecHit2DValidation.cc.

References nano_mu_digi_cff::chamberType, Geom::Phi< T1, Range >::degrees(), hcalRecHitTable_cff::detId, PSimHitMap::detsWithHits(), CSCBaseValidation::doSim_, MillePedeFileConverter_cfg::e, dqm::impl::MonitorElement::Fill(), CSCBaseValidation::findLayer(), PSimHitMap::hits(), mps_fire::i, nano_mu_digi_cff::layer, PV3DBase< T, PVType, FrameType >::phi(), plotResolution(), edm::Handle< T >::product(), rechits_Token_, FastTrackerRecHitCombiner_cfi::simHits, theNPerEventPlot, theScatterPlots, CSCBaseValidation::theSimHitMap, theSimHitScatterPlots, and theTPeaks.

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
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
edm::EDGetTokenT< CSCRecHit2DCollection > rechits_Token_
T const * product() const
Definition: Handle.h:70
void Fill(long long x)
const PSimHitMap * theSimHitMap
const CSCLayer * findLayer(int detId) const
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
MonitorElement * theNPerEventPlot
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:29
MonitorElement * theTPeaks[10]
std::vector< PSimHit > PSimHitContainer

◆ bookHistograms()

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, RandomServiceHelper::t1, RandomServiceHelper::t2, RandomServiceHelper::t3, 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:221
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

◆ plotResolution()

void CSCRecHit2DValidation::plotResolution ( const PSimHit simHit,
const CSCRecHit2D recHit,
const CSCLayer layer,
int  chamberType 
)
private

Definition at line 92 of file CSCRecHit2DValidation.cc.

References nano_mu_digi_cff::chamberType, PVValHelper::dy, dqm::impl::MonitorElement::Fill(), nano_mu_digi_cff::layer, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), rpcPointValidation_cfi::recHit, rpcPointValidation_cfi::simHit, mathSSE::sqrt(), CSCLayerGeometry::strip(), thePullPlots, theRecHitPosInStrip, theResolutionPlots, theSimHitPosInStrip, theYPullPlots, and theYResolutionPlots.

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();
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]
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
MonitorElement * theResolutionPlots[10]
void Fill(long long x)
MonitorElement * theSimHitPosInStrip[10]
MonitorElement * theYPullPlots[10]
float strip(const LocalPoint &lp) const
T sqrt(T t)
Definition: SSEVec.h:23
MonitorElement * thePullPlots[10]
MonitorElement * theRecHitPosInStrip[10]

Member Data Documentation

◆ inputTag_

edm::InputTag CSCRecHit2DValidation::inputTag_
private

Definition at line 17 of file CSCRecHit2DValidation.h.

Referenced by CSCRecHit2DValidation().

◆ rechits_Token_

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

Definition at line 16 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and CSCRecHit2DValidation().

◆ theNPerEventPlot

MonitorElement* CSCRecHit2DValidation::theNPerEventPlot
private

Definition at line 21 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

◆ thePullPlots

MonitorElement* CSCRecHit2DValidation::thePullPlots[10]
private

Definition at line 23 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

◆ theRecHitPosInStrip

MonitorElement* CSCRecHit2DValidation::theRecHitPosInStrip[10]
private

Definition at line 28 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

◆ theResolutionPlots

MonitorElement* CSCRecHit2DValidation::theResolutionPlots[10]
private

Definition at line 22 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

◆ theScatterPlots

MonitorElement* CSCRecHit2DValidation::theScatterPlots[10]
private

Definition at line 26 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

◆ theSimHitPosInStrip

MonitorElement* CSCRecHit2DValidation::theSimHitPosInStrip[10]
private

Definition at line 29 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

◆ theSimHitScatterPlots

MonitorElement* CSCRecHit2DValidation::theSimHitScatterPlots[10]
private

Definition at line 27 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

◆ theTPeaks

MonitorElement* CSCRecHit2DValidation::theTPeaks[10]
private

Definition at line 30 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

◆ theYPullPlots

MonitorElement* CSCRecHit2DValidation::theYPullPlots[10]
private

Definition at line 25 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

◆ theYResolutionPlots

MonitorElement* CSCRecHit2DValidation::theYResolutionPlots[10]
private

Definition at line 24 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().