CMS 3D CMS Logo

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

Public Member Functions

 HGCalBHValidation (const edm::ParameterSet &ps)
 
 ~HGCalBHValidation () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources >
 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
 
void beginJob () override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run 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 edm::InputTag digis_
 
edm::Service< TFileServicefs_
 
const std::string g4Label_
 
TH2D * hdi2Oc_
 
TH2D * hdi3Oc_
 
TH1D * hdigEn_
 
TH1D * hdigLn_
 
TH2D * hdigOc_
 
const std::string hits_
 
TH2D * hsi2Oc_
 
TH2D * hsi3Oc_
 
TH1D * hsimE1_
 
TH1D * hsimE2_
 
TH1D * hsimLn_
 
TH2D * hsimOc_
 
TH1D * hsimTm_
 
const int iSample_
 
const int ringMax_
 
const double threshold_
 
const edm::EDGetTokenT< HGCalDigiCollectiontok_digi_
 
const edm::EDGetTokenT< edm::PCaloHitContainertok_hits_
 

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 32 of file HGCalBHValidation.cc.

Constructor & Destructor Documentation

◆ HGCalBHValidation()

HGCalBHValidation::HGCalBHValidation ( const edm::ParameterSet ps)
explicit

Definition at line 61 of file HGCalBHValidation.cc.

References digis_, g4Label_, hits_, ProducerED_cfi::InputTag, iSample_, TFileService::kSharedResource, and threshold_.

62  : g4Label_(ps.getParameter<std::string>("ModuleLabel")),
63  hits_((ps.getParameter<std::string>("HitCollection"))),
64  digis_(ps.getParameter<edm::InputTag>("DigiCollection")),
65  iSample_(ps.getParameter<int>("Sample")),
66  threshold_(ps.getParameter<double>("Threshold")),
67  tok_hits_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hits_))),
68  tok_digi_(consumes<HGCalDigiCollection>(digis_)),
69  ringMax_(50) {
70  usesResource(TFileService::kSharedResource);
71 
72  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Input for SimHit:" << edm::InputTag(g4Label_, hits_)
73  << " Digits:" << digis_ << " Sample: " << iSample_ << " Threshold "
74  << threshold_;
75 }
static const std::string kSharedResource
Definition: TFileService.h:76
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string hits_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
const edm::InputTag digis_
const std::string g4Label_
const edm::EDGetTokenT< HGCalDigiCollection > tok_digi_
const double threshold_

◆ ~HGCalBHValidation()

HGCalBHValidation::~HGCalBHValidation ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 107 of file HGCalBHValidation.cc.

References edm::SortedCollection< T, SORT >::begin(), TauDecayModes::dec, hcalRecHitTable_cff::depth, das-up-to-nevents::df, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), hcalRecHitTable_cff::energy, hdi2Oc_, hdi3Oc_, hdigEn_, hdigLn_, hdigOc_, DetId::HGCalHSc, hsi2Oc_, hsi3Oc_, hsimE1_, hsimE2_, hsimLn_, hsimOc_, hsimTm_, mps_fire::i, l1ctLayer2EG_cff::id, HGCScintillatorDetId::iphi(), iSample_, edm::HandleBase::isValid(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, HGCScintillatorDetId::layer(), phi, relativeConstraints::ring, HGCScintillatorDetId::ring(), edm::SortedCollection< T, SORT >::size(), threshold_, hcalRecHitTable_cff::time, tok_digi_, tok_hits_, and HGCScintillatorDetId::zside().

107  {
108  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation:Run = " << e.id().run() << " Event = " << e.id().event();
109 
110  //SimHits
111  const edm::Handle<edm::PCaloHitContainer>& hitsHE = e.getHandle(tok_hits_);
112  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: PCaloHitContainer"
113  << " obtained with flag " << hitsHE.isValid();
114  if (hitsHE.isValid()) {
115  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: PCaloHit buffer " << hitsHE->size();
116  unsigned i(0);
117  std::map<unsigned int, double> map_try;
118  for (edm::PCaloHitContainer::const_iterator it = hitsHE->begin(); it != hitsHE->end(); ++it) {
119  double energy = it->energy();
120  double time = it->time();
121  unsigned int id = it->id();
122  if (DetId(id).det() == DetId::HGCalHSc) {
123  double ring = 0.01 + HGCScintillatorDetId(id).ring();
124  double phi = HGCScintillatorDetId(id).iphi() - 0.01;
125  int lay = HGCScintillatorDetId(id).layer();
126  double ring1 = ring * HGCScintillatorDetId(id).zside();
127  hsi2Oc_->Fill(ring1, phi, energy);
128  hsimE1_->Fill(energy);
129  hsimTm_->Fill(time, energy);
130  hsimOc_->Fill(ring1, phi, energy);
131  hsimLn_->Fill(lay, energy);
132  hsi3Oc_->Fill(ring1, lay, energy);
133  double ensum(0);
134  if (map_try.count(id) != 0)
135  ensum = map_try[id];
136  ensum += energy;
137  map_try[id] = ensum;
138  edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << ++i << "] ID " << std::hex << " " << id << std::dec
139  << " " << HGCScintillatorDetId(id) << " E " << energy << " time " << time;
140  }
141  }
142  for (std::map<unsigned int, double>::iterator itr = map_try.begin(); itr != map_try.end(); ++itr) {
143  hsimE2_->Fill((*itr).second);
144  }
145  }
146 
147  //Digits
148  unsigned int kount(0);
149  const edm::Handle<HGCalDigiCollection>& hecoll = e.getHandle(tok_digi_);
150  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: "
151  << "HGCalDigiCollection obtained with"
152  << " flag " << hecoll.isValid();
153  if (hecoll.isValid()) {
154  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi "
155  << "buffer " << hecoll->size();
156  for (HGCalDigiCollection::const_iterator it = hecoll->begin(); it != hecoll->end(); ++it) {
157  const HGCalDataFrame& df(*it);
158  double energy = df[iSample_].data();
159  if (DetId(df.id()).det() == DetId::HGCalHSc) {
160  HGCScintillatorDetId cell(df.id());
161  int depth = cell.layer();
162  if (energy > threshold_) {
163  double ring = 0.01 + cell.ring();
164  double phi = cell.iphi() - 0.01;
165  double ring1 = cell.zside() * ring;
166  hdi2Oc_->Fill(ring1, phi);
167  hdigEn_->Fill(energy);
168  hdigOc_->Fill(ring1, phi);
169  hdigLn_->Fill(depth);
170  hdi3Oc_->Fill(ring1, depth);
171  edm::LogVerbatim("HGCalValidation")
172  << "HGCalBHDigit[" << ++kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_);
173  }
174  }
175  }
176  }
177 }
Log< level::Info, true > LogVerbatim
constexpr int iphi() const
get the phi index
size_type size() const
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
std::vector< T >::const_iterator const_iterator
constexpr int zside() const
get the z-side of the cell (1/-1)
const edm::EDGetTokenT< HGCalDigiCollection > tok_digi_
const_iterator begin() const
const double threshold_
const_iterator end() const
Definition: DetId.h:17
Readout digi for HGC.
Definition: HGCDataFrame.h:14
bool isValid() const
Definition: HandleBase.h:70
constexpr int layer() const
get the layer #
constexpr int ring() const
get the eta index

◆ beginJob()

void HGCalBHValidation::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 40 of file HGCalBHValidation.cc.

40 {}

◆ beginRun()

void HGCalBHValidation::beginRun ( edm::Run const &  ,
edm::EventSetup const &  es 
)
overrideprotected

Definition at line 87 of file HGCalBHValidation.cc.

References fs_, hdi2Oc_, hdi3Oc_, hdigEn_, hdigLn_, hdigOc_, hsi2Oc_, hsi3Oc_, hsimE1_, hsimE2_, hsimLn_, hsimOc_, hsimTm_, TFileService::make(), and ringMax_.

87  {
88  edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Maximum Number of"
89  << " ring sectors:" << ringMax_ << "\nHitsValidationHcal::Booking the Histograms";
90 
91  //Histograms for Sim Hits
92  hsimE1_ = fs_->make<TH1D>("SimHitEn1", "Sim Hit Energy", 1000, 0.0, 1.0);
93  hsimE2_ = fs_->make<TH1D>("SimHitEn2", "Sim Hit Energy", 1000, 0.0, 1.0);
94  hsimTm_ = fs_->make<TH1D>("SimHitTime", "Sim Hit Time", 1000, 0.0, 500.0);
95  hsimLn_ = fs_->make<TH1D>("SimHitLong", "Sim Hit Long. Profile", 50, 0.0, 25.0);
96  hsimOc_ = fs_->make<TH2D>("SimHitOccup", "Sim Hit Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 360, 0, 360);
97  hsi2Oc_ = fs_->make<TH2D>("SimHitOccu2", "Sim Hit Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 360, 0, 360);
98  hsi3Oc_ = fs_->make<TH2D>("SimHitOccu3", "Sim Hit Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 50, 0, 25);
99  //Histograms for Digis
100  hdigEn_ = fs_->make<TH1D>("DigiEnergy", "Digi ADC Sample", 1000, 0.0, 1000.0);
101  hdigLn_ = fs_->make<TH1D>("DigiLong", "Digi Long. Profile", 50, 0.0, 25.0);
102  hdigOc_ = fs_->make<TH2D>("DigiOccup", "Digi Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 360, 0, 360);
103  hdi2Oc_ = fs_->make<TH2D>("DigiOccu2", "Digi Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 360, 0, 360);
104  hdi3Oc_ = fs_->make<TH2D>("DigiOccu3", "Digi Occupnacy", 2 * ringMax_ + 1, -ringMax_, ringMax_ + 1, 50, 0, 25);
105 }
Log< level::Info, true > LogVerbatim
edm::Service< TFileService > fs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64

◆ endRun()

void HGCalBHValidation::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprotected

Definition at line 42 of file HGCalBHValidation.cc.

42 {}

◆ fillDescriptions()

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

Definition at line 77 of file HGCalBHValidation.cc.

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

77  {
79  desc.add<std::string>("ModuleLabel", "g4SimHits");
80  desc.add<std::string>("HitCollection", "HGCHitsHEback");
81  desc.add<edm::InputTag>("DigiCollection", edm::InputTag("simHGCalUnsuppressedDigis", "HEback"));
82  desc.add<int>("Sample", 5);
83  desc.add<double>("Threshold", 15.0);
84  descriptions.add("hgcalBHAnalysis", desc);
85 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ digis_

const edm::InputTag HGCalBHValidation::digis_
private

Definition at line 48 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

◆ fs_

edm::Service<TFileService> HGCalBHValidation::fs_
private

Definition at line 46 of file HGCalBHValidation.cc.

Referenced by beginRun().

◆ g4Label_

const std::string HGCalBHValidation::g4Label_
private

Definition at line 47 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

◆ hdi2Oc_

TH2D * HGCalBHValidation::hdi2Oc_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hdi3Oc_

TH2D * HGCalBHValidation::hdi3Oc_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hdigEn_

TH1D * HGCalBHValidation::hdigEn_
private

Definition at line 56 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hdigLn_

TH1D * HGCalBHValidation::hdigLn_
private

Definition at line 56 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hdigOc_

TH2D* HGCalBHValidation::hdigOc_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hits_

const std::string HGCalBHValidation::hits_
private

Definition at line 47 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

◆ hsi2Oc_

TH2D * HGCalBHValidation::hsi2Oc_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsi3Oc_

TH2D * HGCalBHValidation::hsi3Oc_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsimE1_

TH1D* HGCalBHValidation::hsimE1_
private

Definition at line 55 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsimE2_

TH1D * HGCalBHValidation::hsimE2_
private

Definition at line 55 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsimLn_

TH1D* HGCalBHValidation::hsimLn_
private

Definition at line 56 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsimOc_

TH2D* HGCalBHValidation::hsimOc_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ hsimTm_

TH1D * HGCalBHValidation::hsimTm_
private

Definition at line 55 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

◆ iSample_

const int HGCalBHValidation::iSample_
private

Definition at line 49 of file HGCalBHValidation.cc.

Referenced by analyze(), and HGCalBHValidation().

◆ ringMax_

const int HGCalBHValidation::ringMax_
private

Definition at line 53 of file HGCalBHValidation.cc.

Referenced by beginRun().

◆ threshold_

const double HGCalBHValidation::threshold_
private

Definition at line 50 of file HGCalBHValidation.cc.

Referenced by analyze(), and HGCalBHValidation().

◆ tok_digi_

const edm::EDGetTokenT<HGCalDigiCollection> HGCalBHValidation::tok_digi_
private

Definition at line 52 of file HGCalBHValidation.cc.

Referenced by analyze().

◆ tok_hits_

const edm::EDGetTokenT<edm::PCaloHitContainer> HGCalBHValidation::tok_hits_
private

Definition at line 51 of file HGCalBHValidation.cc.

Referenced by analyze().