CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
ViewTranslator Class Reference

#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)
 
uint32_t fedToFec (const uint32_t &fed_key_mask, const Mapping &input, Mapping &output)
 
void fedToFec (std::string root_filename, uint32_t &fed_key_mask, Mapping &fed_to_fec)
 
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
 

Detailed Description

Author
P.Kalavase, R.Bainbridge

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 18 of file ViewTranslator.h.

Member Typedef Documentation

typedef std::map<uint32_t,uint32_t> ViewTranslator::Mapping

Mapping type between different keys.

Definition at line 23 of file ViewTranslator.h.

Member Function Documentation

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 SiStripFedKey::feChan(), SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), SiStripFedKey::feUnit(), crabWrapper::key, SiStripKey::key(), LogTrace, and sistrip::mlCabling_.

18  {
19 
20 // if ( !cabling ) {
21 // edm::LogWarning(mlCabling_)
22 // << "[ViewTranslator::" << __func__ << "]"
23 // << " NULL pointer to FED cabling object!";
24 // return;
25 // }
26 
27  // Iterator through cabling, construct keys and push back into std::map
28  for ( auto ifed = cabling.fedIds().begin() ; ifed != cabling.fedIds().end(); ++ifed ) {
29 
30  auto conns = cabling.fedConnections( *ifed );
31  for( auto ichan = conns.begin(); ichan != conns.end(); ichan++ ) {
32  if( ichan->fedId() ) {
33 
34  uint32_t fed = SiStripFedKey( *ifed,
35  SiStripFedKey::feUnit(ichan->fedCh()),
36  SiStripFedKey::feChan(ichan->fedCh()) ).key();
37 
38  uint32_t fec = SiStripFecKey( ichan->fecCrate(),
39  ichan->fecSlot(),
40  ichan->fecRing(),
41  ichan->ccuAddr(),
42  ichan->ccuChan(),
43  ichan->lldChannel() ).key();
44 
45  SiStripDetId det_id( ichan->detId(),
46  ichan->apvPairNumber() );
47  uint32_t det = SiStripDetKey( det_id ).key();
48 
49  det_to_fec[det] = fec;
50  fed_to_fec[fed] = fec;
51 
52  }
53  }
54  }
55 
57  << "[ViewTranslator::" << __func__ << "]"
58  << " Size of FedToFec std::map: " << fed_to_fec.size()
59  << ", size of DetToFec std::map: " << det_to_fec.size();
60 
61 }
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
const uint32_t & key() const
Definition: SiStripKey.h:125
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static const char mlCabling_[]
FedsConstIterRange fedIds() const
#define LogTrace(id)
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const uint16_t & feUnit() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
const uint16_t & feChan() const
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 112 of file ViewTranslator.cc.

114  {
115 
116 // if( input.empty() ) {
117 // edm::LogWarning(mlCabling_)
118 // << "[ViewTranslator::" << __func__ << "]"
119 // << " Input std::map is empty!";
120 // return 0 ;
121 // }
122 
123 // Mapping::iterator iter;
124 // SiStripDetKey::Path det_key = SiStripDetKey::path( det_key_mask );
125 
126 // if( det_key.detId_ == sistrip::invalid_ ||
127 // det_key.apvPair_ == sistrip::invalid_ ) {
128 // edm::LogWarning(mlCabling_)
129 // << "[ViewTranslator::" << __func__ << "]"
130 // << " DetKey is not defined!";
131 // output = input;
132 // return output.size();
133 // }
134 
135 // if( det_key.detId_ != sistrip::invalid_ &&
136 // det_key.apvPair_ != sistrip::invalid_ ) {
137 // iter=input->find( det_key_mask );
138 // output[ (*iter).first ] = (*iter).second;
139 // LogTrace(mlSummaryPlots_) << "both are not masked";
140 // }
141 
142 // if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF ) {
143 // LogTrace(mlSummaryPlots_) << "apv is masked";
144 // for(iter=input->begin() ; iter!=input->end() ; iter++) {
145 // DetKey = SiStripDetKey::path( (*iter).first );
146 // if(det_key.detId_==DetKey.detId_)
147 // output[ (*iter).first ]=( (*iter).second );
148 // } //for(iter=input->begin() ; iter!=input->end() ; iter++)
149 // }//if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF )
150 // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. ";
151 
152  return 0; //@@ temp!
153 
154 }
void ViewTranslator::detToFec ( std::string  root_filename,
uint32_t &  det_key_mask,
Mapping det_to_fec 
)
inline

Definition at line 46 of file ViewTranslator.h.

48  {;}
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 66 of file ViewTranslator.cc.

References sistrip::mlCabling_.

68  {
69 
70  if( input.empty() ) {
72  << "[ViewTranslator::" << __func__ << "]"
73  << " Input std::map is empty!";
74  return 0;
75  }
76 
77 // Mapping::iterator iter;
78 // SiStripFedKey fed_key( fed_key_mask );
79 
80 // if( fed_key.detId() == sistrip::invalid_ ||
81 // fed_key.apvPair() == sistrip::invalid_ ) {
82 // edm::LogWarning(mlCabling_)
83 // << "[ViewTranslator::" << __func__ << "]"
84 // << " DetKey is not defined!";
85 // output = input;
86 // return output.size();
87 // }
88 
89 // if( fed_key.detId() != sistrip::invalid_ &&
90 // fed_key.apvPair() != sistrip::invalid_ ) {
91 // iter=input->find( fed_key_mask );
92 // output[ (*iter).first ] = (*iter).second;
93 // LogTrace(mlSummaryPlots_) << "both are not masked";
94 // }
95 
96 // if( fed_key.detId()!=0xFFFFFFFF && fed_key.apvPair()==0xFFFF ) {
97 // LogTrace(mlSummaryPlots_) << "apv is masked";
98 // for(iter=input->begin() ; iter!=input->end() ; iter++) {
99 // DetKey = SiStripFedKey( (*iter).first );
100 // if(fed_key.detId()==DetKey.detId())
101 // output[ (*iter).first ]=( (*iter).second );
102 // } //for(iter=input->begin() ; iter!=input->end() ; iter++)
103 // }//if( fed_key.detId_!=0xFFFFFFFF && fed_key.apvPair_==0xFFFF )
104 // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. ";
105 
106  return 0;
107 
108 }
static std::string const input
Definition: EdmProvDump.cc:45
static const char mlCabling_[]
void ViewTranslator::fedToFec ( std::string  root_filename,
uint32_t &  fed_key_mask,
Mapping fed_to_fec 
)
inline

Definition at line 52 of file ViewTranslator.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and writeMapsToFile().

54  {;}
void ViewTranslator::writeMapsToFile ( std::string  root_filename,
Mapping det_to_fec,
Mapping fed_to_fec 
)

Definition at line 219 of file ViewTranslator.cc.

Referenced by fedToFec().

221  {
222 
223 // Mapping *det_to_fec;
224 // Mapping *fed_to_fec;
225 
226 // det_to_fec = &det;
227 // fed_to_fec = &fed;
228 
229 // if(TFile::Open(fname.c_str())!=NULL) {
230 // TFile *f=TFile::Open(fname.c_str(), "UPDATE");
231 // gDirectory->cd();
232 // TDirectory *std::mapdir = gDirectory;
233 // gDirectory->cd("/DQMData/SiStrip");
234 // std::mapdir=gDirectory;
235 // std::mapdir->WriteObject(det_to_fec, "det_to_fec");
236 // std::mapdir->WriteObject(fed_to_fec, "fed_to_fec");
237 // LogTrace(mlSummaryPlots_) << "Wrote the std::maps";
238 // f->Close();
239 // } else LogTrace(mlSummaryPlots_) << "Cannot find root file. Maps not written.";
240 
241 }

Member Data Documentation

const uint16_t ViewTranslator::fedChMask_ = 0xFF
staticprivate

Definition at line 70 of file ViewTranslator.h.

const uint16_t ViewTranslator::fedFeMask_ = 0xF
staticprivate

Definition at line 69 of file ViewTranslator.h.

const uint16_t ViewTranslator::fedIdMask_ = 0xFFF
staticprivate

Definition at line 68 of file ViewTranslator.h.

std::string ViewTranslator::rootfile_
private

Root filename.

Definition at line 65 of file ViewTranslator.h.