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
 
std::map< uint32_t,
std::vector< int > > const & 
connected () 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 > > &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) 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 18 of file SiStripDetCabling.cc.

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

Definition at line 19 of file SiStripDetCabling.cc.

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

Definition at line 22 of file SiStripDetCabling.cc.

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

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

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

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

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

Definition at line 125 of file SiStripDetCabling.cc.

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

Referenced by getActiveDetectorsContiguousIds(), and getAllDetectorsContiguousIds().

125  {
126  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = connected_.begin(); conn_it!=connected_.end(); conn_it++){
127  vector_to_fill_with_detids.push_back(conn_it->first);
128  }
129  for(std::map< uint32_t, std::vector<int> >::const_iterator conn_it = detected_.begin(); conn_it!=detected_.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 = undetected_.begin(); conn_it!=undetected_.end(); conn_it++){
133  vector_to_fill_with_detids.push_back(conn_it->first);
134  }
135  // no elements added to vector_to_fill_with_detids is empty connected_, detected_.begin and undetected_.begin
136 }
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 194 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and connected_.

194  {
195  addFromSpecificConnection(map_to_add_to, connected_);
196 }
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 > > &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) const
void SiStripDetCabling::addDetected ( std::map< uint32_t, std::vector< int > > &  map_to_add_to) const

Definition at line 199 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and detected_.

199  {
200  addFromSpecificConnection(map_to_add_to, detected_);
201 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) 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 93 of file SiStripDetCabling.cc.

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

Referenced by addDevices(), and SiStripDetCabling().

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

Definition at line 112 of file SiStripDetCabling.cc.

References addDevices(), and fullcabling_.

112  { // by default add to fullcabling_ connections - special case of above class
113  addDevices(conn, fullcabling_ ); // add to fullcabling_
114 }
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,
std::map< int16_t, uint32_t > *  connectionsToFill = nullptr 
) const
private

Definition at line 215 of file SiStripDetCabling.cc.

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

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

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

Definition at line 209 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), detected_, and undetected_.

209  {
210  addFromSpecificConnection(map_to_add_to, detected_);
211  addFromSpecificConnection(map_to_add_to, undetected_);
212 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) 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 204 of file SiStripDetCabling.cc.

References addFromSpecificConnection(), and undetected_.

204  {
205  addFromSpecificConnection(map_to_add_to, undetected_);
206 }
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) const
std::map< uint32_t, std::vector< int > > undetected_
std::map< uint32_t, std::vector<int> > const& SiStripDetCabling::connected ( ) const
inline

Definition at line 63 of file SiStripDetCabling.h.

References connected_.

Referenced by getActiveDetectorsContiguousIds(), and StripClusterizerAlgorithm::initialize().

63 { return connected_;}
std::map< uint32_t, std::vector< int > > connected_
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 281 of file SiStripDetCabling.cc.

References connectionCount, end, newFWLiteAna::found, and LogDebug.

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

281  {
282  uint16_t subDetLayer = layer;
283  // TIB = 1, TID = 2, TOB = 3, TEC = 4
284  if( subDet == "TID-" ) subDetLayer += 10;
285  else if( subDet == "TID+" ) subDetLayer += 10 + 3;
286  else if( subDet == "TOB" ) subDetLayer += 100;
287  else if( subDet == "TEC-" ) subDetLayer += 1000;
288  else if( subDet == "TEC+" ) subDetLayer += 1000 + 9;
289  else if( subDet != "TIB" ) {
290  LogDebug("SiStripDetCabling") << "Error: Wrong subDet. Please use one of TIB, TID, TOB, TEC." << std::endl;
291  return 0;
292  }
293  auto found = connectionCount[connectionType].find(subDetLayer);
294  if(found != connectionCount[connectionType].end()) {
295  return found->second;
296  }
297  return 0;
298 }
#define LogDebug(id)
#define end
Definition: vmac.h:37
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 312 of file SiStripDetCabling.cc.

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

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

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

Referenced by getActiveDetectorsContiguousIds().

301  {
302  allToContiguous.clear(); // reset map
303  std::vector<uint32_t> all; addAllDetectorsRawIds(all); std::sort(all.begin(), all.end()); // get all detids and sort them
304  unsigned int contiguousIndex = 0;
305  for(std::vector<uint32_t>::const_iterator idet = all.begin(); idet!= all.end(); ++idet){
306  ++contiguousIndex;
307  allToContiguous.insert(std::make_pair(*idet,contiguousIndex));
308  }
309 }
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 150 of file SiStripDetCabling.cc.

References getConnections().

Referenced by APVShotsAnalyzer::analyze(), APVShotsFilter::filter(), and ws_sso_content_reader.HTTPSClientAuthHandler::https_open().

150  {
151  const std::vector<const FedChannelConnection *>& fcconns = getConnections(det_id);
152  for(std::vector<const FedChannelConnection *>::const_iterator iconn = fcconns.begin(); iconn!=fcconns.end();iconn++){
153  if ( ((*iconn) != 0) && (((*iconn)->apvPairNumber()) == apv_pair) ) { // check if apvPairNumber() of present FedChannelConnection is the same as requested one
154  return (**iconn); // if yes, return the FedChannelConnection object
155  }
156  }
157  // if did not match none of the above, return some default value - DKwarn : also output message?
158  const static FedChannelConnection default_empty_fedchannelconnection;
159  return default_empty_fedchannelconnection;
160 }
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 139 of file SiStripDetCabling.cc.

References fullcabling_.

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

139  { // return all connections corresponding to one det_id
140  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
141  if( ! (detcabl_it==fullcabling_.end()) ){ // found detid in fullcabling_
142  return ( detcabl_it->second );
143  }else{ // DKwarn : is there need for output message here telling det_id does not exist?
144  const static std::vector<const FedChannelConnection *> default_empty_fedchannelconnection;
145  return default_empty_fedchannelconnection;
146  }
147 }
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
const unsigned int SiStripDetCabling::getDcuId ( uint32_t  det_id) const

Definition at line 163 of file SiStripDetCabling.cc.

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

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

Referenced by StripClusterizerAlgorithm::initialize().

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

Definition at line 324 of file SiStripDetCabling.cc.

References connected_, and IsInMap().

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

324  {
325  return IsInMap(det_id,connected_);
326 }
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 328 of file SiStripDetCabling.cc.

References detected_, and IsInMap().

328  {
329  return IsInMap(det_id,detected_);
330 }
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 334 of file SiStripDetCabling.cc.

References python.multivaluedict::map().

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

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

Definition at line 331 of file SiStripDetCabling.cc.

References IsInMap(), and undetected_.

331  {
332  return IsInMap(det_id,undetected_);
333 }
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 260 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().

261 {
262  if(SiStripDetId(detId).subDetector()==SiStripDetId::TIB){
263  TIBDetId D(detId);
264  return D.layerNumber();
265  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TID){
266  TIDDetId D(detId);
267  // side: 1 = negative, 2 = positive
268  return 10+(D.side() -1)*3 + D.wheel();
269  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TOB){
270  TOBDetId D(detId);
271  return 100+D.layerNumber();
272  } else if (SiStripDetId(detId).subDetector()==SiStripDetId::TEC){
273  TECDetId D(detId);
274  // side: 1 = negative, 2 = positive
275  return 1000+(D.side() -1)*9 + D.wheel();
276  }
277  return 0;
278 }
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 177 of file SiStripDetCabling.cc.

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

Referenced by SiStripQuality::addInvalidConnectionFromCabling().

177  {
178  const std::vector<const FedChannelConnection *>& fcconns = getConnections( det_id );
179  if(fcconns.size()!=0) {
180  // patch needed to take into account the possibility that the first component of fcconns is invalid
181  for(size_t i=0;i<fcconns.size();++i) {
182  if ( (fcconns.at(i) != 0) && (fcconns.at(i)->nApvPairs() != sistrip::invalid_) ) {
183  return fcconns.at(i)->nApvPairs(); // nr of apvpairs for associated module
184  }
185  }
186  }
187  // else {
188  // return 0;
189  // }
190  return 0;
191 }
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:16
const SiStripDetCabling& SiStripDetCabling::operator= ( const SiStripDetCabling )
private
void SiStripDetCabling::print ( std::stringstream &  ss) const

Added missing print method.

Definition at line 341 of file SiStripDetCabling.cc.

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

Referenced by printDebug().

341  {
342  uint32_t valid = 0;
343  uint32_t total = 0;
344  typedef std::vector<const FedChannelConnection *> Conns;
345  typedef std::map<uint32_t,Conns> ConnsMap;
346  ConnsMap::const_iterator ii = fullcabling_.begin();
347  ConnsMap::const_iterator jj = fullcabling_.end();
348  ss << "[SiStripDetCabling::" << __func__ << "]"
349  << " Printing DET cabling for " << fullcabling_.size()
350  << " modules " << std::endl;
351  for ( ; ii != jj; ++ii ) {
352  ss << "Printing " << ii->second.size()
353  << " connections for DetId: " << ii->first << std::endl;
354  Conns::const_iterator iii = ii->second.begin();
355  Conns::const_iterator jjj = ii->second.end();
356  for ( ; iii != jjj; ++iii ) {
357  if ( (*iii)->isConnected() ) { valid++; }
358  total++;
359  ss << **iii << std::endl;
360  }
361  }
362  ss << "Number of connected: " << valid << std::endl
363  << "Number of connections: " << total << std::endl;
364 }
int ii
Definition: cuy.py:588
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 397 of file SiStripDetCabling.cc.

References print().

397  {
398  print(ss);
399 }
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 366 of file SiStripDetCabling.cc.

References connectionCount, getDQMSummary::iter, and edmConvertToStreamModule::modules.

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

Definition at line 85 of file SiStripDetCabling.h.

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

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

Definition at line 86 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