ATLAS Offline Software
Loading...
Searching...
No Matches
DecorateSUSYProcessConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3#==============================================================================
4# SUSY signal process augmentation
5# Component accumulator version
6#==============================================================================
7
8def IsSUSYSignalRun3(flags):
9 """Identify SUSY signal sample"""
10 if not flags.Input.isMC:
11 return False
12 # with MC16, there are no dedicated SUSY DSID blocks anymore but blocks for
13 # each generator: see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PmgMcSoftware#DSID_blocks
14 if flags.Input.MCChannelNumber >= 500000:
15 # there does not seem to be an elegant way to check whether its a SUSY sample
16 # or not, thus run the mark all MadGraph samples as SUSY for the moment
17 # to non-SUSY MG samples this adds only an empty decoration and does not break anything
18 isSUSY = flags.Input.MCChannelNumber < 600000
19 print("DecorateSUSYProcess: fileinfo.mc_channel_number",
20 flags.Input.MCChannelNumber, "is SUSY (aka is MG):", isSUSY)
21 # for pre-MC16 samples use the old way
22 else:
23 import os
24 if not os.access('/cvmfs/atlas.cern.ch/repo/sw/Generators/MC15JobOptions/latest/share/Blocks.list', os.R_OK):
25 # Do it the old-fashioned way
26 # https://svnweb.cern.ch/trac/atlasoff/browser/Generators/MC15JobOptions/trunk/share/Blocks.list
27 isSUSY = (370000 <= flags.Input.MCChannelNumber < 405000) or (406000 <= flags.Input.MCChannelNumber < 410000) \
28 or (436000 <= flags.Input.MCChannelNumber < 439000) or (448000 <= flags.Input.MCChannelNumber < 450000)
29 else:
30 # Automatic detection based on cvmfs
31 isSUSY = False
32 blocks = open('/cvmfs/atlas.cern.ch/repo/sw/Generators/MC15JobOptions/latest/share/Blocks.list', 'r')
33 for l in blocks.readlines():
34 if 'SUSY' not in l:
35 continue
36 myrange = l.split()[0].replace('DSID', '').replace('xxx', '000', 1).replace('xxx', '999', 1)
37 low = int(myrange.split('-')[0])
38 high = int(myrange.split('-')[1]) if '-' in myrange else int(myrange.replace('000', '999'))
39 if low <= flags.Input.MCChannelNumber and flags.Input.MCChannelNumber <= high:
40 isSUSY = True
41 break
42 print("DecorateSUSYProcess: fileinfo.mc_channel_number",
43 flags.Input.MCChannelNumber, "is SUSY:", isSUSY)
44 return isSUSY
45
46# Configure SUSY signal tagger
47
48
49def SUSYSignalTaggerCfg(flags, derivationName):
50 """Configure SUSY signal tagger"""
51 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
52 from AthenaConfiguration.ComponentFactory import CompFactory
53 acc = ComponentAccumulator()
54 if not IsSUSYSignalRun3(flags):
55 print("SUSYSignalTaggerCfg WARNING: Trying to decorate, but sample is not SUSY signal?")
56 acc.addPublicTool(CompFactory.DerivationFramework.SUSYSignalTagger(name=derivationName + "SignalTagger",
57 EventInfoName="EventInfo",
58 MCCollectionName="TruthParticles"),
59 primary=True)
60 return acc
void print(char *figname, TCanvas *c1)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310