26 const std::vector<uint16_t>& feds = fedcabling.
feds();
27 std::vector<uint16_t>::const_iterator ifed;
28 for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
29 const std::vector<FedChannelConnection>& conns = fedcabling.
connections( *ifed );
30 std::vector<FedChannelConnection>::const_iterator iconn;
31 for ( iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
33 bool have_fed_id = iconn->fedId();
34 std::vector<int> vector_of_connected_apvs;
37 int which_apv_pair = iconn->apvPairNumber();
40 if( iconn->detId()==0 ||
47 if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0);
48 if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1);
50 if(vector_of_connected_apvs.size() != 0){
51 std::map<uint32_t, std::vector<int> > map_of_connected_apvs;
52 map_of_connected_apvs.insert(std::make_pair(iconn->detId(),vector_of_connected_apvs));
58 const std::vector<FedChannelConnection>& detected_fed_connections = fedcabling.
detected();
59 for(std::vector<FedChannelConnection>::const_iterator idtct = detected_fed_connections.begin(); idtct != detected_fed_connections.end(); idtct++){
61 bool have_fed_id = idtct->fedId();
62 std::vector<int> vector_of_detected_apvs;
64 int which_apv_pair = idtct->apvPairNumber();
65 if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0);
66 if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1);
68 if(vector_of_detected_apvs.size() != 0){
69 std::map<uint32_t,std::vector<int> > map_of_detected_apvs;
70 map_of_detected_apvs.insert(std::make_pair(idtct->detId(),vector_of_detected_apvs));
75 const std::vector<FedChannelConnection>& undetected_fed_connections = fedcabling.
undetected();
76 for(std::vector<FedChannelConnection>::const_iterator iudtct = undetected_fed_connections.begin(); iudtct != undetected_fed_connections.end(); iudtct++){
78 bool have_fed_id = iudtct->fedId();
79 std::vector<int> vector_of_undetected_apvs;
81 int which_apv_pair = iudtct->apvPairNumber();
82 if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0);
83 if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1);
85 if(vector_of_undetected_apvs.size() != 0){
86 std::map<uint32_t, std::vector<int> > map_of_undetected_apvs;
87 map_of_undetected_apvs.insert(std::make_pair(iudtct->detId(),vector_of_undetected_apvs));
95 std::map< uint32_t, std::vector<FedChannelConnection> >& conns ){
99 edm::LogInfo(
"") <<
" SiStripDetCabling::addDevices for connection associated to detid " << conn.
detId() <<
" apvPairNumber " << conn.
apvPairNumber() <<
"the fedId is " << conn.
fedId();
120 vector_to_fill_with_detids.push_back(conn_it->first);
128 vector_to_fill_with_detids.push_back(conn_it->first);
131 vector_to_fill_with_detids.push_back(conn_it->first);
134 vector_to_fill_with_detids.push_back(conn_it->first);
141 std::map< uint32_t, std::vector<FedChannelConnection> >::const_iterator detcabl_it =
fullcabling_.find(det_id);
143 return ( detcabl_it->second );
145 static std::vector<FedChannelConnection> default_empty_fedchannelconnection;
146 return default_empty_fedchannelconnection;
152 const std::vector<FedChannelConnection>& fcconns =
getConnections(det_id);
153 for(std::vector<FedChannelConnection>::const_iterator iconn = fcconns.begin(); iconn!=fcconns.end();iconn++){
154 if ( (iconn->apvPairNumber()) == apv_pair){
160 return default_empty_fedchannelconnection;
165 const std::vector<FedChannelConnection>& fcconns =
getConnections( det_id );
166 if(fcconns.size()!=0) {
168 for(
size_t i=0;
i<fcconns.size();++
i)
170 return ( fcconns.at(
i) ).dcuId();
173 unsigned int default_zero_value = 0;
174 return default_zero_value;
179 const std::vector<FedChannelConnection>& fcconns =
getConnections( det_id );
180 if(fcconns.size()!=0) {
182 for(
size_t i=0;
i<fcconns.size();++
i)
184 return fcconns.at(
i).nApvPairs();
214 const std::map< uint32_t, std::vector<int> > & specific_connection,
215 const int connectionType )
const {
216 for(
std::map< uint32_t, std::vector<int> >::const_iterator conn_it = specific_connection.begin(); conn_it!=specific_connection.end(); ++conn_it){
217 uint32_t new_detid = conn_it->first;
218 std::vector<int> new_apv_vector = conn_it->second;
219 std::map<uint32_t, std::vector<int> >::iterator it = map_to_add_to.find(new_detid);
220 if( it == map_to_add_to.end() ){
221 std::sort(new_apv_vector.begin(),new_apv_vector.end());
222 map_to_add_to.insert(std::make_pair(new_detid,new_apv_vector));
233 if( connectionType != -1 ) {
237 std::vector<int> existing_apv_vector = it->second;
238 for(std::vector<int>::iterator inew = new_apv_vector.begin(); inew != new_apv_vector.end(); inew++ ){
239 bool there_already =
false;
240 for(std::vector<int>::iterator iold = existing_apv_vector.begin(); iold != existing_apv_vector.end(); iold++){
242 there_already =
true;
246 if( ! there_already ){
247 existing_apv_vector.push_back(*inew);
248 std::sort(existing_apv_vector.begin(),existing_apv_vector.end());
279 uint16_t subDetLayer = layer;
281 if( subDet ==
"TID-" ) subDetLayer += 10;
282 else if( subDet ==
"TID+" ) subDetLayer += 10 + 3;
283 else if( subDet ==
"TOB" ) subDetLayer += 100;
284 else if( subDet ==
"TEC-" ) subDetLayer += 1000;
285 else if( subDet ==
"TEC+" ) subDetLayer += 1000 + 9;
286 else if( subDet !=
"TIB" ) {
287 LogDebug(
"SiStripDetCabling") <<
"Error: Wrong subDet. Please use one of TIB, TID, TOB, TEC." << std::endl;
295 allToContiguous.clear();
297 unsigned int contiguousIndex = 0;
298 for(std::vector<uint32_t>::const_iterator idet = all.begin(); idet!= all.end(); ++idet){
300 allToContiguous.insert(std::make_pair(*idet,contiguousIndex));
306 connectedToContiguous.clear();
309 for(std::vector<uint32_t>::const_iterator idet = connected.begin(); idet!= connected.end(); ++idet){
310 std::map<uint32_t, unsigned int>::iterator deco = allToContiguous.find(*idet);
311 if(deco!=allToContiguous.end()){
312 connectedToContiguous.insert(*deco);
328 std::map< uint32_t, std::vector<int> >::const_iterator it=
map.find(det_id);
329 return (it!=
map.end());
337 typedef std::vector<FedChannelConnection> Conns;
338 typedef std::map<uint32_t,Conns> ConnsMap;
341 ss <<
"[SiStripDetCabling::" << __func__ <<
"]"
343 <<
" modules " << std::endl;
344 for ( ; ii != jj; ++ii ) {
345 ss <<
"Printing " << ii->second.size()
346 <<
" connections for DetId: " << ii->first << std::endl;
347 Conns::const_iterator iii = ii->second.begin();
348 Conns::const_iterator jjj = ii->second.end();
349 for ( ; iii != jjj; ++iii ) {
350 if ( iii->isConnected() ) { valid++; }
352 ss << *iii << std::endl;
355 ss <<
"Number of connected: " << valid << std::endl
356 <<
"Number of connections: " << total << std::endl;
360 for(
int connectionType = 0; connectionType < 3; ++connectionType ) {
361 if( connectionType == 0 ) ss <<
"Connected modules:" << std::endl;
362 else if( connectionType == 1 ) ss <<
"Detected modules:" << std::endl;
363 else ss <<
"Undetected modules:" << std::endl;
364 ss <<
"SubDet and layer\t modules" << std::endl;
365 std::map< int16_t, uint32_t >::const_iterator iter =
connectionCount[connectionType].begin();
367 uint32_t subDetLayer = iter->first;
368 uint32_t modules = iter->second;
369 if(
int(subDetLayer/10) == 0 ) {
370 ss <<
"TIB \t layer " << subDetLayer <<
" \t" << modules << std::endl;
372 else if(
int(subDetLayer/100) == 0 ) {
373 int layer = subDetLayer%10;
374 if( layer <= 3 ) ss <<
"TID- \t disk " << layer <<
"\t" << modules << std::endl;
375 else ss <<
"TID+ \t disk " << layer-3 <<
"\t" << modules << std::endl;
377 else if(
int(subDetLayer/1000) == 0 ) {
378 int layer = subDetLayer%100;
379 ss <<
"TOB \t layer " << layer <<
" \t" << modules << std::endl;
382 int layer = subDetLayer%100;
383 if( layer <= 9 ) ss <<
"TEC- \t disk " << layer <<
" \t" << modules << std::endl;
384 else ss <<
"TEC+ \t disk " << layer-9 <<
" \t" << modules << std::endl;
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_
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
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector< FedChannelConnection > > &)
const uint16_t & fedId() const
unsigned int side() const
positive or negative id
unsigned int layerNumber() const
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.
const std::vector< FedChannelConnection > & getConnections(uint32_t det_id) const
bool IsUndetected(const uint32_t &det_id) const
void getAllDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
const std::vector< FedChannelConnection > & undetected() const
Detector identifier class for the strip tracker.
virtual ~SiStripDetCabling()
void printSummary(std::stringstream &ss) const
const std::vector< FedChannelConnection > & detected() const
unsigned int side() const
positive or negative id
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
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
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const
unsigned int wheel() const
wheel id
std::map< uint32_t, std::vector< FedChannelConnection > > fullcabling_