Index: /fact/tools/rootmacros/PulseTemplates/pixel.C
===================================================================
--- /fact/tools/rootmacros/PulseTemplates/pixel.C	(revision 13596)
+++ /fact/tools/rootmacros/PulseTemplates/pixel.C	(revision 13597)
@@ -227,28 +227,4 @@
 //----------------------------------------------------------------------------
 
-
-void
-Pixel::DrawHistograms(
-        TCanvas**    pixelCanvas,
-        int*        histoFrameNr
-        )
-{
-    if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
-    for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
-    {
-        pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
-        hMaxOverlay[pulse_order]->Draw("COLZ");
-        pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
-        hMaxProfile[pulse_order]->Draw();
-        hEdgeProfile[pulse_order]->Draw("SAME");
-
-        pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
-        hEdgeOverlay[pulse_order]->Draw("COLZ");
-    }
-}
-// end of DrawPulseHistograms
-//----------------------------------------------------------------------------
-
-
 void
 Pixel::BookDistributionHistos( )
@@ -330,225 +306,6 @@
     }
 }
-
-void
-Pixel::DrawDistributionHistograms(
-        TCanvas**    pixelCanvas,
-        int*        histoFrameNr
-        )
-{
-    if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ;
-    bool nothing_to_fill = true;
-    for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
-    {
-        if (mOptions.Contains("S") )
-        {
-        pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
-        hSlopeRisingEdge[pulse_order]->Draw();
-        nothing_to_fill = false;
-        }
-
-        if (mOptions.Contains("R") )
-        {
-        pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
-        hRisingEdgeToMax[pulse_order]->Draw();
-        nothing_to_fill = false;
-        }
-
-        if (mOptions.Contains("M") )
-        {
-        pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
-        hPosOfMax[pulse_order]->Draw();
-        nothing_to_fill = false;
-        }
-
-    }
-    if (nothing_to_fill)
-    {
-        cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl;
-    }
-}
-// end of DrawDistributionHistograms
-//----------------------------------------------------------------------------
-
-void
-Pixel::SavePixelHistograms(
-        const char* outRootFileName,
-        bool        saveResults
-        )
-{
-    if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid;
-    if (!saveResults) return;
-    SaveHistograms(
-            outRootFileName,
-            CreateSubDirName( mChid ),
-            hList,
-            saveResults,
-            mVerbosityLevel
-            );
-}
-// end of SavePixelHistograms
-//----------------------------------------------------------------------------
-
-void
-Pixel::DeletePixelHistos()
-{
-    if (mVerbosityLevel > 2)
-    {
-        cout << endl
-             << "\t...delete current overlay histograms of Pixel# " << mChid;
-    }
-    for (int order = 0;
-         order < mMaxPulseOrder;
-         order ++)
-    {
-        if (mVerbosityLevel > 3)
-        cout << endl << "\t\t...deleting hMaxOverlay"
-                                      << mChid << "_" << order
-                                      << " hMaxOverlay[order] adr " << hMaxOverlay[order]
-                                      << " hMaxOverlay adr " << hMaxOverlay
-                                         ;
-
-        delete hMaxOverlay[order];
-        hMaxOverlay[order] = NULL;
-
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"
-                                      << mChid << "_" << order ;
-        delete hEdgeOverlay[order];
-        hEdgeOverlay[order] = NULL;
-
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"
-                                      << mChid << "_" << order ;
-        delete hMaxProfile[order];
-        hMaxProfile[order] = NULL;
-
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2"
-                                      << mChid << "_" << order ;
-        delete hEdgeProfile[order];
-        hEdgeProfile[order] = NULL;
-    }
-    if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
-
-    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay";
-    delete[] hMaxOverlay;
-    hMaxOverlay = NULL;
-
-    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay";
-    delete[] hEdgeOverlay;
-    hEdgeOverlay = NULL;
-
-    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile";
-    delete[] hMaxProfile;
-    hMaxProfile = NULL;
-
-    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile";
-    delete[] hEdgeProfile;
-    hEdgeProfile = NULL;
-}
-// end of DeletePixelHistos
-//----------------------------------------------------------------------------
-
-void
-Pixel::DeleteDistributionHistos()
-{
-    if (mVerbosityLevel > 2)
-    {
-        cout << endl
-             << "\t...delete current distribution histograms" ;
-    }
-
-    for (int order = 0;
-         order < mMaxPulseOrder;
-         order ++)
-    {
-        if (mOptions.Contains("S"))
-        {
-            if (mVerbosityLevel > 3) cout << endl
-                                          << "\t\t...deleting hSlopeRisingEdge"
-                                          << mChid << "_" << order ;
-            delete hSlopeRisingEdge[order];
-        }
-
-        if (mOptions.Contains("R"))
-        {
-            if (mVerbosityLevel > 3) cout << endl
-                                          << "\t\t...deleting hRisingEdgeToMax"
-                                          << mChid << "_" << order ;
-//            delete hRisingEdgeToMax[order];
-        }
-
-        if (mOptions.Contains("M"))
-        {
-            if (mVerbosityLevel > 3) cout << endl
-                                          << "\t\t...deleting hPosOfMax"
-                                          << mChid << "_" << order ;
-
-//            delete hPosOfMax[order];
-        }
-
-    }
-    if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
-
-    if (mOptions.Contains("S"))
-    {
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hSlopeRisingEdge";
-        delete[] hSlopeRisingEdge;
-        hSlopeRisingEdge = NULL;
-    }
-
-    if (mOptions.Contains("R"))
-    {
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hRisingEdgeToMax";
-        delete[] hRisingEdgeToMax;
-        hRisingEdgeToMax = NULL;
-    }
-
-    if (mOptions.Contains("M"))
-    {
-        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPosOfMax";
-        delete[] hPosOfMax;
-        hPosOfMax = NULL;
-    }
-}
-// end of DeletePixelHistos
-//----------------------------------------------------------------------------
-
-void
-Pixel::LoadPulseHistos()
-{
-    mRootFile->cd();
-    mRootFile->cd(CreateSubDirName( mChid ));
-    for (int order = 0; order < mMaxPulseOrder; order++)
-    {
-        hMaxOverlay[order]  = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) );
-        hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) );
-        hMaxProfile[order]  = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) );
-        hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) );
-    }
-}
-
-TString
-Pixel::HistoName(
-        TString     histoname,
-        int         order
-        )
-{
-    histoname +=   mChid;
-    histoname +=   "_";
-    histoname +=   order;
-    return histoname;
-}
-
-TString
-Pixel::HistoTitle(
-        TString     histo_title,
-        int         order
-        )
-{
-    histo_title +=   " [Pixel_Order] ";
-    histo_title +=   mChid;
-    histo_title +=   "_";
-    histo_title +=   order;
-    return histo_title;
-}
+//end of BookDistributionHistos
+//----------------------------------------------------------------------------
 
 void
@@ -624,4 +381,213 @@
 //----------------------------------------------------------------------------
 
+
+void
+Pixel::DrawOverlayHistograms(
+        TCanvas**    pixelCanvas,
+        int*        histoFrameNr
+        )
+{
+    if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
+    for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
+    {
+        pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
+        hMaxOverlay[pulse_order]->Draw("COLZ");
+        pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
+        hMaxProfile[pulse_order]->Draw();
+        hEdgeProfile[pulse_order]->Draw("SAME");
+
+        pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
+        hEdgeOverlay[pulse_order]->Draw("COLZ");
+    }
+}
+// end of DrawOverlayHistograms
+//----------------------------------------------------------------------------
+
+void
+Pixel::DrawDistributionHistograms(
+        TCanvas**    pixelCanvas,
+        int*        histoFrameNr
+        )
+{
+    if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ;
+    bool nothing_to_fill = true;
+    for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
+    {
+        if (mOptions.Contains("S") )
+        {
+        pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
+        hSlopeRisingEdge[pulse_order]->Draw();
+        nothing_to_fill = false;
+        }
+
+        if (mOptions.Contains("R") )
+        {
+        pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
+        hRisingEdgeToMax[pulse_order]->Draw();
+        nothing_to_fill = false;
+        }
+
+        if (mOptions.Contains("M") )
+        {
+        pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
+        hPosOfMax[pulse_order]->Draw();
+        nothing_to_fill = false;
+        }
+
+    }
+    if (nothing_to_fill)
+    {
+        cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl;
+    }
+}
+// end of DrawDistributionHistograms
+//----------------------------------------------------------------------------
+
+void
+Pixel::DrawTemplateHistograms(
+        TCanvas**    pixelCanvas,
+        int*        histoFrameNr
+        )
+{
+    if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms" ;
+    for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
+    {
+        pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
+        hPixelMax[pulse_order]->Draw();
+
+        pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
+        hPixelMedian[pulse_order]->Draw();
+
+        pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
+        hPixelMean[pulse_order]->Draw();
+
+    }
+}
+// end of DrawTemplateHistograms
+//----------------------------------------------------------------------------
+
+void
+Pixel::DeletePixelHistos()
+{
+    if (mVerbosityLevel > 2)
+    {
+        cout << endl
+             << "\t...delete current overlay histograms of Pixel# " << mChid;
+    }
+    for (int order = 0;
+         order < mMaxPulseOrder;
+         order ++)
+    {
+        if (mVerbosityLevel > 3)
+        cout << endl << "\t\t...deleting hMaxOverlay"
+                                      << mChid << "_" << order
+                                      << " hMaxOverlay[order] adr " << hMaxOverlay[order]
+                                      << " hMaxOverlay adr " << hMaxOverlay
+                                         ;
+
+        delete hMaxOverlay[order];
+        hMaxOverlay[order] = NULL;
+
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"
+                                      << mChid << "_" << order ;
+        delete hEdgeOverlay[order];
+        hEdgeOverlay[order] = NULL;
+
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"
+                                      << mChid << "_" << order ;
+        delete hMaxProfile[order];
+        hMaxProfile[order] = NULL;
+
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2"
+                                      << mChid << "_" << order ;
+        delete hEdgeProfile[order];
+        hEdgeProfile[order] = NULL;
+    }
+    if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
+
+    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay";
+    delete[] hMaxOverlay;
+    hMaxOverlay = NULL;
+
+    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay";
+    delete[] hEdgeOverlay;
+    hEdgeOverlay = NULL;
+
+    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile";
+    delete[] hMaxProfile;
+    hMaxProfile = NULL;
+
+    if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile";
+    delete[] hEdgeProfile;
+    hEdgeProfile = NULL;
+}
+// end of DeletePixelHistos
+//----------------------------------------------------------------------------
+
+void
+Pixel::DeleteDistributionHistos()
+{
+    if (mVerbosityLevel > 2)
+    {
+        cout << endl
+             << "\t...delete current distribution histograms" ;
+    }
+
+    for (int order = 0;
+         order < mMaxPulseOrder;
+         order ++)
+    {
+        if (mOptions.Contains("S"))
+        {
+            if (mVerbosityLevel > 3) cout << endl
+                                          << "\t\t...deleting hSlopeRisingEdge"
+                                          << mChid << "_" << order ;
+            delete hSlopeRisingEdge[order];
+        }
+
+        if (mOptions.Contains("R"))
+        {
+            if (mVerbosityLevel > 3) cout << endl
+                                          << "\t\t...deleting hRisingEdgeToMax"
+                                          << mChid << "_" << order ;
+//            delete hRisingEdgeToMax[order];
+        }
+
+        if (mOptions.Contains("M"))
+        {
+            if (mVerbosityLevel > 3) cout << endl
+                                          << "\t\t...deleting hPosOfMax"
+                                          << mChid << "_" << order ;
+
+//            delete hPosOfMax[order];
+        }
+
+    }
+    if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
+
+    if (mOptions.Contains("S"))
+    {
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hSlopeRisingEdge";
+        delete[] hSlopeRisingEdge;
+        hSlopeRisingEdge = NULL;
+    }
+
+    if (mOptions.Contains("R"))
+    {
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hRisingEdgeToMax";
+        delete[] hRisingEdgeToMax;
+        hRisingEdgeToMax = NULL;
+    }
+
+    if (mOptions.Contains("M"))
+    {
+        if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPosOfMax";
+        delete[] hPosOfMax;
+        hPosOfMax = NULL;
+    }
+}
+// end of DeletePixelHistos
+//----------------------------------------------------------------------------
+
 void
 Pixel::DeleteTemplateHistos()
@@ -671,4 +637,68 @@
     hPixelMean = NULL;
 }
+// end of DeleteTemplateHistos
+//----------------------------------------------------------------------------
+
+void
+Pixel::SavePixelHistograms(
+        const char* outRootFileName,
+        bool        saveResults
+        )
+{
+    if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid;
+    if (!saveResults) return;
+    SaveHistograms(
+            outRootFileName,
+            CreateSubDirName( mChid ),
+            hList,
+            saveResults,
+            mVerbosityLevel
+            );
+}
+// end of SavePixelHistograms
+//----------------------------------------------------------------------------
+
+void
+Pixel::LoadPulseHistos()
+{
+    mRootFile->cd();
+    mRootFile->cd(CreateSubDirName( mChid ));
+    for (int order = 0; order < mMaxPulseOrder; order++)
+    {
+        hMaxOverlay[order]  = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) );
+        hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) );
+        hMaxProfile[order]  = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) );
+        hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) );
+    }
+}
+// end of LoadPulseHistos
+//----------------------------------------------------------------------------
+
+TString
+Pixel::HistoName(
+        TString     histoname,
+        int         order
+        )
+{
+    histoname +=   mChid;
+    histoname +=   "_";
+    histoname +=   order;
+    return histoname;
+}
+
+TString
+Pixel::HistoTitle(
+        TString     histo_title,
+        int         order
+        )
+{
+    histo_title +=   " [Pixel_Order] ";
+    histo_title +=   mChid;
+    histo_title +=   "_";
+    histo_title +=   order;
+    return histo_title;
+}
+
+
 
 //============================= ACESS      ===================================
