StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTowerEnergyList.h
1 // -*- mode: c++;-*-
2 // $Id: StjTowerEnergyList.h,v 1.1 2008/11/27 07:35:31 tai Exp $
3 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
4 #ifndef STJTOWERENERGYLIST_H
5 #define STJTOWERENERGYLIST_H
6 
7 #include <TObject.h>
8 
9 #include <vector>
10 #include <ostream>
11 #include <cmath>
12 
13 class StjTowerEnergy : public TObject {
14 public:
15  int runNumber;
16  int eventId;
17  int detectorId; // 9: BEMC, 13: EEMC
18  int towerId;
19  double towerR;
20  double towerEta;
21  double towerPhi;
22  double vertexX;
23  double vertexY;
24  double vertexZ;
25  double energy;
26  unsigned int adc;
27  float pedestal;
28  float rms;
29  int status; // 1 is good for BEMC. 0 is good for EEMC
30  ClassDef(StjTowerEnergy, 1)
31 };
32 
33 typedef std::vector<StjTowerEnergy> StjTowerEnergyList;
34 
35 inline bool operator==(const StjTowerEnergy& v1, const StjTowerEnergy& v2)
36 {
37  if(v1.runNumber != v2.runNumber) return false;
38  if(v1.eventId != v2.eventId) return false;
39  if(v1.detectorId != v2.detectorId) return false;
40  if(v1.towerId != v2.towerId) return false;
41  if(v1.towerR != v2.towerR) return false;
42  if(v1.towerEta != v2.towerEta) return false;
43  if(v1.towerPhi != v2.towerPhi) return false;
44  if(v1.vertexX != v2.vertexX) return false;
45  if(v1.vertexY != v2.vertexY) return false;
46  if(v1.vertexZ != v2.vertexZ) return false;
47  if(fabs(v1.energy - v2.energy) > 0.0001*fabs(v1.energy)) return false;
48  if(v1.adc != v2.adc) return false;
49  if(v1.pedestal != v2.pedestal) return false;
50  if(v1.rms != v2.rms) return false;
51  if(v1.status != v2.status) return false;
52  return true;
53  }
54 
55 inline bool operator!=(const StjTowerEnergy& v1, const StjTowerEnergy& v2)
56 {
57  return(!(v1 == v2));
58 }
59 
60 inline bool operator==(const StjTowerEnergyList& v1, const StjTowerEnergyList& v2){
61  if(v1.size() != v2.size()) return false;
62  for(size_t i = 0; i < v1.size(); ++i) if(v1[i] != v2[i]) return false;
63  return true;
64 }
65 
66 inline std::ostream& operator<<(std::ostream& out, const StjTowerEnergy& v)
67 {
68  out << "towerId: " << v.towerId << ", energy: " << v.energy << ", .... ";
69  return out;
70 }
71 
72 inline std::ostream& operator<<(std::ostream& out, const StjTowerEnergyList& v)
73 {
74  out << "TowerEnergyList size: " << v.size();
75  return out;
76 }
77 
78 #endif // STJTOWERENERGYLIST_H