CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
HGcalHitIdCheck Class Reference
Inheritance diagram for HGcalHitIdCheck:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

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

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 (edm::Event const &, edm::EventSetup const &) 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 std::string caloHitSource_
 
const std::string g4Label_
 
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecordgeomToken_
 
const std::string nameDetector_
 
const std::string nameSense_
 
const edm::EDGetTokenT< edm::PCaloHitContainertok_calo_
 
const int verbosity_
 

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 28 of file HGCalHitIdCheck.cc.

Constructor & Destructor Documentation

◆ HGcalHitIdCheck()

HGcalHitIdCheck::HGcalHitIdCheck ( const edm::ParameterSet ps)

Definition at line 46 of file HGCalHitIdCheck.cc.

47  : g4Label_(ps.getParameter<std::string>("moduleLabel")),
48  caloHitSource_(ps.getParameter<std::string>("caloHitSource")),
49  nameSense_(ps.getParameter<std::string>("nameSense")),
50  nameDetector_(ps.getParameter<std::string>("nameDevice")),
51  verbosity_(ps.getParameter<int>("Verbosity")),
52  tok_calo_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, caloHitSource_))),
53  geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})) {
54  edm::LogVerbatim("HitStudy") << "Test Hit ID for " << nameDetector_ << " using SimHits for " << nameSense_
55  << " with module Label: " << g4Label_ << " Hits: " << caloHitSource_;
56 }

References nameSense_.

◆ ~HGcalHitIdCheck()

HGcalHitIdCheck::~HGcalHitIdCheck ( )
inlineoverride

Definition at line 31 of file HGCalHitIdCheck.cc.

31 {}

Member Function Documentation

◆ analyze()

void HGcalHitIdCheck::analyze ( edm::Event const &  e,
edm::EventSetup const &  iS 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 68 of file HGCalHitIdCheck.cc.

68  {
69  if (verbosity_ > 0)
70  edm::LogVerbatim("HitStudy") << "Run = " << e.id().run() << " Event = " << e.id().event();
71 
72  // get hcalGeometry
73  const HGCalGeometry* geom = &iS.getData(geomToken_);
74  const std::vector<DetId>& validIds = geom->getValidDetIds();
75 
77  e.getByToken(tok_calo_, hitsCalo);
78  bool getHits = (hitsCalo.isValid());
79  uint32_t nhits = (getHits) ? hitsCalo->size() : 0;
80  uint32_t good(0), all(0);
81  if (verbosity_ > 1)
82  edm::LogVerbatim("HitStudy") << "HGcalHitIdCheck: Input flags Hits " << getHits << " with " << nhits << " hits";
83 
84  if (getHits) {
85  std::vector<PCaloHit> hits;
86  hits.insert(hits.end(), hitsCalo->begin(), hitsCalo->end());
87  if (!hits.empty()) {
88  for (auto hit : hits) {
89  ++all;
90  DetId id(hit.id());
91  if (std::find(validIds.begin(), validIds.end(), id) != validIds.end()) {
92  ++good;
93  if (verbosity_ > 2) {
94  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
95  edm::LogVerbatim("HitStudy") << "Hit[" << all << ":" << good << "]" << HGCSiliconDetId(id);
96  } else if (id.det() == DetId::HGCalHSc) {
97  edm::LogVerbatim("HitStudy") << "Hit[" << all << ":" << good << "]" << HGCScintillatorDetId(id);
98  } else {
99  edm::LogVerbatim("HitStudy") << "Hit[" << all << ":" << good << "]" << std::hex << id.rawId() << std::dec;
100  }
101  }
102  } else {
103  if (verbosity_ > 0) {
104  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
105  edm::LogVerbatim("HitStudy")
106  << "Hit[" << all << ":" << good << "]" << HGCSiliconDetId(id) << " not valid *****";
107  } else if (id.det() == DetId::HGCalHSc) {
108  HGCScintillatorDetId hid1(id);
109  HGCScintillatorDetId hid2(hid1.type(), hid1.layer(), hid1.ring(), hid1.iphi(), false, 0);
110  bool ok = (std::find(validIds.begin(), validIds.end(), DetId(hid2)) != validIds.end());
111  edm::LogVerbatim("HitStudy") << "Hit[" << all << ":" << good << "]" << hid1 << " not valid ***** but "
112  << hid2 << " in list " << ok;
113  } else {
114  edm::LogVerbatim("HitStudy")
115  << "Hit[" << all << ":" << good << "]" << std::hex << id.rawId() << std::dec << " not valid *****";
116  }
117  }
118  }
119  }
120  }
121  }
122  edm::LogVerbatim("HitStudy") << "Total hits = " << all << ":" << nhits << " Good DetIds = " << good
123  << " Invalid DetIds = " << (all - good);
124 }

References python.cmstools::all(), TauDecayModes::dec, MillePedeFileConverter_cfg::e, spr::find(), relativeConstraints::geom, geomToken_, edm::EventSetup::getData(), DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, hfClusterShapes_cfi::hits, triggerObjects_cff::id, hit::id, HGCScintillatorDetId::iphi(), edm::HandleBase::isValid(), HGCScintillatorDetId::layer(), nhits, convertSQLiteXML::ok, HGCScintillatorDetId::ring(), tok_calo_, HGCScintillatorDetId::type(), and verbosity_.

◆ beginJob()

void HGcalHitIdCheck::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 36 of file HGCalHitIdCheck.cc.

36 {}

◆ endJob()

void HGcalHitIdCheck::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 37 of file HGCalHitIdCheck.cc.

37 {}

◆ fillDescriptions()

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

Definition at line 58 of file HGCalHitIdCheck.cc.

58  {
60  desc.add<std::string>("moduleLabel", "g4SimHits");
61  desc.add<std::string>("caloHitSource", "HGCHitsEE");
62  desc.add<std::string>("nameSense", "HGCalEESensitive");
63  desc.add<std::string>("nameDevice", "HGCal EE");
64  desc.add<int>("Verbosity", 0);
65  descriptions.add("hgcalHitIdCheckEE", desc);
66 }

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

Member Data Documentation

◆ caloHitSource_

const std::string HGcalHitIdCheck::caloHitSource_
private

Definition at line 40 of file HGCalHitIdCheck.cc.

◆ g4Label_

const std::string HGcalHitIdCheck::g4Label_
private

Definition at line 40 of file HGCalHitIdCheck.cc.

◆ geomToken_

const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> HGcalHitIdCheck::geomToken_
private

Definition at line 43 of file HGCalHitIdCheck.cc.

Referenced by analyze().

◆ nameDetector_

const std::string HGcalHitIdCheck::nameDetector_
private

Definition at line 40 of file HGCalHitIdCheck.cc.

◆ nameSense_

const std::string HGcalHitIdCheck::nameSense_
private

Definition at line 40 of file HGCalHitIdCheck.cc.

Referenced by HGcalHitIdCheck().

◆ tok_calo_

const edm::EDGetTokenT<edm::PCaloHitContainer> HGcalHitIdCheck::tok_calo_
private

Definition at line 42 of file HGCalHitIdCheck.cc.

Referenced by analyze().

◆ verbosity_

const int HGcalHitIdCheck::verbosity_
private

Definition at line 41 of file HGCalHitIdCheck.cc.

Referenced by analyze().

edm::ESInputTag
Definition: ESInputTag.h:87
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle
Definition: AssociativeIterator.h:50
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
nhits
Definition: HIMultiTrackSelector.h:42
HGCalGeometry
Definition: HGCalGeometry.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGcalHitIdCheck::verbosity_
const int verbosity_
Definition: HGCalHitIdCheck.cc:41
HGcalHitIdCheck::tok_calo_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
Definition: HGCalHitIdCheck.cc:42
HGcalHitIdCheck::g4Label_
const std::string g4Label_
Definition: HGCalHitIdCheck.cc:40
HGcalHitIdCheck::caloHitSource_
const std::string caloHitSource_
Definition: HGCalHitIdCheck.cc:40
HGcalHitIdCheck::nameDetector_
const std::string nameDetector_
Definition: HGCalHitIdCheck.cc:40
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
DetId::HGCalHSc
Definition: DetId.h:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGcalHitIdCheck::geomToken_
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
Definition: HGCalHitIdCheck.cc:43
HGcalHitIdCheck::nameSense_
const std::string nameSense_
Definition: HGCalHitIdCheck.cc:40
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37