test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeometricSearchTrackerBuilder.cc
Go to the documentation of this file.
2 
5 #include "TIBLayerBuilder.h"
6 #include "TOBLayerBuilder.h"
7 #include "TIDLayerBuilder.h"
8 #include "TECLayerBuilder.h"
9 
11 
13 
14 
16 #include <boost/function.hpp>
17 #include <boost/bind.hpp>
18 
19 using namespace std;
20 
23  const TrackerGeometry* theGeomDetGeometry)
24 {
25  PixelBarrelLayerBuilder aPixelBarrelLayerBuilder;
26  PixelForwardLayerBuilder aPixelForwardLayerBuilder;
27  TIBLayerBuilder aTIBLayerBuilder;
28  TOBLayerBuilder aTOBLayerBuilder;
29  TIDLayerBuilder aTIDLayerBuilder;
30  TECLayerBuilder aTECLayerBuilder;
31 
32  vector<BarrelDetLayer const*> thePxlBarLayers;
33  vector<BarrelDetLayer const*> theTIBLayers;
34  vector<BarrelDetLayer const*> theTOBLayers;
35  vector<ForwardDetLayer const*> theNegPxlFwdLayers;
36  vector<ForwardDetLayer const*> thePosPxlFwdLayers;
37  vector<ForwardDetLayer const*> theNegTIDLayers;
38  vector<ForwardDetLayer const*> thePosTIDLayers;
39  vector<ForwardDetLayer const*> theNegTECLayers;
40  vector<ForwardDetLayer const*> thePosTECLayers;
41 
42  using namespace trackerTrie;
43 
44  //-- future code
45  // create a Trie
46  DetTrie trie(0);
47 
48  // to be moved elsewhere
49  {
50  const TrackingGeometry::DetUnitContainer& modules = theGeomDetGeometry->detUnits();
51  typedef TrackingGeometry::DetUnitContainer::const_iterator Iter;
52  Iter b=modules.begin();
53  Iter e=modules.end();
54  Iter last;
55  try {
56  for(;b!=e; ++b) {
57  last = b;
58  unsigned int rawid = (*b)->geographicalId().rawId();
59  trie.insert(trackerHierarchy(rawid), *b);
60  }
61  }
62  catch(edm::Exception const & e) {
63  std::cout << "in filling " << e.what() << std::endl;
64  unsigned int rawid = (*last)->geographicalId().rawId();
65  int subdetid = (*last)->geographicalId().subdetId();
66  std::cout << rawid << " " << subdetid << std::endl;
67  }
68  }
69 
70  // layers "ids"
71  unsigned int layerId[] = {1,3,5,21,22,41,42,61,62};
72  // boost::function<void(trackerTrie::Node const &)> fun[9];
73  /*
74  thePxlBarLayers.push_back( aPixelBarrelLayerBuilder.build(*p) );
75  theTIBLayers.push_back( aTIBLayerBuilder.build(*p) );
76  theTOBLayers.push_back( aTOBLayerBuilder.build(*p) );
77  theNegPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*p) );
78  thePosPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*p) );
79  theNegTIDLayers.push_back( aTIDLayerBuilder.build(*p) );
80  thePosTIDLayers.push_back( aTIDLayerBuilder.build(*p) );
81  theNegTECLayers.push_back( aTECLayerBuilder.build(*p) );
82  thePosTECLayers.push_back( aTECLayerBuilder.build(*p) );
83  */
84 
85 
86  for (int i=0;i<9;i++) {
87  std::string s;
88  if (layerId[i]>9) s+=char(layerId[i]/10);
89  s+=char(layerId[i]%10);
91  node_iterator p(trie.node(s));
92  for (;p!=e;++p) {
93  // fun[i](*p);
94  }
95  }
96 
97 
98  // current code
99  vector<const GeometricDet*> theGeometricDetLayers = theGeometricTracker->components();
100  for(vector<const GeometricDet*>::const_iterator it=theGeometricDetLayers.begin();
101  it!=theGeometricDetLayers.end(); it++){
102 
103  if( (*it)->type() == GeometricDet::PixelBarrel) {
104  vector<const GeometricDet*> thePxlBarGeometricDetLayers = (*it)->components();
105  for(vector<const GeometricDet*>::const_iterator it2=thePxlBarGeometricDetLayers.begin();
106  it2!=thePxlBarGeometricDetLayers.end(); it2++){
107  thePxlBarLayers.push_back( aPixelBarrelLayerBuilder.build(*it2,theGeomDetGeometry) );
108  }
109  }
110 
111  if( (*it)->type() == GeometricDet::TIB) {
112  vector<const GeometricDet*> theTIBGeometricDetLayers = (*it)->components();
113  for(vector<const GeometricDet*>::const_iterator it2=theTIBGeometricDetLayers.begin();
114  it2!=theTIBGeometricDetLayers.end(); it2++){
115  theTIBLayers.push_back( aTIBLayerBuilder.build(*it2,theGeomDetGeometry) );
116  }
117  }
118 
119  if( (*it)->type() == GeometricDet::TOB) {
120  vector<const GeometricDet*> theTOBGeometricDetLayers = (*it)->components();
121  for(vector<const GeometricDet*>::const_iterator it2=theTOBGeometricDetLayers.begin();
122  it2!=theTOBGeometricDetLayers.end(); it2++){
123  theTOBLayers.push_back( aTOBLayerBuilder.build(*it2,theGeomDetGeometry) );
124  }
125  }
126 
127 
128  if( (*it)->type() == GeometricDet::PixelEndCap || (*it)->type() == GeometricDet::PixelEndCapPhase1 ){
129  vector<const GeometricDet*> thePxlFwdGeometricDetLayers = (*it)->components();
130  for(vector<const GeometricDet*>::const_iterator it2=thePxlFwdGeometricDetLayers.begin();
131  it2!=thePxlFwdGeometricDetLayers.end(); it2++){
132  if((*it2)->positionBounds().z() < 0)
133  theNegPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
134  if((*it2)->positionBounds().z() > 0)
135  thePosPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
136  }
137  }
138 
139 
140 
141  if( (*it)->type() == GeometricDet::TID){
142  vector<const GeometricDet*> theTIDGeometricDetLayers = (*it)->components();
143  for(vector<const GeometricDet*>::const_iterator it2=theTIDGeometricDetLayers.begin();
144  it2!=theTIDGeometricDetLayers.end(); it2++){
145  if((*it2)->positionBounds().z() < 0)
146  theNegTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
147  if((*it2)->positionBounds().z() > 0)
148  thePosTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
149  }
150  }
151 
152  if( (*it)->type() == GeometricDet::TEC) {
153  vector<const GeometricDet*> theTECGeometricDetLayers = (*it)->components();
154  for(vector<const GeometricDet*>::const_iterator it2=theTECGeometricDetLayers.begin();
155  it2!=theTECGeometricDetLayers.end(); it2++){
156  if((*it2)->positionBounds().z() < 0)
157  theNegTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
158  if((*it2)->positionBounds().z() > 0)
159  thePosTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
160  }
161  }
162 
163 
164  }
165 
166 
167  return new GeometricSearchTracker(thePxlBarLayers,theTIBLayers,theTOBLayers,
168  theNegPxlFwdLayers,theNegTIDLayers,theNegTECLayers,
169  thePosPxlFwdLayers,thePosTIDLayers,thePosTECLayers);
170 }
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
GeometricSearchTracker * build(const GeometricDet *theGeometricTracker, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TIBLayer * build(const GeometricDet *aTIBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TOBLayer * build(const GeometricDet *aTOBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TECLayer * build(const GeometricDet *aTECLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
PixelBarrelLayer * build(const GeometricDet *aPixelBarrelLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
TIDLayer * build(const GeometricDet *aTIDLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
std::string trackerHierarchy(unsigned int id)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:169
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
void insert(std::string const &str, const T &value)
Definition: Trie.h:621
ForwardDetLayer * build(const GeometricDet *aPixelForwardLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
double b
Definition: hdecay.h:120
tuple cout
Definition: gather_cfg.py:121
std::vector< GeomDetUnit const * > DetUnitContainer
const TrieNode< T > * node(std::string const &str) const
get node matching a string
Definition: Trie.h:666