CMS 3D CMS Logo

DualHistoAxis.cc
Go to the documentation of this file.
2 
3 #include "Alignment/Geners/interface/binaryIO.hh"
4 #include "Alignment/Geners/interface/IOException.hh"
5 #include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
6 
7 namespace npstat {
8  bool DualHistoAxis::write(std::ostream& of) const {
9  unsigned char c = uniform_;
10  gs::write_pod(of, c);
11  if (uniform_)
12  return !of.fail() && u_.classId().write(of) && u_.write(of);
13  else
14  return !of.fail() && a_.classId().write(of) && a_.write(of);
15  }
16 
17  DualHistoAxis* DualHistoAxis::read(const gs::ClassId& id, std::istream& in) {
18  static const gs::ClassId current(gs::ClassId::makeId<DualHistoAxis>());
19  current.ensureSameId(id);
20 
21  unsigned char c;
22  gs::read_pod(in, &c);
23  gs::ClassId clid(in, 1);
24  if (in.fail())
25  throw gs::IOReadFailure(
26  "In npstat::DualHistoAxis::read: "
27  "input stream failure");
28  if (c) {
29  CPP11_auto_ptr<HistoAxis> axis(HistoAxis::read(clid, in));
30  return new DualHistoAxis(*axis);
31  } else {
32  CPP11_auto_ptr<NUHistoAxis> axis(NUHistoAxis::read(clid, in));
33  return new DualHistoAxis(*axis);
34  }
35  }
36 } // namespace npstat
npstat::DualHistoAxis::u_
HistoAxis u_
Definition: DualHistoAxis.h:128
npstat::DualHistoAxis::write
bool write(std::ostream &of) const
Definition: DualHistoAxis.cc:8
npstat::DualHistoAxis::uniform_
bool uniform_
Definition: DualHistoAxis.h:129
npstat::HistoAxis::classId
gs::ClassId classId() const
Definition: HistoAxis.h:117
npstat::NUHistoAxis::read
static NUHistoAxis * read(const gs::ClassId &id, std::istream &in)
Definition: NUHistoAxis.cc:142
npstat::NUHistoAxis::write
bool write(std::ostream &of) const
Definition: NUHistoAxis.cc:134
npstat::DualHistoAxis::read
static DualHistoAxis * read(const gs::ClassId &id, std::istream &in)
Definition: DualHistoAxis.cc:17
npstat
Definition: AbsArrayProjector.h:14
npstat::HistoAxis::write
bool write(std::ostream &of) const
Definition: HistoAxis.cc:113
npstat::DualHistoAxis
Definition: DualHistoAxis.h:23
npstat::NUHistoAxis::classId
gs::ClassId classId() const
Definition: NUHistoAxis.h:95
recoMuon::in
Definition: RecoMuonEnumerators.h:6
npstat::HistoAxis::read
static HistoAxis * read(const gs::ClassId &id, std::istream &in)
Definition: HistoAxis.cc:121
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
DualHistoAxis.h
Represent both equidistant and non-uniform histogram axis binning.
npstat::DualHistoAxis::a_
NUHistoAxis a_
Definition: DualHistoAxis.h:127
npstat::DualHistoAxis::DualHistoAxis
DualHistoAxis()
Definition: DualHistoAxis.h:144