Running GRSISort - r3dunlop/GRSISort GitHub Wiki

HOME > RUNNING GRSISORT

#The Sorting Model The steps involved in using GRSISort are:

We are running a multistage sorting model with GRSISort. This has one main advantage: It allows us to sort the very large MIDAS files non-locally and then download the heavily compressed fragment tree data.

  1. Unpacking the Midas File
  2. Analyzing the Fragment Tree
  3. Histogramming the Final Results

By default GRSIsort will open up a root session in the GRSI environment. #Unpacking the MIDAS File The strategy used by GRSISort is to unpack the MIDAS file and convert the information into a ROOT Tree format. This tree contains TFragments and is essentially all of the information from the MIDAS File with higher compression and accessibility.

grsisort NAME_OF_MIDAS_FILE.mid -> Converts the midas file into a fragment tree

Currently accepted flags for the midas sort:

  • --suppress_error, suppresses errors from failed data parsing appearing in stdout
  • --log_errors, sends errors from failed data parsing to file, will not send errors if supress error option is also used!
  • --no_waveforms, does not add the wave form stored for each event in the mid file to the fragment tree
  • -q, quits the grsi environment after completing the midas sort
  • --work_harder, inputting a <macro>.C file, runs that macro on the sorted file

If multiple .mid files are included at the time of sort, this can even include the wildcard character *, grsisort will sequentially sort all of these MIDAS files and write them to their own fragment trees.

#Sorting the Fragment Tree **grsisort [-a -s] NAME_OF_FRAGMENT_TREE.root** -> Starts sorting the fragment tree into (-s) user defined hists and/or (-a) analysis trees. * Histograms are defined in **users/UserInitObj.h** * How to fill the histogram is defined in **users/UserFillObj.h**

If -a or -s are left off of the command, the fragment tree will be loaded into the grsi environment for the user to enjoy.

Currently accepted flags for the fragment tree sort:

  • -a, creates an analysis tree to be used for doing a full analysis of the data
  • -s, sorts the fragment tree into user defined hists.
  • -q, quits the grsi environment after completeing the fragment sort
  • --no_speed, suppresses the output from the PROOF speedometer
  • --work_harder, inputting a <macro>.C file, runs that macro on the sorted file

If multiple fragment trees are included at the time of the sort, or are created from multiple MIDAS files during the autosort, they will be sorted sequentially. However, it should be noted that although different fragment trees will be sorted into different analysis trees, if a -s sort is called, all of the fragment trees will be histogrammed into a single hists.root. If you would like to output multiple hists.root files, please run an external script to call grsisort multiple times.

##Calibrating the gamma spectra When sorting the fragment tree, you can read in a calibration file at the same time and it will perform the calibrations while sorting. This can be done with the command:

grsisort -flags <midasfile>.mid <calibrationfile>.cal

A sample calibration file can be found in the users directory and is called NewGrifCal.cal

##Displaying parameters of fragment tree You can list the parameters included in the fragment tree with:

FragmentTree->Print()

Alternatively, you view them in a graphical interface with:

FragmentTree->StartViewer()

##Viewing histograms within grsisort After sorting the data and creating a fragment tree, you can create histograms by running the command:

FragmentTree->Draw("<variable> >> <histogramName>(<xbins>,<xmin>,<xmax>)", "<cuts>", "<displayOptions>")

Here is an example that displays a 1D histogram of calibrated energy of all detectors:

FragmentTree->Draw("GetEnergy() >> h(16000,0,16000)", "", "")

Another example, of a 2D histogram that displays calibrated energy vs. detector number ignoring channel 12, is:

FragmentTree->Draw("ChannelNumber:GetEnergy() >> h(16000,0,16000,64,0,64)", "ChannelNumber!=12", "LEGO")

####The Autosort Feature If the -a flag is used on the MIDAS file, GRSISort will sort the MIDAS file and then complete a fragment sort by applying the flags and sorting the fragment tree, making an analysis tree file.

⚠️ **GitHub.com Fallback** ⚠️