ATLAS Offline Software
StandaloneNavigation.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // System include(s):
7 #include <iostream>
8 
11 
13 }
14 
16 }
17 
18 bool HLT::StandaloneNavigation::serializeHolders( std::vector<uint32_t>& output ) const {
19  std::lock_guard<std::recursive_mutex> lock(getMutex());
20  const TrigHolderStructure& holderstorage = getHolderStorage();
21 
22  for ( auto holder: holderstorage.getAllHolders()) {
23  // put size placeholder
24  const size_t holderSizeIndex = output.size();
25  output.push_back(0);
26 
27  holder->serialize(output);
28 
29  output[holderSizeIndex] = output.size() - holderSizeIndex -1;
30  }
31  return true;
32 }
33 
34 
35 bool HLT::StandaloneNavigation::deserializeHolders(std::vector<uint32_t>::const_iterator& start, const std::vector<uint32_t>::const_iterator& end) {
36  using namespace std;
37  std::lock_guard<std::recursive_mutex> lock(getMutex());
38  TrigHolderStructure& holderstorage = getHolderStorage();
39 
40  do {
41  if ( start == end ) // no holders at all
42  break;
43 
44  const size_t holderPayloadSize = *start;
45  ++start;
46 
47  class_id_type clid{0};
48  std::string label;
49  sub_index_type sub{0};
50  std::vector<uint32_t>::const_iterator oneBlobIt = start;
51  bool couldRead = BaseHolder::enquireSerialized(oneBlobIt, end, clid, label, sub);
52 
53  if ( couldRead == false ) // to few data words essentially
54  break;
55 
56  //create holder
57  auto holder = std::make_shared<TypelessHolder>(clid, label, sub);
58 
59  bool status = holderstorage.registerHolder(holder);
60  if(!status){
61  std::cerr << "ERROR registering a holder" << std::endl;
62  }
63 
64  std::advance(start, holderPayloadSize);
65 
66  } while(1);
67 
68  return true;
69 }
70 
71 bool HLT::StandaloneNavigation::serialize( std::vector<uint32_t>& output ) const {
72  const unsigned int version=3; //GetBack - shall we change it to 4
73  output.push_back(version);
74 
76 
77  if ( serializeTEs(output) == false ) {
78  return false;
79  }
80 
81  if ( serializeHolders(output) == false ) {
82  return false;
83  }
84 
85  return true;
86 }
87 
88 bool HLT::StandaloneNavigation::deserialize( const std::vector<uint32_t>& input ) {
89  // using namespace std;
90  // std::cerr << "deserializing navigation of size: " << input.size() << std::endl;
91  std::vector<uint32_t>::const_iterator inputIt = input.begin();
92  const unsigned int version = *inputIt++;
93 
94  // cerr << "version " << version << endl;
95 
96  const size_t totalSize = *inputIt++;
97 
98  //remove unused warning;
99  (void)(version);
100  (void)(totalSize);
101 
102  if (!deserializeTEs(inputIt,input.size())) {
103  return false;
104  }
105 
106  if (!deserializeHolders(inputIt,input.end())) {
107  return false;
108  }
109  return true;
110 }
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
HLT::TrigHolderStructure
Definition: TrigHolderStructure.h:21
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
StandaloneNavigation.h
HLT::TrigHolderStructure::registerHolder
bool registerHolder(const std::shared_ptr< BaseHolder > &holder)
Definition: TrigHolderStructure.cxx:34
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
HLT::StandaloneNavigation::serializeHolders
virtual bool serializeHolders(std::vector< uint32_t > &output) const
method serializes the helper objects allowing use of FeatureAccessHelpers w/o CLID This methods shoul...
Definition: StandaloneNavigation.cxx:18
HLTNavDetails::FillSize
Definition: TrigNavStructure.h:26
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
HLT::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
HLT::sub_index_type
uint16_t sub_index_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:9
merge.output
output
Definition: merge.py:17
HLT::BaseHolder::enquireSerialized
static bool enquireSerialized(std::vector< uint32_t >::const_iterator &fromHere, const std::vector< uint32_t >::const_iterator &end, class_id_type &c, std::string &label, sub_index_type &subtypeIndex)
Definition: BaseHolder.cxx:12
TypelessHolder.h
get_generator_info.version
version
Definition: get_generator_info.py:33
HLT::StandaloneNavigation::~StandaloneNavigation
virtual ~StandaloneNavigation()
Definition: StandaloneNavigation.cxx:15
HLT::StandaloneNavigation::deserialize
virtual bool deserialize(const std::vector< uint32_t > &input)
Definition: StandaloneNavigation.cxx:88
Herwig7_QED_EvtGen_ll.fs
dictionary fs
Definition: Herwig7_QED_EvtGen_ll.py:17
HLT::StandaloneNavigation::serialize
virtual bool serialize(std::vector< uint32_t > &output) const
method serializes entire navigation
Definition: StandaloneNavigation.cxx:71
HLT::StandaloneNavigation::StandaloneNavigation
StandaloneNavigation()
Definition: StandaloneNavigation.cxx:12
python.copyTCTOutput.totalSize
totalSize
Definition: copyTCTOutput.py:93
merge.status
status
Definition: merge.py:17
HLT::TrigHolderStructure::getAllHolders
std::vector< HolderType * > getAllHolders() const
Definition: TrigHolderStructure.h:40
HLT::StandaloneNavigation::deserializeHolders
virtual bool deserializeHolders(std::vector< uint32_t >::const_iterator &start, const std::vector< uint32_t >::const_iterator &end)
Definition: StandaloneNavigation.cxx:35