NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
NcTagger Class Reference

Handling of generic event classification tags. More...

#include "NcTagger.h"

Inheritance diagram for NcTagger:
NcDevice NcSignal NcPosition NcAttrib Nc3Vector

Detailed Description

Handling of generic event classification tags.


Copyright(c) 2021 NCFS/IIHE, All Rights Reserved. *
*
Authors: The Netherlands Center for Fundamental Studies (NCFS). *
The Inter-university Institute for High Energies (IIHE). *
Website : http://www.iihe.ac.be *
Contact : Nick van Eijndhoven (nickve.nl@gmail.com) *
*
Contributors are mentioned in the code where appropriate. *
*
No part of this software may be used, copied, modified or distributed *
by any means nor transmitted or translated into machine language for *
commercial purposes without written permission by the IIHE representative. *
Permission to use the software strictly for non-commercial purposes *
is hereby granted without fee, provided that the above copyright notice *
appears in all copies and that both the copyright notice and this *
permission notice appear in the supporting documentation. *
This software is provided "as is" without express or implied warranty. *
The authors make no claims that this software is free of error, or is *
consistent with any particular standard of merchantability, or that it *
will meet your requirements for any particular application, other than *
indicated in the corresponding documentation. *
This software should not be relied on for solving a problem whose *
incorrect solution could result in injury to a person or loss of property. *
If you do use this software in such a manner, it is at your own risk. *
The authors disclaim all liability for direct or consequential damage *
resulting from your use of this software. *

// Class NcTagger
// NcDevice derived (base) class to handle generic event classification tags.
//
// During data taking or online/offline processing one usually records
// various tags for each event to indicate which selection criteria
// were fulfilled. This also allows to provide different data streams.
//
// It is common that a certain tag has the following two indicators
// pass : This means that the tag criteria have been fulfilled
// write : This means that the event is actually labeled to be written
//
// In case of high-frequency tag streams it is common that not every event
// will be written to storage in order to limit the data volume.
// In the DAQ system this is implemented by a downscaling of the corresponding
// data stream via so-called prescaler settings.
// The effect is that although for a certain tag the passing criteria have
// been fulfilled (i.e. the "pass" flag is set), the "write" flag is not always set,
// but for instance only after every 1000 instances of an activated "pass" flag.
// This results in a downscale factor of 1000 for that tag stream.
//
// Tailoring of the tag settings is provided via the member functions SetPass() and SetWrite().
//
// Note :
// ------
// The standard tagging logic reflects the situation without downscaling,
// which corresponds to the following default behaviour of SetPass() :
//
// pass=kFALSE --> write=kFALSE
// pass=kTRUE --> write=kTRUE
//
// In case the user wants to reflect a different relation between the "pass" and "write" flags,
// as is the case for a downscaled data stream, the SetWrite() member function has to be invoked
// AFTER invokation of the corresponding SetPass().
//
// This class provides a generic basis to handle various event classification tags.
// By introducing instances of this (or a derived) class into an NcEvent c.q. NcDetector
// (or derived) structure, these may be accessed via the usual device retrieval functions.
//
// Usage example :
// ===============
//
// // Load the necessary libraries
// gSystem->Load("ncfspack");
// gSystem->Load("icepack");
//
// IceEvent evt;
//
// NcTagger trig("Trigger","IceCube trigger info");
//
// NcTagger filt("Filter","IceCube filtered stream");
//
// while (......) // Loop over the recorded events
// {
// // Reset all data containers
// evt.Reset();
// trig.Reset();
// filt.Reset();
//
// // Fill the event structure with recorded data
// ... read DAQ structures
// ... obtain the trigger information
// ... etc.
//
// // The trigger data
// trig.SetPass("SMT3",kTRUE); // Simple Multiplicity Trigger (3 coincidences)
// trig.SetPass("SMT8",kFALSE); // Simple Multiplicity Trigger (8 coincidences)
// trig.SetPass("ITOP",kFALSE); // IceTop trigger
//
// // From the trigger info, this seems to be a low multipicity (=low energy) event.
// // Note that by default the "write" tag is set accordingly for all these triggers.
//
// // Perform some reconstruction tasks
// ... track reconstruction
// ... energy reconstruction
// ... topology reconstruction
// ... etc.
//
// // The filtered event stream
// filt.SetPass("Muon",kFALSE); // Reconstructed muon track
// filt.SetPass("EHE",kFALSE); // Extreme High Energy event
// filt.SetPass("LowUp",kTRUE); // Low energy upgoing event
// filt.SetWrite("LowUp",kFALSE); // This event will not be written due to "LowUp" downscaling
// filt.SetPass("Solar",kTRUE); // Event related to solar activity
//
// // Based on the filter info, the event will be written because of the "Solar" filter.
//
// // Add the trigger and filter data into the event structure
// evt.AddDevice(trig);
// evt.AddDevice(filt);
// }
//
// In case this sample of events is written into a file, the trigger and filter statistics
// may be investigated by means of the NcTaggingStats or NcDataStreamStats facilities.
//
//--- Author: Nick van Eijndhoven, IIHE-VUB, Brussel, July 12, 2021 16:36Z
//- Modified: Nick van Eijndhoven, IIHE-VUB, Brussel, July 26, 2022 08:05Z

Definition at line 11 of file NcTagger.h.

Public Member Functions

 NcTagger (const char *name="NcTagger", const char *title="Event tag handling")
 
 NcTagger (const NcTagger &q)
 
virtual ~NcTagger ()
 
virtual TObject * Clone (const char *name="") const
 
Bool_t GetPass (TString name)
 
Bool_t GetWrite (TString name)
 
void SetPass (TString name, Bool_t flag)
 
void SetWrite (TString name, Bool_t flag)
 
- Public Member Functions inherited from NcDevice
 NcDevice (const char *name="", const char *title="")
 
 NcDevice (const NcDevice &dev)
 
virtual ~NcDevice ()
 
void AddHit (NcSignal &s)
 
void AddHit (NcSignal *s)
 
virtual void Data (TString f="car", TString u="rad") const
 
void DisplayHits (Int_t idx=1, Float_t scale=-1, TObjArray *hits=0, Int_t dp=0, Int_t mode=1, Int_t mcol=4)
 
void DisplayHits (TString name, Float_t scale=-1, TObjArray *hits=0, Int_t dp=0, Int_t mode=1, Int_t mcol=4)
 
NcPosition GetCOG (TObjArray *hits, Int_t pos=0, TString slotname="none", Int_t mode=0) const
 
Double_t GetCVAL (TObjArray *hits, TString obsname, TString weightname="none", Int_t mode=0, Int_t type=1) const
 
void GetExtremes (Float_t &vmin, Float_t &vmax, Int_t idx=1, TObjArray *hits=0, Int_t mode=1, Int_t deadcheck=1) const
 
void GetExtremes (Float_t &vmin, Float_t &vmax, TString name, TObjArray *hits=0, Int_t mode=1, Int_t deadcheck=1) const
 
NcSignalGetHit (Int_t j) const
 
NcSignalGetHit (TString name, Int_t mode=0, Int_t opt=0) const
 
Int_t GetHitCopy () const
 
Nc3Vector GetHitPath (TObjArray *hits, Int_t pos=0) const
 
TObjArray * GetHits ()
 
void GetHits (TObjArray &selected, TString name, Int_t mode=0, Int_t opt=0, TObjArray *hits=0) const
 
NcSignalGetIdHit (Int_t id) const
 
Int_t GetNhits () const
 
Int_t GetNhits (TString name, Int_t mode=0, Int_t opt=0) const
 
Int_t GetStatus () const
 
void RemoveHit (NcSignal &s)
 
void RemoveHit (NcSignal *s)
 
void RemoveHits ()
 
virtual void Reset (Int_t mode=0)
 
void SetHitCopy (Int_t j)
 
virtual void SetOwner (Bool_t own=kTRUE)
 
void SetStatus (Int_t word)
 
void ShowHit (Int_t j=0, TString f="car", TString u="rad") const
 
Double_t SlideWindow (TObjArray *hits, Double_t thres, Double_t swin, TString sname, Int_t smode=0, TString wname="none", Int_t wmode=0, Int_t *i1=0, Int_t *i2=0) const
 
TObjArray * SortHits (Int_t idx=1, Int_t mode=-1, TObjArray *hits=0, Int_t mcal=1, Int_t deadcheck=1, TObjArray *ordered=0)
 
TObjArray * SortHits (TString name, Int_t mode=-1, TObjArray *hits=0, Int_t mcal=1, Int_t deadcheck=1, TObjArray *ordered=0)
 
Double_t SumSignals (Int_t idx, Int_t mode=1, TObjArray *hits=0)
 
Double_t SumSignals (TString name, Int_t mode=1, TObjArray *hits=0)
 
- Public Member Functions inherited from NcSignal
 NcSignal (const char *name="", const char *title="")
 
 NcSignal (const NcSignal &s)
 
virtual ~NcSignal ()
 
void AddLink (TObject *obj, Int_t j=1)
 
void AddLink (TObject *obj, TString name)
 
virtual void AddSignal (Double_t sig, Int_t j=1)
 
virtual void AddSignal (Double_t sig, TString name)
 
void AddTrack (NcTrack &t, Int_t mode=1)
 
void DeleteSample (Int_t j=1)
 
void DeleteSample (TString name)
 
virtual void DeleteSignals (Int_t mode=0)
 
void DeleteWaveform (Int_t j=1)
 
void DeleteWaveform (TString name)
 
NcSampleDisplaySample (Int_t j=1, Int_t i=1) const
 
NcSampleDisplaySample (TString name, Int_t i=1) const
 
NcDeviceGetDevice () const
 
Int_t GetErrorFlag (Int_t j=1) const
 
Int_t GetErrorFlag (TString name) const
 
NcTrackGetIdTrack (Int_t id) const
 
Int_t GetIndices (TObject *obj, Int_t j, TArrayI &ks) const
 
Int_t GetIndices (TObject *obj, TArrayI &js, Int_t k) const
 
Int_t GetIndices (TObject *obj, TArrayI &js, TArrayI &ks) const
 
Int_t GetIndices (TObject *obj, TString name, TArrayI &ks) const
 
TObject * GetLink (Int_t j=1, Int_t k=1) const
 
TObject * GetLink (TString name, Int_t k=1) const
 
Int_t GetNerrors () const
 
Int_t GetNlinks (TObject *obj, TString name) const
 
Int_t GetNlinks (TObject *obj=0, Int_t j=0) const
 
Int_t GetNsamples () const
 
virtual Int_t GetNslots () const
 
Int_t GetNtracks (NcTrack *t=0) const
 
Int_t GetNvalues () const
 
Int_t GetNwaveforms () const
 
NcSampleGetSample (Int_t j=1) const
 
NcSampleGetSample (TString name) const
 
Int_t GetSampleIndex (TString name) const
 
virtual Float_t GetSignal (Int_t j=1, Int_t mode=0) const
 
virtual Float_t GetSignal (TString name, Int_t mode=0) const
 
virtual Float_t GetSignalError (Int_t j=1) const
 
virtual Float_t GetSignalError (TString name) const
 
Int_t GetSignalFlag (Int_t j=1) const
 
Int_t GetSignalFlag (TString name) const
 
Int_t GetSwapMode () const
 
NcTrackGetTrack (Int_t j) const
 
TH1F * GetWaveform (Int_t j=1) const
 
TH1F * GetWaveform (TString name) const
 
Int_t GetWaveformIndex (TString name) const
 
virtual void List (Int_t j=0) const
 
virtual void List (TString name) const
 
void ListSample (Int_t j=0) const
 
void ListTrack (Int_t j=0) const
 
void ListWaveform (Int_t j=0) const
 
void RemoveTrack (NcTrack &t, Int_t mode=1)
 
void RemoveTracks (Int_t mode=1)
 
void ResetLink (Int_t j=1, Int_t k=1)
 
void ResetLink (TString name, Int_t k=1)
 
void ResetLinks (TObject *obj, Int_t j=0, Int_t k=0)
 
void ResetLinks (TObject *obj, TString name, Int_t k=0)
 
void ResetSample (Int_t j=1)
 
void ResetSample (TString name)
 
virtual void ResetSignals (Int_t mode=0)
 
void ResetWaveform (Int_t j=1)
 
void ResetWaveform (TString name)
 
void SetDevice (NcDevice *dev)
 
void SetLink (TObject *obj, Int_t j=1, Int_t k=1)
 
void SetLink (TObject *obj, TString name, Int_t k=1)
 
void SetSample (NcSample *sample, Int_t j=1)
 
virtual void SetSignal (Double_t sig, Int_t j=1)
 
virtual void SetSignal (Double_t sig, TString name)
 
virtual void SetSignalError (Double_t dsig, Int_t j=1)
 
virtual void SetSignalError (Double_t dsig, TString name)
 
void SetSwapMode (Int_t swap=1)
 
void SetWaveform (TH1F *waveform, Int_t j=1)
 
- Public Member Functions inherited from NcPosition
 NcPosition ()
 
 NcPosition (const NcPosition &p)
 
virtual ~NcPosition ()
 
Double_t GetDistance (NcPosition &p, Float_t scale=-1)
 
Double_t GetDistance (NcPosition *p, Float_t scale=-1)
 
NcPositionGetPosition ()
 
void GetPosition (Double_t *r, TString f, TString u="rad", Float_t s=-1) const
 
void GetPosition (Float_t *r, TString f, TString u="rad", Float_t s=-1) const
 
void GetPositionErrors (Double_t *e, TString f, TString u="rad", Float_t s=-1) const
 
void GetPositionErrors (Float_t *e, TString f, TString u="rad", Float_t s=-1) const
 
NcTimestampGetTimestamp ()
 
Float_t GetUnitScale () const
 
void RemoveTimestamp ()
 
void ResetPosition ()
 
void SetPosition (Double_t *r, TString f, TString u="rad")
 
void SetPosition (Double_t r1, Double_t r2, Double_t r3, TString f, TString u="rad")
 
void SetPosition (Float_t *r, TString f, TString u="rad")
 
void SetPosition (Nc3Vector &r)
 
void SetPositionErrors (Double_t *e, TString f, TString u="rad")
 
void SetPositionErrors (Double_t e1, Double_t e2, Double_t e3, TString f, TString u="rad")
 
void SetPositionErrors (Float_t *e, TString f, TString u="rad")
 
void SetTimestamp (NcTimestamp &t)
 
void SetUnitScale (Float_t s)
 
- Public Member Functions inherited from Nc3Vector
 Nc3Vector ()
 
 Nc3Vector (const Nc3Vector &v)
 
virtual ~Nc3Vector ()
 
Double_t ConvertAngle (Double_t a, TString in, TString out) const
 
Nc3Vector Cross (Nc3Vector &q) const
 
Double_t Dot (Nc3Vector &q)
 
void GetErrors (Double_t *e, TString f, TString u="rad") const
 
void GetErrors (Float_t *e, TString f, TString u="rad") const
 
Double_t GetNorm ()
 
virtual Double_t GetOpeningAngle (Nc3Vector &q, TString u="rad")
 
Nc3Vector GetPrimed (TRotMatrix *m) const
 
Double_t GetPseudoRapidity ()
 
Double_t GetResultError () const
 
Nc3Vector GetUnprimed (TRotMatrix *m) const
 
Nc3Vector GetVecLong () const
 
void GetVector (Double_t *v, TString f, TString u="rad") const
 
void GetVector (Float_t *v, TString f, TString u="rad") const
 
Nc3Vector GetVecTrans () const
 
Double_t GetX (Int_t i, TString f, TString u="rad")
 
Int_t HasErrors () const
 
Int_t HasVector () const
 
virtual void Load (Nc3Vector &q)
 
Nc3Vector operator* (Double_t s) const
 
Nc3Vectoroperator*= (Double_t s)
 
Nc3Vector operator+ (Nc3Vector &q) const
 
Nc3Vectoroperator+= (Nc3Vector &q)
 
Nc3Vector operator- (Nc3Vector &q) const
 
Nc3Vectoroperator-= (Nc3Vector &q)
 
Nc3Vector operator/ (Double_t s) const
 
Nc3Vectoroperator/= (Double_t s)
 
Nc3Vectoroperator= (const Nc3Vector &q)
 
void PrintAngle (Double_t a, TString in, TString out, Int_t ndig=1, Bool_t align=kFALSE) const
 
void SetErrors (Double_t *e, TString f, TString u="rad")
 
void SetErrors (Double_t e1, Double_t e2, Double_t e3, TString f, TString u="rad")
 
void SetErrors (Float_t *e, TString f, TString u="rad")
 
void SetVector (Double_t *v, TString f, TString u="rad")
 
void SetVector (Double_t v1, Double_t v2, Double_t v3, TString f, TString u="rad")
 
void SetVector (Float_t *v, TString f, TString u="rad")
 
virtual void SetZero ()
 
- Public Member Functions inherited from NcAttrib
 NcAttrib ()
 
 NcAttrib (const NcAttrib &a)
 
virtual ~NcAttrib ()
 
void AddNamedSlot (TString s)
 
void DecreaseEdgeValue (Int_t j=1)
 
void DecreaseEdgeValue (TString name)
 
void DeleteCalibrations (Int_t mode=0)
 
TF1 * GetCalFunction (Int_t j=1) const
 
TF1 * GetCalFunction (TString name) const
 
Int_t GetCalWord (Int_t j=1) const
 
Int_t GetCalWord (TString name) const
 
Int_t GetDeadValue (Int_t j=1) const
 
Int_t GetDeadValue (TString name) const
 
TF1 * GetDecalFunction (Int_t j=1) const
 
TF1 * GetDecalFunction (TString name) const
 
Int_t GetEdgeValue (Int_t j=1) const
 
Int_t GetEdgeValue (TString name) const
 
Float_t GetGain (Int_t j=1) const
 
Float_t GetGain (TString name) const
 
Int_t GetGainFlag (Int_t j=1) const
 
Int_t GetGainFlag (TString name) const
 
Int_t GetLockValue (Int_t j=1) const
 
Int_t GetLockValue (TString name) const
 
Int_t GetNcalflags () const
 
Int_t GetNcalfuncs () const
 
Int_t GetNdecalfuncs () const
 
Int_t GetNgains () const
 
Int_t GetNnames () const
 
Int_t GetNoffsets () const
 
Float_t GetOffset (Int_t j=1) const
 
Float_t GetOffset (TString name) const
 
Int_t GetOffsetFlag (Int_t j=1) const
 
Int_t GetOffsetFlag (TString name) const
 
Int_t GetSlotIndex (TString name, Int_t opt=0) const
 
TString GetSlotName (Int_t j=1) const
 
void IncreaseEdgeValue (Int_t j=1)
 
void IncreaseEdgeValue (TString name)
 
virtual void Load (NcAttrib &a, Int_t j=0)
 
virtual void Load (NcAttrib &a, TString name)
 
void Lock (Int_t j=1)
 
void Lock (TString name)
 
void ResetGain (Int_t j=1)
 
void ResetGain (TString name)
 
void ResetOffset (Int_t j=1)
 
void ResetOffset (TString name)
 
void SetAlive (Int_t j=1)
 
void SetAlive (TString name)
 
void SetCalFunction (TF1 *f, Int_t j=1)
 
void SetCalFunction (TF1 *f, TString name)
 
void SetDead (Int_t j=1)
 
void SetDead (TString name)
 
void SetDecalFunction (TF1 *f, Int_t j=1)
 
void SetDecalFunction (TF1 *f, TString name)
 
void SetEdgeOff (Int_t j=1)
 
void SetEdgeOff (TString name)
 
void SetEdgeOn (Int_t j=1)
 
void SetEdgeOn (TString name)
 
void SetEdgeValue (Int_t val, Int_t j=1)
 
void SetEdgeValue (Int_t val, TString name)
 
void SetGain (Double_t gain, Int_t j=1)
 
void SetGain (Double_t gain, TString name)
 
void SetOffset (Double_t off, Int_t j=1)
 
void SetOffset (Double_t off, TString name)
 
void SetSlotName (TString s, Int_t j=1)
 
void Unlock (Int_t j=1)
 
void Unlock (TString name)
 

Protected Member Functions

void SetTag (TString hitname, TString slotname, Float_t value)
 
- Protected Member Functions inherited from NcSignal
void SetSigFlags (Int_t is, Int_t ie, Int_t j)
 
- Protected Member Functions inherited from NcAttrib
void SetCalFlags (Int_t gf, Int_t of, Int_t j)
 

Additional Inherited Members

- Public Attributes inherited from NcSignal
Bool_t fDevset
 
- Protected Attributes inherited from NcDevice
Int_t fHitCopy
 
TObjArray * fHits
 
TObjArray * fMarkers
 ! Temp. array to hold the 3D markers for the hit display
 
TObjArray * fOrdered
 ! Temp. array to hold the ordered hits
 
Int_t fStatus
 
- Protected Attributes inherited from NcSignal
TObject * fDevice
 
TArrayF * fDsignals
 
NcObjMatrixfLinks
 
TObjArray * fSamples
 
TArrayI * fSigflags
 
TArrayF * fSignals
 
TObjArray * fTracks
 
TObjArray * fWaveforms
 
- Protected Attributes inherited from NcPosition
Float_t fScale
 
NcTimestampfTstamp
 
- Protected Attributes inherited from Nc3Vector
Double32_t fDresult
 ! Error on scalar result (e.g. norm or dotproduct)
 
Int_t fNv
 
Double32_t * fV
 
- Protected Attributes inherited from NcAttrib
TArrayI * fCalflags
 
TObjArray * fCalfuncs
 
TObjArray * fDecalfuncs
 
TArrayF * fGains
 
TObjArray * fNames
 
TArrayF * fOffsets
 

Constructor & Destructor Documentation

◆ NcTagger() [1/2]

NcTagger::NcTagger ( const char * name = "NcTagger",
const char * title = "Event tag handling" )
// Default constructor.

Definition at line 141 of file NcTagger.cxx.

◆ ~NcTagger()

NcTagger::~NcTagger ( )
virtual
// Default destructor.

Definition at line 150 of file NcTagger.cxx.

◆ NcTagger() [2/2]

NcTagger::NcTagger ( const NcTagger & q)
// Copy constructor.

Definition at line 159 of file NcTagger.cxx.

Member Function Documentation

◆ Clone()

TObject * NcTagger::Clone ( const char * name = "") const
virtual
// Make a deep copy of the current object and provide the pointer to the copy.
// This memberfunction enables automatic creation of new objects of the
// correct type depending on the object type, a feature which may be very useful
// for containers like NcEvent when adding objects in case the
// container owns the objects. This feature allows e.g. NcEvent
// to store either NcTagger objects or objects derived from NcTagger
// via tha AddDevice memberfunction, provided these derived classes also have
// a proper Clone memberfunction.

Reimplemented from NcDevice.

Definition at line 277 of file NcTagger.cxx.

◆ GetPass()

Bool_t NcTagger::GetPass ( TString name)
// Provide the pass flag of the tag with the specified name.

Definition at line 211 of file NcTagger.cxx.

◆ GetWrite()

Bool_t NcTagger::GetWrite ( TString name)
// Provide the pass flag of the tag with the specified name.

Definition at line 231 of file NcTagger.cxx.

◆ SetPass()

void NcTagger::SetPass ( TString name,
Bool_t flag )
// Set the pass flag of the tag with the specified name.
//
// Note :
// ------
// The standard tagging logic reflects the situation without downscaling,
// which corresponds to the following default behaviour :
//
// flag=kFALSE --> pass=kFALSE and write=kFALSE
// flag=kTRUE --> pass=kTRUE and write=kTRUE
//
// In case the user wants to reflect a different relation between the "pass" and "write" flags,
// as is the case for a downscaled data stream, the SetWrite() member function has to be invoked
// AFTER this SetPass() invokation.

Definition at line 168 of file NcTagger.cxx.

◆ SetTag()

void NcTagger::SetTag ( TString hitname,
TString slotname,
Float_t value )
protected
// Internal member function to record the tag data.

Definition at line 251 of file NcTagger.cxx.

◆ SetWrite()

void NcTagger::SetWrite ( TString name,
Bool_t flag )
// Set the write flag of the tag with the specified name.
//
// Note : The setting of the pass flag is not modified.

Definition at line 195 of file NcTagger.cxx.


The documentation for this class was generated from the following files: