1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrgReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v $ |
3 |
* $Id: CalibTrgReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $ |
* $Id: CalibTrk2Reader.cpp,v 1.1 2004/07/06 12:31:55 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the LogReader class. |
* Implementation of the LogReader class. |
45 |
#include "stdio.h" |
#include "stdio.h" |
46 |
#include "ReaderAlgorithms.h" |
#include "ReaderAlgorithms.h" |
47 |
|
|
48 |
#include "event/CalibTrgEvent.h" |
#include "event/CalibTrk2Event.h" |
49 |
|
|
50 |
using namespace pamela; |
using namespace pamela; |
51 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
52 |
|
|
53 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibTrgReader"); |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibTrk2Reader"); |
54 |
|
|
55 |
/** |
/** |
56 |
* Constructor. |
* Constructor. |
57 |
*/ |
*/ |
58 |
CalibTrgReader::CalibTrgReader(void): |
CalibTrk2Reader::CalibTrk2Reader(void): |
59 |
TechmodelAlgorithm(PacketType::CalibTrg, "TechmodelCalibTrgReader") { |
TechmodelAlgorithm(PacketType::CalibTrk2, "TechmodelCalibTrk2Reader") { |
60 |
cat << log4cpp::Priority::DEBUG |
cat << log4cpp::Priority::DEBUG |
61 |
<< "Constructor " |
<< "Constructor " |
62 |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
63 |
calibTrg = new CalibTrgEvent(); |
calibTrk2 = new CalibTrk2Event(); |
64 |
} |
} |
65 |
|
|
66 |
/** |
/** |
67 |
* Get a string with the version info of the algorithm. |
* Get a string with the version info of the algorithm. |
68 |
*/ |
*/ |
69 |
std::string CalibTrgReader::GetVersionInfo(void) const { |
std::string CalibTrk2Reader::GetVersionInfo(void) const { |
70 |
return |
return |
71 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrgReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v 1.1 2004/07/06 12:31:55 kusanagi Exp $\n"; |
72 |
} |
} |
73 |
|
|
74 |
/** |
/** |
75 |
* Initialize the algorithm with a special run. This will initialize the |
* Initialize the algorithm with a special run. This will initialize the |
76 |
* event reader routines for all packet types. |
* event reader routines for all packet types. |
77 |
*/ |
*/ |
78 |
void CalibTrgReader::Init(PamelaRun *run) { |
void CalibTrk2Reader::Init(PamelaRun *run) { |
79 |
SetInputStream(run); |
SetInputStream(run); |
80 |
run->WriteSubPacket(this, &calibTrg, calibTrg->Class()); |
run->WriteSubPacket(this, &calibTrk2, calibTrk2->Class()); |
81 |
} |
} |
82 |
|
|
83 |
/** |
/** |
84 |
* Unpack the CalibTrg event from an input file. |
* Unpack the CalibTrk2 event from an input file. |
85 |
*/ |
*/ |
86 |
void CalibTrgReader::RunEvent(int EventNumber, long int length) { |
void CalibTrk2Reader::RunEvent(int EventNumber, long int length) { |
87 |
int ERROR; |
int ERROR; |
88 |
|
|
89 |
//the 2 bytes subtracted belong to the final event CRC bytes |
//the 2 bytes subtracted belong to the final event CRC bytes |
113 |
remove((char*)pathDir.c_str()); |
remove((char*)pathDir.c_str()); |
114 |
|
|
115 |
//Store the unpacked data |
//Store the unpacked data |
116 |
memcpy(calibTrg->DAQmode, trkcalib_.DAQmode, sizeof(calibTrg->DAQmode)); |
memcpy(calibTrk2->DAQmode, trkcalib_.DAQmode, sizeof(calibTrk2->DAQmode)); |
117 |
memcpy(calibTrg->DSPnumber, trkcalib_.DSPnumber, sizeof(calibTrg->DSPnumber)); |
memcpy(calibTrk2->DSPnumber, trkcalib_.DSPnumber, sizeof(calibTrk2->DSPnumber)); |
118 |
memcpy(calibTrg->calibnumber, trkcalib_.calibnumber, sizeof(calibTrg->calibnumber)); |
memcpy(calibTrk2->calibnumber, trkcalib_.calibnumber, sizeof(calibTrk2->calibnumber)); |
119 |
memcpy(calibTrg->DSPnumber, trkcalib_.ncalib_event, sizeof(calibTrg->ncalib_event)); |
memcpy(calibTrk2->DSPnumber, trkcalib_.ncalib_event, sizeof(calibTrk2->ncalib_event)); |
120 |
memcpy(calibTrg->ped_l1, trkcalib_.ped_l1, sizeof(calibTrg->ped_l1)); |
memcpy(calibTrk2->ped_l1, trkcalib_.ped_l1, sizeof(calibTrk2->ped_l1)); |
121 |
memcpy(calibTrg->ped_l2, trkcalib_.ped_l2, sizeof(calibTrg->ped_l2)); |
memcpy(calibTrk2->ped_l2, trkcalib_.ped_l2, sizeof(calibTrk2->ped_l2)); |
122 |
memcpy(calibTrg->ped_l3, trkcalib_.ped_l3, sizeof(calibTrg->ped_l3)); |
memcpy(calibTrk2->ped_l3, trkcalib_.ped_l3, sizeof(calibTrk2->ped_l3)); |
123 |
memcpy(calibTrg->sig_l1, trkcalib_.sig_l1, sizeof(calibTrg->sig_l1)); |
memcpy(calibTrk2->sig_l1, trkcalib_.sig_l1, sizeof(calibTrk2->sig_l1)); |
124 |
memcpy(calibTrg->sig_l2, trkcalib_.sig_l2, sizeof(calibTrg->sig_l2)); |
memcpy(calibTrk2->sig_l2, trkcalib_.sig_l2, sizeof(calibTrk2->sig_l2)); |
125 |
memcpy(calibTrg->sig_l3, trkcalib_.sig_l3, sizeof(calibTrg->sig_l3)); |
memcpy(calibTrk2->sig_l3, trkcalib_.sig_l3, sizeof(calibTrk2->sig_l3)); |
126 |
memcpy(calibTrg->nbad_l1, trkcalib_.nbad_l1, sizeof(calibTrg->nbad_l1)); |
memcpy(calibTrk2->nbad_l1, trkcalib_.nbad_l1, sizeof(calibTrk2->nbad_l1)); |
127 |
memcpy(calibTrg->nbad_l2, trkcalib_.nbad_l2, sizeof(calibTrg->nbad_l2)); |
memcpy(calibTrk2->nbad_l2, trkcalib_.nbad_l2, sizeof(calibTrk2->nbad_l2)); |
128 |
memcpy(calibTrg->nbad_l3, trkcalib_.nbad_l3, sizeof(calibTrg->nbad_l3)); |
memcpy(calibTrk2->nbad_l3, trkcalib_.nbad_l3, sizeof(calibTrk2->nbad_l3)); |
129 |
memcpy(calibTrg->cal_flag, trkcalib_.cal_flag, sizeof(calibTrg->cal_flag)); |
memcpy(calibTrk2->cal_flag, trkcalib_.cal_flag, sizeof(calibTrk2->cal_flag)); |
130 |
memcpy(calibTrg->checksum, trkcalib_.checksum, sizeof(calibTrg->checksum)); |
memcpy(calibTrk2->checksum, trkcalib_.checksum, sizeof(calibTrk2->checksum)); |
131 |
memcpy(calibTrg->DSPbad_par,trkcalib_.DSPbad_par, sizeof(calibTrg->DSPbad_par)); |
memcpy(calibTrk2->DSPbad_par,trkcalib_.DSPbad_par, sizeof(calibTrk2->DSPbad_par)); |
132 |
memcpy(calibTrg->DSPped_par,trkcalib_.DSPped_par, sizeof(calibTrg->DSPped_par)); |
memcpy(calibTrk2->DSPped_par,trkcalib_.DSPped_par, sizeof(calibTrk2->DSPped_par)); |
133 |
memcpy(calibTrg->DSPsig_par,trkcalib_.DSPsig_par, sizeof(calibTrg->DSPsig_par)); |
memcpy(calibTrk2->DSPsig_par,trkcalib_.DSPsig_par, sizeof(calibTrk2->DSPsig_par)); |
134 |
|
|
135 |
cat << log4cpp::Priority::ERROR |
cat << log4cpp::Priority::ERROR |
136 |
<< "Fortran77 function trkcalibpkt error code = " << ERROR |
<< "Fortran77 function trkcalibpkt error code = " << ERROR |