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 text file containing the Ecal raw data in hexadecimal format."
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 "      -bf|--beg_fed_id      b_f_id          fed_id: EE- is 601-609,  EB is 610-645,  EE- is 646-654; default is 0"
0040 echo "      -ef|--end_fed_id      e_f_id          when using 'single sm' fed corresponds to construction number; default is 654"
0041 
0042 echo ""
0043 echo ""
0044 exit
0045 
0046 fi
0047 
0048 
0049 
0050 
0051 data_path="/data/ecalod-22/daq-data/"
0052 data_file="none"
0053 
0054 cfg_path="$conf_dir"
0055 
0056 beg_fed_id=0
0057 end_fed_id=654
0058 
0059 first_event=1
0060 last_event=9999
0061 
0062 
0063 
0064   while [ $# -gt 0 ]; do    # Finché ci sono parametri . . .
0065     case "$1" in
0066 
0067       -p|--path_file)
0068                 data_path="$2"
0069                 ;;
0070 
0071       -f|--first_ev)
0072                 first_event="$2"
0073                 ;;
0074 
0075       -l|--last_ev)
0076                 last_event="$2"
0077                 ;;
0078 
0079       -bf|--beg_fed_id)
0080                 beg_fed_id="$2"
0081                 ;;
0082 
0083       -ef|--end_fed_id)
0084                 end_fed_id="$2"
0085                 ;;
0086 
0087     esac
0088     shift
0089 
0090 done
0091 
0092 data_file=${data_path##*/} 
0093 extension=${data_file##*.}
0094 
0095 echo ""
0096 echo ""
0097 echo "data to be analyzed:                          $data_file"
0098 echo "first event analyzed will be:                 $first_event"
0099 first_event=$(($first_event-1))
0100 
0101 echo "last event analyzed will be:                  $last_event"
0102 echo "first fed that will be dumped:                $beg_fed_id"
0103 echo "last fed that will be dumped:                 $end_fed_id"
0104 
0105 
0106 echo ""
0107 echo ""
0108 
0109 if [[ $extension == "root" ]]; then
0110   input_module="
0111 # if getting data from a .root pool file
0112   source = PoolSource {
0113     untracked uint32 skipEvents = $first_event
0114       untracked vstring fileNames = { 'file:$data_path' }
0115     untracked bool   debugFlag     = true
0116    }"
0117 else
0118   input_module="
0119      source = NewEventStreamFileReader{
0120        untracked uint32 skipEvents = $first_event
0121        untracked vstring fileNames = { 'file:$data_path' }
0122        untracked uint32 debugVebosity = 10
0123        untracked bool   debugFlag     = true
0124      }" 
0125 fi
0126 
0127 cat > "$cfg_path$data_file".hex.$$.cfg <<EOF
0128 process HEXDUMP = { 
0129 
0130 
0131      module hexDump = EcalHexDisplay{
0132      untracked int32 verbosity = 0
0133      untracked bool writeDCC = false
0134 
0135      # fed_id: EE- is 601-609,  EB is 610-645,  EE- is 646-654
0136      # when using 'single sm' fed corresponds to construction number  
0137      untracked int32 beg_fed_id = $beg_fed_id
0138      untracked int32 end_fed_id = $end_fed_id
0139 
0140     # events as counted in the order they are written to file 
0141      untracked int32 first_event = $first_event
0142      untracked int32 last_event  = $last_event
0143      untracked string filename = 'dump.bin'
0144    }
0145 
0146      module counter = AsciiOutputModule{}
0147 
0148     service = MessageLogger{
0149        untracked vstring destinations = { "cout" }
0150        untracked PSet cout = {
0151          untracked string threshold = "WARNING"
0152          untracked PSet default  = { untracked int32 limit = 0 }
0153        }
0154      }
0155 
0156 
0157     untracked PSet maxEvents = {untracked int32 input = $last_event}
0158 
0159      $input_module
0160      
0161      path p     = { hexDump }
0162      endpath ep = { counter }
0163 
0164 
0165 }
0166 
0167 
0168 
0169 
0170 
0171 
0172 
0173 EOF
0174 
0175 echo "initializing cmssw..."
0176 #. /nfshome0/cmssw/cmsset_default.sh
0177 cd $cmssw_dir;
0178 eval `scramv1 ru -sh`;
0179 cd -;
0180 echo "... running" 
0181 cmsRun "$cfg_path$data_file".hex.$$.cfg >& "$log_dir$data_file".$$.hex
0182 
0183 echo ""
0184 echo ""
0185 echo ""
0186 echo "-------------------------------------------------------------------------------------------------------------------------"
0187 echo "hexadecimal dump completed, now edit "$log_dir$data_file".$$.hex to see the results"
0188 echo "-------------------------------------------------------------------------------------------------------------------------"
0189 echo ""
0190 echo ""
0191