ATLAS Offline Software
Loading...
Searching...
No Matches
BinUtilityCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
9
11 Trk::BinUtility *transObj,
12 MsgStream&)
13{
14 transObj->clear();
15
16 // the loop has to go over the type
17 for (size_t ib = 0; ib < persObj->type.size(); ++ib) {
18 int typ = persObj->type[ib];
19
20 // check the type
21 if ( typ == Trk::equidistant ) // equidistant binning
22 (*transObj) += Trk::BinUtility(size_t((persObj->bins)[ib]),
23 float((persObj->min)[ib]),
24 float((persObj->max)[ib]),
25 Trk::BinningOption((persObj->option)[ib]),
26 Trk::BinningValue((persObj->binvalue)[ib]));
27 else if ( typ == Trk::biequidistant ) {
28 // biequidistant binning
29 size_t subbins = size_t(0.5*((persObj->bins)[ib]-1));
30 (*transObj) += Trk::BinUtility(size_t(subbins),
31 float((persObj->subStep)[ib]),
32 float((persObj->min)[ib]),
33 float((persObj->max)[ib]),
34 Trk::BinningOption((persObj->option)[ib]),
35 Trk::BinningValue((persObj->binvalue)[ib]));
36 } else {
37 // arbitary
38 if ((persObj->binvalue)[ib] != Trk::binH){
39 std::vector<float> cboundaries = (persObj->boundaries)[ib];
40 (*transObj) += Trk::BinUtility(cboundaries,
41 Trk::BinningOption((persObj->option)[ib]),
42 Trk::BinningValue((persObj->binvalue)[ib]));
43 } else {
44 std::vector< std::pair<int,float> > chbounds = ((persObj->hbounds)[ib]);
45 (*transObj) += Trk::BinUtility(float((persObj->refphi)[ib]),
46 chbounds);
47 }
48 }
49 }
50}
51
53 Trk::BinUtility_p1 *persObj,
54 MsgStream& )
55{
56 // loop over the BinningData and dump it into the persistent object
57 for (const Trk::BinningData& bd : transObj->binningData()) {
58 persObj->type.push_back(bd.type);
59 persObj->option.push_back(bd.option);
60 persObj->binvalue.push_back(bd.binvalue);
61 persObj->bins.push_back(bd.bins);
62 persObj->min.push_back(bd.min);
63 persObj->max.push_back(bd.max);
64 persObj->step.push_back(bd.step);
65 persObj->subStep.push_back(bd.subStep);
66 persObj->boundaries.push_back(bd.boundaries);
67 persObj->refphi.push_back(bd.refphi);
68 persObj->hbounds.push_back(bd.hbounds);
69 }
70}
virtual void transToPers(const Trk::BinUtility *transObj, Trk::BinUtility_p1 *persObj, MsgStream &log)
virtual void persToTrans(const Trk::BinUtility_p1 *persObj, Trk::BinUtility *transObj, MsgStream &log)
std::vector< unsigned int > bins
std::vector< int > option
std::vector< float > step
std::vector< std::vector< std::pair< int, float > > > hbounds
std::vector< float > subStep
std::vector< std::vector< float > > boundaries
std::vector< int > type
std::vector< float > min
std::vector< float > refphi
std::vector< int > binvalue
std::vector< float > max
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
void clear()
Clear the data.
Definition BinUtility.h:248
const std::vector< BinningData > & binningData() const
return the binning data
Definition BinUtility.h:123
This class holds all the data necessary for the bin calculation.
Definition BinningData.h:47
BinningOption
enum BinValue
Definition BinningType.h:39
@ biequidistant
Definition BinningType.h:33
@ equidistant
Definition BinningType.h:32
BinningValue
how to take the global / local position
Definition BinningType.h:46
@ binH
Definition BinningType.h:53