StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcCtbHit.cc
1 /***************************************************************************
2  *
3  * $Id: StMcCtbHit.cc,v 2.7 2011/10/17 00:24:00 fisyak Exp $
4  * $Log: StMcCtbHit.cc,v $
5  * Revision 2.7 2011/10/17 00:24:00 fisyak
6  * Add time of flight for hits
7  *
8  * Revision 2.6 2007/03/06 19:48:17 calderon
9  * Added filling of g2t_ctf_hit.ds into StMcCtbHit.
10  *
11  * Revision 2.5 2005/09/28 21:30:14 fisyak
12  * Persistent StMcEvent
13  *
14  * Revision 2.4 2005/01/27 23:40:46 calderon
15  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
16  *
17  * Revision 2.3 2003/12/02 21:22:03 calderon
18  * remove unnecessary #include "StMcTrack.hh"
19  *
20  * Revision 2.2 2003/04/11 19:58:29 calderon
21  * Fixed bug in calculating slat and tray. Start with an int, make sure
22  * i_eta and i_phi begin at zero (was missing before), and finally return the values as unsigned
23  * ints.
24  *
25  * Revision 2.1 2003/02/19 03:29:41 calderon
26  * Introduction of CTB classes to repository.
27  *
28  * Revision 1.0 2003/03/18 00:00:00 gans
29  * Introduction of Ctb classes. Modified several classes
30  * accordingly.
31  */
32 #include "StMcCtbHit.hh"
33 static const char rcsid[] = "$Id: StMcCtbHit.cc,v 2.7 2011/10/17 00:24:00 fisyak Exp $";
34 #ifdef POOL
35 StMemoryPool StMcCtbHit::mPool(sizeof(StMcCtbHit));
36 #endif
37 ClassImp(StMcCtbHit)
38 
39 ostream& operator<<(ostream& os, const StMcCtbHit& h)
40 {
41  os << "CtbHit\t" << *((StMcHit *) &h);
42  unsigned int tray;
43  unsigned int slat;
44  h.get_slat_tray(slat,tray);
45  os << "\tSlat: " << slat
46  << " Tray: " << tray
47  << " TofF: " << h.tof();
48  return os;
49 }
50 
51 void StMcCtbHit::get_slat_tray(unsigned int &slat_out, unsigned int &tray_out ) const {
52  long i1 ;
53  unsigned int volume = mVolumeId;
54  int i_phi = static_cast<int>(fmod(volume,100.)) ;
55  int i_eta = 999;
56  int slat = 999;
57  int tray = 999;
58 
59  i1 = int(volume/100) ;
60  if ( i1 < 20 ) {
61  i_phi = 14 - i_phi ;
62  if ( i_phi < 1 ) i_phi = i_phi + 60 ;
63  if ( i1 == 11 ) i_eta = 3 ;
64  else
65  if ( i1 == 12 ) i_eta = 4 ;
66  }
67  else if ( i1 > 20 ) {
68  i_phi = i_phi - 42 ;
69  if ( i_phi < 1 ) i_phi = i_phi + 60 ;
70  if ( i1 == 21 ) i_eta = 2 ;
71  else
72  if ( i1 == 22 ) i_eta = 1 ;
73  }
74 
75  i_phi--;
76  i_eta--;
77 
78  if(i_eta == 0){
79  slat = 1;
80  tray = i_phi + 102;
81  if(tray > 119)
82  tray-= 60;
83  }
84  if(i_eta == 1){
85  slat = 0;
86  tray = i_phi + 102;
87  if(tray > 119)
88  tray-= 60;
89  }
90  if(i_eta == 2){
91  slat = 0;
92  tray = 12 - i_phi;
93  if(tray < 0)
94  tray += 60;
95  }
96  if(i_eta == 3){
97  slat = 1;
98  tray = 12 - i_phi;
99  if(tray < 0)
100  tray += 60;
101  }
102  slat_out = slat;
103  tray_out = tray;
104 }