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
PlaybackRawDataProvider::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PlaybackRawDataProvider.cc:84
PlaybackRawDataProvider::beginJob
void beginJob() override
Definition: PlaybackRawDataProvider.cc:124
PlaybackRawDataProvider::PlaybackRawDataProvider
PlaybackRawDataProvider(const edm::ParameterSet &)
Definition: PlaybackRawDataProvider.cc:30
PlaybackRawDataProvider::writeIndex_
unsigned int writeIndex_
Definition: PlaybackRawDataProvider.h:62
PlaybackRawDataProvider::waitReadSem
void waitReadSem()
Definition: PlaybackRawDataProvider.h:44
PlaybackRawDataProvider::getFEDRawData
virtual FEDRawDataCollection * getFEDRawData()
Definition: PlaybackRawDataProvider.cc:133
PlaybackRawDataProvider::areFilesClosed
bool areFilesClosed()
Definition: PlaybackRawDataProvider.cc:188
PlaybackRawDataProvider::endJob
void endJob() override
Definition: PlaybackRawDataProvider.cc:127
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
PlaybackRawDataProvider::queueSize_
unsigned int queueSize_
Definition: PlaybackRawDataProvider.h:53
PlaybackRawDataProvider::count_
unsigned int count_
Definition: PlaybackRawDataProvider.h:57
EDAnalyzer.h
PlaybackRawDataProvider::postReadSem
void postReadSem()
Definition: PlaybackRawDataProvider.h:45
PlaybackRawDataProvider::destroying_
bool destroying_
Definition: PlaybackRawDataProvider.h:66
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
edm::FileBlock
Definition: FileBlock.h:22
PlaybackRawDataProvider::lock
void lock()
Definition: PlaybackRawDataProvider.h:40
PlaybackRawDataProvider::readSem_
sem_t readSem_
Definition: PlaybackRawDataProvider.h:61
PlaybackRawDataProvider::lock_
sem_t lock_
Definition: PlaybackRawDataProvider.h:59
PlaybackRawDataProvider::unlock
void unlock()
Definition: PlaybackRawDataProvider.h:41
PlaybackRawDataProvider::instance_
static PlaybackRawDataProvider * instance_
Definition: PlaybackRawDataProvider.h:36
PlaybackRawDataProvider::respondToCloseInputFile
void respondToCloseInputFile(edm::FileBlock const &fb) override
Definition: PlaybackRawDataProvider.cc:130
PlaybackRawDataProvider::setFreeToEof
void setFreeToEof()
Definition: PlaybackRawDataProvider.cc:181
PlaybackRawDataProvider::postWriteSem
void postWriteSem()
Definition: PlaybackRawDataProvider.h:43
PlaybackRawDataProvider::freeToEof_
bool freeToEof_
Definition: PlaybackRawDataProvider.h:64
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PlaybackRawDataProvider::instance
static PlaybackRawDataProvider * instance()
Definition: PlaybackRawDataProvider.h:74
edm::EventSetup
Definition: EventSetup.h:58
PlaybackRawDataProvider::runNumber_
unsigned int * runNumber_
Definition: PlaybackRawDataProvider.h:55
PlaybackRawDataProvider::~PlaybackRawDataProvider
~PlaybackRawDataProvider() override
Definition: PlaybackRawDataProvider.cc:55
PlaybackRawDataProvider::filesClosed_
bool filesClosed_
Definition: PlaybackRawDataProvider.h:65
PlaybackRawDataProvider::sem_print
void sem_print()
Definition: PlaybackRawDataProvider.cc:171
PlaybackRawDataProvider::readIndex_
unsigned int readIndex_
Definition: PlaybackRawDataProvider.h:63
ParameterSet.h
PlaybackRawDataProvider::waitWriteSem
void waitWriteSem()
Definition: PlaybackRawDataProvider.h:42
edm::Event
Definition: Event.h:73
PlaybackRawDataProvider::writeSem_
sem_t writeSem_
Definition: PlaybackRawDataProvider.h:60
PlaybackRawDataProvider::evtNumber_
unsigned int * evtNumber_
Definition: PlaybackRawDataProvider.h:56
PlaybackRawDataProvider::eventQueue_
FEDRawDataCollection ** eventQueue_
Definition: PlaybackRawDataProvider.h:54
PlaybackRawDataProvider
Definition: PlaybackRawDataProvider.h:13