X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAlirootRun_MUONtest.sh;h=ae3a376a0db5afc9283c570145e8e9f235557e33;hb=35d1f53b98fa63d7ec2b67ba5a47bd2d4d894443;hp=34caf5998c6b21af7f65f441bdb5732e313c3670;hpb=fe46065920a585847aeb5edf801832d9ee828062;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AlirootRun_MUONtest.sh b/MUON/AlirootRun_MUONtest.sh index 34caf5998c6..ae3a376a0db 100755 --- a/MUON/AlirootRun_MUONtest.sh +++ b/MUON/AlirootRun_MUONtest.sh @@ -1,121 +1,279 @@ #!/bin/sh # $Id$ -# with galice.root, galice_sim.root +# first declare default values + +SIMULATION=1 # will perform simulation +RECONSTRUCTION=1 # will perform reconstruction +RAW=1 # will reconstruct from raw data +CHECKS=1 # will perform checks +SLASHTMP=1 #will use /tmp to put the temporary raw data +NEVENTS=100 # will simulate 100 events + +#RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders +RECOPTIONS="SAVEDIGITS" # default reconstruction options +SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file +OUTDIR="" CURDIR=`pwd` -OUTDIR=test_out -rm -fr $OUTDIR -mkdir $OUTDIR -cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C $OUTDIR +#RUN=0 # run number for OCDB access +SEED=1234567 # random number generator seed +SIMDIR="generated" # sub-directory where to move simulated files prior to reco +DUMPEVENT=5 # event to be dump on files + +# next try to see if there are options of this script that want to change the +# defaults + +EXIT=0 + +while getopts "SRZX:srxzn:tg:p:d:c:" option +do + case $option in + R ) RECONSTRUCTION=1;; + S ) SIMULATION=1;; + X ) + CHECKS=1 + DUMPEVENT=$OPTARG + ;; + Z ) RAW=1;; + r ) RECONSTRUCTION=0;; + s ) SIMULATION=0;; + x ) CHECKS=0;; + t ) SLASHTMP=0;; + z ) RAW=0;; + c ) SIMCONFIG=$OPTARG;; + d ) OUTDIR=$OPTARG;; + n ) NEVENTS=$OPTARG;; + g ) SEED=$OPTARG;; + p ) RECOPTIONS=$OPTARG;; + * ) echo "Unimplemented option chosen." + EXIT=1 + ;; + esac +done + +if [ ! -n "$OUTDIR" ]; then + OUTDIR="$CURDIR/test_out.$NEVENTS" +fi + +# look if there are some leftover options +shift $(($OPTIND - 1)) + +if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then + echo "ERROR : extra option not recognized" + echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)" + echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)" + echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)" + echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)" + echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)" + echo " -n nevents (int) number of events to simulate (default $NEVENTS)" + echo " -t will use OUTDIR as a tmp directory to generate raw data " + echo " -g seed (uint) seed to be used in simulation (default $SEED)" + echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")" + echo " -d full path to output directory (default $OUTDIR)" + echo " -c full path to configuration file for simulation (default $SIMCONFIG)" + exit 4; +fi + +# printout the options +echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS" +if [ "$SIMULATION" -eq 1 ]; then + echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG" +fi +if [ "$RECONSTRUCTION" -eq 1 ]; then +echo "Reconstruction options to be used : $RECOPTIONS" +if [ "$RAW" -eq 0 ]; then +echo "Will reconstruct from digits only (not from raw data)" +fi +fi +echo "Output directory will be : $OUTDIR" + +if [ "$SIMULATION" -eq 1 ]; then + + rm -fr $OUTDIR + mkdir $OUTDIR + +fi + +# Copy *ALL* the macros we need in the output directory, not to mess +# with our source dir in any way. +cp $ALICE_ROOT/MUON/.rootrc \ + $ALICE_ROOT/MUON/rootlogon.C \ + $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \ + $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \ + $ALICE_ROOT/MUON/MUONefficiency.C \ + $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \ + $ALICE_ROOT/MUON/MUONCheck.C \ + $OUTDIR + cd $OUTDIR -RUN=0 -FULLPATH="$CURDIR/$OUTDIR" -NEVENTS=100 -SEED=1234567 - -echo "Running simulation ..." - -aliroot -b >& testSim.out << EOF -// Uncoment following lines to run simulation with local residual mis-alignment -// (generated via MUONGenerateGeometryData.C macro) -// AliCDBManager* man = AliCDBManager::Instance(); -// man->SetDefaultStorage("local://$ALICE_ROOT"); -// man->SetSpecificStorage("MUON/Align/Data","local://$ALICE_ROOT/MUON/ResMisAlignCDB"); -gRandom->SetSeed($SEED); -AliCDBManager::Instance()->SetRun($RUN); -AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C"); -MuonSim.SetMakeTrigger("MUON"); -MuonSim.SetWriteRawData("MUON","raw.root", kTRUE); -MuonSim.Run($NEVENTS); -.q -EOF +if [ "$SLASHTMP" -eq 0 ]; then + mkdir ./tmp + mkdir ./tmp/mdc1 + mkdir ./tmp/mdc2 + mkdir ./tmp/mdc1/tags + + chmod 777 ./tmp + chmod 777 ./tmp/mdc1 + chmod 777 ./tmp/mdc2 + chmod 777 ./tmp/mdc1/tags + + export ALIMDC_RAWDB1=./tmp/mdc1 + export ALIMDC_RAWDB2=./tmp/mdc2 + export ALIMDC_TAGDB=./tmp/mdc1/tags +fi + +############################################################################### +# +# Update CTP in OCDB for MUON Trigger +# +############################################################################### + +if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then + + echo "Updating GRP CTP config ..." -echo "Removing Digits files ..." -mkdir MUON.Digits -mv MUON.Digits*.root MUON.Digits/ -mv galice.root MUON.Digits/ - -echo "Running reconstruction ..." - -aliroot -b >& testReco.out << EOF -AliCDBManager::Instance()->SetRun($RUN); -gRandom->SetSeed($SEED); -AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG); -AliTracker::SetFieldMap(field, kFALSE); -AliReconstruction MuonRec("galice.root"); -MuonRec.SetInput("$FULLPATH/raw.root"); -MuonRec.SetRunVertexFinder(kFALSE); -MuonRec.SetRunLocalReconstruction("MUON"); -MuonRec.SetRunTracking("MUON"); -MuonRec.SetFillESD("MUON"); -MuonRec.SetLoadAlignData("MUON"); -MuonRec.SetNumberOfEventsPerFile($NEVENTS); -// Uncoment following line to run reconstruction with the orginal tracking method -// instead of the kalman one (default) -//MuonRec.SetOption("MUON","Original"); -// Use the following to change clustering method -//MuonRec.SetOption("MUON","MLEM"); // new scheme AZs clustering -//MuonRec.SetOption("MUON","SIMPLEFIT"); // new scheme simple fitting -//MuonRec.SetOption("MUON","COG"); // new scheme basic center-of-gravity only -// Use the following to disconnect the status map creation (only for debug!) -// as this speeds up startup a bit... -//MuonRec.SetOption("MUON","NOSTATUSMAP"); -// Use the following to write to disk the digits (from raw data) -//MuonRec.SetOption("MUON","SAVEDIGITS"); -MuonRec.Run(); -.q + aliroot -b >& $OUTDIR/updateCDBCTPConfig.out << EOF + .L UpdateCDBCTPConfig.C+ + UpdateCDBCTPConfig(); + .q EOF + +fi -if [ ! -e MUON.Digits.root ]; then - echo "Moving Digits files back ..." - mv MUON.Digits/MUON.Digits.root . -fi -mv MUON.Digits/galice.root ./galice_sim.root - -echo "Running Trigger efficiency ..." -aliroot -b >& testTriggerResults.out << EOF -.L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+ -MUONTriggerEfficiency("galice_sim.root", "galice.root", 1); -.q + +############################################################################### +# +# Performing SIMULATION +# +############################################################################### + +if [ "$SIMULATION" -eq 1 ]; then + + echo "Running simulation ..." + + aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out + + mkdir $OUTDIR/$SIMDIR + + if [ "$RAW" -eq 1 ]; then + echo "Moving generated files to $SIMDIR" + mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR + mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR + else + echo "Copying generated files to $SIMDIR" + cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR + cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR + fi + +fi + +############################################################################### +# +# Performing RECONSTRUCTION +# +############################################################################### + +if [ "$RECONSTRUCTION" -eq 1 ]; then + + if [ "$RAW" -eq 1 ]; then + rm -f galice.root + fi + + rm -f AliESD*.root *QA*.root + + echo "Running reconstruction ..." + + cd $OUTDIR + + if [ "$RAW" -eq 1 ]; then + + aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out + + else + + aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out + + fi + +fi + +############################################################################### +# +# Performing CHECKS (and dumps) +# +############################################################################### + +if [ "$CHECKS" -eq 1 ]; then + + if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then + + echo "Running efficiency ..." + + aliroot -b >& $OUTDIR/testResults.out << EOF + .L MUONefficiency.C+ + // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi + MUONefficiency("$OUTDIR/$SIMDIR/galice.root"); + .q EOF -echo "Running efficiency ..." + if [ -f "$OUTDIR/galice.root" ]; then -aliroot -b >& testResults.out << EOF -.L $ALICE_ROOT/MUON/MUONefficiency.C+ -// no argument assumes Upsilon but MUONefficiency(443) works on Jpsi -MUONefficiency("galice_sim.root"); -.q + echo "Running Trigger efficiency ..." + aliroot -b >& $OUTDIR/testTriggerResults.out << EOF + .L MUONTriggerEfficiency.C+ + MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1); + .q EOF -echo "Running check ..." + if [ -f "$OUTDIR/AliESDs.root" ]; then -aliroot -b >& testCheck.out << EOF -gSystem->Load("libMUONevaluation"); -.L $ALICE_ROOT/MUON/MUONCheck.C+ -MUONCheck(0, 9, "galice_sim.root", "galice.root", "AliESDs.root"); -.q + echo "Running check ..." + aliroot -b >& $OUTDIR/testCheck.out << EOF + gSystem->Load("libMUONevaluation"); + .L MUONCheck.C+ + MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root"); + .q EOF + fi + fi + fi -echo "Running dumps for selected event (5) ..." + echo "Running dumps for selected event ($DUMPEVENT) ..." -aliroot -b << EOF -AliMUONSimData simData("galice_sim.root"); -simData.DumpKine(5); > dump.kine -simData.DumpHits(5); > dump.hits -simData.DumpDigits(5); > dump.digits -simData.DumpSDigits(5); > dump.sdigits + if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then + aliroot -l -b << EOF + AliCDBManager* man = AliCDBManager::Instance(); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); + AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root"); + mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine + mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits + mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs + mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits + mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits + .q +EOF + else + echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps" + fi -AliMUONRecData recData("galice.root"); -recData.DumpRecPoints(5); > dump.recpoints -recData.DumpTracks(5); > dump.tracks -recData.DumpRecTrigger(5); > dump.rectrigger -.q + if [ -f "$OUTDIR/galice.root" ]; then + aliroot -l -b << EOF + AliCDBManager* man = AliCDBManager::Instance(); + man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); + AliMUONDataInterface dRec("$OUTDIR/galice.root"); + dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits + dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints + dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger + .q EOF + else + echo "$OUTDIR/galice.root is not there. Skipping rec dumps" + fi +fi echo "Finished" -echo "... see results in test_out" +echo "... see results in $OUTDIR" cd $CURDIR