I have a python script (decoder) that gives out readable data in json format. I am trying to have that data in ROOT file format. I changed the filename.json to filename.root, but it did not work. Please help out on how to get the data in ROOT format. Thank you.
Since I already have a json file, if there is a way to convert that into ROOT format then that will work as well.
# top directory of the specific run Rawdata_XX_XX_2020. YOU NEED TO MODIFY IT ACCORDINGLY
runFolder = 'run02tri'
#dirToData = "/home/user1/WORK/pcb_readout/3view30degree/data/"+runFolder+"/"
dirToData = "/home/user/Desktop/CERN/Rawdata_05_11_2022/"+runFolder+"/"
# number of events to be analyzed from each bin file .Nowadays we save 100 event in each file. If this is not true, we may have a problem here
numberOfEventsInFile = 25
# bias voltage on the collection plane, in volts
collectionBias = 900
# cathode HV, in volts
cathodeHV = 27200
# directory and name of the file that the info will be saved. saving in a json format for now.. I assume we have a folder with name "jsonData"
#dataOutputFile = '/home/user1/WORK/pcb_readout/3view30degree/jsonData/'+runFolder+'.json'
dataOutputFile = '/home/user/Desktop/CERN/data.root'
#### THIS FUNCTION DOES THE BINARY DATA TO JSON CONVERSION AND SAVING ####
saveBinToJSON(dirToData,numberOfEventsInFile,collectionBias,cathodeHV,dataOutputFile)
#### Then the analysis of the results. First load the output file
#f = open('/home/user1/WORK/pcb_readout/analysis/jsonData/single_data.json')
f = open(dataOutputFile)
data = json.load(f)
f.close()