I am currently simulating events using code written by a colleague that outputs a .root file. As part of my analysis I am reading the in TTree, and using a custom python function that outputs multiple numpy arrays. I have been able to convert these outputs back into a separate root DataFrame.
My question is: Is it possible to combine these data frames that have a shared identical column so that I have one data frame that contains the data from both? If this is not possible, and alternative would be writing my columns in as branches to his tree in the root file. I am extremely new to root so please don't be too harsh.
The ultimate goal is to get mine and his data into a shared .root file. The column EventNumber are shared between the data frames, and is unique to each event. While Asic is also shared, it is not unique. Neither of these necessarily need to be added as everything should be in the correct order. Any Help is appreciated.
df = r.RDataFrame('tree',"~/FirstOutput.root")
board = np.zeros(tree.GetEntries(),dtype='int')
column = np.zeros(tree.GetEntries(),dtype='int')
ASIC_Column = []
EventNumn = []
for event in range(tree.GetEntries()):
tree.GetEntry(event)
asic= tree.asic[0]
event_Numn = tree.eventNumber
ASIC_Column.append(asic)
EventNumn.append(event_Numn)
board[event] = get_board(asic)
column[event] = is_even(asic)
# Board and Column are both Numpy arrays generated from the Asic Column of his DataFrame.
#Get_Board and is_even identify the location of each event on the detetector
d = pd.DataFrame()
d['board'] = board
d['column'] = column
d['asic'] = ASIC_Column
d['eventNumber'] = EventNumn
data = {key: d[key].values for key in ['eventNumber', 'asic', 'board','column']}
rdf = r.RDF.FromNumpy(data)