+///////////////////////////////////////////////////////////////////////////////////////
+// Implementation of the TPC pedestal and noise calibration
+//
+// Origin: Jens Wiechula, Marian Ivanov J.Wiechula@gsi.de, Marian.Ivanov@cern.ch
+//
+//
+// *************************************************************************************
+// * Class Description *
+// *************************************************************************************
+//
+// Working principle:
+// ------------------
+// Raw pedestal data is processed by calling one of the ProcessEvent(...) functions
+// (see below). These in the end call the Update(...) function, where the data is filled
+// into histograms.
+//
+// For each ROC one TH2F histo (ROC channel vs. ADC channel) is created when
+// it is filled for the first time (GetHistoPedestal(ROC,kTRUE)). All histos are stored in the
+// TObjArray fHistoPedestalArray.
+//
+// For a fast filling of the histogram the corresponding bin number of the channel and ADC channel
+// is computed by hand and the histogram array is accessed directly via its pointer.
+// ATTENTION: Doing so the the entry counter of the histogram is not increased
+// this means that e.g. the colz draw option gives an empty plot unless
+// calling 'histo->SetEntries(1)' before drawing.
+//
+// After accumulating the desired statistics the Analyse() function has to be called.
+// Whithin this function the pedestal and noise values are calculated for each pad, using
+// the fast gaus fit function AliMathBase::FitGaus(...), and the calibration
+// storage classes (AliTPCCalROC) are filled for each ROC.
+// The calibration information is stored in the TObjArrays fCalRocArrayPedestal and fCalRocArrayRMS;
+//
+//
+//
+// User interface for filling data:
+// --------------------------------
+//
+// To Fill information one of the following functions can be used:
+//
+// Bool_t ProcessEvent(eventHeaderStruct *event);
+// - process Date event
+// - use AliTPCRawReaderDate and call ProcessEvent(AliRawReader *rawReader)
+//
+// Bool_t ProcessEvent(AliRawReader *rawReader);
+// - process AliRawReader event
+// - use AliTPCRawStream to loop over data and call ProcessEvent(AliTPCRawStream *rawStream)
+//
+// Bool_t ProcessEvent(AliTPCRawStream *rawStream);
+// - process event from AliTPCRawStream
+// - call Update function for signal filling
+//
+// Int_t Update(const Int_t isector, const Int_t iRow, const Int_t
+// iPad, const Int_t iTimeBin, const Float_t signal);
+// - directly fill signal information (sector, row, pad, time bin, pad)
+// to the reference histograms
+//
+// It is also possible to merge two independently taken calibrations using the function
+//
+// void Merge(AliTPCCalibPedestal *ped)
+// - copy histograms in 'ped' if the do not exist in this instance
+// - Add histograms in 'ped' to the histograms in this instance if the allready exist
+// - After merging call Analyse again!
+//
+//
+//
+// -- example: filling data using root raw data:
+// void fillPedestal(Char_t *filename)
+// {
+// rawReader = new AliRawReaderRoot(fileName);
+// if ( !rawReader ) return;
+// AliTPCCalibPedestal *calib = new AliTPCCalibPedestal;
+// while (rawReader->NextEvent()){
+// calib->ProcessEvent(rawReader);
+// }
+// calib->Analyse();
+// calib->DumpToFile("PedestalData.root");
+// delete rawReader;
+// delete calib;
+// }
+//
+//
+// What kind of information is stored and how to retrieve them:
+// ------------------------------------------------------------
+//
+// - Accessing the 'Reference Histograms' (pedestal distribution histograms):
+//
+// TH2F *GetHistoPedestal(Int_t sector);
+//
+// - Accessing the calibration storage objects:
+//
+// AliTPCCalROC *GetCalRocPedestal(Int_t sector); - for the pedestal values
+// AliTPCCalROC *GetCalRocNoise(Int_t sector); - for the Noise values
+//
+// example for visualisation:
+// if the file "PedestalData.root" was created using the above example one could do the following:
+//
+// TFile filePedestal("PedestalData.root")
+// AliTPCCalibPedestal *ped = (AliTPCCalibPedestal*)filePedestal->Get("AliTPCCalibPedestal");
+// ped->GetCalRocPedestal(0)->Draw("colz");
+// ped->GetCalRocRMS(0)->Draw("colz");
+//
+// or use the AliTPCCalPad functionality:
+// AliTPCCalPad padPedestal(ped->GetCalPadPedestal());
+// AliTPCCalPad padNoise(ped->GetCalPadRMS());
+// padPedestal->MakeHisto2D()->Draw("colz"); //Draw A-Side Pedestal Information
+// padNoise->MakeHisto2D()->Draw("colz"); //Draw A-Side Noise Information
+//
+/*
+ example: fill pedestal with gausschen noise
+ AliTPCCalibPedestal ped;
+ ped.TestEvent();
+ ped.Analyse();
+ //Draw output;
+ TCanvas* c1 = new TCanvas;
+ c1->Divide(1,2);
+ c1->cd(1);
+ ped.GetHistoPedestal(0)->SetEntries(1); //needed in order for colz to work, reason: fast filling does not increase the entries counter
+ ped.GetHistoPedestal(0)->Draw("colz");
+ c1->cd(2);
+ ped.GetHistoPedestal(36)->SetEntries(1); //needed in order for colz to work, reason: fast filling does not increase the entries counter
+ ped.GetHistoPedestal(36)->Draw("colz");
+ TCanvas* c2 = new TCanvas;
+ c2->Divide(2,2);
+ c2->cd(1);
+ ped.GetCalRocPedestal(0)->Draw("colz");
+ c2->cd(2);
+ ped.GetCalRocRMS(0)->Draw("colz");
+ c2->cd(3);
+ ped.GetCalRocPedestal(36)->Draw("colz");
+ c2->cd(4);
+ ped.GetCalRocRMS(36)->Draw("colz");