Index: /trunk/Mars/hawc/runranger.sh
===================================================================
--- /trunk/Mars/hawc/runranger.sh	(revision 19811)
+++ /trunk/Mars/hawc/runranger.sh	(revision 19812)
@@ -5,4 +5,5 @@
 OUT=ranger.csv
 TRAINRATIO=0.7
+#TREE=Events
 
 # Classical reconstruction parameters
@@ -13,7 +14,9 @@
 #TRUEVAR="MeanY*conv"
 
-# Impact on ground
-#TRUEVAR="TMath::Hypot(X,Y)"
-#TRUEVAR="atan2(X,Y)*TMath::RadToDeg()"
+# Impact on ground (We can not use GroundR here, see --no-indirection)
+#TRUEVAR="GroundR"
+#TRUEVAR="GroundPhi"
+#TRUEVAR="X"
+#TRUEVAR="Y"
 
 echo --------------------------------- Creating input files -------------------------
@@ -29,5 +32,5 @@
 
 # Some cuts to remove events with strange contents
-selector=NumUsedPixels>2.5 && lgArea>-1 && abs(SlopeTrans/conv)<1
+selector=lgArea>-1 && abs(SlopeTrans/conv)<2.5
 
 # Define some alias for easier use and use in the selector
@@ -35,4 +38,6 @@
 conv=1.14112295210361481e-01
 lgArea=log10(TMath::TwoPi()*Width*Length*conv^2)
+GroundR=sqrt(X*X + Y*Y)
+GroundPhi=atan2(Y, X)
 
 # Add additonal columns
@@ -46,5 +51,5 @@
 Delta    = Delta
 Angle    = atan2(MeanX, MeanY)
-M3L      = M3Long*TMath::Sign(1, CosDeltaAlpha)*conv
+M3L      = M3Long*sign(CosDeltaAlpha)*conv
 M3T      = M3Trans*conv
 Asym     = Asym*conv
@@ -55,6 +60,8 @@
 ConcCore = ConcCore
 ConcCOG  = ConcCOG
-SlopeL   = SlopeLong*TMath::Sign(1, CosDeltaAlpha)/conv
+SlopeL   = SlopeLong*sign(CosDeltaAlpha)/conv
 SlopeT   = SlopeTrans/conv
+MeanX    = MeanX
+MeanY    = MeanY
 
 TimeSpread  = TimeSpread
@@ -68,8 +75,8 @@
 
 # Be careful, this is true MC information
-#GroundR   = TMath::Hypot(X,Y)
-#GroundPhi = atan2(Y,X)
+#GroundR   = GroundR
+#GroundPhi = GroundPhi
 #GroundX   = X
-#GroundYY  = Y
+#GroundY   = Y
 EOF
 
@@ -93,4 +100,7 @@
 	--file ${TRAIN} --outprefix ${OUT} --depvarname True \
 	--verbose --treetype 3 --impmeasure 1 --write
+if [ $? != 0 ]; then
+  exit 1
+fi
 
 echo ""
@@ -105,14 +115,16 @@
         --file ${TEST} --outprefix ${OUT} --predict ${OUT}.forest \
 	--verbose --treetype 3
-
-echo --------------------------------- Creating root file ---------------------------
-${NICE} ${CSV2ROOT} ${TEST} ${OUT}.root --force
 if [ $? != 0 ]; then
   exit 1
 fi
 
-${NICE} ${CSV2ROOT} ${OUT}.prediction ${OUT}.root --update
+echo --------------------------------- Creating root file ---------------------------
+${NICE} ${CSV2ROOT} ${TEST} ${OUT}.root ${TREE} --force
 if [ $? != 0 ]; then
   exit 1
 fi
 
+${NICE} ${CSV2ROOT} ${OUT}.prediction ${OUT}.root ${TREE} --update
+if [ $? != 0 ]; then
+  exit 1
+fi
