CMS 3D CMS Logo

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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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, nsubdetectorscpuValidRecHits
 
std::array< ValidHitCollection, nsubdetectorsdiffsValidRecHits
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordestokenGeom_
 
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, nsubdetectorsestokens_
 
std::array< ValidHitCollection, nsubdetectorsgpuValidRecHits
 
std::array< std::string, nsubdetectorshandles_str_
 
hgcal::RecHitTools recHitTools_
 
std::array< std::array< edm::EDGetTokenT< HGChefRecHitCollection >, ncomputingdevices >, nsubdetectorstokens_
 
std::array< std::string, nsubdetectorstreenames_
 
std::array< TTree *, nsubdetectorstrees_
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file HeterogeneousHGCalRecHitsValidator.h.

Constructor & Destructor Documentation

◆ HeterogeneousHGCalRecHitsValidator()

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

Definition at line 3 of file HeterogeneousHGCalRecHitsValidator.cc.

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"))}}}}),
10  treenames_({{"CEE", "CHSi", "CHSci"}}) {
11  usesResource(TFileService::kSharedResource);
12  estokenGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
14  for (unsigned i(0); i < nsubdetectors; ++i) {
15  estokens_[i] = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", handles_str_[i]});
16  trees_[i] = fs->make<TTree>(treenames_[i].c_str(), treenames_[i].c_str());
17  trees_[i]->Branch("cpu", "ValidHitCollection", &cpuValidRecHits[i]);
18  trees_[i]->Branch("gpu", "ValidHitCollection", &gpuValidRecHits[i]);
19  trees_[i]->Branch("diffs", "ValidHitCollection", &diffsValidRecHits[i]);
20  }
21 }

References edm::ParameterSet::getParameter().

◆ ~HeterogeneousHGCalRecHitsValidator()

HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator ( )
override

Definition at line 23 of file HeterogeneousHGCalRecHitsValidator.cc.

23 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 31 of file HeterogeneousHGCalRecHitsValidator.cc.

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 }

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

◆ endJob()

void HeterogeneousHGCalRecHitsValidator::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 25 of file HeterogeneousHGCalRecHitsValidator.cc.

25 {}

◆ set_geometry_()

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

Definition at line 27 of file HeterogeneousHGCalRecHitsValidator.cc.

27  {
29 }

References estokens_, patZpeak::handle, and singleTopDQM_cfi::setup.

Referenced by analyze().

Member Data Documentation

◆ cpuValidRecHits

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

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ diffsValidRecHits

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

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ estokenGeom_

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

Definition at line 47 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ estokens_

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

Definition at line 46 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by set_geometry_().

◆ gpuValidRecHits

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

Definition at line 55 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ handles_str_

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

Definition at line 49 of file HeterogeneousHGCalRecHitsValidator.h.

◆ ncomputingdevices

const unsigned HeterogeneousHGCalRecHitsValidator::ncomputingdevices = 2
staticprivate

Definition at line 43 of file HeterogeneousHGCalRecHitsValidator.h.

◆ nsubdetectors

const unsigned HeterogeneousHGCalRecHitsValidator::nsubdetectors = 3
staticprivate

Definition at line 42 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ recHitTools_

hgcal::RecHitTools HeterogeneousHGCalRecHitsValidator::recHitTools_
private

Definition at line 51 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ tokens_

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

Definition at line 45 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ treenames_

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

Definition at line 54 of file HeterogeneousHGCalRecHitsValidator.h.

◆ trees_

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

Definition at line 53 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
CaloRecHit::energy
constexpr float energy() const
Definition: CaloRecHit.h:29
HeterogeneousHGCalRecHitsValidator::trees_
std::array< TTree *, nsubdetectors > trees_
Definition: HeterogeneousHGCalRecHitsValidator.h:53
patZpeak.handle
handle
Definition: patZpeak.py:23
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HeterogeneousHGCalRecHitsValidator::tokens_
std::array< std::array< edm::EDGetTokenT< HGChefRecHitCollection >, ncomputingdevices >, nsubdetectors > tokens_
Definition: HeterogeneousHGCalRecHitsValidator.h:45
cms::cuda::assert
assert(be >=bs)
HeterogeneousHGCalRecHitsValidator::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: HeterogeneousHGCalRecHitsValidator.h:51
CaloRecHit::detid
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
HeterogeneousHGCalRecHitsValidator::diffsValidRecHits
std::array< ValidHitCollection, nsubdetectors > diffsValidRecHits
Definition: HeterogeneousHGCalRecHitsValidator.h:55
HGCRecHit::timeError
float timeError() const
Definition: HGCRecHit.cc:79
HeterogeneousHGCalRecHitsValidator::estokenGeom_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > estokenGeom_
Definition: HeterogeneousHGCalRecHitsValidator.h:47
HeterogeneousHGCalRecHitsValidator::gpuValidRecHits
std::array< ValidHitCollection, nsubdetectors > gpuValidRecHits
Definition: HeterogeneousHGCalRecHitsValidator.h:55
HeterogeneousHGCalRecHitsValidator::treenames_
std::array< std::string, nsubdetectors > treenames_
Definition: HeterogeneousHGCalRecHitsValidator.h:54
edm::ESHandle
Definition: DTSurvey.h:22
nhits
Definition: HIMultiTrackSelector.h:42
HeterogeneousHGCalRecHitsValidator::cpuValidRecHits
std::array< ValidHitCollection, nsubdetectors > cpuValidRecHits
Definition: HeterogeneousHGCalRecHitsValidator.h:55
CaloRecHit::time
constexpr float time() const
Definition: CaloRecHit.h:31
HGCRecHit
Definition: HGCRecHit.h:14
ValidHit
Definition: ValidHit.h:8
edm::Service< TFileService >
HeterogeneousHGCalRecHitsValidator::estokens_
std::array< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, nsubdetectors > estokens_
Definition: HeterogeneousHGCalRecHitsValidator.h:46
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
HGCalDetId
Definition: HGCalDetId.h:8
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
TFileService::kSharedResource
static const std::string kSharedResource
Definition: TFileService.h:76
HeterogeneousHGCalRecHitsValidator::nsubdetectors
static const unsigned nsubdetectors
Definition: HeterogeneousHGCalRecHitsValidator.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HeterogeneousHGCalRecHitsValidator::set_geometry_
void set_geometry_(const edm::EventSetup &, const unsigned &)
Definition: HeterogeneousHGCalRecHitsValidator.cc:27
HGCRecHit::signalOverSigmaNoise
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:72
HGCRecHit::flagBits
uint32_t flagBits() const
Definition: HGCRecHit.h:111
HeterogeneousHGCalRecHitsValidator::handles_str_
std::array< std::string, nsubdetectors > handles_str_
Definition: HeterogeneousHGCalRecHitsValidator.h:49
edm::InputTag
Definition: InputTag.h:15