#include <ViewTranslator.h>
Public Types | |
typedef std::map< uint32_t, uint32_t > | Mapping |
Public Member Functions | |
uint32_t | detToFec (const uint32_t &det_key_mask, const Mapping &input, Mapping &output) |
void | detToFec (std::string root_filename, uint32_t &det_key_mask, Mapping &det_to_fec) |
void | fedToFec (std::string root_filename, uint32_t &fed_key_mask, Mapping &fed_to_fec) |
uint32_t | fedToFec (const uint32_t &fed_key_mask, const Mapping &input, Mapping &output) |
void | writeMapsToFile (std::string root_filename, Mapping &det_to_fec, Mapping &fed_to_fec) |
Static Public Member Functions | |
static void | buildMaps (const SiStripFedCabling &, Mapping &det_to_fec, Mapping &fed_to_fec) |
Private Attributes | |
std::string | rootfile_ |
Static Private Attributes | |
static const uint16_t | fedChMask_ = 0xFF |
static const uint16_t | fedFeMask_ = 0xF |
static const uint16_t | fedIdMask_ = 0xFFF |
Utility class that maps Fed and Det keys with the Fec Keys, saves them in a root file and also extracts fec keys if given a fed/det key
Definition at line 20 of file ViewTranslator.h.
typedef std::map<uint32_t,uint32_t> ViewTranslator::Mapping |
Mapping type between different keys.
Definition at line 25 of file ViewTranslator.h.
void ViewTranslator::buildMaps | ( | const SiStripFedCabling & | cabling, |
Mapping & | det_to_fec, | ||
Mapping & | fed_to_fec | ||
) | [static] |
Build maps from FED cabling object
Definition at line 16 of file ViewTranslator.cc.
References SiStripFedCabling::connections(), SiStripFedKey::feChan(), SiStripFedCabling::feds(), SiStripFedKey::feUnit(), combine::key, SiStripKey::key(), LogTrace, and sistrip::mlCabling_.
{ // if ( !cabling ) { // edm::LogWarning(mlCabling_) // << "[ViewTranslator::" << __func__ << "]" // << " NULL pointer to FED cabling object!"; // return; // } // Iterator through cabling, construct keys and push back into std::map std::vector<uint16_t>::const_iterator ifed = cabling.feds().begin(); for ( ; ifed != cabling.feds().end(); ifed++ ) { const std::vector<FedChannelConnection>& conns = cabling.connections( *ifed ); std::vector<FedChannelConnection>::const_iterator ichan; for( ichan = conns.begin(); ichan != conns.end(); ichan++ ) { if( ichan->fedId() ) { uint32_t fed = SiStripFedKey( *ifed, SiStripFedKey::feUnit(ichan->fedCh()), SiStripFedKey::feChan(ichan->fedCh()) ).key(); uint32_t fec = SiStripFecKey( ichan->fecCrate(), ichan->fecSlot(), ichan->fecRing(), ichan->ccuAddr(), ichan->ccuChan(), ichan->lldChannel() ).key(); SiStripDetId det_id( ichan->detId(), ichan->apvPairNumber() ); uint32_t det = SiStripDetKey( det_id ).key(); det_to_fec[det] = fec; fed_to_fec[fed] = fec; } } } LogTrace(mlCabling_) << "[ViewTranslator::" << __func__ << "]" << " Size of FedToFec std::map: " << fed_to_fec.size() << ", size of DetToFec std::map: " << det_to_fec.size(); }
void ViewTranslator::detToFec | ( | std::string | root_filename, |
uint32_t & | det_key_mask, | ||
Mapping & | det_to_fec | ||
) | [inline] |
Definition at line 48 of file ViewTranslator.h.
{;}
uint32_t ViewTranslator::detToFec | ( | const uint32_t & | det_key_mask, |
const Mapping & | input, | ||
Mapping & | output | ||
) |
Build "reduced" map based on "masked" DET key
Definition at line 114 of file ViewTranslator.cc.
{ // if( input.empty() ) { // edm::LogWarning(mlCabling_) // << "[ViewTranslator::" << __func__ << "]" // << " Input std::map is empty!"; // return 0 ; // } // Mapping::iterator iter; // SiStripDetKey::Path det_key = SiStripDetKey::path( det_key_mask ); // if( det_key.detId_ == sistrip::invalid_ || // det_key.apvPair_ == sistrip::invalid_ ) { // edm::LogWarning(mlCabling_) // << "[ViewTranslator::" << __func__ << "]" // << " DetKey is not defined!"; // output = input; // return output.size(); // } // if( det_key.detId_ != sistrip::invalid_ && // det_key.apvPair_ != sistrip::invalid_ ) { // iter=input->find( det_key_mask ); // output[ (*iter).first ] = (*iter).second; // LogTrace(mlSummaryPlots_) << "both are not masked"; // } // if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF ) { // LogTrace(mlSummaryPlots_) << "apv is masked"; // for(iter=input->begin() ; iter!=input->end() ; iter++) { // DetKey = SiStripDetKey::path( (*iter).first ); // if(det_key.detId_==DetKey.detId_) // output[ (*iter).first ]=( (*iter).second ); // } //for(iter=input->begin() ; iter!=input->end() ; iter++) // }//if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF ) // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. "; return 0; //@@ temp! }
uint32_t ViewTranslator::fedToFec | ( | const uint32_t & | fed_key_mask, |
const Mapping & | input, | ||
Mapping & | output | ||
) |
Build "reduced" map based on "masked" FED key
Definition at line 68 of file ViewTranslator.cc.
References sistrip::mlCabling_.
{ if( input.empty() ) { edm::LogWarning(mlCabling_) << "[ViewTranslator::" << __func__ << "]" << " Input std::map is empty!"; return 0; } // Mapping::iterator iter; // SiStripFedKey fed_key( fed_key_mask ); // if( fed_key.detId() == sistrip::invalid_ || // fed_key.apvPair() == sistrip::invalid_ ) { // edm::LogWarning(mlCabling_) // << "[ViewTranslator::" << __func__ << "]" // << " DetKey is not defined!"; // output = input; // return output.size(); // } // if( fed_key.detId() != sistrip::invalid_ && // fed_key.apvPair() != sistrip::invalid_ ) { // iter=input->find( fed_key_mask ); // output[ (*iter).first ] = (*iter).second; // LogTrace(mlSummaryPlots_) << "both are not masked"; // } // if( fed_key.detId()!=0xFFFFFFFF && fed_key.apvPair()==0xFFFF ) { // LogTrace(mlSummaryPlots_) << "apv is masked"; // for(iter=input->begin() ; iter!=input->end() ; iter++) { // DetKey = SiStripFedKey( (*iter).first ); // if(fed_key.detId()==DetKey.detId()) // output[ (*iter).first ]=( (*iter).second ); // } //for(iter=input->begin() ; iter!=input->end() ; iter++) // }//if( fed_key.detId_!=0xFFFFFFFF && fed_key.apvPair_==0xFFFF ) // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. "; return 0; }
void ViewTranslator::fedToFec | ( | std::string | root_filename, |
uint32_t & | fed_key_mask, | ||
Mapping & | fed_to_fec | ||
) | [inline] |
Definition at line 54 of file ViewTranslator.h.
{;}
void ViewTranslator::writeMapsToFile | ( | std::string | root_filename, |
Mapping & | det_to_fec, | ||
Mapping & | fed_to_fec | ||
) |
Definition at line 221 of file ViewTranslator.cc.
{ // Mapping *det_to_fec; // Mapping *fed_to_fec; // det_to_fec = &det; // fed_to_fec = &fed; // if(TFile::Open(fname.c_str())!=NULL) { // TFile *f=TFile::Open(fname.c_str(), "UPDATE"); // gDirectory->cd(); // TDirectory *std::mapdir = gDirectory; // gDirectory->cd("/DQMData/SiStrip"); // std::mapdir=gDirectory; // std::mapdir->WriteObject(det_to_fec, "det_to_fec"); // std::mapdir->WriteObject(fed_to_fec, "fed_to_fec"); // LogTrace(mlSummaryPlots_) << "Wrote the std::maps"; // f->Close(); // } else LogTrace(mlSummaryPlots_) << "Cannot find root file. Maps not written."; }
const uint16_t ViewTranslator::fedChMask_ = 0xFF [static, private] |
Definition at line 72 of file ViewTranslator.h.
const uint16_t ViewTranslator::fedFeMask_ = 0xF [static, private] |
Definition at line 71 of file ViewTranslator.h.
const uint16_t ViewTranslator::fedIdMask_ = 0xFFF [static, private] |
Definition at line 70 of file ViewTranslator.h.
std::string ViewTranslator::rootfile_ [private] |
Root filename.
Definition at line 67 of file ViewTranslator.h.