Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Feb 16, 2022
1 parent b47a4ef commit 7b21eda
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 53 deletions.
7 changes: 3 additions & 4 deletions SimG4CMS/Calo/plugins/CaloSimHitAnalysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ CaloSimHitAnalysis::CaloSimHitAnalysis(const edm::ParameterSet& ps)
detNames_(ps.getUntrackedParameter<std::vector<std::string> >("detNames")),
tokGeom_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
toks_calo_{edm::vector_transform(hitLab_,
[this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})},
[this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})},
tok_passive_(consumes<edm::PassiveHitContainer>(edm::InputTag(g4Label_, "AllPassiveHits"))) {

usesResource(TFileService::kSharedResource);

edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " Hits|timeSliceUnit:";
Expand Down
65 changes: 30 additions & 35 deletions SimG4CMS/Calo/plugins/CaloSimHitStudy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,28 @@ class CaloSimHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::on
const std::vector<edm::EDGetTokenT<edm::PSimHitContainer>> toks_tkHigh_;
const std::vector<edm::EDGetTokenT<edm::PSimHitContainer>> toks_tkLow_;

const std::vector<std::string> muonLab_ = {"MuonRPCHits",
"MuonCSCHits",
"MuonDTHits",
"MuonGEMHits"};
const std::vector<std::string> muonLab_ = {"MuonRPCHits", "MuonCSCHits", "MuonDTHits", "MuonGEMHits"};
const std::vector<std::string> tkHighLab_ = {"TrackerHitsPixelBarrelHighTof",
"TrackerHitsPixelEndcapHighTof",
"TrackerHitsTECHighTof",
"TrackerHitsTIBHighTof",
"TrackerHitsTIDHighTof",
"TrackerHitsTOBHighTof"};
"TrackerHitsPixelEndcapHighTof",
"TrackerHitsTECHighTof",
"TrackerHitsTIBHighTof",
"TrackerHitsTIDHighTof",
"TrackerHitsTOBHighTof"};
const std::vector<std::string> tkLowLab_ = {"TrackerHitsPixelBarrelLowTof",
"TrackerHitsPixelEndcapLowTof",
"TrackerHitsTECLowTof",
"TrackerHitsTIBLowTof",
"TrackerHitsTIDLowTof",
"TrackerHitsTOBLowTof"};
"TrackerHitsPixelEndcapLowTof",
"TrackerHitsTECLowTof",
"TrackerHitsTIBLowTof",
"TrackerHitsTIDLowTof",
"TrackerHitsTOBLowTof"};

TH1F *hit_[9], *time_[9], *edepEM_[9], *edepHad_[9], *edep_[9];
TH1F *etot_[9], *etotg_[9], *timeAll_[9], *hitMu, *hitHigh;
TH1F *hitLow, *eneInc_, *etaInc_, *phiInc_, *ptInc_;
TH1F *hitTk_[16], *edepTk_[16], *tofTk_[16], *edepC_[9], *edepT_[9];
};

CaloSimHitStudy::CaloSimHitStudy(const edm::ParameterSet& ps) :
g4Label_(ps.getUntrackedParameter<std::string>("ModuleLabel")),
CaloSimHitStudy::CaloSimHitStudy(const edm::ParameterSet& ps)
: g4Label_(ps.getUntrackedParameter<std::string>("ModuleLabel")),
hitLab_(ps.getUntrackedParameter<std::vector<std::string>>("CaloCollection")),
maxEnergy_(ps.getUntrackedParameter<double>("MaxEnergy", 200.0)),
tmax_(ps.getUntrackedParameter<double>("TimeCut", 100.0)),
Expand All @@ -96,26 +93,24 @@ CaloSimHitStudy::CaloSimHitStudy(const edm::ParameterSet& ps) :
testNumber_(ps.getUntrackedParameter<bool>("TestNumbering", true)),
tok_evt_(consumes<edm::HepMCProduct>(edm::InputTag(ps.getUntrackedParameter<std::string>("SourceLabel")))),
toks_calo_{edm::vector_transform(hitLab_,
[this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})},
[this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})},
toks_track_{edm::vector_transform(muonLab_,
[this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})},
[this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})},
toks_tkHigh_{edm::vector_transform(tkHighLab_,
[this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})},
toks_tkLow_{edm::vector_transform(tkLowLab_,
[this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})} {

[this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})},
toks_tkLow_{edm::vector_transform(tkLowLab_, [this](const std::string& name) {
return consumes<edm::PSimHitContainer>(edm::InputTag{g4Label_, name});
})} {
usesResource(TFileService::kSharedResource);

edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " Hits: " << hitLab_[0] << ", " << hitLab_[1] << ", "
<< hitLab_[2] << ", " << hitLab_[3] << " MaxEnergy: " << maxEnergy_
edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " Hits: " << hitLab_[0] << ", " << hitLab_[1]
<< ", " << hitLab_[2] << ", " << hitLab_[3] << " MaxEnergy: " << maxEnergy_
<< " Tmax: " << tmax_ << " MIP Cut: " << eMIP_;

edm::Service<TFileService> tfile;
Expand Down Expand Up @@ -336,7 +331,7 @@ void CaloSimHitStudy::analyze(edm::Event const& e, edm::EventSetup const&) {

std::vector<PSimHit> muonHits;
for (unsigned int i = 0; i < toks_track_.size(); i++) {
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_track_[i]);
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_track_[i]);
if (hitsTrack.isValid()) {
muonHits.insert(muonHits.end(), hitsTrack->begin(), hitsTrack->end());
analyzeHits(hitsTrack, i + 12);
Expand All @@ -346,7 +341,7 @@ void CaloSimHitStudy::analyze(edm::Event const& e, edm::EventSetup const&) {
hitMu->Fill(double(nhmu));
std::vector<PSimHit> tkHighHits;
for (unsigned int i = 0; i < toks_tkHigh_.size(); i++) {
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_tkHigh_[i]);
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_tkHigh_[i]);
if (hitsTrack.isValid()) {
tkHighHits.insert(tkHighHits.end(), hitsTrack->begin(), hitsTrack->end());
analyzeHits(hitsTrack, i);
Expand All @@ -356,7 +351,7 @@ void CaloSimHitStudy::analyze(edm::Event const& e, edm::EventSetup const&) {
hitHigh->Fill(double(nhtkh));
std::vector<PSimHit> tkLowHits;
for (unsigned int i = 0; i < toks_tkLow_.size(); i++) {
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_tkLow_[i]);
const edm::Handle<edm::PSimHitContainer>& hitsTrack = e.getHandle(toks_tkLow_[i]);
if (hitsTrack.isValid()) {
tkLowHits.insert(tkLowHits.end(), hitsTrack->begin(), hitsTrack->end());
analyzeHits(hitsTrack, i + 6);
Expand Down
4 changes: 2 additions & 2 deletions SimG4CMS/Calo/plugins/CaloSteppingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class CaloSteppingAction : public SimProducer,
std::vector<PassiveData> store_;
};

CaloSteppingAction::CaloSteppingAction(const edm::ParameterSet& p) :
iC_(p.getParameter<edm::ParameterSet>("CaloSteppingAction")),
CaloSteppingAction::CaloSteppingAction(const edm::ParameterSet& p)
: iC_(p.getParameter<edm::ParameterSet>("CaloSteppingAction")),
nameEBSD_(iC_.getParameter<std::vector<std::string> >("EBSDNames")),
nameEESD_(iC_.getParameter<std::vector<std::string> >("EESDNames")),
nameHCSD_(iC_.getParameter<std::vector<std::string> >("HCSDNames")),
Expand Down
11 changes: 5 additions & 6 deletions SimG4CMS/Calo/plugins/EcalSimHitStudy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ EcalSimHitStudy::EcalSimHitStudy(const edm::ParameterSet& ps)
tmax_(ps.getUntrackedParameter<double>("TimeCut", 100.0)),
w0_(ps.getUntrackedParameter<double>("W0", 4.7)),
selX_(ps.getUntrackedParameter<int>("SelectX", -1)),
tok_evt_(consumes<edm::HepMCProduct>(edm::InputTag(ps.getUntrackedParameter<std::string>("SourceLabel", "VtxSmeared")))),
toks_calo_{edm::vector_transform(hitLab_,
[this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})} {

tok_evt_(consumes<edm::HepMCProduct>(
edm::InputTag(ps.getUntrackedParameter<std::string>("SourceLabel", "VtxSmeared")))),
toks_calo_{edm::vector_transform(hitLab_, [this](const std::string& name) {
return consumes<edm::PCaloHitContainer>(edm::InputTag{g4Label_, name});
})} {
usesResource(TFileService::kSharedResource);

edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " Hits: " << hitLab_[0] << ", " << hitLab_[1]
Expand Down
12 changes: 6 additions & 6 deletions SimG4CMS/Calo/plugins/HFPMTHitAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ class HFPMTHitAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o
TH1F *hHF12_time[3], *hHF12_time_Ewt[3];
};

HFPMTHitAnalyzer::HFPMTHitAnalyzer(const edm::ParameterSet &iConfig) :
g4Label_(iConfig.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits")),
HFPMTHitAnalyzer::HFPMTHitAnalyzer(const edm::ParameterSet &iConfig)
: g4Label_(iConfig.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits")),
hcalHits_(iConfig.getUntrackedParameter<std::string>("HitCollection", "HcalHits")),
tok_evt_(consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter<std::string>("SourceLabel", "VtxSmeared")))),
tok_evt_(consumes<edm::HepMCProduct>(
edm::InputTag(iConfig.getUntrackedParameter<std::string>("SourceLabel", "VtxSmeared")))),
tok_calo_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hcalHits_))),
tok_track_(consumes<edm::SimTrackContainer>(edm::InputTag(g4Label_))) {
usesResource(TFileService::kSharedResource);

}

void HFPMTHitAnalyzer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
Expand Down Expand Up @@ -203,8 +203,8 @@ void HFPMTHitAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &
if (event_no % 500 == 0)
edm::LogVerbatim("HcalSim") << "Event # " << event_no << " processed.";

const edm::Handle<edm::PCaloHitContainer>& hitsHcal = iEvent.getHandle(tok_calo_);
const edm::Handle<edm::SimTrackContainer>& Tracks = iEvent.getHandle(tok_track_);
const edm::Handle<edm::PCaloHitContainer> &hitsHcal = iEvent.getHandle(tok_calo_);
const edm::Handle<edm::SimTrackContainer> &Tracks = iEvent.getHandle(tok_track_);
const edm::Handle<edm::HepMCProduct> EvtHandle = iEvent.getHandle(tok_evt_);
const HepMC::GenEvent *myGenEvent = EvtHandle->GetEvent();

Expand Down

0 comments on commit 7b21eda

Please sign in to comment.