diff --git a/setup.csh b/setup.csh
index d7df18c89cf06ac4bea58b32ff02b2cd2fbf27d2..8bbc4063544bafc591e3e7ca94f5b2d0b065eaf1 100644
--- a/setup.csh
+++ b/setup.csh
@@ -2,17 +2,29 @@
 
 set called=($_)
 if ("$called" != "") then
-  set scriptdir=$called[2]
-  set MYDIR=`dirname $scriptdir`
-  set MYDIR=`cd $MYDIR && pwd`    # ensure absolute path
+set scriptdir=$called[2]
+  echo $scriptdir
+# set MYDIR=`dirname $scriptdir`
+# set MYDIR=`cd $MYDIR && pwd` # ensure absolute path
+
+  set MYDIR=`pwd` # ensure absolute path
+
+# echo $MYDIR
+# echo "Are we here"
 else
-  set scriptdir=$1
+set scriptdir=$1
   set MYDIR=$scriptdir
 endif
+
+
 setenv ANALYZER $MYDIR/podd
 setenv HCANALYZER $MYDIR
+
 # Check if LD_LIBRARY_PATH is defined
 if ( ! ($?LD_LIBRARY_PATH) ) then
-   setenv LD_LIBRARY_PATH ""
+setenv LD_LIBRARY_PATH ""
 endif
 setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${ANALYZER}:${HCANALYZER}"
+
+echo $ANALYZER
+echo $HCANALYZER
diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx
index a5abf581b4ad4937323a130679547a3666447027..b70fbb2151450393fcc80a889a2a4ba9903ccdd4 100644
--- a/src/THcHallCSpectrometer.cxx
+++ b/src/THcHallCSpectrometer.cxx
@@ -153,7 +153,7 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date )
   cout << "In THcHallCSpectrometer::ReadDatabase()" << endl;
 #endif
 
-  MAXHODHITS = 30;
+  MAXHODHITS = 53;
   
   fX2D           = new Double_t [MAXHODHITS];
   fY2D           = new Double_t [MAXHODHITS];
@@ -426,11 +426,12 @@ Int_t THcHallCSpectrometer::TrackCalc()
       Double_t fY2Dmin, fX2Dmin, fZap, ft, fChi2PerDeg; //, fShowerEnergy;
       Double_t fHitPos4, fHitPos3, fHitDist3, fHitDist4; //, fChi2Min;
       Int_t i, j, itrack, ip, ihit; //, fGoodTimeIndex = -1;
-      Int_t  fHitCnt4, fHitCnt3, fRawIndex = -1, fGoodRawPad;
+      Int_t  fHitCnt4, fHitCnt3, fRawIndex, fGoodRawPad;
       
       fChi2Min = 10000000000.0;   fGoodTrack = -1;   fY2Dmin = 100.;
       fX2Dmin = 100.;             fZap = 0.;
 
+      fRawIndex = -1;
       for ( itrack = 0; itrack < fNtracks; itrack++ ){
 	
 	THaTrack* goodTrack = static_cast<THaTrack*>( fTracks->At(itrack) );      
@@ -446,24 +447,31 @@ Int_t THcHallCSpectrometer::TrackCalc()
 	      ( goodTrack->GetEnergy()  > fSelEtMin    )   && 
 	      ( goodTrack->GetEnergy()  < fSelEtMax    ) )  	    	    
 	    {
-	      
-	      for ( j = 0; j < 16; j++ ){ f2XHits[j] = 0; }
-	      for ( j = 0; j < 16; j++ ){ f2YHits[j] = 0; }
+	      	      
+	      for ( j = 0; j < 16; j++ ){ 
+		f2XHits[j] = -1; 
+		f2YHits[j] = -1; 
+	      }
 	      
 	      for ( ip = 0; ip < fNPlanes; ip++ ){
 		for ( ihit = 0; ihit < fHodo->GetNScinHits(ip); ihit++ ){
 		  fRawIndex ++;		  
-		  fGoodRawPad = fHodo->GetGoodRawPad(fRawIndex)-1;
-
-		  if ( ip == 2 )
-		    f2XHits[fGoodRawPad] = 0;
-		  
-		  if ( ip == 3 )
-		    f2YHits[fGoodRawPad] = 0;
-		  
+
+		  //		  fGoodRawPad = fHodo->GetGoodRawPad(fRawIndex)-1;
+		  fGoodRawPad = fHodo->GetGoodRawPad(fRawIndex);
+
+		  if ( ip == 2 ){  
+		    f2XHits[fGoodRawPad] = 0;   		    
+		  }
+
+		  if ( ip == 3 ){  
+		    f2YHits[fGoodRawPad] = 0;   
+		    
+		  } 
+
 		} // loop over hits of a plane
 	      } // loop over planes 
-	      
+
 	      fHitPos4  = goodTrack->GetY() + goodTrack->GetPhi() * ( fScin2YZpos + 0.5 * fScin2YdZpos );
 	      fHitCnt4  = TMath::Nint( ( fHodo->GetHodoCenter4() - fHitPos4 ) / fHodo->GetScin2YSpacing() ) + 1;
 	      fHitCnt4  = TMath::Max( TMath::Min(fHitCnt4,TMath::Nint(10) ) , 1); // scin_2y_nr = 10
@@ -476,12 +484,10 @@ Int_t THcHallCSpectrometer::TrackCalc()
 		ft = 0;
 		
 		for ( i = 0; i < 10; i++ ){
-		  
-		  if ( f2YHits[fGoodRawPad] == 1 ) {
-		    
+		  if ( f2YHits[i] == 0 ) {		    
 		    fY2D[itrack] = TMath::Abs(fHitCnt4-i-1);
 		    ft ++;
-		    
+		    		    
 		    if   ( ft == 1 )                              fZap = fY2D[itrack];
 		    if ( ( ft == 2 ) && ( fY2D[itrack] < fZap ) ) fZap = fY2D[itrack]; 		    
 		    if ( ( ft == 3 ) && ( fY2D[itrack] < fZap ) ) fZap = fY2D[itrack]; 
@@ -503,13 +509,13 @@ Int_t THcHallCSpectrometer::TrackCalc()
 
 	      //----------------------------------------------------------------
 
-	      if ( fNtracks > 1 ){     // Plane 3
+	      if ( fNtracks > 1 ){     // Plane 3 (2X)
 		fZap = 0.;
 		ft = 0;
-
 		for ( i = 0; i < 16; i++ ){
-		  if ( f2XHits[fGoodRawPad] == 1 ) {
+		  if ( f2XHits[i] == 0 ) {
 		    fX2D[itrack] = TMath::Abs(fHitCnt3-i-1);
+		    
 		    ft ++;
 		    if   ( ft == 1 )                              fZap = fX2D[itrack];
 		    if ( ( ft == 2 ) && ( fX2D[itrack] < fZap ) ) fZap = fX2D[itrack]; 		    
@@ -527,7 +533,7 @@ Int_t THcHallCSpectrometer::TrackCalc()
 
 	      if ( fNtracks == 1 ) 
 		fX2D[itrack] = 0.;
-	      
+	      	      
 	      if ( fY2D[itrack] <= fY2Dmin ) {
 		if ( fY2D[itrack] < fY2Dmin ) {
 		  fX2Dmin = 100.;
@@ -551,8 +557,7 @@ Int_t THcHallCSpectrometer::TrackCalc()
 		  }		  
 		} // condition fX2D
 	      } // condition fY2D
-	    } // conditions for dedx, beta and trac energy	
-	  
+	    } // conditions for dedx, beta and trac energy		  
 	} // confition for fNFreeFP greater than fSelNDegreesMin
       } // loop over tracks      
 
@@ -586,6 +591,13 @@ Int_t THcHallCSpectrometer::TrackCalc()
     
   }
 
+  //  if ( fHodo->GetEvent() == 11351 ){
+    cout << "hcana_event   " << fHodo->GetEvent()
+	 << "     golden_track   " << fGoodTrack + 1
+	 << "     chimin   " << fChi2Min
+	 << endl;
+    //  }
+    
   return TrackTimes( fTracks );
 }
 
diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index ff575d41934db6d9e627fe482281f5ee757ec360..2802d1ed2d45e9164591fa3a9ccb2fc7ab2a5b10 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -361,7 +361,7 @@ void THcHodoscope::DefineArray(const char* fName, char** Suffix, const Int_t ind
 Int_t THcHodoscope::ReadDatabase( const TDatime& date )
 {
 
-  MAXHODHITS = 30;
+  MAXHODHITS = 53;
   fBeta = new Double_t[ MAXHODHITS ];
   fBetaChisq = new Double_t[ MAXHODHITS ];
 
@@ -441,8 +441,18 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
   fHodoNegInvAdcAdc=new Double_t [fMaxHodoScin];
   
 
+
   prefix[1]='\0';
   DBRequest list[]={
+    // {"scin_2x_zpos",          &fScin2XZpos,            kDouble,         0,  1},
+    // {"scin_2x_dzpos",         &fScin2XdZpos,           kDouble,         0,  1},
+    // {"scin_2y_zpos",          &fScin2YZpos,            kDouble,         0,  1},
+    // {"scin_2y_dzpos",         &fScin2YdZpos,           kDouble,         0,  1},
+    // {"sel_betamin",           &fSelBetaMin,            kDouble,         0,  1},
+    // {"sel_dedx1min",          &fSeldEdX1Min,           kDouble,         0,  1},
+    // {"sel_dedx1max",          &fSeldEdX1Max,           kDouble,         0,  1},
+    //    {"sel_using_scin",        &fSelUsingScin,          kInt,            0,  1},
+    //    {"sel_ndegreesmin",       &fSelNDegreesMin,        kDouble,         0,  1},
     {"start_time_center",     &fStartTimeCenter,                      kDouble},
     {"start_time_slop",       &fStartTimeSlop,                        kDouble},
     {"scin_tdc_to_time",      &fScinTdcToTime,                        kDouble},
@@ -468,6 +478,20 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
   fTofTolerance = 3.0;		// Default if not defined
   gHcParms->LoadParmValues((DBRequest*)&list,prefix);
 
+
+  cout << "\n\n\n\n\n\nPaddles1x = " << fNPaddle[0]
+       << "\nscin_2y_zpos = " << fScin2YZpos
+       << "\nscin_2y_dzpos = " << fScin2YdZpos
+       << endl;  
+  //      << "\ndedx max = " <<   fSeldEdX1Max 
+  //      << "\nbeta min = " <<   fSelBetaMin
+  //      << "\nbeta max = " <<   fSelBetaMax
+  //      << "\net min   = " <<   fSelEtMin
+  //      << "\net max   = " <<   fSelEtMax
+  
+  //      << endl;
+
+
   if (fTofUsingInvAdc) {
     DBRequest list2[]={
       {"hodo_pos_invadc_offset",&fHodoPosInvAdcOffset[0],kDouble,fMaxHodoScin},
@@ -1039,9 +1063,10 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
 	  fRawIndex ++;
 
 	  fPaddle = ((THcSignalHit*)scinPosTDC->At(ihit))->GetPaddleNumber()-1;
-	  fHitPaddle[fGoodTimeIndex] =  fPaddle;
+	  fHitPaddle[fGoodTimeIndex] = fPaddle;
 
-	  fGoodRawPad[fRawIndex] = fPlanes[ip]->GetGoodRawPadNum(ihit);
+	  //	  fGoodRawPad[fRawIndex] = fPlanes[ip]->GetGoodRawPadNum(ihit);
+	  fGoodRawPad[fRawIndex] = fPaddle;
 	  
 	  fXcoord = theTrack->GetX() + theTrack->GetTheta() *
 	    ( fPlanes[ip]->GetZpos() + ( fPaddle % 2 ) * fPlanes[ip]->GetDzpos() ); // Line 277
@@ -1178,6 +1203,14 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
 	      // }
 	      // ---------------------------------------------------------------------------
 
+
+	      //	      fdEdX[itrack][ihit] = 5.0;
+
+
+	      // --------------------------------------------------------------------------------------------
+	      // Date: July 8 201  May be we need this, not sure.
+	      //
+
 	      if ( fGoodTDCPos[fGoodTimeIndex] ){
 		if ( fGoodTDCNeg[fGoodTimeIndex] ){
 
@@ -1213,6 +1246,11 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
 	} // Second loop over hits of a scintillator plane ends here
       } // Loop over scintillator planes ends here
 
+      //------------------------------------------------------------------------------
+      //------------------------------------------------------------------------------
+      //------------------------------------------------------------------------------
+      //------------------------------------------------------------------------------
+      //------------------------------------------------------------------------------
       //------------------------------------------------------------------------------
       //------------------------------------------------------------------------------
       //------------------------------------------------------------------------------
@@ -1299,7 +1337,13 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
 	
 	// -------------------------------------------------------------------- 
 	// -------------------------------------------------------------------- 
-	// -------------------------------------------------------------------- 	
+	// -------------------------------------------------------------------- 
+	// -------------------------------------------------------------------- 
+	// -------------------------------------------------------------------- 
+	// -------------------------------------------------------------------- 
+	// -------------------------------------------------------------------- 
+	// -------------------------------------------------------------------- 
+	
 
       }
       else {
@@ -1328,6 +1372,10 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
 	}
       }
 
+
+      // fBetaChisq[itrack]
+      // fFPTime[ind]
+
       theTrack->SetDedx(fdEdX[itrack][0]);
       theTrack->SetBeta(fBeta[itrack]);
       theTrack->SetBetaChi2( fBetaChisq[itrack] );
diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h
index a41a2dd0fc1bb4710e5a123c390aa51158672bc3..87c9f5a32e82c0b45f0693687b8bc0f95f13fa85 100644
--- a/src/THcHodoscope.h
+++ b/src/THcHodoscope.h
@@ -78,7 +78,7 @@ public:
 
   //  Double_t GetBeta() const {return fBeta[];}
 
-  Double_t GetBeta(Int_t iii) const {return fBeta[iii];} 
+  Double_t GetBeta(Int_t iii) const {return fBeta[iii];} // Ahmed
   Int_t GetEvent(){ return fCheckEvent;}
 
   Double_t GetHodoPosSigma(Int_t iii) const {return fHodoPosSigma[iii];}
@@ -92,6 +92,8 @@ public:
   THcHodoscope();  // for ROOT I/O
 protected:
 
+  //  std::vector<bool> myScinGoodTime;  // Ahmed
+
   Int_t fAnalyzePedestals;
 
   // Calibration
@@ -141,7 +143,7 @@ protected:
   TClonesArray*  fTrackProj;  // projection of track onto scintillator plane
                               // and estimated match to TOF paddle
 
-  //--------------------------   Beta variables   -----------------------------
+  //--------------------------   Ahmed   -----------------------------
 
   THcShower* fShower;