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 | Static Public Member Functions | Protected Member Functions | Private Attributes
HcalTestSimHitID Class Reference
Inheritance diagram for HcalTestSimHitID:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 HcalTestSimHitID (const edm::ParameterSet &ps)
 
 ~HcalTestSimHitID () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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

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

Private Attributes

const bool dumpHits_
 
const std::string g4Label_
 
const std::string hitLab_
 
const int maxEvent_
 
int nevt_
 
const bool testN_
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
tok_geom_
 
const edm::ESGetToken
< HcalDDDRecConstants,
HcalRecNumberingRecord
tok_hrdd_
 
const edm::ESGetToken
< HcalTopology,
HcalRecNumberingRecord
tok_topo_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
toks_calo_
 

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file HcalTestSimHitID.cc.

Constructor & Destructor Documentation

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

Definition at line 54 of file HcalTestSimHitID.cc.

References g4Label_, hitLab_, HLT_FULL_cff::InputTag, maxEvent_, testN_, and toks_calo_.

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

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 81 of file HcalTestSimHitID.cc.

References dumpHits_, edm::EventID::event(), edm::Event::getByToken(), edm::EventSetup::getData(), HcalGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), good, DetId::Hcal, HcalBarrel, mps_fire::i, edm::EventBase::id(), edm::HandleBase::isValid(), maxEvent_, nevt_, fireworks::p1, fireworks::p2, HcalHitRelabeller::relabel(), edm::EventID::run(), testN_, tok_geom_, tok_hrdd_, tok_topo_, toks_calo_, and HcalTopology::validHcal().

81  {
82  ++nevt_;
83  edm::LogVerbatim("HcalSim") << "HcalTestSimHitID::Serial # " << nevt_ << " Run # " << e.id().run() << " Event # "
84  << e.id().event();
85  const HcalDDDRecConstants* hcr = &iS.getData(tok_hrdd_);
86  const HcalTopology* theHBHETopology = &iS.getData(tok_topo_);
87  const CaloGeometry* caloGeom = &iS.getData(tok_geom_);
88  const HcalGeometry* hcalGeom =
89  static_cast<const HcalGeometry*>(caloGeom->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
90 
91  if (nevt_ <= maxEvent_) {
92  std::vector<PCaloHit> hcHits;
94  e.getByToken(toks_calo_, hitsCalo);
95  if (hitsCalo.isValid()) {
96  std::vector<PCaloHit> hits;
97  hits.insert(hits.end(), hitsCalo->begin(), hitsCalo->end());
98  edm::LogVerbatim("HcalSim") << "HcalValidation: Hit buffer " << hits.size();
99 
100  //Now the testing
101  unsigned int good(0);
102  for (unsigned int i = 0; i < hits.size(); i++) {
103  unsigned int id = hits[i].id();
104  HcalDetId hid;
105  GlobalPoint p1, p2;
106  if (testN_) {
107  p1 = hcalGeom->getPosition(id, true);
108  hid = HcalDetId(HcalHitRelabeller::relabel(id, hcr));
109  } else {
110  hid = HcalDetId(id);
111  }
112  p2 = hcalGeom->getPosition(DetId(hid));
113  if (theHBHETopology->validHcal(hid)) {
114  ++good;
115  if (dumpHits_) {
116  edm::LogVerbatim("HcalSim") << "Hit[" << i << "] " << hid;
117  if (testN_)
118  edm::LogVerbatim("HcalSim") << "Test " << p1 << " from HcalDetId " << p2;
119  }
120  } else {
121  edm::LogVerbatim("HcalSim") << "Hit[" << i << "] " << hid << " ***** ERROR *****";
122  }
123  }
124  edm::LogVerbatim("HcalSim") << "\nHcalTestSimHitID:: " << good << " among " << hits.size() << " hits";
125  }
126  }
127 }
RunNumber_t run() const
Definition: EventID.h:38
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
EventNumber_t event() const
Definition: EventID.h:40
const TString p2
Definition: fwPaths.cc:13
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
bool validHcal(const HcalDetId &id) const
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_topo_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
const TString p1
Definition: fwPaths.cc:12
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_hrdd_
bool isValid() const
Definition: HandleBase.h:70
GlobalPoint getPosition(const DetId &id) const
Definition: DetId.h:17
auto const good
min quality of good
edm::EventID id() const
Definition: EventBase.h:59
DetId relabel(const uint32_t testId) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
void HcalTestSimHitID::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 39 of file HcalTestSimHitID.cc.

39 {}
void HcalTestSimHitID::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 40 of file HcalTestSimHitID.cc.

40 {}
void HcalTestSimHitID::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 71 of file HcalTestSimHitID.cc.

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

71  {
73  desc.addUntracked<std::string>("moduleLabel", "g4SimHits");
74  desc.addUntracked<std::string>("hcCollection", "HcalHits");
75  desc.addUntracked<bool>("testNumbering", false);
76  desc.addUntracked<bool>("dumpHits", false);
77  desc.addUntracked<int>("maxEvent", 100);
78  descriptions.add("hcalTestSimHitID", desc);
79 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const bool HcalTestSimHitID::dumpHits_
private

Definition at line 45 of file HcalTestSimHitID.cc.

Referenced by analyze().

const std::string HcalTestSimHitID::g4Label_
private

Definition at line 44 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

const std::string HcalTestSimHitID::hitLab_
private

Definition at line 44 of file HcalTestSimHitID.cc.

Referenced by HcalTestSimHitID().

const int HcalTestSimHitID::maxEvent_
private

Definition at line 46 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

int HcalTestSimHitID::nevt_
private

Definition at line 50 of file HcalTestSimHitID.cc.

Referenced by analyze().

const bool HcalTestSimHitID::testN_
private

Definition at line 45 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().

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

Definition at line 49 of file HcalTestSimHitID.cc.

Referenced by analyze().

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

Definition at line 47 of file HcalTestSimHitID.cc.

Referenced by analyze().

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

Definition at line 48 of file HcalTestSimHitID.cc.

Referenced by analyze().

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

Definition at line 51 of file HcalTestSimHitID.cc.

Referenced by analyze(), and HcalTestSimHitID().