From 2881639e34784c2be1bb62ccdaaf6ec762f1f634 Mon Sep 17 00:00:00 2001 From: "theodore.efremov" <theodore.efremov@cea.fr> Date: Fri, 29 Nov 2024 09:33:45 +0100 Subject: [PATCH] Added class to hold time information --- NPLib/Detectors/PISTA/TTimeData.cxx | 68 ++++++++++++++++++++++ NPLib/Detectors/PISTA/TTimeData.h | 90 +++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 NPLib/Detectors/PISTA/TTimeData.cxx create mode 100644 NPLib/Detectors/PISTA/TTimeData.h diff --git a/NPLib/Detectors/PISTA/TTimeData.cxx b/NPLib/Detectors/PISTA/TTimeData.cxx new file mode 100644 index 000000000..d1aefa0fb --- /dev/null +++ b/NPLib/Detectors/PISTA/TTimeData.cxx @@ -0,0 +1,68 @@ +/***************************************************************************** + * Copyright (C) 2009-2020 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Théodore Efremov contact address: theodore.efremov@cea.fr + * * + * Creation Date : Nov 2024 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Time Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include "TTimeData.h" + +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +using namespace std; + +ClassImp(TTimeData) + + +////////////////////////////////////////////////////////////////////// +TTimeData::TTimeData() { +} + + + +////////////////////////////////////////////////////////////////////// +TTimeData::~TTimeData() { +} + + + +////////////////////////////////////////////////////////////////////// +void TTimeData::Clear() { + fTimeMWPC13.clear(); + fTimeMWPC14.clear(); + fTimeMWPC23.clear(); + fTimeMWPC24.clear(); +} + + + +////////////////////////////////////////////////////////////////////// +void TTimeData::Dump() const { + // This method is very useful for debuging and worth the dev. + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TTimeData::Dump()] XXXXXXXXXXXXXXXXX" << endl; + + size_t mysize = fTimeMWPC13.size(); + cout << "MWPC_Mult: " << mysize << endl; + for(unsigned int i=0; i<mysize; i++){ + cout << "Time 13 mult " << i+1 << " / T= " << fTimeMWPC13[i] << endl; + cout << "Time 14 mult " << i+1 << " / T= " << fTimeMWPC14[i] << endl; + cout << "Time 23 mult " << i+1 << " / T= " << fTimeMWPC23[i] << endl; + cout << "Time 24 mult " << i+1 << " / T= " << fTimeMWPC24[i] << endl; + } +} diff --git a/NPLib/Detectors/PISTA/TTimeData.h b/NPLib/Detectors/PISTA/TTimeData.h new file mode 100644 index 000000000..22e57c69d --- /dev/null +++ b/NPLib/Detectors/PISTA/TTimeData.h @@ -0,0 +1,90 @@ +#ifndef __TIMEDATA__ +#define __TIMEDATA__ +/***************************************************************************** + * Copyright (C) 2009-2020 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Théodore Efremov contact address: theodore.efremov@cea.fr * + * * + * Creation Date : Oct 2023 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Time Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ + +// STL +#include <vector> +using namespace std; + +// ROOT +#include "TObject.h" + +class TTimeData : public TObject { + ////////////////////////////////////////////////////////////// + // data members are hold into vectors in order + // to allow multiplicity treatment + private: + vector<long> fTimeMWPC13; + vector<long> fTimeMWPC14; + vector<long> fTimeMWPC23; + vector<long> fTimeMWPC24; + + + + ////////////////////////////////////////////////////////////// + // Constructor and destructor + public: + TTimeData(); + ~TTimeData(); + + + ////////////////////////////////////////////////////////////// + // Inherited from TObject and overriden to avoid warnings + public: + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + + ////////////////////////////////////////////////////////////// + // Getters and Setters + // Prefer inline declaration to avoid unnecessary called of + // frequently used methods + // add //! to avoid ROOT creating dictionnary for the methods + public: + ////////////////////// SETTERS //////////////////////// + // X setters + inline void SetTime_MWPC13(long time ){fTimeMWPC13.push_back(time);};//! + inline void SetTime_MWPC14(long time ){fTimeMWPC14.push_back(time);};//! + inline void SetTime_MWPC23(long time ){fTimeMWPC23.push_back(time);};//! + inline void SetTime_MWPC24(long time ){fTimeMWPC24.push_back(time);};//! + + + ////////////////////// GETTERS //////////////////////// + inline UShort_t GetTimeMWPC13(const unsigned int &i) const + {return fTimeMWPC13.at(i) ;}//! + inline UShort_t GetTimeMWPC14(const unsigned int &i) const + {return fTimeMWPC14.at(i) ;}//! + inline UShort_t GetTimeMWPC23(const unsigned int &i) const + {return fTimeMWPC23.at(i) ;}//! + inline UShort_t GetTimeMWPC24(const unsigned int &i) const + {return fTimeMWPC24.at(i) ;}//! + + inline UShort_t GetMWPCMult() const + {return fTimeMWPC13.size();} + ////////////////////////////////////////////////////////////// + // Required for ROOT dictionnary + ClassDef(TTimeData,1) // TimeData structure +}; + +#endif -- GitLab