File indexing completed on 2023-03-17 11:24:39
0001
0002
0003 cat > runCastorSLMaker_cfg.template <<EOF
0004 import FWCore.ParameterSet.Config as cms
0005 import time
0006 import datetime
0007
0008 process = cms.Process("CastorShowerLibraryMaker")
0009
0010 process.common_maximum_timex = cms.PSet(
0011 MaxTrackTime = cms.double(500.0),
0012 MaxTimeNames = cms.vstring('ZDCRegion','QuadRegion','InterimRegion'),
0013 MaxTrackTimes = cms.vdouble(2000.0,0.0,0.0)
0014 )
0015
0016 process.common_pgun_particleID = cms.PSet(
0017 PartID = cms.vint32(11,211)
0018 )
0019
0020 process.load("SimGeneral.HepPDTESSource.pdt_cfi")
0021
0022 process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi")
0023
0024
0025 process.load("SimG4CMS.Forward.castorGeometryXML_cfi")
0026
0027
0028
0029
0030
0031
0032
0033 process.load("SimG4Core.Application.g4SimHits_cfi")
0034
0035 process.MessageLogger = cms.Service("MessageLogger",
0036 destinations = cms.untracked.vstring('cout')
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 )
0049
0050
0051 t = datetime.datetime.now()
0052
0053 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0054 moduleSeeds = cms.PSet(
0055 g4SimHits = cms.untracked.uint32(t.second),
0056 VtxSmeared = cms.untracked.uint32(t.microsecond),
0057 generator = cms.untracked.uint32(t.second*t.microsecond)
0058 )
0059
0060 )
0061
0062 process.maxEvents = cms.untracked.PSet(
0063 input = cms.untracked.int32(1000000000)
0064 )
0065
0066
0067 process.g4SimHits.UseMagneticField = False
0068
0069 process.g4SimHits.Generator.MinEtaCut = -7.0
0070 process.g4SimHits.Generator.MaxEtaCut = 7.0
0071 process.g4SimHits.Generator.Verbosity = 0
0072 process.g4SimHits.CaloTrkProcessing.TestBeam = True
0073
0074
0075 process.CaloSD = cms.PSet(
0076 DetailedTiming = cms.bool(False),
0077 EminTrack = cms.double(1.0),
0078 Verbosity = cms.int32(0),
0079 UseMap = cms.bool(True),
0080 CheckHits = cms.int32(25),
0081 TmaxHit = cms.int32(500)
0082 )
0083
0084 process.g4SimHits.StackingAction = cms.PSet(
0085 process.common_heavy_suppression,
0086 process.common_maximum_timex,
0087 TrackNeutrino = cms.bool(False),
0088 KillHeavy = cms.bool(False),
0089 KillDeltaRay = cms.bool(False),
0090 SaveFirstLevelSecondary = cms.untracked.bool(True),
0091 SavePrimaryDecayProductsAndConversionsInTracker = cms.untracked.bool(True),
0092 SavePrimaryDecayProductsAndConversionsInCalo = cms.untracked.bool(True),
0093 SavePrimaryDecayProductsAndConversionsInMuon = cms.untracked.bool(True)
0094 )
0095
0096 process.g4SimHits.SteppingAction = cms.PSet(
0097 process.common_maximum_timex,
0098 KillBeamPipe = cms.bool(True),
0099 CriticalEnergyForVacuum = cms.double(2.0),
0100 CriticalDensity = cms.double(1e-15),
0101 EkinNames = cms.vstring(),
0102 EkinThresholds = cms.vdouble(),
0103 EkinParticles = cms.vstring(),
0104 Verbosity = cms.untracked.int32(0)
0105 )
0106
0107 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0108 PGunParameters = cms.PSet(
0109 process.common_pgun_particleID,
0110 MinEta = cms.double(-6.6),
0111 MaxEta = cms.double(-5.2),
0112 MinPhi = cms.double(0.),
0113 MaxPhi = cms.double(0.7854),
0114 MinE = cms.double(12.00),
0115
0116 MaxE = cms.double(14.00)
0117
0118 ),
0119 AddAntiParticle = cms.bool(False),
0120 Verbosity = cms.untracked.int32(False)
0121 )
0122
0123 process.g4SimHits.CastorSD.useShowerLibrary = False
0124
0125 process.source = cms.Source("EmptySource")
0126
0127
0128
0129
0130
0131 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0132 type = cms.string('CastorShowerLibraryMaker'),
0133 CastorShowerLibraryMaker = cms.PSet(
0134 process.common_pgun_particleID,
0135 EventNtupleFileName = cms.string('SL_had_E12GeV_eta-6.0phi0.3_1events-ppON.root'),
0136 Verbosity = cms.int32(0),
0137 DeActivatePhysicsProcess = cms.bool(False),
0138 StepNtupleFileName = cms.string('stepNtuple_pion_electron_E12GeV_1event-ppON.root'),
0139 StepNtupleFlag = cms.int32(0),
0140 EventNtupleFlag = cms.int32(0),
0141
0142 nemEvents = cms.int32(5),
0143 SLemEnergyBins = cms.vdouble(10.),
0144 SLemEtaBins = cms.vdouble(-6.6,-6.4,-6.2,-6.0,-5.8,-5.6,-5.4),
0145 SLemPhiBins = cms.vdouble(0.,0.15708,0.31416,0.47124,0.62832),
0146 nhadEvents = cms.int32(5),
0147 SLhadEnergyBins = cms.vdouble(10.),
0148
0149 SLhadEtaBins = cms.vdouble(-6.6,-6.4,-6.2,-6.0,-5.8,-5.6,-5.4),
0150 SLhadPhiBins = cms.vdouble(0.,0.15708,0.31416,0.47124,0.62832),
0151 SLMaxPhi = cms.double(0.7854),
0152 SLMaxEta = cms.double(-5.2)
0153 )
0154 ))
0155
0156
0157 process.p1 = cms.Path(process.generator*process.VtxSmeared*process.g4SimHits)
0158
0159 EOF
0160
0161
0162 set cfg_in = "runCastorSLMaker_cfg.template"
0163 set cfg_out = runCastorSLMaker_cfg
0164 set SL_merged
0165 set eta_phi_tag = "7eta-6.6--5.2_5phi0-0.7854"
0166
0167 set merge_script="do_merge-`date +%d%b%Y.%H%M%S`.csh"
0168 cat > $merge_script <<EOF
0169
0170 set exec = \$CMSSW_BASE/bin/\$SCRAM_ARCH/CastorShowerLibraryMerger
0171 if (! -e \$exec) then
0172 echo "\$exec not found. Exiting"
0173 exit
0174 endif
0175 \$exec \\
0176 EOF
0177 echo "Give the number of events in the phi bin for EM shower"
0178 @ nevtem = "$<"
0179 echo "Give the number of events in the phi bin for HAD shower"
0180 @ nevthad = "$<"
0181 if ($nevtem == 0 && $nevthad == 0) exit
0182
0183 set primId
0184
0185 if ($nevtem > 0 && $nevthad == 0) then
0186 set simfile = "sim_electron_E";set evtfile = "SL_em_E"
0187 @ nevt = $nevtem
0188 set primId = 11
0189 else if ($nevtem == 0 && $nevthad > 0) then
0190 set simfile = "sim_pion_E";set evtfile = "SL_had_E"
0191 @ nevt = $nevthad
0192 set primId = 211
0193 else if ($nevtem > 0 && $nevthad > 0) then
0194 set simfile = "sim_electron+pion_E";set evtfile = "SL_em+had_E"
0195 if ($nevtem != $nevthad) then
0196 echo "Use the same number of events for both showers"
0197 exit
0198 endif
0199 @ nevt = $nevtem
0200 set primId = "11,211"
0201 endif
0202 echo "Give the energy bin limits (format low_lim,upp_lim; enter to finish)"
0203 set emax
0204 while(1)
0205 set bin = "$<"
0206 if ("$bin" == "") break
0207 set SL_merged=$SL_merged"`echo $bin|cut -d, -f1`-"
0208 set sbin=`echo $bin|tr ',' '_'`
0209 if (("x$emax" != "x")&&("x`echo $bin|cut -d, -f 1`" != "x$emax")) then
0210 echo "Energy bin not contiguous. Exiting."
0211 rm -f $SL_merged
0212 exit
0213 endif
0214 set emin=`echo $bin|cut -d, -f 1`
0215 set emax=`echo $bin|cut -d, -f 2`
0216 sed -e '/PartID/ s/(.*)/('$primId')/' \
0217 -e '/fileName/ s/sim_.*root/\/tmp\/'$simfile$sbin$eta_phi_tag'.root/' \
0218 -e 's/cms.EDProducer.*/cms.EDProducer("FlatRandomEGunProducer",/' \
0219 -e '/MinE / {s/#//; s/(.*)/('$emin')/}'\
0220 -e '/MaxE / {s/#//; s/(.*)/('$emax')/}'\
0221 -e '/^ *Energybins/ s/^ */&#/' \
0222
0223
0224 -e '/EventNtupleFileName/ s/SL.*_E.*GeV.*.root/'$evtfile$sbin'GeV_'$eta_phi_tag'.root/' \
0225 -e '/EventNtupleFileName/ s/_[0-9]*events/_'$nevt'events/' \
0226 -e '/StepNtupleFileName/ s/_E.*GeV.*.root/_E'$sbin'GeV_'$eta_phi_tag'.root/'\
0227 -e '/nemEvents/ s/=.*$/= cms.int32('$nevtem'),/' \
0228 -e '/^ *SLemEnergyBins/ s/(.*)/('$emin')/' \
0229 -e '/nhadEvents/ s/=.*$/= cms.int32('$nevthad'),/' \
0230 -e '/^ *SLhadEnergyBins/ s/(.*)/('$emin')/' $cfg_in >! ${cfg_out}_E${sbin}.py
0231 bsub -q 2nw <<EOF
0232
0233 set SL_HOME=$PWD
0234 cd \$SL_HOME
0235 cmsenv
0236 cmsRun ${cfg_out}_E${sbin}.py
0237 EOF
0238 set input_file = `grep EventNtupleFileName ${cfg_out}_E${sbin}.py|sed -e's/^.*SL/SL/' -e's/.root.*/.root/'`
0239 echo $input_file' \' >> $merge_script
0240 end
0241 set SL_merged=$SL_merged$emax
0242 echo $input_file|sed -e's/_E.*GeV/_E'$SL_merged'GeV/' >> $merge_script
0243 chmod +x $merge_script