CMS 3D CMS Logo

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

Public Member Functions

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

const std::string caloHitSource_
 
const std::string g4Label_
 
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecordgeomToken_
 
TH1D * h_hit1_
 
TH1D * h_hit2_
 
std::vector< TH1D * > h_hitF_
 
std::vector< TH1D * > h_hitL_
 
std::vector< TH1D * > h_hitP_
 
TH1D * h_hits_
 
bool histos_
 
const int layers_
 
const std::string nameDetector_
 
const std::string nameSense_
 
const std::string tag_
 
const edm::EDGetTokenT< edm::PCaloHitContainertok_calo_
 
const int verbosity_
 

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 31 of file HGCalHitCheck.cc.

Constructor & Destructor Documentation

◆ HGcalHitCheck()

HGcalHitCheck::HGcalHitCheck ( const edm::ParameterSet ps)

Definition at line 52 of file HGCalHitCheck.cc.

References nameSense_.

53  : g4Label_(ps.getParameter<std::string>("moduleLabel")),
54  caloHitSource_(ps.getParameter<std::string>("caloHitSource")),
55  nameSense_(ps.getParameter<std::string>("nameSense")),
57  tag_(ps.getParameter<std::string>("nameDevice")),
58  layers_(ps.getParameter<int>("layers")),
59  verbosity_(ps.getParameter<int>("verbosity")),
60  tok_calo_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, caloHitSource_))),
61  geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})),
62  histos_(false) {
63  edm::LogVerbatim("HitStudy") << "Test Hit ID for " << nameDetector_ << " using SimHits for " << nameSense_
64  << " with module Label: " << g4Label_ << " Hits: " << caloHitSource_;
65 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string nameSense_
const int verbosity_
const int layers_
const std::string tag_
const std::string nameDetector_
const std::string g4Label_
const std::string caloHitSource_
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_

◆ ~HGcalHitCheck()

HGcalHitCheck::~HGcalHitCheck ( )
inlineoverride

Definition at line 34 of file HGCalHitCheck.cc.

34 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 135 of file HGCalHitCheck.cc.

References MillePedeFileConverter_cfg::e, relativeConstraints::geom, geomToken_, edm::EventSetup::getData(), h_hit1_, h_hit2_, h_hitF_, h_hitL_, h_hitP_, h_hits_, histos_, hfClusterShapes_cfi::hits, EcalPhiSymFlatTableProducers_cfi::id, hit::id, info(), edm::HandleBase::isValid(), nameSense_, TrackingDataMCValidation_Standalone_cff::nhits, tok_calo_, verbosity_, HGCalTypes::WaferFull, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

135  {
136  if (verbosity_ > 0)
137  edm::LogVerbatim("HitStudy") << "Run = " << e.id().run() << " Event = " << e.id().event();
138 
139  // get hcalGeometry
140  const HGCalGeometry* geom = &iS.getData(geomToken_);
141  const HGCalDDDConstants& hgc = geom->topology().dddConstants();
142  const std::vector<DetId>& validIds = geom->getValidDetIds();
143  edm::LogVerbatim("HitStudy") << "Detector " << nameSense_ << " with " << validIds.size() << " valid cells";
144 
145  const edm::Handle<edm::PCaloHitContainer>& hitsCalo = e.getHandle(tok_calo_);
146  bool getHits = (hitsCalo.isValid());
147  uint32_t nhits = (getHits) ? hitsCalo->size() : 0;
148  uint32_t wafer(0), tiles(0);
149  if (verbosity_ > 1)
150  edm::LogVerbatim("HitStudy") << "HGcalHitCheck: Input flags Hits " << getHits << " with " << nhits << " hits";
151  if (histos_)
152  h_hits_->Fill(nhits);
153 
154  if (getHits) {
155  std::vector<PCaloHit> hits;
156  hits.insert(hits.end(), hitsCalo->begin(), hitsCalo->end());
157  if (!hits.empty()) {
158  for (auto hit : hits) {
159  if (histos_) {
160  if ((nameSense_ == "HGCalEESensitive") || (nameSense_ == "HGCalHESiliconSensitive")) {
161  ++wafer;
163  int lay = id.layer();
164  h_hitL_[lay - 1]->Fill(nhits);
165  HGCalParameters::waferInfo info = hgc.waferInfo(lay, id.waferU(), id.waferV());
166  if (info.part == HGCalTypes::WaferFull) {
167  h_hit1_->Fill(nhits);
168  h_hitF_[lay - 1]->Fill(nhits);
169  } else {
170  h_hit2_->Fill(nhits);
171  h_hitP_[lay - 1]->Fill(nhits);
172  }
173  } else {
174  ++tiles;
176  int lay = id.layer();
177  h_hitL_[lay - 1]->Fill(nhits);
178  int sipm = id.sipm();
179  if (sipm == 1) {
180  h_hit2_->Fill(nhits);
181  h_hitP_[lay - 1]->Fill(nhits);
182  } else {
183  h_hit1_->Fill(nhits);
184  h_hitF_[lay - 1]->Fill(nhits);
185  }
186  }
187  }
188  }
189  }
190  }
191  edm::LogVerbatim("HitStudy") << "Total hits = " << nhits << " Wafer DetIds = " << wafer << " Tile DetIds = " << tiles;
192 }
Log< level::Info, true > LogVerbatim
static const TGPicture * info(bool iBackgroundIsBlack)
const std::string nameSense_
const int verbosity_
int32_t waferU(const int32_t index)
std::vector< TH1D * > h_hitP_
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
std::vector< TH1D * > h_hitF_
std::vector< TH1D * > h_hitL_
unsigned int id
bool isValid() const
Definition: HandleBase.h:70
int32_t waferV(const int32_t index)
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_

◆ beginJob()

void HGcalHitCheck::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 79 of file HGCalHitCheck.cc.

References compareTotals::fs, h_hit1_, h_hit2_, h_hitF_, h_hitL_, h_hitP_, h_hits_, histos_, isotrackApplyRegressor::k, layers_, mergeVDriftHistosByStation::name, nameSense_, tag_, and runGCPTkAlMap::title.

79  {
81  if (!fs.isAvailable()) {
82  edm::LogVerbatim("HitStudy") << "TFileService unavailable: no histograms";
83  } else {
84  histos_ = true;
85  char name[100], title[200];
86  sprintf(name, "HitsL");
87  sprintf(title, "Number of hits in %s for %s", nameSense_.c_str(), tag_.c_str());
88  h_hits_ = fs->make<TH1D>(name, title, 1000, 0, 5000.);
89  h_hits_->GetXaxis()->SetTitle(title);
90  h_hits_->GetYaxis()->SetTitle("Hits");
91  h_hits_->Sumw2();
92  sprintf(name, "HitsF");
93  sprintf(title, "Number of hits in %s for %s in Full Wafers or SiPM 2", nameSense_.c_str(), tag_.c_str());
94  h_hit1_ = fs->make<TH1D>(name, title, 1000, 0, 5000.);
95  h_hit1_->GetXaxis()->SetTitle(title);
96  h_hit1_->GetYaxis()->SetTitle("Hits");
97  h_hit1_->Sumw2();
98  sprintf(name, "HitsP");
99  sprintf(title, "Number of hits in %s for %s in Partial Wafers or SiPM 4", nameSense_.c_str(), tag_.c_str());
100  h_hit2_ = fs->make<TH1D>(name, title, 1000, 0, 5000.);
101  h_hit2_->GetXaxis()->SetTitle(title);
102  h_hit2_->GetYaxis()->SetTitle("Hits");
103  h_hit2_->Sumw2();
104  for (int k = 0; k < layers_; ++k) {
105  sprintf(name, "HitsL%d", k + 1);
106  sprintf(title, "Number of hits in %s for %s in Layer %d", nameSense_.c_str(), tag_.c_str(), k + 1);
107  h_hitL_.emplace_back(fs->make<TH1D>(name, title, 1000, 0, 5000.));
108  h_hitL_.back()->GetXaxis()->SetTitle(title);
109  h_hitL_.back()->GetYaxis()->SetTitle("Hits");
110  h_hitL_.back()->Sumw2();
111  sprintf(name, "HitsF%d", k + 1);
112  sprintf(title,
113  "Number of hits in %s for %s in Full Wafers or SiPM 2 of Layer %d",
114  nameSense_.c_str(),
115  tag_.c_str(),
116  k + 1);
117  h_hitF_.emplace_back(fs->make<TH1D>(name, title, 1000, 0, 5000.));
118  h_hitF_.back()->GetXaxis()->SetTitle(title);
119  h_hitF_.back()->GetYaxis()->SetTitle("Hits");
120  h_hitF_.back()->Sumw2();
121  sprintf(name, "HitsP%d", k + 1);
122  sprintf(title,
123  "Number of hits in %s for %s in Partial Wafers or SiPM 4 of Layer %d",
124  nameSense_.c_str(),
125  tag_.c_str(),
126  k + 1);
127  h_hitP_.emplace_back(fs->make<TH1D>(name, title, 1000, 0, 5000.));
128  h_hitP_.back()->GetXaxis()->SetTitle(title);
129  h_hitP_.back()->GetYaxis()->SetTitle("Hits");
130  h_hitP_.back()->Sumw2();
131  }
132  }
133 }
Log< level::Info, true > LogVerbatim
const std::string nameSense_
std::vector< TH1D * > h_hitP_
const int layers_
std::vector< TH1D * > h_hitF_
const std::string tag_
std::vector< TH1D * > h_hitL_

◆ endJob()

void HGcalHitCheck::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 40 of file HGCalHitCheck.cc.

40 {}

◆ fillDescriptions()

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

Definition at line 67 of file HGCalHitCheck.cc.

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

67  {
69  desc.add<std::string>("moduleLabel", "g4SimHits");
70  desc.add<std::string>("caloHitSource", "HGCHitsEE");
71  desc.add<std::string>("nameSense", "HGCalEESensitive");
72  desc.add<std::string>("nameDevice", "HGCal EE");
73  desc.add<std::string>("tag", "DDD");
74  desc.add<int>("layers", 26);
75  desc.add<int>("verbosity", 0);
76  descriptions.add("hgcalHitCheckEE", desc);
77 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ caloHitSource_

const std::string HGcalHitCheck::caloHitSource_
private

Definition at line 43 of file HGCalHitCheck.cc.

◆ g4Label_

const std::string HGcalHitCheck::g4Label_
private

Definition at line 43 of file HGCalHitCheck.cc.

◆ geomToken_

const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> HGcalHitCheck::geomToken_
private

Definition at line 46 of file HGCalHitCheck.cc.

Referenced by analyze().

◆ h_hit1_

TH1D * HGcalHitCheck::h_hit1_
private

Definition at line 48 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ h_hit2_

TH1D * HGcalHitCheck::h_hit2_
private

Definition at line 48 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ h_hitF_

std::vector<TH1D*> HGcalHitCheck::h_hitF_
private

Definition at line 49 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ h_hitL_

std::vector<TH1D*> HGcalHitCheck::h_hitL_
private

Definition at line 49 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ h_hitP_

std::vector<TH1D*> HGcalHitCheck::h_hitP_
private

Definition at line 49 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ h_hits_

TH1D* HGcalHitCheck::h_hits_
private

Definition at line 48 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ histos_

bool HGcalHitCheck::histos_
private

Definition at line 47 of file HGCalHitCheck.cc.

Referenced by analyze(), and beginJob().

◆ layers_

const int HGcalHitCheck::layers_
private

Definition at line 44 of file HGCalHitCheck.cc.

Referenced by beginJob().

◆ nameDetector_

const std::string HGcalHitCheck::nameDetector_
private

Definition at line 43 of file HGCalHitCheck.cc.

◆ nameSense_

const std::string HGcalHitCheck::nameSense_
private

Definition at line 43 of file HGCalHitCheck.cc.

Referenced by analyze(), beginJob(), and HGcalHitCheck().

◆ tag_

const std::string HGcalHitCheck::tag_
private

Definition at line 43 of file HGCalHitCheck.cc.

Referenced by beginJob().

◆ tok_calo_

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

Definition at line 45 of file HGCalHitCheck.cc.

Referenced by analyze().

◆ verbosity_

const int HGcalHitCheck::verbosity_
private

Definition at line 44 of file HGCalHitCheck.cc.

Referenced by analyze().