]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTick.cxx
add protection against truncated events + coverity - Rachid
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTick.cxx
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 
20 // help calculate the 
21 // time of crossing 
22 // of the threshold by 
23 // the front edge of the 
24 // time signal
25 //
26 //*-- Author :  Dmitri Peressounko (SUBATECH) 
27 //////////////////////////////////////////////////////////////////////////////
28
29 // --- ROOT system ---
30
31 // --- Standard library ---
32
33 // --- AliRoot header files ---
34 #include "AliEMCALTick.h"
35
36 ClassImp(AliEMCALTick)
37
38
39 //____________________________________________________________________________ 
40 AliEMCALTick::AliEMCALTick()
41   : TObject(),
42     fTime(0),
43     fA(0),
44     fB(0)
45 {
46   //ctor
47 }
48
49 //____________________________________________________________________________ 
50 AliEMCALTick::AliEMCALTick(Float_t time, Float_t a, Float_t slope)
51   : TObject(),
52     fTime(time),
53     fA(a),
54     fB(slope)
55 {
56   //ctor
57 }
58
59
60
61 //____________________________________________________________________________ 
62 Int_t AliEMCALTick::Compare(const TObject * obj) const 
63 {
64   // compares time values
65   if(obj->InheritsFrom("AliEMCALTick")){
66     AliEMCALTick * tick = (AliEMCALTick *) obj ;
67     if(fTime < tick->fTime)
68       return -1 ;
69     else
70       if(fTime == tick->fTime)
71         return 0 ;
72       else
73         return 1 ;
74   }
75   else
76     return 1 ;
77
78 //____________________________________________________________________________
79 void AliEMCALTick::operator+=(AliEMCALTick const & tick) 
80 {
81   // Adds the amplitude of digits and completes the list of primary particles
82   // if amplitude is larger than 
83     
84   fA = fA + fB*(tick.fTime - fTime) + tick.fA ;
85   fB = fB + tick.fB ;
86   if(tick.fTime > fTime) 
87     fTime = tick.fTime ;
88   
89 }