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