CMS 3D CMS Logo

Typedefs | Functions
DDsvalues.h File Reference
#include <algorithm>
#include <map>
#include <ostream>
#include <utility>
#include <vector>
#include "DetectorDescription/Core/interface/DDValue.h"

Go to the source code of this file.

Typedefs

using DDsvalues_Content_type = DDsvalues_type::value_type
 
using DDsvalues_type = std::vector< std::pair< unsigned int, DDValue > >
 

Functions

bool DDfetch (const DDsvalues_type *, DDValue &)
 helper for retrieving DDValues from DDsvalues_type *. More...
 
unsigned int DDfetch (const std::vector< const DDsvalues_type * > &sp, DDValue &toFetch, std::vector< DDValue > &result)
 helper for retrieving DDValues from a std::vector of (DDsvalues_type *). More...
 
DDsvalues_type::const_iterator find (DDsvalues_type const &sv, unsigned int id)
 
DDsvalues_type::const_iterator find (DDsvalues_type::const_iterator begin, DDsvalues_type::const_iterator end, unsigned int id)
 
void merge (DDsvalues_type &target, DDsvalues_type const &sv, bool sortit=true)
 
bool operator< (const DDsvalues_Content_type &lh, const DDsvalues_Content_type &rh)
 
std::ostream & operator<< (std::ostream &, const DDsvalues_type &)
 
std::ostream & operator<< (std::ostream &, const std::vector< const DDsvalues_type * > &)
 

Typedef Documentation

◆ DDsvalues_Content_type

using DDsvalues_Content_type = DDsvalues_type::value_type

Definition at line 13 of file DDsvalues.h.

◆ DDsvalues_type

using DDsvalues_type = std::vector<std::pair<unsigned int, DDValue> >

Definition at line 12 of file DDsvalues.h.

Function Documentation

◆ DDfetch() [1/2]

bool DDfetch ( const DDsvalues_type p,
DDValue v 
)

helper for retrieving DDValues from DDsvalues_type *.

Example:

std::vector<std::string> myFunction(const DDsvalues_type * svalptr, const std::string & name)
{
static std::vector<std::string> v; // empty std::vector, for zero result
if (DDfetch(svalptr,val)) {
return val.std::strings();
} else {
return v;
}
}

Definition at line 79 of file DDsvalues.cc.

79  {
80  bool result = false;
81  DDsvalues_type::const_iterator it = find(*p, v);
82  if (it != p->end()) {
83  result = true;
84  v = it->second;
85  }
86  return result;
87 }

References spr::find(), AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and findQualityFiles::v.

Referenced by DDMapper< G4LogicalVolume *, DDLogicalPart >::all(), ME0GeometryParsFromDD::buildEtaPartition(), GEMGeometryParsFromDD::buildEtaPartition(), ME0GeometryBuilder::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), RPCGeometryParsFromDD::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), DTGeometryParsFromDD::buildGeometry(), DTGeometryBuilderFromDDD::buildGeometry(), dddGetStringRaw(), DDfetch(), FastTimeParametersFromDD::getDDDArray(), EcalSimParametersFromDD::getDDDArray(), HcalSimParametersFromDD::getDDDArray(), HGCalParametersFromDD::getDDDArray(), MaterialBudgetHcalHistos::getDDDArray(), HGCalGeomParameters::getDDDArray(), HGCalParametersFromDD::getDDDValue(), DDG4Builder::getDouble(), MuonDDDNumbering::getInt(), DDG4Builder::getInt(), CaloSimParametersFromDD::getNames(), CaloSimParametersFromDD::getNumbers(), ExtractStringFromDD< FilteredView >::getString(), ExtractStringFromDDD< FilteredView >::getString(), DDG4SensitiveConverter::getString(), EcalSimParametersFromDD::getStringArray(), DDMapper< G4LogicalVolume *, DDLogicalPart >::noSpecifics(), DDMapper< G4LogicalVolume *, DDLogicalPart >::toDouble(), and DDMapper< G4LogicalVolume *, DDLogicalPart >::toString().

◆ DDfetch() [2/2]

unsigned int DDfetch ( const std::vector< const DDsvalues_type * > &  sp,
DDValue toFetch,
std::vector< DDValue > &  result 
)

helper for retrieving DDValues from a std::vector of (DDsvalues_type *).

Definition at line 89 of file DDsvalues.cc.

89  {
90  unsigned int count = 0;
91  for (const auto &it : sp) {
92  if (DDfetch(it, toFetch)) {
93  result.emplace_back(toFetch);
94  ++count;
95  }
96  }
97  return count;
98 }

References KineDebug3::count(), DDfetch(), and mps_fire::result.

◆ find() [1/2]

DDsvalues_type::const_iterator find ( DDsvalues_type const &  sv,
unsigned int  id 
)
inline

Definition at line 30 of file DDsvalues.h.

30  {
31  return find(sv.begin(), sv.end(), id);
32 }

References find(), triggerObjects_cff::id, and pfDeepBoostedJetPreprocessParams_cfi::sv.

◆ find() [2/2]

DDsvalues_type::const_iterator find ( DDsvalues_type::const_iterator  begin,
DDsvalues_type::const_iterator  end,
unsigned int  id 
)
inline

Definition at line 19 of file DDsvalues.h.

21  {
22  static const DDValue dummy;
24  DDsvalues_type::const_iterator it = std::lower_bound(begin, end, v);
25  if (it != end && (*it).first == id)
26  return it;
27  return end;
28 }

References begin, end, cuda_std::lower_bound(), and findQualityFiles::v.

Referenced by find().

◆ merge()

void merge ( DDsvalues_type target,
DDsvalues_type const &  sv,
bool  sortit = true 
)

Definition at line 5 of file DDsvalues.cc.

5  {
6  if (target.empty()) {
7  target = sv;
8  return;
9  }
10  DDsvalues_type::const_iterator sit = sv.begin();
11  DDsvalues_type::const_iterator sed = sv.end();
12  // fast merge
13  if (target.back() < sv.front()) {
14  target.insert(target.end(), sit, sed);
15  return;
16  }
17  if (sv.back() < target.front()) {
18  target.insert(target.begin(), sit, sed);
19  return;
20  }
21  {
22  DDsvalues_type::iterator it = std::lower_bound(target.begin(), target.end(), sv.front());
23  if (it == std::lower_bound(target.begin(), target.end(), sv.back())) {
24  target.insert(it, sit, sed);
25  return;
26  }
27  }
28  // it nevers arrives here...
29  target.reserve(target.size() + sv.size());
30  DDsvalues_type::const_iterator ted = target.end();
31  for (; sit != sed; ++sit) {
32  DDsvalues_type::const_iterator it = find(target.begin(), ted, (*sit).first);
33  if (it != ted)
34  const_cast<DDsvalues_Content_type &>(*it).second = (*sit).second;
35  else
36  target.emplace_back(*sit);
37  }
38  if (sortit)
39  std::sort(target.begin(), target.end());
40 }

References spr::find(), cuda_std::lower_bound(), pfDeepBoostedJetPreprocessParams_cfi::sv, and filterCSVwithJSON::target.

◆ operator<()

bool operator< ( const DDsvalues_Content_type lh,
const DDsvalues_Content_type rh 
)
inline

Definition at line 15 of file DDsvalues.h.

15  {
16  return lh.first < rh.first;
17 }

References mathSSE::lh.

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  ,
const DDsvalues_type  
)

Definition at line 42 of file DDsvalues.cc.

42  {
43  DDsvalues_type::const_iterator it = s.begin();
44  for (; it != s.end(); ++it) {
45  os << it->second;
46  /*
47  os << DDValue(it->first).name() << " = ";
48  for (unsigned int i=0; i<it->second.size(); ++i) {
49  os << it->second[i] << ' ';
50  }
51  os << std::endl;
52  */
53  }
54  return os;
55 }

References alignCSCRings::s.

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  ,
const std::vector< const DDsvalues_type * > &   
)

Definition at line 57 of file DDsvalues.cc.

57  {
58  for (const auto &i : v) {
59  os << *i; // << std::endl;
60  }
61 
62  return os;
63 }

References mps_fire::i, and findQualityFiles::v.

mps_fire.i
i
Definition: mps_fire.py:355
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
end
#define end
Definition: vmac.h:39
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
DDsvalues_Content_type
DDsvalues_type::value_type DDsvalues_Content_type
Definition: DDsvalues.h:13
heppy_batch.val
val
Definition: heppy_batch.py:351
DDValue
Definition: DDValue.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
find
DDsvalues_type::const_iterator find(DDsvalues_type::const_iterator begin, DDsvalues_type::const_iterator end, unsigned int id)
Definition: DDsvalues.h:19
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
mps_fire.result
result
Definition: mps_fire.py:303
DDfetch
bool DDfetch(const DDsvalues_type *p, DDValue &v)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
dummy
Definition: DummySelector.h:38
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
begin
#define begin
Definition: vmac.h:32