Index: /fact/tools/rootmacros/fbsl.C
===================================================================
--- /fact/tools/rootmacros/fbsl.C	(revision 12297)
+++ /fact/tools/rootmacros/fbsl.C	(revision 12298)
@@ -36,4 +36,5 @@
 UInt_t data_roi;
 int NEvents;
+int NBSLeve = 1000;
 
 size_t drs_n;
@@ -157,7 +158,7 @@
 	}
     // Book the histograms
-    printf("call BookHistos\n");
+    // printf("call BookHistos\n");
     BookHistos( data_roi );
-    printf("returned from BookHistos\n");
+    // printf("returned from BookHistos\n");
     // Loop over events
 	cout << "--------------------- Data --------------------" << endl;
@@ -201,4 +202,17 @@
     }
 
+    FILE *fp;
+    TString fName; // name of the histogram file
+    /* create the filename for the histogram file */
+    fName = datafilename; // use the name of the tree file
+    fName.Remove(fName.Length() - 5); // remove the extension .root
+    fName += "_bsl.txt"; // add the new extension
+
+    fp = fopen(fName, "a+");
+    fprintf( fp, "FILE: %s\n", datafilename );
+    fprintf( fp, "NEVENTS: %d\n", NEvents);
+    NBSLeve = NEvents; // this has to be changed when computation on a subset of a run is implemented
+    fprintf( fp, "NBSLEVE:  %d\n", NBSLeve );
+
     for (int pix = 0; pix < NPIX; pix++) {
         //printf("Maximum bin pix[%d] %f\n", pix ,hBaseline[pix]->GetMaximumBin() );
@@ -206,4 +220,7 @@
         float vmaxprob = hBaseline[pix]->GetXaxis()->GetBinCenter(
             hBaseline[pix]->GetMaximumBin() );
+
+        fprintf( fp, "%8.3f", vmaxprob );
+
         hMeanBsl->Fill( vmaxprob );
         hpltMeanBsl->SetBinContent(pix+1, vmaxprob );
@@ -212,4 +229,6 @@
         hpltRmsBsl->SetBinContent( pix+1, hBaseline[pix]->GetRMS() );   
     }
+
+    fclose( fp );
 
     SaveHistograms( datafilename );
@@ -361,5 +380,5 @@
     hList.Add( hRmsBsl );
 
-    hpltRmsBsl = new TH1F("hplt_mean","Value of maximal probability",1440,-0.5,1439.5);
+    hpltRmsBsl = new TH1F("hplt_rms","Value of maximal probability",1440,-0.5,1439.5);
     hpltRmsBsl->GetXaxis()->SetTitle( "pixel" );
     hpltRmsBsl->GetYaxis()->SetTitle( "RMS in mV" );
