CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripDetCabling Class Reference

#include <CalibFormats/SiStripObjects/interface/SiStripDetCabling.h>

Public Member Functions

void addActiveDetectorsRawIds (std::vector< uint32_t > &) const
 
void addAllDetectorsRawIds (std::vector< uint32_t > &vector_to_fill_with_detids) const
 
void addConnected (std::map< uint32_t, std::vector< int > > &) const
 
void addDetected (std::map< uint32_t, std::vector< int > > &) const
 
void addDevices (const FedChannelConnection &, std::map< uint32_t, std::vector< const FedChannelConnection * > > &)
 
void addDevices (const FedChannelConnection &)
 
void addNotConnectedAPVs (std::map< uint32_t, std::vector< int > > &) const
 
void addUnDetected (std::map< uint32_t, std::vector< int > > &) const
 
uint32_t connectedNumber (const std::string &subDet, const uint16_t layer) const
 
uint32_t detectedNumber (const std::string &subDet, const uint16_t layer) const
 
const SiStripFedCablingfedCabling () const
 
void getActiveDetectorsContiguousIds (std::map< uint32_t, unsigned int > &) const
 
void getAllDetectorsContiguousIds (std::map< uint32_t, unsigned int > &) const
 
const FedChannelConnectiongetConnection (uint32_t det_id, unsigned short apv_pair) const
 
const std::vector< const
FedChannelConnection * > & 
getConnections (uint32_t det_id) const
 
const unsigned int getDcuId (uint32_t det_id) const
 
const std::map< uint32_t,
std::vector< const
FedChannelConnection * > > & 
getDetCabling () const
 
bool IsConnected (const uint32_t &det_id) const
 
bool IsDetected (const uint32_t &det_id) const
 
bool IsUndetected (const uint32_t &det_id) const
 
const uint16_t nApvPairs (uint32_t det_id) const
 
void print (std::stringstream &) const
 
void printDebug (std::stringstream &ss) const
 
void printSummary (std::stringstream &ss) const
 
 SiStripDetCabling ()
 
 SiStripDetCabling (const SiStripFedCabling &)
 
uint32_t undetectedNumber (const std::string &subDet, const uint16_t layer) const
 
virtual ~SiStripDetCabling ()
 

Private Member Functions

void addFromSpecificConnection (std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
 
uint32_t detNumber (const std::string &subDet, const uint16_t layer, const int connectionType) const
 Return the number of modules for the specified subDet, layer and connectionType. More...
 
bool IsInMap (const uint32_t &det_id, const std::map< uint32_t, std::vector< int > > &) const
 
int16_t layerSearch (const uint32_t detId) const
 
const SiStripDetCablingoperator= (const SiStripDetCabling &)
 
 SiStripDetCabling (const SiStripDetCabling &)
 

Private Attributes

std::map< uint32_t,
std::vector< int > > 
connected_
 
std::map< int16_t, uint32_t > connectionCount [3]
 
std::map< uint32_t,
std::vector< int > > 
detected_
 
const SiStripFedCablingfedCabling_
 
std::map< uint32_t,
std::vector< const
FedChannelConnection * > > 
fullcabling_
 
std::map< uint32_t,
std::vector< int > > 
undetected_
 

Detailed Description

Description: give detector view of the cabling of the silicon strip tracker

Definition at line 20 of file SiStripDetCabling.h.

Constructor & Destructor Documentation

SiStripDetCabling::SiStripDetCabling ( )

Definition at line 19 of file SiStripDetCabling.cc.

19 : fedCabling_(0) {}
const SiStripFedCabling * fedCabling_
SiStripDetCabling::~SiStripDetCabling ( )
virtual

Definition at line 20 of file SiStripDetCabling.cc.

20 {}
SiStripDetCabling::SiStripDetCabling ( const SiStripFedCabling fedcabling)

Definition at line 23 of file SiStripDetCabling.cc.

References addDevices(), addFromSpecificConnection(), connected_, detected_, SiStripFedCabling::detectedDevices(), SiStripFedCabling::fedConnections(), SiStripFedCabling::feds(), fullcabling_, sistrip::invalid32_, sistrip::invalid_, undetected_, and SiStripFedCabling::undetectedDevices().

23  : fullcabling_(), connected_(), detected_(), undetected_(), fedCabling_(&fedcabling)
24 {
25  // --- CONNECTED = have fedid and i2cAddr
26  // create fullcabling_, loop over vector of FedChannelConnection, either make new element of map, or add to appropriate vector of existing map element
27  // get feds list (vector) from fedcabling object - these are the active FEDs
28  const std::vector<uint16_t>& feds = fedcabling.feds();
29  std::vector<uint16_t>::const_iterator ifed;
30  for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // iterate over active feds, get all their FedChannelConnection-s
31  SiStripFedCabling::ConnsConstIterRange conns = fedcabling.fedConnections( *ifed );
32  std::vector<FedChannelConnection>::const_iterator iconn;
33  for ( iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // loop over FedChannelConnection objects
34  addDevices(*iconn, fullcabling_); // leave separate method, in case you will need to add devices also after constructing
35  bool have_fed_id = iconn->fedId();
36  std::vector<int> vector_of_connected_apvs;
37  if(have_fed_id){ // these apvpairs are seen from the readout
38  // there can be at most 6 APVs on one DetId: 0,1,2,3,4,5
39  int which_apv_pair = iconn->apvPairNumber(); // APVPair (0,1) for 512 strips and (0,1,2) for 768 strips
40 
41  // patch needed to take into account invalid detids or apvPairs
42  if( iconn->detId()==0 ||
43  iconn->detId() == sistrip::invalid32_ ||
44  iconn->apvPairNumber() == sistrip::invalid_ ||
45  iconn->nApvPairs() == sistrip::invalid_ ) {
46  continue;
47  }
48 
49  if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
50  if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
51  }
52  if(vector_of_connected_apvs.size() != 0){ // add only is smth. there, obviously
53  std::map<uint32_t, std::vector<int> > map_of_connected_apvs;
54  map_of_connected_apvs.insert(std::make_pair(iconn->detId(),vector_of_connected_apvs));
55  addFromSpecificConnection(connected_, map_of_connected_apvs, 0);
56  }
57  }
58  }
59  // --- DETECTED = do not have fedid but have i2cAddr
60  SiStripFedCabling::ConnsConstIterRange detected_fed_connections = fedcabling.detectedDevices();
61  for(std::vector<FedChannelConnection>::const_iterator idtct = detected_fed_connections.begin(); idtct != detected_fed_connections.end(); idtct++){
62  addDevices(*idtct, fullcabling_);
63  bool have_fed_id = idtct->fedId();
64  std::vector<int> vector_of_detected_apvs;
65  if(! have_fed_id){
66  int which_apv_pair = idtct->apvPairNumber(); // APVPair (0,1) for 512 strips and (0,1,2) for 768 strips
67  if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
68  if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
69  }
70  if(vector_of_detected_apvs.size() != 0){ // add only is smth. there, obviously
71  std::map<uint32_t,std::vector<int> > map_of_detected_apvs;
72  map_of_detected_apvs.insert(std::make_pair(idtct->detId(),vector_of_detected_apvs));
73  addFromSpecificConnection(detected_, map_of_detected_apvs, 1);
74  }
75  }
76  // --- UNDETECTED = have neither fedid nor i2caddr
77  SiStripFedCabling::ConnsConstIterRange undetected_fed_connections = fedcabling.undetectedDevices();
78  for(std::vector<FedChannelConnection>::const_iterator iudtct = undetected_fed_connections.begin(); iudtct != undetected_fed_connections.end(); iudtct++){
79  addDevices(*iudtct, fullcabling_);
80  bool have_fed_id = iudtct->fedId();
81  std::vector<int> vector_of_undetected_apvs;
82  if(! have_fed_id){
83  int which_apv_pair = iudtct->apvPairNumber(); // APVPair (0,1) for 512 strips and (0,1,2) for 768 strips
84  if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
85  if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
86  }
87  if(vector_of_undetected_apvs.size() != 0){ // add only is smth. there, obviously
88  std::map<uint32_t, std::vector<int> > map_of_undetected_apvs;
89  map_of_undetected_apvs.insert(std::make_pair(iudtct->detId(),vector_of_undetected_apvs));
90  addFromSpecificConnection(undetected_, map_of_undetected_apvs, 2);
91  }
92  }
93 }
ConnsConstIterRange detectedDevices() const
const std::vector< uint16_t > & feds() const
std::map< uint32_t, std::vector< int > > connected_
static const uint32_t invalid32_
Definition: Constants.h:16
ConnsConstIterRange undetectedDevices() const
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
const SiStripFedCabling * fedCabling_
boost::iterator_range< ConnsConstIter > ConnsConstIterRange
std::map< uint32_t, std::vector< int > > detected_
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
static const uint16_t invalid_
Definition: Constants.h:17
ConnsConstIterRange fedConnections(uint16_t fed_id) const
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector< const FedChannelConnection * > > &)
std::map< uint32_t, std::vector< int > > undetected_
SiStripDetCabling::SiStripDetCabling ( const SiStripDetCabling )
private

Member Function Documentation

void SiStripDetCabling::addActiveDetectorsRawIds ( std::vector< uint32_t > &  vector_to_fill_with_detids) const

Definition at line 120 of file SiStripDetCabling.cc.

References connected_, and python.multivaluedict::map().

Referenced by SiStripQuality::addInvalidConnectionFromCabling(), SiStripCondObjBuilderFromDb::buildStripRelatedObjects(), and SiStripCondObjBuilderFromDb::retrieveActiveDetIds().

120  {
121  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = connected_.begin(); conn_it!=connected_.end(); conn_it++){
122  vector_to_fill_with_detids.push_back(conn_it->first);
123  }
124  // no elements added to vector_to_fill_with_detids is empty connected_
125 }
std::map< uint32_t, std::vector< int > > connected_
void SiStripDetCabling::addAllDetectorsRawIds ( std::vector< uint32_t > &  vector_to_fill_with_detids) const

Definition at line 128 of file SiStripDetCabling.cc.

References connected_, detected_, python.multivaluedict::map(), and undetected_.

Referenced by getActiveDetectorsContiguousIds(), and getAllDetectorsContiguousIds().

128  {
129  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = connected_.begin(); conn_it!=connected_.end(); conn_it++){
130  vector_to_fill_with_detids.push_back(conn_it->first);
131  }
132  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = detected_.begin(); conn_it!=detected_.end(); conn_it++){
133  vector_to_fill_with_detids.push_back(conn_it->first);
134  }
135  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = undetected_.begin(); conn_it!=undetected_.end(); conn_it++){
136  vector_to_fill_with_detids.push_back(conn_it->first);
137  }
138  // no elements added to vector_to_fill_with_detids is empty connected_, detected_.begin and undetected_.begin
139 }
std::map< uint32_t, std::vector< int > > connected_
std::map< uint32_t, std::vector< int > > detected_
std::map< uint32_t, std::vector< int > > undetected_
void SiStripDetCabling::addConnected ( std::map< uint32_t, std::vector< int > > &  map_to_add_to) const

Definition at line 197 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and connected_.

197  {
198  addFromSpecificConnection(map_to_add_to, connected_);
199 }
std::map< uint32_t, std::vector< int > > connected_
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
void SiStripDetCabling::addDetected ( std::map< uint32_t, std::vector< int > > &  map_to_add_to) const

Definition at line 202 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and detected_.

202  {
203  addFromSpecificConnection(map_to_add_to, detected_);
204 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
std::map< uint32_t, std::vector< int > > detected_
void SiStripDetCabling::addDevices ( const FedChannelConnection conn,
std::map< uint32_t, std::vector< const FedChannelConnection * > > &  conns 
)

Definition at line 96 of file SiStripDetCabling.cc.

References FedChannelConnection::apvPairNumber(), results_mgr::conn, FedChannelConnection::detId(), FedChannelConnection::fedId(), sistrip::invalid32_, and sistrip::invalid_.

Referenced by addDevices(), and SiStripDetCabling().

97  {
98  if( conn.detId() && conn.detId() != sistrip::invalid32_ && // check for valid detid
99  conn.apvPairNumber() != sistrip::invalid_ ) { // check for valid apv pair number
100  if( conn.fedId()==0 || conn.fedId()==sistrip::invalid_ ){
101  edm::LogInfo("") << " SiStripDetCabling::addDevices for connection associated to detid " << conn.detId() << " apvPairNumber " << conn.apvPairNumber() << "the fedId is " << conn.fedId();
102  return;
103  }
104  // check cached vector size is sufficient
105  // if not, resize
106  if( conn.apvPairNumber() >= conns[conn.detId()].size() ) {
107  conns[conn.detId()].resize( conn.apvPairNumber()+1 );
108  }
109  // add latest connection object
110  conns[conn.detId()][conn.apvPairNumber()] = &conn;
111  }
112 }
static const uint32_t invalid32_
Definition: Constants.h:16
uint16_t apvPairNumber() const
const uint16_t & fedId() const
const uint32_t & detId() const
static const uint16_t invalid_
Definition: Constants.h:17
tuple conn
Definition: results_mgr.py:53
void SiStripDetCabling::addDevices ( const FedChannelConnection conn)

Definition at line 115 of file SiStripDetCabling.cc.

References addDevices(), and fullcabling_.

115  { // by default add to fullcabling_ connections - special case of above class
116  addDevices(conn, fullcabling_ ); // add to fullcabling_
117 }
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector< const FedChannelConnection * > > &)
void SiStripDetCabling::addFromSpecificConnection ( std::map< uint32_t, std::vector< int > > &  map_to_add_to,
const std::map< uint32_t, std::vector< int > > &  specific_connection,
const int  connectionType = -1 
) const
private

Definition at line 218 of file SiStripDetCabling.cc.

References connectionCount, layerSearch(), python.multivaluedict::map(), and python.multivaluedict::sort().

Referenced by addConnected(), addDetected(), addNotConnectedAPVs(), addUnDetected(), and SiStripDetCabling().

220  {
221  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = specific_connection.begin(); conn_it!=specific_connection.end(); ++conn_it){
222  uint32_t new_detid = conn_it->first;
223  std::vector<int> new_apv_vector = conn_it->second;
224  std::map<uint32_t, std::vector<int> >::iterator it = map_to_add_to.find(new_detid);
225  if( it == map_to_add_to.end() ){ // detid does not exist in map, add new entry
226  std::sort(new_apv_vector.begin(),new_apv_vector.end()); // not very efficient sort, time consuming?
227  map_to_add_to.insert(std::make_pair(new_detid,new_apv_vector));
228 
229  // Count the number of detIds per layer. Doing it in this "if" we count each detId only once
230  // (otherwise it would be counted once per APV pair)
231  // ATTENTION: consider changing the loop content to avoid this
232  // This is the expected full number of modules (double sided are counted twice because the two
233  // sides have different detId).
234  // TIB1 : 336, TIB2 : 432, TIB3 : 540, TIB4 : 648
235  // TID : each disk has 48+48+40 (ring1+ring2+ring3)
236  // TOB1 : 504, TOB2 : 576, TOB3 : 648, TOB4 : 720, TOB5 : 792, TOB6 : 888
237  // TEC1 : Total number of modules = 6400.
238  if( connectionType != -1 ) {
239  connectionCount[connectionType][layerSearch(new_detid)]++;
240  }
241  }else{ // detid exists already, add to its vector - if its not there already . . .
242  std::vector<int> existing_apv_vector = it->second;
243  for(std::vector<int>::iterator inew = new_apv_vector.begin(); inew != new_apv_vector.end(); inew++ ){
244  bool there_already = false;
245  for(std::vector<int>::iterator iold = existing_apv_vector.begin(); iold != existing_apv_vector.end(); iold++){
246  if (*iold == *inew){
247  there_already = true;
248  break; // leave the loop
249  }
250  }
251  if( ! there_already ){
252  existing_apv_vector.push_back(*inew);
253  std::sort(existing_apv_vector.begin(),existing_apv_vector.end()); // not very efficient sort, time consuming?
254  }else{
255  //edm::LogWarning("Logical") << "apv "<<*inew<<" already exists in the detector module "<<new_detid;
256  }
257  }
258  }
259  }
260 }
int16_t layerSearch(const uint32_t detId) const
std::map< int16_t, uint32_t > connectionCount[3]
void SiStripDetCabling::addNotConnectedAPVs ( std::map< uint32_t, std::vector< int > > &  map_to_add_to) const

Definition at line 212 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), detected_, and undetected_.

212  {
213  addFromSpecificConnection(map_to_add_to, detected_);
214  addFromSpecificConnection(map_to_add_to, undetected_);
215 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
std::map< uint32_t, std::vector< int > > detected_
std::map< uint32_t, std::vector< int > > undetected_
void SiStripDetCabling::addUnDetected ( std::map< uint32_t, std::vector< int > > &  map_to_add_to) const

Definition at line 207 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and undetected_.

207  {
208  addFromSpecificConnection(map_to_add_to, undetected_);
209 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
std::map< uint32_t, std::vector< int > > undetected_
uint32_t SiStripDetCabling::connectedNumber ( const std::string &  subDet,
const uint16_t  layer 
) const
inline

Definition at line 58 of file SiStripDetCabling.h.

References detNumber().

58 { return detNumber(subDet, layer, 0); }
uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const
Return the number of modules for the specified subDet, layer and connectionType.
uint32_t SiStripDetCabling::detectedNumber ( const std::string &  subDet,
const uint16_t  layer 
) const
inline

Definition at line 59 of file SiStripDetCabling.h.

References detNumber().

59 { return detNumber(subDet, layer, 1); }
uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const
Return the number of modules for the specified subDet, layer and connectionType.
uint32_t SiStripDetCabling::detNumber ( const std::string &  subDet,
const uint16_t  layer,
const int  connectionType 
) const
private

Return the number of modules for the specified subDet, layer and connectionType.

Definition at line 283 of file SiStripDetCabling.cc.

References connectionCount, and LogDebug.

Referenced by connectedNumber(), detectedNumber(), and undetectedNumber().

283  {
284  uint16_t subDetLayer = layer;
285  // TIB = 1, TID = 2, TOB = 3, TEC = 4
286  if( subDet == "TID-" ) subDetLayer += 10;
287  else if( subDet == "TID+" ) subDetLayer += 10 + 3;
288  else if( subDet == "TOB" ) subDetLayer += 100;
289  else if( subDet == "TEC-" ) subDetLayer += 1000;
290  else if( subDet == "TEC+" ) subDetLayer += 1000 + 9;
291  else if( subDet != "TIB" ) {
292  LogDebug("SiStripDetCabling") << "Error: Wrong subDet. Please use one of TIB, TID, TOB, TEC." << std::endl;
293  return 0;
294  }
295  return connectionCount[connectionType][subDetLayer];
296 }
#define LogDebug(id)
std::map< int16_t, uint32_t > connectionCount[3]
const SiStripFedCabling* SiStripDetCabling::fedCabling ( ) const
inline

Definition at line 61 of file SiStripDetCabling.h.

References fedCabling_.

Referenced by SiStripQuality::add(), and SiStripQuality::turnOffFeds().

61 {return fedCabling_;}
const SiStripFedCabling * fedCabling_
void SiStripDetCabling::getActiveDetectorsContiguousIds ( std::map< uint32_t, unsigned int > &  connectedToContiguous) const

Definition at line 310 of file SiStripDetCabling.cc.

References addAllDetectorsRawIds(), getAllDetectorsContiguousIds(), and python.multivaluedict::sort().

310  {
311  connectedToContiguous.clear(); // reset map
312  std::vector<uint32_t> connected; addAllDetectorsRawIds(connected); std::sort(connected.begin(), connected.end()); // get connected detids and sort them (not strictly necessary)
313  std::map<uint32_t, unsigned int> allToContiguous; getAllDetectorsContiguousIds(allToContiguous); // create map of all indices
314  for(std::vector<uint32_t>::const_iterator idet = connected.begin(); idet!= connected.end(); ++idet){ // select only the indices for active detectors
315  std::map<uint32_t, unsigned int>::iterator deco = allToContiguous.find(*idet);
316  if(deco!=allToContiguous.end()){
317  connectedToContiguous.insert(*deco);
318  }
319  }
320 }
void getAllDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
void SiStripDetCabling::getAllDetectorsContiguousIds ( std::map< uint32_t, unsigned int > &  allToContiguous) const

Definition at line 299 of file SiStripDetCabling.cc.

References addAllDetectorsRawIds(), cond::ecalcond::all, and python.multivaluedict::sort().

Referenced by getActiveDetectorsContiguousIds().

299  {
300  allToContiguous.clear(); // reset map
301  std::vector<uint32_t> all; addAllDetectorsRawIds(all); std::sort(all.begin(), all.end()); // get all detids and sort them
302  unsigned int contiguousIndex = 0;
303  for(std::vector<uint32_t>::const_iterator idet = all.begin(); idet!= all.end(); ++idet){
304  ++contiguousIndex;
305  allToContiguous.insert(std::make_pair(*idet,contiguousIndex));
306  }
307 }
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
const FedChannelConnection & SiStripDetCabling::getConnection ( uint32_t  det_id,
unsigned short  apv_pair 
) const

Definition at line 153 of file SiStripDetCabling.cc.

References getConnections().

Referenced by ws_sso_content_reader.HTTPSClientAuthHandler::https_open().

153  {
154  const std::vector<const FedChannelConnection *>& fcconns = getConnections(det_id);
155  for(std::vector<const FedChannelConnection *>::const_iterator iconn = fcconns.begin(); iconn!=fcconns.end();iconn++){
156  if ( ((*iconn) != 0) && (((*iconn)->apvPairNumber()) == apv_pair) ) { // check if apvPairNumber() of present FedChannelConnection is the same as requested one
157  return (**iconn); // if yes, return the FedChannelConnection object
158  }
159  }
160  // if did not match none of the above, return some default value - DKwarn : also output message?
161  static FedChannelConnection default_empty_fedchannelconnection;
162  return default_empty_fedchannelconnection;
163 }
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
Class containning control, module, detector and connection information, at the level of a FED channel...
const std::vector< const FedChannelConnection * > & SiStripDetCabling::getConnections ( uint32_t  det_id) const

Definition at line 142 of file SiStripDetCabling.cc.

References fullcabling_.

Referenced by SiStripQuality::addInvalidConnectionFromCabling(), APVShotsAnalyzer::analyze(), SiStripCondObjBuilderFromDb::buildConnections(), getConnection(), getDcuId(), and nApvPairs().

142  { // return all connections corresponding to one det_id
143  std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator detcabl_it = fullcabling_.find(det_id); // has to be const_iterator because this function cannot change data members
144  if( ! (detcabl_it==fullcabling_.end()) ){ // found detid in fullcabling_
145  return ( detcabl_it->second );
146  }else{ // DKwarn : is there need for output message here telling det_id does not exist?
147  static std::vector<const FedChannelConnection *> default_empty_fedchannelconnection;
148  return default_empty_fedchannelconnection;
149  }
150 }
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
const unsigned int SiStripDetCabling::getDcuId ( uint32_t  det_id) const

Definition at line 166 of file SiStripDetCabling.cc.

References getConnections(), i, and sistrip::invalid32_.

166  {
167  const std::vector<const FedChannelConnection *>& fcconns = getConnections( det_id );
168  if(fcconns.size()!=0) {
169  // patch needed to take into account the possibility that the first component of fcconns is invalid
170  for(size_t i=0;i<fcconns.size();++i)
171  if (fcconns.at(i)->detId() != sistrip::invalid32_ && fcconns.at(i)->detId() != 0 )
172  return ( fcconns.at(i) )->dcuId(); // get dcuId of first element - when you build check this consistency
173  }
174  // default if none of the above is fulfilled
175  unsigned int default_zero_value = 0;
176  return default_zero_value;
177 }
int i
Definition: DBlmapReader.cc:9
static const uint32_t invalid32_
Definition: Constants.h:16
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const std::map< uint32_t, std::vector<const FedChannelConnection *> >& SiStripDetCabling::getDetCabling ( ) const
inline

Definition at line 29 of file SiStripDetCabling.h.

References fullcabling_.

29 { return fullcabling_; }
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
bool SiStripDetCabling::IsConnected ( const uint32_t &  det_id) const

Definition at line 322 of file SiStripDetCabling.cc.

References connected_, and IsInMap().

Referenced by SiStripQuality::addNotConnectedConnectionFromCabling(), and SiStripQuality::IsModuleUsable().

322  {
323  return IsInMap(det_id,connected_);
324 }
std::map< uint32_t, std::vector< int > > connected_
bool IsInMap(const uint32_t &det_id, const std::map< uint32_t, std::vector< int > > &) const
bool SiStripDetCabling::IsDetected ( const uint32_t &  det_id) const

Definition at line 326 of file SiStripDetCabling.cc.

References detected_, and IsInMap().

326  {
327  return IsInMap(det_id,detected_);
328 }
bool IsInMap(const uint32_t &det_id, const std::map< uint32_t, std::vector< int > > &) const
std::map< uint32_t, std::vector< int > > detected_
bool SiStripDetCabling::IsInMap ( const uint32_t &  det_id,
const std::map< uint32_t, std::vector< int > > &  map 
) const
private

Definition at line 332 of file SiStripDetCabling.cc.

References python.multivaluedict::map().

Referenced by IsConnected(), IsDetected(), and IsUndetected().

332  {
333  std::map< uint32_t, std::vector<int> >::const_iterator it=map.find(det_id);
334  return (it!=map.end());
335 }
bool SiStripDetCabling::IsUndetected ( const uint32_t &  det_id) const

Definition at line 329 of file SiStripDetCabling.cc.

References IsInMap(), and undetected_.

329  {
330  return IsInMap(det_id,undetected_);
331 }
bool IsInMap(const uint32_t &det_id, const std::map< uint32_t, std::vector< int > > &) const
std::map< uint32_t, std::vector< int > > undetected_
int16_t SiStripDetCabling::layerSearch ( const uint32_t  detId) const
private

Definition at line 262 of file SiStripDetCabling.cc.

References TOBDetId::layerNumber(), TIBDetId::layerNumber(), TIDDetId::side(), TECDetId::side(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, TIDDetId::wheel(), and TECDetId::wheel().

Referenced by addFromSpecificConnection().

263 {
264  if(SiStripDetId(detId).subDetector()==SiStripDetId::TIB){
265  TIBDetId D(detId);
266  return D.layerNumber();
267  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TID){
268  TIDDetId D(detId);
269  // side: 1 = negative, 2 = positive
270  return 10+(D.side() -1)*3 + D.wheel();
271  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TOB){
272  TOBDetId D(detId);
273  return 100+D.layerNumber();
274  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TEC){
275  TECDetId D(detId);
276  // side: 1 = negative, 2 = positive
277  return 1000+(D.side() -1)*9 + D.wheel();
278  }
279  return 0;
280 }
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
const uint16_t SiStripDetCabling::nApvPairs ( uint32_t  det_id) const

Definition at line 180 of file SiStripDetCabling.cc.

References getConnections(), i, and sistrip::invalid_.

Referenced by SiStripQuality::addInvalidConnectionFromCabling().

180  {
181  const std::vector<const FedChannelConnection *>& fcconns = getConnections( det_id );
182  if(fcconns.size()!=0) {
183  // patch needed to take into account the possibility that the first component of fcconns is invalid
184  for(size_t i=0;i<fcconns.size();++i) {
185  if ( (fcconns.at(i) != 0) && (fcconns.at(i)->nApvPairs() != sistrip::invalid_) ) {
186  return fcconns.at(i)->nApvPairs(); // nr of apvpairs for associated module
187  }
188  }
189  }
190  // else {
191  // return 0;
192  // }
193  return 0;
194 }
int i
Definition: DBlmapReader.cc:9
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
static const uint16_t invalid_
Definition: Constants.h:17
const SiStripDetCabling& SiStripDetCabling::operator= ( const SiStripDetCabling )
private
void SiStripDetCabling::print ( std::stringstream &  ss) const

Added missing print method.

Definition at line 339 of file SiStripDetCabling.cc.

References fullcabling_, findQualityFiles::jj, pileupDistInMC::total, and TrackValidation_HighPurity_cff::valid.

Referenced by printDebug().

339  {
340  uint32_t valid = 0;
341  uint32_t total = 0;
342  typedef std::vector<const FedChannelConnection *> Conns;
343  typedef std::map<uint32_t,Conns> ConnsMap;
344  ConnsMap::const_iterator ii = fullcabling_.begin();
345  ConnsMap::const_iterator jj = fullcabling_.end();
346  ss << "[SiStripDetCabling::" << __func__ << "]"
347  << " Printing DET cabling for " << fullcabling_.size()
348  << " modules " << std::endl;
349  for ( ; ii != jj; ++ii ) {
350  ss << "Printing " << ii->second.size()
351  << " connections for DetId: " << ii->first << std::endl;
352  Conns::const_iterator iii = ii->second.begin();
353  Conns::const_iterator jjj = ii->second.end();
354  for ( ; iii != jjj; ++iii ) {
355  if ( (*iii)->isConnected() ) { valid++; }
356  total++;
357  ss << **iii << std::endl;
358  }
359  }
360  ss << "Number of connected: " << valid << std::endl
361  << "Number of connections: " << total << std::endl;
362 }
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
void SiStripDetCabling::printDebug ( std::stringstream &  ss) const

The printDebug method returns all the connected/detected/undetected modules.

Definition at line 395 of file SiStripDetCabling.cc.

References print().

395  {
396  print(ss);
397 }
void print(std::stringstream &) const
void SiStripDetCabling::printSummary ( std::stringstream &  ss) const

The printSummary method outputs the number of connected/detected/undetected modules for each layer of each subdetector.

Definition at line 364 of file SiStripDetCabling.cc.

References connectionCount.

364  {
365  for( int connectionType = 0; connectionType < 3; ++connectionType ) {
366  if( connectionType == 0 ) ss << "Connected modules:" << std::endl;
367  else if( connectionType == 1 ) ss << "Detected modules:" << std::endl;
368  else ss << "Undetected modules:" << std::endl;
369  ss << "SubDet and layer\t modules" << std::endl;
370  std::map< int16_t, uint32_t >::const_iterator iter = connectionCount[connectionType].begin();
371  for( ; iter != connectionCount[connectionType].end(); ++iter ) {
372  uint32_t subDetLayer = iter->first;
373  uint32_t modules = iter->second;
374  if( int(subDetLayer/10) == 0 ) {
375  ss << "TIB \t layer " << subDetLayer << " \t" << modules << std::endl;
376  }
377  else if( int(subDetLayer/100) == 0 ) {
378  int layer = subDetLayer%10;
379  if( layer <= 3 ) ss << "TID- \t disk " << layer << "\t" << modules << std::endl;
380  else ss << "TID+ \t disk " << layer-3 << "\t" << modules << std::endl;
381  }
382  else if( int(subDetLayer/1000) == 0 ) {
383  int layer = subDetLayer%100;
384  ss << "TOB \t layer " << layer << " \t" << modules << std::endl;
385  }
386  else {
387  int layer = subDetLayer%100;
388  if( layer <= 9 ) ss << "TEC- \t disk " << layer << " \t" << modules << std::endl;
389  else ss << "TEC+ \t disk " << layer-9 << " \t" << modules << std::endl;
390  }
391  }
392  }
393 }
std::map< int16_t, uint32_t > connectionCount[3]
uint32_t SiStripDetCabling::undetectedNumber ( const std::string &  subDet,
const uint16_t  layer 
) const
inline

Definition at line 60 of file SiStripDetCabling.h.

References detNumber().

60 { return detNumber(subDet, layer, 2); }
uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const
Return the number of modules for the specified subDet, layer and connectionType.

Member Data Documentation

std::map< uint32_t, std::vector<int> > SiStripDetCabling::connected_
private
std::map< int16_t, uint32_t > SiStripDetCabling::connectionCount[3]
mutableprivate

Definition at line 84 of file SiStripDetCabling.h.

Referenced by addFromSpecificConnection(), detNumber(), and printSummary().

std::map< uint32_t, std::vector<int> > SiStripDetCabling::detected_
private
const SiStripFedCabling* SiStripDetCabling::fedCabling_
private

Definition at line 85 of file SiStripDetCabling.h.

Referenced by fedCabling().

std::map< uint32_t, std::vector<const FedChannelConnection *> > SiStripDetCabling::fullcabling_
private
std::map< uint32_t, std::vector<int> > SiStripDetCabling::undetected_
private