CMS 3D CMS Logo

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

Public Member Functions

 CherenkovAnalysis (const edm::ParameterSet &)
 
 ~CherenkovAnalysis () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

TH1F * hEnergy_
 
TH1F * hTimeStructure_
 
const double maxEnergy_
 
const int nBinsEnergy_
 
const edm::EDGetTokenT< edm::PCaloHitContainertok_calo_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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)
 

Detailed Description

SimG4CMS/CherenkovAnalysis/test/CherenkovAnalysis.cpp

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file CherenkovAnalysis.cc.

Constructor & Destructor Documentation

◆ CherenkovAnalysis()

CherenkovAnalysis::CherenkovAnalysis ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file CherenkovAnalysis.cc.

References hEnergy_, hTimeStructure_, TFileService::kSharedResource, maxEnergy_, nBinsEnergy_, and compare::tfile.

66  : maxEnergy_(iConfig.getParameter<double>("maxEnergy")),
67  nBinsEnergy_(iConfig.getParameter<int>("nBinsEnergy")),
68  tok_calo_(consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("caloHitSource"))) {
69  usesResource(TFileService::kSharedResource);
70 
71  // Book histograms
73 
74  if (!tfile.isAvailable())
75  throw cms::Exception("BadConfig") << "TFileService unavailable: "
76  << "please add it to config file";
77 
78  hEnergy_ = tfile->make<TH1F>("hEnergy", "Total energy deposit [GeV]", nBinsEnergy_, 0, maxEnergy_);
79  hTimeStructure_ = tfile->make<TH1F>("hTimeStructure", "Time structure [ns]", 100, 0, 0.3);
80 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Definition: tfile.py:1
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
const double maxEnergy_

◆ ~CherenkovAnalysis()

CherenkovAnalysis::~CherenkovAnalysis ( )
inlineoverride

Definition at line 47 of file CherenkovAnalysis.cc.

47 {}

Member Function Documentation

◆ analyze()

void CherenkovAnalysis::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 91 of file CherenkovAnalysis.cc.

References hEnergy_, hTimeStructure_, iEvent, edm::Handle< T >::product(), and tok_calo_.

91  {
92  const edm::Handle<edm::PCaloHitContainer> &pCaloHits = iEvent.getHandle(tok_calo_);
93 
94  double totalEnergy = 0;
95 
96  // Loop on all hits and calculate total energy loss
97  edm::PCaloHitContainer::const_iterator it = pCaloHits.product()->begin();
98  edm::PCaloHitContainer::const_iterator itend = pCaloHits.product()->end();
99  for (; it != itend; ++it) {
100  totalEnergy += (*it).energy();
101  hTimeStructure_->Fill((*it).time(),
102  (*it).energy()); // Time weighted by energy...
103  // edm::LogInfo("CherenkovAnalysis") << "Time = " << (*it).time() <<
104  // std::endl;
105  }
106 #ifdef EDM_ML_DEBUG
107  edm::LogVerbatim("CherenkovAnalysis") << "CherenkovAnalysis::Total energy = " << totalEnergy;
108 #endif
109  hEnergy_->Fill(totalEnergy);
110 }
Log< level::Info, true > LogVerbatim
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_

◆ beginJob()

void CherenkovAnalysis::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 59 of file CherenkovAnalysis.cc.

59 {}

◆ endJob()

void CherenkovAnalysis::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 61 of file CherenkovAnalysis.cc.

61 {}

◆ fillDescriptions()

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

Definition at line 82 of file CherenkovAnalysis.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

82  {
84  desc.add<edm::InputTag>("caloHitSource", edm::InputTag("g4SimHits", "EcalHitsEB"));
85  desc.add<double>("maxEnergy", 2.0);
86  desc.add<int>("nBinsEnergy", 50);
87  descriptions.add("cherenkovAnalysis", desc);
88 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ hEnergy_

TH1F* CherenkovAnalysis::hEnergy_
private

Definition at line 55 of file CherenkovAnalysis.cc.

Referenced by analyze(), and CherenkovAnalysis().

◆ hTimeStructure_

TH1F* CherenkovAnalysis::hTimeStructure_
private

Definition at line 57 of file CherenkovAnalysis.cc.

Referenced by analyze(), and CherenkovAnalysis().

◆ maxEnergy_

const double CherenkovAnalysis::maxEnergy_
private

Definition at line 52 of file CherenkovAnalysis.cc.

Referenced by CherenkovAnalysis().

◆ nBinsEnergy_

const int CherenkovAnalysis::nBinsEnergy_
private

Definition at line 53 of file CherenkovAnalysis.cc.

Referenced by CherenkovAnalysis().

◆ tok_calo_

const edm::EDGetTokenT<edm::PCaloHitContainer> CherenkovAnalysis::tok_calo_
private

Definition at line 54 of file CherenkovAnalysis.cc.

Referenced by analyze().