Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:34

0001 #include "JetMETCorrections/InterpolationTables/interface/DualHistoAxis.h"
0002 
0003 #include "Alignment/Geners/interface/binaryIO.hh"
0004 #include "Alignment/Geners/interface/IOException.hh"
0005 #include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
0006 
0007 namespace npstat {
0008   bool DualHistoAxis::write(std::ostream& of) const {
0009     unsigned char c = uniform_;
0010     gs::write_pod(of, c);
0011     if (uniform_)
0012       return !of.fail() && u_.classId().write(of) && u_.write(of);
0013     else
0014       return !of.fail() && a_.classId().write(of) && a_.write(of);
0015   }
0016 
0017   DualHistoAxis* DualHistoAxis::read(const gs::ClassId& id, std::istream& in) {
0018     static const gs::ClassId current(gs::ClassId::makeId<DualHistoAxis>());
0019     current.ensureSameId(id);
0020 
0021     unsigned char c;
0022     gs::read_pod(in, &c);
0023     gs::ClassId clid(in, 1);
0024     if (in.fail())
0025       throw gs::IOReadFailure(
0026           "In npstat::DualHistoAxis::read: "
0027           "input stream failure");
0028     if (c) {
0029       CPP11_auto_ptr<HistoAxis> axis(HistoAxis::read(clid, in));
0030       return new DualHistoAxis(*axis);
0031     } else {
0032       CPP11_auto_ptr<NUHistoAxis> axis(NUHistoAxis::read(clid, in));
0033       return new DualHistoAxis(*axis);
0034     }
0035   }
0036 }  // namespace npstat