ATLAS Offline Software
aux_functions.py
Go to the documentation of this file.
1 
2 def checkPMTValid(ros, pmt):
3 
4  ros += 1
5  pmt += 1
6 
7  chan2pmt = []
8  if ros==3 or ros==4:
9  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
10  13, 14, 15, 16, 17, 18,-19,-20, 21, 22, 23, 24, \
11  -27,-26,-25,-31,-32,-28, 33, 29, 30,-36,-35, 34, \
12  44, 38, 37, 43, 42, 41,-45,-39,-40,-48,-47,-46]
13  elif ros==1 or ros==2:
14  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
15  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, \
16  27, 26, 25, 30, 29, 28,-33,-32, 31, 36, 35, 34, \
17  39, 38, 37, 42, 41, 40, 45,-44, 43, 48, 47, 46]
18 
19  if pmt in chan2pmt:
20  return 'real'
21  elif -1*pmt in chan2pmt:
22  return 'noninst'
23  else:
24  print ros, pmt
25  print "There is a problem with the indexing."
26  return -1
27 
28 
29 def checkChannelValid(ros, mod, chan):
30  ros += 1
31 
32  # ROS Format:
33  chan2pmt = []
34  if ros==3 or ros==4:
35  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
36  13, 14, 15, 16, 17, 18,-19,-20, 21, 22, 23, 24, \
37  -27,-26,-25,-31,-32,-28, 33, 29, 30,-36,-35, 34, \
38  44, 38, 37, 43, 42, 41,-45,-39,-40,-48,-47,-46]
39  elif ros==1 or ros==2:
40  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
41  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, \
42  27, 26, 25, 30, 29, 28,-33,-32, 31, 36, 35, 34, \
43  39, 38, 37, 42, 41, 40, 45,-44, 43, 48, 47, 46]
44 
45  if(ros < 0 or ros >= 5):
46  return 'noninst'
47  if(mod < 0 or mod >= 4):
48  return 'noninst'
49  if(chan < 0 or chan >= 48):
50  return 'noninst'
51 
52  if len(chan2pmt) > chan and chan2pmt[chan] < 0:
53  return 'noninst'
54 
55  return 'real'
56 
57 
58 
59 def ChanneltoPMT(ros, channel):
60  chan2pmt = []
61  if ros==3 or ros==4:
62  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
63  13, 14, 15, 16, 17, 18,-19,-20, 21, 22, 23, 24, \
64  -27,-26,-25,-31,-32,-28, 33, 29, 30,-36,-35, 34, \
65  44, 38, 37, 43, 42, 41,-45,-39,-40,-48,-47,-46]
66  elif ros==1 or ros==2:
67  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
68  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, \
69  27, 26, 25, 30, 29, 28,-33,-32, 31, 36, 35, 34, \
70  39, 38, 37, 42, 41, 40, 45,-44, 43, 48, 47, 46]
71 
72  return chan2pmt[channel]
73 
74 
75 def PMTtoChannel(ros, pmt):
76 
77  ros += 1
78  pmt += 1
79 
80  chan2pmt = []
81  if ros==3 or ros==4:
82  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
83  13, 14, 15, 16, 17, 18,-19,-20, 21, 22, 23, 24, \
84  -27,-26,-25,-31,-32,-28, 33, 29, 30,-36,-35, 34, \
85  44, 38, 37, 43, 42, 41,-45,-39,-40,-48,-47,-46]
86  elif ros==1 or ros==2:
87  chan2pmt=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
88  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, \
89  27, 26, 25, 30, 29, 28,-33,-32, 31, 36, 35, 34, \
90  39, 38, 37, 42, 41, 40, 45,-44, 43, 48, 47, 46]
91 
92  if pmt in chan2pmt:
93  return chan2pmt.index(pmt)
94  elif -1*pmt in chan2pmt:
95  return chan2pmt.index(-1*pmt)
96  else:
97  print ros, pmt
98  print "There is a problem with the indexing."
99  return -1
100 
aux_functions.ChanneltoPMT
def ChanneltoPMT(ros, channel)
Definition: aux_functions.py:59
aux_functions.checkChannelValid
def checkChannelValid(ros, mod, chan)
Definition: aux_functions.py:29
aux_functions.checkPMTValid
def checkPMTValid(ros, pmt)
Definition: aux_functions.py:2
aux_functions.PMTtoChannel
def PMTtoChannel(ros, pmt)
Definition: aux_functions.py:75
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569