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

◆ Mapping

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

Mapping type between different keys.

Definition at line 21 of file ViewTranslator.h.

Member Function Documentation

◆ buildMaps()

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_.

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

◆ detToFec() [1/2]

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 97 of file ViewTranslator.cc.

97  {
98  // if( input.empty() ) {
99  // edm::LogWarning(mlCabling_)
100  // << "[ViewTranslator::" << __func__ << "]"
101  // << " Input std::map is empty!";
102  // return 0 ;
103  // }
104 
105  // Mapping::iterator iter;
106  // SiStripDetKey::Path det_key = SiStripDetKey::path( det_key_mask );
107 
108  // if( det_key.detId_ == sistrip::invalid_ ||
109  // det_key.apvPair_ == sistrip::invalid_ ) {
110  // edm::LogWarning(mlCabling_)
111  // << "[ViewTranslator::" << __func__ << "]"
112  // << " DetKey is not defined!";
113  // output = input;
114  // return output.size();
115  // }
116 
117  // if( det_key.detId_ != sistrip::invalid_ &&
118  // det_key.apvPair_ != sistrip::invalid_ ) {
119  // iter=input->find( det_key_mask );
120  // output[ (*iter).first ] = (*iter).second;
121  // LogTrace(mlSummaryPlots_) << "both are not masked";
122  // }
123 
124  // if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF ) {
125  // LogTrace(mlSummaryPlots_) << "apv is masked";
126  // for(iter=input->begin() ; iter!=input->end() ; iter++) {
127  // DetKey = SiStripDetKey::path( (*iter).first );
128  // if(det_key.detId_==DetKey.detId_)
129  // output[ (*iter).first ]=( (*iter).second );
130  // } //for(iter=input->begin() ; iter!=input->end() ; iter++)
131  // }//if( det_key.detId_!=0xFFFFFFFF && det_key.apvPair_==0xFFFF )
132  // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. ";
133 
134  return 0; //@@ temp!
135 }

◆ detToFec() [2/2]

void ViewTranslator::detToFec ( std::string  root_filename,
uint32_t &  det_key_mask,
Mapping det_to_fec 
)
inline

Definition at line 38 of file ViewTranslator.h.

38 { ; }

◆ fedToFec() [1/2]

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 56 of file ViewTranslator.cc.

References input, and sistrip::mlCabling_.

56  {
57  if (input.empty()) {
58  edm::LogWarning(mlCabling_) << "[ViewTranslator::" << __func__ << "]"
59  << " Input std::map is empty!";
60  return 0;
61  }
62 
63  // Mapping::iterator iter;
64  // SiStripFedKey fed_key( fed_key_mask );
65 
66  // if( fed_key.detId() == sistrip::invalid_ ||
67  // fed_key.apvPair() == sistrip::invalid_ ) {
68  // edm::LogWarning(mlCabling_)
69  // << "[ViewTranslator::" << __func__ << "]"
70  // << " DetKey is not defined!";
71  // output = input;
72  // return output.size();
73  // }
74 
75  // if( fed_key.detId() != sistrip::invalid_ &&
76  // fed_key.apvPair() != sistrip::invalid_ ) {
77  // iter=input->find( fed_key_mask );
78  // output[ (*iter).first ] = (*iter).second;
79  // LogTrace(mlSummaryPlots_) << "both are not masked";
80  // }
81 
82  // if( fed_key.detId()!=0xFFFFFFFF && fed_key.apvPair()==0xFFFF ) {
83  // LogTrace(mlSummaryPlots_) << "apv is masked";
84  // for(iter=input->begin() ; iter!=input->end() ; iter++) {
85  // DetKey = SiStripFedKey( (*iter).first );
86  // if(fed_key.detId()==DetKey.detId())
87  // output[ (*iter).first ]=( (*iter).second );
88  // } //for(iter=input->begin() ; iter!=input->end() ; iter++)
89  // }//if( fed_key.detId_!=0xFFFFFFFF && fed_key.apvPair_==0xFFFF )
90  // else LogTrace(mlSummaryPlots_) << "Cannot find the det to fec std::map in the root file. ";
91 
92  return 0;
93 }
static std::string const input
Definition: EdmProvDump.cc:50
static const char mlCabling_[]
Log< level::Warning, false > LogWarning

◆ fedToFec() [2/2]

void ViewTranslator::fedToFec ( std::string  root_filename,
uint32_t &  fed_key_mask,
Mapping fed_to_fec 
)
inline

Definition at line 42 of file ViewTranslator.h.

42 { ; }

◆ writeMapsToFile()

void ViewTranslator::writeMapsToFile ( std::string  root_filename,
Mapping det_to_fec,
Mapping fed_to_fec 
)

Definition at line 194 of file ViewTranslator.cc.

194  {
195  // Mapping *det_to_fec;
196  // Mapping *fed_to_fec;
197 
198  // det_to_fec = &det;
199  // fed_to_fec = &fed;
200 
201  // if(TFile::Open(fname.c_str())!=NULL) {
202  // TFile *f=TFile::Open(fname.c_str(), "UPDATE");
203  // gDirectory->cd();
204  // TDirectory *std::mapdir = gDirectory;
205  // gDirectory->cd("/DQMData/SiStrip");
206  // std::mapdir=gDirectory;
207  // std::mapdir->WriteObject(det_to_fec, "det_to_fec");
208  // std::mapdir->WriteObject(fed_to_fec, "fed_to_fec");
209  // LogTrace(mlSummaryPlots_) << "Wrote the std::maps";
210  // f->Close();
211  // } else LogTrace(mlSummaryPlots_) << "Cannot find root file. Maps not written.";
212 }

Member Data Documentation

◆ fedChMask_

const uint16_t ViewTranslator::fedChMask_ = 0xFF
staticprivate

Definition at line 55 of file ViewTranslator.h.

◆ fedFeMask_

const uint16_t ViewTranslator::fedFeMask_ = 0xF
staticprivate

Definition at line 54 of file ViewTranslator.h.

◆ fedIdMask_

const uint16_t ViewTranslator::fedIdMask_ = 0xFFF
staticprivate

Definition at line 53 of file ViewTranslator.h.

◆ rootfile_

std::string ViewTranslator::rootfile_
private

Root filename.

Definition at line 50 of file ViewTranslator.h.