27 auto feds = fedcabling.
fedIds();
28 for (
auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
30 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
32 bool have_fed_id = iconn->fedId();
33 std::vector<int> vector_of_connected_apvs;
36 int which_apv_pair = iconn->apvPairNumber();
39 if( iconn->detId()==0 ||
46 if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0);
47 if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1);
49 if(vector_of_connected_apvs.size() != 0){
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));
58 for(std::vector<FedChannelConnection>::const_iterator idtct = detected_fed_connections.begin(); idtct != detected_fed_connections.end(); idtct++){
60 bool have_fed_id = idtct->fedId();
61 std::vector<int> vector_of_detected_apvs;
63 int which_apv_pair = idtct->apvPairNumber();
64 if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0);
65 if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1);
67 if(vector_of_detected_apvs.size() != 0){
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));
75 for(std::vector<FedChannelConnection>::const_iterator iudtct = undetected_fed_connections.begin(); iudtct != undetected_fed_connections.end(); iudtct++){
77 bool have_fed_id = iudtct->fedId();
78 std::vector<int> vector_of_undetected_apvs;
80 int which_apv_pair = iudtct->apvPairNumber();
81 if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0);
82 if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1);
84 if(vector_of_undetected_apvs.size() != 0){
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));
94 std::map< uint32_t, std::vector<const FedChannelConnection *> >& conns ){
98 edm::LogInfo(
"") <<
" SiStripDetCabling::addDevices for connection associated to detid " << conn.
detId() <<
" apvPairNumber " << conn.
apvPairNumber() <<
"the fedId is " << conn.
fedId();
119 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);
133 vector_to_fill_with_detids.push_back(conn_it->first);
140 std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator detcabl_it =
fullcabling_.find(det_id);
142 return ( detcabl_it->second );
144 const static std::vector<const FedChannelConnection *> default_empty_fedchannelconnection;
145 return default_empty_fedchannelconnection;
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) ) {
159 return default_empty_fedchannelconnection;
164 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
165 if(fcconns.size()!=0) {
167 for(
size_t i=0;
i<fcconns.size();++
i)
169 return ( fcconns.at(
i) )->dcuId();
172 unsigned int default_zero_value = 0;
173 return default_zero_value;
178 const std::vector<const FedChannelConnection *>& fcconns =
getConnections( det_id );
179 if(fcconns.size()!=0) {
181 for(
size_t i=0;
i<fcconns.size();++
i) {
183 return fcconns.at(
i)->nApvPairs();
216 const std::map< uint32_t, std::vector<int> > & specific_connection,
217 const int connectionType )
const {
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() ){
223 std::sort(new_apv_vector.begin(),new_apv_vector.end());
224 map_to_add_to.insert(std::make_pair(new_detid,new_apv_vector));
235 if( connectionType != -1 ) {
239 std::vector<int> existing_apv_vector = it->second;
240 for(std::vector<int>::iterator inew = new_apv_vector.begin(); inew != new_apv_vector.end(); inew++ ){
241 bool there_already =
false;
242 for(std::vector<int>::iterator iold = existing_apv_vector.begin(); iold != existing_apv_vector.end(); iold++){
244 there_already =
true;
248 if( ! there_already ){
249 existing_apv_vector.push_back(*inew);
250 std::sort(existing_apv_vector.begin(),existing_apv_vector.end());
281 uint16_t subDetLayer = layer;
283 if( subDet ==
"TID-" ) subDetLayer += 10;
284 else if( subDet ==
"TID+" ) subDetLayer += 10 + 3;
285 else if( subDet ==
"TOB" ) subDetLayer += 100;
286 else if( subDet ==
"TEC-" ) subDetLayer += 1000;
287 else if( subDet ==
"TEC+" ) subDetLayer += 1000 + 9;
288 else if( subDet !=
"TIB" ) {
289 LogDebug(
"SiStripDetCabling") <<
"Error: Wrong subDet. Please use one of TIB, TID, TOB, TEC." << std::endl;
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_
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...
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
Detector identifier class for the strip tracker.
virtual ~SiStripDetCabling()
void printSummary(std::stringstream &ss) 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
ConnsConstIterRange fedConnections(uint16_t fed_id) const
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
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
DecomposeProduct< arg, typename Div::arg > D
void addConnected(std::map< uint32_t, std::vector< int > > &) const
unsigned int wheel() const
wheel id