[EMCAL-610, EMCAL-659, EMCAL-661] EMCAL digit to raw converter stand alone application#4045
[EMCAL-610, EMCAL-659, EMCAL-661] EMCAL digit to raw converter stand alone application#4045shahor02 merged 5 commits intoAliceO2Group:devfrom
Conversation
|
Pull request will be extended by a stand-alone application converting digit files to raw data (separate ticket ID). |
|
@shahor02 @sawenzel The first IR should be the same for the digitizer and for the raw writer, how do we propagate it in the best way. Currently for EMCAL the digits vector contains all digits in the timeframe, separated by triggers using a second vector with a range reference marking the digits belonging to the same readout window (trigger). This is done in order to implement the handling of pileup in the EMCAL. Live/Dead times are handled there as well. In the digitizer we use the collision context to get the IR, set the detector live for the first trigger, accumulate digits from collisions within the 1.5 ms readout window digitised using the EMCAL time response, and set the detector busy afterwards. Therefore even though for the moment the first collision opens the EMCAL readout window we cannot blindly use the first IR in the timeframe as in the future it might not be the first collision. |
|
Hi @mfasDa I have not really understood the question. The 1st IR of digitization can be anything, it is where the collision happened (currently the sampling starts for orbit/bc = 1/0, can be overridden by --firstOrbit, --firstBC options to digitizer), the 1st IR of raw data is the start of the 1st TF, i.e. detectors data packaging (defined by the configurable param AliceO2/Detectors/Raw/include/DetectorsRaw/HBFUtils.h Lines 126 to 128 in b5b5389 Cheers, |
|
@shahor02 The problem is that our readout window with 1.5 mus >> bunch spacing with 25 ns. Therefore in the digitization in order to simulate pileup we integrate over as many collisions as we can fit into the readout window (-600 ns due to delays in the cable). Therefore we decided to store the digits not per event - which would be anyhow questionable with pileup - but per timeframe, splitting the digits vector in ranges belonging to the same readout window. Therefore we assume in the digitization that all collisions we loop over belong to the same timeframe, and we push the digits vector once per timeframe. Doing this, we must have the same timing definition in the digitizer and the raw writer. We could simply mark the first IR but it might be that EMCAL will not trigger at the first IR and therefore set a wrong IR as first IR - which should be common for all detectors. Otherwise I would be curious how other detectors do it - in particular the continuous detectors must integrate in the digitization over many events and are busy at the end of timeframe, no? |
|
@mfasDa: all detectors store their data in this way, ITS readout window can be as large as 20 \mus, it does not matter. On the digitization level we don't have TF definition at all, but every digit is associated with well defined BC (when the trigger or strobe started). It is irrelevant what other (later) BCs will contribute to this digit, at digit->raw conversion it goes to the TF which its opening BC belongs to. |
|
@shahor02 OK, for us all the digits in the same open readout window have the same IR, the one of the trigger which opened the readout window, and the raw writer makes use of it. Shall we rather push digits in readout windows? |
|
Is not the digit already covering exactly a readout window? What do you mean pushing them in readout window? In terms of the RawWriter you add a payload for the IR of the beginning of the readout window.
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Markus Fasel <notifications@github.com>
Sent: Monday, August 3, 2020 2:24:13 PM
To: AliceO2Group/AliceO2 <AliceO2@noreply.github.com>
Cc: Ruben Shahoyan <shahor02@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [AliceO2Group/AliceO2] [EMCAL-610, EMCAL-659, EMCAL-661] EMCAL digit to raw converter stand alone application (#4045)
@shahor02<https://github.com/shahor02> OK, for us all the digits in the same open readout window have the same IR, the one of the trigger which opened the readout window, and the raw writer makes use of it. Shall we rather push digits in readout windows?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#4045 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABYKIDPP5AKDWV2TNE73OG3R62T63ANCNFSM4PI3CWYA>.
|
There was a problem hiding this comment.
Could you please add the following options:
-
possibility to produce 1 raw file per link (i.e. FEEID), this is preferred mode for replay using readout.exe. See how it is done e.g. for ITS:
-
parsing
configKeyValuesoptions, i.e.
This is necessary for e.g. generation of raw data with custom number of HBFs per TF.
Also, all detectors generate in the output directory a configuration file which can be provided to RawFileReader, this can be done by a simple call:
There was a problem hiding this comment.
All requests are added to the RawCreator + RawWriter is adapted.
There was a problem hiding this comment.
@mfasDa concerning the carryOverMethod: does the original data you provide to writer->addData(..) already contain the trailer (placeholder) which need to be finalized in carryOverMethod or you want to build it on the fly add and to every page payload, regardless if it the data need splitting or not?
What we discussed yesterday is to call carryOverMethod also for the last chunk if there was at least 1 splitting, but given this will be wrong if your data comes w/o trailer.
In the latter case, I would simply add an option (you will need to activate it for EMCal) to always call this method, even if splitting is not needed at all.
But if your original data contain a trailer, then it is more tricky, since it will need to be modified in the original data which is supposed to be const...
Additional point: the trailer string supplied by the method must be a multiple of 16B CRU word.
Is this is a case for the RCU trailer your create?
Also, if your original data do not contain a trailer (so it is added on top of the maxSize):
can the trailer size exceed one 16B word? In this case, if the maxSize estimated by the writer is 16B (minimal possible value), then you will get a negative actualSize.
There was a problem hiding this comment.
@shahor02 Currently the trailer is added at the end of the payload, containing the full payload size which is the number of 32bit ALTRO words in the payload sent to addData. In the hardware the trailer (size typically 9 32 bit ADC words) is added to every page and it contains the number of 10 bit words per page, so in the decoding I have to add the payload size from all the trailers belonging to the same page in order to know how the exact amount of words. In the simulation the trailers must be handled in the same way.
In the carryOverMethod implementation used now I read the trailer from the end-of-payload and replace the payload size with the payload size of the page, in the same way as it is done for ITSMFT. (This answers the first question with yes) This is rather trivial as the number of 8bit words just needs to be divided by 4. However the last trailer must be adapted as well and this I can only do once I know the size of the payload in the last page.
Concerning maxSize: I was under the impression this is the size of the page? The trailer would always be smaller. Did I misunderstand something?
There was a problem hiding this comment.
Hi @mfasDa
The maxSize is the number of bytes remaining in the current open page to reach 8KB limit (or the super-page to reach is limit, by default 1MB). So, ultimately, the maxSize can be just 16B. But if your data already contains the fixed-size trailer, this is not a problem. Since you are starting a new page for every trigger, I don't think you will have a situation of only 16B remaining on the 8KB page, it could happen if you add a new payload to a partially filled page. And in case of super-page filling there is a protection to not create a new page in the same super-page if less than 128B left (from which 64 will be taken by the RDH), so, you should be safe.
Basically, for the EMCAL I will need the writer will need to call carryOverMethod for the very last chunk (where no splitting is actually needed) and instead of adding the supplied trailer after writing the payload (as it would do if there is a real splitting) it should overwrite the last carryOverTrailer.size() bytes, is this correct?
There was a problem hiding this comment.
@mfasDa please check if #4179 is what you want. You will need to enable the carry-over call for the last chunk by RawFileWriter::setApplyCarryOverToLastPage(true); and detect such a call as the modified test shows: https://github.com/AliceO2Group/AliceO2/blob/863c3435580f5fbe1bc34870f4a40a31f45aea82/Detectors/Raw/test/testRawReaderWriter.cxx#L166-L170
There was a problem hiding this comment.
Hi @shahor02, yes, the conclusion is correct. The carryOverMethod currently sets the payload size to the trailer whenever it is called. So since the end of data contains the trailer either it has to be overwritten by the RawFileWriter or our custom carryOverMethod. In the second case I would not add a trailer but modify it myself (probably overall easier). In this case I would need to know that we are on the last page.
There was a problem hiding this comment.
@mfasDa as far as I can see, your carryOverMethod sets the returned actual size to maxSize - trailer.size, this is ok except when you are on the last chunk: in this case the you should return the original maxSize as an actual payload to write and supply the modified trailer string. The writer will overtwrite last trailer.size() of the payload last chunk by this modified trailer. You cannot modify in the carry-over method the original data: it is const gsl::span, just provide an updated trailer to override the one in the payload.
There was a problem hiding this comment.
OK, so I only need to know that I am on the last page to include the trailer size in the from the actual size. I was thinking to take this from the payload size but in principle the page could be 8 kB. Anything that tells me how much data is still to come? I.e. the gsl::span contains the full data or the data starting from the page?
There was a problem hiding this comment.
The const gsl::span<char> data refers to the full original payload you provided to addData, const char* ptr
is start of data yet to write (can be anything between data.begin() and data.end()) and the int maxSize is the max number of bytes the writer can write (starting from the ptr) to currently open 8kb page.
You can detect that you are on the last page by
AliceO2/Detectors/Raw/test/testRawReaderWriter.cxx
Lines 166 to 167 in 72e4fba
- Replace usage of RawOutputPageHandler with RawFileWriter for output streaming - Initialize RawFileWriter using a single output file and a linear link assignment for C-RORC/Link ID untill final link assignment on production FLPs is fixed - Convert input handing from std::vectors to gsl::span
…conversion Stand alone application reading digits file and processing digits to raw conversion for each timeframe entry in the digits tree. Open points: - First IR need to be specified for methods in RawFileWriter - Raw writer settings to come from the CCDB
…h raw page CarryOverMethod cuts the payload in size - size of the RCU trailer and adds the RCU trailer from the last page, in which the payload size is adapted to the size in the page.
- Add option to split to file per full detector, subdector or crorc+link - Change rawfile to output location in order to support multiple raw files - Add parising of the configuration file in order to configure tf handling - Add writing of the output config - Remove obsolete classes
…he last RCU trailer Specify also using carryOverMethod for the last page
|
@mfasDa is this ready to be merged? |
|
@shahor02 Yes, please squash-merge! |
Uh oh!
There was an error while loading. Please reload this page.