Skip to content
Snippets Groups Projects
CbmEvent.h 5.68 KiB
/** @file CbmEvent.h
 ** @author Volker Friese <v.friese@gsi.de>
 ** @date 17.09.2016
 **/


#ifndef CBMEVENT_H
#define CBMEVENT_H 1

#include <Rtypes.h>          // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h>      // for Double_t, UInt_t, Int_t
#include <TMatrixFSymfwd.h>  // for TMatrixFSym
#include <TObject.h>         // for TObject

#include <string>            // for string
#include <map>               // for map, map<>::mapped_type
#include <vector>            // for vector

#include "CbmDefs.h"         // for ECbmDataType, ECbmModuleId::kStsTrack
#include "CbmMatch.h"        // for CbmMatch
#include "CbmVertex.h"       // for CbmVertex, found in core/data/global

/** @class CbmEvent
 ** @brief Class characterising one event by a collection of links (indices)
 ** to data objects,
 ** @author V.Friese <v.friese@gsi.de>
 ** @version 1.0
 **
 **/
class CbmEvent: public TObject {

	public:

		/** Default constructor **/
		CbmEvent() : CbmEvent(-1, 0., 0.) {};

		/** Constructor with event number and time
		 ** @param[in] number    Event number
		 ** @param[in] startTime Event start time [ns]
		 ** @param[in] endTime   Event start time [ns]
		 **/
		CbmEvent(Int_t number, Double_t startTime = 0., Double_t endTime = 0.) :
			TObject(), fNumber(number), fTimeStart(startTime), fTimeEnd(endTime),
			fNofData(0), fVertex(), fMatch(nullptr), fIndexMap() {
		}

                CbmEvent(CbmEvent&&) = default;
                
		/** Destructor **/
		virtual ~CbmEvent() {
			if ( fMatch ) delete fMatch;
		}

                /** Overload TObject Clear to clear the map! **/
                void Clear( Option_t * /*option*/ ) { fIndexMap.clear(); }


		/** Add a data object to the index map
		 ** @param DataType  Type of data (for values see CbmDetectorList.h)
		 ** @param Index     Index of the data object in its TClonesArray
		 */
		void AddData(ECbmDataType type, UInt_t index);


		/** Add an STS track to the event
		 ** @param Index of STS track in its TClonesArray
		 **/
		void AddStsTrack(UInt_t index) { AddData(ECbmDataType::kStsTrack, index); }