diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawEventDict.h b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawEventDict.h index 66d925be54e003283e6b6b9959ec633372cc6593..f9c99d8b82841b48c186990796382e101529bbef 100755 --- a/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawEventDict.h +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawEventDict.h @@ -11,3 +11,7 @@ #include "LArRawEvent/LArFebErrorSummary.h" #include "LArRawEvent/LArLATOMEHeaderContainer.h" //#include "LArRawEvent/LArRawChannelContainer.h" +#include "LArRawEvent/LArSCDigit.h" +#include "LArRawEvent/LArSCDigitContainer.h" +#include "LArRawEvent/LArRawSC.h" +#include "LArRawEvent/LArRawSCContainer.h" diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSC.h b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSC.h new file mode 100755 index 0000000000000000000000000000000000000000..94f115f85c62e536778485415add7f84b4f72372 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSC.h @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARRAWSC_H +#define LARRAWSC_H +#include <vector> + +#include "Identifier/HWIdentifier.h" + +/** + @class LArRawSC + @brief Liquid Argon SuperCell raw data + + represents the output of the LATOME +*/ + +class LArRawSC { + + private: + + /** @brief Online Identifier */ + HWIdentifier m_hardwareID; + + /** @brief Latome channel */ + short m_chan; + + /** @brief LATOME source Id*/ + unsigned int m_sourceId; + + /** @brief vector of energies */ + std::vector < int > m_energies; + + /** @brief vector of bcids */ + std::vector < unsigned short > m_BCId; + + /** @brief vector of saturation flags */ + std::vector < bool > m_satur; + + public: + /** @brief constructor + @param[in] channel_value Online identifier + @param[in] gain_value Gain + @param[in] sample_value Reference of vector with ADC samples + */ + LArRawSC(const HWIdentifier & channel_value, const short chan, const unsigned int sourceId, const std::vector < int > & energies, const std::vector<unsigned short> bcids, std::vector<bool> satur): + m_hardwareID(channel_value), m_chan(chan),m_sourceId(sourceId), m_energies(energies), m_BCId(bcids), m_satur(satur) {} + + LArRawSC(const HWIdentifier & channel_value, + const short chan, + const unsigned int sourceId, + std::vector < int > && energies, + std::vector < unsigned short > && bcids, + std::vector < bool > && satur) + : m_hardwareID(channel_value), + m_chan(chan), + m_sourceId(sourceId), + m_energies(std::move(energies)), + m_BCId(std::move(bcids)), + m_satur(std::move(satur)) + {} + + /** @return HWIdentifier */ + const HWIdentifier & hardwareID() const {return m_hardwareID; } + + /** @return channel */ + short chan() const { return m_chan; } + + /** @return source Id value */ + unsigned int SourceId() const {return m_sourceId;} + + /** @return number of samples */ + int nsamples() const { return m_energies.size(); } + + /** @return a reference to a stl vector containing the energies values */ + const std::vector < int > & energies() const { return m_energies; } + + /** @return a reference to a stl vector containing the bcid values */ + const std::vector < unsigned short > & bcids() const { return m_BCId; } + + /** @return a reference to a stl vector containing the saturation flags */ + const std::vector < bool > & satur() const { return m_satur; } + + /** @brief Conversion operator to a std::string <br> Can be used in a cast operation : (std::string) digit <br> */ + virtual operator std::string() const; + + /** @brief Set energies . + @param[in] samples vector of energies + */ + void setEnergies( std::vector < int > energies); + + /** @brief Set bcids. + @param[in] samples vector of bcids + */ + void setBCIds( std::vector < unsigned short > bcids); + + /** @brief Destructor */ + virtual ~LArRawSC() { } + + /** @brief default constructor for persistency */ + LArRawSC(); +}; + +#endif //LArRawSC_H + diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSCContainer.h b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSCContainer.h new file mode 100755 index 0000000000000000000000000000000000000000..07d8e04311e5f2f50f666c7e0f486ca81f8c8637 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/LArRawSCContainer.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARRAWSCCONTAINER_H +#define LARRAWSCCONTAINER_H + +#include "AthContainers/DataVector.h" +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaKernel/BaseInfo.h" +#include "LArRawEvent/LArRawSC.h" + +/** + @class LArRawSCContainer + @brief Container class for LArRawSC */ + +class LArRawSCContainer : public DataVector<LArRawSC> { + + public : + + /** @brief Constructor */ + LArRawSCContainer() : DataVector<LArRawSC>() { } + + /** @brief Alternative Construction with ownership policy*/ + LArRawSCContainer(SG::OwnershipPolicy ownPolicy) : DataVector<LArRawSC>(ownPolicy) { } + +/** + * Conversion operator to a std::string <br><br> + * Can be used in a cast operation : (std::string) digit_container + */ + + virtual operator std::string() const; + +/** + * destructor + */ + virtual ~LArRawSCContainer() { } +private: + +} ; + + +CLASS_DEF(LArRawSCContainer, 1169658673, 1) +SG_BASE(LArRawSCContainer, DataVector<LArRawSC> ); + +#endif diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigit.h b/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigit.h new file mode 100755 index 0000000000000000000000000000000000000000..6d76280a46455a4c9fe60f7432551701c2eef965 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigit.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARSCDIGIT_H +#define LARSCDIGIT_H +#include "LArDigit.h" + +/** + +@class LArSCDigit +@brief Base class for LArDigits taken by LATOME + +Additional data members to LArDigits are the LATOME channel number and the vector of BCIDs + +@author Pavol Strizenec +*/ + +class LArSCDigit : public LArDigit { + +private: + + /** @brief LATOME channel*/ + uint16_t m_chan; + + /** @brief LATOME source Id*/ + uint32_t m_sourceId; + + /** @brief vector of BCID*/ + std::vector<uint16_t> m_BCId; + +public: + + LArSCDigit(const HWIdentifier & channel_value, short channel, unsigned int sourceId, + const std::vector<short> & sample_values, + const std::vector<unsigned short> & bcids) : + LArDigit(channel_value, CaloGain::LARHIGHGAIN, sample_values), + m_chan(channel), m_sourceId(sourceId), m_BCId(std::move(bcids)) + {}; + + /** @return channel value */ + short Channel() const {return static_cast<short>(m_chan);} + + /** @return source Id value */ + unsigned int SourceId() const {return static_cast<unsigned int>(m_sourceId);} + + /** @return bcids */ + const std::vector<unsigned short> &BCId() const {return m_BCId;} + + /** @brief Destructor */ + virtual ~LArSCDigit(); + + /** @brief default constructor for persistency */ + LArSCDigit(); + +}; + +#endif //LARDIGIT_H + diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigitContainer.h b/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigitContainer.h new file mode 100755 index 0000000000000000000000000000000000000000..eabcddfbb3c84e1cd5902928bb6157352f09f5e2 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/LArSCDigitContainer.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARSCDIGITCONTAINER_H +#define LARSCDIGITCONTAINER_H + +#include "AthContainers/DataVector.h" +#include "AthenaKernel/CLASS_DEF.h" +#include "LArRawEvent/LArSCDigit.h" + +/** +@class LArSCDigitContainer +@brief Container class for LArSCDigit +@author Pavol Strizenec +*/ + +class LArSCDigitContainer : public DataVector<LArSCDigit> { + + public : + /** + @brief constructor + */ + LArSCDigitContainer() : DataVector<LArSCDigit>() { } + +/** + @brief destructor + */ + virtual ~LArSCDigitContainer(); +} ; + + +CLASS_DEF(LArSCDigitContainer,1153794060,0) + +#endif diff --git a/LArCalorimeter/LArRawEvent/LArRawEvent/selection.xml b/LArCalorimeter/LArRawEvent/LArRawEvent/selection.xml index 785c3bd61501d6a64b386530e227230136e900c1..485ed267612af2d47a5dd4042dc7317cb907aab5 100755 --- a/LArCalorimeter/LArRawEvent/LArRawEvent/selection.xml +++ b/LArCalorimeter/LArRawEvent/LArRawEvent/selection.xml @@ -15,6 +15,10 @@ <class name="LArDigitContainer" id="B15FFDA0-206D-4062-8B5F-582A1ECD5502" /> <class name="DataVector<LArDigit>" /> <class name="std::vector<LArDigit*>" /> + <class name="LArSCDigit" /> + <class name="LArSCDigitContainer" id="A9F35100-49CB-4A1B-AA25-5FCF1737BBE5" /> + <class name="LArRawSC" /> + <class name="LArRawSCContainer" id="CEBA32C8-FA00-4FCB-97DC-37F7F7C841BD" /> <!-- <class name="std::vector<float>" /> --> <class name="LArTTL1Container" id="38FAECC7-D0C5-4DD8-8FAE-8D35F0542ECD" /> diff --git a/LArCalorimeter/LArRawEvent/src/LArRawSC.cxx b/LArCalorimeter/LArRawEvent/src/LArRawSC.cxx new file mode 100755 index 0000000000000000000000000000000000000000..f09c03c9ce75829f65a09ee5d8cd42bbbd2b43f9 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/src/LArRawSC.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <typeinfo> + +#include "LArRawEvent/LArRawSC.h" + + +// default constructor +LArRawSC::LArRawSC() {} + +LArRawSC::operator std::string() const{ + + char * stSamples = new char[20] ; + char * stNumberOfSamples = new char[30] ; + char * classNameOfDigit = new char[48] ; + + const char * stname = typeid( *this ).name() ; + int lname ; + sscanf( stname , "%80d%47s" , &lname , classNameOfDigit ) ; + + + sprintf( stNumberOfSamples , "# of samples = %d " , this->nsamples() ) ; + + + std::string digitString = classNameOfDigit ; + delete[] stSamples ; + delete[] classNameOfDigit ; + delete[] stNumberOfSamples ; + + return digitString ; + + +} + +// set method +void LArRawSC::setEnergies(std::vector<int> energies) +{ + m_energies.clear(); + m_energies = energies; +} + +void LArRawSC::setBCIds(std::vector<unsigned short> bcids) +{ + m_BCId.clear(); + m_BCId = bcids; +} diff --git a/LArCalorimeter/LArRawEvent/src/LArRawSCContainer.cxx b/LArCalorimeter/LArRawEvent/src/LArRawSCContainer.cxx new file mode 100755 index 0000000000000000000000000000000000000000..1117287a7662d62350d5c1ba27f5b237ac425e6f --- /dev/null +++ b/LArCalorimeter/LArRawEvent/src/LArRawSCContainer.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArRawEvent/LArRawSCContainer.h" +#include "AthenaKernel/BaseInfo.h" +#include <typeinfo> + + + +LArRawSCContainer::operator std::string () const { + + char * stCounter = new char[48] ; + char * nameOfContainer = new char[48] ; + + const char * stname = typeid( *this ).name() ; + int lname ; + sscanf( stname , "%80d%47s" , &lname , nameOfContainer ) ; + + std::string newline( "\n" ) ; + std::string digitContainerString = nameOfContainer ; + digitContainerString += ": content " ; + digitContainerString += newline ; + + LArRawSCContainer::const_iterator it ; + int counter = 0 ; + const LArRawSC * digit ; + + for(it = this->begin() ; it != this->end() ; it++ ){ // Loop over Hits + + digit = *it ; + + sprintf( stCounter , "%d" , counter ) ; + + digitContainerString += "LArRawSC[" ; + digitContainerString += stCounter ; + digitContainerString += "] = " ; + digitContainerString += (std::string) (*digit) ; + digitContainerString += newline ; + + counter ++ ; + + } + + sprintf( stCounter , "%d" , counter ) ; + digitContainerString += newline ; + digitContainerString += "Number of Digits in this container : " ; + digitContainerString += stCounter ; + + + delete[] stCounter ; + delete[] nameOfContainer ; + + return digitContainerString ; + +} + +SG_ADD_BASE (LArRawSCContainer, DataVector<LArRawSC> ); diff --git a/LArCalorimeter/LArRawEvent/src/LArSCDigit.cxx b/LArCalorimeter/LArRawEvent/src/LArSCDigit.cxx new file mode 100755 index 0000000000000000000000000000000000000000..4c105b612bad5633d697cf108bbdf65e66558166 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/src/LArSCDigit.cxx @@ -0,0 +1,15 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArRawEvent/LArSCDigit.h" + +/** Destructor */ +LArSCDigit::~LArSCDigit() +{} + +/** default constructor for persistency */ +LArSCDigit::LArSCDigit() + : LArDigit(), + m_chan(0),m_sourceId(0) +{} diff --git a/LArCalorimeter/LArRawEvent/src/LArSCDigitContainer.cxx b/LArCalorimeter/LArRawEvent/src/LArSCDigitContainer.cxx new file mode 100755 index 0000000000000000000000000000000000000000..c8916bd8eb1292cc527c9638dadcbfac9a39c4b4 --- /dev/null +++ b/LArCalorimeter/LArRawEvent/src/LArSCDigitContainer.cxx @@ -0,0 +1,8 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArRawEvent/LArSCDigitContainer.h" + +LArSCDigitContainer::~LArSCDigitContainer() +{}