Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:55

0001 #! /bin/bash
0002 
0003 
0004 #preferred_dir="/data/ecalod-22/dump-data"
0005 preferred_dir=`pwd`
0006 log_dir=$preferred_dir/log/
0007 conf_dir=$preferred_dir/conf/
0008 #cmssw_dir="/nfshome0/ecaldev/DUMP/CMSSW_1_3_0_pre3/src"
0009 cmssw_dir=`pwd`
0010 
0011 # in case you wanted to force  execution inside the preferred_dir
0012 # if [ "$PWD" != $preferred_dir ]; then
0013 #
0014 # echo ""
0015 # echo "this script should be executed from $preferred_dir"
0016 # echo "please do:"
0017 # echo "            cd $preferred_dir"
0018 # echo ""
0019 # exit
0020 #
0021 #fi
0022 
0023 mkdir -p  $preferred_dir/log/
0024 mkdir -p  $preferred_dir/conf
0025 
0026 if [ ! -n "$1" ]
0027 
0028 then
0029 
0030 echo ""
0031 echo "This script prints to screen:"
0032 echo " the digi (10 samples) of a certain crystal (cry) in a given supermodule,"
0033 echo " or of a given PN diode (pn)."
0034 echo " You can also get the list of the data format errors in the mem or trigger primitives"
0035 echo ""
0036 echo "Options:"
0037 echo ""
0038 echo "      -p|--path_file        file_path       path to the data to be analyzed (default is /data/ecalod-22/daq-data/)"
0039 echo "      -d|--data_file        file_name       data file to be analyzed"
0040 echo ""
0041 echo "      -f|--first_ev         f_ev            first (as written to file) event that will be analyzed; default is 1"
0042 echo "      -l|--last_ev          l_ev            last  (as written to file) event that will be analyzed; default is 9999"
0043 echo "      -eb|--ieb_id          ieb_id          selects sm barrel id (1...36); default is all"
0044 echo "      -me|--memErrors       0-1             show mem integrity problems; default is 0"
0045 echo "      -cry|--cryDigi        ic              digis from channel ic will be shown"
0046 echo "      -tt|--triggerTower    tt              digis from channel whole tower tt will be shown"
0047 echo "      -pn|--pnDigi          pd_id           digis from pn number pd_id will be shown"
0048 echo "      -tp|--trigPrimDigi    0-1             trigger primitive digis will be shown; default is 0"
0049 
0050 echo ""
0051 echo ""
0052 exit
0053 
0054 fi
0055 
0056 
0057 data_path="/data/ecalod-22/daq-data/"
0058 data_file="none"
0059 
0060 cfg_path="$conf_dir"
0061 
0062 
0063 ieb=1
0064 
0065 memErrors=0;
0066 memString="emtpy";
0067 
0068 cry_ic=1;
0069 tt_id=1;
0070 cryString="false";
0071 towerString="false";
0072 
0073 pn_num=1;
0074 pnString="false";
0075 
0076 trpr=0;
0077 
0078 first_event=1
0079 last_event=9999
0080 
0081 
0082 
0083   while [ $# -gt 0 ]; do    # Finché ci sono parametri . . .
0084     case "$1" in
0085 
0086       -p|--path_file)
0087                 data_path="$2"
0088                 ;;
0089 
0090       -d|--data_file)
0091                 data_file="$2"
0092                 ;;
0093 
0094 
0095       -f|--first_ev)
0096                 first_event="$2"
0097                 ;;
0098 
0099 
0100       -l|--last_ev)
0101                 last_event="$2"
0102                 ;;
0103 
0104 
0105       -eb|--ieb_id)
0106                 ieb="$2"
0107                 ;;
0108 
0109       -me|--memErrors)
0110                 memErrors="$2";
0111                 ;;
0112 
0113       -cry|--cryDigi)
0114                 cry_ic="$2"
0115                 cryString="true"
0116                 ;;
0117 
0118       -tt|--triggerTower)
0119                 tt_id="$2"
0120                 towerString="true"
0121                 cryString="true"
0122                 ;;
0123 
0124       -pn|--pnDigi)
0125                 pn_num="$2"
0126                 pnString="true";
0127                 ;;
0128 
0129       -tp|--trigPrimDigi)
0130                 trpr="$2"
0131                 ;;
0132 
0133 
0134     esac
0135     shift       # Verifica la serie successiva di parametri.
0136 
0137 done
0138 
0139 echo ""
0140 echo ""
0141 echo "data to be analyzed:                          $data_file"
0142 echo "first event analyzed will be:                 $first_event"
0143 first_event=$(($first_event-1))
0144 
0145 echo "last event analyzed will be:                  $last_event"
0146 echo "supermodule selected:                         $ieb"
0147 
0148         if [[  $memErrors = 1  ]]
0149 then
0150 echo "mem boxes data format problems will be dumped"
0151         memString="true";
0152 else
0153 echo "mem boxes data format problems will not be dumped"
0154         memString="false";
0155 fi
0156 
0157 
0158 if [[  $cryString = "true"  ]]
0159 then
0160         echo "channel selected for digis:                   $cry_ic"
0161 fi
0162 
0163 
0164 if [[  $pnString = "true"  ]]
0165 then
0166         echo "pn selected for digis:                        $pn_num"
0167 fi
0168 
0169 if [[  $trpr = 1  ]]
0170 then
0171         echo "trigger primitives will be dumped"
0172         tpString="true";
0173 else
0174         tpString="false";
0175         echo "trigger primitives will not be dumped"
0176 fi
0177 
0178 
0179 echo ""
0180 echo ""
0181 
0182 
0183 
0184 
0185 cat > "$cfg_path$data_file".digi.$$.cfg <<EOF
0186 
0187 process TESTDUMPER = { 
0188 
0189 # if getting data from a .root pool file
0190        source = PoolSource {
0191                untracked uint32 skipEvents = $first_event
0192                untracked vstring fileNames = { 'file:$data_path$data_file' }
0193            untracked bool   debugFlag     = true
0194           }
0195 
0196   untracked PSet maxEvents = {untracked int32 input = $last_event}
0197 
0198      module ecalEBunpacker = EcalDCCTBUnpackingModule{ }
0199 
0200 # verbosity =0:  only headings
0201      module digi = EcalDigiDumperModule{
0202         untracked int32 verbosity      = 1
0203 
0204         # selection on sm number in the barrel (1... 36; 1 with tb unpacker)
0205         # if not specified or value set to -1, no selection will be applied
0206         untracked int32 ieb_id      = 1
0207 
0208         untracked bool memErrors    = $memString
0209 
0210         untracked bool cryDigi      = $cryString
0211         untracked bool pnDigi       = $pnString
0212         untracked bool tpDigi        = $tpString
0213 
0214        untracked int32 mode           = 2
0215  
0216          # if mode is 1 specify these parameters
0217          untracked int32 numChannel     = 3
0218          untracked int32 numPN          = 2
0219 
0220          # if mode is 2 specify these otherparameters
0221          untracked vint32  listChannels = { $cry_ic }
0222          untracked vint32  listTowers = { $tt_id }
0223          untracked vint32  listPns = { $pn_num }
0224       }
0225      
0226      module counter = AsciiOutputModule{}
0227 
0228      path p      = {ecalEBunpacker, digi}
0229 
0230      endpath end = { counter }
0231 
0232 }
0233 
0234 
0235 EOF
0236 
0237 
0238 echo "initializing cmssw..."
0239 export SCRAM_ARCH=slc3_ia32_gcc323
0240 #. /nfshome0/cmssw/cmsset_default.sh
0241 cd $cmssw_dir;
0242 eval `scramv1 ru -sh`;
0243 cd -;
0244 echo "... running"
0245 cmsRun "$cfg_path$data_file".digi.$$.cfg | tee "$log_dir$data_file".$$.digi
0246 
0247 echo ""
0248 echo ""
0249 echo ""
0250 echo "-------------------------------------------------------------------------------------------------------------------------"
0251 echo "digi dump completed. To see the results edit: 
0252 echo  "$log_dir$data_file".$$.digi"
0253 echo "-------------------------------------------------------------------------------------------------------------------------"
0254 echo ""
0255 echo ""
0256