CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
HcalTestSimHitID Class Reference
Inheritance diagram for HcalTestSimHitID:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HcalTestSimHitID (const edm::ParameterSet &ps)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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
 
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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void endJob () override
 
- 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>
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)
 
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)
 

Private Attributes

const bool dumpHits_
 
const std::string g4Label_
 
const std::string hitLab_
 
const int maxEvent_
 
int nevt_
 
const bool testN_
 
edm::EDGetTokenT< edm::PCaloHitContainertoks_calo_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Detailed Description

Definition at line 29 of file HcalTestSimHitID.cc.

Constructor & Destructor Documentation

◆ HcalTestSimHitID()

HcalTestSimHitID::HcalTestSimHitID ( const edm::ParameterSet ps)

Definition at line 48 of file HcalTestSimHitID.cc.

49  : g4Label_(ps.getUntrackedParameter<std::string>("moduleLabel", "g4SimHits")),
50  hitLab_(ps.getUntrackedParameter<std::string>("hcCollection", "HcalHits")),
51  testN_(ps.getUntrackedParameter<bool>("testNumbering", false)),
52  dumpHits_(ps.getUntrackedParameter<bool>("dumpHits", false)),
53  maxEvent_(ps.getUntrackedParameter<int>("maxEvent", 100)),
54  nevt_(0) {
55  // register for data access
56  toks_calo_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hitLab_));
57 
58  std::cout << "HcalTestSimHitID::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent: " << maxEvent_
59  << " Numbering scheme: " << testN_ << " (0 normal; 1 test)\n";
60 }

References gather_cfg::cout, g4Label_, hitLab_, maxEvent_, testN_, and toks_calo_.

Member Function Documentation

◆ analyze()

void HcalTestSimHitID::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Implements edm::EDAnalyzer.

Definition at line 72 of file HcalTestSimHitID.cc.

72  {
73  ++nevt_;
74  std::cout << "HcalTestSimHitID::Serial # " << nevt_ << " Run # " << e.id().run() << " Event # " << e.id().event()
75  << std::endl;
77  iS.get<HcalRecNumberingRecord>().get(pHRNDC);
78  const HcalDDDRecConstants* hcr = static_cast<const HcalDDDRecConstants*>(&(*pHRNDC));
80  iS.get<HcalRecNumberingRecord>().get(htopo);
81  const HcalTopology* theHBHETopology = htopo.product();
82 
83  if (nevt_ <= maxEvent_) {
84  std::vector<PCaloHit> hcHits;
86  e.getByToken(toks_calo_, hitsCalo);
87  if (hitsCalo.isValid()) {
88  std::vector<PCaloHit> hits;
89  hits.insert(hits.end(), hitsCalo->begin(), hitsCalo->end());
90  std::cout << "HcalValidation: Hit buffer " << hits.size() << std::endl;
91 
92  //Now the testing
93  unsigned int good(0);
94  for (unsigned int i = 0; i < hits.size(); i++) {
95  unsigned int id = hits[i].id();
96  HcalDetId hid;
97  if (testN_) {
98  hid = HcalDetId(HcalHitRelabeller::relabel(id, hcr));
99  } else {
100  hid = HcalDetId(id);
101  }
102  if (theHBHETopology->validHcal(hid)) {
103  ++good;
104  if (dumpHits_)
105  std::cout << "Hit[" << i << "] " << hid << " \n";
106  } else {
107  std::cout << "Hit[" << i << "] " << hid << " ***** ERROR *****\n";
108  }
109  }
110  std::cout << "HcalTestSimHitID:: " << good << " among " << hits.size() << " hits\n";
111  }
112  }
113 }

References gather_cfg::cout, dumpHits_, MillePedeFileConverter_cfg::e, edm::EventSetup::get(), get, hfClusterShapes_cfi::hits, mps_fire::i, edm::HandleBase::isValid(), maxEvent_, nevt_, edm::ESHandle< T >::product(), HcalHitRelabeller::relabel(), testN_, toks_calo_, and HcalTopology::validHcal().

◆ beginJob()

void HcalTestSimHitID::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file HcalTestSimHitID.cc.

36 {}

◆ endJob()

void HcalTestSimHitID::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file HcalTestSimHitID.cc.

37 {}

◆ fillDescriptions()

void HcalTestSimHitID::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 62 of file HcalTestSimHitID.cc.

62  {
64  desc.addUntracked<std::string>("moduleLabel", "g4SimHits");
65  desc.addUntracked<std::string>("hcCollection", "HcalHits");
66  desc.addUntracked<bool>("testNumbering", false);
67  desc.addUntracked<bool>("dumpHits", false);
68  desc.addUntracked<int>("maxEvent", 100);
69  descriptions.add("hcalGeometryDetIdTester", desc);
70 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ dumpHits_

const bool HcalTestSimHitID::dumpHits_
private

Definition at line 42 of file HcalTestSimHitID.cc.

Referenced by analyze().

◆ g4Label_

const std::string HcalTestSimHitID::g4Label_
private

Definition at line 41 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

◆ hitLab_

const std::string HcalTestSimHitID::hitLab_
private

Definition at line 41 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

◆ maxEvent_

const int HcalTestSimHitID::maxEvent_
private

Definition at line 43 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ nevt_

int HcalTestSimHitID::nevt_
private

Definition at line 44 of file HcalTestSimHitID.cc.

Referenced by analyze().

◆ testN_

const bool HcalTestSimHitID::testN_
private

Definition at line 42 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ toks_calo_

edm::EDGetTokenT<edm::PCaloHitContainer> HcalTestSimHitID::toks_calo_
private

Definition at line 45 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:355
HcalTestSimHitID::toks_calo_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
Definition: HcalTestSimHitID.cc:45
HcalTopology::validHcal
bool validHcal(const HcalDetId &id) const
Definition: HcalTopology.cc:230
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalTopology
Definition: HcalTopology.h:26
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalTestSimHitID::maxEvent_
const int maxEvent_
Definition: HcalTestSimHitID.cc:43
edm::Handle
Definition: AssociativeIterator.h:50
HcalTestSimHitID::dumpHits_
const bool dumpHits_
Definition: HcalTestSimHitID.cc:42
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HcalTestSimHitID::nevt_
int nevt_
Definition: HcalTestSimHitID.cc:44
edm::ESHandle
Definition: DTSurvey.h:22
HcalRecNumberingRecord
Definition: HcalRecNumberingRecord.h:23
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
HcalTestSimHitID::testN_
const bool testN_
Definition: HcalTestSimHitID.cc:42
HcalDetId
Definition: HcalDetId.h:12
get
#define get
HcalHitRelabeller::relabel
DetId relabel(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:49
HcalTestSimHitID::hitLab_
const std::string hitLab_
Definition: HcalTestSimHitID.cc:41
HcalDDDRecConstants
Definition: HcalDDDRecConstants.h:23
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HcalTestSimHitID::g4Label_
const std::string g4Label_
Definition: HcalTestSimHitID.cc:41
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37