From ded0a6d3ccacdd38615cbcb94b413d5d52abf451 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 5 Sep 2020 16:06:27 +0200 Subject: [PATCH] Add a new testing code to check V14 geometry of HGCal --- .../python/hgcalSiliconValidation_cfi.py | 8 + .../test/HGCalSiliconValidation.cc | 170 ++++++++++++++++ .../test/python/protoHGCalSimWatcher_cfg.py | 190 ++++++++++++++++++ .../test/python/protoSimValid_cfg.py | 188 +++++++++++++++++ .../test/python/protoValid_cfg.py | 170 ++++++++++++++++ 5 files changed, 726 insertions(+) create mode 100644 Validation/HGCalValidation/python/hgcalSiliconValidation_cfi.py create mode 100644 Validation/HGCalValidation/test/HGCalSiliconValidation.cc create mode 100644 Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py create mode 100644 Validation/HGCalValidation/test/python/protoSimValid_cfg.py create mode 100644 Validation/HGCalValidation/test/python/protoValid_cfg.py diff --git a/Validation/HGCalValidation/python/hgcalSiliconValidation_cfi.py b/Validation/HGCalValidation/python/hgcalSiliconValidation_cfi.py new file mode 100644 index 0000000000000..97e91a3218d04 --- /dev/null +++ b/Validation/HGCalValidation/python/hgcalSiliconValidation_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.HGCalValidation.hgcalSiliconAnalysisEE_cfi import * + +hgcalSiliconAnalysisHEF = hgcalSiliconAnalysisEE.clone( + detectorName = cms.untracked.string("HGCalHESiliconSensitive"), + HitCollection = cms.untracked.string('HGCHitsHEfront'), + DigiCollection = cms.untracked.InputTag("hgcalDigis","HEfront")) diff --git a/Validation/HGCalValidation/test/HGCalSiliconValidation.cc b/Validation/HGCalValidation/test/HGCalSiliconValidation.cc new file mode 100644 index 0000000000000..fcdaad1303719 --- /dev/null +++ b/Validation/HGCalValidation/test/HGCalSiliconValidation.cc @@ -0,0 +1,170 @@ +// system include files +#include +#include +#include +#include +#include + +// user include files +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" + +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +// Root objects +#include "TROOT.h" +#include "TSystem.h" +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" + +class HGCalSiliconValidation : public edm::one::EDAnalyzer { +public: + explicit HGCalSiliconValidation(const edm::ParameterSet& ps); + ~HGCalSiliconValidation() override {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +protected: + void beginJob() override {} + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override {} + void analyze(edm::Event const&, edm::EventSetup const&) override; + +private: + edm::Service fs_; + const std::string g4Label_, nameDetector_, hgcalHits_; + const edm::InputTag hgcalDigis_; + const int iSample_; + edm::EDGetTokenT tok_hits_; + edm::EDGetToken tok_digi_; + + TH1D *hsimE1_, *hsimE2_, *hsimTm_; + TH1D *hsimLn_, *hdigEn_, *hdigLn_; + TH2D *hsimOc_, *hsi2Oc_, *hdigOc_, *hdi2Oc_; +}; + +HGCalSiliconValidation::HGCalSiliconValidation(const edm::ParameterSet& ps) + : g4Label_(ps.getUntrackedParameter("ModuleLabel", "g4SimHits")), + nameDetector_(ps.getUntrackedParameter("detectorName", "HGCalEESensitive")), + hgcalHits_((ps.getUntrackedParameter("HitCollection", "HGCHitsEE"))), + hgcalDigis_(ps.getUntrackedParameter("DigiCollection")), + iSample_(ps.getUntrackedParameter("Sample", 5)) { + usesResource(TFileService::kSharedResource); + + tok_hits_ = consumes(edm::InputTag(g4Label_, hgcalHits_)); + tok_digi_ = consumes(hgcalDigis_); + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation::Input for SimHit:" << edm::InputTag(g4Label_, hgcalHits_) << " Digits:" << hgcalDigis_ << " Sample: " << iSample_; +} + +void HGCalSiliconValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.addUntracked("ModuleLabel", "g4SimHits"); + desc.addUntracked("detectorName", "HGCalEESensitive"); + desc.addUntracked("HitCollection", "HGCHitsEE"); + desc.addUntracked("DigiCollection", edm::InputTag("hgcalDigis", "EE")); + desc.addUntracked("Sample", 5); + descriptions.add("hgcalSiliconAnalysisEE", desc); +} + +void HGCalSiliconValidation::beginRun(edm::Run const&, edm::EventSetup const& es) { + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation::Booking the Histograms"; + + //Histograms for Sim Hits + hsimE1_ = fs_->make("SimHitEn1", "Sim Hit Energy", 1000, 0.0, 1.0); + hsimE2_ = fs_->make("SimHitEn2", "Sim Hit Energy", 1000, 0.0, 1.0); + hsimTm_ = fs_->make("SimHitTime", "Sim Hit Time", 1000, 0.0, 500.0); + hsimLn_ = fs_->make("SimHitLong", "Sim Hit Long. Profile", 60, 0.0, 30.0); + hsimOc_ = fs_->make("SimHitOccup", "Sim Hit Occupnacy", 300, 0.0, 300.0, 60, 0.0, 30.0); + hsi2Oc_ = fs_->make("SimHitOccu2", "Sim Hit Occupnacy", 300, 300.0, 600.0, 300, 0.0, 300.0); + //Histograms for Digis + hdigEn_ = fs_->make("DigiEnergy", "Digi ADC Sample", 1000, 0.0, 1000.0); + hdigLn_ = fs_->make("DigiLong", "Digi Long. Profile", 60, 0.0, 30.0); + hdigOc_ = fs_->make("DigiOccup", "Digi Occupnacy", 300, 0.0, 300.0, 60, 0.0, 30.0); + hdi2Oc_ = fs_->make("DigiOccu2", "Digi Occupnacy", 300, 300.0, 600.0, 300, 0.0, 300.0); +} + +void HGCalSiliconValidation::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation:Run = " << e.id().run() << " Event = " << e.id().event(); + + edm::ESHandle geom; + iSetup.get().get(nameDetector_, geom); + if (!geom.isValid()) { + edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; + } else { + const HGCalGeometry* geom0 = geom.product(); + + //SimHits + edm::Handle hitsCalo; + e.getByToken(tok_hits_, hitsCalo); + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation.: PCaloHitContainer obtained with flag " << hitsCalo.isValid(); + if (hitsCalo.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation: PCaloHit buffer " << hitsCalo->size(); + unsigned i(0); + std::map map_try; + for (edm::PCaloHitContainer::const_iterator it = hitsCalo->begin(); it != hitsCalo->end(); ++it) { + double energy = it->energy(); + double time = it->time(); + unsigned int id = it->id(); + GlobalPoint pos = geom0->getPosition(DetId(id)); + double r = pos.perp(); + double z = std::abs(pos.z()); + int lay = HGCSiliconDetId(id).layer(); + hsimE1_->Fill(energy); + hsimTm_->Fill(time, energy); + hsimOc_->Fill(r, lay, energy); + hsi2Oc_->Fill(z, r, energy); + hsimLn_->Fill(lay, energy); + double ensum = (map_try.count(id) != 0) ? map_try[id] : 0; + ensum += energy; + map_try[id] = ensum; + ++i; + edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " " << HGCSiliconDetId(id) << " E " << energy << " time " << time; + } + for (std::map::iterator itr = map_try.begin(); itr != map_try.end(); ++itr) { + hsimE2_->Fill((*itr).second); + } + } + + //Digits + unsigned int kount(0); + edm::Handle digicoll; + e.getByToken(tok_digi_, digicoll); + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation.: HGCalDigiCollection obtained with flag " << digicoll.isValid(); + if (digicoll.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalSiliconValidation: HGCalDigi buffer " << digicoll->size(); + for (HGCalDigiCollection::const_iterator it = digicoll->begin(); it != digicoll->end(); ++it) { + HGCalDataFrame df(*it); + double energy = df[iSample_].data(); + HGCSiliconDetId cell(df.id()); + GlobalPoint pos = geom0->getPosition(cell); + double r = pos.perp(); + double z = std::abs(pos.z()); + int depth = cell.layer(); + hdigEn_->Fill(energy); + hdigLn_->Fill(depth); + hdigOc_->Fill(r, depth); + hdi2Oc_->Fill(z, r); + ++kount; + edm::LogVerbatim("HGCalValidation") << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy; + } + } + } +} + +DEFINE_FWK_MODULE(HGCalSiliconValidation); diff --git a/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py new file mode 100644 index 0000000000000..f82355bc07b5f --- /dev/null +++ b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py @@ -0,0 +1,190 @@ +############################################################################### +# Way to use this: +# cmsRun protoVHGCalSimWatcher_cfg.py geometry=D62 +# +# Options for geometry D49, D58, D59, D62 +# +############################################################################### +import FWCore.ParameterSet.Config as cms +import os, sys, imp, re +import FWCore.ParameterSet.VarParsing as VarParsing + +############################################################ +### SETUP OPTIONS +options = VarParsing.VarParsing('standard') +options.register('geometry', + "D62", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "geometry of operations: D49, D58, D59, D62") + +### get and parse the command line arguments +options.parseArguments() + +print(options) + +############################################################ +# Use the options + +if (options.geometry == "D49"): + from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 + process = cms.Process('PROD',Phase2C9) + process.load('Configuration.Geometry.GeometryExtended2026D49_cff') + process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +elif (options.geometry == "D58"): + from Configuration.Eras.Era_Phase2C12_cff import Phase2C12 + process = cms.Process('PROD',Phase2C12) + process.load('Configuration.Geometry.GeometryExtended2026D58_cff') + process.load('Configuration.Geometry.GeometryExtended2026D58Reco_cff') +elif (options.geometry == "D59"): + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D59_cff') + process.load('Configuration.Geometry.GeometryExtended2026D59Reco_cff') +else: + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D62_cff') + process.load('Configuration.Geometry.GeometryExtended2026D62Reco_cff') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load('Configuration.StandardSequences.L1TrackTrigger_cff') +process.load('Configuration.StandardSequences.DigiToRaw_cff') +process.load('HLTrigger.Configuration.HLT_Fake2_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.RecoSim_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1000) +) + +process.MessageLogger.cerr.FwkReport.reportEvery = 5 +if hasattr(process,'MessageLogger'): + process.MessageLogger.categories.append('ValidHGCal') + process.MessageLogger.categories.append('HGCalGeom') + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string(''), + annotation = cms.untracked.string(''), + name = cms.untracked.string('Applications') +) + +# Output definition +process.output = cms.OutputModule("PoolOutputModule", + splitLevel = cms.untracked.int32(0), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = cms.untracked.vstring( + 'keep *_*hbhe*_*_*', + 'keep *_g4SimHits_*_*', + 'keep *_*HGC*_*_*', + ), + fileName = cms.untracked.string('file:testHGCalSimWatcher.root'), + dataset = cms.untracked.PSet( + filterName = cms.untracked.string(''), + dataTier = cms.untracked.string('GEN-SIM-DIGI-RAW-RECO') + ), + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ) +) + +# Additional output definition +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( + SimG4HGCalValidation = cms.PSet( + Names = cms.vstring( + 'HGCalEESensitive', + 'HGCalHESensitive', + 'HGCalHESiliconSensitive', + 'HGCalHEScintillatorSensitive', + ), + Types = cms.vint32(0,0,0,0), + DetTypes = cms.vint32(0,1,1,2), + LabelLayerInfo = cms.string("HGCalInfoLayer"), + Verbosity = cms.untracked.int32(0), + ), + type = cms.string('SimG4HGCalValidation') +)) + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +process.generator = cms.EDProducer("FlatRandomPtGunProducer", + PGunParameters = cms.PSet( + MaxPt = cms.double(20.0), + MinPt = cms.double(20.0), + PartID = cms.vint32(13), #--->muon + MaxEta = cms.double(3.0), + MaxPhi = cms.double(3.14159265359), + MinEta = cms.double(1.2), + MinPhi = cms.double(-3.14159265359) + ), + Verbosity = cms.untracked.int32(0), + psethack = cms.string('single muon pt 20'), + AddAntiParticle = cms.bool(False), + firstRun = cms.untracked.uint32(1) +) + + +#Modified to produce hgceedigis +process.mix.digitizers = cms.PSet(process.theDigitizersValid) + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.digitisation_step = cms.Path(process.pdigi_valid) +process.L1simulation_step = cms.Path(process.SimL1Emulator) +process.L1TrackTrigger_step = cms.Path(process.L1TrackTrigger) +process.digi2raw_step = cms.Path(process.DigiToRaw) +process.raw2digi_step = cms.Path(process.RawToDigi) +process.L1Reco_step = cms.Path(process.L1Reco) +process.reconstruction_step = cms.Path(process.localreco) +process.recosim_step = cms.Path(process.recosim) +process.out_step = cms.EndPath(process.output) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step, + process.simulation_step, + process.digitisation_step, + process.L1simulation_step, + process.L1TrackTrigger_step, + process.digi2raw_step, + process.raw2digi_step, + process.L1Reco_step, + process.reconstruction_step, + process.recosim_step, + process.out_step + ) + +# filter all path with the production filter sequence +for path in process.paths: + if getattr(process,path)._seq is not None: getattr(process,path)._seq = process.ProductionFilterSequence * getattr(process,path)._seq diff --git a/Validation/HGCalValidation/test/python/protoSimValid_cfg.py b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py new file mode 100644 index 0000000000000..6bb5a9866f6bc --- /dev/null +++ b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py @@ -0,0 +1,188 @@ +############################################################################### +# Way to use this: +# cmsRun protoSimValid_cfg.py geometry=D62 type=hgcalBHValidation +# +# Options for geometry D49, D58, D59, D62 +# type hgcalBHValidation, hgcalSiliconValidation +# +############################################################################### +import FWCore.ParameterSet.Config as cms +import os, sys, imp, re +import FWCore.ParameterSet.VarParsing as VarParsing + +############################################################ +### SETUP OPTIONS +options = VarParsing.VarParsing('standard') +options.register('geometry', + "D62", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "geometry of operations: D49, D58, D59, D62") +options.register ('type', + "hgcalBHValidation", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "type of operations: hgcalBHValidation, hgcalSiliconValidation") + +### get and parse the command line arguments +options.parseArguments() + +print(options) + +############################################################ +# Use the options + +if (options.geometry == "D49"): + from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 + process = cms.Process('PROD',Phase2C9) + process.load('Configuration.Geometry.GeometryExtended2026D49_cff') + process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD49.root' + else: + fileName = 'hgcBHValidD49.root' +elif (options.geometry == "D58"): + from Configuration.Eras.Era_Phase2C12_cff import Phase2C12 + process = cms.Process('PROD',Phase2C12) + process.load('Configuration.Geometry.GeometryExtended2026D58_cff') + process.load('Configuration.Geometry.GeometryExtended2026D58Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD58.root' + else: + fileName = 'hgcBHValidD58.root' +elif (options.geometry == "D59"): + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D59_cff') + process.load('Configuration.Geometry.GeometryExtended2026D59Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD59.root' + else: + fileName = 'hgcBHValidD59.root' +else: + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D62_cff') + process.load('Configuration.Geometry.GeometryExtended2026D62Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD62.root' + else: + fileName = 'hgcBHValidD62.root' + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load('Configuration.StandardSequences.L1TrackTrigger_cff') +process.load('Configuration.StandardSequences.DigiToRaw_cff') +process.load('HLTrigger.Configuration.HLT_Fake2_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.RecoSim_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(2000) +) + +process.MessageLogger.cerr.FwkReport.reportEvery = 5 +if hasattr(process,'MessageLogger'): + process.MessageLogger.categories.append('HGCalGeom') + +# Input source +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomPtGunProducer", + PGunParameters = cms.PSet( + MaxPt = cms.double(35.0), + MinPt = cms.double(35.0), + PartID = cms.vint32(13), #--->muon + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinEta = cms.double(1.2), + MaxEta = cms.double(3.0) + ), + Verbosity = cms.untracked.int32(0), + psethack = cms.string('single muon pt 35'), + AddAntiParticle = cms.bool(True), + firstRun = cms.untracked.uint32(1) +) + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string(''), + annotation = cms.untracked.string(''), + name = cms.untracked.string('Applications') +) + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +# Additional output definition +process.TFileService = cms.Service("TFileService", + fileName = cms.string(fileName), + closeFileFast = cms.untracked.bool(True) ) + +#Modified to produce hgceedigis +process.mix.digitizers = cms.PSet(process.theDigitizersValid) +process.ProductionFilterSequence = cms.Sequence(process.generator) + +#Following Removes Mag Field +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.bField = cms.double(0.0) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.digitisation_step = cms.Path(process.pdigi_valid) +process.L1simulation_step = cms.Path(process.SimL1Emulator) +process.L1TrackTrigger_step = cms.Path(process.L1TrackTrigger) +process.digi2raw_step = cms.Path(process.DigiToRaw) +process.raw2digi_step = cms.Path(process.RawToDigi) +process.L1Reco_step = cms.Path(process.L1Reco) +process.reconstruction_step = cms.Path(process.localreco) +process.recosim_step = cms.Path(process.recosim) + +if (options.type == "hgcalSiliconValidation"): + process.load('Validation.HGCalValidation.hgcalSiliconValidation_cfi') + process.analysis_step = cms.Path(process.hgcalSiliconAnalysisEE+process.hgcalSiliconAnalysisHEF) +else: + process.load('Validation.HGCalValidation.hgcalBHValidation_cfi') + process.analysis_step = cms.Path(process.hgcalBHAnalysis) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step, + process.simulation_step, + process.digitisation_step, + process.L1simulation_step, + process.L1TrackTrigger_step, + process.digi2raw_step, + process.raw2digi_step, + process.L1Reco_step, + process.reconstruction_step, + process.recosim_step, + process.analysis_step, + ) + +# filter all path with the production filter sequence +for path in process.paths: + if getattr(process,path)._seq is not None: getattr(process,path)._seq = process.ProductionFilterSequence * getattr(process,path)._seq diff --git a/Validation/HGCalValidation/test/python/protoValid_cfg.py b/Validation/HGCalValidation/test/python/protoValid_cfg.py new file mode 100644 index 0000000000000..f4684ca279134 --- /dev/null +++ b/Validation/HGCalValidation/test/python/protoValid_cfg.py @@ -0,0 +1,170 @@ +############################################################################### +# Way to use this: +# cmsRun protoValid_cfg.py geometry=D62 type=hgcalSimHitStudy defaultInput=1 +# +# Options for geometry D49, D58, D59, D62 +# type hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy, +# hgcalRecHitStudy, hgcalSiliconValidation +# defaultInput 1, 0 +# +############################################################################### +import FWCore.ParameterSet.Config as cms +import os, sys, imp, re +import FWCore.ParameterSet.VarParsing as VarParsing + +############################################################ +### SETUP OPTIONS +options = VarParsing.VarParsing('standard') +options.register('geometry', + "D62", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "geometry of operations: D49, D58, D59, D62") +options.register('type', + "hgcalGeomCheck", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "type of operations: hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy, hgcalRecHitStudy, hgcalSiliconValidation") +options.register('defaultInput', + 1, # default Value = true + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "change files path in case of defaultInput=0 for using DIGI o/p") + +### get and parse the command line arguments +options.parseArguments() + +print(options) + +############################################################ +# Use the options + +if (options.geometry == "D49"): + from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 + process = cms.Process('PROD',Phase2C9) + process.load('Configuration.Geometry.GeometryExtended2026D49_cff') + process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD49.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD49.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD49.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD49.root' + else: + fileName = 'hgcSilValidD49.root' + else: + fileName = 'hgcGeomCheckD49.root' +elif (options.geometry == "D58"): + from Configuration.Eras.Era_Phase2C12_cff import Phase2C12 + process = cms.Process('PROD',Phase2C12) + process.load('Configuration.Geometry.GeometryExtended2026D58_cff') + process.load('Configuration.Geometry.GeometryExtended2026D58Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD58.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD58.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD58.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD58.root' + else: + fileName = 'hgcSilValidD58.root' + else: + fileName = 'hgcGeomCheckD58.root' +elif (options.geometry == "D59"): + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D59_cff') + process.load('Configuration.Geometry.GeometryExtended2026D59Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD59.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD59.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD59.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD59.root' + else: + fileName = 'hgcSilValidD59.root' + else: + fileName = 'hgcGeomCheckD59.root' +else: + from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 + process = cms.Process('PROD',Phase2C11) + process.load('Configuration.Geometry.GeometryExtended2026D62_cff') + process.load('Configuration.Geometry.GeometryExtended2026D62Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD62.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD62.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD62.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD62.root' + else: + fileName = 'hgcSilValidD62.root' + else: + fileName = 'hgcGeomCheckD62.root' + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load('Configuration.StandardSequences.Services_cff') +process.load("Configuration.EventContent.EventContent_cff") +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['phase2_realistic'] + +process.MessageLogger.cerr.FwkReport.reportEvery = 5 +if hasattr(process,'MessageLogger'): + process.MessageLogger.categories.append('HGCalGeom') + +if (options.type == "hgcalSimHitStudy"): + process.load('Validation.HGCalValidation.hgcSimHitStudy_cfi') + process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:step1.root') ) + process.analysis_step = cms.Path(process.hgcalSimHitStudy) +elif (options.type == "hgcalDigiStudy"): + process.load('Configuration.StandardSequences.RawToDigi_cff') + process.load('Validation.HGCalValidation.hgcDigiStudy_cfi') + process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:step2.root') ) + process.analysis_step = cms.Path(process.RawToDigi+process.hgcalDigiStudyEE+process.hgcalDigiStudyHEF+process.hgcalDigiStudyHEB) +elif (options.type == "hgcalRecHitStudy"): + process.load('Validation.HGCalValidation.hgcalRecHitStudy_cff') + process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:step3.root') ) + process.analysis_step = cms.Path(process.hgcalRecHitStudyEE+process.hgcalRecHitStudyFH+process.hgcalRecHitStudyBH) +elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileIn = "file:step2.root" + else: + fileIn = "file:step1.root" + process.load('Validation.HGCalValidation.hgcalSiliconValidation_cfi') + process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring(fileIn) ) + process.analysis_step = cms.Path(process.hgcalSiliconAnalysisEE+process.hgcalSiliconAnalysisHEF) +else: + process.load('Validation.HGCalValidation.hgcGeomCheck_cff') + process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:testHGCalSimWatcher.root') + ) + process.analysis_step = cms.Path(process.hgcGeomCheck) + + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) ) +process.TFileService = cms.Service("TFileService", + fileName = cms.string(fileName), + closeFileFast = cms.untracked.bool(True) ) +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) +) + +# Schedule definition +process.schedule = cms.Schedule(process.analysis_step)