Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:00:05

0001 #! /bin/bash
0002 
0003 #preferred_dir="/data/ecalod-22/dump-data"
0004 preferred_dir=`pwd`
0005 log_dir=$preferred_dir/log/
0006 conf_dir=$preferred_dir/conf/
0007 #cmssw_dir=/nfshome0/ecaldev/DUMP/CMSSW_1_7_1/src
0008 cmssw_dir=`pwd`
0009 
0010 # in case you wanted to force  execution inside the preferred_dir
0011 # if [ "$PWD" != $preferred_dir ]; then
0012 #
0013 # echo ""
0014 # echo "this script should be executed from $preferred_dir"
0015 # echo "please do:"
0016 # echo "            cd $preferred_dir"
0017 # echo ""
0018 # exit
0019 #
0020 #fi
0021 
0022 mkdir -p  $preferred_dir/log/
0023 mkdir -p  $preferred_dir/conf
0024 
0025 if [ ! -n "$1" ]
0026 
0027 then
0028 
0029 echo ""
0030 echo "This script produces a CMSSW file containing raw data for FEDs showing CRC errors" 
0031 echo ""
0032 echo "Options:"
0033 echo ""
0034 echo "      -p|--path_file        file_path       data file to be analyzed preceeded by path"
0035 echo ""
0036 echo "      -f|--first_ev         f_ev            first (as written to file) event that will be analyzed; default is 1"
0037 echo "      -l|--last_ev          l_ev            last (as written to file) event that will be analyzed; default is 9999"
0038 
0039 echo ""
0040 echo ""
0041 exit
0042 
0043 fi
0044 
0045 
0046 
0047 
0048 data_path="/data/ecalod-22/daq-data/"
0049 data_file="none"
0050 
0051 cfg_path="$conf_dir"
0052 
0053 first_event=1
0054 last_event=-1
0055 
0056 
0057 
0058   while [ $# -gt 0 ]; do    # Finché ci sono parametri . . .
0059     case "$1" in
0060 
0061       -p|--path_file)
0062                 data_path="$2"
0063                 ;;
0064 
0065       -f|--first_ev)
0066                 first_event="$2"
0067                 ;;
0068 
0069       -l|--last_ev)
0070                 last_event="$2"
0071                 ;;
0072 
0073     esac
0074     shift
0075 
0076 done
0077 
0078 data_file=${data_path##*/} 
0079 extension=${data_file##*.}
0080 
0081 echo ""
0082 echo ""
0083 echo "data to be analyzed:                          $data_file"
0084 echo "first event analyzed will be:                 $first_event"
0085 first_event=$(($first_event-1))
0086 
0087 echo "last event analyzed will be:                  $last_event"
0088 echo "first fed that will be dumped:                $beg_fed_id"
0089 echo "last fed that will be dumped:                 $end_fed_id"
0090 
0091 
0092 echo ""
0093 echo ""
0094 
0095 if [[ $extension == "root" ]]; then
0096   input_module="
0097 # if getting data from a .root pool file
0098   source = PoolSource {
0099     untracked uint32 skipEvents = $first_event
0100       untracked vstring fileNames = { 'file:$data_path' }
0101     untracked bool   debugFlag     = true
0102    }"
0103 else
0104   input_module="
0105      source = NewEventStreamFileReader{
0106        untracked uint32 skipEvents = $first_event
0107        untracked vstring fileNames = { 'file:$data_path' }
0108        untracked uint32 debugVebosity = 10
0109        untracked bool   debugFlag     = true
0110      }" 
0111 fi
0112 
0113 cat > "$cfg_path$data_file".crcError.$$.cfg <<EOF
0114 process CRCERRORDUMP = { 
0115 
0116 
0117     module fedErrorFilter = FEDErrorFilter 
0118     {
0119         InputTag InputLabel = source
0120     }
0121 
0122     module ecalFedProducer = EcalFEDWithCRCErrorProducer
0123     {
0124         InputTag InputLabel = source
0125     }
0126 
0127     path p = { fedErrorFilter, ecalFedProducer }
0128 
0129     module out = PoolOutputModule
0130     {
0131         untracked PSet SelectEvents = 
0132         {
0133             vstring SelectEvents = { "p" }
0134         }
0135         untracked string filterName = "crcErrorSkim"
0136         untracked vstring outputCommands = 
0137         {
0138             # keep all infos about the event, after the skim
0139             "drop *",
0140             "keep *_ecalFedProducer_*_*" 
0141         }
0142         untracked string fileName ="${data_file}.$$.crcErrorSkim.root"
0143     }    
0144 
0145     endpath e = {out}
0146 
0147     service = MessageLogger{
0148        untracked vstring destinations = { "cout" }
0149        untracked PSet cout = {
0150          untracked string threshold = "WARNING"
0151          untracked PSet default  = { untracked int32 limit = 0 }
0152        }
0153      }
0154 
0155 
0156     untracked PSet maxEvents = {untracked int32 input = $last_event}
0157 
0158     $input_module
0159 
0160 }
0161 
0162 
0163 EOF
0164 
0165 echo "initializing cmssw..."
0166 #. /nfshome0/cmssw/cmsset_default.sh
0167 cd $cmssw_dir;
0168 eval `scramv1 ru -sh`;
0169 cd -;
0170 echo "... running" 
0171 cmsRun "$cfg_path$data_file".crcError.$$.cfg >& "$log_dir$data_file".$$.crcError
0172 
0173 echo ""
0174 echo ""
0175 echo ""
0176 echo "-------------------------------------------------------------------------------------------------------------------------"
0177 echo "crcError dump completed in file ${data_file}.$$.crcErrorSkim.root"
0178 echo "-------------------------------------------------------------------------------------------------------------------------"
0179 echo ""
0180 echo ""
0181