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

#include <ScalerUnpack.h>

Inheritance diagram for ScalerUnpack:
Collaboration diagram for ScalerUnpack:

Public Member Functions

 ScalerUnpack ()
 
virtual ~ScalerUnpack ()
 
virtual Bool_t Init () override
 
virtual Bool_t DoUnpack (Int_t *data, Int_t size) override
 
virtual void Reset () override
 
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

 ScalerUnpack (const ScalerUnpack &)
 
ScalerUnpackoperator= (const ScalerUnpack &)
 

Private Attributes

uint16_t fPartitionId = 0x8100
 
FairRootManager * fMan = nullptr
 
TTree * tree = nullptr
 
int fDavid = 0
 
int fGoliath = 0
 

Detailed Description

Definition at line 17 of file ScalerUnpack.h.

Constructor & Destructor Documentation

◆ ScalerUnpack() [1/2]

ScalerUnpack::ScalerUnpack ( )
default

◆ ~ScalerUnpack()

ScalerUnpack::~ScalerUnpack ( )
virtualdefault

Destructor.

◆ ScalerUnpack() [2/2]

ScalerUnpack::ScalerUnpack ( const ScalerUnpack )
private

Member Function Documentation

◆ DoUnpack()

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

Process an MBS sub-event.

Reimplemented from ShipUnpack.

Definition at line 47 of file ScalerUnpack.cxx.

48{
49 static_assert(sizeof(ScalarFrame) == 88, "Scaler frame size incorrect!");
50 auto df = reinterpret_cast<ScalarFrame *>(data);
51 LOG(DEBUG) << "ScalerUnpack : Unpacking frame... size/bytes = " << size ;
52 LOG(DEBUG) << "PSW = " << df->PSW ;
53 LOG(DEBUG) << "SPW = " << df->SPW ;
54 LOG(DEBUG) << "POT from SPS = " << df->scalars[0] ;
55 LOG(DEBUG) << "S1raw = " << df->scalars[1] ;
56 LOG(DEBUG) << "S1strobed = " << df->scalars[2] ;
57 LOG(DEBUG) << "S1*S2 TrgRaw = " << df->scalars[3] ;
58 LOG(DEBUG) << "S1*S2 TrgStrobed = " << df->scalars[4] ;
59 for (auto i : ROOT::MakeSeq(df->getSliceCount())) {
60 LOG(DEBUG) << "Slice " << i << "= " << df->slices[i] ;
61 }
62 auto f = fMan->GetOutFile();
63 tree = dynamic_cast<TTree *>(f->Get("scalers"));
64 if (tree == nullptr) {
65 tree = new TTree("scalers", "scalers");
66 }
67 tree->Branch("PSW", &(df->PSW));
68 tree->Branch("SPW", &(df->SPW));
69 for (auto i : ROOT::MakeSeq(16)) {
70 switch (i) {
71 case 11: {
72 fGoliath = int(int(df->scalars[i]) / 0x10000);
73 fDavid = int(int(df->scalars[i]) % 0x10000);
74 tree->Branch("Goliath", &fGoliath);
75 tree->Branch("David", &fDavid);
76 LOG(INFO) << "David: " << fDavid ;
77 LOG(INFO) << "Goliath: " << fGoliath ;
78 break;
79 }
80 case 12:
81 LOG(INFO) << "Spill type: " << df->scalars[i] ;
82 tree->Branch("spill_type", &(df->scalars[i]));
83 break;
84 default: tree->Branch(TString::Format("SC%.2d", i), &(df->scalars[i]));
85 }
86 }
87 auto slices = df->getSliceCount() > 0 ? std::vector<uint32_t>(df->slices, df->slices + df->getSliceCount())
88 : std::vector<uint32_t>();
89 tree->Branch("slices", "vector<uint32_t>", &slices);
90 tree->Fill();
91 tree->Write("", TObject::kOverwrite);
92 return kTRUE;
93}
FairRootManager * fMan
int i
Definition ShipAna.py:86

◆ GetPartition()

uint16_t ScalerUnpack::GetPartition ( )
inlineoverridevirtual

Implements ShipUnpack.

Definition at line 33 of file ScalerUnpack.h.

33{ return fPartitionId; }
uint16_t fPartitionId

◆ Init()

Bool_t ScalerUnpack::Init ( )
overridevirtual

Initialization. Called once, before the event loop.

Reimplemented from ShipUnpack.

Definition at line 23 of file ScalerUnpack.cxx.

24{
25 Register();
26 fMan = FairRootManager::Instance();
27 return kTRUE;
28}
virtual void Register() override

◆ operator=()

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

◆ Register()

void ScalerUnpack::Register ( )
overrideprotectedvirtual

Register the output structures.

Reimplemented from ShipUnpack.

Definition at line 31 of file ScalerUnpack.cxx.

32{
33 LOG(DEBUG) << "ScalerUnpack : Registering..." ;
34}

◆ Reset()

void ScalerUnpack::Reset ( )
overridevirtual

Clear the output structures.

Reimplemented from ShipUnpack.

Definition at line 96 of file ScalerUnpack.cxx.

97{
98 LOG(DEBUG) << "ScalerUnpack : Clearing Data Structure" ;
99}

Member Data Documentation

◆ fDavid

int ScalerUnpack::fDavid = 0
private

Definition at line 43 of file ScalerUnpack.h.

◆ fGoliath

int ScalerUnpack::fGoliath = 0
private

Definition at line 44 of file ScalerUnpack.h.

◆ fMan

FairRootManager* ScalerUnpack::fMan = nullptr
private

Definition at line 41 of file ScalerUnpack.h.

◆ fPartitionId

uint16_t ScalerUnpack::fPartitionId = 0x8100
private

Definition at line 40 of file ScalerUnpack.h.

◆ tree

TTree* ScalerUnpack::tree = nullptr
private

Definition at line 42 of file ScalerUnpack.h.


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