177 : superlayer_id(superlayer), layer_id(
layer), cell_id(cell) {}
228 std::map<DTROBCardId, int, DTROBCardCompare> tdc_idm;
229 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare> ros_map;
230 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare> rob_map;
237 int max_line_length = 1000;
238 char* job_line =
new char[max_line_length];
239 while (jobDesc.getline(job_line, max_line_length)) {
241 char* ptr_line = job_line;
242 char* end_line = job_line + max_line_length;
243 while (ptr_line < end_line) {
246 while (*ptr_line ==
' ')
249 int off_blank =
key.find(
' ');
250 int off_equal =
key.find(
'=');
252 off_equal = max_line_length;
254 off_blank =
key.length();
255 int ioff = (off_blank < off_equal ? off_blank : off_equal);
256 key.erase(ioff++,
key.length());
258 ptr_line += ++off_equal;
260 if ((jobEnd = (
key ==
"end")))
263 while (*ptr_line ==
' ')
266 int off_value =
val.find(
' ');
267 if ((off_value > 0) && (off_value < static_cast<int>(
val.length())))
268 val.erase(off_value++,
val.length());
270 ptr_line += off_value;
283 std::ifstream lfile(map_list.c_str());
287 if (map_type ==
"TDC") {
299 if (map_type ==
"ROS") {
322 std::map<DTROBCardId, int, DTROBCardCompare>& tdc_idm,
327 std::ifstream
ifile(map_file.c_str());
335 tdc_idm.insert(std::pair<DTROBCardId, int>(
key, map_count));
344 while (
ifile >> tdc >> channel >> superlayer >>
layer >> wire) {
352 << superlayer <<
" " <<
layer <<
" " << wire << std::endl;
363 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ddu_map,
364 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ros_map,
369 ddu_map.insert(std::pair<DTROSChannelId, DTROBCardId>(rosBoard, sectorId));
372 std::ifstream
ifile(map_file.c_str());
393 ros_map.insert(std::pair<DTROSChannelId, DTROBCardId>(rosChannel, robCard));
401 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ros_a,
406 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iter = ros_m.begin();
407 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iend = ros_m.end();
408 while (ros_iter != ros_iend) {
409 const std::pair<DTROSChannelId, DTROBCardId>& rosLink = *ros_iter++;
412 if (rosChannelId.
dduId() != ddu_o)
414 if (rosChannelId.
rosId() != ros_o)
417 ros_a.insert(std::pair<DTROSChannelId, DTROBCardId>(rosChanNewId, robCardId));
423 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ros_a) {
424 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iter = ros_a.begin();
425 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iend = ros_a.end();
426 while (ros_iter != ros_iend)
427 ros_m.insert(*ros_iter++);
432 std::map<DTROBCardId, int, DTROBCardCompare>& tdc_idm,
433 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ddu_map,
434 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>& ros_map) {
440 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ddu_iter = ddu_map.begin();
441 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ddu_iend = ddu_map.end();
443 std::map<DTROBCardId, int, DTROBCardCompare>::const_iterator idt_iend = tdc_idm.end();
445 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iter = ros_map.begin();
446 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::const_iterator ros_iend = ros_map.end();
449 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare> ros_app;
452 while (ros_iter != ros_iend) {
454 const std::pair<DTROSChannelId, DTROBCardId>& rosLink = *ros_iter++;
458 ddu_iter = ddu_map.find(rosChanMapId);
462 if (ddu_iter != ddu_iend) {
465 secdef =
sector.sectorId();
466 rosMapCk =
sector.robId();
468 std::cout <<
"DDU map " << rosChannelId.
dduId() <<
" " << rosChannelId.
rosId() <<
" 0 not found" << std::endl;
471 int wheel = robCMapId.wheelId();
472 int sector = robCMapId.sectorId();
473 int station = robCMapId.stationId();
474 int rob = robCMapId.robId();
480 std::map<DTROBCardId, int, DTROBCardCompare>::const_iterator idt_iter = tdc_idm.find(robCardId);
481 if (idt_iter != idt_iend) {
482 int tdcMapId = idt_iter->second;
483 ddu_iter = ddu_map.begin();
484 while (ddu_iter != ddu_iend) {
485 const std::pair<DTROSChannelId, DTROBCardId>& dduLink = *ddu_iter++;
488 int whe_chk = sec_id.
wheelId();
494 if (rosMapCk != sec_id.
robId())
497 idt_iter = tdc_idm.find(robCardId);
498 int tdcMapCk = idt_iter->second;
499 if ((tdcMapId != tdcMapCk) && (!
check)) {
504 if ((tdcMapId == tdcMapCk) &&
check) {
505 std::map<DTROSChannelId, DTROBCardId, DTROSChannelCompare>::iterator ddu_inew = ddu_map.find(ros_id);
527 ddu_iter = ddu_map.begin();
528 while (ddu_iter != ddu_iend) {
529 const std::pair<DTROSChannelId, DTROBCardId>& dduLink = *ddu_iter++;
536 <<
" " << sec_id.
robId() << std::endl;
static int defaultIdValue
static int TDCMapIdOffset
bool operator()(const DTROBCardId &idl, const DTROBCardId &idr) const
static int ROSMapIdOffset
DTTDCChannelId(int tdc, int channel)
static void buildSteering(std::istream &jobDesc)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
bool operator()(const DTROSChannelId &idl, const DTROSChannelId &idr) const
DTPhysicalWireId(int superlayer, int layer, int cell)
static void appendROS(std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_m, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_a)
static void fillROSMap(const std::string &map_file, int ddu, int ros, int whdef, int secdef, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ddu_map, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_map, int map_count, bool &write)
bool operator()(const DTTDCChannelId &idl, const DTTDCChannelId &idr) const
static void cloneROS(std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_m, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_a, int ddu_o, int ros_o, int ddu_f, int ros_f)
DTROSChannelId(int ddu, int ros, int channel)
static void fillReadOutMap(int ros_count, std::map< DTROBCardId, int, DTROBCardCompare > &tdc_idm, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ddu_map, std::map< DTROSChannelId, DTROBCardId, DTROSChannelCompare > &ros_map)
static void fillTDCMap(const std::string &map_file, int wheel, int sector, std::map< DTROBCardId, int, DTROBCardCompare > &tdc_idm, int stationId, int map_count, bool &write)
static int ROBMapIdOffset
bool operator()(const DTPhysicalWireId &idl, const DTPhysicalWireId &idr) const
DTROBCardId(int wheel, int sector, int station, int rob)