CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RoadMapSorting.cc
Go to the documentation of this file.
1 //
2 // Package: RecoTracker/RoadMapRecord
3 // Class: RoadMapSorting
4 //
5 // Description: defines sorting of Roads keys (RoadSeed)
6 //
7 // Original Author: Oliver Gutsche, gutsche@fnal.gov
8 // Created: Tue Apr 17 20:31:32 UTC 2007
9 //
10 // $Author: gutsche $
11 // $Date: 2007/04/17 21:56:54 $
12 // $Revision: 1.2 $
13 //
14 
15 #include <cmath>
16 
18 
19 unsigned int RoadMapSorting::calculateRoadSeedIndex(const std::pair<std::vector<const Ring*>, std::vector<const Ring*> >& seed) const{
20  //
21  // loop over seed rings and build index:
22  // 2 rings: ring1->getindex()*1000 + ring2->getindex()
23  //
24 
25  // return value
26  unsigned int result = 0;
27 
28  unsigned int counter = seed.first.size() + seed.second.size();
29  for ( std::vector<const Ring*>::const_iterator ring = seed.first.begin(),
30  ringEnd = seed.first.end();
31  ring != ringEnd;
32  ++ring ) {
33  result += (*ring)->getindex() * (unsigned int)std::pow((double)1000,(double)--counter);
34  }
35  for ( std::vector<const Ring*>::const_iterator ring = seed.second.begin(),
36  ringEnd = seed.second.end();
37  ring != ringEnd;
38  ++ring ) {
39  result += (*ring)->getindex() * (unsigned int)std::pow((double)1000,(double)--counter);
40  }
41 
42  return result;
43 }
unsigned int calculateRoadSeedIndex(const std::pair< std::vector< const Ring * >, std::vector< const Ring * > > &seed) const
tuple result
Definition: query.py:137
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40