CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NavigationSetter.cc
Go to the documentation of this file.
6 
8  : theNav(school)
9 {
10  //save the current state from all layer in the system which is being set: allow to set it back
11  saveState();
12 
13  //remove any links from the detlayer in the system: allow partial navigation (BeamHalo)
14  cleanState();
15 
16  //set the current navigation
17  setState(school.navigableLayers());
18 }
19 
21 {
22  //remove any link from the detlyaer in the system which has been set
23  cleanState();
24  /*
25  LogDebug("NavigationSetter")<<"NavigationSchool settings are totally reset in the destructor of NavigationSetter.\n"
26  <<"this is the designed behavior. If you do not get track reconstruction, please refer to\n"
27  <<"https://twiki.cern.ch/twiki/bin/view/CMS/NavigationSchool \n"
28  <<"to properly use the NavigationSetter.";
29  */
30 
31  //restore the previous layer DetLayer settings within the system which has been set.
33 }
34 
35 
37  //remember all navigable layers from all layer in the system.
38  std::vector<DetLayer*>::const_iterator i = theNav.allLayersInSystem().begin();
39  std::vector<DetLayer*>::const_iterator end = theNav.allLayersInSystem().end();
40  for (; i != end; ++i){
41  if (*i !=0) theSavedState.push_back( (*i)->navigableLayer());
42  }
43 }
44 
46  //set no navigable layer to all detlayers in the system
47  std::vector<DetLayer*>::const_iterator i = theNav.allLayersInSystem().begin();
48  std::vector<DetLayer*>::const_iterator end = theNav.allLayersInSystem().end();
49  for (; i != end; ++i){
50  if (*i !=0) (*i)->setNavigableLayer(0);
51  }
52 }
53 
54 void NavigationSetter::setState( const StateType& newState) {
55  //set DetLayer->NavigableLayer link from navigable layer in given state
56  StateType::const_iterator i = newState.begin();
57  StateType::const_iterator end = newState.end();
58  for (; i != end; i++) {
59  if ( *i != 0) (**i).detLayer()->setNavigableLayer(*i);
60  }
61 }
62 
virtual StateType navigableLayers() const =0
StateType theSavedState
int i
Definition: DBlmapReader.cc:9
const NavigationSchool & theNav
const std::vector< DetLayer * > & allLayersInSystem() const
#define end
Definition: vmac.h:38
std::vector< NavigableLayer * > StateType
void setState(const StateType &)
NavigationSetter(const NavigationSchool &)