Skip to content
Snippets Groups Projects
Commit 202677e8 authored by Vincent Pascuzzi's avatar Vincent Pascuzzi
Browse files

Merge from FastChainPileup-00-00-47 (ATLASSIM-2882)

As part of migrating FastCaloSim into ISF, the latest svn tags are
also being merged into release 21. This merge adds
python/FastChain_jobProperties.py, needed for FastChain_Flags.
parent 811c9c36
No related merge requests found
Showing with 1341 additions and 137 deletions
......@@ -32,4 +32,5 @@ atlas_install_headers( FastChainPileup )
atlas_install_joboptions( share/*.py )
atlas_install_runtime( test/FastChainPileup_TestConfiguration.xml )
atlas_install_scripts( scripts/sim_reg_test_fastchain.py )
atlas_install_python_modules( python/*.py )
......@@ -17,8 +17,8 @@
//Base class for all samplers
class Sampler {
public:
Sampler() {};
~Sampler(){};
Sampler() : m_val(0.) {};
virtual ~Sampler(){};
virtual float shoot() {return m_val;};
//float operator () { return this->shoot();};
float m_val;
......@@ -37,7 +37,7 @@ class ConstSampler : public Sampler {
class MomSampler {
public:
MomSampler() {};
MomSampler() : m_mass(NULL) {};
~MomSampler(){};
virtual TLorentzVector shoot() {return m_val;};
TLorentzVector m_val;
......@@ -218,7 +218,7 @@ RndmSeq = RandomSeqSampler
class CyclicSeqSampler : public Sampler {
public:
~CyclicSeqSampler() {};
CyclicSeqSampler(const CyclicSeqSampler & orig) {m_sequence = orig.m_sequence;};
CyclicSeqSampler(const CyclicSeqSampler & orig) : m_index(0) {m_sequence = orig.m_sequence;};
CyclicSeqSampler(std::string s) {
size_t pos = 0;
std::string token;
......@@ -566,7 +566,7 @@ class EThetaMPhiSampler(MomSampler):
//Create a 4-momentum vector from pt, eta, m and phi distributions/samplers.
class PtEtaMPhiSampler : public MomSampler{
public:
~PtEtaMPhiSampler() {};
~PtEtaMPhiSampler() { if (m_pt) delete m_pt; if (m_eta) delete m_eta; if (m_phi) delete m_phi;};
PtEtaMPhiSampler(float ptmin, float ptmax, float etamin, float etamax, float mass=0.0, float phimin=0, float phimax=2.*TMath::Pi()){
if (ptmin==ptmax)
m_pt = new ConstSampler(ptmin);
......
package FastChainPileup
author Richard Hawkings <richard.hawkings@cern.ch>
use AtlasPolicy AtlasPolicy-*
use Lhapdf Lhapdf-* External
use Pythia8 Pythia8-* External
use Pythia8_i Pythia8_i-* Generators
use GaudiInterface GaudiInterface-* External
use AtlasROOT AtlasROOT-* External
use GeneratorModules GeneratorModules-* Generators
private
use TestPolicy TestPolicy-*
use AtlasCLHEP AtlasCLHEP-* External
library FastChainPileup MultiPy8Pileup.cxx MultiParticleGunPileup.cxx components/*.cxx
apply_pattern component_library
apply_pattern validate_xml
apply_pattern declare_joboptions files="*.py"
apply_pattern declare_scripts files="-s=$(FastChainPileup_root)/scripts sim_reg_test_fastchain.py"
public
macro FastChainPileup_TestConfiguration "../test/FastChainPileup_TestConfiguration.xml"
apply_pattern declare_runtime extras="../test/FastChainPileup_TestConfiguration.xml"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Mainpage for doxygen
/**
@mainpage package FastChainPileup
@author Richard Hawkings, Vladimir Lyubushkin
This package provides code related to pileup emulation in the fast simulation
chain.
@section MultiPy8Pileup
This algorithm runs Pythia8 to generate multiple pileup events into a
single McEventCollection with a specified key. It inherits from Pythia8_i
which does the real work of interfacing to the Pythia8 generator, and just
provides the code to call the generator a number of times, according to
a given pileup profile.
The algorithm has the following parameters:
- NCollPerEvent: The mean number of pileup collisions per event (bunch
crossing), known as mu.If this is set to a positive value, the givem fixed mu
is used. If it is set to -1, the pileup profile specified by PileupProfile
is used instead.
- PileupProfile: An array of integers, giving the histogram for the mu
distribution to be simulated.
- MultBCID: An array of floats, giving the mu multiplier values R for BCIDs 1, 2, 3.. Events will be generated for the number of BCIDs given (numbered from 1),
and for each BCID, the number of events will be sampled from a Poisson
distribution with the mean mu chosen from the pileup profile, then multiplied
by the multilplier R. Thus an array of [1.0, 1.5] will produce in-time
pileup with BCID=1 according to mu, and then 1.5* this amount of out-of-time
pileup with BCID=2. The different BCIDs can then be treated differently
using the ISF simulation selectors.
- HistFile: If this is set to a non-null value, a ROOT file with the
corresponding name will be produced, with three histograms: pileupProfile giving
the input profile, generatedMu giving the generated mu profile (it should
be compatible with the input profile) and generatedEvents, which shows the
distribution of number of pileup events - equivalent to the mu profile but
with the additional Poisson fluctuations, filled for nevt values for each
BCID (but before multiplying by the R values).
@section Req The requirements file:
@include requirements
@section Uses The packages used:
@htmlinclude used_packages.html
*/
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
## @file Simulation/FastSimulation/FastChainPileup/python/FastChain_jobProperties.py
## @purpose Python module to hold common flags to configure JobOptions
## this is needed for configuring the bcid for Out-of-Time PU with the FastChain
##
""" FastChain_jobProperties
"""
__author__ = "J. Schaarschmidt"
__version__= "$Revision$"
__doc__ = "FastChain_jobProperties"
__all__ = [ "FastChain_jobProperties" ]
# kindly stolen from ISF_Flags by E. Ritsch
##-----------------------------------------------------------------------------
## Import
from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
from AthenaCommon.JobProperties import jobproperties
class FastChainBCID(JobProperty):
"""Steering of FastChain: Setting the BCID for Out-of-Time PU events"""
statusOn = True
allowedTypes = ['list']
#StoredValue = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
StoredValue = [1]
class FastChainPUWeights_lar_em(JobProperty):
"""Steering of FastChain: LAr EM weights for Out-of-Time PU events"""
statusOn = True
allowedTypes = ['list']
#StoredValue = [0.48,1.0,0.68,0.25,-0.008,-0.12,-0.17,-0.18,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.18,-0.13,-0.07,-0.03,-0.01,-0.003,-0.001]
StoredValue = [1.0]
class FastChainPUWeights_lar_hec(JobProperty):
"""Steering of FastChain: LAr HEC weights for Out-of-Time PU events"""
statusOn = True
allowedTypes = ['list']
#StoredValue = [0.52,1.0,0.7,0.26,-0.01,-0.15,-0.2,-0.22,-0.23,-0.23,-0.23,-0.23,-0.23,-0.23,-0.22,-0.15,-0.08,-0.04,-0.01,-0.005,-0.002,-0.0006,0.0]
StoredValue = [1.0]
class FastChainPUWeights_lar_bapre(JobProperty):
"""Steering of FastChain: LAr Barrel presampler weights for Out-of-Time PU events"""
statusOn = True
allowedTypes = ['list']
#StoredValue = [0.42,1.0,0.73,0.33,0.07,-0.06,-0.12,-0.15,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.16,-0.12,-0.07,-0.03]
StoredValue = [1.0]
class FastChainPUWeights_tile(JobProperty):
"""Steering of FastChain: Tile weights for Out-of-Time PU events"""
statusOn = True
allowedTypes = ['list']
#StoredValue = [0.5,1.0,0.5,0.06,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
StoredValue = [1.0]
#class FastChainPUWeights(JobProperty):
# """Steering of FastChain: global weights for Out-of-Time PU events"""
# statusOn = True
# allowedTypes = ['list']
# StoredValue = [0.5,2.0,-0.3]
##-----------------------------------------------------------------------------
## 2nd step
## Definition of the InDet flag container
class FastChain_jobProperties(JobPropertyContainer):
"""Container for the FastChain key flags
"""
pass
##-----------------------------------------------------------------------------
## 3rd step
## adding the container to the general top-level container
jobproperties.add_Container(FastChain_jobProperties)
##-----------------------------------------------------------------------------
## 4th step
## adding flags to the jobProperties container
jobproperties.FastChain_jobProperties.add_JobProperty(FastChainBCID)
#jobproperties.FastChain_jobProperties.add_JobProperty(FastChainPUWeights)
jobproperties.FastChain_jobProperties.add_JobProperty(FastChainPUWeights_lar_em)
jobproperties.FastChain_jobProperties.add_JobProperty(FastChainPUWeights_lar_hec)
jobproperties.FastChain_jobProperties.add_JobProperty(FastChainPUWeights_lar_bapre)
jobproperties.FastChain_jobProperties.add_JobProperty(FastChainPUWeights_tile)
##-----------------------------------------------------------------------------
## 5th step
## short-cut for lazy people
## carefull: do not select ISF_jobProperties as a short name as well.
## otherwise problems with pickle
## Note: you still have to import it:
## >>> from ISF_Example.ISF_jobProperties import ISF_Flags
FastChain_Flags = jobproperties.FastChain_jobProperties
......@@ -92,7 +92,7 @@ def get_recent(path,pathsplit):
return good_rel_refease
###Add EOS prefix###
def eoscp(filename,jobname,tag,store_tag,release):
def eoscp(package,filename,jobname,nightly,tag,store_tag,release):
##rel_list=["0","1","2","3","4","5","6"]
current=os.getcwd()
if os.environ.has_key('LS_SUBCWD'):
......@@ -110,18 +110,21 @@ def eoscp(filename,jobname,tag,store_tag,release):
## elif tag=="yesterday":
## release=arg_list[0]+"_"+rel_list[int(arg_list[1])-1]
## print release
postfix='/'.join(argv[-3:])
#postfix='/'.join(argv[-3:])
postfix="x86_64-slc6-gcc49-opt/offline/"+package
#middle='/'.join(argv[-6:-5])
middle=argv[-5]
#middle=argv[-5]
middle=nightly
pathlist=["prod","batch"]#This 2nd option should make the script work on the RTT test instance.
# status=0
for path in pathlist:
prefix="root://eosatlas//eos/atlas/atlascerngroupdisk/proj-sit/rtt/"+path+"/rtt"
##print "postfix: "+postfix
##print "middle: "+middle
##print "prefix: "+prefix
##print "jobname: "+jobname
##print "filename: "+filename
#print "postfix: "+postfix
#print "middle: "+middle
#print "prefix: "+prefix
#print "jobname: "+jobname
#print "filename: "+filename
path=prefix+'/'+release+'/'+middle+'/'+postfix+'/'+jobname+'/'+filename
print "Path to check on eos: "+path
if store_tag!='':
......@@ -296,7 +299,7 @@ if __name__ == "__main__":
if len(file_list_val)!=0:
print "The following files were not found in the output directory of today's job: "+str(file_list_val)+", will try to copy them from EOS instead."
for val_f in file_list_val:
if eoscp(val_f,sys.argv[8],"today",store_tag,good_rel_mon)!=0 :
if eoscp(sys.argv[5],val_f,sys.argv[7],sys.argv[6],"today",store_tag,good_rel_mon)!=0 :
print "File does not exist in EOS."
else:
file_list_val.remove(val_f)
......@@ -337,7 +340,7 @@ if __name__ == "__main__":
if len(file_list_ref)!=0:
print "The following files were not found in the output directory of "+good_rel_ref+"'s job: "+str(file_list_ref)+", will try to copy them from EOS instead."
for ref_f in file_list_ref :
if eoscp(ref_f,sys.argv[4],"yesterday",store_tag,good_rel_ref)!=0:
if eoscp(sys.argv[1],ref_f,sys.argv[3],sys.argv[2],"yesterday",store_tag,good_rel_ref)!=0:
print "File does not exist in EOS."
else:
file_list_ref.remove(ref_f)
......
......@@ -32,6 +32,8 @@ evgenConfig.keywords = ["QCD", "minBias","SM"]
# following copied from nonStandard/Pythia8/Pythia8_A2_MSTW2008LO_Common.py
# modified to use MultiPy8Pileup
from FastChainPileup.FastChain_jobProperties import FastChain_Flags
from FastChainPileup.FastChainPileupConf import MultiPy8Pileup
genSeq += MultiPy8Pileup("Pythia8")
evgenConfig.generators += ["Pythia8"]
......@@ -79,9 +81,14 @@ genSeq.Pythia8.McEventsRW=gen_pu
genSeq.Pythia8.NCollPerEvent=-1
genSeq.Pythia8.PileupProfile=pileUpProfile
genSeq.Pythia8.MultBCID=[1.]
#genSeq.Pythia8.MultBCID=[1.]
genSeq.Pythia8.MultBCID=FastChain_Flags.FastChainBCID()
# genSeq.Pythia8.HistFile='profile.root'
fast_chain_log.info("Check FastChainBCID Value");
fast_chain_log.info(FastChain_Flags.FastChainBCID.get_Value())
randomSeed=0
if hasattr(runArgs, "randomSeed"):
randomSeed=runArgs.randomSeed
......
......@@ -24,7 +24,8 @@ MultiParticleGunPileup::MultiParticleGunPileup(const std::string& name, ISvcLoca
m_file(NULL),
m_htgPileupProfile(NULL),
m_htgPileupMu(NULL),
m_htgPileupEvents(NULL)
m_htgPileupEvents(NULL),
partSampler(NULL)
{
declareProperty("NCollPerEvent",m_ncollevent=20,"Collisons per event (-1 to use profile)");
declareProperty("PileupProfile",m_pileupProfile,"Pileup profile array");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment