|
9 | 9 | // this example |
10 | 10 | #include "ExHeader.h" |
11 | 11 | #include "MyDigi.h" |
| 12 | +#include "MyHit.h" // temporary for the data check (see below) |
12 | 13 |
|
13 | 14 | // FairRoot |
14 | 15 | #include "BoostSerializer.h" |
|
19 | 20 | // ROOT |
20 | 21 | #include <Rtypes.h> |
21 | 22 | #include <TFile.h> |
| 23 | +#include <TMath.h> // temporary for the data check (see below) |
22 | 24 | #include <TTree.h> |
23 | 25 |
|
24 | 26 | // std |
@@ -64,6 +66,9 @@ struct Sampler : fair::mq::Device |
64 | 66 | ExHeader header; |
65 | 67 | header.eventNumber = idx; |
66 | 68 |
|
| 69 | + // temporarily apply data processing steps to check that they work before & after serialization |
| 70 | + volatile TClonesArray hits = FindHits(*fInput); |
| 71 | + |
67 | 72 | auto msgHeader(NewMessage()); |
68 | 73 | BoostSerializer<ExHeader>().Serialize(*msgHeader, header); |
69 | 74 |
|
@@ -92,6 +97,25 @@ struct Sampler : fair::mq::Device |
92 | 97 | } |
93 | 98 |
|
94 | 99 | private: |
| 100 | + // temporary method to check data before transfer |
| 101 | + TClonesArray FindHits(const TClonesArray& digis) |
| 102 | + { |
| 103 | + TClonesArray hits("MyHit"); |
| 104 | + const TVector3 dpos(1 / TMath::Sqrt(12), 1 / TMath::Sqrt(12), 1 / TMath::Sqrt(12)); |
| 105 | + const Int_t fDetID = 0; |
| 106 | + const Int_t fMCIndex = 0; |
| 107 | + |
| 108 | + for (int i = 0; i < digis.GetEntriesFast(); i++) { |
| 109 | + auto digi = static_cast<MyDigi const*>(digis.At(i)); |
| 110 | + const TVector3 pos(digi->GetX() + 0.5, digi->GetY() + 0.5, digi->GetZ() + 0.5); |
| 111 | + auto hit = new ((hits)[i]) MyHit(fDetID, fMCIndex, pos, dpos); |
| 112 | + hit->SetTimeStamp(digi->GetTimeStamp()); |
| 113 | + hit->SetTimeStampError(digi->GetTimeStampError()); |
| 114 | + } |
| 115 | + |
| 116 | + return hits; |
| 117 | + } |
| 118 | + |
95 | 119 | TClonesArray* fInput; |
96 | 120 | TTree* fTree; |
97 | 121 | std::string fFileName; |
|
0 commit comments