FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMbsSource.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -----------------------------------------------------------------------------
9 // ----- -----
10 // ----- FairMbsSource -----
11 // ----- Created 12.04.2013 by D.Kresan -----
12 // ----- Copied from FairSource 01.11.2013 by F.Uhlig -----
13 // ----- -----
14 // -----------------------------------------------------------------------------
15 
16 #include "FairMbsSource.h"
17 
18 #include "FairLogger.h"
19 
22 {}
23 
25  : FairOnlineSource(source)
26 {}
27 
29 
30 Bool_t FairMbsSource::Unpack(Int_t *data,
31  Int_t size,
32  Short_t type,
33  Short_t subType,
34  Short_t procId,
35  Short_t subCrate,
36  Short_t control)
37 {
38  LOG(debug2) << "FairMbsSource::Unpack => Found Sub-event with flags: "
39  << " Type " << type << " SubType " << subType << " ProcId " << procId << " SubCrate " << subCrate
40  << " Control " << control;
41 
42  FairUnpack *unpack;
43  Bool_t seen = kFALSE;
44  for (Int_t i = 0; i < fUnpackers->GetEntriesFast(); i++) {
45  unpack = static_cast<FairUnpack *>(fUnpackers->At(i));
46 
47  if (unpack->GetSubCrate() < 0) { // All sub-crates
48  if (type != unpack->GetType() || subType != unpack->GetSubType() || procId != unpack->GetProcId()
49  || control != unpack->GetControl()) {
50  continue;
51  }
52  } else { // specified sub-crate
53  if (type != unpack->GetType() || subType != unpack->GetSubType() || procId != unpack->GetProcId()
54  || subCrate != unpack->GetSubCrate() || control != unpack->GetControl()) {
55  continue;
56  }
57  }
58 
59  if (!unpack->DoUnpack(data, size)) {
60  return kFALSE;
61  }
62 
63  seen = kTRUE;
64  }
65 
66  return seen;
67 }
68 
Bool_t Unpack(Int_t *data, Int_t size, Short_t type, Short_t subType, Short_t procId, Short_t subCrate, Short_t control)
virtual Bool_t DoUnpack(Int_t *data, Int_t size)=0
ClassImp(FairEventBuilder)
virtual ~FairMbsSource()
TObjArray * fUnpackers
Short_t GetType() const
Definition: FairUnpack.h:32
Short_t GetProcId() const
Definition: FairUnpack.h:34
Short_t GetSubType() const
Definition: FairUnpack.h:33
Short_t GetControl() const
Definition: FairUnpack.h:36
Short_t GetSubCrate() const
Definition: FairUnpack.h:35