]>
Commit | Line | Data |
---|---|---|
fa701981 | 1 | #!/bin/sh |
2 | # $Id$ | |
3 | ||
aefc4e02 | 4 | # first declare default values |
5 | ||
6 | SIMULATION=1 # will perform simulation | |
7 | RECONSTRUCTION=1 # will perform reconstruction | |
8 | CHECKS=1 # will perform checks | |
9 | NEVENTS=100 # will simulate 100 events | |
32bf5f82 | 10 | |
aefc4e02 | 11 | RECOPTIONS="SAVEDIGITS" # default reconstruction options |
12 | SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file | |
13 | OUTDIR="" | |
fa701981 | 14 | CURDIR=`pwd` |
fa701981 | 15 | |
745f6baf | 16 | #RUN=0 # run number for OCDB access |
aefc4e02 | 17 | SEED=1234567 # random number generator seed |
18 | SIMDIR="generated" # sub-directory where to move simulated files prior to reco | |
19 | DUMPEVENT=5 # event to be dump on files | |
20 | ||
21 | # next try to see if there are options of this script that want to change the | |
22 | # defaults | |
23 | ||
24 | EXIT=0 | |
25 | ||
26 | while getopts "SRX:srxn:p:d:c:" option | |
27 | do | |
28 | case $option in | |
29 | R ) RECONSTRUCTION=1;; | |
30 | S ) SIMULATION=1;; | |
31 | X ) | |
32 | CHECKS=1 | |
33 | DUMPEVENT=$OPTARG | |
34 | ;; | |
35 | r ) RECONSTRUCTION=0;; | |
36 | s ) SIMULATION=0;; | |
37 | x ) CHECKS=0;; | |
38 | c ) SIMCONFIG=$OPTARG;; | |
39 | d ) OUTDIR=$OPTARG;; | |
40 | n ) NEVENTS=$OPTARG;; | |
41 | p ) RECOPTIONS=$OPTARG;; | |
42 | * ) echo "Unimplemented option chosen." | |
43 | EXIT=1 | |
44 | ;; | |
45 | esac | |
46 | done | |
47 | ||
48 | if [ ! -n "$OUTDIR" ]; then | |
49 | OUTDIR="$CURDIR/test_out.$NEVENTS" | |
50 | fi | |
51 | ||
52 | # look if there are some leftover options | |
53 | shift $(($OPTIND - 1)) | |
54 | ||
55 | if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then | |
56 | echo "ERROR : extra option not recognized" | |
57 | echo "Usage: `basename $0` options (-SRXsrxn:p:d:c:)" | |
58 | echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)" | |
59 | echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)" | |
60 | echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)" | |
61 | echo " -n nevents (int) number of events to simulate (default $NEVENTS)" | |
62 | echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")" | |
63 | echo " -d full path to output directory (default $OUTDIR)" | |
64 | echo " -c full path to configuration file for simulation (default $SIMCONFIG)" | |
65 | exit 4; | |
66 | fi | |
67 | ||
68 | # printout the options | |
69 | echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS" | |
70 | if [ "$SIMULATION" -eq 1 ]; then | |
71 | echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG" | |
72 | fi | |
73 | if [ "$RECONSTRUCTION" -eq 1 ]; then | |
74 | echo "Reconstruction options to be used : $RECOPTIONS" | |
75 | fi | |
76 | echo "Output directory will be : $OUTDIR" | |
77 | ||
78 | if [ "$SIMULATION" -eq 1 ]; then | |
79 | ||
80 | rm -fr $OUTDIR | |
81 | mkdir $OUTDIR | |
82 | ||
83 | fi | |
84 | ||
85 | cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C \ | |
86 | $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C $OUTDIR | |
87 | ||
fa701981 | 88 | cd $OUTDIR |
89 | ||
aefc4e02 | 90 | ############################################################################### |
91 | # | |
92 | # Performing SIMULATION | |
93 | # | |
94 | ############################################################################### | |
fa701981 | 95 | |
aefc4e02 | 96 | if [ "$SIMULATION" -eq 1 ]; then |
fa701981 | 97 | |
aefc4e02 | 98 | echo "Running simulation ..." |
858e5b75 | 99 | |
745f6baf | 100 | aliroot -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out |
aefc4e02 | 101 | |
102 | echo "Moving generated files to $SIMDIR" | |
103 | mkdir $OUTDIR/$SIMDIR | |
08c70401 | 104 | mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR |
aefc4e02 | 105 | mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR |
fa701981 | 106 | |
aefc4e02 | 107 | fi |
fa701981 | 108 | |
aefc4e02 | 109 | ############################################################################### |
110 | # | |
111 | # Performing RECONSTRUCTION | |
112 | # | |
113 | ############################################################################### | |
114 | ||
115 | if [ "$RECONSTRUCTION" -eq 1 ]; then | |
116 | ||
117 | rm -f galice.root AliESD*.root | |
118 | ||
119 | echo "Running reconstruction ..." | |
120 | ||
121 | cd $OUTDIR | |
122 | ||
745f6baf | 123 | aliroot -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out |
aefc4e02 | 124 | |
125 | fi | |
858e5b75 | 126 | |
aefc4e02 | 127 | ############################################################################### |
128 | # | |
129 | # Performing CHECKS (and dumps) | |
130 | # | |
131 | ############################################################################### | |
32bf5f82 | 132 | |
aefc4e02 | 133 | if [ "$CHECKS" -eq 1 ]; then |
8dc57946 | 134 | |
029d450d | 135 | if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then |
32bf5f82 | 136 | |
aefc4e02 | 137 | echo "Running efficiency ..." |
138 | ||
139 | aliroot -b >& $OUTDIR/testResults.out << EOF | |
140 | .L $ALICE_ROOT/MUON/MUONefficiency.C+ | |
141 | // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi | |
142 | MUONefficiency("$OUTDIR/$SIMDIR/galice.root"); | |
143 | .q | |
144 | EOF | |
145 | ||
029d450d | 146 | if [ -f "$OUTDIR/galice.root" ]; then |
aefc4e02 | 147 | |
148 | echo "Running Trigger efficiency ..." | |
149 | aliroot -b >& $OUTDIR/testTriggerResults.out << EOF | |
150 | .L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+ | |
151 | MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1); | |
152 | .q | |
8dc57946 | 153 | EOF |
858e5b75 | 154 | |
029d450d | 155 | if [ -f "$OUTDIR/AliESDs.root" ]; then |
156 | ||
157 | echo "Running check ..." | |
158 | aliroot -b >& $OUTDIR/testCheck.out << EOF | |
159 | gSystem->Load("libMUONevaluation"); | |
160 | .L $ALICE_ROOT/MUON/MUONCheck.C+ | |
161 | MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root"); | |
162 | .q | |
aefc4e02 | 163 | EOF |
029d450d | 164 | fi |
aefc4e02 | 165 | fi |
166 | fi | |
167 | ||
168 | echo "Running dumps for selected event ($DUMPEVENT) ..." | |
169 | ||
170 | if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then | |
171 | aliroot -b << EOF | |
07be5a4f | 172 | AliCDBManager* man = AliCDBManager::Instance(); |
173 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
aefc4e02 | 174 | AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root"); |
175 | mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine | |
176 | mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits | |
177 | mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs | |
178 | mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits | |
179 | mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits | |
180 | .q | |
181 | EOF | |
182 | else | |
183 | echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps" | |
184 | fi | |
185 | ||
186 | if [ -f "$OUTDIR/galice.root" ]; then | |
187 | aliroot -b << EOF | |
07be5a4f | 188 | AliCDBManager* man = AliCDBManager::Instance(); |
189 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
aefc4e02 | 190 | AliMUONDataInterface dRec("$OUTDIR/galice.root"); |
191 | dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits | |
192 | dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints | |
aefc4e02 | 193 | dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger |
194 | .q | |
195 | EOF | |
196 | else | |
197 | echo "$OUTDIR/galice.root is not there. Skipping rec dumps" | |
198 | fi | |
199 | fi | |
32bf5f82 | 200 | |
fa701981 | 201 | echo "Finished" |
aefc4e02 | 202 | echo "... see results in $OUTDIR" |
fa701981 | 203 | |
204 | cd $CURDIR |