CMS 3D CMS Logo

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

Public Member Functions

 ZDCSimHitStudy (const edm::ParameterSet &ps)
 
 ~ZDCSimHitStudy () override=default
 
- 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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void analyzeHits (const 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< 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

TH1F * edep_
 
TH1F * eTot_
 
TH1F * eTotT_
 
const std::string g4Label_
 
TH1F * hit_
 
const std::string hitLab_
 
TH1F * indx_
 
const double maxEnergy_
 
const double tCut_
 
TH1F * time_
 
const edm::EDGetTokenT< edm::PCaloHitContainertoks_calo_
 
const bool verbose_
 

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 27 of file ZDCSimHitStudy.cc.

Constructor & Destructor Documentation

◆ ZDCSimHitStudy()

ZDCSimHitStudy::ZDCSimHitStudy ( const edm::ParameterSet ps)

Definition at line 49 of file ZDCSimHitStudy.cc.

References g4Label_, and hitLab_.

50  : g4Label_(ps.getParameter<std::string>("ModuleLabel")),
51  hitLab_(ps.getParameter<std::string>("HitCollection")),
52  maxEnergy_(ps.getParameter<double>("MaxEnergy")),
53  tCut_(ps.getParameter<double>("TimeCut")),
54  verbose_(ps.getParameter<bool>("Verbose")),
55  toks_calo_(consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, hitLab_})) {
56  usesResource(TFileService::kSharedResource);
57 
58  edm::LogVerbatim("HitStudy") << "HOSimHitStudy::Module Label: " << g4Label_ << " Hits: " << hitLab_
59  << " MaxEnergy: " << maxEnergy_ << " time Cut " << tCut_;
60 }
static const std::string kSharedResource
Definition: TFileService.h:76
Log< level::Info, true > LogVerbatim
const std::string hitLab_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const bool verbose_
const double maxEnergy_
const edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
const std::string g4Label_
const double tCut_

◆ ~ZDCSimHitStudy()

ZDCSimHitStudy::~ZDCSimHitStudy ( )
overridedefault

Member Function Documentation

◆ analyze()

void ZDCSimHitStudy::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 87 of file ZDCSimHitStudy.cc.

References analyzeHits(), MillePedeFileConverter_cfg::e, hitLab_, edm::HandleBase::isValid(), and toks_calo_.

87  {
88  edm::LogVerbatim("HitStudy") << "ZDCSimHitStudy::Run = " << e.id().run() << " Event = " << e.id().event();
89 
90  const edm::Handle<edm::PCaloHitContainer> &hitsCalo = e.getHandle(toks_calo_);
91  bool getHits = (hitsCalo.isValid());
92  edm::LogVerbatim("HitStudy") << "HOSimHitStudy::Input flag " << hitLab_ << " getHits flag " << getHits;
93 
94  std::vector<PCaloHit> zdcHits;
95  if (getHits) {
96  zdcHits.insert(zdcHits.end(), hitsCalo->begin(), hitsCalo->end());
97  unsigned int isiz = zdcHits.size();
98  edm::LogVerbatim("HitStudy") << "ZDCSimHitStudy:: Hit buffer for " << hitLab_ << " has " << isiz << " hits";
99  }
100  analyzeHits(zdcHits);
101 }
Log< level::Info, true > LogVerbatim
const std::string hitLab_
void analyzeHits(const std::vector< PCaloHit > &)
const edm::EDGetTokenT< edm::PCaloHitContainer > toks_calo_
bool isValid() const
Definition: HandleBase.h:70

◆ analyzeHits()

void ZDCSimHitStudy::analyzeHits ( const std::vector< PCaloHit > &  zdcHits)
protected

Definition at line 103 of file ZDCSimHitStudy.cc.

References HcalZDCDetId::channel(), HcalZDCDetId::denseIndex(), HcalZDCDetId::depth(), edep_, eTot_, eTotT_, hit_, mps_fire::i, indx_, HcalZDCDetId::section(), tCut_, hcalRecHitTable_cff::time, time_, verbose_, and HcalZDCDetId::zside().

Referenced by analyze().

103  {
104  //initialize
105  double etot(0), etotT(0);
106  int nHit = zdcHits.size();
107  for (int i = 0; i < nHit; i++) {
108  double edep = zdcHits[i].energy();
109  double time = zdcHits[i].time();
110  uint32_t id = zdcHits[i].id();
111  int indx = (id & 0xFF);
112  etotT += edep;
113  if (time < tCut_)
114  etot += edep;
115  if (verbose_)
116  edm::LogVerbatim("HitStudy") << "ZDCSimHitStudy:: Hit " << i << " Section:" << HcalZDCDetId(id).section()
117  << " zside:" << HcalZDCDetId(id).zside() << " depth:" << HcalZDCDetId(id).depth()
118  << " channel:" << HcalZDCDetId(id).channel()
119  << " dense:" << HcalZDCDetId(id).denseIndex() << " edep:" << edep
120  << " time:" << time;
121  time_->Fill(time);
122  edep_->Fill(edep);
123  indx_->Fill(indx);
124  }
125  eTot_->Fill(etot);
126  eTotT_->Fill(etotT);
127  hit_->Fill(nHit);
128 
129  if (verbose_)
130  edm::LogVerbatim("HitStudy") << "ZDCSimHitStudy::analyzeHits: Hits in ZDC " << nHit << " Energy deposits " << etot
131  << ":" << etotT;
132 }
Log< level::Info, true > LogVerbatim
constexpr uint32_t denseIndex() const
Definition: HcalZDCDetId.h:134
constexpr int32_t depth() const
get the depth (1 for EM, channel + 1 for HAD, 2 for RPD, not sure yet for LUM, leave as default) ...
Definition: HcalZDCDetId.h:100
const bool verbose_
constexpr Section section() const
get the section
Definition: HcalZDCDetId.h:92
constexpr int32_t channel() const
get the channel
Definition: HcalZDCDetId.h:112
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:90
const double tCut_

◆ beginJob()

void ZDCSimHitStudy::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 72 of file ZDCSimHitStudy.cc.

References edep_, eTot_, eTotT_, hit_, indx_, maxEnergy_, compare::tfile, time_, and L1TOccupancyClient_cfi::ymax.

72  {
74 
75  if (!tfile.isAvailable())
76  throw cms::Exception("BadConfig") << "TFileService unavailable: "
77  << "please add it to config file";
78  double ymax = maxEnergy_;
79  hit_ = tfile->make<TH1F>("Hits", "Number of Hits", 100, 0., 100);
80  edep_ = tfile->make<TH1F>("Edep", "Deposited Energy (GeV)", 1000, 0., ymax);
81  eTot_ = tfile->make<TH1F>("ETot", "Total Energy in a time window (GeV)", 1000, 0., ymax);
82  eTotT_ = tfile->make<TH1F>("ETotT", "Total Energy (GeV)", 1000, 0., ymax);
83  time_ = tfile->make<TH1F>("Time", "Hit Time (ns)", 2000, 0., 2000);
84  indx_ = tfile->make<TH1F>("Indx", "Hit ID", 100, 0., 100);
85 }
Definition: tfile.py:1
const double maxEnergy_

◆ endJob()

void ZDCSimHitStudy::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 35 of file ZDCSimHitStudy.cc.

35 {}

◆ fillDescriptions()

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

Definition at line 62 of file ZDCSimHitStudy.cc.

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

62  {
64  desc.add<std::string>("ModuleLabel", "g4SimHits");
65  desc.add<std::string>("HitCollection", "ZDCHITS");
66  desc.add<double>("MaxEnergy", 50.0);
67  desc.add<double>("TimeCut", 2000.0);
68  desc.add<bool>("Verbose", false);
69  descriptions.add("zdcSimHitStudy", desc);
70 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ edep_

TH1F * ZDCSimHitStudy::edep_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ eTot_

TH1F * ZDCSimHitStudy::eTot_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ eTotT_

TH1F * ZDCSimHitStudy::eTotT_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ g4Label_

const std::string ZDCSimHitStudy::g4Label_
private

Definition at line 41 of file ZDCSimHitStudy.cc.

Referenced by ZDCSimHitStudy().

◆ hit_

TH1F* ZDCSimHitStudy::hit_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ hitLab_

const std::string ZDCSimHitStudy::hitLab_
private

Definition at line 42 of file ZDCSimHitStudy.cc.

Referenced by analyze(), and ZDCSimHitStudy().

◆ indx_

TH1F * ZDCSimHitStudy::indx_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ maxEnergy_

const double ZDCSimHitStudy::maxEnergy_
private

Definition at line 43 of file ZDCSimHitStudy.cc.

Referenced by beginJob().

◆ tCut_

const double ZDCSimHitStudy::tCut_
private

Definition at line 43 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits().

◆ time_

TH1F * ZDCSimHitStudy::time_
private

Definition at line 46 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits(), and beginJob().

◆ toks_calo_

const edm::EDGetTokenT<edm::PCaloHitContainer> ZDCSimHitStudy::toks_calo_
private

Definition at line 45 of file ZDCSimHitStudy.cc.

Referenced by analyze().

◆ verbose_

const bool ZDCSimHitStudy::verbose_
private

Definition at line 44 of file ZDCSimHitStudy.cc.

Referenced by analyzeHits().