1 |
#ifndef PAMVMCCALOSD_H |
2 |
#define PAMVMCCALOSD_H |
3 |
#include <iostream> |
4 |
|
5 |
#include "PamVMCDetectorSD.h" |
6 |
|
7 |
#define NOCALHIT 4224 |
8 |
|
9 |
using std::cout; |
10 |
using std::endl; |
11 |
|
12 |
class PamVMCCaloSD: public PamVMCDetectorSD{ |
13 |
public: |
14 |
PamVMCCaloSD(): PamVMCDetectorSD("pHitData","CAST",NOCALHIT){ |
15 |
// for(Int_t i=0; i< NOCALHIT; ++i) CreateHit(i); |
16 |
} |
17 |
|
18 |
|
19 |
virtual void FillHit(fin f,TVirtualMC *g){ |
20 |
|
21 |
switch(f) { |
22 |
case ENTERING: |
23 |
CleanHit(); |
24 |
FillVolID(); |
25 |
InitHit(); |
26 |
|
27 |
|
28 |
//FillVolID(); |
29 |
// cout<<"["<<GetViewID()<<"] ["<<GetPlaneID()<<"] ["<<GetStripID()<<"] "<<fhit.GetPOS()<<"\n"; |
30 |
UpdateHit(g); |
31 |
default: |
32 |
UpdateHit(g); |
33 |
break; |
34 |
} |
35 |
|
36 |
switch(f){ |
37 |
case EXITING: |
38 |
UpdateHit(g); |
39 |
// AddGlobalTime(g); |
40 |
// Save hit if energy release is greater than zero |
41 |
if(fhit.GetEREL()){ |
42 |
if(fdetID->FillVolID()){ |
43 |
SaveHit(fdetID->GetID( )); |
44 |
// cout<<fhit.GetPOS()<<"\n"; |
45 |
} else { |
46 |
cout << "Calorimeter FillVolID false" <<endl; |
47 |
} |
48 |
} |
49 |
break; |
50 |
default: |
51 |
break; |
52 |
} |
53 |
} |
54 |
|
55 |
//virtual void UpdateHit(TVirtualMC *g){ |
56 |
|
57 |
|
58 |
//} |
59 |
|
60 |
// virtual void ClearHitColl(){ |
61 |
//do nothing... for calorimerer only |
62 |
// } |
63 |
|
64 |
Int_t GetPlaneID(){ |
65 |
return ((int)fhit.GetPOS()/192); |
66 |
} |
67 |
|
68 |
Int_t GetViewID(){ |
69 |
return ((int)fhit.GetPOS()/96%2==0?0:1); |
70 |
} |
71 |
Int_t GetStripID(){ |
72 |
return (fhit.GetPOS()%96); |
73 |
} |
74 |
|
75 |
|
76 |
|
77 |
ClassDef(PamVMCCaloSD,1) |
78 |
|
79 |
}; |
80 |
|
81 |
#endif // PAMVMCCALOSD_H |