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
 
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::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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = 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)
 

Private Attributes

const bool dumpHits_
 
const std::string g4Label_
 
const std::string hitLab_
 
const int maxEvent_
 
int nevt_
 
const bool testN_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordtok_geom_
 
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecordtok_hrdd_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordtok_topo_
 
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 33 of file HcalTestSimHitID.cc.

Constructor & Destructor Documentation

◆ HcalTestSimHitID()

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

Definition at line 55 of file HcalTestSimHitID.cc.

56  : g4Label_(ps.getUntrackedParameter<std::string>("moduleLabel", "g4SimHits")),
57  hitLab_(ps.getUntrackedParameter<std::string>("hcCollection", "HcalHits")),
58  testN_(ps.getUntrackedParameter<bool>("testNumbering", false)),
59  dumpHits_(ps.getUntrackedParameter<bool>("dumpHits", false)),
60  maxEvent_(ps.getUntrackedParameter<int>("maxEvent", 100)),
61  nevt_(0) {
62  // register for data access
63  toks_calo_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hitLab_));
64  tok_hrdd_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
65  tok_topo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
66  tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
67 
68  std::cout << "HcalTestSimHitID::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent: " << maxEvent_
69  << " Numbering scheme: " << testN_ << " (0 normal; 1 test)\n";
70 }

References gather_cfg::cout, g4Label_, hitLab_, maxEvent_, testN_, tok_geom_, tok_hrdd_, tok_topo_, 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 82 of file HcalTestSimHitID.cc.

82  {
83  ++nevt_;
84  std::cout << "HcalTestSimHitID::Serial # " << nevt_ << " Run # " << e.id().run() << " Event # " << e.id().event()
85  << std::endl;
86  edm::ESHandle<HcalDDDRecConstants> pHRNDC = iS.getHandle(tok_hrdd_);
87  const HcalDDDRecConstants* hcr = pHRNDC.product();
88  edm::ESHandle<HcalTopology> htopo = iS.getHandle(tok_topo_);
89  const HcalTopology* theHBHETopology = htopo.product();
91  const CaloGeometry* caloGeom = geom.product();
92  const HcalGeometry* hcalGeom =
93  static_cast<const HcalGeometry*>(caloGeom->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
94 
95  if (nevt_ <= maxEvent_) {
96  std::vector<PCaloHit> hcHits;
98  e.getByToken(toks_calo_, hitsCalo);
99  if (hitsCalo.isValid()) {
100  std::vector<PCaloHit> hits;
101  hits.insert(hits.end(), hitsCalo->begin(), hitsCalo->end());
102  std::cout << "HcalValidation: Hit buffer " << hits.size() << std::endl;
103 
104  //Now the testing
105  unsigned int good(0);
106  for (unsigned int i = 0; i < hits.size(); i++) {
107  unsigned int id = hits[i].id();
108  HcalDetId hid;
109  GlobalPoint p1, p2;
110  if (testN_) {
111  p1 = hcalGeom->getPosition(id, true);
112  hid = HcalDetId(HcalHitRelabeller::relabel(id, hcr));
113  } else {
114  hid = HcalDetId(id);
115  }
116  p2 = hcalGeom->getPosition(DetId(hid));
117  if (theHBHETopology->validHcal(hid)) {
118  ++good;
119  if (dumpHits_) {
120  std::cout << "Hit[" << i << "] " << hid << " \n";
121  if (testN_)
122  std::cout << "Test " << p1 << " from HcalDetId " << p2 << "\n";
123  }
124  } else {
125  std::cout << "Hit[" << i << "] " << hid << " ***** ERROR *****\n";
126  }
127  }
128  std::cout << "HcalTestSimHitID:: " << good << " among " << hits.size() << " hits\n";
129  }
130  }
131 }

References gather_cfg::cout, dumpHits_, MillePedeFileConverter_cfg::e, relativeConstraints::geom, edm::EventSetup::getHandle(), HcalGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalBarrel, hfClusterShapes_cfi::hits, mps_fire::i, edm::HandleBase::isValid(), maxEvent_, nevt_, p1, p2, edm::ESHandle< T >::product(), HcalHitRelabeller::relabel(), testN_, tok_geom_, tok_hrdd_, tok_topo_, toks_calo_, and HcalTopology::validHcal().

◆ beginJob()

void HcalTestSimHitID::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 40 of file HcalTestSimHitID.cc.

40 {}

◆ endJob()

void HcalTestSimHitID::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 41 of file HcalTestSimHitID.cc.

41 {}

◆ fillDescriptions()

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

Definition at line 72 of file HcalTestSimHitID.cc.

72  {
74  desc.addUntracked<std::string>("moduleLabel", "g4SimHits");
75  desc.addUntracked<std::string>("hcCollection", "HcalHits");
76  desc.addUntracked<bool>("testNumbering", false);
77  desc.addUntracked<bool>("dumpHits", false);
78  desc.addUntracked<int>("maxEvent", 100);
79  descriptions.add("hcalTestSimHitID", desc);
80 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ dumpHits_

const bool HcalTestSimHitID::dumpHits_
private

Definition at line 46 of file HcalTestSimHitID.cc.

Referenced by analyze().

◆ g4Label_

const std::string HcalTestSimHitID::g4Label_
private

Definition at line 45 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

◆ hitLab_

const std::string HcalTestSimHitID::hitLab_
private

Definition at line 45 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

◆ maxEvent_

const int HcalTestSimHitID::maxEvent_
private

Definition at line 47 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ nevt_

int HcalTestSimHitID::nevt_
private

Definition at line 48 of file HcalTestSimHitID.cc.

Referenced by analyze().

◆ testN_

const bool HcalTestSimHitID::testN_
private

Definition at line 46 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ tok_geom_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HcalTestSimHitID::tok_geom_
private

Definition at line 52 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ tok_hrdd_

edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> HcalTestSimHitID::tok_hrdd_
private

Definition at line 50 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ tok_topo_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HcalTestSimHitID::tok_topo_
private

Definition at line 51 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

◆ toks_calo_

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

Definition at line 49 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:428
HcalTestSimHitID::toks_calo_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
Definition: HcalTestSimHitID.cc:49
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
DetId::Hcal
Definition: DetId.h:28
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalBarrel
Definition: HcalAssistant.h:33
HcalTestSimHitID::maxEvent_
const int maxEvent_
Definition: HcalTestSimHitID.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
HcalTestSimHitID::dumpHits_
const bool dumpHits_
Definition: HcalTestSimHitID.cc:46
HcalTestSimHitID::tok_topo_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_topo_
Definition: HcalTestSimHitID.cc:51
DetId
Definition: DetId.h:17
CaloGeometry
Definition: CaloGeometry.h:21
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HcalTestSimHitID::nevt_
int nevt_
Definition: HcalTestSimHitID.cc:48
edm::ESHandle
Definition: DTSurvey.h:22
p2
double p2[4]
Definition: TauolaWrapper.h:90
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalTestSimHitID::tok_hrdd_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_hrdd_
Definition: HcalTestSimHitID.cc:50
HcalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HcalGeometry.cc:179
HcalTestSimHitID::testN_
const bool testN_
Definition: HcalTestSimHitID.cc:46
HcalDetId
Definition: HcalDetId.h:12
p1
double p1[4]
Definition: TauolaWrapper.h:89
HcalHitRelabeller::relabel
DetId relabel(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:49
HcalTestSimHitID::tok_geom_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Definition: HcalTestSimHitID.cc:52
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HcalTestSimHitID::hitLab_
const std::string hitLab_
Definition: HcalTestSimHitID.cc:45
HcalDDDRecConstants
Definition: HcalDDDRecConstants.h:23
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HcalGeometry
Definition: HcalGeometry.h:17
HcalTestSimHitID::g4Label_
const std::string g4Label_
Definition: HcalTestSimHitID.cc:45
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37