/[PAMELA software]/DarthVader/ToFLevel2/src/ToFLevel2.cpp
ViewVC logotype

Contents of /DarthVader/ToFLevel2/src/ToFLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Jun 19 13:27:45 2006 UTC (18 years, 5 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r00
Changes since 1.1: +1 -1 lines
Upgrade to v1r00 to be linked to YODA 6_3/00

1 #include <TObject.h>
2 #include <ToFLevel2.h>
3 #include <iostream>
4 using namespace std;
5 ClassImp(ToFTrkVar);
6 ClassImp(ToFLevel2);
7
8 ToFTrkVar::ToFTrkVar() {
9
10 trkseqno = 0;
11
12 for (Int_t kk=0; kk<13;kk++){
13 beta_a[kk] = 0;
14 }
15
16 for (Int_t kk=0; kk<4;kk++){
17 for (Int_t hh=0; hh<12;hh++){
18 adc_c[hh][kk] = 0;
19 }
20 }
21 }
22
23 ToFTrkVar::ToFTrkVar(const ToFTrkVar &t){
24
25 trkseqno = t.trkseqno;
26
27 memcpy(adc_c,t.adc_c,sizeof(adc_c));
28 memcpy(beta_a,t.beta_a,sizeof(beta_a));
29 }
30
31 ToFLevel2::ToFLevel2() {
32 //
33 ToFTrk = new TClonesArray("ToFTrkVar",1);
34 //
35 for (Int_t kk=0; kk<3;kk++){
36 xtofpos[kk] = 0.;
37 ytofpos[kk] = 0.;
38 }
39
40 for (Int_t kk=0; kk<6;kk++){
41 tof_i_flag[kk] = 0;
42 tof_j_flag[kk] = 0;
43 }
44
45 for (Int_t kk=0; kk<13;kk++){
46 betatof_a[kk] = 0;
47 }
48
49 for (Int_t kk=0; kk<4;kk++){
50 for (Int_t hh=0; hh<12;hh++){
51 adctof_c[hh][kk] = 0;
52 }
53 }
54
55 for (Int_t kk=0; kk<4;kk++){
56 for (Int_t hh=0; hh<12;hh++){
57 tdc_c[hh][kk] = 0;
58 }
59 }
60
61
62 };
63
64 ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){
65 //
66 if(itrk >= ntrk()){
67 printf(" ToFLevel2 ERROR: track related variables set %i does not exists! \n",itrk);
68 printf(" stored track related variables = %i \n",ntrk());
69 return(NULL);
70 }
71 //
72 TClonesArray &t = *(ToFTrk);
73 ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk];
74 return toftrack;
75 }
76 //--------------------------------------
77 //
78 //
79 //--------------------------------------
80 /**
81 * Method to get the paddle ID (11 12 21 22 31 32) from the paddle index (0 1 2 3 4 5)
82 */
83 Int_t ToFLevel2::GetToFPlaneID(Int_t ip){
84 if(ip>=0 && ip<6)return 10*((int)(ip/2+1.1))+(ip%2)+1;
85 else return -1;
86 };
87 /**
88 * Method to get the paddle index (0 1 2 3 4 5) from the paddle ID (11 12 21 22 31 32)
89 */
90 Int_t ToFLevel2::GetToFPlaneIndex(Int_t plane_id){
91 if(
92 plane_id == 11 ||
93 plane_id == 12 ||
94 plane_id == 21 ||
95 plane_id == 22 ||
96 plane_id == 31 ||
97 plane_id == 32 ||
98 false)return (Int_t)(plane_id/10)*2-1- plane_id%2;
99 else return -1;
100 };
101 /**
102 * Method to know if a given ToF paddle was hit, that is there is a TDC signal from both PMTs
103 * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5).
104 * @param paddle_id Paddle ID.
105 * @return 1 if the paddle was hit.
106 */
107 Bool_t ToFLevel2::HitPaddle(Int_t plane, Int_t paddle_id){ //<<< NEW
108 Int_t ip = -1;
109 if (plane>=6 ) ip = GetToFPlaneIndex(plane);
110 else if(plane>=0 && plane < 6) ip = plane;
111 Int_t flag=0;
112 if(ip != -1)flag = tof_j_flag[ip] & (int)pow(2.,(double)paddle_id);
113 if(
114 (ip == 0 && paddle_id < 8 && flag) ||
115 (ip == 1 && paddle_id < 6 && flag) ||
116 (ip == 2 && paddle_id < 2 && flag) ||
117 (ip == 3 && paddle_id < 2 && flag) ||
118 (ip == 4 && paddle_id < 3 && flag) ||
119 (ip == 5 && paddle_id < 3 && flag) ||
120 false) return true;
121 else return false;
122 };
123 /**
124 * Method to get the number of hit paddles on a ToF plane.
125 * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5).
126 */
127 Int_t ToFLevel2::GetNHitPaddles(Int_t plane){
128 Int_t npad=0;
129 for(Int_t i=0; i<8; i++)npad = npad + (int)HitPaddle(plane,i);
130 return npad;
131 };

  ViewVC Help
Powered by ViewVC 1.1.23