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 | Static Private Attributes
HeterogeneousHGCalRecHitsValidator Class Reference

#include <HeterogeneousHGCalRecHitsValidator.h>

Inheritance diagram for HeterogeneousHGCalRecHitsValidator:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 
 HeterogeneousHGCalRecHitsValidator (const edm::ParameterSet &)
 
 ~HeterogeneousHGCalRecHitsValidator () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void set_geometry_ (const edm::EventSetup &, const unsigned &)
 

Private Attributes

std::array< ValidHitCollection,
nsubdetectors
cpuValidRecHits
 
std::array< ValidHitCollection,
nsubdetectors
diffsValidRecHits
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
estokenGeom_
 
std::array< edm::ESGetToken
< HGCalGeometry,
IdealGeometryRecord >
, nsubdetectors
estokens_
 
std::array< ValidHitCollection,
nsubdetectors
gpuValidRecHits
 
std::array< std::string,
nsubdetectors
handles_str_
 
hgcal::RecHitTools recHitTools_
 
std::array< std::array
< edm::EDGetTokenT
< HGChefRecHitCollection >
, ncomputingdevices >
, nsubdetectors
tokens_
 
std::array< std::string,
nsubdetectors
treenames_
 
std::array< TTree
*, nsubdetectors
trees_
 

Static Private Attributes

static const unsigned ncomputingdevices = 2
 
static const unsigned nsubdetectors = 3
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 34 of file HeterogeneousHGCalRecHitsValidator.h.

Constructor & Destructor Documentation

HeterogeneousHGCalRecHitsValidator::HeterogeneousHGCalRecHitsValidator ( const edm::ParameterSet ps)
explicit

Definition at line 3 of file HeterogeneousHGCalRecHitsValidator.cc.

References edm::ParameterSet::getParameter().

4  : tokens_({{{{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsEEToken")),
5  consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsEEToken"))}},
6  {{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsHSiToken")),
7  consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsHSiToken"))}},
8  {{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsHSciToken")),
9  consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsHSciToken"))}}}}),
std::array< std::array< edm::EDGetTokenT< HGChefRecHitCollection >, ncomputingdevices >, nsubdetectors > tokens_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator ( )
override

Definition at line 23 of file HeterogeneousHGCalRecHitsValidator.cc.

23 {}

Member Function Documentation

void HeterogeneousHGCalRecHitsValidator::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 31 of file HeterogeneousHGCalRecHitsValidator.cc.

References cms::cuda::assert(), gather_cfg::cout, cpuValidRecHits, CaloRecHit::detid(), diffsValidRecHits, CaloRecHit::energy(), estokenGeom_, HGCRecHit::flagBits(), edm::EventSetup::getData(), gpuValidRecHits, mps_fire::i, nhits, nsubdetectors, recHitTools_, set_geometry_(), hgcal::RecHitTools::setGeometry(), HGCRecHit::signalOverSigmaNoise(), CaloRecHit::time(), HGCRecHit::timeError(), and tokens_.

31  {
33 
34  //future subdetector loop
35  for (size_t idet = 0; idet < nsubdetectors; ++idet) {
36  set_geometry_(setup, idet);
37 
38  //get hits produced with the CPU
39  const auto &cpuhits = event.get(tokens_[idet][0]);
40 
41  //get hits produced with the GPU
42  const auto &gpuhits = event.get(tokens_[idet][1]);
43 
44  size_t nhits = cpuhits.size();
45  std::cout << nhits << ", " << gpuhits.size() << std::endl;
46  assert(nhits == gpuhits.size());
47  //float sum_cpu = 0.f, sum_gpu = 0.f, sum_son_cpu = 0.f, sum_son_gpu = 0.f;
48  for (unsigned i(0); i < nhits; i++) {
49  const HGCRecHit &cpuHit = cpuhits[i];
50  const HGCRecHit &gpuHit = gpuhits[i];
51 
52  const float cpuEn = cpuHit.energy();
53  const float gpuEn = gpuHit.energy();
54  //sum_cpu += cpuEn; sum_gpu += gpuEn;
55 
56  const float cpuTime = cpuHit.time();
57  const float gpuTime = gpuHit.time();
58  const float cpuTimeErr = cpuHit.timeError();
59  const float gpuTimeErr = gpuHit.timeError();
60  const HGCalDetId cpuDetId = cpuHit.detid();
61  const HGCalDetId gpuDetId = gpuHit.detid();
62  const float cpuFB = cpuHit.flagBits();
63  const float gpuFB = gpuHit.flagBits();
64  const float cpuSoN = cpuHit.signalOverSigmaNoise();
65  const float gpuSoN = gpuHit.signalOverSigmaNoise();
66  //sum_son_cpu += cpuSoN; sum_son_gpu += gpuSoN;
67 
68  ValidHit vCPU(cpuEn, cpuTime, cpuTimeErr, cpuDetId, cpuFB, cpuSoN);
69  ValidHit vGPU(gpuEn, gpuTime, gpuTimeErr, gpuDetId, gpuFB, gpuSoN);
70  ValidHit vDiffs(cpuEn - gpuEn,
71  cpuTime - gpuTime,
72  cpuTimeErr - gpuTimeErr,
73  cpuDetId - gpuDetId,
74  cpuFB - gpuFB,
75  cpuSoN - gpuSoN);
76 
77  cpuValidRecHits[idet].push_back(vCPU);
78  gpuValidRecHits[idet].push_back(vGPU);
79  diffsValidRecHits[idet].push_back(vDiffs);
80  }
81  trees_[idet]->Fill();
82  }
83 }
constexpr float energy() const
Definition: CaloRecHit.h:29
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
std::array< ValidHitCollection, nsubdetectors > cpuValidRecHits
assert(be >=bs)
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:72
bool getData(T &iHolder) const
Definition: EventSetup.h:122
float timeError() const
Definition: HGCRecHit.cc:79
std::array< std::array< edm::EDGetTokenT< HGChefRecHitCollection >, ncomputingdevices >, nsubdetectors > tokens_
std::array< TTree *, nsubdetectors > trees_
uint32_t flagBits() const
Definition: HGCRecHit.h:111
constexpr float time() const
Definition: CaloRecHit.h:31
void set_geometry_(const edm::EventSetup &, const unsigned &)
std::array< ValidHitCollection, nsubdetectors > gpuValidRecHits
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > estokenGeom_
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
tuple cout
Definition: gather_cfg.py:144
std::array< ValidHitCollection, nsubdetectors > diffsValidRecHits
void HeterogeneousHGCalRecHitsValidator::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 25 of file HeterogeneousHGCalRecHitsValidator.cc.

25 {}
void HeterogeneousHGCalRecHitsValidator::set_geometry_ ( const edm::EventSetup setup,
const unsigned &  detidx 
)
private

Definition at line 27 of file HeterogeneousHGCalRecHitsValidator.cc.

References estokens_, edm::EventSetup::getHandle(), and patZpeak::handle.

Referenced by analyze().

27  {
29 }
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, nsubdetectors > estokens_
tuple handle
Definition: patZpeak.py:25
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151

Member Data Documentation

std::array<ValidHitCollection, nsubdetectors> HeterogeneousHGCalRecHitsValidator::cpuValidRecHits
private

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

std::array<ValidHitCollection, nsubdetectors> HeterogeneousHGCalRecHitsValidator::diffsValidRecHits
private

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HeterogeneousHGCalRecHitsValidator::estokenGeom_
private

Definition at line 47 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

std::array<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>, nsubdetectors> HeterogeneousHGCalRecHitsValidator::estokens_
private

Definition at line 46 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by set_geometry_().

std::array<ValidHitCollection, nsubdetectors> HeterogeneousHGCalRecHitsValidator::gpuValidRecHits
private

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

std::array<std::string, nsubdetectors> HeterogeneousHGCalRecHitsValidator::handles_str_
private
Initial value:
= {
{"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}}

Definition at line 49 of file HeterogeneousHGCalRecHitsValidator.h.

const unsigned HeterogeneousHGCalRecHitsValidator::ncomputingdevices = 2
staticprivate

Definition at line 43 of file HeterogeneousHGCalRecHitsValidator.h.

const unsigned HeterogeneousHGCalRecHitsValidator::nsubdetectors = 3
staticprivate

Definition at line 42 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

hgcal::RecHitTools HeterogeneousHGCalRecHitsValidator::recHitTools_
private

Definition at line 51 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

std::array<std::array<edm::EDGetTokenT<HGChefRecHitCollection>, ncomputingdevices>, nsubdetectors> HeterogeneousHGCalRecHitsValidator::tokens_
private

Definition at line 45 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

std::array<std::string, nsubdetectors> HeterogeneousHGCalRecHitsValidator::treenames_
private

Definition at line 54 of file HeterogeneousHGCalRecHitsValidator.h.

std::array<TTree*, nsubdetectors> HeterogeneousHGCalRecHitsValidator::trees_
private

Definition at line 53 of file HeterogeneousHGCalRecHitsValidator.h.