-/* $Id$ */
-
-////////////////////////////////////////////////////////////////////////////////////////
-// //
-// Implementation of the TPC Central Electrode calibration //
-// //
-// Origin: Jens Wiechula, Marian Ivanov J.Wiechula@gsi.de, Marian.Ivanov@cern.ch //
-// //
-////////////////////////////////////////////////////////////////////////////////////////
-//
-//
-// *************************************************************************************
-// * Class Description *
-// *************************************************************************************
-//
-/* BEGIN_HTML
- <h4>The AliTPCCalibCE class is used to get calibration data from the Central Electrode
- using laser runs.</h4>
-
- The information retrieved is
- <ul style="list-style-type: square;">
- <li>Time arrival from the CE</li>
- <li>Signal width</li>
- <li>Signal sum</li>
- </ul>
-
-<h4>Overview:</h4>
- <ol style="list-style-type: upper-roman;">
- <li><a href="#working">Working principle</a></li>
- <li><a href="#user">User interface for filling data</a></li>
- <li><a href="#info">Stored information</a></li>
- </ol>
-
- <h3><a name="working">I. Working principle</a></h3>
-
- <h4>Raw laser data is processed by calling one of the ProcessEvent(...) functions
- (see below). These in the end call the Update(...) function.</h4>
-
- <ul style="list-style-type: square;">
- <li>the Update(...) function:<br />
- In this function the array fPadSignal is filled with the adc signals between the specified range
- fFirstTimeBin and fLastTimeBin for the current pad.
- before going to the next pad the ProcessPad() function is called, which analyses the data for one pad
- stored in fPadSignal.
- </li>
- <ul style="list-style-type: square;">
- <li>the ProcessPad() function:</li>
- <ol style="list-style-type: decimal;">
- <li>Find Pedestal and Noise information</li>
- <ul style="list-style-type: square;">
- <li>use database information which has to be set by calling<br />
- SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC)</li>
- <li>if no information from the pedestal data base
- is available the informaion is calculated on the fly
- ( see FindPedestal() function )</li>
- </ul>
- <li>Find local maxima of the pad signal</li>
- <ul style="list-style-type: square;">
- <li>maxima arise from the laser tracks, the CE and also periodic postpeaks after the CE signal have
- have been observed ( see FindLocalMaxima(...) )</li>
- </ul>
- <li>Find the CE signal information</li>
- <ul style="list-style-type: square;">
- <li>to find the position of the CE signal the Tmean information from the previos event is used
- as the CE signal the local maximum closest to this Tmean is identified</li>
- <li>calculate mean = T0, RMS = signal width and Q sum in a range of -4+7 timebins around Q max position
- the Q sum is scaled by pad area (see FindPulserSignal(...) function)</li>
- </ul>
- <li>Fill a temprary array for the T0 information (GetPadTimesEvent(fCurrentSector,kTRUE)) (why see below)</li>
- <li>Fill the Q sum and RMS values in the histograms (GetHisto[RMS,Q](ROC,kTRUE))</li>
- </ol>
- </ul>
- </ul>
-
- <h4>At the end of each event the EndEvent() function is called</h4>
-
- <ul style="list-style-type: square;">
- <li>the EndEvent() function:</li>
- <ul style="list-style-type: square;">
- <li>calculate the mean T0 for side A and side C. Fill T0 histogram with Time0-<Time0 for side[A,C]>
- This is done to overcome syncronisation problems between the trigger and the fec clock.</li>
- <li>calculate Mean T for each ROC using the COG aroud the median of the LocalMaxima distribution in one sector</li>
- <li>calculate Mean Q</li>
- <li>calculate Global fit parameters for Pol1 and Pol2 fits</li>
- </ul>
- </ul>
-
- <h4>After accumulating the desired statistics the Analyse() function has to be called.</h4>
- <ul style="list-style-type: square;">
- <li>the Analyse() function:</li>
- <ul style="list-style-type: square;">
- <li>calculate the mean values of T0, RMS, Q for each pad, using
- the AliMathBase::GetCOG(...) function</li>
- <li>fill the calibration storage classes (AliTPCCalROC) for each ROC</li>
- (The calibration information is stored in the TObjArrays fCalRocArrayT0, fCalRocArrayRMS and fCalRocArrayQ</li>
- </ul>
- </ul>
-
- <h3><a name="user">II. User interface for filling data</a></h3>
-
- <h4>To Fill information one of the following functions can be used:</h4>
-
- <ul style="list-style-type: none;">
- <li> Bool_t ProcessEvent(eventHeaderStruct *event);</li>
- <ul style="list-style-type: square;">
- <li>process Date event</li>
- <li>use AliTPCRawReaderDate and call ProcessEvent(AliRawReader *rawReader)</li>
- </ul>
- <br />
-
- <li> Bool_t ProcessEvent(AliRawReader *rawReader);</li>
- <ul style="list-style-type: square;">
- <li>process AliRawReader event</li>
- <li>use AliTPCRawStream to loop over data and call ProcessEvent(AliTPCRawStream *rawStream)</li>
- </ul>
- <br />
-
- <li> Bool_t ProcessEvent(AliTPCRawStream *rawStream);</li>
- <ul style="list-style-type: square;">
- <li>process event from AliTPCRawStream</li>
- <li>call Update function for signal filling</li>
- </ul>
- <br />
-
- <li> Int_t Update(const Int_t isector, const Int_t iRow, const Int_t
- iPad, const Int_t iTimeBin, const Float_t signal);</li>
- <ul style="list-style-type: square;">
- <li>directly fill signal information (sector, row, pad, time bin, pad)
- to the reference histograms</li>
- </ul>
- </ul>
-
- <h4>It is also possible to merge two independently taken calibrations using the function</h4>
-
- <ul style="list-style-type: none;">
- <li> void Merge(AliTPCCalibSignal *sig)</li>
- <ul style="list-style-type: square;">
- <li>copy histograms in 'sig' if they do not exist in this instance</li>
- <li>Add histograms in 'sig' to the histograms in this instance if the allready exist</li>
- <li>After merging call Analyse again!</li>
- </ul>
- </ul>
-
-
- <h4>example: filling data using root raw data:</h4>
- <pre>
- void fillCE(Char_t *filename)
- {
- rawReader = new AliRawReaderRoot(fileName);
- if ( !rawReader ) return;
- AliTPCCalibCE *calib = new AliTPCCalibCE;
- while (rawReader->NextEvent()){
- calib->ProcessEvent(rawReader);
- }
- calib->Analyse();
- calib->DumpToFile("CEData.root");
- delete rawReader;
- delete calib;
- }
- </pre>
-
- <h3><a name="info">III. What kind of information is stored and how to retrieve it</a></h4>
-
- <h4><a name="info:stored">III.1 Stored information</a></h4>
- <ul style="list-style-type: none;">
- <li>Histograms:</li>
- <ul style="list-style-type: none;">
- <li>For each ROC three TH2S histos 'Reference Histograms' (ROC channel vs. [Time0, signal width, Q sum])
- is created when it is filled for the first time (GetHisto[T0,RMS,Q](ROC,kTRUE)). The histos are
- stored in the TObjArrays fHistoT0Array, fHistoRMSArray and fHistoQArray.</li>
- </ul>
- <br />
-
- <li>Calibration Data:</li>
- <ul style="list-style-type: none;">
- <li>For each ROC three types of calibration data (AliTPCCalROC) is stored: for the mean arrival Time,
- the signal width and the signal Sum. The AliTPCCalROC objects are stored in the TObjArrays
- fCalRocArrayT0, fCalRocArrayRMS , fCalRocArrayQ. The object for each roc is created the first time it
- is accessed (GetCalRoc[T0,RMS,Q](ROC,kTRUE));</li>
- </ul>
- <br />
-
- <li>For each event the following information is stored:</li>
-
- <ul style="list-style-type: square;">
- <li>event time ( TVectorD fVEventTime )</li>
- <li>event id ( TVectorD fVEventNumber )</li>
- <br />
- <li>mean arrival time for each ROC ( TObjArray fTMeanArrayEvent )</li>
- <li>mean Q for each ROC ( TObjArray fQMeanArrayEvent )</li>
- <li>parameters of a plane fit for each ROC ( TObjArray fParamArrayEventPol1 )</li>
- <li>parameters of a 2D parabola fit for each ROC ( TObjArray fParamArrayEventPol2 )</li>
- </ul>
- </ul>
-
- <h4><a name="info:retrieve">III.2 Retrieving information</a></h4>
- <ul style="list-style-type: none;">
- <li>Accessing the 'Reference Histograms' (Time0, signal width and Q sum information pad by pad):</li>
- <ul style="list-style-type: square;">
- <li>TH2F *GetHistoT0(Int_t sector);</li>
- <li>TH2F *GetHistoRMS(Int_t sector);</li>
- <li>TH2F *GetHistoQ(Int_t sector);</li>
- </ul>
- <br />
-
- <li>Accessing the calibration storage objects:</li>
- <ul style="list-style-type: square;">
- <li>AliTPCCalROC *GetCalRocT0(Int_t sector); // for the Time0 values</li>
- <li>AliTPCCalROC *GetCalRocRMS(Int_t sector); // for the signal width values</li>
- <li>AliTPCCalROC *GetCalRocQ(Int_t sector); // for the Q sum values</li>
- </ul>
- <br />
-
- <li>Accessin the event by event information:</li>
- <ul style="list-style-type: square;">
- <li>The event by event information can be displayed using the</li>
- <li>MakeGraphTimeCE(Int_t sector, Int_t xVariable, Int_t fitType, Int_t fitParameter)</li>
- <li>which creates a graph from the specified variables</li>
- </ul>
- </ul>
-
- <h4>example for visualisation:</h4>
- <pre>
- //if the file "CEData.root" was created using the above example one could do the following:
- TFile fileCE("CEData.root")
- AliTPCCalibCE *ce = (AliTPCCalibCE*)fileCE->Get("AliTPCCalibCE");
- ce->GetCalRocT0(0)->Draw("colz");
- ce->GetCalRocRMS(0)->Draw("colz");
-
- //or use the AliTPCCalPad functionality:
- AliTPCCalPad padT0(ped->GetCalPadT0());
- AliTPCCalPad padSigWidth(ped->GetCalPadRMS());
- padT0->MakeHisto2D()->Draw("colz"); //Draw A-Side Time0 Information
- padSigWidth->MakeHisto2D()->Draw("colz"); //Draw A-Side signal width Information
-
- //display event by event information:
- //Draw mean arrival time as a function of the event time for oroc sector A00
- ce->MakeGraphTimeCE(36, 0, 2)->Draw("alp");
- //Draw first derivative in local x from a plane fit as a function of the event time for oroc sector A00
- ce->MakeGraphTimeCE(36, 0, 0, 1)->Draw("alp");
- </pre>
-END_HTML */
-//////////////////////////////////////////////////////////////////////////////////////
-
+/// \class AliTPCCalibCE
+/// \brief Implementation of the TPC Central Electrode calibration
+///
+/// \author Jens Wiechula, Marian Ivanov J.Wiechula@gsi.de, Marian.Ivanov@cern.ch
+///
+/// Class Description
+/// The AliTPCCalibCE class is used to get calibration data from the Central Electrode
+/// using laser runs.
+///
+/// The information retrieved is
+/// <ul style="list-style-type: square;">
+/// <li>Time arrival from the CE</li>
+/// <li>Signal width</li>
+/// <li>Signal sum</li>
+/// </ul>
+///
+/// <h4>Overview:</h4>
+/// <ol style="list-style-type: upper-roman;">
+/// <li><a href="#working">Working principle</a></li>
+/// <li><a href="#user">User interface for filling data</a></li>
+/// <li><a href="#info">Stored information</a></li>
+/// </ol>
+///
+/// <h3><a name="working">I. Working principle</a></h3>
+///
+/// <h4>Raw laser data is processed by calling one of the ProcessEvent(...) functions
+/// (see below). These in the end call the Update(...) function.</h4>
+///
+/// <ul style="list-style-type: square;">
+/// <li>the Update(...) function:<br />
+/// In this function the array fPadSignal is filled with the adc signals between the specified range
+/// fFirstTimeBin and fLastTimeBin for the current pad.
+/// before going to the next pad the ProcessPad() function is called, which analyses the data for one pad
+/// stored in fPadSignal.
+/// </li>
+/// <ul style="list-style-type: square;">
+/// <li>the ProcessPad() function:</li>
+/// <ol style="list-style-type: decimal;">
+/// <li>Find Pedestal and Noise information</li>
+/// <ul style="list-style-type: square;">
+/// <li>use database information which has to be set by calling<br />
+/// SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC)</li>
+/// <li>if no information from the pedestal data base
+/// is available the informaion is calculated on the fly
+/// ( see FindPedestal() function )</li>
+/// </ul>
+/// <li>Find local maxima of the pad signal</li>
+/// <ul style="list-style-type: square;">
+/// <li>maxima arise from the laser tracks, the CE and also periodic postpeaks after the CE signal have
+/// have been observed ( see FindLocalMaxima(...) )</li>
+/// </ul>
+/// <li>Find the CE signal information</li>
+/// <ul style="list-style-type: square;">
+/// <li>to find the position of the CE signal the Tmean information from the previos event is used
+/// as the CE signal the local maximum closest to this Tmean is identified</li>
+/// <li>calculate mean = T0, RMS = signal width and Q sum in a range of -4+7 timebins around Q max position
+/// the Q sum is scaled by pad area (see FindPulserSignal(...) function)</li>
+/// </ul>
+/// <li>Fill a temprary array for the T0 information (GetPadTimesEvent(fCurrentSector,kTRUE)) (why see below)</li>
+/// <li>Fill the Q sum and RMS values in the histograms (GetHisto[RMS,Q](ROC,kTRUE))</li>
+/// </ol>
+/// </ul>
+/// </ul>
+///
+/// <h4>At the end of each event the EndEvent() function is called</h4>
+///
+/// <ul style="list-style-type: square;">
+/// <li>the EndEvent() function:</li>
+/// <ul style="list-style-type: square;">
+/// <li>calculate the mean T0 for side A and side C. Fill T0 histogram with Time0-<Time0 for side[A,C]>
+/// This is done to overcome syncronisation problems between the trigger and the fec clock.</li>
+/// <li>calculate Mean T for each ROC using the COG aroud the median of the LocalMaxima distribution in one sector</li>
+/// <li>calculate Mean Q</li>
+/// <li>calculate Global fit parameters for Pol1 and Pol2 fits</li>
+/// </ul>
+/// </ul>
+///
+/// <h4>After accumulating the desired statistics the Analyse() function has to be called.</h4>
+/// <ul style="list-style-type: square;">
+/// <li>the Analyse() function:</li>
+/// <ul style="list-style-type: square;">
+/// <li>calculate the mean values of T0, RMS, Q for each pad, using
+/// the AliMathBase::GetCOG(...) function</li>
+/// <li>fill the calibration storage classes (AliTPCCalROC) for each ROC</li>
+/// (The calibration information is stored in the TObjArrays fCalRocArrayT0, fCalRocArrayRMS and fCalRocArrayQ</li>
+/// </ul>
+/// </ul>
+///
+/// <h3><a name="user">II. User interface for filling data</a></h3>
+///
+/// <h4>To Fill information one of the following functions can be used:</h4>
+///
+/// <ul style="list-style-type: none;">
+/// <li> Bool_t ProcessEvent(eventHeaderStruct *event);</li>
+/// <ul style="list-style-type: square;">
+/// <li>process Date event</li>
+/// <li>use AliTPCRawReaderDate and call ProcessEvent(AliRawReader *rawReader)</li>
+/// </ul>
+/// <br />
+///
+/// <li> Bool_t ProcessEvent(AliRawReader *rawReader);</li>
+/// <ul style="list-style-type: square;">
+/// <li>process AliRawReader event</li>
+/// <li>use AliTPCRawStream to loop over data and call ProcessEvent(AliTPCRawStream *rawStream)</li>
+/// </ul>
+/// <br />
+///
+/// <li> Bool_t ProcessEvent(AliTPCRawStream *rawStream);</li>
+/// <ul style="list-style-type: square;">
+/// <li>process event from AliTPCRawStream</li>
+/// <li>call Update function for signal filling</li>
+/// </ul>
+/// <br />
+///
+/// <li> Int_t Update(const Int_t isector, const Int_t iRow, const Int_t
+/// iPad, const Int_t iTimeBin, const Float_t signal);</li>
+/// <ul style="list-style-type: square;">
+/// <li>directly fill signal information (sector, row, pad, time bin, pad)
+/// to the reference histograms</li>
+/// </ul>
+/// </ul>
+///
+/// <h4>It is also possible to merge two independently taken calibrations using the function</h4>
+///
+/// <ul style="list-style-type: none;">
+/// <li> void Merge(AliTPCCalibSignal *sig)</li>
+/// <ul style="list-style-type: square;">
+/// <li>copy histograms in 'sig' if they do not exist in this instance</li>
+/// <li>Add histograms in 'sig' to the histograms in this instance if the allready exist</li>
+/// <li>After merging call Analyse again!</li>
+/// </ul>
+/// </ul>
+///
+///
+/// <h4>example: filling data using root raw data:</h4>
+/// <pre>
+/// void fillCE(Char_t *filename)
+/// {
+/// rawReader = new AliRawReaderRoot(fileName);
+/// if ( !rawReader ) return;
+/// AliTPCCalibCE *calib = new AliTPCCalibCE;
+/// while (rawReader->NextEvent()){
+/// calib->ProcessEvent(rawReader);
+/// }
+/// calib->Analyse();
+/// calib->DumpToFile("CEData.root");
+/// delete rawReader;
+/// delete calib;
+/// }
+/// </pre>
+///
+/// <h3><a name="info">III. What kind of information is stored and how to retrieve it</a></h4>
+///
+/// <h4><a name="info:stored">III.1 Stored information</a></h4>
+/// <ul style="list-style-type: none;">
+/// <li>Histograms:</li>
+/// <ul style="list-style-type: none;">
+/// <li>For each ROC three TH2S histos 'Reference Histograms' (ROC channel vs. [Time0, signal width, Q sum])
+/// is created when it is filled for the first time (GetHisto[T0,RMS,Q](ROC,kTRUE)). The histos are
+/// stored in the TObjArrays fHistoT0Array, fHistoRMSArray and fHistoQArray.</li>
+/// </ul>
+/// <br />
+///
+/// <li>Calibration Data:</li>
+/// <ul style="list-style-type: none;">
+/// <li>For each ROC three types of calibration data (AliTPCCalROC) is stored: for the mean arrival Time,
+/// the signal width and the signal Sum. The AliTPCCalROC objects are stored in the TObjArrays
+/// fCalRocArrayT0, fCalRocArrayRMS , fCalRocArrayQ. The object for each roc is created the first time it
+/// is accessed (GetCalRoc[T0,RMS,Q](ROC,kTRUE));</li>
+/// </ul>
+/// <br />
+///
+/// <li>For each event the following information is stored:</li>
+///
+/// <ul style="list-style-type: square;">
+/// <li>event time ( TVectorD fVEventTime )</li>
+/// <li>event id ( TVectorD fVEventNumber )</li>
+/// <br />
+/// <li>mean arrival time for each ROC ( TObjArray fTMeanArrayEvent )</li>
+/// <li>mean Q for each ROC ( TObjArray fQMeanArrayEvent )</li>
+/// <li>parameters of a plane fit for each ROC ( TObjArray fParamArrayEventPol1 )</li>
+/// <li>parameters of a 2D parabola fit for each ROC ( TObjArray fParamArrayEventPol2 )</li>
+/// </ul>
+/// </ul>
+///
+/// <h4><a name="info:retrieve">III.2 Retrieving information</a></h4>
+/// <ul style="list-style-type: none;">
+/// <li>Accessing the 'Reference Histograms' (Time0, signal width and Q sum information pad by pad):</li>
+/// <ul style="list-style-type: square;">
+/// <li>TH2F *GetHistoT0(Int_t sector);</li>
+/// <li>TH2F *GetHistoRMS(Int_t sector);</li>
+/// <li>TH2F *GetHistoQ(Int_t sector);</li>
+/// </ul>
+/// <br />
+///
+/// <li>Accessing the calibration storage objects:</li>
+/// <ul style="list-style-type: square;">
+/// <li>AliTPCCalROC *GetCalRocT0(Int_t sector); // for the Time0 values</li>
+/// <li>AliTPCCalROC *GetCalRocRMS(Int_t sector); // for the signal width values</li>
+/// <li>AliTPCCalROC *GetCalRocQ(Int_t sector); // for the Q sum values</li>
+/// </ul>
+/// <br />
+///
+/// <li>Accessin the event by event information:</li>
+/// <ul style="list-style-type: square;">
+/// <li>The event by event information can be displayed using the</li>
+/// <li>MakeGraphTimeCE(Int_t sector, Int_t xVariable, Int_t fitType, Int_t fitParameter)</li>
+/// <li>which creates a graph from the specified variables</li>
+/// </ul>
+/// </ul>
+///
+/// <h4>example for visualisation:</h4>
+/// <pre>
+/// //if the file "CEData.root" was created using the above example one could do the following:
+/// TFile fileCE("CEData.root")
+/// AliTPCCalibCE *ce = (AliTPCCalibCE*)fileCE->Get("AliTPCCalibCE");
+/// ce->GetCalRocT0(0)->Draw("colz");
+/// ce->GetCalRocRMS(0)->Draw("colz");
+///
+/// //or use the AliTPCCalPad functionality:
+/// AliTPCCalPad padT0(ped->GetCalPadT0());
+/// AliTPCCalPad padSigWidth(ped->GetCalPadRMS());
+/// padT0->MakeHisto2D()->Draw("colz"); //Draw A-Side Time0 Information
+/// padSigWidth->MakeHisto2D()->Draw("colz"); //Draw A-Side signal width Information
+///
+/// //display event by event information:
+/// //Draw mean arrival time as a function of the event time for oroc sector A00
+/// ce->MakeGraphTimeCE(36, 0, 2)->Draw("alp");
+/// //Draw first derivative in local x from a plane fit as a function of the event time for oroc sector A00
+/// ce->MakeGraphTimeCE(36, 0, 0, 1)->Draw("alp");
+/// </pre>