22 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
23 |
#include <EventHeader.h> |
#include <EventHeader.h> |
24 |
#include <fstream> |
#include <fstream> |
25 |
|
#include <cstdlib> |
26 |
|
#include <sys/stat.h> |
27 |
#include <TFile.h> |
#include <TFile.h> |
28 |
#include <TObjString.h> |
#include <TObjString.h> |
29 |
#include <TString.h> |
#include <TString.h> |
31 |
|
|
32 |
void PhysEndRunToXML(TString base, TString outDirectory = "", TString xslPath = ""){ |
void PhysEndRunToXML(TString base, TString outDirectory = "", TString xslPath = ""){ |
33 |
|
|
34 |
Int_t tmpSize; |
// Int_t tmpSize; |
35 |
ofstream outputFile; |
ofstream outputFile; |
36 |
stringstream oss; |
stringstream oss; |
37 |
|
|
79 |
tr->GetEntry(i); |
tr->GetEntry(i); |
80 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
81 |
outputFile << "<PHYSER_EVENT>\n"; |
outputFile << "<PHYSER_EVENT>\n"; |
82 |
outputFile << "\t<PACKET_OBT>" << ph->GetOrbitalTime() << "</PACKET_OBT>\n"; |
outputFile << "\t<PACKET_OBT>" << dec << ph->GetOrbitalTime() << "</PACKET_OBT>\n"; |
83 |
outputFile << "\t<PACKET_NUM>" << ph->GetCounter() << "</PACKET_NUM>\n"; |
outputFile << "\t<PACKET_NUM>" << ph->GetCounter() << "</PACKET_NUM>\n"; |
84 |
outputFile << "\t<CALOENDRUN_RECORDS>\n"; |
outputFile << "\t<CALOENDRUN_RECORDS>\n"; |
85 |
for (int j = 0; j < 4; j++){ |
for (int j = 0; j < 4; j++){ |
97 |
outputFile << "\t\t\t\t<HK1_ITEM>" << (int)cer.CALO_HK1[k] << "</HK1_ITEM>\n"; |
outputFile << "\t\t\t\t<HK1_ITEM>" << (int)cer.CALO_HK1[k] << "</HK1_ITEM>\n"; |
98 |
} |
} |
99 |
outputFile << "\t\t\t</HK1>\n"; |
outputFile << "\t\t\t</HK1>\n"; |
|
outputFile << "\t\t\t<BOARD_ID_REG>" << (int)cer.CALO_BOARD_ID_REG << "</BOARD_ID_REG>\n"; |
|
|
outputFile << "\t\t\t<BOARD_ST_REG>" << (int)cer.CALO_BOARD_STATUS_REG << "</BOARD_ST_REG>\n"; |
|
100 |
outputFile << "\t\t\t<CALO_REG>\n"; |
outputFile << "\t\t\t<CALO_REG>\n"; |
101 |
for (int k = 0; k < 7; k++){ |
for (int k = 0; k < 7; k++){ |
102 |
|
outputFile << "\t\t\t\t<CALO_REG_ITEM>" << (short)cer.CALO_BOARD_ID_REG[k] << "</CALO_REG_ITEM>\n"; |
103 |
|
outputFile << "\t\t\t\t<CALO_REG_ITEM>" << (short)cer.CALO_BOARD_STATUS_REG[k] << "</CALO_REG_ITEM>\n"; |
104 |
outputFile << "\t\t\t\t<CALO_REG_ITEM>" << (int)cer.CALO_REG[k] << "</CALO_REG_ITEM>\n"; |
outputFile << "\t\t\t\t<CALO_REG_ITEM>" << (int)cer.CALO_REG[k] << "</CALO_REG_ITEM>\n"; |
105 |
} |
} |
106 |
outputFile << "\t\t\t</CALO_REG>\n"; |
outputFile << "\t\t\t</CALO_REG>\n"; |
110 |
|
|
111 |
outputFile << "\t<TBENDRUN>\n"; |
outputFile << "\t<TBENDRUN>\n"; |
112 |
ter = pere->TB_ENDRUN; |
ter = pere->TB_ENDRUN; |
113 |
outputFile << "\t\t<ALARM_MASK>" << (int)ter.TB_ALARM_MASK << "</ALARM_MASK>\n"; |
outputFile << "\t\t<ALARM_MASK>" << (UInt_t)ter.TB_ALARM_MASK << "</ALARM_MASK>\n"; |
114 |
outputFile << "\t\t<PMT_MASK_S3>" << (int)ter.TB_PMT_MASK_S3 << "</PMT_MASK_S3>\n"; |
outputFile << "\t\t<PMT_MASK_S3S2S12>" << (UInt_t)ter.TB_PMT_MASK_S3S2S12 << "</PMT_MASK_S3S2S12>\n"; |
115 |
outputFile << "\t\t<PMT_MASK_S2>" << (int)ter.TB_PMT_MASK_S2 << "</PMT_MASK_S2>\n"; |
outputFile << "\t\t<PMT_MASK_S11CRC>" << (UInt_t)ter.TB_PMT_MASK_S11CRC << "</PMT_MASK_S11CRC>\n"; |
116 |
outputFile << "\t\t<PMT_MASK_S12>" << (int)ter.TB_PMT_MASK_S12 << "</PMT_MASK_S12>\n"; |
outputFile << "\t\t<PMT_MASK_S4CAL>" << (UInt_t)ter.TB_S4_CAL_MASK << "</PMT_MASK_S4CAL>\n"; |
117 |
outputFile << "\t\t<PMT_MASK_S11>" << (int)ter.TB_PMT_MASK_S11 << "</PMT_MASK_S11>\n"; |
outputFile << "\t\t<BUSY_MASK>" << (UInt_t)ter.TB_BUSY_MASK << "</BUSY_MASK>\n"; |
118 |
outputFile << "\t\t<S4_MASK>" << (int)ter.TB_S4_MASK << "</S4_MASK>\n"; |
outputFile << "\t\t<TRIG_CONF>" << (UInt_t)ter.TB_TRIG_CONF << "</TRIG_CONF>\n"; |
|
outputFile << "\t\t<CALO_MASK>" << (int)ter.TB_CALO_MASK << "</CALO_MASK>\n"; |
|
|
outputFile << "\t\t<BUSY_MASK>" << (int)ter.TB_BUSY_MASK << "</BUSY_MASK>\n"; |
|
|
outputFile << "\t\t<CALIB_FLAG>" << (int)ter.TB_CALIB_FLAG << "</CALIB_FLAG>\n"; |
|
|
outputFile << "\t\t<S4_TRIG>" << (int)ter.TB_S4_TRIG << "</S4_TRIG>\n"; |
|
|
outputFile << "\t\t<CALO_TRIG>" << (int)ter.TB_CALO_TRIG << "</CALO_TRIG>\n"; |
|
|
outputFile << "\t\t<TOF_TRIG>" << (int)ter.TB_TOF_TRIG << "</TOF_TRIG>\n"; |
|
119 |
outputFile << "\t</TBENDRUN>\n"; |
outputFile << "\t</TBENDRUN>\n"; |
120 |
|
|
121 |
outputFile << "</PHYSER_EVENT>\n"; |
outputFile << "</PHYSER_EVENT>\n"; |
144 |
|
|
145 |
for (int i = 2; i < argc; i++){ |
for (int i = 2; i < argc; i++){ |
146 |
if (!strcmp(argv[i], "-outDir")){ |
if (!strcmp(argv[i], "-outDir")){ |
147 |
if (++i >= argc){ |
if (++i >= argc){ |
148 |
printf( "-outDir needs arguments. \n"); |
printf( "-outDir needs arguments. \n"); |
149 |
printf( "Try '--help' for more information. \n"); |
printf( "Try '--help' for more information. \n"); |
150 |
exit(1); |
exit(1); |
151 |
} else { |
} else { |
152 |
outDir = argv[i]; |
outDir = argv[i]; |
153 |
continue; |
continue; |
154 |
} |
} |
155 |
} |
} |
156 |
|
|
157 |
if (!strcmp(argv[i], "-xslPath")) |
if (!strcmp(argv[i], "-xslPath")){ |
158 |
if (++i >= argc){ |
if (++i >= argc){ |
159 |
printf( "-xslPath needs arguments. \n"); |
printf( "-xslPath needs arguments. \n"); |
160 |
printf( "Try '--help' for more information. \n"); |
printf( "Try '--help' for more information. \n"); |
161 |
exit(1); |
exit(1); |
162 |
} else { |
} else { |
163 |
xslPath = argv[i]; |
xslPath = argv[i]; |
164 |
continue; |
continue; |
165 |
} |
} |
166 |
} |
} |
167 |
|
} |
168 |
PhysEndRunToXML(argv[1], outDir, xslPath); |
PhysEndRunToXML(argv[1], outDir, xslPath); |
169 |
} |
} |
170 |
|
|