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=`pwd`
0004 log_dir=$preferred_dir/log/
0005 conf_dir=$preferred_dir/conf/
0006 cmssw_dir=`pwd`
0007 
0008 # in case you wanted to force  execution inside the preferred_dir
0009 #if [ "$PWD" != $preferred_dir ]; then
0010 #
0011 # echo ""
0012 # echo "this script should be executed from $preferred_dir"
0013 # echo "please do:"
0014 # echo "            cd $preferred_dir"
0015 # echo ""
0016 ## exit
0017 #
0018 #fi
0019 
0020 mkdir -p  $preferred_dir/log/
0021 mkdir -p  $preferred_dir/conf/
0022 
0023 
0024 if [ ! -n "$1" ]
0025 
0026 then
0027 echo ""
0028 echo "This script produces a root file containing the Ecal exclusively triggered (without muon/HCAL triggers) events only."
0029 echo "Note: Runs on RAW data!"
0030 echo ""
0031 echo "Options:"
0032 echo ""
0033 echo "      -p|--path_file        file_path       data file (from Castor) to be analyzed preceeded by path"
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 echo ""
0037 echo ""
0038 echo ""
0039 exit
0040 
0041 fi
0042 
0043 
0044 
0045 
0046 data_path="/data/ecalod-22/daq-data/"
0047 data_file="none"
0048 
0049 cfg_path="$conf_dir"
0050 
0051 
0052 first_event=1
0053 last_event=9999
0054 
0055 
0056 
0057   while [ $# -gt 0 ]; do    # Finché ci sono parametri . . .
0058     case "$1" in
0059 
0060       -p|--path_file)
0061                 data_path="$2"
0062                 ;;
0063 
0064       -f|--first_ev)
0065                 first_event="$2"
0066                 ;;
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 ""
0085 echo ""
0086 
0087 if [[ $extension == "root" ]]; then
0088   input_module="
0089 # if getting data from a .root pool file
0090   source = PoolSource {
0091     untracked uint32 skipEvents = $first_event
0092     untracked vstring fileNames = { 'file:$data_path' }
0093     untracked bool   debugFlag     = true
0094    }"
0095 else
0096   input_module="
0097      source = NewEventStreamFileReader{
0098        untracked uint32 skipEvents = $first_event
0099        untracked vstring fileNames = { 'file:$data_path' }
0100        untracked uint32 debugVebosity = 10
0101        untracked bool   debugFlag     = true
0102      }" 
0103 fi
0104 
0105 cat > "$cfg_path$data_file".ecalExclusive.$$.cfg <<EOF
0106 
0107 process EcalExclusiveTrigSkim ={
0108 
0109     $input_module
0110 
0111     #number of event to be processed
0112     untracked PSet maxEvents = {untracked int32 input = $last_event}
0113                 
0114     include "Configuration/StandardSequences/data/FrontierConditions_GlobalTag.cff"
0115       replace GlobalTag.globaltag = "CRUZET_V3::All"
0116 
0117     # Messages
0118     include "FWCore/MessageLogger/data/MessageLogger.cfi"
0119 
0120     include "L1TriggerConfig/L1ScalesProducers/data/L1MuTriggerScalesConfig.cff"
0121     module gtDigis = l1GtUnpack from "EventFilter/L1GlobalTriggerRawToDigi/data/l1GtUnpack.cfi"
0122     replace gtDigis.DaqGtInputTag = source
0123 
0124     # skim
0125     include "CaloOnlineTools/EcalTools/data/ecalExclusiveTrigFilter.cfi"
0126 
0127  
0128     # output module
0129         module out = PoolOutputModule
0130         {
0131          untracked PSet SelectEvents = 
0132                 {
0133                  vstring SelectEvents = { "p" }
0134                 }
0135          untracked string filterName = "skimming"
0136          untracked vstring outputCommands = 
0137                 {
0138                 # keep all infos about the event, after the skim
0139                 "keep *" 
0140                 }
0141          untracked string fileName ="$datafile.ecalExclusiveSkim.root"
0142         }
0143 
0144     # paths
0145         path p = { gtDigis, ecalExclusiveTrigFilter }
0146         endpath e = { out }
0147  
0148  
0149  }
0150 
0151 
0152 EOF
0153 
0154 echo "initializing cmssw..."
0155 #. /nfshome0/cmssw/cmsset_default.sh
0156 cd $cmssw_dir;
0157 eval `scramv1 ru -sh`;
0158 cd -;
0159 echo "... running" 
0160 cmsRun "$cfg_path$data_file".ecalExclusive.$$.cfg >& "$log_dir$data_file".$$.ecalExclusive.log
0161 
0162 echo ""
0163 echo ""
0164 echo ""
0165 echo "-------------------------------------------------------------------------------------------------------------------------"
0166 echo "skimming complete."
0167 echo "-------------------------------------------------------------------------------------------------------------------------"
0168 echo ""
0169 echo ""