Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming endl to RESTendl and other logger functions #63

Merged
merged 3 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/TRestRawBaseLineCorrectionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class TRestRawBaseLineCorrectionProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

metadata << "Smoothing window size: " << fSmoothingWindow << endl;
metadata << "Baseline correction applied to signals with IDs in range (" << fSignalsRange.X() << "," << fSignalsRange.Y() << ")" << endl;
RESTMetadata << "Smoothing window size: " << fSmoothingWindow << RESTendl;
RESTMetadata << "Baseline correction applied to signals with IDs in range (" << fSignalsRange.X() << "," << fSignalsRange.Y() << ")" << RESTendl;

EndPrintProcess();
}
Expand Down
12 changes: 6 additions & 6 deletions inc/TRestRawCommonNoiseReductionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class TRestRawCommonNoiseReductionProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

metadata << " mode : [" << fMode << "]";
if (fMode == 0) metadata << " --> Mode 0 activated." << endl;
if (fMode == 1) metadata << " --> Mode 1 activated." << endl;
metadata << " centerWidth : " << fCenterWidth << endl;
metadata << "blocks : [" << fBlocks << "]" << endl;
metadata << " Minimum number of signals : " << fMinSignalsRequired << endl;
RESTMetadata << " mode : [" << fMode << "]";
if (fMode == 0) RESTMetadata << " --> Mode 0 activated." << RESTendl;
if (fMode == 1) RESTMetadata << " --> Mode 1 activated." << RESTendl;
RESTMetadata << " centerWidth : " << fCenterWidth << RESTendl;
RESTMetadata << "blocks : [" << fBlocks << "]" << RESTendl;
RESTMetadata << " Minimum number of signals : " << fMinSignalsRequired << RESTendl;

EndPrintProcess();
}
Expand Down
28 changes: 14 additions & 14 deletions inc/TRestRawMultiCoBoAsAdToSignalProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ struct CoBoHeaderFrame {
// int fEveTimeNanoSec;

void Show() {
std::cout << "------ Frame Header ------" << endl;
std::cout << "frameSize " << frameSize << endl;

std::cout << "frameType " << frameType << endl;
std::cout << "revision " << revision << endl;
std::cout << "headerSize " << headerSize << endl;
std::cout << "itemSize " << itemSize << endl;
std::cout << "nItems " << nItems << endl;
std::cout << "eventTime " << eventTime << endl;
std::cout << "eventIdx " << eventIdx << endl;

std::cout << "asadIdx " << asadIdx << endl;
std::cout << "readOffset " << readOffset << endl;
std::cout << "status " << status << endl;
std::cout << "------ Frame Header ------" << std::endl;
std::cout << "frameSize " << frameSize << std::endl;

std::cout << "frameType " << frameType << std::endl;
std::cout << "revision " << revision << std::endl;
std::cout << "headerSize " << headerSize << std::endl;
std::cout << "itemSize " << itemSize << std::endl;
std::cout << "nItems " << nItems << std::endl;
std::cout << "eventTime " << eventTime << std::endl;
std::cout << "eventIdx " << eventIdx << std::endl;

std::cout << "asadIdx " << asadIdx << std::endl;
std::cout << "readOffset " << readOffset << std::endl;
std::cout << "status " << status << std::endl;
}
};

Expand Down
2 changes: 1 addition & 1 deletion inc/TRestRawSignalAddNoiseProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TRestRawSignalAddNoiseProcess : public TRestEventProcess {
inline void PrintMetadata() override {
BeginPrintProcess();

metadata << "Noise Level : " << fNoiseLevel << endl;
RESTMetadata << "Noise Level : " << fNoiseLevel << RESTendl;

EndPrintProcess();
}
Expand Down
14 changes: 7 additions & 7 deletions inc/TRestRawSignalAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class TRestRawSignalAnalysisProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

metadata << "Baseline range : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y() << " ) "
<< endl;
metadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y() << " ) "
<< endl;
metadata << "Point Threshold : " << fPointThreshold << " sigmas" << endl;
metadata << "Signal threshold : " << fSignalThreshold << " sigmas" << endl;
metadata << "Number of points over threshold : " << fPointsOverThreshold << endl;
RESTMetadata << "Baseline range : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y() << " ) "
<< RESTendl;
RESTMetadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y() << " ) "
<< RESTendl;
RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
RESTMetadata << "Number of points over threshold : " << fPointsOverThreshold << RESTendl;

EndPrintProcess();
}
Expand Down
18 changes: 9 additions & 9 deletions inc/TRestRawSignalChannelActivityProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ class TRestRawSignalChannelActivityProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

metadata << "Low signal threshold activity : " << fLowThreshold << endl;
metadata << "High signal threshold activity : " << fHighThreshold << endl;
RESTMetadata << "Low signal threshold activity : " << fLowThreshold << RESTendl;
RESTMetadata << "High signal threshold activity : " << fHighThreshold << RESTendl;

metadata << "Number of daq histogram channels : " << fDaqChannels << endl;
metadata << "Start daq channel : " << fDaqStartChannel << endl;
metadata << "End daq channel : " << fDaqEndChannel << endl;
RESTMetadata << "Number of daq histogram channels : " << fDaqChannels << RESTendl;
RESTMetadata << "Start daq channel : " << fDaqStartChannel << RESTendl;
RESTMetadata << "End daq channel : " << fDaqEndChannel << RESTendl;

#ifdef REST_DetectorLib
metadata << "Number of readout histogram channels : " << fReadoutChannels << endl;
metadata << "Start readout channel : " << fReadoutStartChannel << endl;
metadata << "End readout channel : " << fReadoutEndChannel << endl;
RESTMetadata << "Number of readout histogram channels : " << fReadoutChannels << RESTendl;
RESTMetadata << "Start readout channel : " << fReadoutStartChannel << RESTendl;
RESTMetadata << "End readout channel : " << fReadoutEndChannel << RESTendl;
#else
metadata << "Some Detector features in this process are not available!" << endl;
RESTMetadata << "Some Detector features in this process are not available!" << RESTendl;
#endif

EndPrintProcess();
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestRawSignalGeneralFitProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class TRestRawSignalGeneralFitProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

metadata << "Function std::string: " << fFunction << endl;
metadata << "Range: ( " << fFunctionRange.X() << " , " << fFunctionRange.Y() << " ) " << endl;
RESTMetadata << "Function std::string: " << fFunction << RESTendl;
RESTMetadata << "Range: ( " << fFunctionRange.X() << " , " << fFunctionRange.Y() << " ) " << RESTendl;

EndPrintProcess();
}
Expand Down
12 changes: 6 additions & 6 deletions inc/TRestRawSignalRecoverChannelsProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TRestRawSignalRecoverChannelsProcess : public TRestEventProcess {
TRestDetectorReadout* fReadout; //!
#endif

void Initialize();
void Initialize() override;

void LoadDefaultConfig();

Expand All @@ -56,16 +56,16 @@ class TRestRawSignalRecoverChannelsProcess : public TRestEventProcess {
any GetInputEvent() const override { return fInputSignalEvent; }
any GetOutputEvent() const override { return fOutputSignalEvent; }

void InitProcess();
TRestEvent* ProcessEvent(TRestEvent* eventInput);
void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* eventInput) override;

void LoadConfig(const std::string& configFilename, const std::string& name = "");

/// It prints out the process parameters stored in the metadata structure
void PrintMetadata() {
void PrintMetadata() override {
BeginPrintProcess();
for (const auto& channelId : fChannelIds) {
metadata << "Channel id to recover: " << channelId << endl;
RESTMetadata << "Channel id to recover: " << channelId << RESTendl;
}
EndPrintProcess();
}
Expand All @@ -83,6 +83,6 @@ class TRestRawSignalRecoverChannelsProcess : public TRestEventProcess {
// Destructor
~TRestRawSignalRecoverChannelsProcess();

ClassDef(TRestRawSignalRecoverChannelsProcess, 1);
ClassDefOverride(TRestRawSignalRecoverChannelsProcess, 1);
};
#endif
2 changes: 1 addition & 1 deletion inc/TRestRawSignalRemoveChannelsProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TRestRawSignalRemoveChannelsProcess : public TRestEventProcess {
BeginPrintProcess();

for (unsigned int n = 0; n < fChannelIds.size(); n++)
metadata << "Channel id to remove : " << fChannelIds[n] << endl;
RESTMetadata << "Channel id to remove : " << fChannelIds[n] << RESTendl;

EndPrintProcess();
}
Expand Down
8 changes: 4 additions & 4 deletions inc/TRestRawSignalShapingProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class TRestRawSignalShapingProcess : public TRestEventProcess {
inline void PrintMetadata() override {
BeginPrintProcess();

metadata << "Shaping type : " << fShapingType << endl;
metadata << "Shaping time : " << fShapingTime << endl;
metadata << "Amplitude gain : " << fShapingGain << endl;
RESTMetadata << "Shaping type : " << fShapingType << RESTendl;
RESTMetadata << "Shaping time : " << fShapingTime << RESTendl;
RESTMetadata << "Amplitude gain : " << fShapingGain << RESTendl;
if (fShapingType == "responseFile") {
metadata << "Response file : " << fResponseFilename << endl;
RESTMetadata << "Response file : " << fResponseFilename << RESTendl;
}

EndPrintProcess();
Expand Down
2 changes: 1 addition & 1 deletion inc/TRestRawSignalViewerProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TRestRawSignalViewerProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();

std::cout << "Refresh value : " << fDrawRefresh << endl;
std::cout << "Refresh value : " << fDrawRefresh << std::endl;

EndPrintProcess();
}
Expand Down
86 changes: 43 additions & 43 deletions src/TRestRawAFTERToSignalProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
payload = head.eventSize;
frameBits = sizeof(head);

debug << "Event number from header --> 0x" << std::hex << head.eventNumb << std::dec << endl;
debug << " event header size " << sizeof(head) << endl;
debug << " total rawdata size 0x" << std::hex << head.eventSize << std::dec << endl;
debug << "Payload " << payload << endl;
RESTDebug << "Event number from header --> 0x" << std::hex << head.eventNumb << std::dec << RESTendl;
RESTDebug << " event header size " << sizeof(head) << RESTendl;
RESTDebug << " total rawdata size 0x" << std::hex << head.eventSize << std::dec << RESTendl;
RESTDebug << "Payload " << payload << RESTendl;

fSignalEvent->SetID(head.eventNumb);

Expand Down Expand Up @@ -208,51 +208,51 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
prevTime = eventTime;
first = false;

debug << "Timestamp: " << eventTime << endl;
RESTDebug << "Timestamp: " << eventTime << RESTendl;
}

debug << "******Event data packet header:******" << endl;
RESTDebug << "******Event data packet header:******" << RESTendl;

debug << "Size " << ntohs(pHeader.size) << endl;
RESTDebug << "Size " << ntohs(pHeader.size) << RESTendl;

debug << "Event data packet header: " << endl;
debug << std::hex << "Size 0x" << ntohs(pHeader.size) << endl;
RESTDebug << "Event data packet header: " << RESTendl;
RESTDebug << std::hex << "Size 0x" << ntohs(pHeader.size) << RESTendl;
#ifdef NEW_DAQ_T2K_2_X
debug << "DCC 0x" << ntohs(pHeader.dcc) << endl;
RESTDebug << "DCC 0x" << ntohs(pHeader.dcc) << RESTendl;
#endif
debug << "Hdr word 0x" << ntohs(pHeader.hdr) << endl;
debug << "Args 0x" << ntohs(pHeader.args) << endl;
debug << "TS_H 0x" << ntohs(pHeader.ts_h) << endl;
debug << "TS_L 0x" << ntohs(pHeader.ts_l) << endl;
debug << "Ecnt 0x" << ntohs(pHeader.ecnt) << endl;
debug << "Scnt 0x" << ntohs(pHeader.scnt) << std::dec << endl;
RESTDebug << "Hdr word 0x" << ntohs(pHeader.hdr) << RESTendl;
RESTDebug << "Args 0x" << ntohs(pHeader.args) << RESTendl;
RESTDebug << "TS_H 0x" << ntohs(pHeader.ts_h) << RESTendl;
RESTDebug << "TS_L 0x" << ntohs(pHeader.ts_l) << RESTendl;
RESTDebug << "Ecnt 0x" << ntohs(pHeader.ecnt) << RESTendl;
RESTDebug << "Scnt 0x" << ntohs(pHeader.scnt) << std::dec << RESTendl;

#ifdef NEW_DAQ_T2K_2_X
debug << "RawDCC Head 0x" << std::hex << ntohs(pHeader.dcc) << std::dec << " Version "
RESTDebug << "RawDCC Head 0x" << std::hex << ntohs(pHeader.dcc) << std::dec << " Version "
<< GET_EVENT_TYPE(ntohs(pHeader.dcc));
debug << " Flag " << ((ntohs(pHeader.dcc) & 0x3000) >> 12);
debug << " RT " << ((ntohs(pHeader.dcc) & 0x0C00) >> 10) << " DCCInd "
RESTDebug << " Flag " << ((ntohs(pHeader.dcc) & 0x3000) >> 12);
RESTDebug << " RT " << ((ntohs(pHeader.dcc) & 0x0C00) >> 10) << " DCCInd "
<< ((ntohs(pHeader.dcc) & 0x03F0) >> 4);
debug << " FEMInd " << (ntohs(pHeader.dcc) & 0x000F) << endl;
RESTDebug << " FEMInd " << (ntohs(pHeader.dcc) & 0x000F) << RESTendl;

debug << "FEM0Ind " << ntohs(pHeader.hdr) << " Type " << ((ntohs(pHeader.hdr) & 0xF000) >> 12);
debug << " L " << ((ntohs(pHeader.hdr) & 0x0800) >> 11);
debug << " U " << ((ntohs(pHeader.hdr) & 0x0800) >> 10) << " FECFlags "
RESTDebug << "FEM0Ind " << ntohs(pHeader.hdr) << " Type " << ((ntohs(pHeader.hdr) & 0xF000) >> 12);
RESTDebug << " L " << ((ntohs(pHeader.hdr) & 0x0800) >> 11);
RESTDebug << " U " << ((ntohs(pHeader.hdr) & 0x0800) >> 10) << " FECFlags "
<< ((ntohs(pHeader.hdr) & 0x03F0) >> 4);
debug << " Index " << (ntohs(pHeader.hdr) & 0x000F) << endl;
RESTDebug << " Index " << (ntohs(pHeader.hdr) & 0x000F) << RESTendl;

debug << "RawFEM 0x" << std::hex << ntohs(pHeader.args) << std::dec << " M "
RESTDebug << "RawFEM 0x" << std::hex << ntohs(pHeader.args) << std::dec << " M "
<< ((ntohs(pHeader.args) & 0x8000) >> 15);
debug << " N " << ((ntohs(pHeader.args) & 0x4000) >> 14) << " Zero "
RESTDebug << " N " << ((ntohs(pHeader.args) & 0x4000) >> 14) << " Zero "
<< ((ntohs(pHeader.args) & 0x1000) >> 13);
debug << " Arg2 " << GET_RB_ARG2(ntohs(pHeader.args)) << " Arg2 " << GET_RB_ARG1(ntohs(pHeader.args))
<< endl;
debug << "TimeStampH " << ntohs(pHeader.ts_h) << endl;
debug << "TimeStampL " << ntohs(pHeader.ts_l) << endl;
debug << "RawEvType 0x" << std::hex << ntohs(pHeader.ecnt) << std::dec << " EvTy "
RESTDebug << " Arg2 " << GET_RB_ARG2(ntohs(pHeader.args)) << " Arg2 " << GET_RB_ARG1(ntohs(pHeader.args))
<< RESTendl;
RESTDebug << "TimeStampH " << ntohs(pHeader.ts_h) << RESTendl;
RESTDebug << "TimeStampL " << ntohs(pHeader.ts_l) << RESTendl;
RESTDebug << "RawEvType 0x" << std::hex << ntohs(pHeader.ecnt) << std::dec << " EvTy "
<< GET_EVENT_TYPE(ntohs(pHeader.ecnt));
debug << " EventCount " << GET_EVENT_COUNT(ntohs(pHeader.ecnt)) << endl;
debug << "Samples " << ntohs(pHeader.scnt) << endl;
RESTDebug << " EventCount " << GET_EVENT_COUNT(ntohs(pHeader.ecnt)) << RESTendl;
RESTDebug << "Samples " << ntohs(pHeader.scnt) << RESTendl;
#endif

tempAsic1 = GET_RB_ARG1(ntohs(pHeader.args));
Expand All @@ -261,7 +261,7 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
asicN = (10 * (tempAsic1 % 6) / 2 + tempAsic2) % 4;
fecN = (10 * (tempAsic1 % 6) / 2 + tempAsic2) / 4;

debug << " channel " << channel << " asic " << asicN << " fec " << fecN << endl;
RESTDebug << " channel " << channel << " asic " << asicN << " fec " << fecN << RESTendl;

sampleCountRead = ntohs(pHeader.scnt);
pay = sampleCountRead % 2;
Expand Down Expand Up @@ -300,20 +300,20 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
data = ntohs(dat);

std::bitset<16> bs(data);
debug << bs << endl;
RESTDebug << bs << RESTendl;

if (((data & 0xFE00) >> 9) == 8) {
timeBin = GET_CELL_INDEX(data);
if (timeBin == 511) isData = false;
debug << data << " Time bin " << timeBin << endl;
RESTDebug << data << " Time bin " << timeBin << RESTendl;
} else if ((((data & 0xF000) >> 12) == 0) && isData) {
fSignalEvent->AddChargeToSignal(physChannel, timeBin, data);
debug << "Time bin " << timeBin << " ADC: " << data << endl;
RESTDebug << "Time bin " << timeBin << " ADC: " << data << RESTendl;
timeBin++;
}
}

debug << pay << endl;
RESTDebug << pay << RESTendl;
if (pay) {
fread(&dat, sizeof(uint16_t), 1, fInputBinFile);
frameBits += sizeof(uint16_t);
Expand All @@ -322,23 +322,23 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
fread(&pEnd, sizeof(DataPacketEnd), 1, fInputBinFile);
frameBits += sizeof(DataPacketEnd);

debug << "Read "
RESTDebug << "Read "
<< sampleCountRead * sizeof(uint16_t) + sizeof(DataPacketHeader) + sizeof(DataPacketEnd) +
sampleCountRead % 2 * sizeof(uint16_t)
<< " vs HeadSize " << ntohs(pHeader.size) << " Diff "
<< ntohs(pHeader.size) - (sampleCountRead + sizeof(DataPacketHeader) + sizeof(DataPacketEnd) +
sampleCountRead % 2)
<< endl;
debug << "Trailer_H " << ntohs(pEnd.crc1) << " Trailer_L " << ntohs(pEnd.crc2) << endl;
debug << "Trailer " << eventTime << "\n" << endl;
<< RESTendl;
RESTDebug << "Trailer_H " << ntohs(pEnd.crc1) << " Trailer_L " << ntohs(pEnd.crc2) << RESTendl;
RESTDebug << "Trailer " << eventTime << "\n" << RESTendl;

} // end while
totalBytesReaded += frameBits;

// printf("Event ID %d time stored
// %.3lf\n",fSignalEvent->GetID(),fSignalEvent->GetTime());

debug << "End of event " << endl;
RESTDebug << "End of event " << RESTendl;

return fSignalEvent;
}
Loading