1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v $ |
3 |
* $Id: TrackerReader.cpp,v 2.0 2004/09/21 20:51:22 kusanagi Exp $ |
* $Id: TrackerReader.cpp,v 4.4 2005/05/28 10:44:13 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the TrackerPhysicsReader class. |
* Implementation of the TrackerPhysicsReader class. |
10 |
#include <log4cxx/logger.h> |
#include <log4cxx/logger.h> |
11 |
#include "TrackerReader.h" |
#include "TrackerReader.h" |
12 |
#include "event/physics/tracker/TrackerEvent.h" |
#include "event/physics/tracker/TrackerEvent.h" |
13 |
|
//#include <TArrayC.h> |
14 |
|
|
15 |
extern "C" { |
extern "C" { |
16 |
//Passo il path verso la il file temporaneo |
//Passo il path verso la il file temporaneo |
36 |
int fl2[12]; |
int fl2[12]; |
37 |
int fl1[12]; |
int fl1[12]; |
38 |
int fl6[12]; |
int fl6[12]; |
39 |
|
int checksum[12]; |
40 |
|
int TOTDATAlength; |
41 |
|
int datatracker[49152]; |
42 |
int pnum[12]; |
int pnum[12]; |
43 |
int cmdnum[12]; |
int cmdnum[12]; |
44 |
int bid[12]; |
int bid[12]; |
45 |
int alarm[12]; |
int alarm[12]; |
46 |
int aswr[12]; |
int aswr[12]; |
|
int TOTDATAlength; |
|
|
int datatracker[49152]; |
|
47 |
} level0_; |
} level0_; |
48 |
#include <dirent.h> |
#include <dirent.h> |
49 |
} |
} |
67 |
*/ |
*/ |
68 |
std::string TrackerReader::GetVersionInfo(void) const { |
std::string TrackerReader::GetVersionInfo(void) const { |
69 |
return |
return |
70 |
"$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 2.0 2004/09/21 20:51:22 kusanagi Exp $"; |
"$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 4.4 2005/05/28 10:44:13 kusanagi Exp $"; |
71 |
} |
} |
72 |
|
|
73 |
/** |
/** |
95 |
|
|
96 |
//Scrivo un file temporaneo per passarlo alla routine |
//Scrivo un file temporaneo per passarlo alla routine |
97 |
//Speriamo di cambiare la routine per passargli un buffer..... |
//Speriamo di cambiare la routine per passargli un buffer..... |
98 |
DIR *dirp; |
//DIR *dirp; |
99 |
std::string pathDir((char*)getenv("YODA_DATA")); |
|
100 |
pathDir = pathDir + "/todatemp.dat"; |
//std::string pathDir((char*)getenv("YODA_DATA")); |
101 |
|
|
102 |
|
//pathDir = pathDir + "/todatemp.dat"; |
103 |
|
stringstream oss; |
104 |
|
oss.str(""); |
105 |
|
oss << getenv("YODA_DATA") << "/" << time(NULL) << "trev.dat"; |
106 |
FILE *pfile; |
FILE *pfile; |
107 |
pfile = fopen((char*)pathDir.c_str(), "wb"); |
pfile = fopen(oss.str().c_str(), "wb"); |
108 |
fwrite(subData, 1, length, pfile); |
fwrite(subData, 1, length, pfile); |
109 |
fclose(pfile); |
fclose(pfile); |
110 |
|
|
111 |
//Call to the FORTRAN routin that unpack tracker events |
//Call to the FORTRAN routin that unpack tracker events |
112 |
trkeventpkt_(&ERROR, (char*)pathDir.c_str()); |
trkeventpkt_(&ERROR, (char*)oss.str().c_str()); |
113 |
|
|
114 |
remove((char*)pathDir.c_str()); |
remove(oss.str().c_str()); |
115 |
|
|
116 |
/*if (ERROR != 0) { |
if (ERROR != 0) { |
117 |
char *errmsg; |
char *errmsg; |
118 |
switch (ERROR){ |
switch (ERROR){ |
119 |
case 1: errmsg = "---------------------"; |
case 1: errmsg = "GENERIC TRACKER ERROR"; |
120 |
|
break; |
121 |
|
default: errmsg = "TRACKER ERRROR CODE UNIDENTIFIED"; |
122 |
} |
} |
123 |
} else {*/ |
oss.str(""); |
124 |
|
oss << "Fortran77 function trkeventpkt: " << errmsg; |
125 |
|
logger->warn(oss.str().c_str()); |
126 |
|
} |
127 |
//Store the unpacked data |
//Store the unpacked data |
128 |
memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode)); |
tracker->unpackError = ERROR; |
129 |
memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber)); |
tracker->good0 = level0_.good0; |
130 |
|
tracker->nev0 = level0_.nev0; |
131 |
|
memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode)); |
132 |
|
memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber)); |
133 |
memcpy(tracker->DATAlength, level0_.DATAlength, sizeof(tracker->DATAlength)); |
memcpy(tracker->DATAlength, level0_.DATAlength, sizeof(tracker->DATAlength)); |
134 |
memcpy(tracker->eventn, level0_.eventn, sizeof(tracker->eventn)); |
memcpy(tracker->eventn, level0_.eventn, sizeof(tracker->eventn)); |
135 |
memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust)); |
memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust)); |
136 |
memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc)); |
memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc)); |
137 |
memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl)); |
memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl)); |
138 |
// memcpy(tracker->addrcluster, (level0_.addrcluster), sizeof(tracker->addrcluster)); |
// memcpy(tracker->addrcluster, (level0_.addrcluster), sizeof(tracker->addrcluster)); |
139 |
// memcpy(tracker->signcluster, (level0_.signcluster), sizeof(tracker->signcluster)); |
// memcpy(tracker->signcluster, (level0_.signcluster), sizeof(tracker->signcluster)); |
140 |
//--------have to invert array because of FORTRAN <-> C different management of the indexes |
//--------have to invert array because of FORTRAN <-> C different management of the indexes |
142 |
int tempSign[3][12]; |
int tempSign[3][12]; |
143 |
memcpy(tempAddr, (level0_.addrcluster), sizeof(tempAddr)); |
memcpy(tempAddr, (level0_.addrcluster), sizeof(tempAddr)); |
144 |
memcpy(tempSign, (level0_.signcluster), sizeof(tempSign)); |
memcpy(tempSign, (level0_.signcluster), sizeof(tempSign)); |
145 |
for (int j = 0; j < 11; j++){ |
for (int j = 0; j < 12; j++){ |
146 |
for (int i = 0; i < 2; i++){ |
for (int i = 0; i < 3; i++){ |
147 |
tracker->addrcluster[j][i] = tempAddr[i][j]; |
tracker->addrcluster[j][i] = tempAddr[i][j]; |
148 |
tracker->signcluster[j][i] = tempSign[i][j]; |
tracker->signcluster[j][i] = tempSign[i][j]; |
149 |
} |
} |
150 |
} |
} |
151 |
//----------------------------------------------------------------------------------------- |
//----------------------------------------------------------------------------------------- |
152 |
|
|
153 |
memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc)); |
memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc)); |
154 |
memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime)); |
memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime)); |
155 |
memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1)); |
memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1)); |
156 |
memcpy(tracker->fl2, level0_.fl2, sizeof(tracker->fl2)); |
memcpy(tracker->fl2, level0_.fl2, sizeof(tracker->fl2)); |
157 |
memcpy(tracker->fl3, level0_.fl3, sizeof(tracker->fl3)); |
memcpy(tracker->fl3, level0_.fl3, sizeof(tracker->fl3)); |
158 |
memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4)); |
memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4)); |
159 |
memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5)); |
memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5)); |
160 |
memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6)); |
memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6)); |
161 |
memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum)); |
memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum)); |
162 |
memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum)); |
memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum)); |
163 |
memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid)); |
memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid)); |
164 |
memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm)); |
memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm)); |
165 |
memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr)); |
memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr)); |
166 |
|
|
167 |
tracker->TOTDATAlength = level0_.TOTDATAlength; |
tracker->TOTDATAlength = level0_.TOTDATAlength; |
168 |
memcpy(tracker->datatracker, level0_.datatracker, sizeof(tracker->datatracker)); |
//tracker->TrackerData = new TArrayI(level0_.TOTDATAlength, level0_.datatracker); |
169 |
|
tracker->TrackerData = TArrayI(level0_.TOTDATAlength, level0_.datatracker); |
170 |
|
|
171 |
|
//memcpy(tracker->datatracker, level0_.datatracker, sizeof(tracker->datatracker)); |
172 |
//} |
//} |
173 |
|
|
174 |
} |
} |