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 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
 
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_, Skims_PA_cff::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  [this](const std::string& name) {
44  return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
45  })},
46  types_(ps.getParameter<std::vector<int>>("CollectionTypes")),
47  maxEvent_(ps.getParameter<int>("MaxEvent")),
48  kount_(0) {
49  edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " with " << hitLab_.size()
50  << " collections and maxEvent = " << maxEvent_;
51  for (unsigned int k = 0; k < hitLab_.size(); ++k)
52  edm::LogVerbatim("HitStudy") << "[" << k << "] Type " << types_[k] << " Label " << hitLab_[k];
53 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 66 of file EcalSimHitDump.cc.

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

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

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

55  {
57  std::vector<std::string> coll = {"EcalHitsEB", "EcalHitsEE", "EcalHitsES"};
58  std::vector<int> type = {0, 1, 2};
59  desc.add<std::string>("ModuleLabel", "g4SimHits");
60  desc.add<std::vector<std::string>>("HitCollections", coll);
61  desc.add<std::vector<int>>("CollectionTypes", type);
62  desc.add<int>("MaxEvent", 10);
63  descriptions.add("ecalSimHitDump", desc);
64 }
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().