SND@LHC Software
Loading...
Searching...
No Matches
ecalCluster.cxx
Go to the documentation of this file.
1#include "ecalCluster.h"
2
3#include "ecalCell.h"
4#include "ecalMaximum.h"
5
6#include "TMath.h"
7
8#include <algorithm>
9#include <iostream>
10
11using namespace std;
12
15 : TObject(),
16 fNum(0),
17 fSize(0),
18 fMaxs(0),
19 fEnergy(0.),
20 fPreCalibrated(-1111.),
21 fMoment(0.),
22 fMomentX(0.),
23 fMomentY(0.),
24 fX(0.),
25 fY(0.),
26 fChi2(0.),
27 fStatus(0),
28 fCellNums(),
29 fPeakNums(),
30 fPreEnergy(),
31 fMaximums(NULL)
32{
33}
34
36ecalCluster::ecalCluster(Int_t num, const std::list<ecalCell*>& cluster, const std::list<ecalMaximum*>& maximums)
37 : TObject(),
38 fNum(num),
39 fSize(0),
40 fMaxs(0),
41 fEnergy(0.),
42 fPreCalibrated(-1111.),
43 fMoment(0.),
44 fMomentX(0.),
45 fMomentY(0.),
46 fX(0.),
47 fY(0.),
48 fChi2(0.),
49 fStatus(0),
50 fCellNums(),
51 fPeakNums(),
52 fPreEnergy(),
53 fMaximums(NULL)
54{
55 std::list<ecalCell*> cls;
56 list<ecalCell*>::const_iterator p=cluster.begin();
57 list<ecalMaximum*>::const_iterator pm;
58 Double_t e;
59 Double_t x;
60 Double_t y;
61 Double_t r;
62 Int_t i;
63
64 fMaxs=maximums.size();
65 fEnergy=0;
66 fX=0;
67 fY=0;
68 for(;p!=cluster.end();++p)
69 {
70 cls.push_back(*p);
71 e=(*p)->GetEnergy();
72 x=(*p)->GetCenterX();
73 y=(*p)->GetCenterY();
74 fX+=x*e; fY+=y*e;
75 fEnergy+=e;
76 }
77 fSize=cls.size();
78
79 cls.sort(ecalClusterSortProcess());
80 cls.reverse();
81 fX/=fEnergy;
82 fY/=fEnergy;
83 fChi2=-1111.0;
84
85 fCellNums.Set(fSize);
86 fPeakNums.Set(fMaxs);
87 fPreEnergy.Set(fMaxs);
88
90 for(p=cls.begin();p!=cls.end();++p)
91 {
93 e=(*p)->GetEnergy();
94 x=fX-(*p)->GetCenterX(); x*=x;
95 y=fY-(*p)->GetCenterY(); y*=y;
96 fMomentX+=x*e; fMomentY+=y*e; fMoment+=(x+y)*e;
97 }
99
100 i=0;
101 for(p=cls.begin();p!=cls.end();++p)
102 fCellNums[i++]=(*p)->GetCellNumber();
103 i=0;
105 for(pm=maximums.begin();pm!=maximums.end();++pm)
106 {
107 fMaximums[i]=(*pm);
108 fPeakNums[i++]=(*pm)->Cell()->GetCellNumber();
109 }
110}
113{
114 delete [] fMaximums;
115}
116
Int_t GetCellNumber() const
Definition ecalCell.h:40
virtual ~ecalCluster()
TArrayD fPreEnergy
Definition ecalCluster.h:95
Double_t fEnergy
Definition ecalCluster.h:73
Double_t fMomentY
Definition ecalCluster.h:81
Double_t fY
Definition ecalCluster.h:84
TArrayI fPeakNums
Definition ecalCluster.h:93
Double_t fMoment
Definition ecalCluster.h:77
Double_t fMomentX
Definition ecalCluster.h:79
TArrayI fCellNums
Definition ecalCluster.h:91
Double_t fChi2
Definition ecalCluster.h:86
ecalMaximum ** fMaximums
Definition ecalCluster.h:97
Double_t fX
Definition ecalCluster.h:83
ecalCell * Cell() const
Definition ecalMaximum.h:21
ClassImp(ecalContFact) ecalContFact