Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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