NTagIO

class NTagIO : public NTagEventInfo

Subclassed by NTagROOT, NTagZBS

Public Functions

NTagIO(const char *inFileName, const char *outFileName, Verbosity verbose)

Constructor of NTagIO class.

Basic I/O settings and trees are set up in this constructor.

Parameters
  • inFileName – Input file name.

  • outFileName – Ouptut file name.

  • verbose – #Verbosity.

~NTagIO()

Destructor of NTagIO. Ends BONSAI.

virtual void Initialize()

Initialize SK data options and opens the input file.

inline virtual void OpenFile()

Opens SK data file.

This function must be implemented in a daughter class.

inline virtual void CloseFile()

Closes SK data file.

This function must be implemented in a daughter class.

inline virtual void SetFitInfo()

Saves prompt vertex fit information.

This function must be implemented in a daughter class. If you’re using APFit or BONSAI, just specify either NTagEventInfo::SetAPFitInfo or NTagEventInfo::SetLowFitInfo.

virtual void SKInitialize()

Sets SK options and geometry. Initializes Zebra and BONSAI.

virtual void ReadFile()

Starts reading input file and looping over events.

The steering code here is skread. skread is called and all data variables copied to the SK fortran common blocks are read by the member functions of NTagEventInfo if the read status of the event is normal. For MC, events with prompt vertices within PMTs are skipped.

virtual void ReadEvent()

Calls NTagIO::ReadFlatEvent for MC and NTagIO::ReadDataEvent for data events.

virtual void SetEventInfo()

Set event information.

See the source code for details.

virtual void SearchAndFill()

Search for neutrons and fill the results.

See the source code for details.

virtual void ReadFlatEvent()

Instructions to each loop for an MC event.

See the source code for details.

virtual void ReadDataEvent()

Instructions to each loop for a data event.

The trigger information is read from the common variable skhead_.idtgsk and corresponding event instructions are called.

virtual void ReadSHEEvent()

Instructions for SHE-triggered events.

Saves the prompt vertex information and the raw hit TQ vectors vTISKZ, vQISKZ, and vCABIZ of NTagEventInfo. Does not fill ntvarTree. ntvarTree is filled at NTagIO::ReadAFTEvent if the next event is AFT, otherwise it’s filled at NTagIO::ReadFlatEvent.

virtual void ReadNonSHEEvent()

Instructions for data events other than SHE.

Saves the prompt vertex information and the raw hit TQ vectors vTISKZ, vQISKZ, and vCABIZ of NTagEventInfo. Also, neutron capture candidates are searched for and the member variables are filled to the tree ntvarTree.

virtual void ReadAFTEvent()

Instructions for AFT-triggered events.

Appends raw TQ information from the common sktqz to the raw TQ hit vectors vTISKZ, vQISKZ, and vCABIZ of NTagEventInfo. Neutron capture candidates are searched for and the member variables are filled to the tree ntvarTree.

virtual void WriteOutput()

Creates output file and write trees. truthTree is written only if the input file is MC.

virtual void DoWhenInterrupted()

Instructions for SIGINT signal, i.e., Ctrl+c. NTagIO::WriteOutput is called.

virtual void CreateBranchesToTruthTree()

Creates branches to truthTree with certain member variables from MC. See the source code for the branch names and filled variables.

virtual void CreateBranchesToNtvarTree()

Creates branches to truthTree with member variables. See the source code for the branch names and filled variables.

virtual void AddCandidateVariablesToNtvarTree()

Creates additional branches out of feature variables declared in NTagCandidate::SetVariables to ntvarTree.

virtual void CreateBranchesToRawTQTree()

Create branches to rawtqTree with raw TQ hit vectors vTISKZ, vQISKZ, and vCABIZ.

virtual void CreateBranchesToResTQTree()

Create branches to restqTree with residual TQ hit vectors #vSortedT, #vSortedT, and vSortedPMTID.

virtual void FillTrees()

Fills trees.

void SetSignalTQ(const char *fSigTQName)

Set source file #fSigTQFile and tree #fSigTQTree to extract signal TQ hits for vISIGZ in NTagEventInfo::AppendRawHitInfo.

virtual void CheckMC()

Check if the event being processed is MC or data with the run number.

virtual void AddSKOption(TString optn)

Add SK option. Refer to $SKOFL_ROOT/src/skrd/skoptn.F for available SK options.

virtual void RemoveSKOption(TString optn)

Remove SK option. Refer to $SKOFL_ROOT/src/skrd/skoptn.F for available SK options.

virtual void SetSKOption(TString optn)

Set SK option. Refer to $SKOFL_ROOT/src/skrd/skoptn.F for available SK options.

virtual void SetSKBadChOption(int badopt)

Set SK Bad-Ch option. Refer to $SKOFL_ROOT/src/skrd/skbadopt.F for available bad-ch options.

Protected Attributes

TTree *truthTree

A tree of member variables. (created for MC inputs only)

TTree *ntvarTree

A tree of member variables.

TTree *rawtqTree

A tree of Raw TQ hit vectors. (vTISKZ, vQISKZ, and vCABIZ)

TTree *restqTree

A tree of Residual TQ hit vectors. (#vSortedT, vSortedQ, and vSortedPMTID)