Skip to content
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
2 changes: 1 addition & 1 deletion applications/dogma/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example for DOGMA file processing
# Example for new DOGMA file processing

Configure TRB and TDCs to process DLD file
While DLD file has only one level - HLD processor not involved
53 changes: 19 additions & 34 deletions applications/dogma/first.C
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,36 @@ void first()
base::ProcMgr::instance()->SetHistFilling(4);

// this limits used for liner calibrations when nothing else is available
hadaq::TdcMessage::SetFineLimits(31, 491);
hadaq::TdcMessage::SetFineLimits(80, 1190);

hadaq::TdcProcessor::SetTriggerDWindow(-10, 90);

// default number of fine bins
hadaq::TdcProcessor::SetDefaults(1250);

// default channel numbers and edges mask
// 1 - use only rising edge, falling edge is ignore
// 2 - falling edge enabled and fully independent from rising edge
// 3 - falling edge enabled and uses calibration from rising edge
// 4 - falling edge enabled and common statistic is used for calibration
hadaq::TrbProcessor::SetDefaults(33, 2);
hadaq::TrbProcessor::SetDefaults(8, 2);

// [min..max] range for TDC ids
hadaq::TrbProcessor::SetTDCRange(0x1000, 0x7FFF);
// not used now while IDs are very wide range
// hadaq::TrbProcessor::SetTDCRange(0x1000, 0x7FFF);

// true indicates that dogma data are expected
auto proc = new hadaq::TrbProcessor(0, nullptr, 4, true);

proc->CreateTDC(0x101e, 0x601e);
auto vect = proc->CreateTDC5(0x0a7b00de);

// enable handling 0xD trigger signals for references
hadaq::TdcProcessor::SetUseDTrigForRef(true);

for (auto tdc : vect) {
for (int nch = 1; nch < 8; nch++)
tdc->SetRefChannel(nch, nch - 1, tdc->GetID(), 2000, -10., 10.);
}

// first parameter if filename prefix for calibration files
// and calibration mode (empty string - no file I/O)
Expand All @@ -44,7 +58,7 @@ void first()
// (1 << 0xD) - special 0XD trigger with internal pulser, used also for TOT calibration
// 0x3FFF - all kinds of trigger types will be used for calibration (excluding 0xE and 0xF)
// 0x80000000 in mask enables usage of temperature correction
proc->ConfigureCalibration("dogmacal", 100000, 0x3fff);
proc->ConfigureCalibration("tdc5cal", 50000, 0x3fff);

// only accept trigger type 0x1 when storing file
// new hadaq::HldFilter(0x1);
Expand All @@ -58,32 +72,3 @@ void first()
// 3 - std::vector<hadaq::MessageDouble> - compact form, with channel 0, absolute time stamp as double
base::ProcMgr::instance()->SetStoreKind(0);
}

// extern "C" required by DABC to find function from compiled code

extern "C" void after_create(hadaq::HldProcessor* hld)
{
printf("Called after all sub-components are created\n");

if (hld==0) return;

for (unsigned k=0;k<hld->NumberOfTRB();k++) {
hadaq::TrbProcessor* trb = hld->GetTRB(k);
if (trb==0) continue;
printf("Configure %s!\n", trb->GetName());
trb->SetPrintErrors(10);
}

for (unsigned k=0;k<hld->NumberOfTDC();k++) {
hadaq::TdcProcessor* tdc = hld->GetTDC(k);
if (tdc==0) continue;

printf("Configure %s!\n", tdc->GetName());

// tdc->SetUseLastHit(true);
for (unsigned nch=2;nch<tdc->NumChannels();nch++)
tdc->SetRefChannel(nch, 1, 0xffff, 2000, -10., 10.);
}
}


7 changes: 6 additions & 1 deletion framework/base/Processor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ base::Processor::Processor(const char* name, unsigned brdid) :
{
if (brdid != DummyBrdId) {
char sbuf[100];
unsigned mask = strstr(name, "%06X") ? 0xffffff : 0xffff;
unsigned mask = 0xffff;
if (strstr(name, "%06X"))
mask = 0xffffff;
else if (strstr(name, "%08X"))
mask = 0xffffffff;

snprintf(sbuf, sizeof(sbuf), name, brdid & mask);
fName = sbuf;
fID = brdid;
Expand Down
36 changes: 18 additions & 18 deletions framework/hadaq/MdcProcessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ hadaq::MdcProcessor::MdcProcessor(TrbProcessor* trb, unsigned subid) :
if (HistFillLevel() > 1) {
alldeltaT = MakeH1("alldeltaT", "", 6000, -2099.8, 300.2);
allToT = MakeH1("allToT", "", 1650, 0.2, 1100.2);
Errors = MakeH1("Errors", "", TDCCHANNELS, -0.5, TDCCHANNELS-0.5);
Errors = MakeH1("Errors", "", TDCCHANNELS, -0.5, (int) TDCCHANNELS - 0.5);
ToT = MakeH2("ToT", "", TDCCHANNELS, 0, TDCCHANNELS, 550, 0.2, 1100.2);
deltaT = MakeH2("deltaT", "", TDCCHANNELS, 0, TDCCHANNELS, 600, -2099.8, 300.2);
deltaT_ToT = MakeH2("deltaT_ToT", "", 600, -2099.8, 300.2, 550, 0.2, 1100.2);

Hits[0] = MakeH2("Hit0","", 600, -2099.8, 300.2, 550, 0.2, 1100.2);
Hits[1] = MakeH2("Hit1","", 600, -2099.8, 300.2, 550, 0.2, 1100.2);
// Hits[2] = MakeH2("Hit2","", 600, -2099.8, 300.2, 550, 0.2, 1100.2);
Expand Down Expand Up @@ -104,21 +104,21 @@ bool hadaq::MdcProcessor::FirstBufferScan(const base::Buffer &buf)
signed reference = data0 & 0x1FFF;

int numhits = 0, numerrs = 0;

int hitsperchannel[TDCCHANNELS] = {0};
// float last_timeToT = 0;
// float last_timeDiff = 0;
// float last_timeDiff1 = 0;

// int numlongtot = 0;
// int haslongtot[TDCCHANNELS] = {0};

for (unsigned n = 1; n < len; n++) {
uint32_t data = arr[n];
unsigned channel = data >> 27;

hitsperchannel[channel]++;

if ((data >> 26) & 1) {
numerrs++;
FillH1(Errors, channel);
Expand Down Expand Up @@ -172,24 +172,24 @@ bool hadaq::MdcProcessor::FirstBufferScan(const base::Buffer &buf)
// FillH1(allToT, timeToT);
// FillH2(deltaT_ToT, timeDiff, timeToT);
// FillH2(T0_T1, timeDiff, timeDiff1);
//
//
// if (hChToTHld)
// SetH2Content(*hChToTHld, fHldId, channel, timeToT);
//
//
// if (hChDeltaTHld)
// SetH2Content(*hChDeltaTHld, fHldId, channel, timeDiff);
//
//
// if (HistFillLevel() > 2) {
// FillH1(tot_h[channel], timeToT);
// FillH2(potato_h[channel], timeDiff, timeToT);
// FillH1(t1_h[channel], timeDiff);
// }
}
// if(channel==6) {
// if(channel==6) {
// if(hitsperchannel[channel] < 5) {
// if(hitsperchannel[channel]==1 || haslongtot[channel])
// FillH2(Hits[hitsperchannel[channel]-1], timeDiff, timeToT);
// }
// }
/* if(hitsperchannel[channel] == 1) {
FillH2(Hits[0], timeDiff, timeToT);
}
Expand All @@ -198,30 +198,30 @@ bool hadaq::MdcProcessor::FirstBufferScan(const base::Buffer &buf)
}
if(channel>=2 && hitsperchannel[channel-2] == 0 && hitsperchannel[channel-1] == 0 && hitsperchannel[channel] == 1 && (arr[n+1] >> 27) != channel+1 && (arr[n+1] >> 27) != channel+2) {
FillH2(Hits[2], timeDiff, timeToT);
}
}
if(channel>=1 && hitsperchannel[channel-1] == 0 && hitsperchannel[channel] == 1 && (arr[n+1] >> 27) != channel+1) {
FillH2(Hits[3], timeDiff, timeToT);
} */
// }
} */
// }
// if(channel==13 && channel>=1 && (hitsperchannel[channel-1] >= 1) && hitsperchannel[channel] == 1) {
// FillH2(ToTToT[0], last_timeToT, timeToT);
// FillH2(ToTToT[1], last_timeDiff, timeDiff);
// FillH2(ToTToT[2], last_timeDiff1, timeDiff1);
// FillH2(ToTToT[3], timeDiff-last_timeDiff, timeDiff1-last_timeDiff1);
// }

// if(timeToT > 150) {
// numlongtot++;
// haslongtot[channel]++;
// }
// last_timeToT = timeToT;

// last_timeToT = timeToT;
// last_timeDiff = timeDiff;
// last_timeDiff1 = timeDiff1;
}

// FillH1(longToT,numlongtot);

if (hHitsHld)
DefFillH1(*hHitsHld, fHldId, numhits);

Expand Down
Loading