LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::BranchDescription Class Reference

#include "BranchDescription.h"

Classes

struct  Transients
 

Public Member Functions

 BranchDescription ()=default
 
 BranchDescription (BranchType const bt, TypeLabel const &tl, ModuleDescription const &modDesc)
 
void write (std::ostream &os) const
 
std::string const & moduleLabel () const
 
std::string const & processName () const
 
std::string const & producedClassName () const
 
std::string const & friendlyClassName () const
 
std::string const & productInstanceName () const
 
InputTag inputTag () const
 
bool produced () const
 
bool present () const
 
bool dropped () const
 
bool transient () const
 
int splitLevel () const
 
int basketSize () const
 
int compression () const
 
std::set< fhicl::ParameterSetID > const & psetIDs () const
 
ProductID productID () const
 
BranchType branchType () const
 
bool supportsView () const
 
std::string const & branchName () const
 
std::string const & wrappedName () const
 
void merge (BranchDescription const &other)
 
void swap (BranchDescription &other)
 
void setValidity (Transients::validity_state const state)
 

Static Public Attributes

static int constexpr invalidSplitLevel {-1}
 
static int constexpr invalidBasketSize {0}
 
static int constexpr invalidCompression {-1}
 

Private Member Functions

bool transientsFluffed_ () const
 
void initProductID_ ()
 
void fluffTransients_ () const
 
fhicl::ParameterSetID const & psetID () const
 
bool isPsetIDUnique () const
 
std::set< ProcessConfigurationID > const & processConfigurationIDs () const
 
Transientsguts ()
 
Transients const & guts () const
 
void throwIfInvalid_ () const
 

Private Attributes

BranchType branchType_ {InEvent}
 
std::string moduleLabel_ {}
 
std::string processName_ {}
 
ProductID productID_ {}
 
std::string producedClassName_ {}
 
std::string friendlyClassName_ {}
 
std::string productInstanceName_ {}
 
bool supportsView_ {false}
 
std::set< fhicl::ParameterSetIDpsetIDs_ {}
 
std::set< ProcessConfigurationIDprocessConfigurationIDs_ {}
 
Transient< Transientstransients_ {}
 

Friends

class detail::BranchDescriptionStreamer
 
bool combinable (BranchDescription const &, BranchDescription const &)
 
bool operator< (BranchDescription const &, BranchDescription const &)
 
bool operator== (BranchDescription const &, BranchDescription const &)
 

Detailed Description

Definition at line 52 of file BranchDescription.h.

Constructor & Destructor Documentation

art::BranchDescription::BranchDescription ( )
default
art::BranchDescription::BranchDescription ( BranchType const  bt,
TypeLabel const &  tl,
ModuleDescription const &  modDesc 
)

Definition at line 31 of file BranchDescription.cc.

References fluffTransients_(), friendlyClassName_, guts(), initProductID_(), moduleLabel_, processConfigurationIDs_, processName_, art::BranchDescription::Transients::Produced, producedClassName_, productInstanceName_, psetIDs_, supportsView_, throwIfInvalid_(), art::BranchDescription::Transients::transient_, and art::BranchDescription::Transients::validity_.

34  : branchType_{bt}
35  , moduleLabel_{tl.hasEmulatedModule() ? tl.emulatedModule() :
36  md.moduleLabel()}
37  , processName_{md.processName()}
38  , producedClassName_{tl.className()}
39  , friendlyClassName_{tl.friendlyClassName()}
40  , productInstanceName_{tl.productInstanceName()}
41  , supportsView_{tl.supportsView()}
42  {
44  guts().transient_ = tl.transient();
45  psetIDs_.insert(md.parameterSetID());
46  processConfigurationIDs_.insert(md.processConfigurationID());
50  }
void fluffTransients_() const
std::set< ProcessConfigurationID > processConfigurationIDs_
std::set< fhicl::ParameterSetID > psetIDs_

Member Function Documentation

int art::BranchDescription::basketSize ( ) const
inline

Definition at line 127 of file BranchDescription.h.

Referenced by art::RootOutputTree::addOutputBranch().

128  {
129  return guts().basketSize_;
130  }
BranchType art::BranchDescription::branchType ( ) const
inline
int art::BranchDescription::compression ( ) const
inline

Definition at line 132 of file BranchDescription.h.

Referenced by art::RootOutputTree::addOutputBranch().

133  {
134  return guts().compression_;
135  }
bool art::BranchDescription::dropped ( ) const
inline
void art::BranchDescription::fluffTransients_ ( ) const
private

Definition at line 64 of file BranchDescription.cc.

References art::canonicalProductName(), friendlyClassName(), moduleLabel(), processName(), producedClassName_, productInstanceName(), transients_, transientsFluffed_(), and art::wrappedClassName().

Referenced by BranchDescription().

65  {
66  if (transientsFluffed_()) {
67  return;
68  }
69  transients_.get().branchName_ = canonicalProductName(
71  transients_.get().wrappedName_ = wrappedClassName(producedClassName_);
72  }
bool transientsFluffed_() const
std::string wrappedClassName(std::string const &className)
std::string const & moduleLabel() const
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
std::string const & productInstanceName() const
std::string const & processName() const
Transient< Transients > transients_
std::string const & friendlyClassName() const
Transients& art::BranchDescription::guts ( )
inlineprivate

Definition at line 243 of file BranchDescription.h.

Referenced by BranchDescription(), initProductID_(), merge(), and psetID().

244  {
245  return transients_.get();
246  }
Transient< Transients > transients_
Transients const& art::BranchDescription::guts ( ) const
inlineprivate

Definition at line 248 of file BranchDescription.h.

249  {
250  return transients_.get();
251  }
Transient< Transients > transients_
void art::BranchDescription::initProductID_ ( )
private

Definition at line 53 of file BranchDescription.cc.

References guts(), art::ProductID::isValid(), productID_, art::ProductID::setID(), and transientsFluffed_().

Referenced by BranchDescription().

54  {
55  if (!transientsFluffed_()) {
56  return;
57  }
58  if (!productID_.isValid()) {
59  productID_.setID(guts().branchName_);
60  }
61  }
bool transientsFluffed_() const
bool isValid() const
Definition: ProductID.h:33
void setID(std::string const &canonicalProductName)
Definition: ProductID.cc:15
InputTag art::BranchDescription::inputTag ( ) const
inline

Definition at line 95 of file BranchDescription.h.

Referenced by art::Provenance::inputTag().

96  {
97  return InputTag{moduleLabel(), productInstanceName(), processName()};
98  }
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & processName() const
bool art::BranchDescription::isPsetIDUnique ( ) const
inlineprivate

Definition at line 232 of file BranchDescription.h.

233  {
234  return psetIDs().size() == 1;
235  }
std::set< fhicl::ParameterSetID > const & psetIDs() const
void art::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 90 of file BranchDescription.cc.

References art::BranchDescription::Transients::basketSize_, art::BranchDescription::Transients::compression_, guts(), invalidBasketSize, invalidCompression, invalidSplitLevel, processConfigurationIDs(), processConfigurationIDs_, psetIDs(), psetIDs_, and art::BranchDescription::Transients::splitLevel_.

91  {
92  psetIDs_.insert(other.psetIDs().begin(), other.psetIDs().end());
93  processConfigurationIDs_.insert(other.processConfigurationIDs().begin(),
94  other.processConfigurationIDs().end());
96  guts().splitLevel_ = other.guts().splitLevel_;
97  }
98  if (guts().basketSize_ == invalidBasketSize) {
99  guts().basketSize_ = other.guts().basketSize_;
100  }
101  // FIXME: This is probably wrong! We are going from defaulted compression
102  // to a possibly different compression, bad.
103  if (guts().compression_ == invalidCompression) {
104  guts().compression_ = other.guts().compression_;
105  }
106  }
static int constexpr invalidCompression
std::set< ProcessConfigurationID > processConfigurationIDs_
static int constexpr invalidSplitLevel
std::set< fhicl::ParameterSetID > psetIDs_
static int constexpr invalidBasketSize
bool art::BranchDescription::present ( ) const
inline
std::set<ProcessConfigurationID> const& art::BranchDescription::processConfigurationIDs ( ) const
inlineprivate

Definition at line 237 of file BranchDescription.h.

Referenced by merge(), art::operator<(), and art::operator==().

238  {
240  }
std::set< ProcessConfigurationID > processConfigurationIDs_
bool art::BranchDescription::produced ( ) const
inline
std::string const& art::BranchDescription::producedClassName ( ) const
inline
ParameterSetID const & art::BranchDescription::psetID ( ) const
private

Definition at line 75 of file BranchDescription.cc.

References art::BranchDescription::Transients::branchName_, art::errors::Configuration, guts(), and psetIDs().

76  {
77  assert(!psetIDs().empty());
78  if (psetIDs().size() != 1) {
79  throw Exception(errors::Configuration, "AmbiguousProvenance")
80  << "Your application requires all events on Branch '"
81  << guts().branchName_
82  << "'\n to have the same provenance. This file has events with "
83  "mixed provenance\n"
84  << "on this branch. Use a different input file.\n";
85  }
86  return *psetIDs().begin();
87  }
std::set< fhicl::ParameterSetID > const & psetIDs() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::set<fhicl::ParameterSetID> const& art::BranchDescription::psetIDs ( ) const
inline

Definition at line 138 of file BranchDescription.h.

Referenced by merge(), art::operator<(), art::operator==(), psetID(), and art::Provenance::psetIDs().

139  {
140  return psetIDs_;
141  }
std::set< fhicl::ParameterSetID > psetIDs_
void art::BranchDescription::setValidity ( Transients::validity_state const  state)
inline

Definition at line 214 of file BranchDescription.h.

215  {
216  guts().validity_ = state;
217  }
int art::BranchDescription::splitLevel ( ) const
inline

Definition at line 122 of file BranchDescription.h.

Referenced by art::RootOutputTree::addOutputBranch().

123  {
124  return guts().splitLevel_;
125  }
bool art::BranchDescription::supportsView ( ) const
inline

Definition at line 154 of file BranchDescription.h.

155  {
156  return supportsView_;
157  }
void art::BranchDescription::swap ( BranchDescription other)

Definition at line 121 of file BranchDescription.cc.

References branchType_, friendlyClassName_, moduleLabel_, processConfigurationIDs_, processName_, producedClassName_, productID_, productInstanceName_, psetIDs_, supportsView_, and transients_.

122  {
123  using std::swap;
124  swap(branchType_, other.branchType_);
125  swap(moduleLabel_, other.moduleLabel_);
126  swap(processName_, other.processName_);
127  swap(productID_, other.productID_);
128  swap(producedClassName_, other.producedClassName_);
129  swap(friendlyClassName_, other.friendlyClassName_);
130  swap(productInstanceName_, other.productInstanceName_);
131  swap(supportsView_, other.supportsView_);
132  swap(psetIDs_, other.psetIDs_);
133  swap(processConfigurationIDs_, other.processConfigurationIDs_);
134  swap(transients_, other.transients_);
135  }
std::set< ProcessConfigurationID > processConfigurationIDs_
void swap(BranchDescription &other)
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::set< fhicl::ParameterSetID > psetIDs_
Transient< Transients > transients_
void art::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 138 of file BranchDescription.cc.

References branchType_, art::errors::Configuration, friendlyClassName(), friendlyClassName_, art::errors::LogicError, moduleLabel(), moduleLabel_, art::NumBranchTypes, processName(), processName_, producedClassName_, productInstanceName(), productInstanceName_, and transientsFluffed_().

Referenced by BranchDescription().

139  {
140  constexpr char underscore{'_'};
141  if (transientsFluffed_()) {
142  return;
143  }
144  if (branchType_ >= NumBranchTypes) {
145  throwExceptionWithText("Illegal BranchType detected");
146  }
147  if (moduleLabel_.empty()) {
148  throwExceptionWithText("Module label is not allowed to be empty");
149  }
150  if (processName_.empty()) {
151  throwExceptionWithText("Process name is not allowed to be empty");
152  }
153  if (producedClassName_.empty()) {
154  throwExceptionWithText("Full class name is not allowed to be empty");
155  }
156  if (friendlyClassName_.empty()) {
157  throwExceptionWithText("Friendly class name is not allowed to be empty");
158  }
159  if (friendlyClassName_.find(underscore) != std::string::npos) {
160  throw Exception(errors::LogicError, "IllegalCharacter")
161  << "Class name '" << friendlyClassName()
162  << "' contains an underscore ('_'), which is illegal in the "
163  << "name of a product.\n";
164  }
165  if (moduleLabel_.find(underscore) != std::string::npos) {
166  throw Exception(errors::Configuration, "IllegalCharacter")
167  << "Module label '" << moduleLabel()
168  << "' contains an underscore ('_'), which is illegal in a "
169  << "module label.\n";
170  }
171  if (productInstanceName_.find(underscore) != std::string::npos) {
172  throw Exception(errors::Configuration, "IllegalCharacter")
173  << "Product instance name '" << productInstanceName()
174  << "' contains an underscore ('_'), which is illegal in a "
175  << "product instance name.\n";
176  }
177  if (processName_.find(underscore) != std::string::npos) {
178  throw Exception(errors::Configuration, "IllegalCharacter")
179  << "Process name '" << processName()
180  << "' contains an underscore ('_'), which is illegal in a "
181  << "process name.\n";
182  }
183  }
bool transientsFluffed_() const
std::string const & moduleLabel() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string const & productInstanceName() const
std::string const & processName() const
std::string const & friendlyClassName() const
bool art::BranchDescription::transient ( ) const
inline
bool art::BranchDescription::transientsFluffed_ ( ) const
inlineprivate

Definition at line 223 of file BranchDescription.h.

Referenced by fluffTransients_(), initProductID_(), and throwIfInvalid_().

224  {
225  return !guts().branchName_.empty();
226  }
std::string const& art::BranchDescription::wrappedName ( ) const
inline
void art::BranchDescription::write ( std::ostream &  os) const

Definition at line 109 of file BranchDescription.cc.

References branchType_, friendlyClassName(), moduleLabel(), processName(), producedClassName(), productID(), and productInstanceName().

Referenced by art::operator<<(), and art::Provenance::write().

110  {
111  os << "Branch Type = " << branchType_ << std::endl;
112  os << "Process Name = " << processName() << std::endl;
113  os << "ModuleLabel = " << moduleLabel() << std::endl;
114  os << "Product ID = " << productID() << '\n';
115  os << "Class Name = " << producedClassName() << '\n';
116  os << "Friendly Class Name = " << friendlyClassName() << '\n';
117  os << "Product Instance Name = " << productInstanceName() << std::endl;
118  }
std::string const & producedClassName() const
std::string const & moduleLabel() const
ProductID productID() const
std::string const & productInstanceName() const
std::string const & processName() const
std::string const & friendlyClassName() const

Friends And Related Function Documentation

bool combinable ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 246 of file BranchDescription.cc.

Referenced by art::operator==().

247  {
248  return (a.branchType() == b.branchType()) &&
249  (a.processName() == b.processName()) &&
250  (a.producedClassName() == b.producedClassName()) &&
251  (a.friendlyClassName() == b.friendlyClassName()) &&
252  (a.productInstanceName() == b.productInstanceName()) &&
253  (a.moduleLabel() == b.moduleLabel()) &&
254  (a.productID() == b.productID());
255  }
friend class detail::BranchDescriptionStreamer
friend

Definition at line 220 of file BranchDescription.h.

bool operator< ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 186 of file BranchDescription.cc.

187  {
188  if (a.processName() < b.processName()) {
189  return true;
190  }
191  if (b.processName() < a.processName()) {
192  return false;
193  }
194  if (a.producedClassName() < b.producedClassName()) {
195  return true;
196  }
197  if (b.producedClassName() < a.producedClassName()) {
198  return false;
199  }
200  if (a.friendlyClassName() < b.friendlyClassName()) {
201  return true;
202  }
203  if (b.friendlyClassName() < a.friendlyClassName()) {
204  return false;
205  }
206  if (a.productInstanceName() < b.productInstanceName()) {
207  return true;
208  }
209  if (b.productInstanceName() < a.productInstanceName()) {
210  return false;
211  }
212  if (a.moduleLabel() < b.moduleLabel()) {
213  return true;
214  }
215  if (b.moduleLabel() < a.moduleLabel()) {
216  return false;
217  }
218  if (a.branchType() < b.branchType()) {
219  return true;
220  }
221  if (b.branchType() < a.branchType()) {
222  return false;
223  }
224  if (a.productID() < b.productID()) {
225  return true;
226  }
227  if (b.productID() < a.productID()) {
228  return false;
229  }
230  if (a.psetIDs() < b.psetIDs()) {
231  return true;
232  }
233  if (b.psetIDs() < a.psetIDs()) {
234  return false;
235  }
236  if (a.processConfigurationIDs() < b.processConfigurationIDs()) {
237  return true;
238  }
239  if (b.processConfigurationIDs() < a.processConfigurationIDs()) {
240  return false;
241  }
242  return false;
243  }
bool operator== ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 258 of file BranchDescription.cc.

259  {
260  return combinable(a, b) && (a.psetIDs() == b.psetIDs()) &&
261  (a.processConfigurationIDs() == b.processConfigurationIDs());
262  }
friend bool combinable(BranchDescription const &, BranchDescription const &)

Member Data Documentation

BranchType art::BranchDescription::branchType_ {InEvent}
private

Definition at line 256 of file BranchDescription.h.

Referenced by swap(), throwIfInvalid_(), and write().

std::string art::BranchDescription::friendlyClassName_ {}
private

Definition at line 272 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

int constexpr art::BranchDescription::invalidBasketSize {0}
static

Definition at line 55 of file BranchDescription.h.

Referenced by merge().

int constexpr art::BranchDescription::invalidCompression {-1}
static

Definition at line 56 of file BranchDescription.h.

Referenced by merge().

int constexpr art::BranchDescription::invalidSplitLevel {-1}
static

Definition at line 54 of file BranchDescription.h.

Referenced by merge().

std::string art::BranchDescription::moduleLabel_ {}
private

Definition at line 260 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

std::set<ProcessConfigurationID> art::BranchDescription::processConfigurationIDs_ {}
private

Definition at line 287 of file BranchDescription.h.

Referenced by BranchDescription(), merge(), and swap().

std::string art::BranchDescription::processName_ {}
private

Definition at line 263 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

std::string art::BranchDescription::producedClassName_ {}
private

Definition at line 269 of file BranchDescription.h.

Referenced by BranchDescription(), fluffTransients_(), swap(), and throwIfInvalid_().

ProductID art::BranchDescription::productID_ {}
private

Definition at line 266 of file BranchDescription.h.

Referenced by initProductID_(), and swap().

std::string art::BranchDescription::productInstanceName_ {}
private

Definition at line 276 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

std::set<fhicl::ParameterSetID> art::BranchDescription::psetIDs_ {}
private

Definition at line 283 of file BranchDescription.h.

Referenced by BranchDescription(), merge(), and swap().

bool art::BranchDescription::supportsView_ {false}
private

Definition at line 279 of file BranchDescription.h.

Referenced by BranchDescription(), and swap().

Transient<Transients> art::BranchDescription::transients_ {}
mutableprivate

Definition at line 289 of file BranchDescription.h.

Referenced by fluffTransients_(), and swap().


The documentation for this class was generated from the following files: