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 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $ |
* $Id: TrackerReader.cpp,v 1.5 2004/08/24 08:00:12 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the TrackerPhysicsReader class. |
* Implementation of the TrackerPhysicsReader class. |
7 |
*/ |
*/ |
8 |
|
|
9 |
#include <string> |
#include <string> |
10 |
#include <log4cpp/Category.hh> |
#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 |
|
|
16 |
extern void trkeventpkt_(int*, char*); |
extern void trkeventpkt_(int*, char*); |
17 |
//Struct per il passaggio di dati da e verso la chiamata fortran |
//Struct per il passaggio di dati da e verso la chiamata fortran |
18 |
extern struct { |
extern struct { |
19 |
|
int good0; |
20 |
|
int nev0; |
21 |
int DAQmode[12]; |
int DAQmode[12]; |
22 |
int DSPnumber[12]; |
int DSPnumber[12]; |
23 |
int DATAlength[12]; |
int DATAlength[12]; |
35 |
int fl2[12]; |
int fl2[12]; |
36 |
int fl1[12]; |
int fl1[12]; |
37 |
int fl6[12]; |
int fl6[12]; |
|
int checksum[12]; |
|
38 |
int pnum[12]; |
int pnum[12]; |
39 |
int cmdnum[12]; |
int cmdnum[12]; |
40 |
int bid[12]; |
int bid[12]; |
41 |
int alarm[12]; |
int alarm[12]; |
42 |
int aswr[12]; |
int aswr[12]; |
43 |
|
int TOTDATAlength; |
44 |
|
int datatracker[49152]; |
45 |
} level0_; |
} level0_; |
46 |
|
|
47 |
#include <dirent.h> |
#include <dirent.h> |
50 |
using namespace pamela; |
using namespace pamela; |
51 |
using namespace pamela::tracker; |
using namespace pamela::tracker; |
52 |
|
|
53 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.tracker.TrackerReader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.tracker.TrackerReader")); |
54 |
|
|
55 |
/** |
/** |
56 |
* Constructor. |
* Constructor. |
57 |
*/ |
*/ |
58 |
TrackerReader::TrackerReader(void): |
TrackerReader::TrackerReader(void): |
59 |
TechmodelAlgorithm(PacketType::Physics, "TechmodelTrackerReader") { |
TechmodelAlgorithm(PacketType::Physics, "TechmodelTrackerReader") { |
60 |
cat.debug("Constructor"); |
logger->debug(_T("Constructor")); |
61 |
tracker = new TrackerEvent(); |
tracker = new TrackerEvent(); |
62 |
} |
} |
63 |
|
|
66 |
*/ |
*/ |
67 |
std::string TrackerReader::GetVersionInfo(void) const { |
std::string TrackerReader::GetVersionInfo(void) const { |
68 |
return |
return |
69 |
"$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $"; |
"$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 1.5 2004/08/24 08:00:12 kusanagi Exp $"; |
70 |
} |
} |
71 |
|
|
72 |
/** |
/** |
74 |
* event reader routines for all packet types. |
* event reader routines for all packet types. |
75 |
*/ |
*/ |
76 |
void TrackerReader::Init(PamelaRun *run) { |
void TrackerReader::Init(PamelaRun *run) { |
77 |
|
logger->debug(_T("Initialize")); |
78 |
SetInputStream(run); |
SetInputStream(run); |
79 |
run->WriteSubPacket(this, &tracker, tracker->Class()); |
run->WriteSubPacket(this, &tracker, tracker->Class()); |
80 |
} |
} |
107 |
|
|
108 |
remove((char*)pathDir.c_str()); |
remove((char*)pathDir.c_str()); |
109 |
|
|
110 |
|
/*if (ERROR != 0) { |
111 |
|
char *errmsg; |
112 |
|
switch (ERROR){ |
113 |
|
case 1: errmsg = "---------------------"; |
114 |
|
} |
115 |
|
} else {*/ |
116 |
//Store the unpacked data |
//Store the unpacked data |
117 |
memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode)); |
memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode)); |
118 |
memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber)); |
memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber)); |
121 |
memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust)); |
memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust)); |
122 |
memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc)); |
memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc)); |
123 |
memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl)); |
memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl)); |
124 |
memcpy(tracker->addrcluster, level0_.addrcluster, sizeof(tracker->addrcluster)); |
|
125 |
memcpy(tracker->signcluster, level0_.signcluster, sizeof(tracker->signcluster)); |
//--------have to invert array because of FORTRAN <-> C different management of the indexes |
126 |
|
int tempAddr[3][12]; |
127 |
|
int tempSign[3][12]; |
128 |
|
memcpy(tempAddr, (level0_.addrcluster), sizeof(tempAddr)); |
129 |
|
memcpy(tempSign, (level0_.signcluster), sizeof(tempSign)); |
130 |
|
for (int j = 0; j < 12; j++){ |
131 |
|
for (int i = 0; i < 3; i++){ |
132 |
|
tracker->addrcluster[j][i] = tempAddr[i][j]; |
133 |
|
tracker->signcluster[j][i] = tempSign[i][j]; |
134 |
|
} |
135 |
|
} |
136 |
|
//----------------------------------------------------------------------------------------- |
137 |
|
|
138 |
memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc)); |
memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc)); |
139 |
memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime)); |
memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime)); |
140 |
memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1)); |
memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1)); |
143 |
memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4)); |
memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4)); |
144 |
memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5)); |
memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5)); |
145 |
memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6)); |
memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6)); |
|
memcpy(tracker->checksum, level0_.checksum, sizeof(tracker->checksum)); |
|
146 |
memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum)); |
memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum)); |
147 |
memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum)); |
memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum)); |
148 |
memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid)); |
memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid)); |
149 |
memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm)); |
memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm)); |
150 |
memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr)); |
memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr)); |
151 |
|
tracker->TOTDATAlength = level0_.TOTDATAlength; |
152 |
cat << log4cpp::Priority::ERROR |
memcpy(tracker->datatracker, level0_.datatracker, sizeof(tracker->datatracker)); |
153 |
<< "Fortran77 function trkcalibpkt error code = " << ERROR |
//} |
154 |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
155 |
} |
} |