Index: fact/tools/rootmacros/fbsl.C
===================================================================
--- fact/tools/rootmacros/fbsl.C	(revision 12516)
+++ fact/tools/rootmacros/fbsl.C	(revision 12517)
@@ -88,6 +88,4 @@
 TCanvas* cFilter;
 
-int spikeDebug = 0;
-int searchSinglesPeaks = 0;
 
 int fbsl( 
@@ -100,4 +98,6 @@
 	int firstpixel		= 0,
 	int npixel				= -1,
+	int spikeDebug = 0,
+	int searchSinglesPeaks = 0,
 	bool produceGraphic = true
 ){
@@ -142,8 +142,8 @@
 	    datafile->GetRow( ev );
 		
-		if ( ev % 100 == 0 ){
+		if( ev % 100 == 0){
 			cout << "Event ID: " << EventID << endl;
-		}
-		
+			}
+	
 		// loop over pixel
 		for ( int pix = firstpixel ; pix < npixel+firstpixel ; pix++ ){
@@ -165,10 +165,10 @@
 			sliding_avg(Vcorr, Vslide, 8);
 
-            for ( unsigned int sl = 0; sl <RegionOfInterest ; sl++){
+            for ( unsigned int sl = 0; sl < Vslide.size() ; sl++){
                // hPixelCellData.Fill( sl, Vcorr[sl] );
                hBaseline[pix-firstpixel]->Fill( Vslide[sl] ) ;
             }   
 	    }
-    }
+	}
 
     FILE *fp;
@@ -183,6 +183,5 @@
 
     for (int pix = firstpixel; pix < firstpixel+npixel; pix++) {
-
-        float vmaxprob = hBaseline[pix]->GetXaxis()->GetBinCenter(
+        float vmaxprob = hBaseline[pix-firstpixel]->GetXaxis()->GetBinCenter(
             hBaseline[pix-firstpixel]->GetMaximumBin() );
 
@@ -198,4 +197,5 @@
 
     fclose( fp );
+
 
     SaveHistograms( RootOutFileName );
