source: trunk/CDFCones/Cluster.hh@ 10

Last change on this file since 10 was 2, checked in by Pavel Demin, 16 years ago

first commit

File size: 963 bytes
Line 
1#ifndef _CLUSTER_HH_
2#define _CLUSTER_HH_
3
4#include "PhysicsTower.hh"
5#include "LorentzVector.hh"
6#include "Centroid.hh"
7#include <vector>
8
9class Cluster
10{
11 public:
12 std::vector<PhysicsTower> towerList;
13 LorentzVector fourVector;
14 Centroid centroid;
15
16 Cluster()
17 {
18 clear();
19 }
20 void clear()
21 {
22 towerList.clear();
23 fourVector = LorentzVector();
24 centroid = Centroid();
25 }
26 void addTower(PhysicsTower p)
27 {
28 towerList.push_back(p);
29 fourVector.add(p.fourVector);
30 centroid.add(Centroid(p.Et(),p.eta(),p.phi()));
31 }
32 void removeTower(PhysicsTower p)
33 {
34 for(std::vector<PhysicsTower>::iterator towerIter = towerList.begin(); towerIter != towerList.end(); towerIter++)
35 if(towerIter->isEqual(p)){
36 fourVector.subtract(towerIter->fourVector);
37 centroid.subtract(Centroid(towerIter->Et(),towerIter->eta(),towerIter->phi()));
38 towerList.erase(towerIter);
39 break;
40 }
41 }
42 int size(){return towerList.size();}
43};
44
45#endif
Note: See TracBrowser for help on using the repository browser.