Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:17

0001 #!/bin/bash
0002 
0003 if (( ${#LOCALRT} < 4 ))
0004 then
0005     if (( ${#HCALDAQ_SW_LOC} > 3  && ${#HCAL_CMSSW_RELEASE} > 3 ))
0006     then
0007         pushd $HCALDAQ_SW_LOC/src/$HCAL_CMSSW_RELEASE/src >/dev/null
0008         eval `scramv1 runtime -sh`
0009         popd >/dev/null
0010     fi
0011 fi
0012 
0013 if (( ${#LOCALRT} < 4 ))
0014 then
0015     echo Please setup your runtime environment!
0016     exit
0017 fi
0018 
0019 ARG1=$1
0020 OUTPUTFILE=$2
0021 
0022 if [[ -e ./reco_setup.rc ]] 
0023 then
0024     source ./reco_setup.rc
0025 fi
0026 
0027 if (( ${#DOCALIB} > 1 ))
0028 then
0029     UNPACKCALIB=true
0030 else
0031     UNPACKCALIB=false
0032 fi
0033 
0034 # ARG1 determines the file selection mode
0035 #
0036 if [[ "${ARG1}" == *[[:alpha:]]* ]]
0037 then
0038     # Filename mode
0039     FILE=$ARG1
0040 else
0041     # Run Number mode
0042     FILE=`printf "${FORMAT}" ${ARG1}`
0043 fi
0044 
0045 echo $FILE
0046 
0047 if (( ${#EVENTLIMIT} == 0 )) 
0048 then
0049     EVENTLIMIT="-1";
0050 fi
0051 
0052 if (( ${#MAPFILE} < 10 )) 
0053 then
0054     echo "Must have a map file in the reco_setup.rc or config file"
0055     exit 1
0056 fi
0057 
0058 #### common head part of Config File
0059 ### create the file
0060 CFGFILE=/tmp/runCMSSWReco_${USER}.cfg
0061 cat > ${CFGFILE}<<EOF
0062 process RECO = {
0063  service = MessageLogger
0064         {
0065         untracked vstring destinations = { "cout" }
0066         untracked vstring categories = {  "DDLParser", "FwkJob", "FwkReport"}
0067         untracked PSet cout = {untracked string threshold = "INFO"
0068                                untracked PSet INFO        = { untracked int32 limit = 10000 }
0069                                untracked PSet DDLParser = { untracked int32 limit = 0 }
0070                                untracked PSet FwkJob = { untracked int32 limit =10 }
0071                                untracked PSet FwkReport = { untracked int32 limit = 20 }
0072                               }
0073         }
0074 EOF
0075 
0076 ### Mode-dependent part
0077 
0078 if [[ "$MODE" == "TESTSTAND" || "${FILE}" == *"HTB_"* ]]
0079 then
0080 # STREAMS: comma-separated list of strings, like: " 'HCAL_Trigger','HCAL_DCC020'  "
0081     STREAMS=","${FEDS}
0082     STREAMS=${STREAMS/20/020} # special case for teststand files
0083     STREAMS=${STREAMS//,/\',\'HCAL_DCC}
0084     STREAMS="'HCAL_Trigger"${STREAMS}\'
0085 
0086     if [[ "$MODE" == "TESTSTAND" && "$FIRSTFED" == "" ]]
0087     then
0088         FIRSTFED=20
0089     fi
0090     EXTRAPREPATH="tbunpacker,"
0091 cat >> ${CFGFILE}<<EOF
0092     // Loads the events from testbeam files
0093     source = HcalTBSource { 
0094                 untracked vstring fileNames = { "file:${FILE}" }
0095                 untracked int32 maxEvents = ${EVENTLIMIT}
0096                 untracked vstring streams = { ${STREAMS} }
0097     }
0098     module tbunpacker = HcalTBObjectUnpacker {
0099            untracked int32 HcalTriggerFED  = 1
0100            untracked int32 HcalSlowDataFED = -1
0101            untracked int32 HcalTDCFED      = -1
0102            untracked int32 HcalSourcePosFED = -1
0103            untracked bool IncludeUnmatchedHits = false
0104            untracked string ConfigurationFile='configQADCTDC.txt'
0105     }
0106     module hcaldigi = HcalRawToDigi {
0107         int32 firstSample = 0
0108         int32 lastSample = 9
0109         untracked bool UnpackCalib = ${UNPACKCALIB}
0110         bool FilterDataQuality = true
0111         untracked int32 HcalFirstFED = ${FIRSTFED}
0112         untracked vint32 FEDs = { ${FEDS} }
0113     }
0114 EOF
0115 # MTCC mode unavailable for now
0116 # elif [[ "$MODE" == "MTCC" ]] 
0117 #     then
0118 #
0119 #     if [[ -z "$FIRSTFED" ]]
0120 #     then
0121 #        FIRSTFED=700
0122 #     fi
0123 # 
0124 #     EXT=${FILE##*.}
0125 #     if [[ "$EXT" == "dat" ]]
0126 #       then
0127 #       
0128 # cat >> ${CFGFILE}<<EOF
0129 #   source = NewEventStreamFileReader
0130 #   {
0131 #     string fileName = "${FILE}"
0132 #     untracked int32 maxEvents = ${EVENTLIMIT}
0133 #     int32 max_event_size = 7000000
0134 #     int32 max_queue_depth = 5
0135 #   }
0136 # EOF
0137 #     elif [[ "$EXT" == "root" ]]
0138 #       then
0139 # 
0140 #       PREF=${FILE#*:}
0141 #       if (( ${#PREF} == ${#FILE} ))
0142 #           then
0143 #           FILE="file:$FILE"
0144 #       fi
0145 # 
0146 # 
0147 # cat >> ${CFGFILE}<<EOF
0148 #         source = PoolConvert { 
0149 #                 untracked vstring fileNames = { '${FILE}' }
0150 #                 untracked int32 maxEvents = ${EVENTLIMIT}
0151 #         }
0152 # EOF
0153 #     fi
0154 elif [[ "$MODE" == "TB06" ]] 
0155     then
0156 
0157     if [[ -z "$FIRSTFED" ]]
0158     then
0159         FIRSTFED=700
0160     fi
0161 
0162     PREF=${FILE#*:}
0163     if (( ${#PREF} == ${#FILE} ))
0164         then
0165         FILE="file:$FILE"
0166     fi
0167 
0168     EXTRAPREPATH="tbunpacker,"
0169 cat >> ${CFGFILE}<<EOF
0170     source = PoolSource { 
0171                 untracked vstring fileNames = { "${FILE}" }
0172                 untracked int32 maxEvents = ${EVENTLIMIT}
0173     }
0174 
0175          module tbunpacker = HcalTBObjectUnpacker {
0176                 untracked int32 HcalTriggerFED  = 1
0177                 untracked int32 HcalSlowDataFED = -1  # 3
0178                 untracked int32 HcalTDCFED      = -1  # 8
0179                 untracked int32 HcalQADCFED      = -1 # 8
0180                 untracked int32 HcalSourcePosFED = -1
0181                 untracked bool IncludeUnmatchedHits = false
0182 #               untracked string ConfigurationFile='configQADCTDC.txt'
0183          }
0184          module hcaldigi = HcalRawToDigi {
0185              int32 firstSample = 0
0186              int32 lastSample = 9
0187              untracked bool UnpackCalib = ${UNPACKCALIB}
0188              bool FilterDataQuality = true
0189              untracked int32 HcalFirstFED = ${FIRSTFED}
0190              untracked vint32 FEDs = { ${FEDS} }
0191          }
0192 EOF
0193 elif [[ "$MODE" == "USC" ]] 
0194     then
0195     EXTRAPREPATH="tbunpacker,"
0196 cat >> ${CFGFILE}<<EOF
0197     // Loads the events from testbeam files
0198     source = HcalTBSource { 
0199                 untracked vstring fileNames = { "file:${FILE}" }
0200                 untracked int32 maxEvents = ${EVENTLIMIT}
0201                 untracked vstring streams = { 'HCAL_Trigger',
0202                     'HCAL_DCC700','HCAL_DCC701','HCAL_DCC702','HCAL_DCC703',
0203                     'HCAL_DCC704','HCAL_DCC705','HCAL_DCC706','HCAL_DCC707',
0204                     'HCAL_DCC708','HCAL_DCC709','HCAL_DCC710','HCAL_DCC711',
0205                     'HCAL_DCC712','HCAL_DCC713','HCAL_DCC714','HCAL_DCC715',
0206                     'HCAL_DCC716','HCAL_DCC717','HCAL_DCC718','HCAL_DCC719',
0207                     'HCAL_DCC720','HCAL_DCC721','HCAL_DCC722','HCAL_DCC723',
0208                     'HCAL_DCC724','HCAL_DCC725','HCAL_DCC726','HCAL_DCC727',
0209                     'HCAL_DCC728','HCAL_DCC729','HCAL_DCC730','HCAL_DCC731' }
0210         }
0211 
0212     module tbunpacker = HcalTBObjectUnpacker {
0213            untracked int32 HcalTriggerFED  = 1
0214            untracked int32 HcalSlowDataFED = -1
0215            untracked int32 HcalTDCFED      = -1
0216            untracked int32 HcalSourcePosFED = -1
0217            untracked bool IncludeUnmatchedHits = false
0218            untracked string ConfigurationFile='configQADCTDC.txt'
0219        }
0220 
0221     module hcaldigi = HcalRawToDigi {
0222         int32 firstSample = 0
0223         int32 lastSample = 9
0224         untracked bool UnpackCalib = ${UNPACKCALIB}
0225         bool FilterDataQuality = true
0226         // untracked int32 HcalFirstFED = ${FIRSTFED} # use default!
0227         untracked vint32 FEDs = {}
0228     }
0229 EOF
0230 else
0231   echo Unknown mode '$MODE'
0232   exit
0233 fi    
0234 
0235 #### common tail part of Config File
0236 cat >> ${CFGFILE}<<EOF99
0237    module hbhereco = HcalSimpleReconstructor {
0238     /// Indicate which digi time sample to start with when
0239     /// integrating the signal
0240     int32 firstSample = 1
0241     /// Indicate how many digi time samples to integrate over
0242     int32 samplesToAdd = 8
0243     /// Indicate whether to apply energy-dependent time-slew corrections
0244     bool correctForTimeslew = true
0245     /// Indicate whether to apply corrections for pulse containment in the summing window
0246     bool correctForPhaseContainment = true
0247     /// Nanosecond phase for pulse containment correction (default of 13 ns appropriate for simulation)
0248     double correctionPhaseNS = 13.0
0249     /// Indicate which subdetector to reconstruct for.
0250     string Subdetector = 'HBHE'
0251     /// Give the label associated with the HcalRawToDigi unpacker module.
0252     /// NOTE: cross-dependency here.
0253     InputTag digiLabel = hcaldigi
0254   }
0255 
0256    module horeco = HcalSimpleReconstructor {
0257     /// Indicate which digi time sample to start with when
0258     /// integrating the signal
0259     int32 firstSample = 1
0260     /// Indicate how many digi time samples to integrate over
0261     int32 samplesToAdd = 8
0262     /// Indicate whether to apply energy-dependent time-slew corrections
0263     bool correctForTimeslew = false
0264     /// Indicate whether to apply corrections for pulse containment in the summing window
0265     bool correctForPhaseContainment = true
0266     /// Nanosecond phase for pulse containment correction (default of 13 ns appropriate for simulation)
0267     double correctionPhaseNS = 13.0
0268     /// Indicate which subdetector to reconstruct for.
0269     string Subdetector = 'HO'
0270     /// Give the label associated with the HcalRawToDigi unpacker module.
0271     /// NOTE: cross-dependency here.
0272     InputTag digiLabel = hcaldigi
0273   }
0274 
0275    module hfreco = HcalSimpleReconstructor {
0276     /// Indicate which digi time sample to start with when
0277     /// integrating the signal
0278     int32 firstSample = 1
0279     /// Indicate how many digi time samples to integrate over
0280     int32 samplesToAdd = 4
0281     /// Indicate whether to apply energy-dependent time-slew corrections
0282     bool correctForTimeslew = true
0283     /// Indicate whether to apply corrections for pulse containment in the summing window (not in HF or ZDC)
0284     bool correctForPhaseContainment = false
0285     /// Nanosecond phase for pulse containment correction (ignored if correction is not used)
0286     double correctionPhaseNS = 0.0
0287     /// Indicate which subdetector to reconstruct for.
0288     string Subdetector = 'HF'
0289     /// Give the label associated with the HcalRawToDigi unpacker module.
0290     /// NOTE: cross-dependency here.
0291     InputTag digiLabel = hcaldigi
0292   }
0293 
0294   module plotanal = HcalQLPlotAnal {
0295      untracked InputTag hbheRHtag = hbhereco
0296      untracked InputTag hoRHtag   = horeco
0297      untracked InputTag hfRHtag   = hfreco
0298      untracked InputTag hcalDigiTag = hcaldigi
0299      untracked InputTag hcalTrigTag = tbunpacker
0300      untracked string outputFilename = "${OUTPUTFILE}"
0301      untracked bool     doCalib   = ${UNPACKCALIB} // false is the default
0302 
0303 //   untracked double calibFC2GeV = 0.2   // 0.2 is the default
0304 
0305      PSet HistoParameters = 
0306      {
0307         double pedGeVlo   = ${PED_E_GEV_LO}
0308         double pedGeVhi   = ${PED_E_GEV_HI}
0309         double pedADClo   = ${PED_E_ADC_LO}
0310         double pedADChi   = ${PED_E_ADC_HI}
0311         double ledGeVlo   = ${LED_E_GEV_LO}
0312         double ledGeVhi   = ${LED_E_GEV_HI}
0313         double laserGeVlo = ${LASER_E_GEV_LO}
0314         double laserGeVhi = ${LASER_E_GEV_HI}
0315         double otherGeVlo = ${OTHER_E_GEV_LO}
0316         double otherGeVhi = ${OTHER_E_GEV_HI}
0317         double beamGeVlo  = ${BEAM_E_GEV_LO}
0318         double beamGeVhi  = ${BEAM_E_GEV_HI}
0319         double timeNSlo   = ${TIME_NS_LO}
0320         double timeNShi   = ${TIME_NS_HI}
0321      }
0322   }
0323 
0324   path p = { ${EXTRAPREPATH} hcaldigi, hbhereco, horeco, hfreco, plotanal }
0325 
0326 
0327 // stuff for the calibration system
0328   es_module = HcalDbProducer {}
0329 EOF99
0330 
0331 # Stuff related to the setup
0332 
0333 HARDCODED="\"PedestalWidths\", \"GainWidths\", \"QIEShape\", \"QIEData\", \"ChannelQuality\""
0334 TEXT="{\nstring object=\"ElectronicsMap\"\nFileInPath file=\"${MAPFILE}\"\n}\n"
0335 
0336 if (( ${#PEDESTALFILE} > 1 )) 
0337 then
0338     TEXT=${TEXT}",{\nstring object=\"Pedestals\"\nFileInPath file=\"${PEDESTALFILE}\"\n}\n"
0339 else
0340     HARDCODED=${HARDCODED}", \"Pedestals\""
0341 fi
0342 
0343 if (( ${#GAINSFILE} > 1 )) 
0344 then
0345     TEXT=${TEXT}",{\nstring object=\"Gains\"\nFileInPath file=\"${GAINSFILE}\"\n}\n"
0346 else
0347     HARDCODED=${HARDCODED}", \"Gains\""
0348 fi
0349 
0350 echo "   es_source es_hardcode = HcalHardcodeCalibrations { untracked vstring toGet= { ${HARDCODED}  } }" >> ${CFGFILE}
0351 
0352 echo "   es_source es_ascii = HcalTextCalibrations { VPSet input = {" >> ${CFGFILE}
0353 printf "${TEXT}" >> ${CFGFILE}
0354 echo "   } }" >> ${CFGFILE}
0355 
0356 echo "}" >> ${CFGFILE}
0357 
0358 # run cmsRun
0359 cmsRun ${CFGFILE}