/[PAMELA software]/yoda/techmodel/physics/TrackerReader.cpp
ViewVC logotype

Contents of /yoda/techmodel/physics/TrackerReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sat Jul 17 20:03:48 2004 UTC (20 years, 5 months ago) by kusanagi
Branch: MAIN
Changes since 1.1: +5 -8 lines
*** empty log message ***

1 /** @file
2 * $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 $
4 * $Author: kusanagi $
5 *
6 * Implementation of the TrackerPhysicsReader class.
7 */
8
9 #include <string>
10 #include <log4cpp/Category.hh>
11 #include "TrackerReader.h"
12 #include "event/physics/tracker/TrackerEvent.h"
13
14 extern "C" {
15 //Passo il path verso la il file temporaneo
16 extern void trkeventpkt_(int*, char*);
17 //Struct per il passaggio di dati da e verso la chiamata fortran
18 extern struct {
19 int DAQmode[12];
20 int DSPnumber[12];
21 int DATAlength[12];
22 int eventn[12];
23 int nclust[12];
24 int cutc[12];
25 int cutcl[12];
26 int addrcluster[12][3];
27 int signcluster[12][3];
28 int fc[12];
29 int compressiontime[12];
30 int fl5[12];
31 int fl4[12];
32 int fl3[12];
33 int fl2[12];
34 int fl1[12];
35 int fl6[12];
36 int checksum[12];
37 int pnum[12];
38 int cmdnum[12];
39 int bid[12];
40 int alarm[12];
41 int aswr[12];
42 } level0_;
43
44 #include <dirent.h>
45 }
46
47 using namespace pamela;
48 using namespace pamela::tracker;
49
50 static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.tracker.TrackerReader");
51
52 /**
53 * Constructor.
54 */
55 TrackerReader::TrackerReader(void):
56 TechmodelAlgorithm(PacketType::Physics, "TechmodelTrackerReader") {
57 cat.debug("Constructor");
58 tracker = new TrackerEvent();
59 }
60
61 /**
62 * Get a string with the version info of the algorithm.
63 */
64 std::string TrackerReader::GetVersionInfo(void) const {
65 return
66 "$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $";
67 }
68
69 /**
70 * Initialize the algorithm with a special run. This will initialize the
71 * event reader routines for all packet types.
72 */
73 void TrackerReader::Init(PamelaRun *run) {
74 SetInputStream(run);
75 run->WriteSubPacket(this, &tracker, tracker->Class());
76 }
77
78 /**
79 * Unpack the orbital event from an input file.
80 */
81 void TrackerReader::RunEvent(int EventNumber) {
82
83 }
84
85 /**
86 * Unpack the Tracker data event from the physical packet.
87 */
88 void TrackerReader::RunEvent(int EventNumber, const char subData[], long int length) {
89 int ERROR;
90
91 //Scrivo un file temporaneo per passarlo alla routine
92 //Speriamo di cambiare la routine per passargli un buffer.....
93 DIR *dirp;
94 std::string pathDir((char*)getenv("YODA_DATA"));
95 pathDir = pathDir + "/todatemp.dat";
96 FILE *pfile;
97 pfile = fopen((char*)pathDir.c_str(), "wb");
98 fwrite(subData, 1, length, pfile);
99 fclose(pfile);
100
101 //Call to the FORTRAN routin that unpack tracker events
102 trkeventpkt_(&ERROR, (char*)pathDir.c_str());
103
104 remove((char*)pathDir.c_str());
105
106 //Store the unpacked data
107 memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode));
108 memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber));
109 memcpy(tracker->DATAlength, level0_.DATAlength, sizeof(tracker->DATAlength));
110 memcpy(tracker->eventn, level0_.eventn, sizeof(tracker->eventn));
111 memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust));
112 memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc));
113 memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl));
114 memcpy(tracker->addrcluster, level0_.addrcluster, sizeof(tracker->addrcluster));
115 memcpy(tracker->signcluster, level0_.signcluster, sizeof(tracker->signcluster));
116 memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc));
117 memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime));
118 memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1));
119 memcpy(tracker->fl2, level0_.fl2, sizeof(tracker->fl2));
120 memcpy(tracker->fl3, level0_.fl3, sizeof(tracker->fl3));
121 memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4));
122 memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5));
123 memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6));
124 memcpy(tracker->checksum, level0_.checksum, sizeof(tracker->checksum));
125 memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum));
126 memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum));
127 memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid));
128 memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm));
129 memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr));
130
131 cat << log4cpp::Priority::ERROR
132 << "Fortran77 function trkcalibpkt error code = " << ERROR
133 << "\n " << log4cpp::CategoryStream::ENDLINE;
134 }

  ViewVC Help
Powered by ViewVC 1.1.23