Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit a387d290 authored by dino's avatar dino
Browse files

recovered r1283 from GANIL replayed on top of r1271 and its fake followers

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1284 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 1b36bb84
......@@ -13,11 +13,12 @@ set( CMAKE_MODULE_PATH "." )
################################################################
# Set the off-line version of the actors (no NRV_ONLINE for femul)
ADD_DEFINITIONS( -DNRV_TYPE=NRV_OFFLINE )
#ADD_DEFINITIONS( -DNRV_TYPE=NRV_OFFLINE )
ADD_DEFINITIONS( -DNRV_TYPE=NRV_ONLINE )
################################################################
# Select the threads library as THR_NONE, THR_BOOST or THR_STD
if( 1 ) # 0 to select from command line ( e.g. cmake . -DTHR_TYPE=THR_STD )
if( 0 ) # 0 to select from command line ( e.g. cmake . -DTHR_TYPE=THR_STD )
set( THR_TYPE THR_BOOST ) # default
endif()
......
......@@ -119,10 +119,12 @@ DISPATCHER BuilderName pseudo actor to connect the output of a chain to an i
thrLib::mutex ioMutex; // mutex for LOCK_COUT
#endif
#if NRV_TYPE == NRV_OFFLINE
// Replacement of Xavier's variable to ask producers to return from process_block even
// if the buffer is not yet full. This is just to avoid complaints from the compiler, not
// an implementation of the time-out mechanism (which is not very meaningful in off-line).
unsigned int library_timeout = 0;
#endif
// to control verbosity of the LogCollector (in topologyConfNew)
#include "CentralLog.h"
......@@ -344,6 +346,9 @@ void showWhat()
cout << "OS is Cygwin " << endl;
#endif
#if NRV_TYPE == NRV_ONLINE
cout << "ONLINE version " << endl;
#endif
#if THR_TYPE == THR_BOOST
cout << "Using boost " << BOOST_VERSION/100000 << "_" << (BOOST_VERSION/100)%1000 << "_" << BOOST_VERSION%100 << endl;
......

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "femul", "femul.vcproj", "{59103B92-AA2C-44A9-BEE6-FF49F8F8AAF7}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "femul", "femul.vcxproj", "{59103B92-AA2C-44A9-BEE6-FF49F8F8AAF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
......@@ -151,7 +151,11 @@ void EventBuilder::PrintStat()
cout << "Statistics of " << fActualClass << " after " << nevCount << " events" << endl;
cout << " # counts good mult";
cout << " [ rest badKey shifts errors maxIsize maxQsize firstTimestamp lastTimeStamp ]" << endl;
ULong64_t sumMult = 0;
ULong64_t totMult = 0;
for(UInt_t nn = 0; nn < nQueues; nn++) {
sumMult += ULong64_t(statKeys[nn]);
totMult += nn*ULong64_t(statKeys[nn]);
cout << setw(4) << nn << " "
<< setw(8) << evQue[nn].totCount << " "
<< setw(8) << evQue[nn].statChan << " "
......@@ -170,12 +174,19 @@ void EventBuilder::PrintStat()
<< "]" << endl;
}
if(statKeys[nQueues]) {
sumMult += ULong64_t(statKeys[nQueues]);
totMult += nQueues*ULong64_t(statKeys[nQueues]);
cout << setw(4) << nQueues << " "
<< " "
<< " "
<< setw(8) << statKeys[nQueues] << " ";
cout << endl;
}
double faver = double(totMult)/double(sumMult);
cout << " <mult> = ";
cout << fixed << setprecision(2) << setw(6) << double(totMult)/double(sumMult) << endl;
PrintDFAgentKeys("ADF keys at the end\n");
}
......@@ -324,7 +335,7 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
#ifdef EVB_MULTIHIST
{ // before moving it out, increment the tstamp-diff spectrum
int tq = int(evQue[nn].getTstamp() - minTstamp);
if(EvbSpecSbus && nn != minChain)
if(EvbSpecSbus /*&& nn != minChain*/)
EvbSpecSbus->Incr(tq);
if(EvbSpecTAC) {
EvbTqueue[qnum].first = nn; // save ID and timestamp for EvbSpecTAC
......@@ -681,7 +692,7 @@ UInt_t EventBuilder::GetParameters(const std::string& confFile, Bool_t doList)
conf.Add("TstampCorrect", "Queue Value", &ind1, &val1);
conf.Add("TstampLimits", "discard events outside this data-timestamp interval (seconds)", &secMin, &secMax);
conf.Add("TstampRegions", "tStampMin, tStampStep, TxtFile with 0/1 for each timestamp step", &tStampOffset, &tStampStep, &tStampFile);
conf.Add("RateProfile", "tStampMin, tStampStep, Length of rate-profile spectrum", &tStampOffset, &tStampStep, &tStampSize);
conf.Add("RateProfile", "tStampMin, tStampStep, Length of rate-profile spectrum", &tStampOffset, &tStampStep, &tStampSize);
conf.Add("Details", "bit1=tstamp_snapshots, bit2=queue_tstamp_diff, bit3=TAC for all pairs", &fDetails);
conf.Add("NoMultiHist", "exclude flat binary spectra", &fUseMultiHist);
conf.Add("Verbose", "verbosity of printouts", &fVerbose);
......@@ -939,13 +950,14 @@ void EventBuilder::PrintDFAgentKeys(std::string)
void EventBuilder::InitMultiHist(bool reset)
{
if(reset) {
EvbSpecSbus = NULL; // distribution of timestmp of accepted events
sTstamps = NULL; // fDetails_b1 LM of timestamp differences for the queues as seen by the event builder
EvbSpecRate = NULL; // "" spectrum of timestamp differences seen by the event builder
//evQueue::sTstDiff // fDetails_b2 LM of timestamp differences for each queue
EvbSpecTAC = NULL; // fDetails_b3
EvbTqueue = NULL; // "" detID and timestamp of the front events, to produce the pairwise TAC spectra
EvbSpecStep = NULL; // accepted_events / time_slot
EvbSpecSbus = NULL; // distribution of timestmp of accepted events
sTstamps = NULL; // fDetails_b1 LM of timestamp differences for the queues as seen by the event builder
EvbSpecRate = NULL; // fDetails_b1 spectrum of timestamp differences seen by the event builder
//evQueue::sTstDiff // fDetails_b2 LM of timestamp differences [for each queue]
EvbSpecTAC = NULL; // fDetails_b3 TS-TS TAC spectra for all pairs
EvbTqueue = NULL; // fDetails_b3 detID and timestamp of the front events, to produce the pairwise TAC spectra
EvbSpecStep = NULL; // accepted_events / time_slot
//evQueue::EvqSpecStep // event requests / time_slot [for each queue]
fUseMultiHist = true;
return;
}
......
......@@ -185,12 +185,12 @@ protected:
#ifdef EVB_MULTIHIST
MultiHistGroup hGroup; // used to record the pointers of all defined MultiHist spectra
MultiHist<unsigned int> *EvbSpecSbus; // distribution of timestmp of accepted events
MultiHist<unsigned int> *EvbSpecSbus; // distribution of timestmp of accepted events
sAppend<UInt_t> *sTstamps; // fDetails_b1 LM of timestamp differences for the queues as seen by the event builder
MultiHist<unsigned int> *EvbSpecRate; // "" spectrum of timestamp differences (ms) seen by the event builder
//evQueue::sTstDiff // fDetails_b2 LM of timestamp differences for each queue
MultiHist<unsigned int> *EvbSpecTAC; // fDetails_b3
std::pair<int, int> *EvbTqueue; // "" detID and timestamp of the front events, to produce the pairwise TAC spectra
MultiHist<unsigned int> *EvbSpecRate; // fDetails_b1 spectrum of timestamp differences (ms) seen by the event builder
///////// evQueue::sTstDiff // fDetails_b2 LM of timestamp differences [for each queue]
MultiHist<unsigned int> *EvbSpecTAC; // fDetails_b3 TS-TS TAC spectra for all pairs
std::pair<int, int> *EvbTqueue; // fDetails_b3 detID and timestamp of the front events, to produce the pairwise TAC spectra
MultiHist<unsigned int> *EvbSpecStep; // accepted_events / time_slot
void InitMultiHist(bool reset=false);
#else
......
......@@ -10,7 +10,6 @@ using namespace std;
#define EXCLUDE_TST_ZERO // discard events with timestamp=0; count them as errors
//#define CHECK_DETAILS // DEBUG
const bool discardOutOfOrderEvents = true; // if true, doReorderEvents is redundant
const bool doReorderEvents = true; // fix timestamp inversion events while they are inserted into the queue
UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr)
......@@ -82,17 +81,10 @@ UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr)
tstNew += tstCorr; // apply timestamp correction
if (tstNew < tstLast) {
if(tstNew < tstLast)
errCount++; // timestamp inversions counted as errors
if (discardOutOfOrderEvents) {
i4dat += i4len; // remove this event from the input buffer
n4dat -= i4len;
continue;
}
}
if (tstNew >= tstLast || numEvts == 0 || !doReorderEvents) {
if(!doReorderEvents || tstNew >= tstLast || numEvts==0) {
// don't care, or no inversion, or queue is empty
memcpy(data+indNext, i4dat, i4len*sizeof(UInt_t));
if(tstCorr)
......
......@@ -114,7 +114,7 @@ public:
UInt_t validSize; // kQueueSize minus the size of a key-only frame
Bool_t EodInserted; // queue has been closed by a frame with timestamp==0xFFFFFFFFFFFFFFFF
std::string myBuilder; // name of the specific EventBuilder
sAppend<Int_t> *sTstDiff; // to generate the distribution of timestamp differences between events
sAppend<Int_t>*sTstDiff; // distribution of timestamp differences between events (instantiated and saved by EventBuilder)
ULong64_t tstVeryFirst; // timestamp of first event seen by this queue
ULong64_t tstVeryLast; // timestamp of last event seen by this queue
ULong64_t tstOld; // ""
......
......@@ -660,15 +660,15 @@ float MWD::MWtransampl(float *pdat, unsigned int ch1)
// timing filter amplifier followed by a CFD
// the intermediate traces can be retrieved by MWgetShortTFA and MWgetShortCFD
// Per il caso dell'analisi di tracce corte di AGATA, che sono state gi catturate da un loro
// trigger di tipo LE, l'analisi si pu semplificare parecchio perch sappiamo che, se il canale
// ha segnale (cosa che sappiamo dalla misura dell'energia) il punto di trigger esiste, quasi
// sempre unico ed in una zona che sta nella prima met della traccia.
// Per il caso dell'analisi di tracce corte di AGATA, che sono state gia' catturate da un loro
// trigger di tipo LE, l'analisi si puo' semplificare parecchio perche' se il canale ha segnale
// (cosa che sappiamo dalla misura dell'energia) il punto di trigger esiste, quasi sempre unico
// ed e' in una zona che sta nella prima meta' della traccia.
// Dunque:
// 1) non necessario differenziare
// 2) lo shaping CFD (1 0 0 .. 0 -g) produce un segnale negativo alla fine della traccia
// 3) si pu cercare il punto di ZC (da - a +) partendo da sinistra
// 4) lo si pu interpolare con una parabola (?)
// 3) si pu cercare il punto di ZC (da - a +) partendo da destra
// 4) lo si puo' interpolare con una parabola (?)
// 5) una volta trovato si potrebbe estrapolare a zero direttamente dal segnale originale (??) (Kalman??)
//#define INTERPOLCFD
......
......@@ -61,9 +61,9 @@ PSAFilter::PSAFilter() :
fPsaSlots = fPsaCount*fPsaModulo;
theBlocks = NULL;
#elif THR_TYPE == THR_STD
fPsaCount = TCOUNT;
fPsaCount = TCOUNT;
fPsaModulo = TMODULO;
fPsaSlots = fPsaCount*fPsaModulo;
fPsaSlots = fPsaCount*fPsaModulo;
#else
fPsaCount = 0;
fPsaModulo = 1;
......@@ -692,6 +692,12 @@ UInt_t PSAFilter::ProcessBlockAsync(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
std::vector<int> firstSlot(fPsaCount, -1);
std::vector<int> countSlot(fPsaCount, 0);
//#define ADETAILS
#ifdef ADETAILS
std::chrono::milliseconds span(5);
#endif
int anumb = 0;
int block = 0;
int slot = 0;
firstSlot[block] = slot;
......@@ -714,9 +720,14 @@ UInt_t PSAFilter::ProcessBlockAsync(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
// launch the block
VR[block] = std::async(std::launch::async, [=]() { return Process(firstSlot[block], countSlot[block]); }); // std::launch::deferred
busy[block] = true;
anumb++;
// switch to next block
block = (block + 1) % fPsaCount;
if (busy[block]) {
#ifdef ADETAILS
while (VR[block].wait_for(span) == std::future_status::timeout)
std::cout << block;
#endif
// had data, so get result and process it
Int_t result = VR[block].get();
busy[block] = false;
......@@ -737,6 +748,7 @@ UInt_t PSAFilter::ProcessBlockAsync(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
// send events of the last, partially filled block
VR[block] = std::async(std::launch::async, [=]() { return Process(firstSlot[block], countSlot[block]); }); // std::launch::deferred
busy[block] = true;
anumb++;
block = (block + 1) % fPsaCount;
}
......@@ -745,6 +757,10 @@ UInt_t PSAFilter::ProcessBlockAsync(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
for (int nn = blz; nn < blz + fPsaCount; nn++) {
block = nn%fPsaCount;
if (busy[block]) {
#ifdef ADETAILS
while (VR[block].wait_for(span) == std::future_status::timeout)
std::cout << char(block + 97);
#endif
Int_t result = VR[block].get();
busy[block] = false;
error_code = PostProcess(firstSlot[block], countSlot[block]);
......@@ -752,6 +768,9 @@ UInt_t PSAFilter::ProcessBlockAsync(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
break;
}
}
#ifdef ADETAILS
cout << "=" << anumb;
#endif
//if (error_code) {
for (int block = 0; block < fPsaCount; block++) {
......
......@@ -895,7 +895,6 @@ Int_t PostPSAFilter::Process()
}
#endif
// 12) fix the timing
CoreT[0] += fShiftTimeCC*0.1f;
//CoreT[1] += fShiftTimeCC*0.1f; // leave here the old value
......@@ -989,27 +988,7 @@ Int_t PostPSAFilter::Process()
}
#ifdef PPS_MULTIHIST
// 16-1) flat histograms of the final event
if (PostSpecEner) {
float efinalSG = 0;
float efinalCC = 0;
for (UInt_t nh = 0; nh < number_of_hits; nh++) {
locHit_t *pLoc = locHit + nh;
if (!pLoc->valid)
continue;
int netSeg = pLoc->Sg;
PostSpecEner->Incr(4, netSeg, (int)(pLoc->eSGcorr*fEnergyGain)); //
PostSpecEner->Incr(4, kNSG, (int)(pLoc->eSGcorr*fEnergyGain)); // 36 OR SG
PostSpecEner->Incr(4, kNSG + 1, (int)(pLoc->eCCcorr*fEnergyGain)); // 37 OR CC
efinalSG += pLoc->eSGcorr;
efinalCC += pLoc->eCCcorr;
}
PostSpecEner->Incr(4, kNSG + 2, (int)(efinalSG*fEnergyGain)); // 38 sum of segments
PostSpecEner->Incr(4, kNSG + 3, (int)(CoreE[0]*fEnergyGain)); // 39 core
}
// 16-2) repeat PostMatrXYZ, but only for total projections, placed at the last position
// 16) repeat PostMatrXYZ, but only for total projections, placed at the last position
if(PostMatrXYZ && (fSegCenter || fDetCenter)) {
#define xAddr(fx) ( int((fx+matOff)/matPack) )
......@@ -1149,7 +1128,7 @@ void PostPSAFilter::InitMultiHist(bool reset)
if(!fUseMultiHist)
return;
PostSpecEner = new MultiHist<unsigned int>(5, 40, specLenE);
PostSpecEner = new MultiHist<unsigned int>(4, 40, specLenE);
PostSpecEner->setFileName(fOdirPrefix+"Post?Ener.spec");
PostSpecEner->setComment("Energy spectra before and after Trapping correction");
hGroup.add(PostSpecEner);
......
......@@ -498,7 +498,7 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
char chtmp[100];
fAncRawFrameNum = fAncRawFrameNum > 9 ? 9 : fAncRawFrameNum;
fAncRawFrameNum = fAncRawFrameNum < 0 ? 0 : fAncRawFrameNum;
//fAncRawFrameNum = fAncRawFrameNum < 0 ? 0 : fAncRawFrameNum; // always true with UInt_t
sprintf(chtmp, "data:ranc%d", fAncRawFrameNum);
fAncRawFrameStr = string(chtmp);
cout << endl;
......@@ -743,7 +743,8 @@ UInt_t TrackingFilter::ProcessBlock(ADF::FrameBlock &inBlock, ADF::FrameBlock &o
}
}
#endif
continue; // UNCOMMENT THIS LINE TO AVOID PASSING THESE EVENTS TO THE POST-PROCESSING AND TO THE OUTPUT
if(fDiscardEmpty)
continue;
}
// Analysis after tracking (writing the root tree and various histograms)
......
......@@ -8,6 +8,10 @@
///////////////////// some useful macros and functions /////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
#ifndef M_PI
# define M_PI 3.1415926535897932384626433
#endif
#define DEG2RAD (M_PI/180.) // conversion degrees -> radiants
#define RAD2DEG (180./M_PI) // conversion radiants -> degrees
......
......@@ -11,14 +11,14 @@
void swapd(double v[], int m, int l)
{
register double temp;
double temp;
temp = v[m];
v[m] = v[l];
v[l] = temp;
}
void swapi(int v[], int m, int l)
{
register int temp;
int temp;
temp = v[m];
v[m] = v[l];
v[l] = temp;
......@@ -26,8 +26,8 @@ void swapi(int v[], int m, int l)
void swapp(posi3D v[], int m, int l)
{
register double dtmp;
register int itmp;
double dtmp;
int itmp;
dtmp = v[m].x; v[m].x = v[l].x; v[l].x = dtmp;
dtmp = v[m].y; v[m].y = v[l].y; v[l].y = dtmp;
dtmp = v[m].z; v[m].z = v[l].z; v[l].z = dtmp;
......
......@@ -30,7 +30,7 @@ std::string AncillaryProducerTCP::gConfPath;
using namespace std;
#if NRV_TYPE != NRV_ONLINE && OS_TYPE != OS_APPLE
#if NRV_TCP != NRV_ONLINE && OS_TYPE != OS_APPLE
extern
#endif
unsigned int library_timeout;
......@@ -72,7 +72,7 @@ AncillaryProducerTCP::AncillaryProducerTCP ()
ptr_agava = NULL;
ptr_data = NULL;
#if NRV_TYPE == NRV_ONLINE
#if NRV_TCP == NRV_ONLINE
tcp_client = NULL;
#endif
}
......@@ -130,7 +130,7 @@ void AncillaryProducerTCP::process_initialise (uint32_t *error_code)
// exclude the off-line variants
fRawXDaq = 0;
fReBlock = 0;
#if NRV_TYPE == NRV_ONLINE
#if NRV_TCP == NRV_ONLINE
// Initialize the TCP socket server
cout << "trying to create a tcp_socket_server port " << endl;
tcp_listener = new tcp_socket_server();
......@@ -373,7 +373,7 @@ void AncillaryProducerTCP::process_stop(uint32_t *error_code)
*error_code = 0;
stop_called = true;
#if NRV_TYPE == NRV_OFFLINE
#if NRV_TCP == NRV_OFFLINE
// This is put here as femul calls process_stop synchronously at the very end of the job.
cServer.Finish(); // Must be called explicitely because Enrico has not implemented the destructor
#endif
......@@ -393,7 +393,7 @@ void AncillaryProducerTCP::process_stop(uint32_t *error_code)
// size_of_input_buffer = read_size_of_input_buffer = used_size_of_input_buffer = 0;
// old_event_still_present = false;
//
//#if NRV_TYPE == NRV_ONLINE
//#if NRV_TCP == NRV_ONLINE
// //close connection
// tcp_client->close();
// tcp_listener->close();
......@@ -404,7 +404,7 @@ void AncillaryProducerTCP::process_stop(uint32_t *error_code)
// if(output_file && output_file.is_open())
// output_file.close();
//
//#if NRV_TYPE == NRV_ONLINE
//#if NRV_TCP == NRV_ONLINE
// //free memory
// if(tcp_client) delete tcp_client;
// if(input_stream) delete input_stream;
......@@ -445,7 +445,7 @@ bool AncillaryProducerTCP::reset_stream(uint32_t *error_code)
return false;
}
#if NRV_TYPE == NRV_ONLINE
#if NRV_TCP == NRV_ONLINE
if(input_stream) {
if(fVerbose)
cout << "Close stream and wait for a new client connection..." << endl;
......
......@@ -13,7 +13,15 @@
#include "commonDefs.h"
#if NRV_TYPE != NRV_ONLINE
#define NRV_TCP NRV_TYPE // in this class we check NRV_TCP
#if 1 // 0 to use skstream
# if NRV_TYPE == NRV_ONLINE
# undef NRV_TCP
# define NRV_TCP NRV_OFFLINE // allows to ignore skstream
# endif
#endif
#if NRV_TCP != NRV_ONLINE
#define AF_INHERITS_FROM_NARVAL_PRODUCER
#endif
......@@ -39,7 +47,7 @@ typedef int int32_t;
# include <sys/types.h>
# include <cstdlib>
# include <unistd.h> //Needed only for sleep function
# if NRV_TYPE == NRV_ONLINE
# if NRV_TCP == NRV_ONLINE
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h> //Needed for the endianness correction
......@@ -143,7 +151,7 @@ private:
std::ifstream input_file;
std::istream* input_stream;
#if NRV_TYPE == NRV_ONLINE
#if NRV_TCP == NRV_ONLINE
tcp_socket_server* tcp_listener; // TCP server socket
tcp_socket_stream* tcp_client; // Stream from TCP client or from file
#endif
......@@ -161,7 +169,7 @@ private:
// Returns pointers to next event, reading new buffers if needed
bool read_event(uint32_t *error_code);
#if NRV_TYPE != NRV_ONLINE && OS_TYPE != OS_APPLE
#if NRV_TCP != NRV_ONLINE && OS_TYPE != OS_APPLE
uint32_t htonl(uint32_t iv) {
uint32_t ov = (iv&0xFF000000) >> 24 |
(iv&0x00FF0000) >> 8 |
......
......@@ -68,7 +68,7 @@ fTrigger("data:crystal")
fSmokeGain = 1; // default gain
fInputDataFile.clear();
fWriteTstampDiff = false;
fVerbose = false;
crystal_id = 0;
crystal_status = 0;
......@@ -184,7 +184,7 @@ UInt_t CrystalProducer::GetParameters(const std::string& confFile, Bool_t doList
conf.Add("TstampCorrection", "modify timestamp of events", &fTstampCorr);
conf.Add("DomainID", "ID of trigger-domain", &fDomainID);
conf.Add("CrystalID", "ID of crystal", &fCrystalID);
conf.Add("WriteDataMask", "0=none 1=input_mezzdata 2=event_mezzdata 4=event_mezzhead 8=event_energy 16=event_core 32=tstampdiff", &fWriteDataMask);
conf.Add("WriteDataMask", "0=none 1=input_mezzdata 2=event_mezzdata 4=event_mezzhead 8=event_energy 16=event_core 32=event_adfkey", &fWriteDataMask);
conf.Add("DecimateMezzdata", "write out one every num events", &fDecimateMezzData);
conf.Add("DecimateMezzener", "write out one every num events", &fDecimateMezzEner);
conf.Add("WriteUnCompressed", "event_mezzdata written uncompressed", &fWriteUnCompressed);
......@@ -196,7 +196,8 @@ UInt_t CrystalProducer::GetParameters(const std::string& confFile, Bool_t doList
conf.Add("TraceLength", "length of traces (samples)", &fTraceLengthRaw);
conf.Add("ValidationRate", "define size of buffers in the ATCA ouput driver", &fValidationRate);
conf.Add("WriteTraces", "number of events for file of the original traces", &fWriteNumTraces);
conf.Add("WriteBaseLines", "enable list-mode file of pre-trigger-averaged baselines with a decimation factor of (%d)", &fWriteBaselines);
conf.Add("WriteBaseLines", "list-mode of pre-trigger-averaged baselines with a decimation factor of (%d)", &fWriteBaselines);
conf.Add("WriteTstampDiff", "list-mode of time stamp differences between successive events", &fWriteTstampDiff);
conf.Add("ProjeM1", "MinSegAmpli SpekGain for single-hit amplitude spectra used for energy calibration", &fMinSegAmpli, &fSpekGain);
conf.Add("ProjeRawWidth", "number of samples used for the amplitude spectra derived from traces (0 == not done)", &fRawAmpWidth);
conf.Add("SmokeCC", "enable calculating smoke plot for the core (0..1); amplitude calibrated as f1+f2*ampli", &fSmokeCC, &fSmokeOffs, &fSmokeGain);
......
......@@ -53,7 +53,7 @@ protected:
std::string fOdirPrefix;
Long64_t fTstampCorr;
UInt_t fWriteDataMask; // 0=none, 1=input_mezzdata[], 2=event_mezzdata 4=event_mezzhead 8=event_energy 16=event_core, 32=event_tstdiff
UInt_t fWriteDataMask; // 0=none, 1=input_mezzdata[], 2=event_mezzdata 4=event_mezzhead 8=event_energy 16=event_core, 32=event_adfkey
UInt_t fDecimateMezzData; // write one every fDecimateMezzData
UInt_t fDecimateMezzEner; // write one every fDecimateMezzEner
Int_t fWriteDataMinAmpl; // event written to event_mezzdata.bdat only if CC[0] amplitude > fWriteDataThreshold
......@@ -77,6 +77,7 @@ protected:
Int_t fSmokeCC, fSmokeSG; // smoke plot for the given CC or SG;
Float_t fSmokeOffs, fSmokeGain; // scaling and offset for the amplitude axis
std::string fInputDataFile; // filename of raw data, used to simplify the decoding of CrystalProducerATCA.conf
Bool_t fWriteTstampDiff; // list-mode of time stamp differences
Bool_t fVerbose;
Bool_t fUseMultiHist;
......
......@@ -56,7 +56,7 @@ const int nSG = 36;
const int nCC = 2;
CrystalProducerATCA::CrystalProducerATCA():
DAQ_NFILE(0), DAQ_NMEZZ(0), ANA_NSEGS(0),
DAQ_NFILE(0), DAQ_NMEZZ(0), ANA_NSEGS(0), DAQ_GGP(false),
FA(NULL), MZ(NULL), CC(NULL), PR(NULL), mezzFound(NULL), mezzToGet(0),
nfiles(0), fnstep(1), bReaFromFile(false),
maxDiff(0), expDiff(0), bStartCalled(false),
......@@ -216,10 +216,9 @@ Int_t CrystalProducerATCA::AlgoInitialise()
fProdBaseCount = 0;
}
bWriteTstampDiff = (writeDataMask&32) != 0;
if(bWriteTstampDiff) {
writeDataMask &= ~32; // switch off the bit because this part managed by Process(), not by WriteOriginalData()
sTstampDiff = new sAppend<UInt_t>(fOdirPrefix+"event_tstdiff.bdat", 2048);
if(fWriteTstampDiff) {
bWriteTstampDiff = true;
sTstampDiff = new sAppend<UInt_t>(fOdirPrefix+"Prod__0-1000-UI__tstdiff.bdat", 10000);
}
File_Finished = false;
......@@ -361,9 +360,9 @@ UInt_t CrystalProducerATCA::ProcessBlock (ADF::FrameBlock &outBlock)
used_size_of_output_buffer = UInt_t(outBlock.GetSize());
// save original data to disk in various formats (writeDataMask tested only for 2,4,8,16)
// save original data to disk in various formats
if(writeDataMask) {
error_code = WriteOriginalData(evnumber, timestamp); // writeDataMask tested only for 2,4,8,16
error_code = WriteOriginalData(evnumber, timestamp); // writeDataMask tested only for 2,4,8,16,32
if(error_code) {
LOCK_COUT;
Log.SetProcessMethod("CrystalProducerATCA::process_block");
......@@ -791,6 +790,10 @@ bool CrystalProducerATCA::Decodesetup(std::string setupFile, std::string odirPre
return false;
}
DAQ_GGP = DAQ_NFILE==1 && DAQ_NMEZZ==1 && ANA_NSEGS>6;
if(DAQ_GGP)
cout << "Assumed to be ggp data " << endl;
if(bReaFromFile && DAQ_NFILE!=1) {
cout << "Number of files changed to 1 to read from file" << endl;
cout << "The definition of mezzanines will be changed accordingly" << endl;
......@@ -833,7 +836,7 @@ bool CrystalProducerATCA::Decodesetup(std::string setupFile, std::string odirPre
FA[filenum].crystID = fCrystalID;
FA[filenum].domainID = fDomainID;
FA[filenum].numMezz = ncards;
FA[filenum].setFileName(fIdirPrefix+fname);
FA[filenum].setFileName(fname);
FA[filenum].bStatistics = bStatistics;
}
else {
......@@ -979,7 +982,7 @@ bool CrystalProducerATCA::InitATCA(bool writeOriginal)
// On-line performance should be checked (in the past we had ~20 kHz)
for(int nn = 0; nn < DAQ_NFILE; nn++) {
//ok = FA[nn].Reset(fTraceLengthRaw, 6, writeOriginal, odir, cps);
ok = FA[nn].Reset(fTraceLengthRaw, MZ[FA[nn].oneMezz].nChan, writeOriginal, odir, cps);
ok = FA[nn].Reset(fTraceLengthRaw, MZ[FA[nn].oneMezz].nChan, writeOriginal, odir, DAQ_GGP, cps);
if(!ok)
return false;
FA[nn].SetDomain(fDomainID);
......@@ -1048,8 +1051,8 @@ unsigned int CrystalProducerATCA::NextEventATCA(unsigned int *pTimeout)
return kEvFinish;
retVal |= retMask;
mezzFound[nn] = true;
//if(--mezzToGet == 0) // mettere in funzione questo una volta capito perch mezzToGet va sotto zero
//break; // (probabilmente perch process_start viene chiamato dopo process_block)
//if(--mezzToGet == 0) // mettere in funzione questo una volta capito perche' mezzToGet va sotto zero
//break; // (probabilmente perche' process_start viene chiamato dopo process_block)
mezzToGet--;
if(mezzToGet < 0) {
DEBUG_LINE << " mezzToGet = " << mezzToGet << " retMask = " << retMask << endl;
......@@ -1167,7 +1170,12 @@ int CrystalProducerATCA::CheckEvnum()
int CrystalProducerATCA::WriteOriginalData(unsigned int evNumb, unsigned long long tStamp)
{
bool doIt = true;
if(fWriteDataRange) {
if (MZ[0].isIdle()) { // don't write idles