CMS 3D CMS Logo

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

Public Member Functions

 EcalSimHitDump (const edm::ParameterSet &ps)
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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
 
- 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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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::vector< std::string > hitLab_
 
int kount_
 
const int maxEvent_
 
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toksCalo_
 
const std::vector< int > types_
 

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 22 of file EcalSimHitDump.cc.

Constructor & Destructor Documentation

◆ EcalSimHitDump()

EcalSimHitDump::EcalSimHitDump ( const edm::ParameterSet ps)

Definition at line 39 of file EcalSimHitDump.cc.

References g4Label_, hitLab_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and edm::vector_transform().

40  : g4Label_(ps.getParameter<std::string>("ModuleLabel")),
41  hitLab_(ps.getParameter<std::vector<std::string>>("HitCollections")),
43  hitLab_,
44  [this](const std::string& name) { return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name}); })},
45  types_(ps.getParameter<std::vector<int>>("CollectionTypes")),
46  maxEvent_(ps.getParameter<int>("MaxEvent")),
47  kount_(0) {
48  edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " with " << hitLab_.size()
49  << " collections and maxEvent = " << maxEvent_;
50  for (unsigned int k = 0; k < hitLab_.size(); ++k)
51  edm::LogVerbatim("HitStudy") << "[" << k << "] Type " << types_[k] << " Label " << hitLab_[k];
52 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< int > types_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const int maxEvent_
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toksCalo_
const std::string g4Label_
const std::vector< std::string > hitLab_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 65 of file EcalSimHitDump.cc.

References MillePedeFileConverter_cfg::e, mps_fire::i, hit::id, edm::HandleBase::isValid(), isotrackApplyRegressor::k, kount_, maxEvent_, hcalRecHitTable_cff::time, toksCalo_, and types_.

65  {
66  ++kount_;
67  edm::LogVerbatim("HitStudy") << "[" << kount_ << "] Run = " << e.id().run() << " Event = " << e.id().event();
68 
69  if ((kount_ <= maxEvent_) || (maxEvent_ <= 0)) {
70  for (unsigned int k = 0; k < toksCalo_.size(); ++k) {
71  const edm::Handle<edm::PCaloHitContainer>& hitsCalo = e.getHandle(toksCalo_[k]);
72  if (hitsCalo.isValid())
73  edm::LogVerbatim("HitStudy") << "EcalSimHitDump: Input " << hitsCalo->size() << " hits of type " << types_[k];
74  unsigned int i(0);
75  for (auto const& hit : *hitsCalo) {
76  double edep = hit.energy();
77  double time = hit.time();
78  unsigned int id = hit.id();
79  if (types_[k] == 0)
80  edm::LogVerbatim("HitStudy") << "[" << i << "] " << EBDetId(id) << " E" << edep << " T " << time;
81  else if (types_[k] == 1)
82  edm::LogVerbatim("HitStudy") << "[" << i << "] " << EEDetId(id) << " E" << edep << " T " << time;
83  else
84  edm::LogVerbatim("HitStudy") << "[" << i << "] " << ESDetId(id) << " E" << edep << " T " << time;
85  ++i;
86  }
87  }
88  }
89 }
Log< level::Info, true > LogVerbatim
const std::vector< int > types_
const int maxEvent_
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > toksCalo_
unsigned int id
bool isValid() const
Definition: HandleBase.h:70

◆ fillDescriptions()

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

Definition at line 54 of file EcalSimHitDump.cc.

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

54  {
56  std::vector<std::string> coll = {"EcalHitsEB", "EcalHitsEE", "EcalHitsES"};
57  std::vector<int> type = {0, 1, 2};
58  desc.add<std::string>("ModuleLabel", "g4SimHits");
59  desc.add<std::vector<std::string>>("HitCollections", coll);
60  desc.add<std::vector<int>>("CollectionTypes", type);
61  desc.add<int>("MaxEvent", 10);
62  descriptions.add("ecalSimHitDump", desc);
63 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ g4Label_

const std::string EcalSimHitDump::g4Label_
private

Definition at line 31 of file EcalSimHitDump.cc.

Referenced by EcalSimHitDump().

◆ hitLab_

const std::vector<std::string> EcalSimHitDump::hitLab_
private

Definition at line 32 of file EcalSimHitDump.cc.

Referenced by EcalSimHitDump().

◆ kount_

int EcalSimHitDump::kount_
private

Definition at line 36 of file EcalSimHitDump.cc.

Referenced by analyze().

◆ maxEvent_

const int EcalSimHitDump::maxEvent_
private

Definition at line 35 of file EcalSimHitDump.cc.

Referenced by analyze().

◆ toksCalo_

const std::vector<edm::EDGetTokenT<edm::PCaloHitContainer> > EcalSimHitDump::toksCalo_
private

Definition at line 33 of file EcalSimHitDump.cc.

Referenced by analyze().

◆ types_

const std::vector<int> EcalSimHitDump::types_
private

Definition at line 34 of file EcalSimHitDump.cc.

Referenced by analyze().