ATLAS Offline Software
Functions | Variables
python.replaceMUCTPI Namespace Reference

Functions

def modify (event)
 
def ReplaceMUCTPI (input_file, output_file)
 

Variables

 input_file
 
 output_file
 

Function Documentation

◆ modify()

def python.replaceMUCTPI.modify (   event)
Fills in the MUCTPi ROB).

Definition at line 19 of file replaceMUCTPI.py.

19 def modify(event):
20  """Fills in the MUCTPi ROB)."""
21 
22  map=[[eformat.helper.SubDetector.TDAQ_MUON_CTP_INTERFACE,0,1]]
23 
24  DaqRobs=[None]*len(map)
25 
26  for rob in event:
27  cnt=0
28  for match in map:
29  if rob.source_id()==eformat.helper.SourceIdentifier(match[0],match[1]):
30  DaqRobs[cnt]=rob
31  cnt+=1
32 
33 
34  #work around corrupted events:
35  #new_event=eformat.write.FullEventFragment(event)
36  new_event=eformat.write.FullEventFragment()
37  new_event.copy_header(event)
38  for rob in event:
39  keep=True
40  for match in map:
41  if rob.source_id()==eformat.helper.SourceIdentifier(match[0],match[2]):
42  keep=False
43  break
44  if keep:
45  new_event.append_unchecked(rob)
46  for idx in range(len(map)):
47  if DaqRobs[idx]:
48  rob=eformat.write.ROBFragment(DaqRobs[idx])
49  rob.source_id(eformat.helper.SourceIdentifier(map[idx][0],map[idx][2]))
50  if map[idx][0]==eformat.helper.SubDetector.TDAQ_CTP:
51  version=rob.rod_minor_version()&0x1f
52  if version:
53  ctpSkip=(rob.rod_minor_version()>>8)&0x3f
54  else:
55  ctpSkip=(rob.rod_detev_type()>>16)&0x3f
56  data=[DaqRobs[idx].rod_data()[0],DaqRobs[idx].rod_data()[1]]
57  for ii in range(30):
58  data+=[DaqRobs[idx].rod_data()[2+ctpSkip*30+ii]]
59  rob.rod_data(data)
60  if map[idx][0]==eformat.helper.SubDetector.TDAQ_MUON_CTP_INTERFACE:
61  data=[]
62  if len(DaqRobs[idx].rod_data()):
63  muctpBC=(DaqRobs[idx].rod_data()[0]>>18)&7
64  for word in DaqRobs[idx].rod_data()[1:]:
65  if (word>>14)&7==muctpBC and (word>>26)&1:
66  data+=[(word&0x3fff)|(((word>>17)&0x1ff)<<14)]
67  if len(data)==0:
68  rob=eformat.write.ROBFragment()
69  rob.copy_header(DaqRobs[idx])
70  rob.source_id(eformat.helper.SourceIdentifier(map[idx][0],map[idx][2]))
71  else:
72  rob.rod_data(data)
73  new_event.append(rob)
74  else:
75  rob=eformat.write.ROBFragment()
76  rob.source_id(eformat.helper.SourceIdentifier(map[idx][0],map[idx][2]))
77  new_event.append(rob)
78  return new_event.readonly()
79 
80 

◆ ReplaceMUCTPI()

def python.replaceMUCTPI.ReplaceMUCTPI (   input_file,
  output_file 
)

Definition at line 81 of file replaceMUCTPI.py.

81 def ReplaceMUCTPI(input_file,output_file):
82  input = eformat.istream([input_file])
83  dr=EventStorage.pickDataReader(input_file)
84  output = eformat.ostream(core_name="subset",
85  run_number=dr.runNumber(),
86  trigger_type=dr.triggerType(),
87  detector_mask=dr.detectorMask(),
88  beam_type=dr.beamType(),
89  beam_energy=dr.beamEnergy())
90  for event in input:
91  output.write(modify(event))
92  tmp_file_name = output.last_filename()
93  del output
94  os.rename(tmp_file_name,output_file)
95 
96 
97 

Variable Documentation

◆ input_file

python.replaceMUCTPI.input_file

Definition at line 102 of file replaceMUCTPI.py.

◆ output_file

python.replaceMUCTPI.output_file

Definition at line 103 of file replaceMUCTPI.py.

python.replaceMUCTPI.ReplaceMUCTPI
def ReplaceMUCTPI(input_file, output_file)
Definition: replaceMUCTPI.py:81
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.replaceMUCTPI.modify
def modify(event)
Definition: replaceMUCTPI.py:19