CMS 3D CMS Logo

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

Public Member Functions

 HcalSimHitDump (const edm::ParameterSet &ps)
 
 ~HcalSimHitDump () override
 
- 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 &&)=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
 
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 analyzeHits (std::vector< PCaloHit > &)
 
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 g4Label_
 
const std::string hitLab_
 
const int maxEvent_
 
int nevt_
 
const bool testNumber_
 
edm::EDGetTokenT< edm::PCaloHitContainertoks_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 31 of file HcalSimHitDump.cc.

Constructor & Destructor Documentation

◆ HcalSimHitDump()

HcalSimHitDump::HcalSimHitDump ( const edm::ParameterSet ps)

Definition at line 52 of file HcalSimHitDump.cc.

53  : g4Label_(ps.getParameter<std::string>("ModuleLabel")),
54  hitLab_(ps.getParameter<std::string>("HCCollection")),
55  maxEvent_(ps.getParameter<int>("MaxEvent")),
56  testNumber_(ps.getParameter<bool>("TestNumber")),
57  nevt_(0) {
58  // register for data access
59  toks_calo_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hitLab_));
60 
61  edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent "
62  << maxEvent_ << " TestNumbering " << testNumber_;
63 }

References g4Label_, hitLab_, maxEvent_, testNumber_, and toks_calo_.

◆ ~HcalSimHitDump()

HcalSimHitDump::~HcalSimHitDump ( )
inlineoverride

Definition at line 34 of file HcalSimHitDump.cc.

34 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 74 of file HcalSimHitDump.cc.

74  {
75  ++nevt_;
76  edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Serial # " << nevt_ << " Run # " << e.id().run() << " Event # "
77  << e.id().event();
78 
79  if (nevt_ <= maxEvent_) {
80  std::vector<PCaloHit> hcHits;
82  e.getByToken(toks_calo_, hitsCalo);
83  if (hitsCalo.isValid()) {
84  edm::LogVerbatim("HitStudy") << "HcalValidation: get valid hist for Hcal";
85  std::vector<PCaloHit> caloHits;
86  caloHits.insert(caloHits.end(), hitsCalo->begin(), hitsCalo->end());
87  edm::LogVerbatim("HitStudy") << "HcalValidation: Hit buffer " << caloHits.size();
88  analyzeHits(caloHits);
89  }
90  }
91 }

References analyzeHits(), MillePedeFileConverter_cfg::e, edm::HandleBase::isValid(), maxEvent_, nevt_, and toks_calo_.

◆ analyzeHits()

void HcalSimHitDump::analyzeHits ( std::vector< PCaloHit > &  hits)
protected

Definition at line 93 of file HcalSimHitDump.cc.

93  {
94  //Now the dump
95  for (unsigned int i = 0; i < hits.size(); i++) {
96  double edep = hits[i].energy();
97  double time = hits[i].time();
98  unsigned int id_ = hits[i].id();
99  if (testNumber_) {
100  int det, z, depth, eta, phi, lay;
101  HcalTestNumbering::unpackHcalIndex(id_, det, z, depth, eta, phi, lay);
102  std::string sub("HX");
103  if (det == 1)
104  sub = "HB";
105  else if (det == 2)
106  sub = "HE";
107  else if (det == 3)
108  sub = "HO";
109  else if (det == 4)
110  sub = "HF";
111  else if (det == 5)
112  sub = "HT";
113  int side = (z == 0) ? (-1) : (1);
114  edm::LogVerbatim("HitStudy") << "[" << i << "] (" << sub << " " << side * eta << "," << phi << "," << depth << ","
115  << lay << ") E " << edep << " T " << time;
116  } else {
117  edm::LogVerbatim("HitStudy") << "[" << i << "] " << HcalDetId(id_) << " E " << edep << " T " << time;
118  }
119  }
120 }

References LEDCalibrationChannels::depth, PVValHelper::eta, hfClusterShapes_cfi::hits, mps_fire::i, phi, AlCaHLTBitMon_QueryRunRegistry::string, testNumber_, protons_cff::time, HcalTestNumbering::unpackHcalIndex(), and z.

Referenced by analyze().

◆ beginJob()

void HcalSimHitDump::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 38 of file HcalSimHitDump.cc.

38 {}

◆ endJob()

void HcalSimHitDump::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 39 of file HcalSimHitDump.cc.

39 {}

◆ fillDescriptions()

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

Definition at line 65 of file HcalSimHitDump.cc.

65  {
67  desc.add<std::string>("ModuleLabel", "g4SimHits");
68  desc.add<std::string>("HCCollection", "HcalHits");
69  desc.add<int>("MaxEvent", 10);
70  desc.add<bool>("TestNumber", true);
71  descriptions.add("hcalSimHitDump", desc);
72 }

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

Member Data Documentation

◆ g4Label_

const std::string HcalSimHitDump::g4Label_
private

Definition at line 45 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

◆ hitLab_

const std::string HcalSimHitDump::hitLab_
private

Definition at line 45 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

◆ maxEvent_

const int HcalSimHitDump::maxEvent_
private

Definition at line 46 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().

◆ nevt_

int HcalSimHitDump::nevt_
private

Definition at line 49 of file HcalSimHitDump.cc.

Referenced by analyze().

◆ testNumber_

const bool HcalSimHitDump::testNumber_
private

Definition at line 47 of file HcalSimHitDump.cc.

Referenced by analyzeHits(), and HcalSimHitDump().

◆ toks_calo_

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

Definition at line 48 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().

mps_fire.i
i
Definition: mps_fire.py:428
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HcalSimHitDump::g4Label_
const std::string g4Label_
Definition: HcalSimHitDump.cc:45
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
protons_cff.time
time
Definition: protons_cff.py:35
edm::Handle
Definition: AssociativeIterator.h:50
HcalSimHitDump::toks_calo_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
Definition: HcalSimHitDump.cc:48
HcalSimHitDump::hitLab_
const std::string hitLab_
Definition: HcalSimHitDump.cc:45
HcalTestNumbering::unpackHcalIndex
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: HcalTestNumbering.cc:18
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:70
DDAxes::z
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalSimHitDump::testNumber_
const bool testNumber_
Definition: HcalSimHitDump.cc:47
HcalDetId
Definition: HcalDetId.h:12
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDAxes::phi
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HcalSimHitDump::analyzeHits
void analyzeHits(std::vector< PCaloHit > &)
Definition: HcalSimHitDump.cc:93
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HcalSimHitDump::maxEvent_
const int maxEvent_
Definition: HcalSimHitDump.cc:46
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HcalSimHitDump::nevt_
int nevt_
Definition: HcalSimHitDump.cc:49
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37