Data Processing Flow - danecross/PyNA62Analysis GitHub Wiki

In trying to understand the data manipulation process, there seems to be a somewhat established flow. This is what I gleaned from reading the templateAnalyzer.cc file. There are 13 official functions, but some of them are merely for pre- and post-processing. So as I see it there are 3 main parts with a few subparts. It follows similar procedure to most data processing so this is good.

Pre-processing and data request

Constructor

This is where you tell the system which pre-defined trees, data, and compiler arguments that you will be using.

RequestTree(...)              # specifies trees and their corresponding event class
RequestTriggerData(...)       # Tell system what data to look for (in input file ?)
AddParam(...)                 # add compilation info
AddPrimitiveReader(...)       # read a primitive file in parallel
SetLnMatchingWindowWidth(...) # where n = 0, 1, 2

InitOutput()

This is where you tell the system which trees and variables you will be defining in the following functions.

RegisterOutput(...)        # create output variables
OpenNewTree(..)            # create new TTree
     AddBranch<...>(..)    # create a branch for your new TTree
CreateStandardTree(...)    # create a standard TTree containing KineParts (for candidates)

InitHist

This is where you tell the system which histograms and counters you plan on creating and which ones you want to access that have already been created

BookHisto(...)                    # initialize a histogram
BookCounter(...)                  # initialize a counter
NewEventFraction(...)             # create a new event fraction
AddCounterToEventFraction(...)    # self explanitory
DefineSampleSizeCounter(...)      # 
GetListOf...(...)                 # examine what is in an input file and what to use
RequestHistogram(...)             # get a histogram that has already been created

DefineMCSimple()

Here you just initialize the particles to add to the MC simulation

fMCSimple.AddParticle(...)

StartOfRunUser, StartOfBurstUser, ProcessSpecialTriggerUser

These are all functions you can use if you have anything else to do before you start processing the data.

Actual Data Processing

This is where the meat occurs, where we pull info that we want and get it ready to plot. There is only one function for this stage.

Process(...)

This function is called for as many events as is required. There are many parts to this method so I will break it down further:

Retrieve and process single particles
fMCSimple["..."][i]                           # returns the ith particle with the ".." name
fParticleInterface->FindParticle("").Mass()   # accesses the properties of the particle being accessed

Retrieve and process events

GetEvent<MyClass>()            # retrieves events from pre-defined trees
(eventClass*)GetEvent(...)     # ^^
GetMCEvent(..)                 # retrieve full MC events
GetEventHeader(..)             # retrieves the event header

Get data from trees and other sources

GetObject<...>(..)               # get data from generic TTrees
GetPrimitiveObject<..>(..)       # ^^
GetLnData()                      # where n = 0, 1, 2

Write and fill histograms

fHisto.Get...(..)     # get the requested histogram
FillHisto(..)         # fill the requested histogram with values

Misc

IncrementCounter('name')                # increment the requested counter
DecrementCounter('name')                # decrement the requested counter
CreateStandardCandidate(..)             # append a candidate in one of your standard output Tree
    FillTrees(..)                       # save this event in your custom and standard TTrees
FilterAccept()                          # replicate this event in the output file
FindAllPrimitiveInMatchingWindow(..)    # get all the primitives in a certain window around the event timestamp
FindMatchingPrimitive(..)               # get the primitive closest the the event timestamp

Post-processing data and making plots

PostProcess, EndOfBurstUser, EndOfRunUser

This is where you put anything that you need to do before the plot-making step

EndOfJobUser

This is where you save plots

SaveAllPlots()
histogram->write() 
GetIterator...()

DrawPlots

This is where the plots are drawn

DrawAllPlots(...)
fHisto.get...("histoname")...
⚠️ **GitHub.com Fallback** ⚠️