Skip to content

Instantly share code, notes, and snippets.

@gadamc
Last active December 16, 2015 02:50
Show Gist options
  • Save gadamc/5365792 to your computer and use it in GitHub Desktop.
Save gadamc/5365792 to your computer and use it in GitHub Desktop.
//paste this into a ROOT macro, or the interpreter directly
gSystem.Load("libkds")
KHLAEvent *ehla = KEventFactory::NewHLAEvent()
KAmpEvent *eamp = KEventFactory::NewAmpEvent()
eamp->SetEventTriggerStamp(100)
eamp->AddBolo()
// (class KAmpBolometerRecord*)0x7fbbeacd1ee0
ehla->GetNumBolos()
// (const Int_t)0
ehla->GetEventTriggerStamp()
// (const Long64_t)(-99)
eamp->GetNumBolos()
// (const Int_t)1
eamp->GetEventTriggerStamp()
// (const Long64_t)100
//The assignment operator in C++ figures out these are different types, but inherit from the same base class
//so only the base class members are assigned
*ehla = *eamp
ehla->GetNumBolos()
// (const Int_t)0
ehla->GetEventTriggerStamp()
// (const Long64_t)100
//in ROOT, you can use the Dump method to inspect an object's content
eamp.Dump()
//==> Dumping object at: 0x00007fbbeacf6c50, name=KAmpEvent, class=KAmpEvent
//
//fMuonSystem ->7fbbeacf6c70 Muon Veto System Record
//fMuonSystem.fRunNumber -99 run number of the Muon Veto system
//fMuonSystem.fMultiADC -99 the number of PMTs in the MuVeto system with an ADC value
//fMuonSystem.fDistanceEst -99 laser distance from the East wall to the MuVeto System
//fMuonSystem.fDistanceNemo -99 laser distance from the Nemo wall to the MuVeto System
//fMuonSystem.fEventNumber 0 the event number returned by IRQ. Note, this can be reset in the middle of a run and there are a number of jumps to very high values
//fMuonSystem.fFileNumber -99 there are up to 99 files per Run in the MuVeto System
//fMuonSystem.fMultiTDC -99 the number of PMTs with a TDC value
//fMuonSystem.fPcTimeSec -99 the time in seconds (presumably since Jan 1, 1970) returned by the DAQ PC
//fMuonSystem.fPcTimeMuSec -99 the microseconds elaspsed within the PC time
//fMuonSystem.fCommonStopTime -99 the TDC value of the common stop signal for Muon Veto Events.
//fMuonSystem.fRunStartTime -99 start time, in unix time, for the beginning of the current system run
//fMuonSystem.fRunEndTime -99 end time, in unix time, for the beginning of the current system run
//fMuonSystem.fFileStartTime -99 start time, in unix time, for the beginning of the current "file"
//fMuonSystem.fFileEndTime -99 end time, in unix time, for the beginning of the current "file"
//fMuonSystem.fEventQuality ->7fbbeacf6cc8 || //the Event Quality bits. But don't split them! Otherwise, they won't be accessible from TTree::Draw
//fMuonSystem.fEventQuality.fNbi0s Highest bit set + 1
//fMuonSystem.fEventQuality.fNby0es Number of UChars in fAllBits
//fMuonSystem.fEventQuality.*fAl->0 s [fNbytes] array of UChars
//fMuonSystem.fEventQuality.fUni0ueID object unique identifier
//fMuonSystem.fEventQuality.fBit0x03000000 bit field status word
//fMuonSystem.fSystemOn false
//*fSamba ->7fbbeacf70d0 -> an array of samba records
//*fBolo ->7fbbeacf7420 -> an array of bolometer records
//*fBoloPulse ->7fbbeacf7a40 -> an array of pulse record
//*fMuonModule ->7fbbeacf8150 -> an array of muon module records
//*fPulseAna ->7fbbeacf8770 -> an array of pulse analysis, each calculated by a different method
//fEventTriggerStamp 100 the Opera clock value for this event.
//fTriggerType 1 0x1 for Bolo event, 0x2 for Muon System, 0x4 if NC counter, 0x8 for next system, etc...
//fUniqueID 0 object unique identifier
//fBits 0x03000000 bit field status word
ehla.Dump()
//==> Dumping object at: 0x00007fbbeace3d30, name=KHLAEvent, class=KHLAEvent
//
//fMuonSystem ->7fbbeace3d50 Muon Veto System Record
//fMuonSystem.fRunNumber -99 run number of the Muon Veto system
//fMuonSystem.fMultiADC -99 the number of PMTs in the MuVeto system with an ADC value
//fMuonSystem.fDistanceEst -99 laser distance from the East wall to the MuVeto System
//fMuonSystem.fDistanceNemo -99 laser distance from the Nemo wall to the MuVeto System
//fMuonSystem.fEventNumber 0 the event number returned by IRQ. Note, this can be reset in the middle of a run and there are a number of jumps to very high values
//fMuonSystem.fFileNumber -99 there are up to 99 files per Run in the MuVeto System
//fMuonSystem.fMultiTDC -99 the number of PMTs with a TDC value
//fMuonSystem.fPcTimeSec -99 the time in seconds (presumably since Jan 1, 1970) returned by the DAQ PC
//fMuonSystem.fPcTimeMuSec -99 the microseconds elaspsed within the PC time
//fMuonSystem.fCommonStopTime -99 the TDC value of the common stop signal for Muon Veto Events.
//fMuonSystem.fRunStartTime -99 start time, in unix time, for the beginning of the current system run
//fMuonSystem.fRunEndTime -99 end time, in unix time, for the beginning of the current system run
//fMuonSystem.fFileStartTime -99 start time, in unix time, for the beginning of the current "file"
//fMuonSystem.fFileEndTime -99 end time, in unix time, for the beginning of the current "file"
//fMuonSystem.fEventQuality ->7fbbeace3da8 || //the Event Quality bits. But don't split them! Otherwise, they won't be accessible from TTree::Draw
//fMuonSystem.fEventQuality.fNbi0s Highest bit set + 1
//fMuonSystem.fEventQuality.fNby0es Number of UChars in fAllBits
//fMuonSystem.fEventQuality.*fAl->0 s [fNbytes] array of UChars
//fMuonSystem.fEventQuality.fUni0ueID object unique identifier
//fMuonSystem.fEventQuality.fBit0x03000000 bit field status word
//fMuonSystem.fSystemOn false
//*fSamba ->7fbbeace3c40 -> pointer to the array of Samba Sub Records
//*fBolo ->7fbbeace93b0 -> pointer to the array of Single Bolo Sub Records
//*fBoloPulse ->7fbbeacec090 -> pointer to the array of Bolo Pulse Sub Records
//*fMuonModule ->7fbbeacf2670 -> pointer to the array of Muon Module Sub Records
//fRunNumber -99 big Run number. the small run number is found in the Bolometer data record
//fRunStartTime -99 begining of the Big Run
//fRunEndTime -99 end of the Big Run
//fGSEventNumber 0 Global Software Event Number. starts from 1 with each new Run
//fEventTriggerStamp 100 the Opera clock value for this event.
//fTriggerType 1 0x1 for Bolo event, 0x2 for Muon System, 0x4 if NC counter, 0x8 for next system, etc...
//fUniqueID 0 object unique identifier
//fBits 0x03000000 bit field status word
import ROOT
ROOT.gSystem.Load('libkds')
eamp = ROOT.KEventFactory.NewAmpEvent()
ehla = ROOT.KEventFactory.NewHLAEvent()
eamp.SetEventTriggerStamp(100) #EventTriggerTimeStamp is a base class member
eamp.AddBolo() #add a bolo amp record
#check contents
ehla.GetNumBolos()
# 0
ehla.GetEventTriggerStamp()
# -99L
eamp.GetNumBolos()
# 1
eamp.GetEventTriggerStamp()
# 100L
#call the base class assignment operator
ehla.__class__.__base__.__assign__(ehla, eamp)
#re-check contents
ehla.GetNumBolos()
# 0
ehla.GetEventTriggerStamp() #base class information was copied
# 100L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment