Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jul 16, 2021
1 parent 39e705e commit 59aa7b8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
10 changes: 5 additions & 5 deletions SimG4CMS/Calo/interface/HCalSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class TH1F;
class HCalSD : public CaloSD, public Observer<const BeginOfJob*> {
public:
HCalSD(const std::string&,
const HcalDDDSimConstants*,
const HcalDDDRecConstants*,
const HcalSimulationConstants*,
const HBHEDarkening*,
const HBHEDarkening*,
const HcalDDDSimConstants*,
const HcalDDDRecConstants*,
const HcalSimulationConstants*,
const HBHEDarkening*,
const HBHEDarkening*,
const SensitiveDetectorCatalog&,
edm::ParameterSet const&,
const SimTrackManager*);
Expand Down
38 changes: 25 additions & 13 deletions SimG4CMS/Calo/plugins/HcalSensitiveDetectorBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,26 @@
class HcalSensitiveDetectorBuilder : public SensitiveDetectorMakerBase {
public:
explicit HcalSensitiveDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc)
: hdscToken_{cc.esConsumes<edm::Transition::BeginRun>()}, hdrcToken_{cc.esConsumes<edm::Transition::BeginRun>()}, hscsToken_{cc.esConsumes<edm::Transition::BeginRun>()}, hbdkToken_{cc.esConsumes<HBHEDarkening, HBHEDarkeningRecord, edm::Transition::BeginRun>(edm::ESInputTag{"","HB"})}, hedkToken_{cc.esConsumes<HBHEDarkening, HBHEDarkeningRecord, edm::Transition::BeginRun>(edm::ESInputTag{"","HE"})}, hcalDDSim_{nullptr}, hcalDDRec_{nullptr}, hcalSimConstants_{nullptr}, hbDarkening_{nullptr}, heDarkening_{nullptr} {
edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
agingFlagHB_ = m_HC.getParameter<bool>("HBDarkening");
agingFlagHE_ = m_HC.getParameter<bool>("HEDarkening");
forTBHC_ = m_HC.getUntrackedParameter<bool>("ForTBHCAL", false);
forTBH2_ = m_HC.getUntrackedParameter<bool>("ForTBH2", false);
}
: hdscToken_{cc.esConsumes<edm::Transition::BeginRun>()},
hdrcToken_{cc.esConsumes<edm::Transition::BeginRun>()},
hscsToken_{cc.esConsumes<edm::Transition::BeginRun>()},
hbdkToken_{
cc.esConsumes<HBHEDarkening, HBHEDarkeningRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", "HB"})},
hedkToken_{
cc.esConsumes<HBHEDarkening, HBHEDarkeningRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", "HE"})},
hcalDDSim_{nullptr},
hcalDDRec_{nullptr},
hcalSimConstants_{nullptr},
hbDarkening_{nullptr},
heDarkening_{nullptr} {
edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
agingFlagHB_ = m_HC.getParameter<bool>("HBDarkening");
agingFlagHE_ = m_HC.getParameter<bool>("HEDarkening");
forTBHC_ = m_HC.getUntrackedParameter<bool>("ForTBHCAL", false);
forTBH2_ = m_HC.getUntrackedParameter<bool>("ForTBH2", false);
}

void beginRun(const edm::EventSetup& es) final {
void beginRun(const edm::EventSetup& es) final {
hcalDDSim_ = &es.getData(hdscToken_);
if ((!forTBHC_) && (!forTBH2_))
hcalDDRec_ = &es.getData(hdrcToken_);
Expand All @@ -47,16 +58,16 @@ class HcalSensitiveDetectorBuilder : public SensitiveDetectorMakerBase {
if (agingFlagHB_) {
edm::ESHandle<HBHEDarkening> hbdark = es.getHandle(hbdkToken_);
if (hbdark.isValid())
hbDarkening_ = hbdark.product();
hbDarkening_ = hbdark.product();
else
edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HBDarkening";
edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HBDarkening";
}
if (agingFlagHE_) {
edm::ESHandle<HBHEDarkening> hedark = es.getHandle(hedkToken_);
if (hedark.isValid())
heDarkening_ = hedark.product();
heDarkening_ = hedark.product();
else
edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HEDarkening";
edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HEDarkening";
}
}

Expand All @@ -65,7 +76,8 @@ class HcalSensitiveDetectorBuilder : public SensitiveDetectorMakerBase {
const edm::ParameterSet& p,
const SimTrackManager* man,
SimActivityRegistry& reg) const final {
auto sd = std::make_unique<HCalSD>(iname, hcalDDSim_, hcalDDRec_, hcalSimConstants_, hbDarkening_, heDarkening_, clg, p, man);
auto sd = std::make_unique<HCalSD>(
iname, hcalDDSim_, hcalDDRec_, hcalSimConstants_, hbDarkening_, heDarkening_, clg, p, man);
SimActivityRegistryEnroller::enroll(reg, sd.get());
return sd;
}
Expand Down
10 changes: 5 additions & 5 deletions SimG4CMS/Calo/src/HCalSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
#endif

HCalSD::HCalSD(const std::string& name,
const HcalDDDSimConstants* hcns,
const HcalDDDRecConstants* hcnr,
const HcalSimulationConstants* hscs,
const HBHEDarkening* hbd,
const HBHEDarkening* hed,
const HcalDDDSimConstants* hcns,
const HcalDDDRecConstants* hcnr,
const HcalSimulationConstants* hscs,
const HBHEDarkening* hbd,
const HBHEDarkening* hed,
const SensitiveDetectorCatalog& clg,
edm::ParameterSet const& p,
const SimTrackManager* manager)
Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Calo/src/HcalTestNS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

//#define EDM_ML_DEBUG

HcalTestNS::HcalTestNS(const HcalDDDRecConstants* hcons) : hcons_(hcons) { }
HcalTestNS::HcalTestNS(const HcalDDDRecConstants* hcons) : hcons_(hcons) {}

HcalTestNS::~HcalTestNS() {}

Expand Down

0 comments on commit 59aa7b8

Please sign in to comment.