rm -fr $OUTDIR
mkdir $OUTDIR
-cp .rootrc $OUTDIR
+cp .rootrc rootlogon.C $OUTDIR
cd $OUTDIR
+FULLPATH="$CURDIR/$OUTDIR"
+# Minimum number of events to have enough stat. for invariant mass fit
+# 10000 is ok, 20000 is really fine
+NEVENTS=10000
+SEED=1234567
+
+CDBDIRECTORY="$ALICE_ROOT/MUON/CDB/Default";
+CDB="local://$CDBDIRECTORY";
+
+if [ ! -d $CDBDIRECTORY"/MUON" ]; then
+
+echo "Generating Condition Database in directory $CDBDIRECTORY. This may take a while, so please be patient..."
+
+aliroot -b >& testGenerateCalibrations.out << EOF
+.L $ALICE_ROOT/MUON/MUONCDB.C+
+gRandom->SetSeed($SEED);
+generateCalibrations("$CDB",true);
+.q
+EOF
+
+else
+
+echo "Condition Database found in directory $CDBDIRECTORY. Will use it if needed."
+
+fi
+
echo "Running simulation ..."
aliroot -b >& testSim.out << EOF
-AliSimulation MuonSim
-MuonSim.SetConfigFile("$ALICE_ROOT/MUON/Config.C")
-// Minimum number of events to have enough stat. for invariant mass fit
-// 10000 is ok, 20000 is really fine
-MuonSim.Run(1000)
+// 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","local://$ALICE_ROOT/MUON/ResMisAlignCDB");
+gRandom->SetSeed($SEED);
+AliCDBManager::Instance()->SetDefaultStorage("$CDB");
+AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
+MuonSim.Run($NEVENTS);
.q
EOF
echo "Running reconstruction ..."
aliroot -b >& testReco.out << EOF
-TPluginManager* pluginManager = gROOT->GetPluginManager();
-pluginManager->AddHandler("AliReconstructor", "MUON","AliMUONReconstructor", "MUON","AliMUONReconstructor()")
-AliReconstruction MuonRec("galice.root")
-MuonRec.SetRunTracking("")
-MuonRec.SetRunVertexFinder(kFALSE)
-MuonRec.SetRunLocalReconstruction("MUON")
-MuonRec.SetFillESD("MUON")
-MuonRec.Run()
+gRandom->SetSeed($SEED);
+AliCDBManager::Instance()->SetDefaultStorage("$CDB");
+AliReconstruction MuonRec("galice.root");
+MuonRec.SetRunTracking("");
+MuonRec.SetRunVertexFinder(kFALSE);
+MuonRec.SetRunLocalReconstruction("MUON");
+MuonRec.SetFillESD("MUON");
+MuonRec.Run();
.q
EOF
echo "Running Trigger efficiency ..."
aliroot -b >& testTriggerResults.out << EOF
-.includepath $ALICE_ROOT/STEER
-.includepath $ALICE_ROOT/MUON
-.L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C++
+.L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+
MUONTriggerEfficiency();
.q
EOF
echo "Running efficiency ..."
aliroot -b >& testEfficiency.out << EOF
-.includepath $ALICE_ROOT/STEER
-.includepath $ALICE_ROOT/MUON
-.L $ALICE_ROOT/MUON/MUONefficiency.C++
+.L $ALICE_ROOT/MUON/MUONefficiency.C+
// no argument assumes Upsilon but MUONefficiency(443) handles Jpsi
MUONefficiency();
.q