/[PAMELA software]/quicklook/tracker/flight/src/TrkFunctions.cpp
ViewVC logotype

Contents of /quicklook/tracker/flight/src/TrkFunctions.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed May 10 09:57:36 2006 UTC (18 years, 6 months ago) by pam-fi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
.cpp files removed

1 /**
2 * TrkFunctions.cpp --> some useful tracker functions
3 *
4 * version 1.0
5 * Parameters:
6 * file - the path to the root file to analyse
7 * outdir - total path of output file
8 *
9 */
10
11 #include <Rtypes.h>
12 #include <TString.h>
13 typedef struct trkword{
14
15 int type;
16 int decode;
17
18 };
19
20 typedef struct caltrk_def{
21 Int_t good0[2];
22 Int_t daqmode[12];
23 Int_t dspnum[12];
24 Int_t calibnum[12];
25 Int_t ncalev[12];
26 Int_t calfl[12];
27 Int_t ped1[12];
28 Int_t ped2[12];
29 Int_t ped3[12];
30 Int_t sig1[12];
31 Int_t sig2[12];
32 Int_t sig3[12];
33 Int_t nbad1[12];
34 Int_t nbad2[12];
35 Int_t nbad3[12];
36 Float_t dspped[12][3702];
37 Float_t dspsig[12][3702];
38 Float_t dspbad[12][3702];
39 Int_t crc_c[12][3];
40 Int_t crc_hc[12];
41 };
42
43 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
44 *
45 | The function "datadecode" decodes the tracker words.
46 *
47 | Tracker words are of three types:
48 * - ADC data
49 | - strip address
50 * - end of ladder
51 |
52 * The function returns a struct variable (trkword)
53 | that contains two quantities, type and decode, which are assigned
54 * the following values:
55 |
56 * type decode
57 | ----------------------------------------------------
58 * -1 error 0
59 | 0 data 0-4095 ADC values
60 * 1 address 0-1023 strip address (relative to ladder)
61 | 2 end-of-ladder 1,2,3 ladder number (compressed acq mode)
62 * 4,5,6 ladder number + 3 (full acq mode)
63 |
64 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
65 trkword datadecode(int word){
66 int type =0;
67 int data =0;
68 int nodata = word&0xf000;
69 int zero = 0;
70
71 trkword thisword;
72
73 switch (nodata>>12){
74
75 case 0:
76
77 thisword.decode = word;
78 thisword.type = 0;
79 // cout << thisword.decode << "\n";
80 return (thisword); //>>>>> ADC data (0)
81
82 case 1:
83
84 type = word&0xC00;
85 data = word&0x3ff;
86
87 switch(type>>10){
88
89 case 0:
90 thisword.decode = data;
91 thisword.type = 1; //>>> address (1)
92 return (thisword);
93
94 case 2:
95 // if(data>=4)data = data-3;
96 if(data>6){
97 printf("Error on data \n");
98 thisword.decode = zero;
99 thisword.type = -1;
100 return (thisword); //>>>>> error (-1)
101 }
102 thisword.decode = data;
103 thisword.type = 2;
104 return (thisword); //>>> end-of-ladder
105
106 default:
107 printf("Error on data \n");
108 thisword.decode = zero;
109 thisword.type = -1;
110 return (thisword); //>>>>> error (-1)
111
112 }
113
114 default:
115
116 printf("Error on data \n");
117 thisword.decode = zero;
118 thisword.type = -1;
119 return (thisword); //>>>>> error (-1)
120
121 };
122 };
123
124
125 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){
126 if ( to == 0 ){
127 Int_t t2length = s2.Length();
128 s1 = "";
129 to = t2length;
130 };
131 for (Int_t i = from; i<to; i++){
132 s1.Append(s2[i],1);
133 };
134 };
135
136

  ViewVC Help
Powered by ViewVC 1.1.23