TestTMapFile.cxx
Go to the documentation of this file.
1 ///
2 /// \file TestTMapFile.cxx
3 /// \brief Module to test for possible interferences between ART and TMapFile/-lNew
4 /// \version $Id: TestTMapFile.cxx,v 1.1 2012-03-14 19:40:34 messier Exp $
5 /// \author messier@indiana.edu
6 ///
9 #include "TMapFile.h"
10 #include "TH1F.h"
11 #include "RawData/FlatDAQData.h"
12 using namespace om;
13 
15 
16 //......................................................................
17 
19 
20 //......................................................................
21 
23 {
24  bool discoverMapAddress = false;
25 
26  if (discoverMapAddress==false) {
27  TMapFile::SetMapAddress(0x2aaab9c85000);
28  }
29 
30  std::cout << "Creating map file...";
31  fMapFile = TMapFile::Create("testTMapFile.map",
32  "RECREATE",
33  1*1024*1024,
34  "Test use of TMapFile with ART");
35  std::cout << "done." << std::endl;
36 
37  if (discoverMapAddress==true) {
38  std::cout << std::hex << fMapFile->GetBaseAddr() << std::endl;
39  exit(0);
40  }
41 
42  fHisto = new TH1F("histo","histo",100,0,100);
43 
44  fMapFile->Add(fHisto);
45 }
46 
47 //......................................................................
48 
50 
51 //......................................................................
52 
54 {
55  static int count = 0;
56 
57  // Pull some data out of the event to exercise ART a little bit
58  std::cout << "Pulling flatdaq_handle...";
59  try {
61  evt.getByLabel("daq",flatdaq_handle);
62  }
63  catch (...) {
64  }
65  std::cout << "done." << std::endl;
66 
67  std::cout << "Updating histogram and mapfile...";
68  fHisto->Fill(count%1000);
69  fMapFile->Update(0);
70  std::cout << "done." << std::endl;
71 
72  ++count;
73  std::cout << "TestTMapFile: " << count << " updates" << std::endl;
74 }
75 
76 ////////////////////////////////////////////////////////////////////////
void analyze(art::Event const &e)
virtual ~TestTMapFile()
const char * p
Definition: xmltok.h:285
int evt
Top level module for the online monitoring.
OStream cout
Definition: OStream.cxx:6
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
exit(0)
TMapFile * fMapFile
Definition: TestTMapFile.h:26
TestTMapFile(fhicl::ParameterSet const &p)
Online Monitoring package header.