Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-02 08:15:28

0001 #!/usr/bin/bash
0002 
0003 
0004 IDX="$1" # same as $(Process)
0005 NEVENT_GEN=500
0006 DATARUNNUMBER=54404
0007 
0008 NEVENTS_PREPARED_DATA=$(( NEVENT_GEN * 2 )) #padding for possible skipping of events
0009 
0010 echo "=== run.sh inputs ==="
0011 echo "  IDX (job index)           = ${IDX}"
0012 echo "  NEVENT_GEN               = ${NEVENT_GEN}"
0013 echo "  NEVENTS_PREPARED_DATA    = ${NEVENTS_PREPARED_DATA}"
0014 echo "  DATARUNNUMBER            = ${DATARUNNUMBER}"
0015 
0016 # check number of events in a setment
0017 NEVENTS_SEGMENT=$(psql FileCatalog -t -A -c  "select events from datasets where segment=0 and filename like 'DST_TRIGGERED_EVENT_seb07%' and runnumber=${DATARUNNUMBER};")
0018 
0019 
0020 #calculate which segment to run
0021 SEGMENT=$(( ( IDX * NEVENTS_PREPARED_DATA ) / NEVENTS_SEGMENT))  
0022 
0023 # calculate how many events to skip
0024 NEVENTS_SKIP=$(( ( IDX * NEVENTS_PREPARED_DATA ) % NEVENTS_SEGMENT))  
0025 
0026 START_INDEX=$(( IDX * NEVENTS_PREPARED_DATA ))
0027 echo "=== segment/skip math ==="
0028 echo "  NEVENTS_SEGMENT (from DB)= ${NEVENTS_SEGMENT}"
0029 echo "  start index (IDX*NEVENTS_PREPARED_DATA) = ${START_INDEX}"
0030 echo "  SEGMENT (which file)     = ${SEGMENT}  (= start / NEVENTS_SEGMENT)"
0031 echo "  NEVENTS_SKIP             = ${NEVENTS_SKIP}  (= start % NEVENTS_SEGMENT)"
0032 echo "========================="  
0033 
0034 # create list of files to run
0035 psql FileCatalog -t -A -c  "select filename from datasets where segment=${SEGMENT} and filename like 'DST_TRIG%' and runnumber=${DATARUNNUMBER};" > test.list
0036 
0037 # add the next segment to the list in case we go over the number of events in the segment
0038 #psql FileCatalog -t -A -c  "select filename from datasets where segment=$(( SEGMENT + 1 )) and filename like 'DST_TRIG%' and runnumber=${DATARUNNUMBER};" >> test.list
0039 
0040 root -l -b -q "Fun4All_PrepDataFitting.C(${NEVENT_GEN},${NEVENTS_PREPARED_DATA},${NEVENTS_SKIP},\"test.list\")"
0041 
0042 # get prepared data filename from prepData.txt which is created by Fun4All_PrepDataFitting.C
0043 FILE=$(cat prepData.txt)
0044 
0045 
0046 # Run the Fun4All_G4_Embed_data.C script with the provided parameters
0047 root -l -b -q "Fun4All_G4_Embed_data.C(${NEVENT_GEN},0,\"${FILE}\", \"./\" , \"embed_test.root\", \"Jet10\", \"MDC2\")"