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
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
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
 
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 32 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);
13  for (unsigned i(0); i < nsubdetectors; ++i) {
14  trees_[i] = fs->make<TTree>(treenames_[i].c_str(), treenames_[i].c_str());
15  trees_[i]->Branch("cpu", "ValidHitCollection", &cpuValidRecHits[i]);
16  trees_[i]->Branch("gpu", "ValidHitCollection", &gpuValidRecHits[i]);
17  trees_[i]->Branch("diffs", "ValidHitCollection", &diffsValidRecHits[i]);
18  }
19 }

References edm::ParameterSet::getParameter().

◆ ~HeterogeneousHGCalRecHitsValidator()

HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator ( )
override

Definition at line 21 of file HeterogeneousHGCalRecHitsValidator.cc.

21 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 30 of file HeterogeneousHGCalRecHitsValidator.cc.

30  {
32  setup.get<CaloGeometryRecord>().get(baseGeom);
33  recHitTools_.setGeometry(*baseGeom);
34 
35  //future subdetector loop
36  for (size_t idet = 0; idet < nsubdetectors; ++idet) {
37  set_geometry_(setup, idet);
38 
39  //get hits produced with the CPU
40  const auto &cpuhits = event.get(tokens_[idet][0]);
41 
42  //get hits produced with the GPU
43  const auto &gpuhits = event.get(tokens_[idet][1]);
44 
45  size_t nhits = cpuhits.size();
46  std::cout << nhits << ", " << gpuhits.size() << std::endl;
47  assert(nhits == gpuhits.size());
48  //float sum_cpu = 0.f, sum_gpu = 0.f, sum_son_cpu = 0.f, sum_son_gpu = 0.f;
49  for (unsigned i(0); i < nhits; i++) {
50  const HGCRecHit &cpuHit = cpuhits[i];
51  const HGCRecHit &gpuHit = gpuhits[i];
52 
53  const float cpuEn = cpuHit.energy();
54  const float gpuEn = gpuHit.energy();
55  //sum_cpu += cpuEn; sum_gpu += gpuEn;
56 
57  const float cpuTime = cpuHit.time();
58  const float gpuTime = gpuHit.time();
59  const float cpuTimeErr = cpuHit.timeError();
60  const float gpuTimeErr = gpuHit.timeError();
61  const HGCalDetId cpuDetId = cpuHit.detid();
62  const HGCalDetId gpuDetId = gpuHit.detid();
63  const float cpuFB = cpuHit.flagBits();
64  const float gpuFB = gpuHit.flagBits();
65  const float cpuSoN = cpuHit.signalOverSigmaNoise();
66  const float gpuSoN = gpuHit.signalOverSigmaNoise();
67  //sum_son_cpu += cpuSoN; sum_son_gpu += gpuSoN;
68 
69  ValidHit vCPU(cpuEn, cpuTime, cpuTimeErr, cpuDetId, cpuFB, cpuSoN);
70  ValidHit vGPU(gpuEn, gpuTime, gpuTimeErr, gpuDetId, gpuFB, gpuSoN);
71  ValidHit vDiffs(cpuEn - gpuEn,
72  cpuTime - gpuTime,
73  cpuTimeErr - gpuTimeErr,
74  cpuDetId - gpuDetId,
75  cpuFB - gpuFB,
76  cpuSoN - gpuSoN);
77 
78  cpuValidRecHits[idet].push_back(vCPU);
79  gpuValidRecHits[idet].push_back(vGPU);
80  diffsValidRecHits[idet].push_back(vDiffs);
81  }
82  trees_[idet]->Fill();
83  }
84 }

References cms::cuda::assert(), gather_cfg::cout, cpuValidRecHits, CaloRecHit::detid(), diffsValidRecHits, CaloRecHit::energy(), HGCRecHit::flagBits(), get, 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 23 of file HeterogeneousHGCalRecHitsValidator.cc.

23 {}

◆ set_geometry_()

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

Member Data Documentation

◆ cpuValidRecHits

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

Definition at line 50 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ diffsValidRecHits

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

Definition at line 50 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ gpuValidRecHits

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

Definition at line 50 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 44 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by set_geometry_().

◆ ncomputingdevices

const unsigned HeterogeneousHGCalRecHitsValidator::ncomputingdevices = 2
staticprivate

Definition at line 41 of file HeterogeneousHGCalRecHitsValidator.h.

◆ nsubdetectors

const unsigned HeterogeneousHGCalRecHitsValidator::nsubdetectors = 3
staticprivate

Definition at line 40 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ recHitTools_

hgcal::RecHitTools HeterogeneousHGCalRecHitsValidator::recHitTools_
private

Definition at line 46 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ tokens_

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

Definition at line 43 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

◆ treenames_

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

Definition at line 49 of file HeterogeneousHGCalRecHitsValidator.h.

◆ trees_

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

Definition at line 48 of file HeterogeneousHGCalRecHitsValidator.h.

Referenced by analyze().

mps_fire.i
i
Definition: mps_fire.py:428
CaloRecHit::energy
constexpr float energy() const
Definition: CaloRecHit.h:29
HeterogeneousHGCalRecHitsValidator::trees_
std::array< TTree *, nsubdetectors > trees_
Definition: HeterogeneousHGCalRecHitsValidator.h:48
patZpeak.handle
handle
Definition: patZpeak.py:23
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HeterogeneousHGCalRecHitsValidator::tokens_
std::array< std::array< edm::EDGetTokenT< HGChefRecHitCollection >, ncomputingdevices >, nsubdetectors > tokens_
Definition: HeterogeneousHGCalRecHitsValidator.h:43
cms::cuda::assert
assert(be >=bs)
HeterogeneousHGCalRecHitsValidator::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: HeterogeneousHGCalRecHitsValidator.h:46
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:50
HGCRecHit::timeError
float timeError() const
Definition: HGCRecHit.cc:79
HeterogeneousHGCalRecHitsValidator::gpuValidRecHits
std::array< ValidHitCollection, nsubdetectors > gpuValidRecHits
Definition: HeterogeneousHGCalRecHitsValidator.h:50
HeterogeneousHGCalRecHitsValidator::treenames_
std::array< std::string, nsubdetectors > treenames_
Definition: HeterogeneousHGCalRecHitsValidator.h:49
edm::ESHandle< CaloGeometry >
nhits
Definition: HIMultiTrackSelector.h:42
HeterogeneousHGCalRecHitsValidator::cpuValidRecHits
std::array< ValidHitCollection, nsubdetectors > cpuValidRecHits
Definition: HeterogeneousHGCalRecHitsValidator.h:50
CaloRecHit::time
constexpr float time() const
Definition: CaloRecHit.h:31
HGCRecHit
Definition: HGCRecHit.h:14
ValidHit
Definition: ValidHit.h:8
edm::Service< TFileService >
get
#define get
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:40
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:25
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:44
edm::InputTag
Definition: InputTag.h:15
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64