#include <L1Trigger/DTTraco/interface/DTTracoCard.h>
Public Member Functions | |
void | clearCache () |
Clear all traco stuff (cache & map). | |
bool | debug () |
Return TU debug flag. | |
DTTracoCard (DTTrigGeom *, DTBtiCard *, DTTSTheta *) | |
Constructor. | |
DTTracoChip * | getTRACO (const DTTracoId &tracoid) const |
Returns the required DTTracoChip. Return 0 if it doesn't exist. | |
DTTracoChip * | getTRACO (int n) const |
Returns the required DTTracoChip. Return 0 if it doesn't exist. | |
LocalVector | localDirection (const DTTrigData *) const |
NEWGEO Local direction in chamber of a trigger-data object. | |
LocalPoint | localPosition (const DTTrigData *) const |
NEWGEO Local position in chamber of a trigger-data object. | |
virtual void | reconstruct () |
Load BTIs triggers and run TRACOs algorithm. | |
void | setConfig (const DTConfigManager *conf) |
Set configuration. | |
DTTracoTrig * | storeTrigger (DTTracoTrigData) |
Returns a DTTracoTrig corresponding to a DTTracoTrigData. | |
std::vector< DTTracoChip * > | tracoList () |
Returns the active TRACO list. | |
DTTSTheta * | TSTh () const |
Return TSTheta. | |
~DTTracoCard () | |
Destructor. | |
Private Member Functions | |
DTTracoChip * | activeGetTRACO (const DTTracoId &tracoid) |
Returns the required DTTracoChip. Create it if it doesn't exist. | |
DTTracoChip * | activeGetTRACO (int) |
Returns the required DTTracoChip. Create it if it doesn't exist. | |
DTConfigTraco * | config_traco (const DTTracoId &tracoid) const |
Return single TRACO config. | |
void | loadTRACO () |
store BTI triggers in TRACO's | |
void | localClear () |
clear the TRACO map | |
void | runTRACO () |
run TRACO algorithm | |
Private Attributes | |
DTBtiCard * | _bticard |
ConfTracoMap | _conf_traco_map |
bool | _debug |
TRACOContainer | _tracomap |
DTTSTheta * | _tstheta |
Modifications: III/07 : SV configuration with DTConfigManager
Definition at line 59 of file DTTracoCard.h.
DTTracoCard::DTTracoCard | ( | DTTrigGeom * | geo, | |
DTBtiCard * | bticard, | |||
DTTSTheta * | tstheta | |||
) |
Constructor.
Definition at line 48 of file DTTracoCard.cc.
00049 : DTGeomSupplier(geo) , 00050 _bticard(bticard), _tstheta(tstheta) { 00051 00052 // get traco configuration map 00053 // DTChamberId sid = geom()->statId(); 00054 // _debug = _conf_manager->getDTTPGDebug(); 00055 // _conf_traco_map = _conf_manager->getDTConfigTracoMap(sid); 00056 00057 }
DTTracoCard::~DTTracoCard | ( | ) |
Destructor.
Definition at line 63 of file DTTracoCard.cc.
References localClear().
00063 { 00064 00065 localClear(); 00066 00067 }
DTTracoChip* DTTracoCard::activeGetTRACO | ( | const DTTracoId & | tracoid | ) | [inline, private] |
Returns the required DTTracoChip. Create it if it doesn't exist.
Definition at line 120 of file DTTracoCard.h.
References activeGetTRACO(), and DTTracoId::traco().
00120 { 00121 return activeGetTRACO(tracoid.traco()); 00122 }
DTTracoChip * DTTracoCard::activeGetTRACO | ( | int | n | ) | [private] |
Returns the required DTTracoChip. Create it if it doesn't exist.
Definition at line 218 of file DTTracoCard.cc.
References _tracomap, config_traco(), DTGeomSupplier::geom(), and DTTrigGeom::statId().
Referenced by activeGetTRACO(), loadTRACO(), and storeTrigger().
00218 { 00219 00220 // the traco identifier 00221 DTChamberId sid = geom()->statId(); 00222 DTTracoId _id = DTTracoId(sid,n); 00223 00224 DTTracoChip* traco=0; 00225 TRACO_iter ptraco = _tracomap.find(n); 00226 if( ptraco!=_tracomap.end() ) { 00227 traco=(*ptraco).second; 00228 } else { 00229 traco = new DTTracoChip(this,n,config_traco(_id)); 00230 _tracomap[n]=traco; 00231 } 00232 return traco; 00233 }
Clear all traco stuff (cache & map).
Reimplemented from DTCache< DTTracoTrigData > >.
Definition at line 74 of file DTTracoCard.cc.
References DTCache< T, Coll >::clearCache(), and localClear().
Referenced by reconstruct(), and DTTrig::triggerReco().
00074 { 00075 00076 TRACOCache::clearCache(); 00077 localClear(); 00078 00079 }
DTConfigTraco * DTTracoCard::config_traco | ( | const DTTracoId & | tracoid | ) | const [private] |
Return single TRACO config.
Definition at line 393 of file DTTracoCard.cc.
References _conf_traco_map, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DTGeomSupplier::geom(), DTTracoId::sector(), DTTrigGeom::statId(), DTTracoId::station(), DTTracoId::traco(), and DTTracoId::wheel().
Referenced by activeGetTRACO(), localDirection(), and localPosition().
00394 { 00395 00396 // the traco identifier 00397 DTChamberId sid = geom()->statId(); 00398 00399 //loop on map to find traco 00400 ConfTracoMap::const_iterator titer = _conf_traco_map.find(tracoid); 00401 if (titer == _conf_traco_map.end()){ 00402 std::cout << "DTTracoCard::config_traco : TRACO (" << tracoid.wheel() 00403 << "," << tracoid.sector() 00404 << "," << tracoid.station() 00405 << "," << tracoid.traco() 00406 << ") not found, return 0" << std::endl; 00407 return 0; 00408 } 00409 00410 return const_cast<DTConfigTraco*>(&(*titer).second); 00411 }
bool DTTracoCard::debug | ( | ) | [inline] |
Return TU debug flag.
Definition at line 77 of file DTTracoCard.h.
References _debug.
Referenced by loadTRACO(), localDirection(), and runTRACO().
00077 {return _debug;}
DTTracoChip* DTTracoCard::getTRACO | ( | const DTTracoId & | tracoid | ) | const [inline] |
Returns the required DTTracoChip. Return 0 if it doesn't exist.
Definition at line 86 of file DTTracoCard.h.
References getTRACO(), and DTTracoId::traco().
DTTracoChip * DTTracoCard::getTRACO | ( | int | n | ) | const |
Returns the required DTTracoChip. Return 0 if it doesn't exist.
Definition at line 236 of file DTTracoCard.cc.
References _tracomap.
Referenced by getTRACO(), and DTTracoChip::setFlag().
00236 { 00237 TRACO_const_iter ptraco = _tracomap.find(n); 00238 if( ptraco==_tracomap.end() ) return 0; 00239 return (*ptraco).second; 00240 }
void DTTracoCard::loadTRACO | ( | ) | [private] |
store BTI triggers in TRACO's
Definition at line 100 of file DTTracoCard.cc.
References _bticard, activeGetTRACO(), DTTracoChip::add_btiT(), DTCache< T, Coll >::begin(), GenMuonPlsPt100GeV_cfg::cout, debug(), DTCache< T, Coll >::end(), lat::endl(), DTGeomSupplier::geom(), int, localClear(), DTConfig::NBTITC, p, DTGeomSupplier::sector(), DTGeomSupplier::station(), cmsRelvalreportInput::step, and DTGeomSupplier::wheel().
Referenced by reconstruct().
00100 { 00101 00102 localClear(); 00103 00104 if(debug()){ 00105 std::cout << "DTTracoCard::loadTRACO called for wheel=" << wheel() ; 00106 std::cout << ", station=" << station(); 00107 std::cout << ", sector=" << sector() << std::endl; 00108 } 00109 00110 int maxtc = int(ceil( float(geom()->nCell(1)) / float(DTConfig::NBTITC) )); 00111 00112 // loop on all BTI triggers 00113 std::vector<DTBtiTrigData>::const_iterator p; 00114 std::vector<DTBtiTrigData>::const_iterator pend=_bticard->end(); 00115 for(p=_bticard->begin();p!=pend;p++){ 00116 if(debug()){ 00117 std::cout << "Found bti trigger: "; 00118 (*p).print(); 00119 } 00120 // BTI number 00121 int nbti = (*p).btiNumber(); 00122 int nsl = (*p).btiSL(); 00123 int step = (*p).step(); 00124 00125 // assign BTI to TRACO 00126 int ntc = static_cast<int>((nbti-1)/DTConfig::NBTITC)+1; 00127 if( ntc<1 || ntc>maxtc ) 00128 continue; 00129 00130 // position inside cor.: 00131 int pos = nbti-(ntc-1)*DTConfig::NBTITC; 00132 00133 // store trigger in TRACO. Create TRACO if it doesn't exist 00134 // SV tb2003 : check if traco is connected! 00135 00136 // Load master TRACO plane 00137 if( nsl==1 ) { 00138 //FIX check traco maps !!! 00139 if( /*config()->usedTraco(ntc)==1 &&*/ ( ntc>0 && ntc<=maxtc ) ) 00140 activeGetTRACO(ntc)->add_btiT( step, pos, &(*p) ); 00141 else{ 00142 if(debug()) 00143 std::cout << "ATTENTION: traco " << ntc << " is disconnected!" << std::endl; 00144 } 00145 } 00146 00147 // Load slave TRACO plane 00148 if( nsl==3 ) { 00149 // 3 TRACO's 00150 for(int tci=-1;tci<=1;tci++) { 00151 if( /*config()->usedTraco(ntc+tci)==1 &&*/ ( (ntc+tci)>0 && (ntc+tci)<=maxtc ) ) 00152 activeGetTRACO(ntc+tci)->add_btiT( step, pos+8-4*tci, &(*p) ); 00153 else{ 00154 if(debug()) 00155 std::cout << "ATTENTION: traco " << ntc+tci << " is disconnected!" << std::endl; 00156 } 00157 } 00158 } 00159 00160 }//end loop on bti trigs 00161 }
void DTTracoCard::localClear | ( | ) | [private] |
clear the TRACO map
Definition at line 91 of file DTTracoCard.cc.
Referenced by clearCache(), loadTRACO(), and ~DTTracoCard().
00091 { 00092 // Clear the map 00093 for(TRACO_iter p=_tracomap.begin();p!=_tracomap.end();p++){ 00094 delete (*p).second; 00095 } 00096 _tracomap.clear(); 00097 }
LocalVector DTTracoCard::localDirection | ( | const DTTrigData * | tr | ) | const [virtual] |
NEWGEO Local direction in chamber of a trigger-data object.
Implements DTGeomSupplier.
Definition at line 358 of file DTTracoCard.cc.
References DTTrigGeom::cellPitch(), config_traco(), funct::cos(), GenMuonPlsPt100GeV_cfg::cout, debug(), DTTrigGeom::distSL(), lat::endl(), DTGeomSupplier::geom(), DTTracoTrigData::K(), DTTracoTrigData::parentId(), and funct::sin().
Referenced by DTTracoChip::calculateAngles(), and DTTSPhi::localDirection().
00358 { 00359 //NEWGEO 00360 DTTracoTrigData* trig = dynamic_cast<DTTracoTrigData*>(const_cast<DTTrigData*>(tr)); 00361 if(!trig) { 00362 std::cout << "DTtracoCard::localDirection called with wrong argument!" << std::endl; 00363 return LocalVector(0,0,0); 00364 } 00365 00366 //FE position 00367 //int FE = geom()->posFE(3); 00368 00369 float psi = atan((float)(trig->K())*geom()->cellPitch() 00370 /( geom()->distSL() * config_traco(trig->parentId())->BTIC()) ); 00371 00372 if(config_traco(trig->parentId())->debug()==4) 00373 std::cout << "K " << trig->K() << " == psi " << psi << " in FE frame " << std::endl; 00374 00375 // (xd,yd,zd) in chamber frame 00376 float xd=-sin(psi); 00377 float yd=0; 00378 float zd=-cos(psi); 00379 00380 // 10/07/06 Not needed anymore (chages in geometry) 00381 // if(FE==1){//FE in negative y 00382 // xd = - xd; 00383 //} 00384 00385 00386 if(config_traco(trig->parentId())->debug()==4) 00387 std::cout << "Direction in chamber frame is (" << xd << "," << yd << "," << zd << ")" << std::endl; 00388 00389 return LocalVector(xd,yd,zd); 00390 }
LocalPoint DTTracoCard::localPosition | ( | const DTTrigData * | tr | ) | const [virtual] |
NEWGEO Local position in chamber of a trigger-data object.
Implements DTGeomSupplier.
Definition at line 305 of file DTTracoCard.cc.
References DTTrigGeom::cellPitch(), config_traco(), GenMuonPlsPt100GeV_cfg::cout, DTTrigGeom::distSL(), lat::endl(), DTGeomSupplier::geom(), DTTrigGeom::localPosition(), DTTracoTrigData::parentId(), DTTracoTrigData::posIn(), DTTracoTrigData::posOut(), DTTracoTrigData::X(), x, y, and z.
Referenced by DTTSPhi::localPosition().
00305 { 00306 //NEWGEO 00307 DTTracoTrigData* trig = dynamic_cast<DTTracoTrigData*>(const_cast<DTTrigData*>(tr)); 00308 if(!trig) { 00309 std::cout << "DTTracoCard::localPosition called with wrong argument!" << std::endl; 00310 return LocalPoint(0,0,0); 00311 } 00312 float x = geom()->localPosition(trig->parentId()).x(); 00313 float y = geom()->localPosition(trig->parentId()).y(); 00314 float z = geom()->localPosition(trig->parentId()).z(); 00315 00316 float trig_pos = geom()->cellPitch() * ( (float)trig->X() / (float)(config_traco(trig->parentId())->BTIC())); 00317 00318 // 10/7/06 May be not needed anymore in new geometry 00319 // if(geom()->posFE(1)==1) 00320 // trig_pos = -trig_pos; 00321 00322 x += trig_pos; 00323 00324 // If not correlated get the position of the SL instead of the chamber center 00325 // z axis toward vertex 00326 if(trig->posIn()==0 ) { 00327 z -= 0.5 * geom()->distSL(); // no inner ==> only outer 00328 } 00329 else if(trig->posOut()==0) { 00330 z += 0.5 * geom()->distSL(); // no outer ==> only inner 00331 } 00332 return LocalPoint(x,y,z); 00333 }
Load BTIs triggers and run TRACOs algorithm.
Reimplemented from DTCache< DTTracoTrigData > >.
Definition at line 106 of file DTTracoCard.h.
References clearCache(), loadTRACO(), and runTRACO().
Referenced by DTTrig::triggerReco().
00106 { clearCache(); loadTRACO(); runTRACO(); }
void DTTracoCard::runTRACO | ( | ) | [private] |
run TRACO algorithm
Definition at line 164 of file DTTracoCard.cc.
References DTCache< DTTracoTrigData > >::_cache, _tracomap, GenMuonPlsPt100GeV_cfg::cout, debug(), lat::endl(), DTConfig::NSTEPF, DTConfig::NSTEPL, DTTracoChip::nTrig(), DTTracoChip::run(), DTGeomSupplier::sector(), DTGeomSupplier::station(), cmsRelvalreportInput::step, DTTracoChip::triggerData(), DTTracoChip::useSecondTrack(), and DTGeomSupplier::wheel().
Referenced by reconstruct().
00164 { 00165 00166 if(debug()){ 00167 std::cout << "DTTracoCard:runTRACO called for wheel=" << wheel() ; 00168 std::cout << ", station=" << station(); 00169 std::cout << ", sector=" << sector(); 00170 std::cout << ", " << _tracomap.size() << " TRACOs with signal" << std::endl; 00171 } 00172 00173 // run TRACO algorithm on all non-empty TRACO 00174 if(_tracomap.size()>0){ 00175 00176 if(debug()){ 00177 std::cout << "====================================================" << std::endl; 00178 std::cout << " TRACO triggers " << std::endl; 00179 } 00180 00181 00182 TRACO_iter ptraco; 00183 for(ptraco=_tracomap.begin(); ptraco!=_tracomap.end(); ptraco++) { 00184 DTTracoChip* traco = (*ptraco).second; 00185 traco->run(); 00186 for(int step=DTConfig::NSTEPF; step<=DTConfig::NSTEPL; step++){ 00187 if( traco->nTrig(step)>0 ){ 00188 _cache.push_back( traco->triggerData(step,1) ); 00189 /* 00190 std::cout<<"first bti sl3: "<<geom()->localPosition(DTBtiId(wheel(),station(),sector(),3,1))<<std::endl; 00191 std::cout<<"traco pos: " << geom()->localPosition((traco->triggerData(step,1).parentId()))<<std::endl; 00192 traco->triggerData(step,1).print(); 00193 std::cout<<"pos: " << localPosition(&(traco->triggerData(step,1))) << std::endl; 00194 std::cout<<"dir: " << localDirection(&(traco->triggerData(step,1))) << std::endl; 00195 std::cout << std::endl; 00196 */ 00197 } 00198 // Store second track only if no first track at previous BX 00199 if( traco->nTrig(step)>1 && traco->useSecondTrack(step) ){ 00200 _cache.push_back( traco->triggerData(step,2) ); 00201 /* 00202 std::cout<<"first bti sl3: "<<geom()->localPosition(DTBtiId(wheel(),station(),sector(),3,1))<<std::endl; 00203 std::cout<<"traco pos: " << geom()->localPosition((traco->triggerData(step,2).parentId()))<<std::endl; 00204 traco->triggerData(step,2).print(); 00205 std::cout<<"pos: " << localPosition(&(traco->triggerData(step,2))) << std::endl; 00206 std::cout<<"dir: " << localDirection(&(traco->triggerData(step,2))) << std::endl; 00207 std::cout << std::endl; 00208 */ 00209 } 00210 } 00211 } 00212 if(debug()) 00213 std::cout << "====================================================" << std::endl; 00214 } 00215 }
void DTTracoCard::setConfig | ( | const DTConfigManager * | conf | ) |
Set configuration.
Definition at line 82 of file DTTracoCard.cc.
References _conf_traco_map, _debug, DTGeomSupplier::ChamberId(), DTConfigManager::getDTConfigTracoMap(), and DTConfigManager::getDTTPGDebug().
Referenced by DTSCTrigUnit::setConfig().
00082 { 00083 00084 DTChamberId sid = ChamberId(); 00085 _conf_traco_map = conf->getDTConfigTracoMap(sid); 00086 _debug = conf->getDTTPGDebug(); 00087 00088 }
DTTracoTrig * DTTracoCard::storeTrigger | ( | DTTracoTrigData | td | ) |
Returns a DTTracoTrig corresponding to a DTTracoTrigData.
Creates the corresponding TRACO chip if needed and stores the trigger
Definition at line 257 of file DTTracoCard.cc.
References activeGetTRACO(), DTTracoChip::addTrig(), GenMuonPlsPt100GeV_cfg::cout, DTTracoTrigData::parentId(), DTTracoId::sector(), DTGeomSupplier::sector(), DTTracoId::station(), DTGeomSupplier::station(), DTTracoTrigData::step(), DTTracoId::traco(), DTGeomSupplier::wheel(), and DTTracoId::wheel().
00257 { 00258 DTTracoId tracoid = td.parentId(); 00259 if(!(tracoid.wheel()==wheel() && 00260 tracoid.sector()==sector() && 00261 tracoid.station()==station()) ) return 0; 00262 std::cout << "DTTracoChip::trigger: trigger not belonging to this card! "; 00263 std::cout << "card=(" << wheel() << "," << station() << "," << sector() << ") "; 00264 std::cout << "trig=(" << tracoid.wheel() << "," << tracoid.station() << "," 00265 << tracoid.sector() << ")"; 00266 // get the appropriate Traco 00267 DTTracoChip* traco = activeGetTRACO(tracoid.traco()); 00268 // create a new trigger in the Traco 00269 DTTracoTrig* trig = new DTTracoTrig(traco,td); 00270 // add the trigger to the Traco 00271 traco->addTrig(td.step(),trig); 00272 // return the trigger 00273 return trig; 00274 }
std::vector< DTTracoChip * > DTTracoCard::tracoList | ( | ) |
Returns the active TRACO list.
Definition at line 243 of file DTTracoCard.cc.
References _tracomap, p, and DTCache< DTTracoTrigData > >::size().
00243 { 00244 00245 std::vector<DTTracoChip*> blist; 00246 00247 if(size()<1)return blist; 00248 00249 for(TRACO_const_iter p=_tracomap.begin();p!=_tracomap.end();p++){ 00250 blist.push_back((*p).second); 00251 } 00252 return blist; 00253 00254 }
DTTSTheta* DTTracoCard::TSTh | ( | ) | const [inline] |
Return TSTheta.
Definition at line 80 of file DTTracoCard.h.
References _tstheta.
Referenced by DTTracoChip::storeUncorr().
00080 { return _tstheta; }
DTBtiCard* DTTracoCard::_bticard [private] |
ConfTracoMap DTTracoCard::_conf_traco_map [private] |
bool DTTracoCard::_debug [private] |
TRACOContainer DTTracoCard::_tracomap [private] |
Definition at line 135 of file DTTracoCard.h.
Referenced by activeGetTRACO(), getTRACO(), localClear(), runTRACO(), and tracoList().
DTTSTheta* DTTracoCard::_tstheta [private] |