Made more robust
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTick.cxx
CommitLineData
51ecce10 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//_________________________________________________________________________
19// Auxiliary class to help calculate the time of crossing
20// of the threshold by the front edge of the time signal
21//
22//*-- Author : Dmitri Peressounko (SUBATECH)
23//////////////////////////////////////////////////////////////////////////////
24
25// --- ROOT system ---
26
27// --- Standard library ---
28
29// --- AliRoot header files ---
30#include "AliEMCALTick.h"
31
32ClassImp(AliEMCALTick)
33
34
35//____________________________________________________________________________
36 AliEMCALTick::AliEMCALTick():TObject()
37{
d64c959b 38 //ctor
51ecce10 39 fTime = 0;
40 fA = 0;
41 fB = 0 ;
42}
43
44//____________________________________________________________________________
45AliEMCALTick::AliEMCALTick(Float_t time, Float_t a, Float_t slope):TObject()
46{
d64c959b 47 //ctor
51ecce10 48 fTime = time;
49 fA = a;
50 fB = slope ;
51}
52//____________________________________________________________________________
d64c959b 53Int_t AliEMCALTick::Compare(const TObject * obj) const
54{
55 // compares time values
51ecce10 56 if(obj->InheritsFrom("AliEMCALTick")){
57 AliEMCALTick * tick = (AliEMCALTick *) obj ;
58 if(fTime < tick->fTime)
59 return -1 ;
60 else
61 if(fTime == tick->fTime)
62 return 0 ;
63 else
64 return 1 ;
65 }
66 else
67 return 1 ;
68}
69//____________________________________________________________________________
70void AliEMCALTick::operator+=(AliEMCALTick const & tick)
71{
72 // Adds the amplitude of digits and completes the list of primary particles
73 // if amplitude is larger than
74
75 fA = fA + fB*(tick.fTime - fTime) + tick.fA ;
76 fB = fB + tick.fB ;
77 if(tick.fTime > fTime)
78 fTime = tick.fTime ;
79
80}