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::InputTag &inputTag, edm::ConsumesCollector &&iC)
 
 ~CSCRecHit2DValidation () override
 
- Public Member Functions inherited from CSCBaseValidation
 CSCBaseValidation (const edm::InputTag &inputTag)
 
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::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

- Protected Member Functions inherited from CSCBaseValidation
const CSCLayerfindLayer (int detId) const
 
- Protected Attributes inherited from CSCBaseValidation
const CSCGeometrytheCSCGeometry
 
edm::InputTag theInputTag
 
const PSimHitMaptheSimHitMap
 

Detailed Description

Definition at line 12 of file CSCRecHit2DValidation.h.

Constructor & Destructor Documentation

CSCRecHit2DValidation::CSCRecHit2DValidation ( const edm::InputTag inputTag,
edm::ConsumesCollector &&  iC 
)

Definition at line 7 of file CSCRecHit2DValidation.cc.

References HiClusterCompatibility_cfi::inputTag, and rechits_Token_.

10 : CSCBaseValidation(inputTag),
11  theNPerEventPlot(nullptr)
12 {
14 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CSCRecHit2DCollection > rechits_Token_
CSCBaseValidation(const edm::InputTag &inputTag)
MonitorElement * theNPerEventPlot
CSCRecHit2DValidation::~CSCRecHit2DValidation ( )
override

Definition at line 16 of file CSCRecHit2DValidation.cc.

References MonitorElement::getMean(), MonitorElement::getName(), MonitorElement::getRMS(), mps_fire::i, theResolutionPlots, and theTPeaks.

17 {
18  for(int i = 0; i < 10; ++i)
19  {
20  edm::LogInfo("CSCRecHitValidation") << "Resolution of " << theResolutionPlots[i]->getName() << " is " << theResolutionPlots[i]->getRMS();
21  edm::LogInfo("CSCRecHitValidation") << "Peak Time is " << theTPeaks[i]->getMean();
22  }
23 }
const std::string & getName() const
get name of ME
MonitorElement * theResolutionPlots[10]
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * theTPeaks[10]

Member Function Documentation

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

Implements CSCBaseValidation.

Definition at line 53 of file CSCRecHit2DValidation.cc.

References CSCLayer::chamber(), CSCChamberSpecs::chamberType(), PSimHitMap::detsWithHits(), MonitorElement::Fill(), CSCBaseValidation::findLayer(), edm::Event::getByToken(), PSimHitMap::hits(), mps_fire::i, phase1PixelTopology::localX(), phase1PixelTopology::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().

Referenced by CSCRecHitValidation::analyze().

54 {
55  // get the collection of CSCRecHrecHitItrD
57  e.getByToken(rechits_Token_, hRecHits);
58  const CSCRecHit2DCollection * cscRecHits = hRecHits.product();
59 
60  unsigned nPerEvent = 0;
61 
62  for(CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin();
63  recHitItr != cscRecHits->end(); recHitItr++)
64  {
65  ++nPerEvent;
66  int detId = (*recHitItr).cscDetId().rawId();
68  const CSCLayer * layer = findLayer(detId);
69  int chamberType = layer->chamber()->specs()->chamberType();
70  theTPeaks[chamberType-1]->Fill(recHitItr->tpeak());
71  if(simHits.size() == 1)
72  {
73  plotResolution(simHits[0], *recHitItr, layer, chamberType);
74  }
75  float localX = recHitItr->localPosition().x();
76  float localY = recHitItr->localPosition().y();
77  //theYPlots[chamberType-1]->Fill(localY);
78  // find a local phi
79  float globalR = layer->toGlobal(LocalPoint(0.,0.,0.)).perp();
80  GlobalPoint axisThruChamber(globalR+localY, localX, 0.);
81  float localPhi = axisThruChamber.phi().degrees();
82  //thePhiPlots[chamberType-1]->Fill(axisThruChamber.phi().degrees());
83  theScatterPlots[chamberType-1]->Fill( localPhi, localY);
84  }
85  theNPerEventPlot->Fill(nPerEvent);
86 return;
87  // fill sim hits
88  std::vector<int> layersWithSimHits = theSimHitMap->detsWithHits();
89  for(unsigned i = 0; i < layersWithSimHits.size(); ++i)
90  {
91  edm::PSimHitContainer simHits = theSimHitMap->hits(layersWithSimHits[i]);
92  for(edm::PSimHitContainer::const_iterator hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr)
93  {
94  const CSCLayer * layer = findLayer(layersWithSimHits[i]);
95  int chamberType = layer->chamber()->specs()->chamberType();
96  float localX = hitItr->localPosition().x();
97  float localY = hitItr->localPosition().y();
98  //theYPlots[chamberType-1]->Fill(localY);
99  // find a local phi
100  float globalR = layer->toGlobal(LocalPoint(0.,0.,0.)).perp();
101  GlobalPoint axisThruChamber(globalR+localY, localX, 0.);
102  float localPhi = axisThruChamber.phi().degrees();
103  //thePhiPlots[chamberType-1]->Fill(axisThruChamber.phi().degrees());
104  theSimHitScatterPlots[chamberType-1]->Fill( localPhi, localY);
105  }
106  }
107 
108 }
MonitorElement * theSimHitScatterPlots[10]
MonitorElement * theScatterPlots[10]
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
T perp() const
Definition: PV3DBase.h:72
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:579
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
constexpr uint16_t localY(uint16_t py)
void Fill(long long x)
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
const PSimHitMap * theSimHitMap
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:22
std::vector< int > detsWithHits() const
Definition: PSimHitMap.cc:37
T const * product() const
Definition: Handle.h:81
int chamberType() const
constexpr uint16_t localX(uint16_t px)
MonitorElement * theNPerEventPlot
MonitorElement * theTPeaks[10]
std::vector< PSimHit > PSimHitContainer
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayer * findLayer(int detId) const
void CSCRecHit2DValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 25 of file CSCRecHit2DValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), mps_fire::i, theNPerEventPlot, thePullPlots, theRecHitPosInStrip, theResolutionPlots, theScatterPlots, theSimHitPosInStrip, theSimHitScatterPlots, theTPeaks, theYPullPlots, and theYResolutionPlots.

Referenced by CSCRecHitValidation::bookHistograms().

26 {
27  theNPerEventPlot = iBooker.book1D("CSCRecHitsPerEvent", "Number of CSC Rec Hits per event", 100, 0, 500);
28  for(int i = 0; i < 10; ++i)
29  {
30  char title1[200], title2[200], title3[200], title4[200], title5[200], title6[200], title7[200], title8[200], title9[200];
31  sprintf(title1, "CSCRecHitResolution%d", i+1);
32  sprintf(title2, "CSCRecHitPull%d", i+1);
33  sprintf(title3, "CSCRecHitYResolution%d", i+1);
34  sprintf(title4, "CSCRecHitYPull%d", i+1);
35  sprintf(title5, "CSCRecHitPosInStrip%d", i+1);
36  sprintf(title6, "CSCSimHitPosInStrip%d", i+1);
37  sprintf(title7, "CSCRecHit%d", i+1);
38  sprintf(title8, "CSCSimHit%d", i+1);
39  sprintf(title9, "CSCTPeak%d", i+1);
40 
41  theResolutionPlots[i] = iBooker.book1D(title1, title1, 100, -0.2, 0.2);
42  thePullPlots[i] = iBooker.book1D(title2, title2, 100, -3, 3);
43  theYResolutionPlots[i] = iBooker.book1D(title3, title3, 100, -5, 5);
44  theYPullPlots[i] = iBooker.book1D(title4, title4, 100, -3, 3);
45  theRecHitPosInStrip[i] = iBooker.book1D(title5, title5, 100, -2, 2);
46  theSimHitPosInStrip[i] = iBooker.book1D(title6, title6, 100, -2, 2);
47  theScatterPlots[i] = iBooker.book2D(title7, title7, 200, -20, 20, 200, -250, 250);
48  theSimHitScatterPlots[i] = iBooker.book2D(title8, title8, 200, -20, 20, 200, -250, 250);
49  theTPeaks[i] = iBooker.book1D(title9, title9, 200, 0, 400);
50  }
51 }
MonitorElement * theSimHitScatterPlots[10]
MonitorElement * theYResolutionPlots[10]
MonitorElement * theScatterPlots[10]
MonitorElement * theResolutionPlots[10]
MonitorElement * theSimHitPosInStrip[10]
MonitorElement * theYPullPlots[10]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * theNPerEventPlot
MonitorElement * thePullPlots[10]
MonitorElement * theRecHitPosInStrip[10]
MonitorElement * theTPeaks[10]
void CSCRecHit2DValidation::plotResolution ( const PSimHit simHit,
const CSCRecHit2D recHit,
const CSCLayer layer,
int  chamberType 
)
private

Definition at line 110 of file CSCRecHit2DValidation.cc.

References PVValHelper::dy, 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().

112 {
113  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
114  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
115 
116  double dphi = recHitPos.phi() - simHitPos.phi();
117  double rdphi = recHitPos.perp() * dphi;
118  theResolutionPlots[chamberType-1]->Fill( rdphi );
119  thePullPlots[chamberType-1]->Fill( rdphi/ sqrt(recHit.localPositionError().xx()) );
120  double dy = recHit.localPosition().y() - simHit.localPosition().y();
121  theYResolutionPlots[chamberType-1]->Fill( dy );
122  theYPullPlots[chamberType-1]->Fill( dy/ sqrt(recHit.localPositionError().yy()) );
123 
124  const CSCLayerGeometry * layerGeometry = layer->geometry();
125  float recStrip = layerGeometry->strip(recHit.localPosition());
126  float simStrip = layerGeometry->strip(simHit.localPosition());
127  theRecHitPosInStrip[chamberType-1]->Fill( recStrip - int(recStrip) );
128  theSimHitPosInStrip[chamberType-1]->Fill( simStrip - int(simStrip) );
129 }
MonitorElement * theYResolutionPlots[10]
float xx() const
Definition: LocalError.h:24
T perp() const
Definition: PV3DBase.h:72
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:50
MonitorElement * theResolutionPlots[10]
void Fill(long long x)
MonitorElement * theSimHitPosInStrip[10]
MonitorElement * theYPullPlots[10]
float yy() const
Definition: LocalError.h:26
Local3DPoint localPosition() const
Definition: PSimHit.h:44
T sqrt(T t)
Definition: SSEVec.h:18
float strip(const LocalPoint &lp) const
LocalError localPositionError() const override
Definition: CSCRecHit2D.h:51
MonitorElement * thePullPlots[10]
MonitorElement * theRecHitPosInStrip[10]
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47

Member Data Documentation

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

Definition at line 23 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and CSCRecHit2DValidation().

MonitorElement* CSCRecHit2DValidation::theNPerEventPlot
private

Definition at line 28 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::thePullPlots[10]
private

Definition at line 30 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theRecHitPosInStrip[10]
private

Definition at line 35 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theResolutionPlots[10]
private

Definition at line 29 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), plotResolution(), and ~CSCRecHit2DValidation().

MonitorElement* CSCRecHit2DValidation::theScatterPlots[10]
private

Definition at line 33 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::theSimHitPosInStrip[10]
private

Definition at line 36 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theSimHitScatterPlots[10]
private

Definition at line 34 of file CSCRecHit2DValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCRecHit2DValidation::theTPeaks[10]
private

Definition at line 37 of file CSCRecHit2DValidation.h.

Referenced by analyze(), bookHistograms(), and ~CSCRecHit2DValidation().

MonitorElement* CSCRecHit2DValidation::theYPullPlots[10]
private

Definition at line 32 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCRecHit2DValidation::theYResolutionPlots[10]
private

Definition at line 31 of file CSCRecHit2DValidation.h.

Referenced by bookHistograms(), and plotResolution().