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
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 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 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)
 
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 std::string g4Label_
 
const std::string hitLab_
 
const int maxEvent_
 
int nevt_
 
const bool testNumber_
 
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 31 of file HcalSimHitDump.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file HcalSimHitDump.cc.

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

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 }
Log< level::Info, true > LogVerbatim
const std::string g4Label_
const bool testNumber_
const std::string hitLab_
edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
const int maxEvent_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 74 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_.

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

Definition at line 93 of file HcalSimHitDump.cc.

References HLT_FULL_cff::depth, PVValHelper::eta, mps_fire::i, phi, AlCaHLTBitMon_QueryRunRegistry::string, testNumber_, HcalTestNumbering::unpackHcalIndex(), and z.

Referenced by analyze().

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 }
Log< level::Info, true > LogVerbatim
const bool testNumber_
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::one::EDAnalyzerBase.

Definition at line 38 of file HcalSimHitDump.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 39 of file HcalSimHitDump.cc.

39 {}
void HcalSimHitDump::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 65 of file HcalSimHitDump.cc.

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

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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const std::string HcalSimHitDump::g4Label_
private

Definition at line 45 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

const std::string HcalSimHitDump::hitLab_
private

Definition at line 45 of file HcalSimHitDump.cc.

Referenced by HcalSimHitDump().

const int HcalSimHitDump::maxEvent_
private

Definition at line 46 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().

int HcalSimHitDump::nevt_
private

Definition at line 49 of file HcalSimHitDump.cc.

Referenced by analyze().

const bool HcalSimHitDump::testNumber_
private

Definition at line 47 of file HcalSimHitDump.cc.

Referenced by analyzeHits(), and HcalSimHitDump().

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

Definition at line 48 of file HcalSimHitDump.cc.

Referenced by analyze(), and HcalSimHitDump().