CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 $Date: 11/10/2006 $Revision: 1.0

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.

Member Typedef Documentation

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

Mapping type between different keys.

Definition at line 25 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 SiStripFedCabling::connections(), SiStripFedKey::feChan(), SiStripFedCabling::feds(), SiStripFedKey::feUnit(), combine::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  std::vector<uint16_t>::const_iterator ifed = cabling.feds().begin();
29  for ( ; ifed != cabling.feds().end(); ifed++ ) {
30 
31  const std::vector<FedChannelConnection>& conns = cabling.connections( *ifed );
32  std::vector<FedChannelConnection>::const_iterator ichan;
33  for( ichan = conns.begin(); ichan != conns.end(); ichan++ ) {
34  if( ichan->fedId() ) {
35 
36  uint32_t fed = SiStripFedKey( *ifed,
37  SiStripFedKey::feUnit(ichan->fedCh()),
38  SiStripFedKey::feChan(ichan->fedCh()) ).key();
39 
40  uint32_t fec = SiStripFecKey( ichan->fecCrate(),
41  ichan->fecSlot(),
42  ichan->fecRing(),
43  ichan->ccuAddr(),
44  ichan->ccuChan(),
45  ichan->lldChannel() ).key();
46 
47  SiStripDetId det_id( ichan->detId(),
48  ichan->apvPairNumber() );
49  uint32_t det = SiStripDetKey( det_id ).key();
50 
51  det_to_fec[det] = fec;
52  fed_to_fec[fed] = fec;
53 
54  }
55  }
56  }
57 
59  << "[ViewTranslator::" << __func__ << "]"
60  << " Size of FedToFec std::map: " << fed_to_fec.size()
61  << ", size of DetToFec std::map: " << det_to_fec.size();
62 
63 }
const std::vector< uint16_t > & feds() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:57
const uint32_t & key() const
Definition: SiStripKey.h:126
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
static const char mlCabling_[]
#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:29
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const uint16_t & feUnit() const
list key
Definition: combine.py:13
const uint16_t & feChan() const
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) 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 114 of file ViewTranslator.cc.

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

50  {;}
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_.

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

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

Definition at line 221 of file ViewTranslator.cc.

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

Member Data Documentation

const uint16_t ViewTranslator::fedChMask_ = 0xFF
staticprivate

Definition at line 72 of file ViewTranslator.h.

const uint16_t ViewTranslator::fedFeMask_ = 0xF
staticprivate

Definition at line 71 of file ViewTranslator.h.

const uint16_t ViewTranslator::fedIdMask_ = 0xFFF
staticprivate

Definition at line 70 of file ViewTranslator.h.

std::string ViewTranslator::rootfile_
private

Root filename.

Definition at line 67 of file ViewTranslator.h.