CMS 3D CMS Logo

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

Public Member Functions

 HcalSimHitDump (const edm::ParameterSet &ps)
 
 ~HcalSimHitDump () override
 
- 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)
 

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

std::string g4Label_
 
std::string hitLab_
 
int maxEvent_
 
int nevt_
 
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
 
- 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 ()
 

Detailed Description

Definition at line 31 of file HcalSimHitDump.cc.

Constructor & Destructor Documentation

◆ HcalSimHitDump()

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

Definition at line 49 of file HcalSimHitDump.cc.

49  : nevt_(0) {
50  g4Label_ = ps.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits");
51  hitLab_ = ps.getUntrackedParameter<std::string>("HCCollection", "HcalHits");
52  maxEvent_ = ps.getUntrackedParameter<int>("MaxEvent", 10);
53 
54  // register for data access
55  toks_calo_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hitLab_));
56 
57  edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent "
58  << maxEvent_;
59 }

References g4Label_, edm::ParameterSet::getUntrackedParameter(), hitLab_, maxEvent_, AlCaHLTBitMon_QueryRunRegistry::string, 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::EDAnalyzer.

Definition at line 61 of file HcalSimHitDump.cc.

61  {
62  ++nevt_;
63  edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Serial # " << nevt_ << " Run # " << e.id().run() << " Event # "
64  << e.id().event();
65 
66  if (nevt_ <= maxEvent_) {
67  std::vector<PCaloHit> hcHits;
69  e.getByToken(toks_calo_, hitsCalo);
70  if (hitsCalo.isValid()) {
71  edm::LogVerbatim("HitStudy") << "HcalValidation: get valid hist for Hcal";
72  std::vector<PCaloHit> caloHits;
73  caloHits.insert(caloHits.end(), hitsCalo->begin(), hitsCalo->end());
74  edm::LogVerbatim("HitStudy") << "HcalValidation: Hit buffer " << caloHits.size();
75  analyzeHits(caloHits);
76  }
77  }
78 }

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 80 of file HcalSimHitDump.cc.

80  {
81  bool testN(false);
82  for (unsigned int k = 1; k < hits.size(); ++k) {
83  int det = (((hits[k].id()) >> 28) & 0xF);
84  if (det != 4) {
85  testN = true;
86  break;
87  }
88  }
89  edm::LogVerbatim("HitStudy") << "Hit ID uses numbering scheme " << testN << " (0 normal; 1 test)";
90 
91  //Now the dump
92  for (unsigned int i = 0; i < hits.size(); i++) {
93  double edep = hits[i].energy();
94  double time = hits[i].time();
95  unsigned int id_ = hits[i].id();
96  if (testN) {
97  int det, z, depth, eta, phi, lay;
99  std::string sub("HX");
100  if (det == 1)
101  sub = "HB";
102  else if (det == 2)
103  sub = "HE";
104  else if (det == 3)
105  sub = "HO";
106  else if (det == 4)
107  sub = "HF";
108  else if (det == 5)
109  sub = "HT";
110  int side = (z == 0) ? (-1) : (1);
111  edm::LogVerbatim("HitStudy") << "[" << i << "] (" << sub << " " << side * eta << "," << phi << "," << depth << ","
112  << lay << ") E " << edep << " T " << time;
113  } else {
114  edm::LogVerbatim("HitStudy") << "[" << i << "] " << HcalDetId(id_) << " E " << edep << " T " << time;
115  }
116  }
117 }

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

Referenced by analyze().

◆ beginJob()

void HcalSimHitDump::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file HcalSimHitDump.cc.

37 {}

◆ endJob()

void HcalSimHitDump::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file HcalSimHitDump.cc.

38 {}

Member Data Documentation

◆ g4Label_

std::string HcalSimHitDump::g4Label_
private

Definition at line 44 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

◆ hitLab_

std::string HcalSimHitDump::hitLab_
private

Definition at line 44 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

◆ maxEvent_

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 46 of file HcalSimHitDump.cc.

Referenced by analyze().

◆ toks_calo_

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

Definition at line 45 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
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
HcalSimHitDump::toks_calo_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
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
PVValHelper::eta
Definition: PVValidationHelpers.h:69
DDAxes::z
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HcalSimHitDump::g4Label_
std::string g4Label_
Definition: HcalSimHitDump.cc:44
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalDetId
Definition: HcalDetId.h:12
HcalSimHitDump::hitLab_
std::string hitLab_
Definition: HcalSimHitDump.cc:44
DDAxes::phi
HcalSimHitDump::maxEvent_
int maxEvent_
Definition: HcalSimHitDump.cc:46
HcalSimHitDump::analyzeHits
void analyzeHits(std::vector< PCaloHit > &)
Definition: HcalSimHitDump.cc:80
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
ntuplemaker.time
time
Definition: ntuplemaker.py:310
HcalSimHitDump::nevt_
int nevt_
Definition: HcalSimHitDump.cc:46
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37