1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v $ |
3 |
* $Id: CalibTrk2Reader.cpp,v 2.2 2004/12/03 22:08:00 kusanagi Exp $ |
* $Id: CalibTrk2Reader.cpp,v 4.2 2005/03/16 22:51:36 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the LogReader class. |
* Implementation of the LogReader class. |
33 |
int nbad_l2[6]; |
int nbad_l2[6]; |
34 |
int nbad_l3[6]; |
int nbad_l3[6]; |
35 |
int cal_flag[6]; |
int cal_flag[6]; |
|
int checksum[6]; |
|
|
int DSPbad_par[6][3072]; |
|
36 |
float DSPped_par[6][3072]; |
float DSPped_par[6][3072]; |
37 |
float DSPsig_par[6][3072]; |
float DSPsig_par[6][3072]; |
38 |
|
int DSPbad_par[6][3072]; |
39 |
} trkcalib_; |
} trkcalib_; |
40 |
#include <dirent.h> |
#include <dirent.h> |
41 |
} |
} |
65 |
*/ |
*/ |
66 |
std::string CalibTrk2Reader::GetVersionInfo(void) const { |
std::string CalibTrk2Reader::GetVersionInfo(void) const { |
67 |
return |
return |
68 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v 2.2 2004/12/03 22:08:00 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v 4.2 2005/03/16 22:51:36 kusanagi Exp $\n"; |
69 |
} |
} |
70 |
|
|
71 |
/** |
/** |
90 |
|
|
91 |
//Scrivo un file temporaneo per passarlo alla routine |
//Scrivo un file temporaneo per passarlo alla routine |
92 |
//Speriamo di cambiare la routine per passargli un buffer..... |
//Speriamo di cambiare la routine per passargli un buffer..... |
93 |
DIR *dirp; |
oss.str(""); |
94 |
std::string pathDir((char*)getenv("YODA_DATA")); |
oss << getenv("YODA_DATA") << "/" << time(NULL) << "trc2.dat"; |
|
pathDir = pathDir + "/todatemp.dat"; |
|
95 |
FILE *pfile; |
FILE *pfile; |
96 |
pfile = fopen((char*)pathDir.c_str(), "wb"); |
pfile = fopen(oss.str().c_str(), "wb"); |
97 |
fwrite(subData, 1, dataLength, pfile); |
fwrite(subData, 1, dataLength, pfile); |
98 |
fclose(pfile); |
fclose(pfile); |
99 |
|
|
100 |
//Call to the FORTRAN routin that unpack tracker events |
//Call to the FORTRAN routin that unpack tracker events |
101 |
trkcalibpkt_(&ERROR, (char*)pathDir.c_str()); |
trkcalibpkt_(&ERROR, (char*)oss.str().c_str()); |
102 |
|
|
103 |
|
calibTrk2->unpackError = ERROR; |
104 |
|
remove(oss.str().c_str()); |
105 |
if (ERROR != 0) { |
if (ERROR != 0) { |
106 |
oss.str(""); |
oss.str(""); |
107 |
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
108 |
logger->warn(oss.str().c_str()); |
logger->warn(oss.str().c_str()); |
109 |
} |
} |
110 |
//delete the temporary file |
//delete the temporary file |
111 |
remove((char*)pathDir.c_str()); |
remove((char*)oss.str().c_str()); |
112 |
|
|
113 |
//Store the unpacked data |
//Store the unpacked data |
114 |
memcpy(calibTrk2->DAQmode, trkcalib_.DAQmode, sizeof(calibTrk2->DAQmode)); |
memcpy(calibTrk2->DAQmode, trkcalib_.DAQmode, sizeof(calibTrk2->DAQmode)); |
129 |
// memcpy(calibTrk2->DSPped_par, trkcalib_.DSPped_par, sizeof(calibTrk2->DSPped_par)); |
// memcpy(calibTrk2->DSPped_par, trkcalib_.DSPped_par, sizeof(calibTrk2->DSPped_par)); |
130 |
// memcpy(calibTrk2->DSPsig_par, trkcalib_.DSPsig_par, sizeof(calibTrk2->DSPsig_par)); |
// memcpy(calibTrk2->DSPsig_par, trkcalib_.DSPsig_par, sizeof(calibTrk2->DSPsig_par)); |
131 |
//--------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 |
132 |
int tempBad_par[3072][6]; |
int tempBad_par[3072][6]; |
133 |
int tempPed_par[3072][6]; |
float tempPed_par[3072][6]; |
134 |
int tempSig_par[3072][6]; |
float tempSig_par[3072][6]; |
135 |
memcpy(tempBad_par,trkcalib_.DSPbad_par, sizeof(tempBad_par)); |
memcpy(tempBad_par,trkcalib_.DSPbad_par, sizeof(tempBad_par)); |
136 |
memcpy(tempPed_par,trkcalib_.DSPped_par, sizeof(tempPed_par)); |
memcpy(tempPed_par,trkcalib_.DSPped_par, sizeof(tempPed_par)); |
137 |
memcpy(tempSig_par,trkcalib_.DSPsig_par, sizeof(tempSig_par)); |
memcpy(tempSig_par,trkcalib_.DSPsig_par, sizeof(tempSig_par)); |
138 |
|
|
139 |
for (int i = 0; i < 6; i++){ |
for (int i = 0; i < 6; i++){ |
140 |
for (int j = 0; j < 3072; j++){ |
for (int j = 0; j < 3072; j++){ |
147 |
oss.str(""); |
oss.str(""); |
148 |
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
149 |
logger->warn(oss.str().c_str()); |
logger->warn(oss.str().c_str()); |
|
|
|
|
//delete [] subData; |
|
150 |
} |
} |
151 |
|
|