00001 00002 // $Id: LatticeBuilder.cxx,v 1.2 2000/05/10 10:07:04 west Exp $ 00003 // 00004 // LatticeBuilder 00005 // 00006 // Begin_Html<img src="../../pedestrians.gif" align=center> 00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 00008 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 00009 // <a href="../index.html">The MINOS Class User Guide</a>End_Html 00010 // 00011 // N. West 03/2000 00012 // 00013 // Purpose: 00014 // 00016 00017 #include "Lattice/LatticeBuilder.h" 00018 #include "MessageService/MsgService.h" 00019 00020 // Definition of static data members 00021 // ********************************* 00022 00023 CVSID("$Id: LatticeBuilder.cxx,v 1.2 2000/05/10 10:07:04 west Exp $"); 00024 00025 // Definition of member functions (alphabetical order) 00026 // *************************************************** 00027 00028 00029 //..................................................................... 00030 00031 Bool_t LatticeBuilder::AddPrimary( Long_t key, ID primaryID) { 00032 00033 // Purpose: Add primary to lattice 00034 // Arguments: 00035 // Key in Key associated with primary 00036 // primaryID in ID of primary 00037 // 00038 // Return: kTRUE if request accepted. 00039 00040 // Contact: N. West 00041 00042 00043 // Specification:- 00044 // ============= 00045 00046 // o Record the keys and IDs of all primaries ready for pass over 00047 // secondaries. 00048 00049 00050 // Confirm that we can record a primary. 00051 00052 if ( fState != kHasLattice && fState != kHasPrimary ) { 00053 MSG("Lat",Msg::kWarning) << "Lattice not ready for primaries " 00054 <<endl; 00055 return kFALSE; 00056 } 00057 00058 00059 // Record key in look-up table. 00060 fKeyMap[key] = primaryID; 00061 fState = kHasPrimary; 00062 return kTRUE; 00063 00064 } 00065 00066 //..................................................................... 00067 00068 Bool_t LatticeBuilder::AddSecondary( Long_t key, ID secondaryID) { 00069 00070 // Purpose: 00071 // Key in Key associated with secondary 00072 // primaryID in ID of secondary 00073 // 00074 // Return: kTRUE if request accepted. 00075 // 00076 // Return: 00077 00078 // Contact: N. West 00079 00080 // Specification:- 00081 // ============= 00082 00083 // o Look up the key and record the (primary,secondary) pair in 00084 // the lattice. 00085 00086 // Confirm that we can build a primary secondary pair. 00087 00088 if ( fState != kHasSecondary && fState != kHasPrimary ) { 00089 MSG("Lat",Msg::kWarning) << "Lattice not ready for secondaries " 00090 <<endl; 00091 return kFALSE; 00092 } 00093 00094 00095 00096 // Retrieve primary using key and record pair in Lattice. 00097 00098 if ( fKeyMap.count(key) == 0 ) { 00099 MSG("Lat",Msg::kWarning) << "No primary for key " << key <<endl; 00100 return kFALSE; 00101 } 00102 00103 fLattice->Connect(fPrimarySide, fKeyMap[key], 0, secondaryID); 00104 fState = kHasSecondary; 00105 return kTRUE; 00106 00107 00108 } 00109 00110 //..................................................................... 00111 00112 void LatticeBuilder::DockLattice( Lattice* lattice, 00113 ESide primarySide) { 00114 00115 // Purpose: Dock new lattice to Builder ready for filling. 00116 // Arguments: 00117 // lattice in lattice to be filled (any existing lattice 00118 // will be disconected). 00119 // primarySide 00120 // in The side of the Lattice (either kLeft or 00121 // kRight) that holds the primaries. 00122 // Return: n/a 00123 00124 // Contact: N. West 00125 00126 // Specification:- 00127 // ============= 00128 00129 // o Dock new kattice ready for building. 00130 00131 00132 fLattice = lattice; 00133 fPrimarySide = primarySide; 00134 fState = fLattice ? kHasLattice : kFloating; 00135 fKeyMap.clear(); 00136 } 00137 00138 //..................................................................... 00139 00140 LatticeBuilder::LatticeBuilder() { 00141 00142 // Purpose: Default Constructor 00143 // Arguments: None 00144 // 00145 // Return: n/a 00146 00147 // Contact: N. West 00148 00149 00150 DockLattice( 0, Lattice::kLeft ); 00151 } 00152 00153 //..................................................................... 00154 00155 LatticeBuilder::LatticeBuilder(Lattice* lattice, 00156 ESide primarySide) { 00157 00158 // Purpose: Constructor 00159 // Arguments: 00160 // lattice in The lattice to be docked ready for filling 00161 // primarySide in The side of lattice holding primaries. 00162 // 00163 // 00164 // Return: n/a 00165 00166 // Contact: N. West 00167 00168 00169 DockLattice( lattice, primarySide ); 00170 } 00171 00172 //..................................................................... 00173 00174 LatticeBuilder::~LatticeBuilder() {} 00175 00176 // Purpose: Destructor 00177 // Arguments: n/a 00178 // 00179 // Return: n/a 00180 00181 // Contact: N. West 00182 00183 00184 00185 // ******************************************************************** 00186 00187 //..................................................................... 00188 00189 00190 // Purpose: 00191 // Arguments: 00192 // 00193 // Return: 00194 00195 // Contact: N. West 00196 00197 //..................................................................... 00198 00199
1.3.9.1