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.
3 
8 #include "TIBLayerBuilder.h"
9 #include "TOBLayerBuilder.h"
10 #include "TIDLayerBuilder.h"
11 #include "TECLayerBuilder.h"
12 
14 
17 
19 #include <boost/function.hpp>
20 #include <boost/bind.hpp>
21 
22 using namespace std;
23 
26  const TrackerGeometry* theGeomDetGeometry,
27  const TrackerTopology* tTopo)
28 {
29 
30  PixelBarrelLayerBuilder aPixelBarrelLayerBuilder;
31  Phase2OTBarrelLayerBuilder aPhase2OTBarrelLayerBuilder;
34  Phase2OTEndcapLayerBuilder aPhase2OTEndcapLayerBuilder;
35  TIBLayerBuilder aTIBLayerBuilder;
36  TOBLayerBuilder aTOBLayerBuilder;
37  TIDLayerBuilder aTIDLayerBuilder;
38  TECLayerBuilder aTECLayerBuilder;
39 
40  vector<BarrelDetLayer const*> thePxlBarLayers;
41  vector<BarrelDetLayer const*> theTIBLayers;
42  vector<BarrelDetLayer const*> theTOBLayers;
43  vector<ForwardDetLayer const*> theNegPxlFwdLayers;
44  vector<ForwardDetLayer const*> thePosPxlFwdLayers;
45  vector<ForwardDetLayer const*> theNegTIDLayers;
46  vector<ForwardDetLayer const*> thePosTIDLayers;
47  vector<ForwardDetLayer const*> theNegTECLayers;
48  vector<ForwardDetLayer const*> thePosTECLayers;
49 
50  using namespace trackerTrie;
51 
52  //-- future code
53  // create a Trie
54  DetTrie trie(0);
55 
56  //FIXME::ERICA: this is not just DetUnits anymore!
57  // to be moved elsewhere
58  {
59  const TrackingGeometry::DetUnitContainer& modules = theGeomDetGeometry->detUnits();
60  typedef TrackingGeometry::DetUnitContainer::const_iterator Iter;
61  Iter b=modules.begin();
62  Iter e=modules.end();
63  Iter last;
64  try {
65  for(;b!=e; ++b) {
66  last = b;
67  unsigned int rawid = (*b)->geographicalId().rawId();
68  trie.insert(trackerHierarchy(rawid), *b);
69  }
70  }
71  catch(edm::Exception const & e) {
72  std::cout << "in filling " << e.what() << std::endl;
73  unsigned int rawid = (*last)->geographicalId().rawId();
74  int subdetid = (*last)->geographicalId().subdetId();
75  std::cout << rawid << " " << subdetid << std::endl;
76  }
77  }
78 
79  // layers "ids"
80  unsigned int layerId[] = {1,3,5,21,22,41,42,61,62};
81  // boost::function<void(trackerTrie::Node const &)> fun[9];
82  /*
83  thePxlBarLayers.push_back( aPixelBarrelLayerBuilder.build(*p) );
84  theTIBLayers.push_back( aTIBLayerBuilder.build(*p) );
85  theTOBLayers.push_back( aTOBLayerBuilder.build(*p) );
86  theNegPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*p) );
87  thePosPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*p) );
88  theNegTIDLayers.push_back( aTIDLayerBuilder.build(*p) );
89  thePosTIDLayers.push_back( aTIDLayerBuilder.build(*p) );
90  theNegTECLayers.push_back( aTECLayerBuilder.build(*p) );
91  thePosTECLayers.push_back( aTECLayerBuilder.build(*p) );
92  */
93 
94 
95  for (int i=0;i<9;i++) {
96  std::string s;
97  if (layerId[i]>9) s+=char(layerId[i]/10);
98  s+=char(layerId[i]%10);
100  node_iterator p(trie.node(s));
101  for (;p!=e;++p) {
102  // fun[i](*p);
103  }
104  }
105 
106 
107  // current code
108  vector<const GeometricDet*> theGeometricDetLayers = theGeometricTracker->components();
109  for(vector<const GeometricDet*>::const_iterator it=theGeometricDetLayers.begin();
110  it!=theGeometricDetLayers.end(); it++){
111 
112  if( (*it)->type() == GeometricDet::PixelBarrel) {
113  vector<const GeometricDet*> thePxlBarGeometricDetLayers = (*it)->components();
114  for(vector<const GeometricDet*>::const_iterator it2=thePxlBarGeometricDetLayers.begin();
115  it2!=thePxlBarGeometricDetLayers.end(); it2++){
116  thePxlBarLayers.push_back( aPixelBarrelLayerBuilder.build(*it2,theGeomDetGeometry) );
117  }
118  }
119 
120  if( (*it)->type() == GeometricDet::PixelPhase1Barrel) {
121  vector<const GeometricDet*> thePxlBarGeometricDetLayers = (*it)->components();
122  for(vector<const GeometricDet*>::const_iterator it2=thePxlBarGeometricDetLayers.begin();
123  it2!=thePxlBarGeometricDetLayers.end(); it2++){
124  thePxlBarLayers.push_back( aPixelBarrelLayerBuilder.build(*it2,theGeomDetGeometry) );
125  }
126  }
127 
128  if( (*it)->type() == GeometricDet::TIB) {
129  vector<const GeometricDet*> theTIBGeometricDetLayers = (*it)->components();
130  for(vector<const GeometricDet*>::const_iterator it2=theTIBGeometricDetLayers.begin();
131  it2!=theTIBGeometricDetLayers.end(); it2++){
132  theTIBLayers.push_back( aTIBLayerBuilder.build(*it2,theGeomDetGeometry) );
133  }
134  }
135 
136  if( (*it)->type() == GeometricDet::TOB) {
137  vector<const GeometricDet*> theTOBGeometricDetLayers = (*it)->components();
138  for(vector<const GeometricDet*>::const_iterator it2=theTOBGeometricDetLayers.begin();
139  it2!=theTOBGeometricDetLayers.end(); it2++){
140  theTOBLayers.push_back( aTOBLayerBuilder.build(*it2,theGeomDetGeometry) );
141  }
142  }
143 
144  if( (*it)->type() == GeometricDet::OTPhase2Barrel) {
145  vector<const GeometricDet*> theTOBGeometricDetLayers = (*it)->components();
146  for(vector<const GeometricDet*>::const_iterator it2=theTOBGeometricDetLayers.begin();
147  it2!=theTOBGeometricDetLayers.end(); it2++){
148  theTOBLayers.push_back( aPhase2OTBarrelLayerBuilder.build(*it2,theGeomDetGeometry) );
149  }
150  }
151 
152  if( (*it)->type() == GeometricDet::PixelEndCap) {
153  vector<const GeometricDet*> thePxlFwdGeometricDetLayers = (*it)->components();
154  for(vector<const GeometricDet*>::const_iterator it2=thePxlFwdGeometricDetLayers.begin();
155  it2!=thePxlFwdGeometricDetLayers.end(); it2++){
156  if((*it2)->positionBounds().z() < 0)
157  theNegPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
158  if((*it2)->positionBounds().z() > 0)
159  thePosPxlFwdLayers.push_back( aPixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
160  }
161  }
162 
163  if( (*it)->type() == GeometricDet::PixelPhase1EndCap ) {
164  vector<const GeometricDet*> thePxlFwdGeometricDetLayers = (*it)->components();
165  for(vector<const GeometricDet*>::const_iterator it2=thePxlFwdGeometricDetLayers.begin();
166  it2!=thePxlFwdGeometricDetLayers.end(); it2++){
167  if((*it2)->positionBounds().z() < 0)
168  theNegPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
169  if((*it2)->positionBounds().z() > 0)
170  thePosPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
171  }
172  }
173 
174  if( (*it)->type() == GeometricDet::PixelPhase2EndCap ){
175  vector<const GeometricDet*> thePxlFwdGeometricDetLayers = (*it)->components();
176  for(vector<const GeometricDet*>::const_iterator it2=thePxlFwdGeometricDetLayers.begin();
177  it2!=thePxlFwdGeometricDetLayers.end(); it2++){
178  if((*it2)->positionBounds().z() < 0)
179  theNegPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
180  if((*it2)->positionBounds().z() > 0)
181  thePosPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
182  }
183  }
184 
185  if( (*it)->type() == GeometricDet::TID){
186  vector<const GeometricDet*> theTIDGeometricDetLayers = (*it)->components();
187  for(vector<const GeometricDet*>::const_iterator it2=theTIDGeometricDetLayers.begin();
188  it2!=theTIDGeometricDetLayers.end(); it2++){
189  if((*it2)->positionBounds().z() < 0)
190  theNegTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
191  if((*it2)->positionBounds().z() > 0)
192  thePosTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
193  }
194  }
195 
196  if( (*it)->type() == GeometricDet::OTPhase2EndCap ){
197  vector<const GeometricDet*> theTIDGeometricDetLayers = (*it)->components();
198  for(vector<const GeometricDet*>::const_iterator it2=theTIDGeometricDetLayers.begin();
199  it2!=theTIDGeometricDetLayers.end(); it2++){
200  if((*it2)->positionBounds().z() < 0)
201  theNegTIDLayers.push_back( aPhase2OTEndcapLayerBuilder.build(*it2,theGeomDetGeometry) );
202  if((*it2)->positionBounds().z() > 0)
203  thePosTIDLayers.push_back( aPhase2OTEndcapLayerBuilder.build(*it2,theGeomDetGeometry) );
204  }
205  }
206 
207  if( (*it)->type() == GeometricDet::TEC) {
208  vector<const GeometricDet*> theTECGeometricDetLayers = (*it)->components();
209  for(vector<const GeometricDet*>::const_iterator it2=theTECGeometricDetLayers.begin();
210  it2!=theTECGeometricDetLayers.end(); it2++){
211  if((*it2)->positionBounds().z() < 0)
212  theNegTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
213  if((*it2)->positionBounds().z() > 0)
214  thePosTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
215  }
216  }
217 
218 
219  }
220 
221 
222  return new GeometricSearchTracker(thePxlBarLayers,theTIBLayers,theTOBLayers,
223  theNegPxlFwdLayers,theNegTIDLayers,theNegTECLayers,
224  thePosPxlFwdLayers,thePosTIDLayers,thePosTECLayers, tTopo);
225 }
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
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))
Phase2OTEndcapLayer * build(const GeometricDet *aPhase2OTEndcapLayer, 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))
Phase2OTBarrelLayer * build(const GeometricDet *aPhase2OTBarrelLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
std::string trackerHierarchy(unsigned int id)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:174
void insert(std::string const &str, const T &value)
Definition: Trie.h:619
double b
Definition: hdecay.h:120
tuple cout
Definition: gather_cfg.py:145
GeometricSearchTracker * build(const GeometricDet *theGeometricTracker, const TrackerGeometry *theGeomDetGeometry, const TrackerTopology *tTopo) __attribute__((cold))
std::vector< GeomDetUnit const * > DetUnitContainer
const TrieNode< T > * node(std::string const &str) const
get node matching a string
Definition: Trie.h:664
ForwardDetLayer * build(const GeometricDet *aPixelForwardLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.