13
Classes to decode and display raw data F. Cafagna

Classes to decode and display raw data F. Cafagna

Embed Size (px)

Citation preview

Page 1: Classes to decode and display raw data F. Cafagna

Classes to decode and display raw data

F. Cafagna

Page 2: Classes to decode and display raw data F. Cafagna

Once upon a time …

… a dialog between collegues …

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 2

Do you have a scheme of the layout of the PDM I can describe in my code?

Yes! Of course! It is not so difficult. You have ASICs connected to MAPMT, the ASICs are soldered on a board that is connected to other boards. The boards are numbered from 1 to 6, but are connected to slot numbered from A0 to A5, during the winter, and from B123 to B321 during the summer. But don’t worry, the MAPMT are numbered from 12.4 to 54.8 and are grouped by four. When in the group they change name into John, Paul, George and Ringo. Please note also that the ASIC channels are connected using a special scrambling algorithm, and you need the contemporary presence of two ring masters to decode it. But don’t worry we are going to change it soon.

I see, should be easy to implement in a decoding code. By the way, how do you want to plot it? Any suggestion?

This is way more simple! We are numbering, from 1 to 36, the MAPMT looking them from the bottom of the PDM. Then immagine to rotate the PDM and look to the PDM from the TOP. Now we consider PIXELS, that are numbered on a way I still don’t know, in a system of reference that is left-handed. Please note that the numbering can start from 0 or from 1, depending on the axis. Anyway, we are going to rotaate arbitrarly all the MAPMT … sooner or later. By the way I need to extracct just few PMT or EC, or channels and plot them as viewved from the bottom ….

Ahhhh. Gotcha. Cristal clear. I have all the informations I need ….

….

Page 3: Classes to decode and display raw data F. Cafagna

Intro

I was just kidding, of course. Things are more linear …

One important message was: be flexible, try to generalize.

In this approach I have also tried to minimize memory copies and footprints, trying to leverage the general programming (i.e. using templates).

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 3

Page 4: Classes to decode and display raw data F. Cafagna

From ASIC to MAPMT

We have two categories of mapping between the ASIC and the MAPMT channels: ASIC_ACE, or ASIC_BDF

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 4From Pierre B.

Page 5: Classes to decode and display raw data F. Cafagna

From ASIC to MAPMT I have noticed

that ASIC channels are decremented by a fixed number, in group. Then the channel number «jumps» to another number and the decrement rools over.

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 5

MAPMT ch

ASIC (b, d & f) ch

Decrements and jumps

ASIC (a, c & e) ch

Decrements and jumps

1 48 -16 33 -322 32 -16 1 313 16 -16 32 -324 0 61 0 535 61 -16 53 -326 45 -16 21 317 29 -16 52 -328 13 43 20 299 56 -16 49 -32

10 40 -16 17 3111 24 -16 48 -3212 8 45 16 2113 53 -16 37 -3214 37 -16 5 3115 21 -16 36 -32

Page 6: Classes to decode and display raw data F. Cafagna

From ASIC to MAPMT Thanks to this nice features, I decided to write a

pointer class that could «navigate and jump» into the data buffer.

This class is called: jumper_iterator. The template parameters define:

The data buffer type, i.e. PDM data type; The data type, i.e. ASIC data type; The GROUP, DECREMENT, START and memory OFFSET; The type and amount of jumps.

It is a derived class from the base class: base_jumper_iterator

It behaves like a random access iterator, so has been defined the operators: *, [], ++, =

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 6

Page 7: Classes to decode and display raw data F. Cafagna

From ASIC to MAPMT

Example of usage:typedef pdm::utils::asicbdf::jumper_iterator_type jumper_iterator_bdf_type;jumper_iterator_bdf_type pmt110B_1(&data[event_header_offset+0]), pmt110B_2;// Extract the data using the postincrementFor(int i=0; i<MAPMT_CHANNELS; ++i)

std::cout << “ Ch: “ << i<< “, counts: “ << pmt110B_1++ << std::endl;// Extract data using the random access operatorpmt110B_2=&data[event_header_offset+0]);// Extract the data collected by the PMT channel 10 (counting from 0)Std::cout << “ Ch: 10” << pmt110B_2[10] << std::endl;

Pros: no memory copy, high granularity, small memory footprint, can be used with standard algorithms.

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 7

Page 8: Classes to decode and display raw data F. Cafagna

A MAPMT channel, must be mapped to a corresponding pixel.

This can be done with the template class: pixels This class converts MAPMT channels into pixels in

the system of reference of the MAPMT

MAPMT pixels

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 8

0 1 2 3 4 5 6 7

8 9 10 11 12 13 14 15

16 17 18 19 20 21 22 23

24 25 26 27 28 29 30 31

32 33 34 35 36 37 38 39

40 41 42 43 44 45 46 47

48 49 50 51 52 53 54 55

56 57 58 59 60 61 62 63

0,0

0,1

8,8

Page 9: Classes to decode and display raw data F. Cafagna

EC pixels A B

D C

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 9

In a EC the MAPMT are rotated by 90 degrees. In the EC system of reference you can

imagine that B is A rotated by 90 degrees around the EC center, C is and A rotated by 180 and D by 270.

I wrote the class: rotation, that is able to rotate a pixels class.

In the same way a class: translation, is able to translate a pixels class.

Up to three transformation, in any order, can be executed in the: transformation class.

Page 10: Classes to decode and display raw data F. Cafagna

EC pixels A B

D C

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 10

For example, if j is a given B channel, to obtain the pixel position in the EC system of reference, (centered in the EC) you have to: 1. Create a pixels object; 2. Obtain the pixels pair in the A system of

reference;3. Rotate the pixels pair 90° clockwise;4. Translate the pixels pair by (1,1) pixel, to

avoid to have empty rows in correspondence of the axis.

Page 11: Classes to decode and display raw data F. Cafagna

EC pixels

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 11

The pixels of the EC itself can be transformed in the same way.

For the actual configuration, you can think about the EC, as rotated and translated into the PDM.

The same pixels rototranslation can be applied to the EC pixels.

Page 12: Classes to decode and display raw data F. Cafagna

EC Pixels Example// Plot just the central ECInt irow=2, icol=2;// Calculate the displacement, in pixel of the center of the EC respect to the PDM system of referenceint ix = irow * 16 + 8;int iy = icol * 16 + 8;//Please note that the PDM system of reference is left handed and with the origin on the topmost left corner of the PDM// Create the transformation and use it to translate the ECpdm::utils::pixels::pixels_translation_type ectopdm(ix,iy);pdm::utils::pixels::pixels_translation_type ectopdmg(ectopdm.boost());// Create a temporary pairpdm::utils::pixels::pixels_type::pair_type temp;// Create the pixel of the MAPMT Apdm::utils::pixels::pixels_type a;const int PMTXROW=12, PMTXCOL=2;int pmt=0;// Loop over the MAPMT D channels and translate them into pixels// For every EC the MAPMTfor (int i = 0; i < pdm::mapmt::CHANNELS; ++i){// The fourth MAPMT of and EC is of C type// From the C MAPMT to the EC system of reference// From the EC to the PDM system of reference

temp = pdm::utils::pixels::atod(a(i));temp = pdm::utils::pixels::dtoec(temp);temp = ectopdmg(temp);

// Set the PMT number to be used to retrive the jumper iterator from the pdm vectorpmt=irow*PMTXROW + icol* PMTXCOL + 7;

// Save the data from the jumper iteratorasicch.SetBinContent(temp.first, temp.second, pdm[pmt]->get_position(i) );

} // for CHANNELS

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 12

Page 13: Classes to decode and display raw data F. Cafagna

Conclusion The set of classes gives you the capability of

navigate in the data buffer, without copying it and extracting just the information that you need. It offers you a fully configurable set of transformations to set play with the pixels.

You can decide to plot just one EC in its system of reference, or to extract just one MAPMT data.

The library is header only, i.e. no binaries are needed and should be fully portable.

Fausto Guarino & Francesco Perfetto are porting it to OFFLINE framework.

WE NEED TO AGREE ON A STANDARD NOMENCLATURE AND SYSTEM OF REFERENCE!

02/10/2014 F.S. Cafagna, 1st Balloon Software meeting, IRAP 13