StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcHit.cc
1 /***************************************************************************
2  *
3  * $Id: StMcHit.cc,v 2.14 2015/07/22 19:30:00 jwebb Exp $
4  * $Log: StMcHit.cc,v $
5  * Revision 2.14 2015/07/22 19:30:00 jwebb
6  * Fix minor compiler warnings.
7  *
8  * Revision 2.13 2014/08/06 19:07:34 perev
9  * Warnoff
10  *
11  * Revision 2.12 2011/10/17 00:24:00 fisyak
12  * Add time of flight for hits
13  *
14  * Revision 2.10 2005/11/22 21:44:51 fisyak
15  * Add compress Print for McEvent, add Ssd collections
16  *
17  * Revision 2.9 2005/09/29 01:01:10 calderon
18  * Fixed bugs in printing event and hit information.
19  * Format operator<< for various classes.
20  *
21  * Revision 2.8 2005/09/28 21:30:14 fisyak
22  * Persistent StMcEvent
23  *
24  * Revision 2.7 2005/01/27 23:40:47 calderon
25  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
26  *
27  * Revision 2.6 2000/06/06 02:58:41 calderon
28  * Introduction of Calorimeter classes. Modified several classes
29  * accordingly.
30  *
31  * Revision 2.5 2000/05/05 15:25:43 calderon
32  * Reduced dependencies and made constructors more efficient
33  *
34  * Revision 2.4 2000/04/18 00:55:14 calderon
35  * added printout of local momentum to operator<<
36  *
37  * Revision 2.3 2000/04/17 23:01:15 calderon
38  * Added local momentum to hits as per Lee's request
39  *
40  * Revision 2.2 1999/12/14 07:04:49 calderon
41  * Numbering scheme as per SVT request.
42  *
43  * Revision 2.1 1999/11/19 19:06:32 calderon
44  * Recommit after redoing the files.
45  *
46  * Revision 2.0 1999/11/17 02:12:16 calderon
47  * Completely revised for new StEvent
48  *
49  * Revision 1.3 1999/09/23 21:25:51 calderon
50  * Added Log & Id
51  * Modified includes according to Yuri
52  *
53  *
54  **************************************************************************/
55 #include "StMcHit.hh"
56 #include "TString.h"
57 static const Char_t rcsid[] = "$Id: StMcHit.cc,v 2.14 2015/07/22 19:30:00 jwebb Exp $";
58 ClassImp(StMcHit);
59 
60 int StMcHit::operator==(const StMcHit& h) const
61 {
62  return h.mKey == mKey && h.mPosition == mPosition &&
63  h.mdE == mdE && h.mdS == mdS ;
64 }
65 
66 ostream& operator<<(ostream& os, const StMcHit& h)
67 {
68  if (h.parentTrack())
69  os << "Key, parent Key : " << Form("%5i/%5i",(int)h.key(),(int)h.parentTrack()->key()) << endl;
70  else
71  os << "Key : " << Form("%5i/undef",int(h.key())) << endl;
72 
73  os << "Position xyz : " << Form("%8.2f%8.2f%8.2f",h.position().x(), h.position().y(), h.position().z()) << endl;
74  os << "Local Momentum : " << Form("%8.2f%8.2f%8.2f",h.localMomentum().x() ,h.localMomentum().y() ,h.localMomentum().z()) << endl;
75  os << "dE : " << Form("%8.2f keV",1e6*h.dE()) << endl;
76  os << "dS : " << Form("%8.2f cm",h.dS()) << endl;
77  os << "tof : " << Form("%8.2f ns",h.tof()*1e9) << endl;
78  os << "VolId : " << h.volumeId() << endl;
79  return os;
80 }
81 //________________________________________________________________________________
82 void StMcHit::Print(Option_t *option) const {
83  cout << *this << endl;
84 }