StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjFourVecList.h
1 // -*- mode: c++;-*-
2 // $Id: StjFourVecList.h,v 1.1 2008/11/27 07:29:52 tai Exp $
3 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
4 #ifndef STJFOURVECLIST_H
5 #define STJFOURVECLIST_H
6 
7 #include <TObject.h>
8 
9 #include <ostream>
10 #include <vector>
11 
12 class StjFourVec : public TObject {
13 public:
14  int runNumber;
15  int eventId;
16  int fourvecId;
17  int type; // 0: mc, 1: track, 2: tower energy
18  int detectorId; // 1: TPC, 9: BEMC, 13: EEMC
19  short trackId;
20  int towerId;
21  int mcparticleId;
22  double pt;
23  double eta;
24  double phi;
25  double m;
26  double vertexZ;
27  ClassDef(StjFourVec, 1)
28 };
29 
30 typedef std::vector<StjFourVec> StjFourVecList;
31 
32 inline bool operator==(const StjFourVec& v1, const StjFourVec& v2)
33 {
34  if(v1.runNumber != v2.runNumber) return false;
35  if(v1.eventId != v2.eventId) return false;
36  if(v1.fourvecId != v2.fourvecId) return false;
37  if(v1.type != v2.type) return false;
38  if(v1.detectorId != v2.detectorId) return false;
39  if(v1.trackId != v2.trackId) return false;
40  if(v1.towerId != v2.towerId) return false;
41  if(v1.mcparticleId != v2.mcparticleId) return false;
42  if(v1.pt != v2.pt) return false;
43  if(v1.eta != v2.eta) return false;
44  if(v1.phi != v2.phi) return false;
45  if(v1.m != v2.m) return false;
46  return true;
47  }
48 
49 inline bool operator!=(const StjFourVec& v1, const StjFourVec& v2)
50 {
51  return(!(v1 == v2));
52 }
53 
54 inline bool operator==(const StjFourVecList& v1, const StjFourVecList& v2){
55  if(v1.size() != v2.size()) return false;
56  for(size_t i = 0; i < v1.size(); ++i) if(v1[i] != v2[i]) return false;
57  return true;
58 }
59 
60 inline std::ostream& operator<<(std::ostream& out, const StjFourVec& v)
61 {
62  out << "fourvecId: " << v.fourvecId << ", pt: " << v.pt << ", .... ";
63  return out;
64 }
65 
66 inline std::ostream& operator<<(std::ostream& out, const StjFourVecList& v)
67 {
68  out << "FourVecList size: " << v.size();
69  return out;
70 }
71 
72 #endif // STJFOURVECLIST_H