SND@LHC Software
Loading...
Searching...
No Matches
ecalCell.h
Go to the documentation of this file.
1
7#ifndef ECALCELL_H
8#define ECALCELL_H
9
10#include "TObject.h"
11
12#include <list>
13#include <map>
14#include <algorithm>
15
16class ecalCell : public TObject
17{
18public:
19 ecalCell(Int_t cellnumber, Float_t x1=0, Float_t y1=0, Float_t x2=0, Float_t y2=0, Char_t type=0, Float_t energy=0)
20 : TObject(), fNumber(cellnumber), fX1(x1), fY1(y1), fX2(x2),
21 fY2(y2), fType(type), fEnergy(energy), fADC(-1111), fNeighbors(), f5x5Cluster(),fTime(-1111)
22 {};
23
24 inline Bool_t IsInside(Float_t x, Float_t y) {return x>GetX1()&&x<GetX2()&&y>GetY1()&&y<GetY2();}
25 //getters
26 inline Char_t GetType() const {return fType;}
27 inline Float_t X1() const {return fX1;}
28 inline Float_t Y1() const {return fY1;}
29 inline Float_t X2() const {return fX2;}
30 inline Float_t Y2() const {return fY2;}
31 inline Float_t GetX1() const {return fX1;}
32 inline Float_t GetY1() const {return fY1;}
33 inline Float_t GetX2() const {return fX2;}
34 inline Float_t GetY2() const {return fY2;}
35 inline Float_t GetCenterX() const {return (fX1+fX2)/2.0;}
36 inline Float_t GetCenterY() const {return (fY1+fY2)/2.0;}
37 inline Short_t ADC() const {return fADC;}
38 inline Short_t GetADC() const {return fADC;}
39
40 inline Int_t GetCellNumber() const {return fNumber;}
41
42 inline Float_t GetEnergy() const {return fEnergy;}
43 Float_t GetTime() const {return fTime;}
44 void SetTime(Float_t time) {fTime=time;}
45
46 // Neighbours stuff
47 // Get list of 8 neighbors
48 inline void GetNeighborsList(std::list<ecalCell*> &neib) const
49 {
50 neib=fNeighbors;
51 }
52 inline void SetNeighborsList(std::list<ecalCell*> &neib)
53 {
54 fNeighbors=neib;
55 }
56
57 // 5x5 cluster stuff
58 inline void Get5x5Cluster(std::list<ecalCell*>& cls)
59 {
60 if (f5x5Cluster.size()==0) Create5x5Cluster();
61 cls=f5x5Cluster;
62 }
63
64 inline void SetEnergy(Float_t energy) {fEnergy=energy;}
65 inline void SetADC(Short_t adc) {fADC=adc;}
67 void ResetEnergyFast();
68 inline void AddEnergy(Float_t energy) {fEnergy+=energy;}
69
70 // code=0 for "3x3" cluster
71 void GetClusterEnergy(Float_t& EcalEnergy);
72
73 inline void SetCoord(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
74 { fX1=x1; fY1=y1; fX2=x2; fY2=y2; }
75 inline void SetType(Char_t type) {fType=type;}
77 Int_t CountNeighbors(const std::list<ecalCell*>& lst) const;
78private:
80 Int_t fNumber;
82 Float_t fX1;
84 Float_t fY1;
86 Float_t fX2;
88 Float_t fY2;
90 Char_t fType;
92 Float_t fEnergy;
94 Short_t fADC;
95
96
98 std::list<ecalCell*> fNeighbors;
100 std::list<ecalCell*> f5x5Cluster;
101 void Create5x5Cluster();
102
104 Double_t fTime;
105
107};
108
110{
111 fEnergy=0;
112 fADC=-1111;
113 fTime=-1111;
114}
115
116#endif
Float_t fY1
Definition ecalCell.h:84
void SetNeighborsList(std::list< ecalCell * > &neib)
Definition ecalCell.h:52
Char_t GetType() const
Definition ecalCell.h:26
Int_t GetCellNumber() const
Definition ecalCell.h:40
void Create5x5Cluster()
Definition ecalCell.cxx:43
Short_t GetADC() const
Definition ecalCell.h:38
void GetNeighborsList(std::list< ecalCell * > &neib) const
Definition ecalCell.h:48
void SetEnergy(Float_t energy)
Definition ecalCell.h:64
Float_t GetCenterX() const
Definition ecalCell.h:35
Float_t fEnergy
Definition ecalCell.h:92
ecalCell(Int_t cellnumber, Float_t x1=0, Float_t y1=0, Float_t x2=0, Float_t y2=0, Char_t type=0, Float_t energy=0)
Definition ecalCell.h:19
Float_t fX1
Definition ecalCell.h:82
Float_t X2() const
Definition ecalCell.h:29
Float_t fX2
Definition ecalCell.h:86
void GetClusterEnergy(Float_t &EcalEnergy)
Definition ecalCell.cxx:30
Int_t CountNeighbors(const std::list< ecalCell * > &lst) const
Definition ecalCell.cxx:18
Short_t fADC
Definition ecalCell.h:94
Float_t GetX2() const
Definition ecalCell.h:33
Double_t fTime
Definition ecalCell.h:104
Short_t ADC() const
Definition ecalCell.h:37
void AddEnergy(Float_t energy)
Definition ecalCell.h:68
void SetType(Char_t type)
Definition ecalCell.h:75
void SetADC(Short_t adc)
Definition ecalCell.h:65
void ResetEnergyFast()
Definition ecalCell.h:109
std::list< ecalCell * > fNeighbors
Definition ecalCell.h:98
Float_t GetY1() const
Definition ecalCell.h:32
Float_t GetY2() const
Definition ecalCell.h:34
Float_t GetTime() const
Definition ecalCell.h:43
Bool_t IsInside(Float_t x, Float_t y)
Definition ecalCell.h:24
Float_t GetCenterY() const
Definition ecalCell.h:36
void Get5x5Cluster(std::list< ecalCell * > &cls)
Definition ecalCell.h:58
Float_t GetEnergy() const
Definition ecalCell.h:42
Float_t Y2() const
Definition ecalCell.h:30
Float_t fY2
Definition ecalCell.h:88
void SetTime(Float_t time)
Definition ecalCell.h:44
Float_t GetX1() const
Definition ecalCell.h:31
Float_t Y1() const
Definition ecalCell.h:28
Float_t X1() const
Definition ecalCell.h:27
Char_t fType
Definition ecalCell.h:90
std::list< ecalCell * > f5x5Cluster
Definition ecalCell.h:100
ClassDef(ecalCell, 1)
void SetCoord(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
Definition ecalCell.h:73
Int_t fNumber
Definition ecalCell.h:80