StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcCalorimeterHit.cc
1 // $Id: StMcCalorimeterHit.cc,v 2.5 2005/09/28 21:30:14 fisyak Exp $
2 //
3 // $Log: StMcCalorimeterHit.cc,v $
4 // Revision 2.5 2005/09/28 21:30:14 fisyak
5 // Persistent StMcEvent
6 //
7 // Revision 2.4 2005/01/27 23:40:46 calderon
8 // Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
9 //
10 // Revision 2.3 2003/08/20 18:50:20 calderon
11 // Addition of Tof classes and Pixel classes. Modified track, event, and
12 // container code to reflect this.
13 // Fix bug in StMcVertex and in clearing of some hit collections.
14 //
15 // Revision 2.2 2000/06/06 02:58:40 calderon
16 // Introduction of Calorimeter classes. Modified several classes
17 // accordingly.
18 //
19 // Revision 2.1 2000/05/05 14:54:13 calderon
20 // Initial revision
21 //
22 //
23 
24 #include "StMcCalorimeterHit.hh"
25 #include "StMcTrack.hh"
26 #include "StParticleDefinition.hh"
27 
28 // static const char rcsid[] = "$Id: StMcCalorimeterHit.cc,v 2.5 2005/09/28 21:30:14 fisyak Exp $";
29 
30 //StMemoryPool StMcCalorimeterHit::mPool(sizeof(StMcCalorimeterHit));
31 ClassImp(StMcCalorimeterHit);
32 StMcCalorimeterHit::StMcCalorimeterHit():mModule(0),mEta(0),mSub(0),mdE(0),mParentTrack(0)
33 { /* noop */ }
34 
35 StMcCalorimeterHit::StMcCalorimeterHit(int m,int e,int s,float de)
36  :mModule(m),mEta(e),mSub(s),mdE(de),mParentTrack(0)
37 { /* noop */ }
38 
39 StMcCalorimeterHit::StMcCalorimeterHit(int m,int e,int s,float de,StMcTrack* parent)
40  :mModule(m),mEta(e),mSub(s),mdE(de),mParentTrack(parent)
41 { /* noop */ }
42 
43 StMcCalorimeterHit::~StMcCalorimeterHit() { /* noop */ }
44 
45 int StMcCalorimeterHit::operator==(const StMcCalorimeterHit& h) const
46 {
47  // Hits are from the same particle and the same tower(cell)
48  return h.mModule == mModule && h.mEta == mEta &&
49  h.mSub == mSub && h.mParentTrack == mParentTrack;
50 }
51 
52 int StMcCalorimeterHit::operator!=(const StMcCalorimeterHit& h) const
53 {
54  return !(*this == h); // use operator==()
55 }
56 
57 void StMcCalorimeterHit::operator+=(const StMcCalorimeterHit& h)
58 {
59  if(*this == h) mdE += h.dE(); // use operator==()
60 }
61 
62 bool StMcCalorimeterHit::sameCell(const StMcCalorimeterHit& h) const
63 {
64  // Hits are from the same cell(tower)
65  // For transition from MC hits to raw hits
66  return h.mModule == mModule && h.mEta == mEta && h.mSub == mSub;
67 }
68 
69 void StMcCalorimeterHit::setModule(int val) { mModule = val; }
70 
71 void StMcCalorimeterHit::setEta(int val) { mEta = val; }
72 
73 void StMcCalorimeterHit::setSub(int val) { mSub = val; }
74 
75 void StMcCalorimeterHit::setdE(float val) { mdE = val; }
76 
77 void StMcCalorimeterHit::setParentTrack(StMcTrack* val) { mParentTrack = val; }
78 
79 ostream& operator<<(ostream& os, const StMcCalorimeterHit & h)
80 {
81  os << "CalHit\t"
82  << " m: " << h.module()
83  << " e: " << h.eta()
84  << " s: " << h.sub()
85  << " dE: " << h.dE();
86  if(h.parentTrack()) {
87  StMcTrack* t=h.parentTrack();
88  if(t->particleDefinition()){
89  os << " | g2t key : " << t->key()
90  << " Name: "<<(t->particleDefinition()->name()).c_str();
91  }
92  }
93  else os <<" Parent track undefined ";
94  return os;
95 }
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144