| 1428 | return pairs, unPaired, dmVars, cmVars |
| 1429 | |
| 1430 | def _makeNewDetector(instr, pairs, dmVars, cmVars): |
| 1431 | old_detector = instr.detector |
| 1432 | new_detector = False |
| 1433 | if type(old_detector) == list: |
| 1434 | if len(old_detector) == 2: |
| 1435 | if old_detector[0] != None and old_detector[1] != None: |
| 1436 | extLen = len(instr.pairExt[0]) |
| 1437 | base_P = old_detector[0][0:-extLen] |
| 1438 | base_N = old_detector[0][0:-extLen] |
| 1439 | if base_P == base_N: |
| 1440 | baseName = base_P + "_" |
| 1441 | if instr.convType == 'dd' or instr.convType=='cd': |
| 1442 | if baseName + "D" in dmVars: |
| 1443 | instr.detector = baseName + "D" |
| 1444 | print("Detector changed to:", instr.detector) |
| 1445 | new_detector = True |
| 1446 | elif instr.convType == 'cc' or instr.convType=='dc': |
| 1447 | if baseName + "C" in cmVars: |
| 1448 | instr.detector = baseName + "C" |
| 1449 | print("Detector changed to:", instr.detector) |
| 1450 | new_detector = True |
| 1451 | elif old_detector[1] == None: |
| 1452 | # Check if detector was already modified |
| 1453 | if instr.convType == 'dd' or instr.convType=='cd' and old_detector[0] in dmVars: |
| 1454 | new_detector = True |
| 1455 | elif instr.convType == 'dc' or instr.convType=='cc' and old_detector[0] in cmVars: |
| 1456 | new_detector = True |
| 1457 | if not new_detector and instr.convType != "all" and old_detector != None: |
| 1458 | print("Warning: cannot create a new detector for conversion type: %s."%(instr.convType)) |
| 1459 | return instr.detector |
| 1460 | |
| 1461 | def _getSubMatrices(instr, dimDm, dimCm, convType): |
| 1462 | """ |