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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 31 of file HcalSimHitDump.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file HcalSimHitDump.cc.

References g4Label_, edm::ParameterSet::getUntrackedParameter(), hitLab_, HLT_2018_cff::InputTag, maxEvent_, AlCaHLTBitMon_QueryRunRegistry::string, and toks_calo_.

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 }
T getUntrackedParameter(std::string const &, T const &) const
std::string g4Label_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
std::string hitLab_
HcalSimHitDump::~HcalSimHitDump ( )
inlineoverride

Definition at line 34 of file HcalSimHitDump.cc.

34 {}

Member Function Documentation

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

Definition at line 61 of file HcalSimHitDump.cc.

References analyzeHits(), edm::EventID::event(), edm::Event::getByToken(), edm::EventBase::id(), edm::HandleBase::isValid(), maxEvent_, nevt_, edm::EventID::run(), and toks_calo_.

Referenced by endJob().

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 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
void analyzeHits(std::vector< PCaloHit > &)
bool isValid() const
Definition: HandleBase.h:70
edm::EventID id() const
Definition: EventBase.h:59
void HcalSimHitDump::analyzeHits ( std::vector< PCaloHit > &  hits)
protected

Definition at line 80 of file HcalSimHitDump.cc.

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

Referenced by analyze(), and endJob().

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;
98  HcalTestNumbering::unpackHcalIndex(id_, 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 }
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
void HcalSimHitDump::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file HcalSimHitDump.cc.

37 {}
void HcalSimHitDump::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file HcalSimHitDump.cc.

References analyze(), analyzeHits(), HltBtagPostValidation_cff::c, and MillePedeFileConverter_cfg::e.

38 {}

Member Data Documentation

std::string HcalSimHitDump::g4Label_
private

Definition at line 44 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

std::string HcalSimHitDump::hitLab_
private

Definition at line 44 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

int HcalSimHitDump::maxEvent_
private

Definition at line 46 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().

int HcalSimHitDump::nevt_
private

Definition at line 46 of file HcalSimHitDump.cc.

Referenced by analyze().

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

Definition at line 45 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().