CMS 3D CMS Logo

PlaybackRawDataProvider.h
Go to the documentation of this file.
1 #ifndef PLAYBACKRAWDATAPROVIDER_H
2 #define PLAYBACKRAWDATAPROVIDER_H 1
3 
7 
8 #include <memory>
9 #include <semaphore.h>
10 
12 
14 public:
15  //
16  // construction/destruction
17  //
19  ~PlaybackRawDataProvider() override;
20 
21  // EDAnalyzer interface
22  void beginJob() override;
23  void analyze(const edm::Event&, const edm::EventSetup&) override;
24  void endJob() override;
25  void respondToCloseInputFile(edm::FileBlock const& fb) override;
26 
27  // provide cached fed collection (and run/evt number, if needed!)
29  virtual FEDRawDataCollection* getFEDRawData(unsigned int& runNumber, unsigned int& evtNumber);
30  void setFreeToEof();
31  bool areFilesClosed();
32 
34 
35 private:
37  //
38  // private member functions
39  //
40  void lock() { sem_wait(&lock_); }
41  void unlock() { sem_post(&lock_); }
42  void waitWriteSem() { sem_wait(&writeSem_); }
43  void postWriteSem() { sem_post(&writeSem_); }
44  void waitReadSem() { sem_wait(&readSem_); }
45  void postReadSem() { sem_post(&readSem_); }
46 
47  void sem_print();
48 
49 private:
50  //
51  // member data
52  //
53  unsigned int queueSize_;
55  unsigned int* runNumber_;
56  unsigned int* evtNumber_;
57  unsigned int count_;
58 
59  sem_t lock_;
60  sem_t writeSem_;
61  sem_t readSem_;
62  unsigned int writeIndex_;
63  unsigned int readIndex_;
64  bool freeToEof_;
67 };
68 
69 //
70 // implementation of inline functions
71 //
72 
73 //______________________________________________________________________________
75 
76 #endif
FEDRawDataCollection ** eventQueue_
void analyze(const edm::Event &, const edm::EventSetup &) override
PlaybackRawDataProvider(const edm::ParameterSet &)
virtual FEDRawDataCollection * getFEDRawData()
static PlaybackRawDataProvider * instance()
static PlaybackRawDataProvider * instance_
void respondToCloseInputFile(edm::FileBlock const &fb) override