Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:36

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_3_0_pre3/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 
0026 if [ ! -n "$1" ]
0027 
0028 then
0029 
0030 echo ""
0031 echo "This script produces Root TGraphs of for given Pn diode (PN) and all its neigbors in a line around it "
0032 echo ""
0033 echo "Options:"
0034 echo ""
0035 echo "      -p|--path_file        file_path       path to the data to be analyzed (default is /data/ecalod-22/daq-data/)"
0036 echo "      -d|--data_file        file_name       data file to be analyzed"
0037 echo ""
0038 echo "      -f|--first_ev         f_ev            first (as written to file) event that will be analyzed; default is 1"
0039 echo "      -l|--last_ev          l_ev            last  (as written to file) event that will be analyzed; default is 9999"
0040 echo "      -eb|--ieb_id          ieb_id          selects sm barrel id (1...36); default is all"
0041 echo "      -s|--length           numPn           number of Pn's for which graphs are required"
0042 echo "      -pns|--pnGraph        ipn             graphs from for Pn's in this list will be created"
0043 
0044 echo ""
0045 echo ""
0046 exit
0047 
0048 fi
0049 
0050 
0051 data_path="/data/ecalod-22/daq-data/"
0052 data_file="none"
0053 
0054 cfg_path="$conf_dir"
0055 
0056 
0057 ieb=1
0058 
0059 Pn_ipn=1;
0060 pnsString="false";
0061 
0062 numPn=1
0063 
0064 first_event=1
0065 last_event=9999
0066 
0067 
0068 
0069   while [ $# -gt 0 ]; do    # till where there are parameters available...
0070     case "$1" in
0071 
0072       -p|--path_file)
0073                 data_path="$2"
0074                 ;;
0075 
0076       -d|--data_file)
0077                 data_file="$2"
0078                 ;;
0079 
0080 
0081       -f|--first_ev)
0082                 first_event="$2"
0083                 ;;
0084 
0085 
0086       -l|--last_ev)
0087                 last_event="$2"
0088                 ;;
0089 
0090 
0091       -eb|--ieb_id)
0092                 ieb="$2"
0093                 ;;
0094 
0095       -pns|--pnGraph)
0096                                 if [ "$numPn" = "1" ]
0097                                         then
0098                                         Pn_ipn="$2"
0099                                 elif [ "$numPn" = "2" ]
0100                                         then
0101                                         Pn_ipn="$2,$3"
0102                                 elif [ "$numPn" = "3" ]
0103                                         then
0104                                         Pn_ipn="$2,$3,$4"
0105                                 elif [ "$numPn" = "4" ]
0106                                         then
0107                                         Pn_ipn="$2,$3,$4,$5"
0108                                 elif [ "$numPn" = "5" ]
0109                                         then
0110                                         Pn_ipn="$2,$3,$4,$5,$6"
0111                                 elif [ "$numPn" = "6" ]
0112                                         then
0113                                         Pn_ipn="$2,$3,$4,$5,$6,$7"
0114                                 elif [ "$numPn" = "7" ]
0115                                         then
0116                                         Pn_ipn="$2,$3,$4,$5,$6,$7,$8"
0117                                 elif [ "$numPn" = "8" ]
0118                                         then
0119                                         Pn_ipn="$2,$3,$4,$5,$6,$7,$8,$9"
0120                                 elif [ "$numPn" = "9" ]
0121                                         then
0122                                         Pn_ipn="$2,$3,$4,$5,$6,$7,$8,$9,$10"
0123                                 elif [ "$numPn" = "10" ]
0124                                         then
0125                                         Pn_ipn="$2,$3,$4,$5,$6,$7,$8,$9,${10},${11}"
0126                                 fi
0127                 pnsString="true"
0128                 ;;
0129 
0130       -s|--numPn)
0131                 numPn="$2"
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 
0149 if [[  $pnsString = "true"  ]]
0150 then
0151         echo "channel selected for graphs:                  $Pn_ipn"
0152 fi
0153 
0154         echo "numPn:                                        $numPn"
0155 
0156 
0157 echo ""
0158 echo ""
0159 
0160 
0161 
0162 
0163 cat > "$cfg_path$data_file".Pngraph.$$.cfg <<EOF
0164 
0165 
0166 
0167 process TESTGRAPHDUMPER = { 
0168 
0169 # if getting data from a .root pool file
0170        source = PoolSource {
0171            untracked uint32 skipEvents = $first_event
0172             untracked vstring fileNames = { 'file:$data_path$data_file' }
0173            untracked bool   debugFlag     = true
0174          }
0175 
0176    untracked PSet maxEvents = {untracked int32 input = $last_event}
0177 
0178         #source = DAQEcalTBInputService{
0179         #      untracked vstring fileNames = { 'file:$data_path$data_file' }
0180         #       untracked uint32 skipEvents =  $first_event
0181         #       untracked int32 maxEvents = $last_event
0182         #       untracked bool isBinary = true
0183         # }
0184 
0185      module ecalEBunpacker = EcalDCCTBUnpackingModule{ }
0186 
0187 # verbosity =0:  only headings
0188      module PngraphDumperModule = EcalPnGraphDumperModule{
0189 
0190         # selection on sm number in the barrel (1... 36; 1 with tb unpacker)
0191         # if not specified or value set to -1, no selection will be applied
0192         untracked int32 ieb_id      = $ieb
0193         
0194          # specify list of Pns to be graphed around
0195          untracked vint32  listPns = { $Pn_ipn }
0196 
0197          # length of the line centered on listPns containing the Pns you want to see
0198          # needs to be an odd number
0199          #untracked int32  numPn = $numPn
0200         untracked int32  numPn = 1
0201          untracked string fileName =  '$data_file' 
0202 
0203       }
0204      
0205 
0206      path p = {ecalEBunpacker, PngraphDumperModule}
0207 
0208 
0209 }
0210 
0211 
0212 
0213 
0214 
0215 EOF
0216 
0217 
0218 echo "initializing cmssw..."
0219 export SCRAM_ARCH=slc3_ia32_gcc323
0220 #. /nfshome0/cmssw/cmsset_default.sh
0221 cd $cmssw_dir;
0222 eval `scramv1 ru -sh`;
0223 cd -;
0224 echo "... running"
0225 cmsRun "$cfg_path$data_file".Pngraph.$$.cfg >& "$log_dir$data_file".$$.graph
0226 
0227 echo ""
0228 echo ""
0229 
0230 mv *.graph.root $log_dir
0231 echo "File root with graphs was created:"
0232 ls -ltrFh $log_dir/*.graph.root | tail -1
0233 
0234 echo ""
0235 echo ""
0236 echo ""
0237 echo "you can open it using root:"
0238 commandStringRoot="         root `ls -ltrFh $log_dir/*.graph.root | tail -1 |  awk '{print $9}'`"
0239 #echo "         root " `ls -ltrFh $log_dir/*.graph.root | tail -1 |  awk '{print $9}'`
0240 echo ""
0241 echo "$commandStringRoot"
0242 echo "         than using the TBrowser with option "a*" "
0243 echo ""
0244 echo ""
0245 echo ""
0246 echo ""
0247 
0248 $commandStringRoot