SND@LHC Software
Loading...
Searching...
No Matches
PixelUnpack Class Reference

#include <PixelUnpack.h>

Inheritance diagram for PixelUnpack:
Collaboration diagram for PixelUnpack:

Public Member Functions

 PixelUnpack (uint16_t PartitionId)
 
virtual ~PixelUnpack ()
 
virtual Bool_t Init () override
 
virtual Bool_t DoUnpack (Int_t *data, Int_t size) override
 
virtual void Reset () override
 
Int_t GetNHitsTotal ()
 
uint16_t GetPartition () override
 
- Public Member Functions inherited from ShipUnpack
 ShipUnpack ()
 
virtual ~ShipUnpack ()
 
Int_t GetNHitsTotal ()
 

Protected Member Functions

virtual void Register () override
 

Private Member Functions

 PixelUnpack (const PixelUnpack &)
 
PixelUnpackoperator= (const PixelUnpack &)
 

Private Attributes

TClonesArray * fRawData
 
Int_t fNHits
 
Int_t fNHitsTotal
 
uint16_t fPartitionId
 

Detailed Description

Definition at line 16 of file PixelUnpack.h.

Constructor & Destructor Documentation

◆ PixelUnpack() [1/2]

PixelUnpack::PixelUnpack ( uint16_t  PartitionId)

Definition at line 28 of file PixelUnpack.cxx.

29 : fRawData(new TClonesArray("ShipPixelHit")), fNHits(0), fNHitsTotal(0), fPartitionId(PartitionId)
30{
31}
Int_t fNHitsTotal
Definition PixelUnpack.h:44
uint16_t fPartitionId
Definition PixelUnpack.h:45
TClonesArray * fRawData
Definition PixelUnpack.h:42

◆ ~PixelUnpack()

PixelUnpack::~PixelUnpack ( )
virtual

Destructor.

Definition at line 34 of file PixelUnpack.cxx.

35{
36 LOG(INFO) << "PixelUnpack: Delete instance";
37 delete fRawData;
38}

◆ PixelUnpack() [2/2]

PixelUnpack::PixelUnpack ( const PixelUnpack )
private

Member Function Documentation

◆ DoUnpack()

Bool_t PixelUnpack::DoUnpack ( Int_t *  data,
Int_t  size 
)
overridevirtual

Process an MBS sub-event.

Reimplemented from ShipUnpack.

Definition at line 59 of file PixelUnpack.cxx.

60{
61 LOG(INFO) << "PixelUnpack : Unpacking frame... size/bytes = " << size;
62
63 auto df = reinterpret_cast<DataFrame *>(data);
64 switch (df->header.frameTime) {
65 case SoS: LOG(INFO) << "PixelUnpacker: SoS frame."; return kTRUE;
66 case EoS: LOG(INFO) << "PixelUnpacker: EoS frame."; return kTRUE;
67 default: break;
68 }
69 assert(df->header.size == size);
70 auto nhits = df->getHitCount();
71 std::vector<RawDataHit> hits(df->hits, df->hits + nhits);
72 for (auto &&hit : hits) {
73 auto hitData = reinterpret_cast<HitData *>(&(hit.hitTime));
74 auto channelId = reinterpret_cast<ChannelId *>(&(hit.channelId));
75 auto detectorID = (df->header.partitionId%0x0800) * 10000000 + 1000000 * hitData->moduleID + 1000 * channelId->row + channelId->column;
76 auto tot = hitData->tot;
77 new ((*fRawData)[fNHits]) ShipPixelHit(detectorID, tot); //tot is measured in steps of 25 ns
78 fNHits++;
79 }
80
82 return kTRUE;
83}
integer(mpi) nhits
number of hits
Definition mptest1.f90:58
uint16_t row

◆ GetNHitsTotal()

Int_t PixelUnpack::GetNHitsTotal ( )
inline

Method for controlling the functionality.

Definition at line 33 of file PixelUnpack.h.

33{ return fNHitsTotal; }

◆ GetPartition()

uint16_t PixelUnpack::GetPartition ( )
inlineoverridevirtual

Implements ShipUnpack.

Definition at line 35 of file PixelUnpack.h.

35{ return fPartitionId; }

◆ Init()

Bool_t PixelUnpack::Init ( )
overridevirtual

Initialization. Called once, before the event loop.

Reimplemented from ShipUnpack.

Definition at line 41 of file PixelUnpack.cxx.

42{
43 Register();
44 return kTRUE;
45}
virtual void Register() override

◆ operator=()

PixelUnpack & PixelUnpack::operator= ( const PixelUnpack )
private

◆ Register()

void PixelUnpack::Register ( )
overrideprotectedvirtual

Register the output structures.

Reimplemented from ShipUnpack.

Definition at line 48 of file PixelUnpack.cxx.

49{
50 LOG(INFO) << "PixelUnpack : Registering...";
51 auto *fMan = FairRootManager::Instance();
52 if (!fMan) {
53 return;
54 }
55 fMan->Register("Digi_PixelHits", "Pixels", fRawData, kTRUE);
56}

◆ Reset()

void PixelUnpack::Reset ( )
overridevirtual

Clear the output structures.

Reimplemented from ShipUnpack.

Definition at line 86 of file PixelUnpack.cxx.

87{
88 LOG(DEBUG) << "PixelUnpack : Clearing Data Structure" ;
89 fRawData->Clear();
90 fNHits = 0;
91}

Member Data Documentation

◆ fNHits

Int_t PixelUnpack::fNHits
private

Number of raw items in current event.

Definition at line 43 of file PixelUnpack.h.

◆ fNHitsTotal

Int_t PixelUnpack::fNHitsTotal
private

Total number of raw items.

Definition at line 44 of file PixelUnpack.h.

◆ fPartitionId

uint16_t PixelUnpack::fPartitionId
private

Definition at line 45 of file PixelUnpack.h.

◆ fRawData

TClonesArray* PixelUnpack::fRawData
private

Array of output raw items.

Definition at line 42 of file PixelUnpack.h.


The documentation for this class was generated from the following files: