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