Belle II Software development
tmemread.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "daq/dqm/DqmSharedMem.h"
10
11#include <unistd.h>
12
13#include "TH1F.h"
14#include "TMemFile.h"
15
16using namespace Belle2;
17using namespace std;
18
19int main(int /*argc*/, char** /*argv*/)
20{
21
22 DqmSharedMem* shm = new DqmSharedMem("testhisto", 2000000);
23 char* buf = new char[8000000];
24
25 for (;;) {
26 shm->lock();
27 memcpy(buf, shm->ptr(), 8000000);
28 shm->unlock();
29 TMemFile* file = new TMemFile("TestHisto", (char*)shm->ptr(), 2000000, "READ", "", 0);
30 file->ls();
31 file->Print();
32 TH1F* h1 = (TH1F*) file->Get("testhisto");
33 h1->Print();
34 sleep(1);
35 delete file;
36 }
37 // file->Write();
38 // file->Close();
39 return 0;
40}
Abstract base class for different kinds of events.
STL namespace.