Index: /fact/tools/rootmacros/PulseTemplates/pulse.C
===================================================================
--- /fact/tools/rootmacros/PulseTemplates/pulse.C	(revision 14945)
+++ /fact/tools/rootmacros/PulseTemplates/pulse.C	(revision 14946)
@@ -75,4 +75,19 @@
 // PUBLIC OPERATIONS
 // ===========================================================================
+
+void
+Pulse::Fit()
+{
+    Fit(mName, mOptions, mType);
+}
+
+void
+Pulse::Fit(
+        TString fitOptions,
+        int     type
+        )
+{
+    Fit(mName, fitOptions, type);
+}
 
 void
@@ -140,5 +155,5 @@
     mHisto              = NULL;
     mModel              = NULL;
-    mOptions            = "S";
+    mOptions            = "ERS";
     mBsl.first          = 0;
     mHeight.first       = 0;
@@ -168,4 +183,5 @@
     mChi2               = 0;
     mTimeResolution     = 0.5;
+    mVerbosityLvl       = 6;
 }
 
@@ -181,8 +197,9 @@
         )
 {
+    int numPara = 7;
     mFitMin = fitMin;
     mFitMax = fitMax;
-    mModel  = new TF1(fitName, shapeFunc, fitMin, fitMax, 7 );
-
+    mModel  = new TF1(fitName, shapeFunc, fitMin, fitMax, numPara );
+    mModel->SetNpx( mHisto->GetNbinsX());
     // ======================================================================
     // Calculate startvaues for fit
@@ -214,4 +231,13 @@
     double para[] = {bsl, amplitude, start, stop, tau, tau, phe};
 
+
+    // cout startvalues
+    if (mVerbosityLvl > 3)
+    {
+        for (unsigned int i = 0; i < numPara; i++)
+        {
+            cout << "para[ " << i << "]: " << para[i] << endl;
+        }
+    }
 
 
@@ -246,23 +272,60 @@
         )
 {
+    int numPara = 6;
     mFitMin = fitMin;
     mFitMax = fitMax;
-    mModel  = new TF1(fitName, shapeFunc2, fitMin, fitMax, 6 );
-
+    mModel  = new TF1(fitName, shapeFunc2, fitMin, fitMax, numPara );
+    mModel->SetNpx( mHisto->GetNbinsX());
     // ======================================================================
     // Calculate startvaues for fit
-    double tau      = 30.0;
+    double tau  = 30.0;
     double bsl  = 0; //MW der ersten zehn slices
+//    double bsl2  = 0; //MW der ersten zehn slices
     double gain = 10; //startvalue for gain
-    int first_bin   = mHisto->GetXaxis()->GetFirst();
-
-    for (int i = 0; i < 30; i++){
-        bsl += mHisto->GetBinContent(first_bin+0);
-    }
-    bsl = bsl/30;
+    int counter = 0;
 
     double stop     = mHisto->GetMaximumBin(); //pos of max
-    double amplitude= mHisto->GetBinContent(stop);
-    double start    = stop-10; //pos 10 slices before maximum
+    double amplitude=0;
+
+    for (int i = (stop - 3) ; i < (stop + 3) && i <= fitMax && i >= fitMin ; i++)
+    {
+        counter++;
+        amplitude= mHisto->GetBinContent(i);
+    }
+    amplitude=amplitude/counter;
+
+    counter = 0;
+    for (int i = (stop - 15) ; i > fitMin+2 && i <= fitMax ; i--)
+    {
+        if (mHisto->GetBinContent(i) > 0)
+        {
+            break;
+        }
+        counter++;
+        bsl += mHisto->GetBinContent(i);
+    }
+    if (counter <= 0)
+    {
+        counter = 1;
+    }
+    bsl = bsl/counter;
+
+//    counter = 0;
+//    for (int i = stop + 100; i < stop + 200 && i <= fitMax && i >= fitMin ; i++)
+//    {
+//        if (mHisto->GetBinContent(i) > 0.5*amplitude )
+//        {
+//            break;
+//        }
+//        counter++;
+//        bsl2 += mHisto->GetBinContent(i);
+//    }
+//    if (counter <= 0)
+//    {
+//        counter = 1;
+//    }
+//    bsl2 = bsl2/counter;
+
+    double start    = mHisto->GetBinCenter(stop-10); //pos 10 slices before maximum
     int    phe = 0;
     if (mOrder < 0)
@@ -277,9 +340,18 @@
 
 
-    double para[] = {bsl, amplitude, start, tau, tau, phe};
+    double para[] = {bsl, 2*amplitude+gain, start, tau*0.1, tau, phe};
     mModel->SetParameters(para);
     mModel->SetParNames("BSL", "A0", "t0", "Tau1", "Tau2", "PhE");
     mModel->SetLineColor(kBlue);
 
+    // cout startvalues
+    if (mVerbosityLvl > 3)
+    {
+        cout << endl;
+        for (unsigned int i = 0; i < numPara; i++)
+        {
+            cout << "para[ " << i << "]: " << para[i] << endl;
+        }
+    }
     mFitResultPtr   = mHisto->Fit(mModel, fitOptions);
     mBsl.first      = mModel->GetParameter(0);
@@ -401,4 +473,5 @@
 double  Pulse::GetTimeResolution(){return mTimeResolution;}
 void    Pulse::SetTimeResolution(double timeResolution){mTimeResolution = timeResolution;}
+void    Pulse::SetVerbosity(int verbLvl){mVerbosityLvl = verbLvl;}
 
 
@@ -498,4 +571,5 @@
     double tau2     = par[4];
     int    phe      = par[5];
+//    double bsl2      = par[6];
 
     // helper variables
Index: /fact/tools/rootmacros/PulseTemplates/pulse.h
===================================================================
--- /fact/tools/rootmacros/PulseTemplates/pulse.h	(revision 14945)
+++ /fact/tools/rootmacros/PulseTemplates/pulse.h	(revision 14946)
@@ -77,4 +77,9 @@
 // OPERATIONS
 //    double shapeFunc( double* x, double* par);
+    void    Fit();
+    void    Fit(
+            TString fitOptions,
+            int     type
+            );
     void    Fit(TString fitName, TString fitOptions, int type );
     void    Fit(TString fitName, TString fitOptions, int type, int fitMin, int fitMax);
@@ -120,4 +125,5 @@
     double  GetTimeResolution();
     void    SetTimeResolution(double timeResolution);
+    void    SetVerbosity(int verbLvl);
 
 // INQUIRY
@@ -148,4 +154,6 @@
 
     TFitResultPtr           mFitResultPtr;
+
+    int                     mVerbosityLvl;
 };
 
Index: /fact/tools/rootmacros/PulseTemplates/templateextractors.C
===================================================================
--- /fact/tools/rootmacros/PulseTemplates/templateextractors.C	(revision 14945)
+++ /fact/tools/rootmacros/PulseTemplates/templateextractors.C	(revision 14946)
@@ -540,11 +540,11 @@
     TH1F*   hOutputMeanHisto        = NULL;
     TH1F*   hOutputMedianHisto      = NULL;
-    TH1*    hTempHisto              = NULL;
-    float   max_prop                = 0;
-    float   median                  = 0;
-    float   mean                    = 0;
-    float   max_prop_err            = 0;
-    float   median_err              = 0;
-    float   mean_err                = 0;
+    TH1D*    hTempHisto              = NULL;
+    double  max_prop                = 0;
+    double  median                  = 0;
+    double  mean                    = 0;
+    double  max_prop_err            = 0;
+    double  median_err              = 0;
+    double  mean_err                = 0;
 
     if (verbosityLevel > 3)
@@ -695,4 +695,9 @@
     ShiftStartOfHistoInXTo(
             hOutputMedianHisto,
+            0
+            );
+
+    ShiftStartOfHistoInXTo(
+            hInputHisto,
             0
             );
