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++ ) {
32 std::vector<FedChannelConnection>::const_iterator iconn;
33 for ( iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
35 bool have_fed_id = iconn->fedId();
36 std::vector<int> vector_of_connected_apvs;
39 int which_apv_pair = iconn->apvPairNumber();
42 if( iconn->detId()==0 ||
49 if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0);
50 if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1);
52 if(vector_of_connected_apvs.size() != 0){
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));
61 for(std::vector<FedChannelConnection>::const_iterator idtct = detected_fed_connections.begin(); idtct != detected_fed_connections.end(); idtct++){
63 bool have_fed_id = idtct->fedId();
64 std::vector<int> vector_of_detected_apvs;
66 int which_apv_pair = idtct->apvPairNumber();
67 if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0);
68 if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1);
70 if(vector_of_detected_apvs.size() != 0){
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));
78 for(std::vector<FedChannelConnection>::const_iterator iudtct = undetected_fed_connections.begin(); iudtct != undetected_fed_connections.end(); iudtct++){
80 bool have_fed_id = iudtct->fedId();
81 std::vector<int> vector_of_undetected_apvs;
83 int which_apv_pair = iudtct->apvPairNumber();
84 if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0);
85 if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1);
87 if(vector_of_undetected_apvs.size() != 0){
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));
97 std::map< uint32_t, std::vector<const FedChannelConnection *> >& conns ){
101 edm::LogInfo(
"") <<
" SiStripDetCabling::addDevices for connection associated to detid " << conn.
detId() <<
" apvPairNumber " << conn.
apvPairNumber() <<
"the fedId is " << conn.
fedId();
122 vector_to_fill_with_detids.push_back(conn_it->first);
130 vector_to_fill_with_detids.push_back(conn_it->first);
133 vector_to_fill_with_detids.push_back(conn_it->first);
136 vector_to_fill_with_detids.push_back(conn_it->first);
143 std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator detcabl_it =
fullcabling_.find(det_id);
145 return ( detcabl_it->second );
147 static std::vector<const FedChannelConnection *> default_empty_fedchannelconnection;
148 return default_empty_fedchannelconnection;
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) ) {
162 return default_empty_fedchannelconnection;
167 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
168 if(fcconns.size()!=0) {
170 for(
size_t i=0;
i<fcconns.size();++
i)
172 return ( fcconns.at(
i) )->dcuId();
175 unsigned int default_zero_value = 0;
176 return default_zero_value;
181 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
182 if(fcconns.size()!=0) {
184 for(
size_t i=0;
i<fcconns.size();++
i) {
186 return fcconns.at(
i)->nApvPairs();
219 const std::map< uint32_t, std::vector<int> > & specific_connection,
220 const int connectionType )
const {
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() ){
226 std::sort(new_apv_vector.begin(),new_apv_vector.end());
227 map_to_add_to.insert(std::make_pair(new_detid,new_apv_vector));
238 if( connectionType != -1 ) {
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++){
247 there_already =
true;
251 if( ! there_already ){
252 existing_apv_vector.push_back(*inew);
253 std::sort(existing_apv_vector.begin(),existing_apv_vector.end());
284 uint16_t subDetLayer = layer;
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;
300 allToContiguous.clear();
302 unsigned int contiguousIndex = 0;
303 for(std::vector<uint32_t>::const_iterator idet = all.begin(); idet!= all.end(); ++idet){
305 allToContiguous.insert(std::make_pair(*idet,contiguousIndex));
311 connectedToContiguous.clear();
314 for(std::vector<uint32_t>::const_iterator idet = connected.begin(); idet!= connected.end(); ++idet){
315 std::map<uint32_t, unsigned int>::iterator deco = allToContiguous.find(*idet);
316 if(deco!=allToContiguous.end()){
317 connectedToContiguous.insert(*deco);
333 std::map< uint32_t, std::vector<int> >::const_iterator it=
map.find(det_id);
334 return (it!=
map.end());
342 typedef std::vector<const FedChannelConnection *> Conns;
343 typedef std::map<uint32_t,Conns> ConnsMap;
346 ss <<
"[SiStripDetCabling::" << __func__ <<
"]"
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++; }
357 ss << **iii << std::endl;
360 ss <<
"Number of connected: " << valid << std::endl
361 <<
"Number of connections: " << total << std::endl;
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();
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;
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;
382 else if(
int(subDetLayer/1000) == 0 ) {
383 int layer = subDetLayer%100;
384 ss <<
"TOB \t layer " << layer <<
" \t" << modules << std::endl;
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;
ConnsConstIterRange detectedDevices() const
const FedChannelConnection & getConnection(uint32_t det_id, unsigned short apv_pair) const
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
const std::vector< uint16_t > & feds() const
std::map< uint32_t, std::vector< int > > connected_
const unsigned int getDcuId(uint32_t det_id) const
static const uint32_t invalid32_
ConnsConstIterRange undetectedDevices() const
uint16_t apvPairNumber() const
bool IsInMap(const uint32_t &det_id, const std::map< uint32_t, std::vector< int > > &) const
bool IsConnected(const uint32_t &det_id) const
void addFromSpecificConnection(std::map< uint32_t, std::vector< int > > &, const std::map< uint32_t, std::vector< int > > &, const int connectionType=-1) const
int16_t layerSearch(const uint32_t detId) const
const uint16_t & fedId() const
unsigned int side() const
positive or negative id
unsigned int layerNumber() const
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
boost::iterator_range< ConnsConstIter > ConnsConstIterRange
unsigned int layerNumber() const
std::map< uint32_t, std::vector< int > > detected_
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
void addNotConnectedAPVs(std::map< uint32_t, std::vector< int > > &) 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.
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
bool IsUndetected(const uint32_t &det_id) const
void getAllDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
Detector identifier class for the strip tracker.
virtual ~SiStripDetCabling()
void printSummary(std::stringstream &ss) const
unsigned int side() const
positive or negative id
ConnsConstIterRange fedConnections(uint16_t fed_id) const
static const uint16_t invalid_
std::map< int16_t, uint32_t > connectionCount[3]
unsigned int wheel() const
wheel id
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
const uint16_t nApvPairs(uint32_t det_id) const
void getActiveDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
void addDetected(std::map< uint32_t, std::vector< int > > &) const
void printDebug(std::stringstream &ss) const
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector< const FedChannelConnection * > > &)
std::map< uint32_t, std::vector< int > > undetected_
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
void addUnDetected(std::map< uint32_t, std::vector< int > > &) const
bool IsDetected(const uint32_t &det_id) const
void print(std::stringstream &) const
DecomposeProduct< arg, typename Div::arg > D
void addConnected(std::map< uint32_t, std::vector< int > > &) const
unsigned int wheel() const
wheel id