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.
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  Phase2EndcapLayerBuilder aPhase2EndcapLayerBuilder;
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 
179  //FIXME: this is just to keep the compatibility with the PixelPhase1 extension layout
180  //hopefully we can get rid of it soon
181  if((*it2)->positionBounds().z() < 0){
182  if( (*it2)->type() == GeometricDet::PixelPhase2FullDisk || (*it2)->type() == GeometricDet::PixelPhase2ReducedDisk )
183  theNegPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
184  else if( (*it2)->type() == GeometricDet::PixelPhase2TDRDisk )
185  theNegPxlFwdLayers.push_back( aPhase2EndcapLayerBuilder.build(*it2,theGeomDetGeometry,false) );
186  } else if((*it2)->positionBounds().z() > 0){
187  if( (*it2)->type() == GeometricDet::PixelPhase2FullDisk || (*it2)->type() == GeometricDet::PixelPhase2ReducedDisk )
188  thePosPxlFwdLayers.push_back( aPhase1PixelForwardLayerBuilder.build(*it2,theGeomDetGeometry) );
189  else if( (*it2)->type() == GeometricDet::PixelPhase2TDRDisk )
190  thePosPxlFwdLayers.push_back( aPhase2EndcapLayerBuilder.build(*it2,theGeomDetGeometry,false) );
191  } else {
192  edm::LogError("TkDetLayers") << "In PixelPhase2EndCap the disks are neither PixelPhase2FullDisk nor PixelPhase2ReducedDisk nor PixelPhase2TDRDisk...";
193  }
194 
195  }
196  }
197 
198  if( (*it)->type() == GeometricDet::TID){
199  vector<const GeometricDet*> theTIDGeometricDetLayers = (*it)->components();
200  for(vector<const GeometricDet*>::const_iterator it2=theTIDGeometricDetLayers.begin();
201  it2!=theTIDGeometricDetLayers.end(); it2++){
202  if((*it2)->positionBounds().z() < 0)
203  theNegTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
204  if((*it2)->positionBounds().z() > 0)
205  thePosTIDLayers.push_back( aTIDLayerBuilder.build(*it2,theGeomDetGeometry) );
206  }
207  }
208 
209  if( (*it)->type() == GeometricDet::OTPhase2EndCap ){
210  vector<const GeometricDet*> theTIDGeometricDetLayers = (*it)->components();
211  for(vector<const GeometricDet*>::const_iterator it2=theTIDGeometricDetLayers.begin();
212  it2!=theTIDGeometricDetLayers.end(); it2++){
213  if((*it2)->positionBounds().z() < 0)
214  theNegTIDLayers.push_back( aPhase2EndcapLayerBuilder.build(*it2,theGeomDetGeometry,true) );
215  if((*it2)->positionBounds().z() > 0)
216  thePosTIDLayers.push_back( aPhase2EndcapLayerBuilder.build(*it2,theGeomDetGeometry,true) );
217  }
218  }
219 
220  if( (*it)->type() == GeometricDet::TEC) {
221  vector<const GeometricDet*> theTECGeometricDetLayers = (*it)->components();
222  for(vector<const GeometricDet*>::const_iterator it2=theTECGeometricDetLayers.begin();
223  it2!=theTECGeometricDetLayers.end(); it2++){
224  if((*it2)->positionBounds().z() < 0)
225  theNegTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
226  if((*it2)->positionBounds().z() > 0)
227  thePosTECLayers.push_back( aTECLayerBuilder.build(*it2,theGeomDetGeometry) );
228  }
229  }
230 
231 
232  }
233 
234 
235  return new GeometricSearchTracker(thePxlBarLayers,theTIBLayers,theTOBLayers,
236  theNegPxlFwdLayers,theNegTIDLayers,theNegTECLayers,
237  thePosPxlFwdLayers,thePosTIDLayers,thePosTECLayers, tTopo);
238 }
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))
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:175
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))
Phase2EndcapLayer * build(const GeometricDet *aPhase2EndcapLayer, const TrackerGeometry *theGeomDetGeometry, const bool isOuterTracker) __attribute__((cold))
const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.