CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
- 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 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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
 
template<class T >
void analyzeDigi (const T &, double const &, bool const &, int const &, unsigned int &)
 
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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_
 
const int etaMax_
 
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 double threshold_
 
const edm::EDGetToken tok_digi_
 
const edm::EDGetTokenT
< edm::PCaloHitContainer
tok_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 ( const edm::ParameterSet ps)
explicit

Definition at line 63 of file HGCalBHValidation.cc.

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

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

Definition at line 35 of file HGCalBHValidation.cc.

35 {}

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 109 of file HGCalBHValidation.cc.

References analyzeDigi(), HGCDataFrame< D, S >::data(), TauDecayModes::dec, HLT_FULL_cff::depth, DetId::det(), isotrackApplyRegressor::df, relval_parameters_module::energy, PVValHelper::eta, HLT_FULL_cff::eta1, edm::EventID::event(), edm::Event::getByToken(), DetId::HGCalHSc, hsi2Oc_, hsi3Oc_, hsimE1_, hsimE2_, hsimLn_, hsimOc_, hsimTm_, mps_fire::i, gpuClustering::id, HGCDataFrame< D, S >::id(), edm::EventBase::id(), HGCScintillatorDetId::ieta(), HGCScintillatorDetId::iphi(), iSample_, edm::HandleBase::isValid(), HGCScintillatorDetId::layer(), phi, edm::EventID::run(), tok_digi_, and tok_hits_.

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

Definition at line 179 of file HGCalBHValidation.cc.

References PVValHelper::eta, HLT_FULL_cff::eta1, hdi2Oc_, hdi3Oc_, hdigEn_, hdigLn_, hdigOc_, phi, and threshold_.

Referenced by analyze().

180  {
181  if (energy > threshold_) {
182  int eta = cell.ieta();
183  int phi = cell.iphi();
184  double eta1 = (eta >= 0) ? (eta + 0.1) : (eta - 0.1);
185  hdi2Oc_->Fill(eta1, (phi - 0.1));
186  if (bh) {
187  hdigEn_->Fill(energy);
188  hdigOc_->Fill(eta1, (phi - 0.1));
189  hdigLn_->Fill(depth);
190  hdi3Oc_->Fill(eta1, depth);
191  ++kount;
192  edm::LogVerbatim("HGCalValidation")
193  << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_);
194  }
195  }
196 }
Log< level::Info, true > LogVerbatim
const double threshold_
void HGCalBHValidation::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 40 of file HGCalBHValidation.cc.

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

Definition at line 89 of file HGCalBHValidation.cc.

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

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

Definition at line 42 of file HGCalBHValidation.cc.

42 {}
void HGCalBHValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 79 of file HGCalBHValidation.cc.

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

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

Member Data Documentation

const edm::InputTag HGCalBHValidation::digis_
private

Definition at line 50 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

const int HGCalBHValidation::etaMax_
private

Definition at line 55 of file HGCalBHValidation.cc.

Referenced by beginRun().

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

Definition at line 48 of file HGCalBHValidation.cc.

Referenced by beginRun().

const std::string HGCalBHValidation::g4Label_
private

Definition at line 49 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

TH2D * HGCalBHValidation::hdi2Oc_
private

Definition at line 60 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and beginRun().

TH2D * HGCalBHValidation::hdi3Oc_
private

Definition at line 60 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and beginRun().

TH1D * HGCalBHValidation::hdigEn_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and beginRun().

TH1D * HGCalBHValidation::hdigLn_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and beginRun().

TH2D* HGCalBHValidation::hdigOc_
private

Definition at line 60 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and beginRun().

const std::string HGCalBHValidation::hits_
private

Definition at line 49 of file HGCalBHValidation.cc.

Referenced by HGCalBHValidation().

TH2D * HGCalBHValidation::hsi2Oc_
private

Definition at line 59 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH2D * HGCalBHValidation::hsi3Oc_
private

Definition at line 59 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH1D* HGCalBHValidation::hsimE1_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH1D * HGCalBHValidation::hsimE2_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH1D* HGCalBHValidation::hsimLn_
private

Definition at line 58 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH2D* HGCalBHValidation::hsimOc_
private

Definition at line 59 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

TH1D * HGCalBHValidation::hsimTm_
private

Definition at line 57 of file HGCalBHValidation.cc.

Referenced by analyze(), and beginRun().

const int HGCalBHValidation::iSample_
private

Definition at line 51 of file HGCalBHValidation.cc.

Referenced by analyze(), and HGCalBHValidation().

const double HGCalBHValidation::threshold_
private

Definition at line 52 of file HGCalBHValidation.cc.

Referenced by analyzeDigi(), and HGCalBHValidation().

const edm::EDGetToken HGCalBHValidation::tok_digi_
private

Definition at line 54 of file HGCalBHValidation.cc.

Referenced by analyze().

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

Definition at line 53 of file HGCalBHValidation.cc.

Referenced by analyze().