24 auto feds = fedcabling.
fedIds();
25 for (
auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
27 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
29 bool have_fed_id = iconn->fedId();
30 std::vector<int> vector_of_connected_apvs;
33 int which_apv_pair = iconn->apvPairNumber();
36 if( iconn->detId()==0 ||
43 if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0);
44 if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1);
46 if(vector_of_connected_apvs.size() != 0){
47 std::map<uint32_t, std::vector<int> > map_of_connected_apvs;
48 map_of_connected_apvs.insert(std::make_pair(iconn->detId(),vector_of_connected_apvs));
55 for(std::vector<FedChannelConnection>::const_iterator idtct = detected_fed_connections.begin(); idtct != detected_fed_connections.end(); ++idtct){
57 bool have_fed_id = idtct->fedId();
58 std::vector<int> vector_of_detected_apvs;
60 int which_apv_pair = idtct->apvPairNumber();
61 if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0);
62 if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1);
64 if(vector_of_detected_apvs.size() != 0){
65 std::map<uint32_t,std::vector<int> > map_of_detected_apvs;
66 map_of_detected_apvs.insert(std::make_pair(idtct->detId(),vector_of_detected_apvs));
72 for(std::vector<FedChannelConnection>::const_iterator iudtct = undetected_fed_connections.begin(); iudtct != undetected_fed_connections.end(); ++iudtct){
74 bool have_fed_id = iudtct->fedId();
75 std::vector<int> vector_of_undetected_apvs;
77 int which_apv_pair = iudtct->apvPairNumber();
78 if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0);
79 if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1);
81 if(vector_of_undetected_apvs.size() != 0){
82 std::map<uint32_t, std::vector<int> > map_of_undetected_apvs;
83 map_of_undetected_apvs.insert(std::make_pair(iudtct->detId(),vector_of_undetected_apvs));
91 std::map< uint32_t, std::vector<const FedChannelConnection *> >& conns ){
95 edm::LogInfo(
"") <<
" SiStripDetCabling::addDevices for connection associated to detid " << conn.
detId() <<
" apvPairNumber " << conn.
apvPairNumber() <<
"the fedId is " << conn.
fedId();
116 vector_to_fill_with_detids.push_back(conn_it->first);
124 vector_to_fill_with_detids.push_back(conn_it->first);
127 vector_to_fill_with_detids.push_back(conn_it->first);
130 vector_to_fill_with_detids.push_back(conn_it->first);
137 std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator detcabl_it =
fullcabling_.find(det_id);
139 return ( detcabl_it->second );
141 const static std::vector<const FedChannelConnection *> default_empty_fedchannelconnection;
142 return default_empty_fedchannelconnection;
148 const std::vector<const FedChannelConnection *>& fcconns =
getConnections(det_id);
149 for(std::vector<const FedChannelConnection *>::const_iterator iconn = fcconns.begin(); iconn!=fcconns.end();++iconn){
150 if ( ((*iconn) != 0) && (((*iconn)->apvPairNumber()) == apv_pair) ) {
156 return default_empty_fedchannelconnection;
161 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
162 if(fcconns.size()!=0) {
164 for(
size_t i=0;
i<fcconns.size();++
i)
166 return ( fcconns.at(
i) )->dcuId();
169 unsigned int default_zero_value = 0;
170 return default_zero_value;
175 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
176 if(fcconns.size()!=0) {
178 for(
size_t i=0;
i<fcconns.size();++
i) {
180 return fcconns.at(
i)->nApvPairs();
213 const std::map< uint32_t, std::vector<int> > & specific_connection,
214 std::map< int16_t, uint32_t >* connectionsToFill )
const {
215 for(
std::map< uint32_t, std::vector<int> >::const_iterator conn_it = specific_connection.begin(); conn_it!=specific_connection.end(); ++conn_it){
216 uint32_t new_detid = conn_it->first;
217 std::vector<int> new_apv_vector = conn_it->second;
218 std::map<uint32_t, std::vector<int> >::iterator it = map_to_add_to.find(new_detid);
219 if( it == map_to_add_to.end() ){
220 std::sort(new_apv_vector.begin(),new_apv_vector.end());
221 map_to_add_to.insert(std::make_pair(new_detid,new_apv_vector));
232 if( connectionsToFill ) {
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());
260 const int subdet = detectorId.
subdetId();
277 uint16_t subDetLayer = layer;
279 if( subDet ==
"TID-" ) subDetLayer += 10;
280 else if( subDet ==
"TID+" ) subDetLayer += 10 + 3;
281 else if( subDet ==
"TOB" ) subDetLayer += 100;
282 else if( subDet ==
"TEC-" ) subDetLayer += 1000;
283 else if( subDet ==
"TEC+" ) subDetLayer += 1000 + 9;
284 else if( subDet !=
"TIB" ) {
285 LogDebug(
"SiStripDetCabling") <<
"Error: Wrong subDet. Please use one of TIB, TID, TOB, TEC." << std::endl;
290 return found->second;
297 allToContiguous.clear();
299 unsigned int contiguousIndex = 0;
300 for(std::vector<uint32_t>::const_iterator idet = all.begin(); idet!= all.end(); ++idet){
302 allToContiguous.insert(std::make_pair(*idet,contiguousIndex));
308 connectedToContiguous.clear();
311 for(std::vector<uint32_t>::const_iterator idet = connected.begin(); idet!= connected.end(); ++idet){
312 std::map<uint32_t, unsigned int>::iterator deco = allToContiguous.find(*idet);
313 if(deco!=allToContiguous.end()){
314 connectedToContiguous.insert(*deco);
330 std::map< uint32_t, std::vector<int> >::const_iterator it=
map.find(det_id);
331 return (it!=
map.end());
339 typedef std::vector<const FedChannelConnection *> Conns;
340 typedef std::map<uint32_t,Conns> ConnsMap;
343 ss <<
"[SiStripDetCabling::" << __func__ <<
"]" 345 <<
" modules " << std::endl;
346 for ( ; ii !=
jj; ++
ii ) {
347 ss <<
"Printing " << ii->second.size()
348 <<
" connections for DetId: " << ii->first << std::endl;
349 Conns::const_iterator iii = ii->second.begin();
350 Conns::const_iterator jjj = ii->second.end();
351 for ( ; iii != jjj; ++iii ) {
352 if ( (*iii)->isConnected() ) { valid++; }
354 ss << **iii << std::endl;
357 ss <<
"Number of connected: " << valid << std::endl
358 <<
"Number of connections: " << total << std::endl;
362 for(
int connectionType = 0; connectionType < 3; ++connectionType ) {
363 if( connectionType == 0 ) ss <<
"Connected modules:" << std::endl;
364 else if( connectionType == 1 ) ss <<
"Detected modules:" << std::endl;
365 else ss <<
"Undetected modules:" << std::endl;
366 ss <<
"SubDet and layer\t modules" << std::endl;
367 std::map< int16_t, uint32_t >::const_iterator iter =
connectionCount[connectionType].begin();
369 uint32_t subDetLayer = iter->first;
370 uint32_t
modules = iter->second;
371 if(
int(subDetLayer/10) == 0 ) {
372 ss <<
"TIB \t layer " << subDetLayer <<
" \t" << modules << std::endl;
374 else if(
int(subDetLayer/100) == 0 ) {
375 int layer = subDetLayer%10;
376 if( layer <= 3 ) ss <<
"TID- \t disk " << layer <<
"\t" << modules << std::endl;
377 else ss <<
"TID+ \t disk " << layer-3 <<
"\t" << modules << std::endl;
379 else if(
int(subDetLayer/1000) == 0 ) {
380 int layer = subDetLayer%100;
381 ss <<
"TOB \t layer " << layer <<
" \t" << modules << std::endl;
384 int layer = subDetLayer%100;
385 if( layer <= 9 ) ss <<
"TEC- \t disk " << layer <<
" \t" << modules << std::endl;
386 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
std::map< uint32_t, std::vector< int > > connected_
CaloTopology const * topology(0)
const unsigned int getDcuId(uint32_t det_id) const
static const uint32_t invalid32_
ConnsConstIterRange undetectedDevices() const
uint16_t apvPairNumber() const
unsigned int side(const DetId &id) 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
int16_t layerSearch(const uint32_t detId) const
const uint16_t & fedId() const
const SiStripFedCabling * fedCabling_
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
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_
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
FedsConstIterRange fedIds() const
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
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual ~SiStripDetCabling()
void printSummary(std::stringstream &ss) const
static const uint16_t invalid_
std::map< int16_t, uint32_t > connectionCount[3]
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
unsigned int layer(const DetId &id) const
const uint16_t nApvPairs(uint32_t det_id) const
void getActiveDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
const TrackerTopology *const tTopo
std::map< uint32_t, std::vector< int > > const & connected() 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
SiStripDetCabling(const TrackerTopology *const topology)
void addConnected(std::map< uint32_t, std::vector< int > > &) const