CMS 3D CMS Logo

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

#include <SiPixelPhase1RecHitsV.h>

Inheritance diagram for SiPixelPhase1RecHitsV:
SiPixelPhase1Base DQMEDAnalyzer HistogramManagerHolder edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelPhase1RecHitsV (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from SiPixelPhase1Base
void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override=0
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &iSetup) override
 
 SiPixelPhase1Base (const edm::ParameterSet &iConfig)
 
 ~SiPixelPhase1Base () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 
- Public Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig)
 

Private Types

enum  {
  IN_TIME_BUNCH, OUT_TIME_BUNCH, NSIMHITS, RECHIT_X,
  RECHIT_Y, RES_X, RES_Y, ERROR_X,
  ERROR_Y, PULL_X, PULL_Y
}
 

Private Attributes

edm::EDGetTokenT< SiPixelRecHitCollectionsrcToken_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from SiPixelPhase1Base
enum  { DCS }
 
- Protected Member Functions inherited from SiPixelPhase1Base
bool checktrigger (const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
- Protected Attributes inherited from HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Detailed Description

Definition at line 16 of file SiPixelPhase1RecHitsV.h.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

SiPixelPhase1RecHitsV::SiPixelPhase1RecHitsV ( const edm::ParameterSet conf)
explicit

Definition at line 19 of file SiPixelPhase1RecHitsV.cc.

19  :
20  SiPixelPhase1Base(iConfig),
22  srcToken_ ( consumes<SiPixelRecHitCollection>(iConfig.getParameter<edm::InputTag>("src")) )
23 {}
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< SiPixelRecHitCollection > srcToken_
TrackerHitAssociator::Config trackerHitAssociatorConfig_

Member Function Documentation

void SiPixelPhase1RecHitsV::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 25 of file SiPixelPhase1RecHitsV.cc.

References funct::abs(), TrackerHitAssociator::associateHit(), edmNew::DetSetVector< T >::begin(), EncodedEventId::bunchCrossing(), DEFINE_FWK_MODULE, edmNew::DetSetVector< T >::end(), PSimHit::entryPoint(), ERROR_X, ERROR_Y, EncodedEventId::event(), PSimHit::eventId(), PSimHit::exitPoint(), edm::Event::getByToken(), HistogramManagerHolder::histo, IN_TIME_BUNCH, input, edm::HandleBase::isValid(), funct::m, NSIMHITS, OUT_TIME_BUNCH, PULL_X, PULL_Y, RECHIT_X, RECHIT_Y, RES_X, RES_Y, rpcPointValidation_cfi::simHit, mathSSE::sqrt(), srcToken_, trackerHitAssociatorConfig_, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

25  {
27  iEvent.getByToken(srcToken_, input);
28  if (!input.isValid()) return;
29 
31 
33  for (it = input->begin(); it != input->end(); ++it) {
34  auto id = DetId(it->detId());
35 
36  for(SiPixelRecHit const& rechit : *it) {
37  SiPixelRecHit::ClusterRef const& clust = rechit.cluster();
38 
39  std::vector<PSimHit> associateSimHit;
40  associateSimHit = associate.associateHit(rechit);
41  std::vector<PSimHit>::const_iterator closestIt = associateSimHit.begin();
42 
43  LocalPoint lp = rechit.localPosition();
44  float rechit_x = lp.x();
45  float rechit_y = lp.y();
46 
47  LocalError lerr = rechit.localPositionError();
48  float lerr_x = sqrt(lerr.xx());
49  float lerr_y = sqrt(lerr.yy());
50 
51  // loop over associated sim hits and find the closest
52  if ( !associateSimHit.empty() ) {
53  float closestSimHit = 9999.9;
54 
55  for (std::vector<PSimHit>::const_iterator m = associateSimHit.begin(); m < associateSimHit.end(); m++) {
56  float sim_x1 ( (*m).entryPoint().x() ), sim_x2 ( (*m).exitPoint().x() ), sim_xpos ( 0.5*(sim_x1+sim_x2) );
57  float sim_y1 ( (*m).entryPoint().y() ), sim_y2 ( (*m).exitPoint().y() ), sim_ypos ( 0.5*(sim_y1+sim_y2) );
58 
59  float xres ( std::abs(sim_xpos - rechit_x) ), yres ( std::abs(sim_ypos - rechit_y) );
60  float dist = std::sqrt( xres*xres + yres*yres );
61 
62  if ( dist < closestSimHit ) {
63  closestSimHit = dist;
64  closestIt = m;
65  }
66  }
67  }
68 
69  // Sim Hit stuff
70 
71  if ( !associateSimHit.empty() ) {
72 
73  const PSimHit& simHit = *closestIt;
74 
75  int bunch = simHit.eventId().bunchCrossing();
76  int event = simHit.eventId().event();
77 
78  float sim_x1 ( simHit.entryPoint().x() ), sim_x2 ( simHit.exitPoint().x() ), sim_xpos ( 0.5*(sim_x1 + sim_x2) );
79  float sim_y1 ( simHit.entryPoint().y() ), sim_y2 ( simHit.exitPoint().y() ), sim_ypos ( 0.5*(sim_y1 + sim_y2) );
80 
81  float res_x = (rechit_x - sim_xpos) * 10000.0;
82  float res_y = (rechit_y - sim_ypos) * 10000.0;
83 
84  float pull_x = ( rechit_x - sim_xpos ) / lerr_x;
85  float pull_y = ( rechit_y - sim_ypos ) / lerr_y;
86 
87  // Now Plotting stuff
88  if ( bunch == 0 ) histo[IN_TIME_BUNCH].fill(bunch, id, &iEvent);
89  if ( bunch != 0 ) histo[OUT_TIME_BUNCH].fill(bunch, id, &iEvent);
90 
91  histo[NSIMHITS].fill(event, id, &iEvent);
92 
93  histo[RECHIT_X].fill(rechit_x, id, &iEvent);
94  histo[RECHIT_Y].fill(rechit_y, id, &iEvent);
95 
96  histo[RES_X].fill(res_x, id, &iEvent);
97  histo[RES_Y].fill(res_y, id, &iEvent);
98 
99  histo[ERROR_X].fill(lerr_x, id, &iEvent);
100  histo[ERROR_Y].fill(lerr_y, id, &iEvent);
101 
102  histo[PULL_X].fill(pull_x, id, &iEvent);
103  histo[PULL_Y].fill(pull_y, id, &iEvent);
104  }
105  }
106  }
107 }
float xx() const
Definition: LocalError.h:24
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
int event() const
get the contents of the subdetector field (should be protected?)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
T y() const
Definition: PV3DBase.h:63
static std::string const input
Definition: EdmProvDump.cc:44
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
int bunchCrossing() const
get the detector field from this detid
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< SiPixelRecHitCollection > srcToken_
EncodedEventId eventId() const
Definition: PSimHit.h:105
bool isValid() const
Definition: HandleBase.h:74
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Definition: DetId.h:18
std::vector< HistogramManager > histo
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
const_iterator begin(bool update=false) const
Definition: event.py:1
Our base class.
Definition: SiPixelRecHit.h:23

Member Data Documentation

edm::EDGetTokenT<SiPixelRecHitCollection> SiPixelPhase1RecHitsV::srcToken_
private

Definition at line 37 of file SiPixelPhase1RecHitsV.h.

Referenced by analyze().

TrackerHitAssociator::Config SiPixelPhase1RecHitsV::trackerHitAssociatorConfig_
private

Definition at line 36 of file SiPixelPhase1RecHitsV.h.

Referenced by analyze().