StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcEtrHit.cc
1 /***************************************************************************
2  *
3  ***************************************************************************/
4 #include <assert.h>
5 #include "StMcEtrHit.hh"
6 #include "tables/St_g2t_etr_hit_Table.h"
7 
8 static const char rcsid[] = "$Id: StMcEtrHit.cc,v 2.2 2015/07/22 19:29:17 jwebb Exp $";
9 
10 ClassImp(StMcEtrHit)
11 
12 //_____________________________________________________________________________
13 ostream& operator<<(ostream& os, const StMcEtrHit& h)
14 {
15  os << "StMcEtrHit" << endl;
16  os << *((StMcHit *) &h);
17  os << "Layer : " << h.layer() << endl;
18  os << "Sector : " << h.sector() << endl;
19  return os;
20 }
21 //_____________________________________________________________________________
22 StMcEtrHit::StMcEtrHit(g2t_etr_hit_st* pt) :
23  StMcHit(StThreeVectorF(pt->x[0], pt->x[1], pt->x[2]),
24  StThreeVectorF(pt->p[0], pt->p[1], pt->p[2]),
25  pt->de, pt->ds, pt->tof, pt->id, pt->volume_id, 0) {}
26 
27 //_____________________________________________________________________________
28 int StMcEtrHit::layer() const
29 {
30  int iLayer; // 3 disk in TRD, iLayer=0, 1, 2
31 
32  // volumeId encoded in UPGR16, section+100*layer+10000*sector
33  int ilayer = (volumeId()/100)%100; // 3 disk in TRD, iLayer=0, 1, 2
34  assert (ilayer <=2 || ilayer >=0);
35  // NOTE: Return ilayer (lower-case "l") here instead of the uninitialized
36  // iLayer (upper "L"). May indicate a bug in the code.
37  return iLayer=ilayer;
38 }
39 
40 
41 //_____________________________________________________________________________
42 int StMcEtrHit::sector() const
43 {
44  // volumeId encoded in UPGR16
45  int iSector = volumeId()/10000; // 12 sector in TRD layer, 0 - 11
46  assert(iSector>=0 || iSector<=11);
47  return iSector;
48 }
49 //________________________________________________________________________________
50 void StMcEtrHit::Print(Option_t *option) const {
51  cout << "EtrHit\t";
52  StMcHit::Print();
53  cout << "\tLayer: " << layer()
54  << "\tSector: " << sector() << endl;;
55 }
Definition: tof.h:15