File indexing completed on 2024-04-06 12:29:25
0001
0002
0003 function sigHdl(){
0004 if [ -e $TMPFILE ]; then
0005 rm "$TMPFILE"
0006 true
0007 fi
0008 exit 0
0009 }
0010
0011 trap sigHdl 0
0012 TMPFILE=get_sr_config__.py
0013
0014 default_global_tag=START39_V6::All
0015 default_db=frontier://FrontierProd/CMS_COND_34X_ECAL
0016 default_auth=/afs/cern.ch/cms/DB/conddb
0017 function help(){
0018 cat <<EOF
0019
0020 Usage: get_sr_config [-l] [-T global_tag] [-t sr_tag] [-o FILE]"
0021
0022 Desciption: tool to retrieve Selective readout emulation setting from condition database.
0023
0024 OPTION:
0025 -l list available tags
0026 -T GLOBAL_TAG specifies global tag (default: $default_global_tag) for tag list mode (see -l option)
0027 -t SR_TAG specifies conddb tag for selective readout setting, if different than default from global tag
0028 -c DB specifies database connection string (default: $default_db)
0029 -P [ --auth-path ] PATH path to authentication xml(default $default_auth)
0030 -o FILE dump configuration into a file instead of standard output
0031 -h --help display this help
0032
0033 EOF
0034 }
0035
0036 # Note that we use `"$@"' to let each command-line parameter expand to a
0037 # separate word. The quotes around `$@' are essential!
0038 # We need TEMP as the `eval set --' would nuke the return value of getopt.
0039 temp=`getopt -o hlt:T:c:o: --long help,auth-path \
0040 -n 'get_sr_config' -- "$@"`
0041 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
0042
0043 # Note the quotes around `$TEMP': they are essential!
0044 eval set -- "$temp"
0045
0046 global_tag=$default_global_tag
0047 db=$default_db
0048 auth=$default_auth
0049 mode=read_config
0050 out=/dev/stdout
0051 unset sr_tag
0052
0053 while true ; do
0054 case "$1" in
0055 -h|--help) help; exit 0;;
0056 -l) mode=list_tags; shift;;
0057 -T) globla_tag="$2"; shift 2;;
0058 -t) sr_tag="$2"; shift 2;;
0059 -c|--auth-path) db="$2"; shift 2;;
0060 -o) out="$2"; shift 2;;
0061 --) shift ; break ;; #end of options. It remains only the args.
0062 *) echo "Internal error!" ; exit 1 ;;
0063 esac
0064 done
0065
0066 if [ $# != 0 ]; then
0067 help
0068 exit 1
0069 fi
0070
0071 if [ -z "$CMSSW_BASE" ]; then
0072 echo "No CMSSW environment defined. CMSSW environment must be set using scramv1 runtime command"
0073 exit
0074 fi
0075
0076 if [ X$mode = Xlist_tags ]; then
0077 cmscond_list_iov -c "$db" -P/afs/cern.ch/cms/DB/conddb -a | grep EcalSRSetting
0078 else
0079 cat > $TMPFILE <<EOF
0080 import FWCore.ParameterSet.Config as cms
0081
0082 #global_tag='START39_V6::All'
0083 #sr_tag = 'EcalSRSettings_beam2010_v01_mc'
0084 #sr_tag = 'EcalSRSettings_beam2010_v01_offline'
0085 #sr_tag = 'EcalSRSettings_fullreadout_v01_mc'
0086 #sr_tag = 'EcalSRSettings_lowlumi_v01_mc'
0087 #sr_tag = 'EcalSRSettings_lumi1e33_v01_mc'
0088
0089 process = cms.Process("ProcessOne")
0090
0091 process.MessageLogger = cms.Service("MessageLogger",
0092 debugModules = cms.untracked.vstring('*'),
0093 destinations = cms.untracked.vstring('cerr')
0094 )
0095
0096 process.maxEvents = cms.untracked.PSet(
0097 input = cms.untracked.int32(1)
0098 )
0099 process.source = cms.Source("EmptySource")
0100
0101 process.readFromDB = cms.EDAnalyzer("EcalSRCondTools",
0102 mode = cms.string("read")
0103 )
0104
0105 process.p = cms.Path(process.readFromDB)
0106
0107 # Conditions
0108 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0109 process.GlobalTag.globaltag = '$global_tag'
0110 EOF
0111
0112
0113 if [ -n "$sr_tag" ]; then
0114 cat >> "$TMPFILE" <<EOF
0115 process.GlobalTag.toGet = cms.VPSet(
0116 cms.PSet(record = cms.string("EcalSRSettingsRcd"),
0117 tag = cms.string('$sr_tag'),
0118 connect = cms.untracked.string('$db')
0119 ))
0120
0121 EOF
0122 fi
0123 cmsRun $TMPFILE > "$out"
0124 fi