FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMQPixAltSamplerBin.h
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  ********************************************************************************/
15 #ifndef FAIRMQPIXALTSAMPLERBIN_H_
16 #define FAIRMQPIXALTSAMPLERBIN_H_
17 
18 #include "PixelPayload.h"
19 
20 #include <FairMQDevice.h>
21 #include <cstdint>
22 #include <fstream>
23 #include <string>
24 #include <thread>
25 #include <vector>
26 
27 class TBranch;
28 class TChain;
29 
30 class FairMQPixAltSamplerBin : public FairMQDevice
31 {
32  public:
34  virtual ~FairMQPixAltSamplerBin();
35 
36  void AddInputFileName(const std::string& tempString) { fFileNames.push_back(tempString); }
37 
38  void SetMaxIndex(int64_t tempInt) { fMaxIndex = tempInt; }
39 
40  void ListenForAcks();
41 
42  void SetOutputChannelName(const std::string& tstr) { fOutputChannelName = tstr; }
43  void SetAckChannelName(const std::string& tstr) { fAckChannelName = tstr; }
44 
45  void SetAggregateFactor(int nal) { fAggregateLevel = nal; }
46 
47  protected:
48  virtual bool ConditionalRun();
49  virtual void PreRun();
50  virtual void PostRun();
51  virtual void InitTask();
52 
53  bool ReadBinFile();
54  bool ReadRootFile();
55 
56  private:
57  std::string fOutputChannelName;
58  std::string fAckChannelName;
59 
60  std::vector<std::string> fFileNames;
61  std::ifstream fInputFile;
62  int fCurrentFile;
63 
64  TChain* fInputChain;
65  PixelPayload::EventHeader* fEventHeader;
66  TBranch* fDigiBranch;
67  std::vector<PixelPayload::Digi>* fDigiArray;
68 
69  int fAggregateLevel;
70 
71  int64_t fMaxIndex;
72 
73  int fEventCounter;
74  int fNofRecAcks;
75 
76  bool fReadingRootFiles;
77 
80 
81  std::thread fAckListener;
82 };
83 
84 #endif /* FAIRMQPIXALTSAMPLER_H_ */
void AddInputFileName(const std::string &tempString)
void SetOutputChannelName(const std::string &tstr)
void SetAckChannelName(const std::string &tstr)
void SetMaxIndex(int64_t tempInt)