Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Protodune
singlephase
RawDecoding
RawDecodingUtils.cc
Go to the documentation of this file.
1
2
#include "
RawDecodingUtils.hh
"
3
4
#include "artdaq-core/Data/ContainerFragment.hh"
5
6
#include "
art/Framework/Principal/Handle.h
"
7
8
#include <stdexcept>
9
//#include "cetlib/exception.h"
10
11
//#include <sstream>
12
13
artdaq::Fragments
14
dune::getHandleChecked
(
const
art::Event
&
evt
,
const
std::string
&
label
,
15
const
std::string
& fragtype,
const
bool
& expectFragsInContainer) {
16
17
artdaq::Fragments
fragments;
18
19
/*
20
art::Handle<artdaq::Fragments> handleFragments;
21
22
if (expectFragsInContainer) {
23
art::InputTag itag1(label, "Container");
24
handleFragments = evt.getHandle<artdaq::Fragments>(itag1);
25
}
26
else {
27
art::inputTag itag2(label, fragtype);
28
handleFragments = evt.getHandle<artdaq::Fragments>(itag2);
29
}
30
31
if(!handleFragments.isValid()) {
32
std::cerr << "Run: " << evt.run()
33
<< ", SubRun: " << evt.subRun()
34
<< ", Event: " << evt.event()
35
<< " is NOT VALID" << std::endl;
36
37
if (expectFragsInContainer) {
38
//throw cet::exception("getHandleChecked") << "getHandle call for fragments of type \"Container\" NOT VALID";
39
throw std::runtime_error("(THIS SHOULD BE CHANGED TO A cet::exception) getHandle call for fragments NOT VALID");
40
} else {
41
// throw cet::exception("getHandleChecked") << "getHandle call for fragments of type \"" << fragtype << "\" NOT VALID";
42
throw std::runtime_error("(THIS SHOULD BE CHANGED TO A cet::exception) getHandle call for fragments NOT VALID");
43
}
44
}
45
if (expectFragsInContainer) {
46
47
for (auto cont : *handleFragments)
48
{
49
artdaq::ContainerFragment contf(cont);
50
51
for (size_t ii = 0; ii < contf.block_count(); ++ii)
52
{
53
size_t fragSize = contf.fragSize(ii);
54
artdaq::Fragment thisfrag;
55
thisfrag.resizeBytes(fragSize);
56
57
std::cout << "Copying " << fragSize << " bytes from " << contf.at(ii) << " to " << thisfrag.headerAddress() << std::endl;
58
memcpy(thisfrag.headerAddress(), contf.at(ii), fragSize);
59
60
std::cout << "Putting new fragment into output vector" << std::endl;
61
fragments.emplace_back(thisfrag);
62
}
63
}
64
} else {
65
66
for(auto const& frag: *handleFragments){
67
fragments.emplace_back( frag );
68
}
69
}
70
*/
71
// C++11 will move, rather than copy, a vector on return
72
return
fragments;
73
}
74
dune::getHandleChecked
artdaq::Fragments getHandleChecked(const art::Event &evt, const std::string &label, const std::string &fragtype, const bool &inContainer)
Definition:
RawDecodingUtils.cc:14
Handle.h
string
std::string string
Definition:
nybbler.cc:12
test_nxdot.label
label
Definition:
test_nxdot.py:6
RawDecodingUtils.hh
art::Event
Definition:
Event.h:22
tca::evt
TCEvent evt
Definition:
DataStructs.cxx:7
dune::HDF5Utils::Fragments
std::vector< Fragment > Fragments
Definition:
HDF5Utils.h:57
Generated by
1.8.11