Index: fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
===================================================================
--- fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C	(revision 14781)
+++ fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C	(revision 14811)
@@ -96,12 +96,13 @@
 //----------------------------------------------------------------------------
 int FCalcPulseTemplate(
-    TString     InRootFileName        = "20120309_017.root",
+    TString     InRootFileName        = "20120802templ_0mV_entries.root",
 //    TString     InRootFileName        = "20120309_032.root",
-    TString     InputPath           = "analysis/analysis/FPulseTemplate/20120309_017/Overlay/",
+//    TString     InputPath           = "analysis/analysis/FPulseTemplate/20120309_017/Overlay/",
+    TString     InputPath           = "",
 //    TString     InputPath           = "analysis/analysis/FPulseTemplate/20120309_032/Overlay/",
     TString     OutputRootFileName     = "test.root",
-    TString     OutPutPath          = "analysis/FPulseTemplate/20120309_017/",
+    TString     OutPutPath          = "",
     int         firstpixel          = 0,
-    int         npixel              = 100,
+    int         npixel              = 1,
     int         pixelSetSize        = 200,
     int         maxPulseOrder       = 1,
@@ -111,5 +112,5 @@
     bool        saveResults         = false,
 //    bool        fitdata             = false,
-    bool        debugPixel          = false,
+    bool        debugPixel          = true,
 //    int         refresh_rate        = 500,      //refresh rate for canvases
     int         verbosityLevel      = 1        // different verbosity levels can be implemented here
@@ -549,15 +550,4 @@
                             );
 
-
-//                ShiftStartOfHistoInXTo(
-//                            pixel[pixelID]->hEdgeOverlay[pulse_order],
-//                            0
-//                            );
-
-//                ShiftStartOfHistoInXTo(
-//                            pixel[pixelID]->hMaxOverlay[pulse_order],
-//                            0
-//                            );
-
                 PixelCsv.WritePointSet(
                             pixel[pixelID],
@@ -593,42 +583,4 @@
                 if (ProduceGraphic && debugPixel)
                 {
-//                    pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-//                    pixel[pixelID]->hPixelEdgeMean[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-//                    pixel[pixelID]->hPixelEdgeMedian[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-//                    pixel[pixelID]->hPixelMax[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-//                    pixel[pixelID]->hPixelMean[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-//                    pixel[pixelID]->hPixelMedian[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-
-//                    pixel[pixelID]->hEdgeProfile[pulse_order]->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-
-
-
-
-//                    pixel[pixelID]->ShiftHistoInY(
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order],
-//                                0.25
-//                                );
-
 
                     pixel[pixelID]->DrawTemplateHistograms(
@@ -652,123 +604,4 @@
 
                     cgpPixelPulses[pulse_order]->cd(8);
-
-//                    pixel[pixelID]->hEdgeProfile[pulse_order]->SetLineColor(kBlack);
-//                    Pulse pulseMean("PulseMean", pixel[pixelID]->hEdgeProfile[pulse_order], 0);
-
-
-
-
-//                    double fit_parameters5[3];
-//                    fit_parameters5[0] = fit_parameters[0];
-//                    fit_parameters5[0] = fit_parameters[0];
-//                    FitPulse(
-//                                "hugo3",
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order],
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin()-12,
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin(),
-//                                fit_parameters5
-//                            );
-//                    cout << "Parameters\t" << fit_parameters[0] << "\n"
-//                            << fit_parameters[1] << "\n"
-//                               << fit_parameters[2] << "\n" << endl;
-
-//                    TF1 *func = new TF1("func", template_function, 0, 300, 10);
-
-//                    func->SetParameters(
-//                                -0.5, // bsl
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetFirst() + 50,
-//                                pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin()
-//                                ); // range
-
-
-
-//                    func->SetParNames("baseline",
-//                                      "begin of pol3", "begin of exp",
-//                                      "exp-factor", "exp-tau", "ext-t0",
-//                                      "pol3_0", "pol3_1", "pol3_2", "pol3_3"
-//                                      );
-//                    pixel[pixelID]->hPixelEdgeMax[pulse_order]->Fit(func);
-
-//                    TH1F* hTest = new TH1F(
-//                                "hTest",
-//                                "Test",
-//                                pixel[pixelID]->mPixelOverlayXaxisLeft
-//                                + pixel[pixelID]->mPixelOverlayXaxisRight ,
-//                                (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5,
-//                                pixel[pixelID]->mPixelOverlayXaxisRight-0.5
-//                                );
-
-//                    hTest->GetXaxis()->SetLimits(
-//                                0,
-//                                300
-//                                );
-
-//                    for (int bin = 0;
-//                         bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
-//                         bin++
-//                         )
-//                    {
-//                        hTest->SetBinContent( bin, (-1)*(fit_parameters[0]+TMath::Exp(fit_parameters[1]+fit_parameters[2]*(bin))) );
-//                    }
-
-//                    hTest->Add(pixel[pixelID]->hPixelEdgeMax[pulse_order], 1);
-
-//                    cgpPixelPulses[pulse_order]->cd(7);
-//                    hTest->Draw();
-
-//                    for (int bin = 0;
-//                         bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
-//                         bin++
-//                         )
-//                    {
-//                        hTest->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) );
-//                    }
-
-
-//                    double fit_parameters2[3];
-//                    FitFallingEdge(
-//                                "hugo2",
-//                                hTest,
-//                                hTest->GetXaxis()->GetFirst()+68,
-//                                hTest->GetXaxis()->GetFirst()+80,
-//                                fit_parameters2
-//                            );
-
-//                     cgpPixelPulses[pulse_order]->cd(8);
-
-//                     TH1F* hTest2 = new TH1F(
-//                                 "hTest2",
-//                                 "Test",
-//                                 pixel[pixelID]->mPixelOverlayXaxisLeft
-//                                 + pixel[pixelID]->mPixelOverlayXaxisRight ,
-//                                 (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5,
-//                                 pixel[pixelID]->mPixelOverlayXaxisRight-0.5
-//                                 );
-
-//                     hTest2->GetXaxis()->SetLimits(
-//                                 0,
-//                                 300
-//                                 );
-
-//                    for (int bin = 0;
-//                         bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
-//                         bin++
-//                         )
-//                    {
-//                        hTest2->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) );
-//                    }
-
-//                    double fit_parameters3[3];
-//                    FitRisingEdge(
-//                                "hugo3",
-//                                hTest2,
-//                                hTest2->GetXaxis()->GetFirst()+68,
-//                                hTest2->GetXaxis()->GetFirst()+80,
-//                                fit_parameters3
-//                            );
-
-
-//                    hTest2->Draw();
-
 
                     //-------------------------------------
@@ -785,22 +618,22 @@
 
 //                pulses.cd(1);
-                Pulse maxMaxPulse("maxMaxPulse", pixel[pixelID]->hPixelMax[pulse_order], "Q", 1);
+                Pulse maxMaxPulse("maxMaxPulse", pixel[pixelID]->hPixelMax[pulse_order], "Q", 1,pulse_order);
                 pulseFits[0] = &maxMaxPulse;
 
 //                pulses.cd(2);
-                Pulse maxMedianPulse("maxMedianPulse", pixel[pixelID]->hPixelMedian[pulse_order], "Q",1);
+                Pulse maxMedianPulse("maxMedianPulse", pixel[pixelID]->hPixelMedian[pulse_order], "Q",1,pulse_order);
                 pulseFits[1] = &maxMedianPulse;
 
 //                pulses.cd(3);
-                Pulse maxMeanPulse("maxMeanPulse", pixel[pixelID]->hPixelMean[pulse_order], "Q",1);
+                Pulse maxMeanPulse("maxMeanPulse", pixel[pixelID]->hPixelMean[pulse_order], "Q",1,pulse_order);
                 pulseFits[2] = &maxMeanPulse;
 
-                Pulse edgeMaxPulse("edgeMaxPulse", pixel[pixelID]->hPixelEdgeMax[pulse_order], "Q",1);
+                Pulse edgeMaxPulse("edgeMaxPulse", pixel[pixelID]->hPixelEdgeMax[pulse_order], "Q",1,pulse_order);
                 pulseFits[3] = &edgeMaxPulse;
 
-                Pulse edgeMedianPulse("edgeMedianPulse", pixel[pixelID]->hPixelEdgeMedian[pulse_order], "Q",1);
+                Pulse edgeMedianPulse("edgeMedianPulse", pixel[pixelID]->hPixelEdgeMedian[pulse_order], "Q",1,pulse_order);
                 pulseFits[4] = &edgeMedianPulse;
 
-                Pulse edgeMeanPulse("edgeMeanPulse", pixel[pixelID]->hPixelEdgeMean[pulse_order], "Q",1);
+                Pulse edgeMeanPulse("edgeMeanPulse", pixel[pixelID]->hPixelEdgeMean[pulse_order], "Q",1,pulse_order);
                 pulseFits[5] = &edgeMeanPulse;
 
