diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/ARA_selection.xml b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/ARA_selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..45ffc3caf9a2fb01afdb7ae47241360f765f3c60 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/ARA_selection.xml @@ -0,0 +1,33 @@ +<lcgdict> + + <class name="T_TPCnv<LArConditionsSubset<LArAutoCorrP1>, LArAutoCorrSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArOFCP1>, LArOFCSubset_p1 >"/> + + <class name="T_TPCnv<LArPedestalMC, LArPedestalMC_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArPedestalP1>, LArPedestalSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArRampP1>, LArRampSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArShapeP1>, LArShapeSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArShapeP2>, LArShapeSubset_p2 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArMphysOverMcalP1>, LArMphysOverMcalSubset_p1 >" /> + + <class name="T_TPCnv<LArConditionsSubset<LArSingleFloatP>, LArSingleFloatSubset_p1 >" /> + + <class name="T_TPCnv<LArConditionsSubset<LArOFCBinP>, LArSingleIntSubset_p1 > " /> + + <class name="T_TPCnv<LArConditionsSubset<LArCaliWaveVec>, LArCaliWaveSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArCaliWaveVec>, LArCaliWaveSubset_p2 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArPhysWave>, LArPhysWaveSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArDSPThresholdsP>, LArDSPThresholdsSubset_p1 >"/> + + <class name="T_TPCnv<LArConditionsSubset<LArPedestalP1>, LArPedestalSubset_p2 >"/> + +</lcgdict> diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..f2d5a71b610ab4f9aa4b0c8a5338c8fbc6af5b7b --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARAUTOCORRSUBSETCNV_P1_H +#define LARCONDTPCNV_LARAUTOCORRSUBSETCNV_P1_H + +#include "LArCondTPCnv/LArAutoCorrSubset_p1.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArAutoCorrP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArAutoCorrP1> LArAutoCorrTransType; +typedef LArAutoCorrSubset_p1 LArAutoCorrPersType; + +class LArAutoCorrSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArAutoCorrTransType, LArAutoCorrPersType > +{ +public: + + LArAutoCorrSubsetCnv_p1() {} + virtual void persToTrans(const LArAutoCorrPersType* persObj, LArAutoCorrTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArAutoCorrTransType* transObj, LArAutoCorrPersType* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArAutoCorrP1>, LArAutoCorrSubset_p1 > + : public LArAutoCorrSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..3210dbcd34d59d5343b9ac5eca274d1598c654b9 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArAutoCorrSubset_p1.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArAutoCorrSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArAutoCorrSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArAutoCorrSubset_p1.h,v 1.1 2007-12-03 18:35:31 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARAUTOCORRSUBSET_P1 +#define LARCONDTPCNV_LARAUTOCORRSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArAutoCorrSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArAutoCorr data. + * + * +**/ + +class LArAutoCorrSubset_p1 +{ + +public: + LArAutoCorrSubset_p1() + : m_vAutoCorrSize(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vAutoCorr; + unsigned int m_vAutoCorrSize; +}; + + +#endif // LARCONDTPCNV_LARAUTOCORRSUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..0c0838329a0813a74dba2a0c444bc3cdc1c7b99a --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARcaliWAVEsubsetCNV_P1_H +#define LARCONDTPCNV_LARcaliWAVEsubsetCNV_P1_H + +#include "LArCondTPCnv/LArCaliWaveSubset_p1.h" +#include "LArRawConditions/LArCaliWave.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArRawConditions/LArConditionsSubset.h" + +class MsgStream; + +typedef LArConditionsSubset<LArCaliWaveVec> LArCWTransType; +typedef LArCaliWaveSubset_p1 LArCWPersType; + +class LArCaliWaveSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArCWTransType, LArCWPersType > +{ +public: + + LArCaliWaveSubsetCnv_p1() {} + virtual void persToTrans(const LArCWPersType* persObj, LArCWTransType* transObj, MsgStream &log); + virtual void transToPers(const LArCWTransType* transObj, LArCWPersType* persObj, MsgStream &log); + +}; + +template<> +class T_TPCnv<LArCWTransType, LArCWPersType > + : public LArCaliWaveSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..9b2004a2b6981344efac19e269f2a32fe6a34083 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARcaliWAVEsubsetCNV_P2_H +#define LARCONDTPCNV_LARcaliWAVEsubsetCNV_P2_H + +#include "LArCondTPCnv/LArCaliWaveSubset_p2.h" +#include "LArRawConditions/LArCaliWave.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArRawConditions/LArConditionsSubset.h" + +class MsgStream; + +typedef LArConditionsSubset<LArCaliWaveVec> LArCWTransType; + +class LArCaliWaveSubsetCnv_p2 + : public T_AthenaPoolTPCnvBase<LArCWTransType, LArCaliWaveSubset_p2 > +{ +public: + + LArCaliWaveSubsetCnv_p2() {} + virtual void persToTrans(const LArCaliWaveSubset_p2* persObj, LArCWTransType* transObj, MsgStream &log); + virtual void transToPers(const LArCWTransType* transObj, LArCaliWaveSubset_p2* persObj, MsgStream &log); + +}; + +template<> +class T_TPCnv<LArCWTransType, LArCaliWaveSubset_p2 > + : public LArCaliWaveSubsetCnv_p2 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..6a6e37114b08b67d685a3038aa48f9654f8f3ede --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p1.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArCaliWaveSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArCaliWave + * + * @author Ilija Vukotic <ivukotic@cern.ch> + * + */ +#ifndef LARCONDTPCNV_LARCALIWAVESUBSET_P1 +#define LARCONDTPCNV_LARCALIWAVESUBSET_P1 + +/** + * @class LArCaliWaveSubset_p1 + * + * @brief persistent class container of + * LArCaliWave data. + * + * +**/ + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" +class LArCaliWaveSubset_p1 +{ + +public: + LArCaliWaveSubset_p1() + : m_samples(0) {} + LArConditionsSubset_p1 m_subset; // stores febIDs etc. + std::vector<float> m_dt; // one per channel + std::vector<float> m_vAmplitudes; // m_samples per channel + std::vector<float> m_vErrors; // m_samples per channel + std::vector<int> m_vTriggers; // m_samples per channel + std::vector<unsigned> m_flag; // one per channel + std::vector<int> m_DAC; + unsigned int m_samples; // usualy 768 per channel +}; + + +#endif // LARCONDTPCNV_LARWAVE_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..2f5a02bed8caaa4cf31cfbdf0ad623108d42eaad --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCaliWaveSubset_p2.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArCaliWaveSubset_p2.h + * + * @brief This file defines the class used for persistent container of + * LArCaliWave + * + * @author Ilija Vukotic <ivukotic@cern.ch> + * + */ +#ifndef LARCONDTPCNV_LARCALIWAVESUBSET_P2 +#define LARCONDTPCNV_LARCALIWAVESUBSET_P2 + +/** + * @class LArCaliWaveSubset_p2 + * + * @brief persistent class container of + * LArCaliWave data. + * + * +**/ + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" +class LArCaliWaveSubset_p2 +{ + +public: + LArCaliWaveSubset_p2() + : m_samples(0) {} + LArConditionsSubset_p1 m_subset; // stores febIDs etc.. + std::vector<float> m_dt; // one per channel + std::vector<float> m_vAmplitudes; // m_samples per channel + std::vector<float> m_vErrors; // m_samples per channel + std::vector<int> m_vTriggers; // m_samples per channel + std::vector<unsigned short> m_vDAC; // how many dac values per channel + std::vector<unsigned> m_flag; // one per channel + std::vector<int> m_DAC; // DAC values + unsigned int m_samples; // usualy 768 per channel +}; + + +#endif // LARCONDTPCNV_LARCALIWAVESUBSET_P2 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCondTPCnvDict.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCondTPCnvDict.h new file mode 100644 index 0000000000000000000000000000000000000000..13d22b25d23d0f281efe8bb5e96325c5e868b187 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArCondTPCnvDict.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARCONDTPCNVDICT_H +#define LARCONDTPCNV_LARCONDTPCNVDICT_H +/** + * @file LArCondTPCnvDict.h + * + * @brief Header file for dictionary generation + * + * @author <R.D.Schaffer@cern.ch> + */ + +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h" +#include "LArCondTPCnv/LArCaliWaveSubset_p1.h" +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h" +#include "LArCondTPCnv/LArCaliWaveSubset_p2.h" +#include "LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPhysWaveSubset_p1.h" +#include "LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h" +#include "LArCondTPCnv/LArAutoCorrSubset_p1.h" +#include "LArCondTPCnv/LArOFCSubsetCnv_p1.h" +#include "LArCondTPCnv/LArOFCSubset_p1.h" +#include "LArCondTPCnv/LArPedestalMCCnv_p1.h" +#include "LArCondTPCnv/LArPedestalMC_p1.h" +#include "LArCondTPCnv/LArPedestalSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPedestalSubset_p1.h" +#include "LArCondTPCnv/LArRampSubsetCnv_p1.h" +#include "LArCondTPCnv/LArRampSubset_p1.h" +#include "LArCondTPCnv/LArShapeSubsetCnv_p1.h" +#include "LArCondTPCnv/LArShapeSubsetCnv_p2.h" +#include "LArCondTPCnv/LArShapeSubset_p1.h" +#include "LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h" +#include "LArCondTPCnv/LArSingleFloatSubset_p1.h" +#include "LArCondTPCnv/LArOFCBinSubsetCnv_p1.h" +#include "LArCondTPCnv/LArSingleIntSubset_p1.h" +#include "LArCondTPCnv/LArMphysOverMcalSubset_p1.h" +#include "LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h" +#include "LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPedestalSubsetCnv_p2.h" +#include "LArCondTPCnv/LArPedestalSubset_p2.h" + + +struct dummy { + T_TPCnv<LArConditionsSubset<LArAutoCorrP1>, + LArAutoCorrSubset_p1 > m_autocorr_p1; + T_TPCnv<LArConditionsSubset<LArOFCP1>, + LArOFCSubset_p1 > m_ofc_p1; + T_TPCnv<LArPedestalMC, + LArPedestalMC_p1 > m_pedestalmc_p1; + T_TPCnv<LArConditionsSubset<LArPedestalP1>, + LArPedestalSubset_p1 > m_pedestal_p1; + T_TPCnv<LArConditionsSubset<LArRampP1>, + LArRampSubset_p1 > m_ramp_p1; + + T_TPCnv<LArConditionsSubset<LArShapeP1>, + LArShapeSubset_p1 > m_shape_p1; + + T_TPCnv<LArConditionsSubset<LArShapeP2>, + LArShapeSubset_p2 > m_shape_p2; + + T_TPCnv<LArConditionsSubset<LArMphysOverMcalP1>, + LArMphysOverMcalSubset_p1 > m_MphysOverMcal_p1; + + T_TPCnv<LArConditionsSubset<LArSingleFloatP>, + LArSingleFloatSubset_p1 > m_singleFloat_p1; + + T_TPCnv<LArConditionsSubset<LArOFCBinP>, + LArSingleIntSubset_p1 > m_ofcbin_p1; + + T_TPCnv<LArConditionsSubset<LArCaliWaveVec>, LArCaliWaveSubset_p1 > m_caliwave_p1; + T_TPCnv<LArConditionsSubset<LArCaliWaveVec>, LArCaliWaveSubset_p2 > m_caliwave_p2; + T_TPCnv<LArConditionsSubset<LArPhysWave>, LArPhysWaveSubset_p1 > m_physwave_p1; + + T_TPCnv<LArConditionsSubset<LArDSPThresholdsP>, LArDSPThresholdsSubset_p1 > m_dspthr_p1; + + + + + T_TPCnv<LArConditionsSubset<LArPedestalP1>, + LArPedestalSubset_p2 > m_pedestal_p2; + + +}; + +#endif // LARCONDTPCNV_LARCONDTPCNVDICT_H + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArConditionsSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArConditionsSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..bbe93f85196eeb5073561c269237c60ddfbb7309 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArConditionsSubset_p1.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArConditionsSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LAr conditions data + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArConditionsSubset_p1.h,v 1.2 2008-01-23 13:52:08 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARCONDITIONSSUBSET_P1_H +#define LARCONDTPCNV_LARCONDITIONSSUBSET_P1_H +/** + * @class LArConditionsSubset_p1 + * + * @brief persistent class container of LAr conditions data. Holds the + * generic information a LArConditionsSubset, i.e. not the details for + * each conditions object + * + * +**/ + +#include <vector> + +/// Size of channel vector, per FEB +enum Subset_size { + NCHANNELPERFEB = 128 +}; + +class LArConditionsSubset_p1 +{ +public: + + // LArConditionsSubset_p1 contain the persistent data for the + // set of LArConditionsSubsets for a given folder. + // + // Conditions data are normally organized by feb, identified by + // the febid. Each feb then has 128 channels of conditions data. + // In addition, there are corrections stored one per channel with + // their channel id. + // + // In certain cases, not all 128 channels will have conditions + // data. For normal conditions, space data may arise from channels + // that could not be treated, or other failures. For MC + // conditions, this data may be sparse due to the use of implied + // symmetry of the detector and so only a subset of febs and a + // subset of their channels are present. + // + // For the 'normal' dense set of conditions, it is sufficient to + // save the set of febids since the number of channels is known. + // + // For sparse conditions, we save both the febid and a bit map + // indicating which channels contain data. + // + // For corrections, we save separately the channel ids. + // + // + + /// Default constructor + LArConditionsSubset_p1( ) + : + m_gain(0), + m_channel(0), + m_groupingType(0) + {} + + std::vector<unsigned int> m_febIds; + std::vector<unsigned int> m_corrChannels; + std::vector<unsigned int> m_febsWithSparseData; + unsigned int m_gain; + unsigned int m_channel; + unsigned int m_groupingType; +}; + + + +#endif // LARCONDTPCNV_LARCONDITIONSSUBSET_P1_H diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..6243d987be14e442e4d15891ff41391871f16a79 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//Dear emacs, this is -*-c++-*- +#ifndef LARCONDTPCNV_LARDSPTHRESHOLDSCNV_P1_H +#define LARCONDTPCNV_LARDSPTHRESHOLDSCNV_P1_H + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArCondTPCnv/LArDSPThresholdsSubset_p1.h" +#include "LArRawConditions/LArDSPThresholdsP.h" + +class MsgStream; + +typedef LArConditionsSubset<LArDSPThresholdsP> DSPThresholdsTransType; +typedef LArDSPThresholdsSubset_p1 DSPThresholdsPersType; + +class LArDSPThresholdsSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<DSPThresholdsTransType,DSPThresholdsPersType> +{ +public: + + LArDSPThresholdsSubsetCnv_p1() {} + virtual void persToTrans(const DSPThresholdsPersType* persObj, DSPThresholdsTransType* transObj, MsgStream &log) ; + virtual void transToPers(const DSPThresholdsTransType* transObj, DSPThresholdsPersType* persObj, MsgStream &log) ; +}; + + + +template<> +class T_TPCnv<LArConditionsSubset<LArDSPThresholdsP>, LArDSPThresholdsSubset_p1> + : public LArDSPThresholdsSubsetCnv_p1 +{ +public: +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..001cf5bb789b900b9d4fa8beb9d415403da970dc --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArDSPThresholdsSubset_p1.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArDSPThresholdsSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArDSPThresholdsSubset + * + * @author Walter Lampl <walter.lampl@ cern.ch> + * + * $Id: LArDSPThresholdsSubset_p1.h,v 1.1 2008-10-08 14:03:50 wlampl Exp $ + */ +#ifndef LARCONDTPCNV_LARDSPTHRESHOLDSUBSET_P1_H +#define LARCONDTPCNV_LARDSPTHRESHOLDSUBSET_P1_H + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArDSPThresholdsSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArDSPThresholds data. + * + * +**/ + +class LArDSPThresholdsSubset_p1 +{ + +public: + LArDSPThresholdsSubset_p1() {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_tQThr; + std::vector<float> m_samplesThr; + std::vector<float> m_trigSumThr; + +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..5719026b70d9584f91aaf31e6e6cff20bc460128 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//Dear emacs, this is -*-c++-*- +#ifndef LARCONDTPCNV_LARSIMPLESUBSETCNV_P1_H +#define LARCONDTPCNV_LARSIMPLESUBSETCNV_P1_H + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArCondTPCnv/LArMphysOverMcalSubset_p1.h" +#include "LArRawConditions/LArMphysOverMcalP1.h" +#include "LArRawConditions/LArSingleFloatP.h" + +class MsgStream; + +typedef LArConditionsSubset<LArSingleFloatP> LArMpMcTransType; +typedef LArMphysOverMcalSubset_p1 LArMpMcPersType; + +class LArMphysOverMcalSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArMpMcTransType,LArMpMcPersType > +{ +public: + LArMphysOverMcalSubsetCnv_p1() {} + virtual void persToTrans(const LArMpMcPersType* persObj, LArMpMcTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArMpMcTransType* transObj, LArMpMcPersType* persObj, MsgStream &log) ; +}; + + +template<> +class T_TPCnv<LArConditionsSubset<LArSingleFloatP> ,LArMphysOverMcalSubset_p1> + : public LArMphysOverMcalSubsetCnv_p1 +{ +public: +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArMphysOverMcalP1> ,LArMphysOverMcalSubset_p1> + : public LArMphysOverMcalSubsetCnv_p1 +{ +public: +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..6fb0f141fa3793cd55035dfe9b70bbb54afbda99 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArMphysOverMcalSubset_p1.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArMphysOverMcalSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArMphysOverMcalSubset + * + * @author Walter Lampl <walter.lampl@ cern.ch> + * + * $Id: LArMphysOverMcalSubset_p1.h,v 1.1 2008-01-25 17:38:29 wlampl Exp $ + */ +#ifndef LARCONDTPCNV_LARSMPHYSOVERMCALSUBSET_P1 +#define LARCONDTPCNV_LARSMPHYSOVERMCALSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArMphysOverMcalSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArMphysOverMcal data. + * + * +**/ + +class LArMphysOverMcalSubset_p1 +{ + +public: + LArMphysOverMcalSubset_p1() {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_values; +}; + + +#endif // LARCONDTPCNV_LARSHAPESUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCBinSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCBinSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..af570f54246f2ab2da10edf336a97006e56b533b --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCBinSubsetCnv_p1.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//Dear emacs, this is -*-c++-*- +#ifndef LARCONDTPCNV_LAROFCBINSUBSETCNV_P1_H +#define LARCONDTPCNV_LAROFCBINSUBSETCNV_P1_H + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArCondTPCnv/LArSingleIntSubset_p1.h" +#include "LArRawConditions/LArOFCBinP.h" + +class MsgStream; + +typedef LArConditionsSubset<LArOFCBinP> OFCBinTransType; +typedef LArSingleIntSubset_p1 OFCBinPersType; + +class LArOFCBinSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<OFCBinTransType,OFCBinPersType> +{ +public: + + LArOFCBinSubsetCnv_p1() {} + virtual void persToTrans(const OFCBinPersType* persObj, OFCBinTransType* transObj, MsgStream &log) ; + virtual void transToPers(const OFCBinTransType* transObj, OFCBinPersType* persObj, MsgStream &log) ; +}; + + + +template<> +class T_TPCnv<LArConditionsSubset<LArOFCBinP>, LArSingleIntSubset_p1> + : public LArOFCBinSubsetCnv_p1 +{ +public: +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..61e34ec3a8edc631c79ae092dec181d371420389 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LAROFCSUBSETCNV_P1_H +#define LARCONDTPCNV_LAROFCSUBSETCNV_P1_H + +#include "LArCondTPCnv/LArOFCSubset_p1.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArOFCP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArOFCP1> LArOFCTransType; +typedef LArOFCSubset_p1 LArOFCPersType; + +class LArOFCSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArOFCTransType, LArOFCPersType > +{ +public: + + LArOFCSubsetCnv_p1() {} + virtual void persToTrans(const LArOFCPersType* persObj, LArOFCTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArOFCTransType* transObj, LArOFCPersType* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArOFCP1>, LArOFCSubset_p1 > + : public LArOFCSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..3ce1416e8fd076cc0ad19e8198f1844b784a4772 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArOFCSubset_p1.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArOFCSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArOFCSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArOFCSubset_p1.h,v 1.1 2008-01-23 13:52:08 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LAROFCSUBSET_P1 +#define LARCONDTPCNV_LAROFCSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArOFCSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArOFC data. + * + * +**/ + +class LArOFCSubset_p1 +{ + +public: + LArOFCSubset_p1() + : m_nPhases(0), m_nSamples(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vOFC_a; + std::vector<float> m_vOFC_b; + std::vector<float> m_timeOffset; + std::vector<float> m_timeBinWidth; + unsigned int m_nPhases; + unsigned int m_nSamples; +}; + + +#endif // LARCONDTPCNV_LAROFCSUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMCCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMCCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..28338e4dc15a287593d2e0f08510dd91dfb8df4e --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMCCnv_p1.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARPEDESTALMCCNV_P1_H +#define LARCONDTPCNV_LARPEDESTALMCCNV_P1_H + +#include "LArCondTPCnv/LArPedestalMC_p1.h" +#include "LArRawConditions/LArPedestalMC.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArPedestalMC LArPedMCTransType; +typedef LArPedestalMC_p1 LArPedMCPersType; + +class LArPedestalMCCnv_p1 + : public T_AthenaPoolTPCnvBase<LArPedMCTransType, LArPedMCPersType > +{ +public: + + LArPedestalMCCnv_p1() {} + virtual void persToTrans(const LArPedMCPersType* persObj, LArPedMCTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArPedMCTransType* transObj, LArPedMCPersType* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArPedestalMC, LArPedestalMC_p1 > + : public LArPedestalMCCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMC_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMC_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..ea35dc44bc72ca78e146a9eff1e0d26c25112814 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalMC_p1.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArPedestalMC_p1.h + * + * @brief This file defines the class used for persistent container of + * LArPedestalMC + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArPedestalMC_p1.h,v 1.1 2008-01-23 13:52:08 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARPEDESTALMC_P1 +#define LARCONDTPCNV_LARPEDESTALMC_P1 + +/** + * @class LArPedestalMC_p1 + * + * @brief persistent class container of LArConditionsMC for + * LArPedestal data. + * + * +**/ + +class LArPedestalMC_p1 +{ + +public: + LArPedestalMC_p1() {} + std::vector<float> m_vPedestal; + std::vector<float> m_vPedestalRMS; +}; + + +#endif // LARCONDTPCNV_LARPEDESTALMC_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..8770bfbe8e5fd9ac051ff76964c2372281779c4d --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARPEDESTALSUBSETCNV_P1_H +#define LARCONDTPCNV_LARPEDESTALSUBSETCNV_P1_H + +#include "LArCondTPCnv/LArPedestalSubset_p1.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArPedestalP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArPedestalP1> LArPedestalTransType; +typedef LArPedestalSubset_p1 LArPedestalPersType; + +class LArPedestalSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArPedestalTransType, LArPedestalPersType > +{ +public: + + LArPedestalSubsetCnv_p1() {} + virtual void persToTrans(const LArPedestalPersType* persObj, LArPedestalTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArPedestalTransType* transObj, LArPedestalPersType* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArPedestalP1>, LArPedestalSubset_p1 > + : public LArPedestalSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..b65b73a28a8500088503dd191d16e06ef5cad8e9 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubsetCnv_p2.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARPEDESTALSUBSETCNV_P2_H +#define LARCONDTPCNV_LARPEDESTALSUBSETCNV_P2_H + +#include "LArCondTPCnv/LArPedestalSubset_p2.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArPedestalP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArPedestalP1> LArPedestalTransType; + +class LArPedestalSubsetCnv_p2 + : public T_AthenaPoolTPCnvBase<LArPedestalTransType, LArPedestalSubset_p2 > +{ +public: + + LArPedestalSubsetCnv_p2() {} + virtual void persToTrans(const LArPedestalSubset_p2* persObj, LArPedestalTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArPedestalTransType* transObj, LArPedestalSubset_p2* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArPedestalP1>, LArPedestalSubset_p2 > + : public LArPedestalSubsetCnv_p2 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..391346f7fae08a69d29c0f5ea564517cb3c88793 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p1.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArPedestalSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArPedestalSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArPedestalSubset_p1.h,v 1.1 2007-12-03 18:35:32 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARPEDESTALSUBSET_P1 +#define LARCONDTPCNV_LARPEDESTALSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArPedestalSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArPedestal data. + * + * +**/ + +class LArPedestalSubset_p1 +{ + +public: + LArPedestalSubset_p1() + : m_vPedestalSize(0), m_vPedestalRMSSize(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vPedestal; + std::vector<float> m_vPedestalRMS; + unsigned int m_vPedestalSize; + unsigned int m_vPedestalRMSSize; +}; + + +#endif // LARCONDTPCNV_LARPEDESTALSUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..7a8b7766c7c6804cc0cb4ad34a5a7cf5d3009ceb --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPedestalSubset_p2.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArPedestalSubset_p2.h + * + * @brief This file defines the class used for persistent container of + * LArPedestalSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArPedestalSubset_p2.h,v 1.1 2009-04-27 15:22:43 gunal Exp $ + */ +#ifndef LARCONDTPCNV_LARPEDESTALSUBSET_P2 +#define LARCONDTPCNV_LARPEDESTALSUBSET_P2 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArPedestalSubset_p2 + * + * @brief persistent class container of LArConditionsSubset for + * LArPedestal data. + * + * +**/ + +class LArPedestalSubset_p2 +{ + +public: + LArPedestalSubset_p2() {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vPedestal; + std::vector<float> m_vPedestalRMS; +}; + + +#endif // LARCONDTPCNV_LARPEDESTALSUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..b0d04fd935c2a8ff133cba5955a342afbeb2bab1 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARphysWAVEsubsetCNV_P1_H +#define LARCONDTPCNV_LARphysWAVEsubsetCNV_P1_H + +#include "LArCondTPCnv/LArPhysWaveSubset_p1.h" +#include "LArRawConditions/LArPhysWave.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArRawConditions/LArConditionsSubset.h" + +class MsgStream; + +typedef LArConditionsSubset<LArPhysWave> LArPWTransType; +typedef LArPhysWaveSubset_p1 LArPWPersType; + +class LArPhysWaveSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArPWTransType, LArPWPersType > +{ +public: + + LArPhysWaveSubsetCnv_p1() {} + virtual void persToTrans(const LArPWPersType* persObj, LArPWTransType* transObj, MsgStream &log); + virtual void transToPers(const LArPWTransType* transObj, LArPWPersType* persObj, MsgStream &log); + +}; + +template<> +class T_TPCnv<LArPWTransType, LArPWPersType > + : public LArPhysWaveSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..0833b05e60049c1ff0a78fe65413508bb7ff0f03 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArPhysWaveSubset_p1.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArPhysWaveSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArPhysWave + * + * @author Ilija Vukotic <ivukotic@cern.ch> + * + */ +#ifndef LARCONDTPCNV_LARPhysWaveSUBSET_P1 +#define LARCONDTPCNV_LARPhysWaveSUBSET_P1 + +/** + * @class LArPhysWaveSubset_p1 + * + * @brief persistent class container of + * LArPhysWave data. + * + * +**/ + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" +class LArPhysWaveSubset_p1 +{ + +public: + LArPhysWaveSubset_p1() + : m_samples(0) {} + LArConditionsSubset_p1 m_subset; // stores febIDs etc. + std::vector<float> m_dt; // one per channel - from LArWave + std::vector<float> m_vAmplitudes; // m_samples per channel - from LArWave + std::vector<float> m_vErrors; // m_samples per channel - from LArWaveCumul + std::vector<int> m_vTriggers; // m_samples per channel - from LArWaveCumul + std::vector<unsigned> m_flag; // one per channel - from LArWave + std::vector<int> m_timeOffset; // one per channel - from LArPhysWave + + unsigned int m_samples; // per channel +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..3c5117a7b43c3e86d8b94cb1f60d1396f50f6901 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARRAMPSUBSETCNV_P1_H +#define LARCONDTPCNV_LARRAMPSUBSETCNV_P1_H + +#include "LArCondTPCnv/LArRampSubset_p1.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArRampP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArRampP1> LArRampTransType; +typedef LArRampSubset_p1 LArRampPersType; + +class LArRampSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArRampTransType, LArRampPersType > +{ +public: + + LArRampSubsetCnv_p1() {} + virtual void persToTrans(const LArRampPersType* persObj, LArRampTransType* transObj, MsgStream &log) ; + virtual void transToPers(const LArRampTransType* transObj, LArRampPersType* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArRampP1>, LArRampSubset_p1 > + : public LArRampSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..65484164ea213670c15e5359d0878aaf5f1a5130 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArRampSubset_p1.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArRampSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArRampSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArRampSubset_p1.h,v 1.1 2007-12-03 18:35:32 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARRAMPSUBSET_P1 +#define LARCONDTPCNV_LARRAMPSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArRampSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArRamp data. + * + * +**/ + +class LArRampSubset_p1 +{ + +public: + LArRampSubset_p1() + : m_vRampSize(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vRamp; + unsigned int m_vRampSize; +}; + + +#endif // LARCONDTPCNV_LARRAMPSUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..b646441a44a0659368dbb40c7cd48a53f26a6676 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p1.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARSHAPESUBSETCNV_P1_H +#define LARCONDTPCNV_LARSHAPESUBSETCNV_P1_H + +#include "LArCondTPCnv/LArShapeSubset_p1.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArShapeP1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArShapeP1> LArShapeTransType1; +typedef LArShapeSubset_p1 LArShapePersType1; + +class LArShapeSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<LArShapeTransType1, LArShapePersType1 > +{ +public: + + LArShapeSubsetCnv_p1() {} + virtual void persToTrans(const LArShapePersType1* persObj, LArShapeTransType1* transObj, MsgStream &log) ; + virtual void transToPers(const LArShapeTransType1* transObj, LArShapePersType1* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArShapeP1>, LArShapeSubset_p1 > + : public LArShapeSubsetCnv_p1 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..e4fd6378ef64b187828e3bfa6701d1aba72dcee5 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubsetCnv_p2.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARCONDTPCNV_LARSHAPESUBSETCNV_P2_H +#define LARCONDTPCNV_LARSHAPESUBSETCNV_P2_H + +#include "LArCondTPCnv/LArShapeSubset_p2.h" +#include "LArRawConditions/LArConditionsSubset.h" +#include "LArRawConditions/LArShapeP2.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + +typedef LArConditionsSubset<LArShapeP2> LArShapeTransType2; +typedef LArShapeSubset_p2 LArShapePersType2; + +class LArShapeSubsetCnv_p2 + : public T_AthenaPoolTPCnvBase<LArShapeTransType2, LArShapePersType2 > +{ +public: + + LArShapeSubsetCnv_p2() {} + virtual void persToTrans(const LArShapePersType2* persObj, LArShapeTransType2* transObj, MsgStream &log) ; + virtual void transToPers(const LArShapeTransType2* transObj, LArShapePersType2* persObj, MsgStream &log) ; + +}; + +template<> +class T_TPCnv<LArConditionsSubset<LArShapeP2>, LArShapeSubset_p2 > + : public LArShapeSubsetCnv_p2 +{ +public: +}; + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..662efa48790b9f0e3eac6cecb4c6ef181d3357a3 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p1.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArShapeSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArShapeSubset + * + * @author RD Schaffer <R.D.Schaffer@cern.ch> + * + * $Id: LArShapeSubset_p1.h,v 1.1 2007-10-26 16:13:34 schaffer Exp $ + */ +#ifndef LARCONDTPCNV_LARSHAPESUBSET_P1 +#define LARCONDTPCNV_LARSHAPESUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArShapeSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArShape data. + * + * +**/ + +class LArShapeSubset_p1 +{ + +public: + LArShapeSubset_p1() + : m_vShapeSize(0), m_vShapeDerSize(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vShape; + std::vector<float> m_vShapeDer; + unsigned int m_vShapeSize; + unsigned int m_vShapeDerSize; +}; + + +#endif // LARCONDTPCNV_LARSHAPESUBSET_P1 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p2.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..f911baeb24cacaf181e2486a5906f16c5a92f1cc --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArShapeSubset_p2.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArShapeSubset_p2.h + * + * @brief This file defines the class used for persistent container of + * LArShapeSubset + * + * @author Marco Delmastro <Marco.Delmastro@cern.ch> + * + * $Id: LArShapeSubset_p2.h,v 1.1 2008-06-19 10:14:53 mdelmast Exp $ + */ +#ifndef LARCONDTPCNV_LARSHAPESUBSET_P2 +#define LARCONDTPCNV_LARSHAPESUBSET_P2 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArShapeSubset_p2 + * + * @brief persistent class container of LArConditionsSubset for + * LArShape data. + * + * +**/ + +class LArShapeSubset_p2 +{ + +public: + LArShapeSubset_p2() + : m_nPhases(0), m_nSamples(0) {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_vShape; + std::vector<float> m_vShapeDer; + std::vector<float> m_timeOffset; + std::vector<float> m_timeBinWidth; + unsigned int m_nPhases; + unsigned int m_nSamples; +}; + + +#endif // LARCONDTPCNV_LARSHAPESUBSET_P2 diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..337490ffee10be9f3b6e99e532205489791c0955 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//Dear emacs, this is -*-c++-*- +#ifndef LARCONDTPCNV_LARSINGLEFLOATSUBSETCNV_P1_H +#define LARCONDTPCNV_LARSINGLEFLOATSUBSETCNV_P1_H + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "LArCondTPCnv/LArSingleFloatSubset_p1.h" +#include "LArRawConditions/LArSingleFloatP.h" + +class MsgStream; + +typedef LArConditionsSubset<LArSingleFloatP> SingleFloatTransType; +typedef LArSingleFloatSubset_p1 SingleFloatPersType; + +class LArSingleFloatSubsetCnv_p1 + : public T_AthenaPoolTPCnvBase<SingleFloatTransType,SingleFloatPersType> +{ +public: + + LArSingleFloatSubsetCnv_p1() {} + virtual void persToTrans(const SingleFloatPersType* persObj, SingleFloatTransType* transObj, MsgStream &log) ; + virtual void transToPers(const SingleFloatTransType* transObj, SingleFloatPersType* persObj, MsgStream &log) ; +}; + + + +template<> +class T_TPCnv<LArConditionsSubset<LArSingleFloatP>, LArSingleFloatSubset_p1> + : public LArSingleFloatSubsetCnv_p1 +{ +public: +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..57a67d2ae954a8bae2ca9838a11168c8acb27ce6 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleFloatSubset_p1.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArSingleFloatSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArSingleFloatSubset + * + * @author Walter Lampl <walter.lampl@ cern.ch> + * + * $Id: LArSingleFloatSubset_p1.h,v 1.1 2008-04-10 13:04:48 wlampl Exp $ + */ +#ifndef LARCONDTPCNV_LARSINGLEFLOATSUBSET_P1 +#define LARCONDTPCNV_LARSINGLEFLOATSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArSingleFloatSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArSingleFloat data. + * + * +**/ + +class LArSingleFloatSubset_p1 +{ + +public: + LArSingleFloatSubset_p1() {} + LArConditionsSubset_p1 m_subset; + std::vector<float> m_values; +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleIntSubset_p1.h b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleIntSubset_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..1343c5f117b66e833480e1808e331464a9af1ed1 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/LArSingleIntSubset_p1.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file LArSingleIntSubset_p1.h + * + * @brief This file defines the class used for persistent container of + * LArSingleIntSubset + * + * @author Walter Lampl <walter.lampl@ cern.ch> + * + * $Id: LArSingleIntSubset_p1.h,v 1.1 2008-03-31 15:41:26 wlampl Exp $ + */ +#ifndef LARCONDTPCNV_LARSINGLEINTSUBSET_P1 +#define LARCONDTPCNV_LARSINGLEINTSUBSET_P1 + +#include "LArCondTPCnv/LArConditionsSubset_p1.h" + +/** + * @class LArSingleIntSubset_p1 + * + * @brief persistent class container of LArConditionsSubset for + * LArSingleInt data. + * + * +**/ + +class LArSingleIntSubset_p1 +{ + +public: + LArSingleIntSubset_p1() {} + LArConditionsSubset_p1 m_subset; + std::vector<int> m_values; +}; + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/OLD_selection.xml b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/OLD_selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae43349385a4b4c722d0bb23532794b516a4d549 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/OLD_selection.xml @@ -0,0 +1,7 @@ +<lcgdict> + + <class name="LArShapeSubset_p1" id="95B61750-4C45-412D-B4D4-9758E9DB40D1" /> + <class name="LArCaliWaveSubset_p1" id="9E61BE2D-3274-4459-A5C2-3BBFB7056EBA" /> + <class name="LArPedestalSubset_p1" id="E365F747-264B-4A0C-B80A-570DBE099881" /> + +</lcgdict> diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/selection.xml b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..1de804b4d28cd3629077cf5be71f4deb456677fb --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/LArCondTPCnv/selection.xml @@ -0,0 +1,15 @@ +<lcgdict> + <class name="LArConditionsSubset_p1" /> + <class name="LArAutoCorrSubset_p1" id="FA16A69D-241E-40F3-B710-77A95937E394" /> + <class name="LArOFCSubset_p1" id="0A1DE2E2-90E4-4A24-BC6E-2092EDC9FDF6" /> + <class name="LArPedestalMC_p1" id="3891D5E0-82D1-45AB-97B1-CE4CF25D6E16" /> + <class name="LArRampSubset_p1" id="BB629283-BDF5-4FA8-93F4-5D8C2F201364" /> + <class name="LArShapeSubset_p2" id="5139AF4A-5947-421A-A775-B2D1134145C7" /> + <class name="LArMphysOverMcalSubset_p1" id="60FB956A-0B7F-450E-BF6A-2A0B8ED55204" /> + <class name="LArSingleFloatSubset_p1" id="85C3E380-4F5C-4F2B-81F0-D7C08A446800" /> + <class name="LArSingleIntSubset_p1" id="E7E2E993-4AF2-4782-9B8B-7668434CBAEC" /> + <class name="LArCaliWaveSubset_p2" id="6CF01BBF-85A9-45FA-B321-6A98B0D719FB" /> + <class name="LArPhysWaveSubset_p1" id="87E436E2-6FF4-42D3-BC70-6650C076E589" /> + <class name="LArDSPThresholdsSubset_p1" id="09607438-09CC-4E40-A1E2-23F0B021DF3D" /> + <class name="LArPedestalSubset_p2" id="8BD3FE69-A3C4-418C-ACB9-E362CE524353" /> +</lcgdict> diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/cmt/requirements b/LArCalorimeter/LArCnv/LArCondTPCnv/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..4155a975206d9d9392c7a54889a282950321e9c8 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/cmt/requirements @@ -0,0 +1,28 @@ +package LArCondTPCnv + +author RD Schaffer <R.D.Schaffer@cern.ch> +author Walter Lampl <Walter.Lampl@cern.ch> + +use AtlasPolicy AtlasPolicy-* +use AtlasReflex AtlasReflex-* External + +use AthenaPoolCnvSvc AthenaPoolCnvSvc-* Database/AthenaPOOL + +use LArRawConditions LArRawConditions-* LArCalorimeter + + + +library LArCondTPCnv *.cxx +apply_pattern tpcnv_library + +apply_pattern lcgdict dict=LArCondTPCnv selectionfile=selection.xml headerfiles="../LArCondTPCnv/LArCondTPCnvDict.h" +apply_pattern lcgdict dict=ARA_LArCondTPCnv selectionfile=ARA_selection.xml headerfiles="../LArCondTPCnv/LArCondTPCnvDict.h" +apply_pattern lcgdict dict=OLD_LArCondTPCnv selectionfile=OLD_selection.xml headerfiles="../LArCondTPCnv/LArCondTPCnvDict.h" + +private +use AthenaKernel AthenaKernel-* Control +use LArElecCalib LArElecCalib-* LArCalorimeter + +#macro cppdebugflags '$(cppdebugflags_s)' +#macro_remove componentshr_linkopts "-Wl,-s" + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/CopyFloatWithErrorcode.h b/LArCalorimeter/LArCnv/LArCondTPCnv/src/CopyFloatWithErrorcode.h new file mode 100644 index 0000000000000000000000000000000000000000..c6cb357286fad18e977500afa6ca00cfab6b078f --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/CopyFloatWithErrorcode.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//Dear emacs, this is -*-c++-*- +#ifndef COPYFLOATWITHERRORCODE_H +#define COPYFLOATWITHERRORCODE_H + +/** + * @file CopyFloatWithErrorcode.h + * @brief Copies a single float from a persistent LAr calibration object, protected against roundoff errors + * @author Walter Lampl <walter.lampl@cern.ch> + * $Id: CopyFloatWithErrorcode.h,v 1.1 2009-04-27 15:22:44 gunal Exp $ + */ + +#include "LArElecCalib/LArCalibErrorCode.h" +#include <math.h> + +//A copy rountine to get floats from persistency, +// protected against roundoff problems and nans +inline float copyFloatPT(const float& pers) { + //Protect against rounding effects and nans. + if (std::isnan(pers) || pers<=1.0+LArElecCalib::ERRORCODE) + return (float)LArElecCalib::ERRORCODE; + else + return pers; +} + + +#endif diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArAutoCorrSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArAutoCorrSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fde89a6c664bb8e59ee9f90711dee6cef6cf730a --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArAutoCorrSubsetCnv_p1.cxx @@ -0,0 +1,342 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h" + +void +LArAutoCorrSubsetCnv_p1::persToTrans(const LArAutoCorrPersType* persObj, + LArAutoCorrTransType* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nAutoCorrs = persObj->m_vAutoCorrSize; + unsigned int autocorrIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty autocorr vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData] ) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has autocorrs - loop over autocorrs per channel + // and copy to the persistent object + + // check indexes + if (autocorrIndex >= persObj->m_vAutoCorr.size()) { + log << MSG::ERROR + << "LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size " + << autocorrIndex << " " << persObj->m_vAutoCorr.size() << " " + << endreq; + return; + } + + // This channel has autocorrs, resize vectors + transObj->m_subset[i].second[j].m_vAutoCorr.resize(nAutoCorrs); + + for (unsigned int k = 0; k < persObj->m_vAutoCorrSize; ++k){ + transObj->m_subset[i].second[j].m_vAutoCorr[k] = persObj->m_vAutoCorr[autocorrIndex]; + autocorrIndex++; + } + } + +// static unsigned int nch1 = 0; +// ++nch1; +// std::cout << "persToTrans - i, j, copy " << i << " " << j << " " +// << copyChannel << " " << nch1 +// << " hasSparseData " << hasSparseData +// << " chansSet, chansOffset, ifebWithData " << std::hex +// << chansSet << std::dec << " " << chansOffset << " " << ifebWithData +// << " febids " << febid << " " +// << sparseFebid +// << std::endl; + + } + } + + // Copy corrections + + if (ncorrs) { + // corrs exist - resize vector + std::vector<float> vAutoCorr(nAutoCorrs,0.0); + LArAutoCorrP1 larAutoCorrP1(vAutoCorr); + + transObj->m_correctionVec.resize(ncorrs, LArAutoCorrTransType::CorrectionPair(0, larAutoCorrP1)); + } + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (autocorrIndex >= persObj->m_vAutoCorr.size()) { + log << MSG::ERROR + << "LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size " + << autocorrIndex << " " << persObj->m_vAutoCorr.size() << " " + << endreq; + return; + } + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + // Loop over autocorrs per channel + for (unsigned int k = 0; k < persObj->m_vAutoCorrSize; ++k){ + transObj->m_correctionVec[i].second.m_vAutoCorr[k] = persObj->m_vAutoCorr[autocorrIndex]; + autocorrIndex++; + } + } + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + +} + + + + +void +LArAutoCorrSubsetCnv_p1::transToPers(const LArAutoCorrTransType* transObj, + LArAutoCorrPersType* persObj, + MsgStream &log) +{ + + // Copy conditions + + // We copy all autocorrs into a single vector. + // For the conditions, there are two situations to treat: + // 1) dense data: normal conditions where each feb has 128 + // channels and all channels have data, + // 2) sparse data: conditions data where some channels are + // missing data. This is true for MC conditions (only some + // channels have data, and symmetry is used to obtain + // conditions for the rest of the channels), as well for + // 'normal' conditions it may happen that some channels may + // be missing data. + // + // Treating 1) is straight-forward. For 2) we need to keep track + // of which channels are present. We do so with + // m_subset.m_febsWithSparseData where we store the febid followed by + // four unsigned ints which contain the full bit pattern of the + // channels set (i.e. bits 0-127). + // + // Note that one may also have a subset with all channels missing + // data. In this case, we do not write out the empty subset. + // + // Finally, for corrections, we save the channel ids in + // m_subset.m_corrChannels and the autocorrs in the same vectors as + // the rest of the conditions data. + // + // For each channel with data, the number of autocorrs is assumed + // constant. This is calculated at the beginning, along with + // whether a feb is sparse or not. + // + + // Get the number of channels, corrections and the size of autocorr + unsigned int nfebs = transObj->m_subset.size(); + unsigned int nsubsetsNotEmpty = 0; + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nchans = 0; + unsigned int nAutoCorrs = 0; + bool foundNAutoCorrs = false; + std::vector<unsigned int> febsWithSparseData; + + // Find the number of autocorrs and check for sparse conditions, + // e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArAutoCorrSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + + // Loop over channels and check if this subset has sparse data + bool subsetIsSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { + const LArAutoCorrP1& autocorr = transObj->m_subset[i].second[j]; + if (autocorr.m_vAutoCorr.size() == 0) { + if (!subsetIsSparse) { + // save febids for sparse subsets + subsetIsSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first); + } + } + else { + nchans++; // count number of channels + if (!foundNAutoCorrs) { + // Save the number of autocorrs and derivatives from first channels present + nAutoCorrs = autocorr.m_vAutoCorr.size(); + foundNAutoCorrs = true; + } + } + } + } + if (!foundNAutoCorrs && ncorrs>0) { + // Save the number of autocorrs and derivatives from first + // correct - couldn't find it from channels + const LArAutoCorrP1& autocorr = transObj->m_correctionVec[0].second; + nAutoCorrs = autocorr.m_vAutoCorr.size(); + } + // Save sizes + persObj->m_vAutoCorrSize = nAutoCorrs; + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + unsigned int nAutoCorrsTot = (nchans + ncorrs)*nAutoCorrs; + persObj->m_vAutoCorr.reserve(nAutoCorrsTot); + + // For subsets with sparse data, reserve space for identifying + // channels written out: + // 1 - febid + // 4 - for 128 bits (4*32) + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); + + // Copy conditions in subset + unsigned int isparse = 0; + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + + + bool isSparse = false; + if (isparse < febsWithSparseData.size() && + febsWithSparseData[isparse] == febid) { + // sparse subset, save channels with data + isparse++; + isSparse = true; + // save febid + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + // Now loop over channels and save autocorrs and channel number + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveAutoCorrs = true; + if (isSparse) { + // subset with sparse data + + if (transObj->m_subset[i].second[j].m_vAutoCorr.size() > 0) { + // store the channel number in bit map + if (j < chansOffset || (j - chansOffset) > 31) { + log << MSG::ERROR + << "LArAutoCorrSubsetCnv_p1::transToPers - incorrect channel indexing: j, chansOffset: " << j << " " << chansOffset + << endreq; + } + chansSet |= (1 << (j - chansOffset)); + } + else { + saveAutoCorrs = false; + } + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; + } + } + if (saveAutoCorrs) { + // save autocorrs + bool tooSmall=false; + for (unsigned int k = 0; k < nAutoCorrs; ++k){ + if (k>=transObj->m_subset[i].second[j].m_vAutoCorr.size()) { + persObj->m_vAutoCorr.push_back(0.); + tooSmall=true; + } + else + persObj->m_vAutoCorr.push_back(transObj->m_subset[i].second[j].m_vAutoCorr[k]); + } + if (tooSmall) + log << MSG::ERROR << "Feb 0x" << std::hex << febid << std::dec << " channel " << j <<": AutoCorr object too small. Expected " + << nAutoCorrs << " entries. Padded with 0.0" << endreq; + } +// static unsigned int nch = 0; +// ++nch; +// std::cout << "transToPers - i, j, save " << i << " " << j << " " +// << saveAutoCorrs << " " << nch << " febid " << febid +// << " chansSet " << std::hex << chansSet << std::dec +// << " chansOffset " << chansOffset +// << std::endl; + + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // AutoCorrs + bool tooSmall=false; + for (unsigned int k = 0; k < nAutoCorrs; ++k){ + if (k>=transObj->m_correctionVec[i].second.m_vAutoCorr.size()) { + persObj->m_vAutoCorr.push_back(0.); + tooSmall=true; + } + else + persObj->m_vAutoCorr.push_back(transObj->m_correctionVec[i].second.m_vAutoCorr[k]); + } + if (tooSmall) + log << MSG::ERROR << "Correction index "<< i <<"(channel 0x" << std::hex << transObj->m_correctionVec[i].first << std::dec << + "): AutoCorr object too small. Expected " << nAutoCorrs << " entries. Padded with 0.0" << endreq; + } + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ca3c4330f2332b6fd42276090bf68ce02730f220 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p1.cxx @@ -0,0 +1,311 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h" + + +void +LArCaliWaveSubsetCnv_p1::persToTrans(const LArCWPersType* persObj, LArCWTransType* transObj, MsgStream & log){ + + log<<MSG::DEBUG<<" LArCaliWaveSubsetCNV_p1 begin persToTrans"<<endreq; + + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + + log<<MSG::DEBUG<<"Total febs:"<<nfebids<<endreq; + + transObj->m_subset.resize(nfebids); + + unsigned int waveIndex = 0; + unsigned int chIndex = 0; + + unsigned int febid = 0; // Loop over febs + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + //std::cout<<"\nfeb index:"<<i; + + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; // Set febid + // std::cout<<"\tfebID: "<<febid<<std::endl; + + transObj->m_subset[i].second.resize(NCHANNELPERFEB);// Fill channels with empty calowavevec's +// std::cout<<"test"<<std::endl; + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + hasSparseData = true;// Found feb with sparse data + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // log<<MSG::DEBUG<<" Feb sparse? -> "<< hasSparseData <<endreq; + + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + copyChannel = false;// Channel is missing data - skip + // std::cout<<"0"; + } +// else std::cout<<"1"; + + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; +// std::cout<<" "; + } + } + + if (copyChannel) { // This channel has wave, resize vectors + LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; // what is this for? + double time =persObj->m_dt[chIndex]; + unsigned int f =persObj->m_flag[chIndex]; + int dac =persObj->m_DAC[chIndex]; + chIndex++; + std::vector<double> val; + std::vector<double> err; + std::vector<int> tri; + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArCaliWave cv(val,err,tri, time,dac, f); + val.clear(); + err.clear(); + tri.clear(); + + CWV.push_back(cv); + } + } // loop on channels +// std::cout<<std::endl; + } // loop on FEBs + + + //log<<MSG::DEBUG << "entering corr reading, ncorr=" << ncorrs << " waveIndex=" << waveIndex << " size=" << persObj->m_vAmplitudes.size() << endreq; + transObj->m_correctionVec.resize(ncorrs); + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (chIndex >= persObj->m_dt.size()) { + log << MSG::ERROR + << "LArCaliWaveSubsetCnv_p1::persToTrans - CaliWave index too large: WaveIndex/sizeInFile " + << chIndex << " " << persObj->m_dt.size() << " " + << endreq; + return; + } + + + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + LArCaliWaveVec& CWV = transObj->m_correctionVec[i].second; + + double time = persObj->m_dt[chIndex]; + unsigned int f = persObj->m_flag[chIndex]; + int dac = persObj->m_DAC[chIndex]; + chIndex++; + std::vector<double> val; + std::vector<double> err; + std::vector<int> tri; + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + if (waveIndex>=persObj->m_vAmplitudes.size()) + log << MSG::ERROR << "Persistent LArCaliWave object is inconsistent. i=" << i << " WaveIndes=" + << waveIndex << " size=" << persObj->m_vAmplitudes.size() << "samples=" << persObj->m_samples <<endreq; + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArCaliWave cv(val,err,tri, time,dac, f); + val.clear(); + err.clear(); + tri.clear(); + + CWV.push_back(cv); + } + + + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + log<< MSG::DEBUG <<"CaliWave p1 done reading"<<endreq; +} + + +void +LArCaliWaveSubsetCnv_p1::transToPers(const LArCWTransType* transObj, LArCWPersType* persObj, MsgStream & log){ + + log<<MSG::DEBUG<<"LArCaliWaveSubsetCNV_p1 begin transToPers"<<endreq; + + // Copy conditions + unsigned int nfebs = transObj->m_subset.size(); +// log<<MSG::DEBUG<<"total febs:"<<nfebs<<endreq; + unsigned int ncorrs = transObj->m_correctionVec.size(); + // log<<MSG::DEBUG<<"total corrections: "<<ncorrs<<endreq; + + unsigned int nsubsetsNotEmpty = 0; + unsigned int nchans = 0; + + persObj->m_samples=0; //for now + + std::vector<unsigned int> febsWithSparseData; // collects IDs of febs with sparse data + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); +// std::cout<<"feb index: "<<i<<" has "<<nfebChans<<" channels. "<<std::endl; + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR << "LArCaliWaveSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans<< endreq; + return; + } + + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty FEBS + + bool isSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { // Loop over channels and check if this subset has sparse data + + const LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; + + if (!isSparse && CWV.size() == 0) { + isSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first);// save febids for sparse subsets +// std::cout<<"febID: "<<transObj->m_subset[i].first<<" is sparse"<<std::endl; + } + if (CWV.size()){ // should be like this no? + //else { + nchans++; // count number of channels + //std::cout<<":"<<CWV[0].getSize()<<std::endl; always 768 + persObj->m_samples=CWV[0].getSize(); // completely ineficient but fast to fix :-( + } + } + +// std::cout<<"\nFeb: "<<i<<" nonemptychannels till now: "<<nchans<<std::endl; + + } // loop over febs + +// std::cout<<"total nonempty febs = "<<nsubsetsNotEmpty<<std::endl; + + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + + persObj->m_subset.m_corrChannels.reserve(ncorrs); + + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); // this stores FEBID + 128 bitmask of existing channels + + persObj->m_dt.reserve(nchans); + persObj->m_vAmplitudes.reserve(nchans*persObj->m_samples); + persObj->m_vErrors.reserve(nchans*persObj->m_samples); + persObj->m_vTriggers.reserve(nchans*persObj->m_samples); + persObj->m_flag.reserve(nchans); + + + int counterSparse=0; + for (unsigned int i = 0; i < nfebs; ++i){ // new loop over febs + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans == 0) continue; // skip subsets without any channels + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); // stores FEBID's of nonempty FEBs + + bool isSparse=false; // this is just to avoid search loop + if (counterSparse < (int)febsWithSparseData.size() && febid == febsWithSparseData[counterSparse]){ + counterSparse++; + isSparse=true; + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveAmplitudes=true; + if (isSparse) { // subset with sparse data + + if (transObj->m_subset[i].second[j].size() > 0) { // channel exists + + if (j < chansOffset || (j - chansOffset) > 31) // store the channel number in bit map + log << MSG::ERROR << "LArCWSubsetCnv_p1::tTP - incorrect ch. ind: j, chansOffset: " << j << " " << chansOffset << endreq; + + chansSet |= (1 << (j - chansOffset)); //store the channel number in the bit map + +// std::cout<<"1"; + } + else { // channel does not exist + saveAmplitudes = false; +// std::cout<<"0"; + } + + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; +// std::cout<<" "; + } + } // if sparse + + if (saveAmplitudes) {// save amplitudes, errors and triggers + const LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; + std::vector<double> w=CWV[0].getWave(); + std::vector<double> e=CWV[0].getErrors(); + std::vector<int> t=CWV[0].getTriggers(); + persObj->m_dt.push_back(CWV[0].getDt()); + persObj->m_flag.push_back(CWV[0].getFlag()); + persObj->m_DAC.push_back(CWV[0].getDAC() | (CWV[0].getIsPulsedInt()<<16)); + for (unsigned int k = 0; k< w.size(); ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + } + } + + } // over channels +// std::cout<<std::endl; + }// over febs + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // log<<MSG::DEBUG<<"WRITING CORRECTION : "<<i<<endreq; + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // Waves + const LArCaliWaveVec& CWV = transObj->m_correctionVec[i].second; + std::vector<double> w=CWV[0].getWave(); + std::vector<double> e=CWV[0].getErrors(); + std::vector<int> t=CWV[0].getTriggers(); + persObj->m_dt.push_back(CWV[0].getDt()); + persObj->m_flag.push_back(CWV[0].getFlag()); + persObj->m_DAC.push_back(CWV[0].getDAC() | (CWV[0].getIsPulsedInt()<<16)); + persObj->m_samples=w.size(); + for (unsigned int k = 0; k< w.size(); ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + } + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + log<< MSG::DEBUG <<"CaliWave p1 written down."<<endreq; +} + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p2.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3d91ecf75e1581b9276d2eb957427a25004caff --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCaliWaveSubsetCnv_p2.cxx @@ -0,0 +1,331 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h" + + +void +LArCaliWaveSubsetCnv_p2::persToTrans(const LArCaliWaveSubset_p2* persObj, LArCWTransType* transObj, MsgStream & log){ + + log<<MSG::DEBUG<<"LArCaliWaveSubsetCNV_p2 begin persToTrans"<<endreq; + + unsigned int nfebids = persObj->m_subset.m_febIds.size(); log<<MSG::DEBUG<<"Total febs:"<<nfebids; + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); log<<MSG::DEBUG<<"\tCorrections:"<<ncorrs<<endreq; + + transObj->m_subset.resize(nfebids); + + unsigned int cwvIndex=0, waveIndex=0, chIndex = 0; + + unsigned int febid = 0; // Loop over febs + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; // Set febid + log<<MSG::DEBUG<<"feb index: "<<i<<"\tfebID: "<<febid; + + transObj->m_subset[i].second.resize(NCHANNELPERFEB);// Fill channels with empty calowavevec's + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + hasSparseData = true;// Found feb with sparse data + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + log<<MSG::DEBUG<<"\tFeb sparse? "<< hasSparseData <<endreq; + + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { // Channel is missing data - skip + copyChannel = false; // std::cout<<"0"; + } // else std::cout<<"1"; + + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + // std::cout<<" "; + } + } + + if (copyChannel) { // This channel has wave, resize vectors + LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; + + unsigned int nDAC=persObj->m_vDAC[cwvIndex]; + cwvIndex++; + for (unsigned int nD=0;nD<nDAC;nD++){ + double time =persObj->m_dt[chIndex]; + unsigned int f =persObj->m_flag[chIndex]; + int dac =persObj->m_DAC[chIndex]; + chIndex++; + + std::vector<double> val, err; + std::vector<int> tri; + + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArCaliWave cv(val,err,tri, time,dac, f); + val.clear(); + err.clear(); + tri.clear(); + + CWV.push_back(cv); + } + } + } // loop on channels +// std::cout<<std::endl; + } // loop on FEBs + + + log<<MSG::DEBUG << "Correction reading, ncorr:" << ncorrs << "\twaveIndex=" << waveIndex << "\tsize:" << persObj->m_vAmplitudes.size()<<endreq; + transObj->m_correctionVec.resize(ncorrs); + + for (unsigned int i = 0; i < ncorrs; ++i){ // Loop over corrections + + if (chIndex >= persObj->m_dt.size()) {// check indexes + log << MSG::ERROR + << "LArCaliWaveSubsetCnv_p2::persToTrans - CaliWave index too large: WaveIndex/sizeInFile " + << chIndex << " " << persObj->m_dt.size() << " " << endreq; + return; + } + + + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + LArCaliWaveVec& CWV = transObj->m_correctionVec[i].second; + + unsigned int nDAC=persObj->m_vDAC[cwvIndex]; + cwvIndex++; + for (unsigned int nD=0;nD<nDAC;nD++){ + + double time = persObj->m_dt[chIndex]; + unsigned int f = persObj->m_flag[chIndex]; + int dac = persObj->m_DAC[chIndex]; + chIndex++; + std::vector<double> val, err; + std::vector<int> tri; + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + + if (waveIndex>=persObj->m_vAmplitudes.size()) + log << MSG::ERROR << "Persistent LArCaliWave object is inconsistent. i=" << i << " WaveIndes=" + << waveIndex << " size=" << persObj->m_vAmplitudes.size() << "samples=" << persObj->m_samples <<endreq; + + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArCaliWave cv(val,err,tri, time,dac, f); + val.clear(); + err.clear(); + tri.clear(); + + CWV.push_back(cv); + + }// over DAC values + }//over corrections + + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + log<< MSG::DEBUG <<"CaliWave ver p2 successfully read in."<<endreq; +} + + + + + + +void +LArCaliWaveSubsetCnv_p2::transToPers(const LArCWTransType* transObj, LArCaliWaveSubset_p2* persObj, MsgStream & log){ + + log<<MSG::DEBUG<<" LArCaliWaveSubsetCNV_p2 begin Writing"<<endreq; + + unsigned int nfebs = transObj->m_subset.size(); log<<MSG::DEBUG<<"total febs:"<<nfebs; + unsigned int ncorrs = transObj->m_correctionVec.size(); log<<MSG::DEBUG<<"\tCorrections: "<<ncorrs<<endreq; + + unsigned int nsubsetsNotEmpty = 0; + unsigned int nchans = 0; + + persObj->m_samples=0; + + std::vector<unsigned int> febsWithSparseData; // collects IDs of febs with sparse data + + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + log<<MSG::DEBUG<<"feb index: "<<i<<" has "<<nfebChans<<" channels. "; + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR << "LArCaliWaveSubsetCnv_p2::transToPers - found incorrect number of channels per feb: " << nfebChans<< endreq; + return; + } + + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty FEBS + + bool isSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { // Loop over channels and check if this subset has sparse data + + const LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; + + if (!isSparse && CWV.size() == 0) { + isSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first);// save febids for sparse subsets +// std::cout<<"febID: "<<transObj->m_subset[i].first<<" is sparse"<<std::endl; + } + + if (CWV.size()){ // should be like this no? + //else { + nchans++; // count number of channels + //std::cout<<":"<<CWV[0].getSize()<<std::endl; always 768 + persObj->m_samples=CWV[0].getSize(); // completely ineficient but fast to fix :-( + } + + } + +// std::cout<<"\nFeb: "<<i<<" nonemptychannels till now: "<<nchans<<std::endl; + + } // loop over febs + +// std::cout<<"total nonempty febs = "<<nsubsetsNotEmpty<<std::endl; + + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + + persObj->m_subset.m_corrChannels.reserve(ncorrs); + + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); // this stores FEBID + 128 bitmask of existing channels + + persObj->m_dt.reserve(nchans); + persObj->m_vAmplitudes.reserve(nchans*persObj->m_samples); + persObj->m_vErrors.reserve(nchans*persObj->m_samples); + persObj->m_vTriggers.reserve(nchans*persObj->m_samples); + persObj->m_flag.reserve(nchans); + + + int counterSparse=0; + for (unsigned int i = 0; i < nfebs; ++i){ // new loop over febs + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans == 0) continue; // skip subsets without any channels + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); // stores FEBID's of nonempty FEBs + + bool isSparse=false; // this is just to avoid search loop + if (counterSparse < (int)febsWithSparseData.size() && febid == febsWithSparseData[counterSparse]){ + counterSparse++; + isSparse=true; + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveAmplitudes=true; + if (isSparse) { // subset with sparse data + + if (transObj->m_subset[i].second[j].size() > 0) { // channel exists + + if (j < chansOffset || (j - chansOffset) > 31) // store the channel number in bit map + log << MSG::ERROR << "LArCWSubsetCnv_p2::tTP - incorrect ch. ind: j, chansOffset: " << j << " " << chansOffset << endreq; + + chansSet |= (1 << (j - chansOffset)); //store the channel number in the bit map + +// std::cout<<"1"; + } + else { // channel does not exist + saveAmplitudes = false; +// std::cout<<"0"; + } + + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; +// std::cout<<" "; + } + } // if sparse + + if (saveAmplitudes) { // save amplitudes, errors and triggers + const LArCaliWaveVec& CWV = transObj->m_subset[i].second[j]; + int dacValues=CWV.size(); + persObj->m_vDAC.push_back(dacValues); //std::cout<<"CWV size: "<<dacValues<<std::endl; + + for(int dv=0;dv<dacValues;dv++){ + persObj->m_dt.push_back(CWV[dv].getDt()); + persObj->m_flag.push_back(CWV[dv].getFlag()); + persObj->m_DAC.push_back(CWV[dv].getDAC() | (CWV[dv].getIsPulsedInt()<<16)); + std::vector<double> w=CWV[dv].getWave(); + std::vector<double> e=CWV[dv].getErrors(); + std::vector<int> t=CWV[dv].getTriggers(); + for (unsigned int k = 0; k< w.size(); ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + } // over samples + }// over DAC values + } + + } // over channels +// std::cout<<std::endl; + }// over febs + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + log<<MSG::DEBUG<<"WRITTING CORRECTION: "<<i<<" ch id: "<<transObj->m_correctionVec[i].first; + + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first);// Save channel id in febid vector + + const LArCaliWaveVec& CWV = transObj->m_correctionVec[i].second; + + int dacValues=CWV.size(); + persObj->m_vDAC.push_back(dacValues); + log<<MSG::DEBUG<<"\t CWV size: "<<dacValues; + + for(int dv=0;dv<dacValues;dv++){ + persObj->m_dt.push_back(CWV[dv].getDt()); + persObj->m_flag.push_back(CWV[dv].getFlag()); + persObj->m_DAC.push_back(CWV[dv].getDAC() | (CWV[dv].getIsPulsedInt()<<16)); + std::vector<double> w=CWV[dv].getWave(); + std::vector<double> e=CWV[dv].getErrors(); + std::vector<int> t=CWV[dv].getTriggers(); + persObj->m_samples=w.size(); // std::cout<<" samples: "<<w.size()<<std::endl; + for (unsigned int k = 0; k< w.size(); ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + }// over samples + }// over dac values + }// over corrections + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + log<< MSG::DEBUG <<" Cali Wave p2 successfully written down."<<endreq; +} + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCondTPCnv.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCondTPCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..68fca14add80d4479e960efc685e8d51a051ce7b --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArCondTPCnv.cxx @@ -0,0 +1,110 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// generate the T/P converter entries +#include "AthenaKernel/TPCnvFactory.h" + +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p1.h" +#include "LArCondTPCnv/LArCaliWaveSubset_p1.h" +#include "LArCondTPCnv/LArCaliWaveSubsetCnv_p2.h" +#include "LArCondTPCnv/LArCaliWaveSubset_p2.h" +#include "LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPhysWaveSubset_p1.h" +#include "LArCondTPCnv/LArAutoCorrSubsetCnv_p1.h" +#include "LArCondTPCnv/LArAutoCorrSubset_p1.h" +#include "LArCondTPCnv/LArOFCSubsetCnv_p1.h" +#include "LArCondTPCnv/LArOFCSubset_p1.h" +#include "LArCondTPCnv/LArPedestalMCCnv_p1.h" +#include "LArCondTPCnv/LArPedestalMC_p1.h" +#include "LArCondTPCnv/LArPedestalSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPedestalSubset_p1.h" +#include "LArCondTPCnv/LArRampSubsetCnv_p1.h" +#include "LArCondTPCnv/LArRampSubset_p1.h" +#include "LArCondTPCnv/LArShapeSubsetCnv_p1.h" +#include "LArCondTPCnv/LArShapeSubsetCnv_p2.h" +#include "LArCondTPCnv/LArShapeSubset_p1.h" +#include "LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h" +#include "LArCondTPCnv/LArSingleFloatSubset_p1.h" +#include "LArCondTPCnv/LArOFCBinSubsetCnv_p1.h" +#include "LArCondTPCnv/LArSingleIntSubset_p1.h" +#include "LArCondTPCnv/LArMphysOverMcalSubset_p1.h" +#include "LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h" +#include "LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h" +#include "LArCondTPCnv/LArPedestalSubsetCnv_p2.h" +#include "LArCondTPCnv/LArPedestalSubset_p2.h" + +DECLARE_TPCNV_FACTORY(LArAutoCorrSubsetCnv_p1, + LArConditionsSubset<LArAutoCorrP1>, + LArAutoCorrSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArCaliWaveSubsetCnv_p1, + LArConditionsSubset<LArCaliWaveVec>, + LArCaliWaveSubset_p1, + Athena::TPCnvVers::Old) + +DECLARE_TPCNV_FACTORY(LArCaliWaveSubsetCnv_p2, + LArConditionsSubset<LArCaliWaveVec>, + LArCaliWaveSubset_p2, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArDSPThresholdsSubsetCnv_p1, + LArConditionsSubset<LArDSPThresholdsP>, + LArDSPThresholdsSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArMphysOverMcalSubsetCnv_p1, + LArConditionsSubset<LArMphysOverMcalP1>, + LArMphysOverMcalSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArOFCBinSubsetCnv_p1, + LArConditionsSubset<LArOFCBinP>, + LArSingleIntSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArOFCSubsetCnv_p1, + LArConditionsSubset<LArOFCP1>, + LArOFCSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArPedestalSubsetCnv_p1, + LArConditionsSubset<LArPedestalP1>, + LArPedestalSubset_p1, + Athena::TPCnvVers::Old) + +DECLARE_TPCNV_FACTORY(LArPedestalSubsetCnv_p2, + LArConditionsSubset<LArPedestalP1>, + LArPedestalSubset_p2, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArPhysWaveSubsetCnv_p1, + LArConditionsSubset<LArPhysWave>, + LArPhysWaveSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArRampSubsetCnv_p1, + LArConditionsSubset<LArRampP1>, + LArRampSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArShapeSubsetCnv_p1, + LArConditionsSubset<LArShapeP1>, + LArShapeSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArShapeSubsetCnv_p2, + LArConditionsSubset<LArShapeP2>, + LArShapeSubset_p2, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArSingleFloatSubsetCnv_p1, + LArConditionsSubset<LArSingleFloatP>, + LArSingleFloatSubset_p1, + Athena::TPCnvVers::Current) + +DECLARE_TPCNV_FACTORY(LArPedestalMCCnv_p1, + LArPedestalMC, + LArPedestalMC_p1, + Athena::TPCnvVers::Current) diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArDSPThresholdsSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArDSPThresholdsSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5f4f1d9788c979dad2aaf27f6bf6b5d6cf5ffcff --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArDSPThresholdsSubsetCnv_p1.cxx @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArCondTPCnv/LArDSPThresholdsSubsetCnv_p1.h" + +void +LArDSPThresholdsSubsetCnv_p1::persToTrans(const DSPThresholdsPersType* persObj, + DSPThresholdsTransType* transObj, + MsgStream & /*log*/) { + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned index =0; + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + // Loop over channels in feb + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + transObj->m_subset[i].second[j].set(persObj->m_tQThr[index],persObj->m_samplesThr[index],persObj->m_trigSumThr[index]); + ++index; + } + } + + transObj->m_correctionVec.reserve(ncorrs); + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + transObj->m_correctionVec[i].second.set(persObj->m_tQThr[index],persObj->m_samplesThr[index],persObj->m_trigSumThr[index]); + ++index; + } + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + return; +} + + + + + +void +LArDSPThresholdsSubsetCnv_p1::transToPers(const DSPThresholdsTransType* transObj, + DSPThresholdsPersType* persObj, + MsgStream &log) +{ + // Get the number of channels, corrections and the size of pedestal and pedestalrms + unsigned int nfebs = transObj->m_subset.size(); + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nsubsetsNotEmpty = 0; + + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArDSPThresholdsSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + } + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + persObj->m_tQThr.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + persObj->m_samplesThr.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + persObj->m_trigSumThr.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + + //Copy subsets + for (unsigned int i = 0; i < nfebs; ++i) {//Loop over FEBs + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans==0) continue; + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + for (unsigned int j=0; j<nfebChans;++j) { //Loop over channels in FEB + persObj->m_tQThr.push_back(transObj->m_subset[i].second[j].tQThr()); + persObj->m_samplesThr.push_back(transObj->m_subset[i].second[j].samplesThr()); + persObj->m_trigSumThr.push_back(transObj->m_subset[i].second[j].trigSumThr()); + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + persObj->m_tQThr.push_back(transObj->m_correctionVec[i].second.tQThr()); + persObj->m_samplesThr.push_back(transObj->m_correctionVec[i].second.samplesThr()); + persObj->m_trigSumThr.push_back(transObj->m_correctionVec[i].second.trigSumThr()); + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArMphysOverMcalSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArMphysOverMcalSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2b814198a04519b598db65ad6608a95d1a064a32 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArMphysOverMcalSubsetCnv_p1.cxx @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArCondTPCnv/LArMphysOverMcalSubsetCnv_p1.h" + +void +LArMphysOverMcalSubsetCnv_p1::persToTrans(const LArMpMcPersType* persObj, + LArMpMcTransType* transObj, + MsgStream & /*log*/) { + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned index =0; + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty pedestal vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + // Loop over channels in feb + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + transObj->m_subset[i].second[j].m_data=persObj->m_values[index]; + // std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel=" + // << j << " Payload= << + ++index; + } + } + + transObj->m_correctionVec.reserve(ncorrs); + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + transObj->m_correctionVec[i].second.m_data=persObj->m_values[index]; + ++index; + } + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + return; +} + + +void +LArMphysOverMcalSubsetCnv_p1::transToPers(const LArMpMcTransType*, + LArMpMcPersType*, + MsgStream &log) { + + log << MSG::ERROR << "LArMphysOverMcalSubsetCnv_p1::transToPers is obsolete" << endreq; + return; +} + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCBinSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCBinSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3150ce0f5e078e901021bb400316b8481cdc7c0 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCBinSubsetCnv_p1.cxx @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArCondTPCnv/LArOFCBinSubsetCnv_p1.h" + +void +LArOFCBinSubsetCnv_p1::persToTrans(const OFCBinPersType* persObj, + OFCBinTransType* transObj, + MsgStream & /*log*/) { + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned index =0; + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty pedestal vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + // Loop over channels in feb + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + transObj->m_subset[i].second[j].m_bin=persObj->m_values[index]; + // std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel=" + // << j << " Payload= << + ++index; + } + } + + transObj->m_correctionVec.reserve(ncorrs); + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + transObj->m_correctionVec[i].second.m_bin=persObj->m_values[index]; + ++index; + } + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + return; +} + + + + + +void +LArOFCBinSubsetCnv_p1::transToPers(const OFCBinTransType* transObj, + OFCBinPersType* persObj, + MsgStream &log) +{ + // Get the number of channels, corrections and the size of pedestal and pedestalrms + unsigned int nfebs = transObj->m_subset.size(); + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nsubsetsNotEmpty = 0; + + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArOFCBinSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + } + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + persObj->m_values.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + + //Copy subsets + for (unsigned int i = 0; i < nfebs; ++i) {//Loop over FEBs + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans==0) continue; + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + for (unsigned int j=0; j<nfebChans;++j) //Loop over channels in FEB + persObj->m_values.push_back(transObj->m_subset[i].second[j].m_bin); + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + persObj->m_values.push_back(transObj->m_correctionVec[i].first); + persObj->m_values.push_back(transObj->m_correctionVec[i].second.m_bin); + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b0d6254202b550c51a5b3ef80a38a933b8ba3800 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArOFCSubsetCnv_p1.cxx @@ -0,0 +1,395 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArOFCSubsetCnv_p1.h" + +void +LArOFCSubsetCnv_p1::persToTrans(const LArOFCPersType* persObj, + LArOFCTransType* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nPhases = persObj->m_nPhases; + unsigned int nSamples = persObj->m_nSamples; + unsigned int dataIndex = 0; + unsigned int timeIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty ofc vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has ofcs - loop over ofcs per channel and + // copy to the persistent object + + // check indexes + if (dataIndex >= persObj->m_vOFC_a.size() || + dataIndex >= persObj->m_vOFC_b.size() || + timeIndex >= persObj->m_timeOffset.size() || + timeIndex >= persObj->m_timeBinWidth.size()) { + log << MSG::ERROR + << "LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size " + << dataIndex << " " << persObj->m_vOFC_a.size() << " " + << persObj->m_vOFC_b.size() << " " << timeIndex << " " + << persObj->m_timeOffset.size() << " " + << persObj->m_timeBinWidth.size() + << endreq; + return; + } + + LArOFCTransType::Reference ofcs = + transObj->m_subset[i].second[j]; + LArOFCP1 tmp (persObj->m_timeOffset[timeIndex], + persObj->m_timeBinWidth[timeIndex], + nPhases, + nSamples, + persObj->m_vOFC_a, + persObj->m_vOFC_b, + dataIndex); + ofcs.assign (tmp); + ++timeIndex; + dataIndex += nPhases * nSamples; + } + } + } + + // Copy corrections + + if (ncorrs) { + // corrs exist - resize vector + std::vector<float> vSamples(nSamples, 0.0); + std::vector<std::vector<float> > vOFC(nPhases, vSamples); + LArOFCP1 larOFCP1(0.0, 0.0, vOFC, vOFC); + + transObj->m_correctionVec.resize(ncorrs, LArOFCTransType::CorrectionPair(0, larOFCP1)); + } + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (dataIndex >= persObj->m_vOFC_a.size() || + dataIndex >= persObj->m_vOFC_b.size() || + timeIndex >= persObj->m_timeOffset.size() || + timeIndex >= persObj->m_timeBinWidth.size()) { + log << MSG::ERROR + << "LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size " + << dataIndex << " " << persObj->m_vOFC_a.size() << " " + << persObj->m_vOFC_b.size() << " " << timeIndex << " " + << persObj->m_timeOffset.size() << " " + << persObj->m_timeBinWidth.size() + << endreq; + return; + } + + // copy channel id + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + LArOFCP1& ofcs = transObj->m_correctionVec[i].second; + LArOFCP1 tmp (persObj->m_timeOffset[timeIndex], + persObj->m_timeBinWidth[timeIndex], + nPhases, + nSamples, + persObj->m_vOFC_a, + persObj->m_vOFC_b, + dataIndex); + ofcs.setFrom (tmp); + ++timeIndex; + dataIndex += nPhases * nSamples; + } + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + transObj->m_subset.trim(); +} + + + + +void +LArOFCSubsetCnv_p1::transToPers(const LArOFCTransType* transObj, + LArOFCPersType* persObj, + MsgStream &log) +{ + + // Copy conditions + + // We copy all ofcs into a few simple vectors. + // For the conditions, there are two situations to treat: + // 1) dense data: normal conditions where each feb has 128 + // channels and all channels have data, + // 2) sparse data: conditions data where some channels are + // missing data. This is true for MC conditions (only some + // channels have data, and symmetry is used to obtain + // conditions for the rest of the channels), as well for + // 'normal' conditions it may happen that some channels may + // be missing data. + // + // Treating 1) is straight-forward. For 2) we need to keep track + // of which channels are present. We do so with + // m_subset.m_febsWithSparseData where we store the febid followed by + // four unsigned ints which contain the full bit pattern of the + // channels set (i.e. bits 0-127). + // + // Note that one may also have a subset with all channels missing + // data. In this case, we do not write out the empty subset. + // + // Finally, for corrections, we save the channel ids in + // m_subset.m_corrChannels and the ofcs in the same vectors as the + // rest of the conditions data. + // + // For each channel with data, the number of ofcs is assumed + // constant. This is calculated at the beginning, along with + // whether a feb is sparse or not. + // + + // Get the number of channels, corrections and the size of ofc vectors + unsigned int nfebs = transObj->m_subset.size(); + unsigned int nsubsetsNotEmpty = 0; + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nchans = 0; + unsigned int nPhases = 0; + unsigned int nSamples = 0; + bool foundOFCs = false; + std::vector<unsigned int> febsWithSparseData; + + // Find the number of ofcs and check for sparse conditions, + // e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArOFCSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + + // Loop over channels and check if this subset has sparse data + bool subsetIsSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { + LArOFCTransType::ConstReference ofc = + transObj->m_subset[i].second[j]; + if (ofc.OFC_aSize() == 0) { + if (!subsetIsSparse) { + // save febids for sparse subsets + subsetIsSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first); + } + } + else { + nchans++; // count number of channels + if (!foundOFCs) { + // Save the number of phases and samples for each + // ofc from first channels present + nPhases = ofc.OFC_aSize(); + nSamples = ofc.OFC_a(0).size(); + foundOFCs = true; + } + } + } + } + if (!foundOFCs && ncorrs>0) { + // Save the number of phases and samples for each ofc from + // first correction - couldn't find it from channels + const LArOFCP1& ofc = transObj->m_correctionVec[0].second; + nPhases = ofc.OFC_aSize(); + nSamples = ofc.OFC_a(0).size(); + } + + // Save sizes + persObj->m_nPhases = nPhases; + persObj->m_nSamples = nSamples; + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + unsigned int ndataTot = (nchans + ncorrs)*nPhases*nSamples; + unsigned int nTime = (nchans + ncorrs); + persObj->m_vOFC_a.reserve(ndataTot); + persObj->m_vOFC_b.reserve(ndataTot); + persObj->m_timeOffset.reserve(nTime); + persObj->m_timeBinWidth.reserve(nTime); + + // For subsets with sparse data, reserve space for identifying + // channels written out: + // 1 - febid + // 4 - for 128 bits (4*32) + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); + + // Copy conditions in subset + unsigned int isparse = 0; + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + + + bool isSparse = false; + if (isparse < febsWithSparseData.size() && + febsWithSparseData[isparse] == febid) { + // sparse subset, save channels with data + isparse++; + isSparse = true; + // save febid + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + // Now loop over channels and save ofc and times + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveOFCs = true; + if (isSparse) { + // subset with sparse data + if (transObj->m_subset[i].second[j].OFC_aSize() > 0) { + // store the channel number in bit map + if (j < chansOffset || (j - chansOffset) > 31) { + log << MSG::ERROR + << "LArOFCSubsetCnv_p1::transToPers - incorrect channel indexing: j, chansOffset: " << j << " " << chansOffset + << endreq; + } + chansSet |= (1 << (j - chansOffset)); + } + else { + saveOFCs = false; + } + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; + } + } + if (saveOFCs) { + bool tooSmall=false; + // Loop over phases and samples per channel + for (unsigned int k = 0; k < nPhases; ++k) { + for (unsigned int l = 0; l < nSamples; ++l) { + //check if data object is big enough + if (k>=transObj->m_subset[i].second[j].OFC_aSize() || l>=transObj->m_subset[i].second[j].OFC_a(k).size()) { + tooSmall=true; + persObj->m_vOFC_a.push_back(0.); + persObj->m_vOFC_b.push_back(0.); + } + else { + persObj->m_vOFC_a.push_back(transObj->m_subset[i].second[j].OFC_a(k)[l]); + persObj->m_vOFC_b.push_back(transObj->m_subset[i].second[j].OFC_b(k)[l]); +// std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel=" +// << j << " Phase="<< k<< " Sample " << l << " OFC=" +// << transObj->m_subset[i].second[j].m_vOFC_a[k][l] << std::endl; + } + } + } + // set time offset and binwidth + persObj->m_timeOffset.push_back(transObj->m_subset[i].second[j].timeOffset()); + persObj->m_timeBinWidth.push_back(transObj->m_subset[i].second[j].timeBinWidth()); + if (tooSmall) + log << MSG::ERROR << "Feb 0x" << std::hex << febid << std::dec << " channel " << j <<": OFC object too small. Expected " + << nPhases << " phases and " << nSamples << " samples. Padded with 0.0" << endreq; + + }// end if saveOFC + +// static unsigned int nch = 0; +// ++nch; +// std::cout << "transToPers - i, j, save " << i << " " << j << " " +// << saveOFCs << " " << nch << " febid " << febid +// << " chansSet " << std::hex << chansSet << std::dec +// << " chansOffset " << chansOffset +// << std::endl; + + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // OFCs + bool tooSmall=false; + // Loop over phases and samples per channel + for (unsigned int k = 0; k < nPhases; ++k) { + for (unsigned int l = 0; l < nSamples; ++l) { + //check if data object is big enough + if (k>=transObj->m_correctionVec[i].second.OFC_aSize() || l>=transObj->m_correctionVec[i].second.OFC_a(k).size()) { + tooSmall=true; + persObj->m_vOFC_a.push_back(0.); + persObj->m_vOFC_b.push_back(0.); + } + else { + persObj->m_vOFC_a.push_back(transObj->m_correctionVec[i].second.OFC_a(k)[l]); + persObj->m_vOFC_b.push_back(transObj->m_correctionVec[i].second.OFC_b(k)[l]); + } + } + } + // set time offset and binwidth + persObj->m_timeOffset.push_back(transObj->m_correctionVec[i].second.timeOffset()); + persObj->m_timeBinWidth.push_back(transObj->m_correctionVec[i].second.timeBinWidth()); + if (tooSmall) + log << MSG::ERROR << "Correction index "<< i <<"(channel 0x" << std::hex << transObj->m_correctionVec[i].first << std::dec << + "): OFC object too small. Expected " << nPhases << " phases and " << nSamples << " samples. Padded with 0.0" << endreq; + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalMCCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalMCCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..550f3e0c60b2c93d045ff235d734bc2b1a874e0f --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalMCCnv_p1.cxx @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArPedestalMC.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArPedestalMCCnv_p1.h" + +void +LArPedestalMCCnv_p1::persToTrans(const LArPedMCPersType* persObj, + LArPedMCTransType* transObj, + MsgStream & /*log*/) +{ + // Copy conditions + transObj->m_vPedestal = persObj->m_vPedestal; + transObj->m_vPedestalRMS = persObj->m_vPedestalRMS; + +} + + + + +void +LArPedestalMCCnv_p1::transToPers(const LArPedMCTransType* transObj, + LArPedMCPersType* persObj, + MsgStream & /*log*/) +{ + + // Copy conditions + persObj->m_vPedestal = transObj->m_vPedestal; + persObj->m_vPedestalRMS = transObj->m_vPedestalRMS; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..30c6f69ca0e07e17668b320b77715183ad1d6587 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p1.cxx @@ -0,0 +1,147 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArPedestalSubsetCnv_p1.h" + +void +LArPedestalSubsetCnv_p1::persToTrans(const LArPedestalPersType* persObj, + LArPedestalTransType* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nPedestals = persObj->m_vPedestalSize; + unsigned int nPedestalRMSs = persObj->m_vPedestalRMSSize; + unsigned int pedestalIndex = 0; + unsigned int pedestalrmsIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty pedestal vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has pedestals - loop over pedestals per channel + // and copy to the persistent object + + // check indexes + if (pedestalIndex >= persObj->m_vPedestal.size() || + pedestalrmsIndex >= persObj->m_vPedestalRMS.size()) { + log << MSG::ERROR + << "LArPedestalSubsetCnv_p1::persToTrans - pedestal index too large: pedestal/size, pedestalrms/size " + << pedestalIndex << " " << persObj->m_vPedestal.size() << " " + << pedestalrmsIndex << " " << persObj->m_vPedestalRMS.size() + << endreq; + return; + } + + // This channel has pedestals, resize vectors + //transObj->m_subset[i].second[j].m_vPedestal.resize(nPedestals); + //transObj->m_subset[i].second[j].m_vPedestalRMS.resize(nPedestalRMSs); + if (nPedestals) + transObj->m_subset[i].second[j].m_Pedestal = persObj->m_vPedestal[pedestalIndex]; + pedestalIndex+=nPedestals; + + if (nPedestalRMSs) + transObj->m_subset[i].second[j].m_PedestalRMS = persObj->m_vPedestalRMS[pedestalrmsIndex]; + pedestalrmsIndex+=nPedestalRMSs; + }//end if copychannel + + }//end loop over channels in feb + }// end loop over febs + + // Copy corrections + + if (ncorrs) { + transObj->m_correctionVec.resize(ncorrs); + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (pedestalIndex >= persObj->m_vPedestal.size() || + pedestalrmsIndex >= persObj->m_vPedestalRMS.size()) { + log << MSG::ERROR + << "LArPedestalSubsetCnv_p1::persToTrans - pedestal index too large: pedestal/size, pedestalrms/size " + << pedestalIndex << " " << persObj->m_vPedestal.size() << " " + << pedestalrmsIndex << " " << persObj->m_vPedestalRMS.size() + << endreq; + return; + } + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + if (nPedestals) + transObj->m_correctionVec[i].second.m_Pedestal = persObj->m_vPedestal[pedestalIndex]; + pedestalIndex+=nPedestals; + + + if (nPedestalRMSs) + transObj->m_correctionVec[i].second.m_PedestalRMS = persObj->m_vPedestalRMS[pedestalrmsIndex]; + pedestalrmsIndex+=nPedestalRMSs; + + }// end loop over corrections + + }//end if ncorr + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + +} + + + + +void +LArPedestalSubsetCnv_p1::transToPers(const LArPedestalTransType* /*transObj*/, + LArPedestalPersType* /*persObj*/, + MsgStream &log) +{ + + log << MSG::ERROR << "LArPedestalSubset_p1 is obsolete and can't be written out any more." << endreq; + return; +} + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p2.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3ade75628564188d9c8d0994c0536c9d4d709ea5 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPedestalSubsetCnv_p2.cxx @@ -0,0 +1,133 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArPedestalSubsetCnv_p2.h" +#include "CopyFloatWithErrorcode.h" + +void +LArPedestalSubsetCnv_p2::persToTrans(const LArPedestalSubset_p2* persObj, + LArPedestalTransType* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int pedestalIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty pedestal vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + + // Loop over channels in feb + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + //Copy Pedestal + transObj->m_subset[i].second[j].m_Pedestal=copyFloatPT(persObj->m_vPedestal[pedestalIndex]); + //Copy RMS + transObj->m_subset[i].second[j].m_PedestalRMS=copyFloatPT(persObj->m_vPedestalRMS[pedestalIndex]); + ++pedestalIndex; + }//end loop over channel in feb + }//end loop over febs + + // Copy corrections + if (ncorrs) { + // corrs exist - resize vector + transObj->m_correctionVec.resize(ncorrs); + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (pedestalIndex >= persObj->m_vPedestal.size()) { + log << MSG::ERROR + << "LArPedestalSubsetCnv_p2::persToTrans - pedestal index too large: pedestal/size " + << pedestalIndex << " " << persObj->m_vPedestal.size() << endreq; + return; + } + + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + //Copy Pedestal + transObj->m_correctionVec[i].second.m_Pedestal=copyFloatPT(persObj->m_vPedestal[pedestalIndex]); + //Copy RMS + transObj->m_correctionVec[i].second.m_PedestalRMS=copyFloatPT(persObj->m_vPedestalRMS[pedestalIndex]); + ++pedestalIndex; + }//end loop over corrections + }//end if ncorrs + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; +} + + + + +void +LArPedestalSubsetCnv_p2::transToPers(const LArPedestalTransType* transObj, + LArPedestalSubset_p2* persObj, + MsgStream &log) +{ + + // Copy conditions + // Get the number of channels, corrections and the size of pedestal and pedestalrms + unsigned int nfebs = transObj->m_subset.size(); + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nsubsetsNotEmpty = 0; + + // Find the number of pedestals/pedestalrmss and check for sparse + // conditions, e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArPedestalSubsetCnv_p2::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + } + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + persObj->m_vPedestal.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + persObj->m_vPedestalRMS.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + + // Copy conditions in subset + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + for (unsigned int j=0; j<nfebChans;++j) { //Loop over channels in FEB + persObj->m_vPedestal.push_back(transObj->m_subset[i].second[j].m_Pedestal); + persObj->m_vPedestalRMS.push_back(transObj->m_subset[i].second[j].m_PedestalRMS); + }//End loop over channels in feb + }//end loop over febs + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + persObj->m_vPedestal.push_back(transObj->m_correctionVec[i].second.m_Pedestal); + persObj->m_vPedestalRMS.push_back(transObj->m_correctionVec[i].second.m_PedestalRMS); + }//End loop over corrections + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPhysWaveSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPhysWaveSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e67e765638897b0a0422bf4f4e4dac9d33d365df --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArPhysWaveSubsetCnv_p1.cxx @@ -0,0 +1,314 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArPhysWaveSubsetCnv_p1.h" + +void +LArPhysWaveSubsetCnv_p1::persToTrans(const LArPWPersType* persObj, LArPWTransType* transObj, MsgStream & log){ + + log<<MSG::DEBUG<<"LArPhysWaveSubsetCNV_p1 begin persToTrans"<<endreq; + + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); log<<MSG::DEBUG<<"Total corrections:"<<ncorrs; + unsigned int nfebids = persObj->m_subset.m_febIds.size(); log<<MSG::DEBUG<<"\t\tTotal febs:"<<nfebids<<endreq; + transObj->m_subset.resize(nfebids); + + unsigned int waveIndex = 0; + unsigned int chIndex = 0; + + unsigned int febid = 0; // Loop over febs + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; // Set febid + log<<MSG::DEBUG<<"feb index:"<<i<<"\tfebID: "<<febid; + + transObj->m_subset[i].second.resize(NCHANNELPERFEB);// Fill channels with empty physvec's + + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + hasSparseData = true;// Found feb with sparse data + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + log<<MSG::DEBUG<<"\t\tsparse? "<< hasSparseData <<endreq; + + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) {// Channel is missing data - skip + copyChannel = false; // std::cout<<"0"; + } + //else std::cout<<"1"; + + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; +// std::cout<<" "; + } + } + + if (copyChannel) { // This channel has wave, resize vectors + LArPhysWave& PW = transObj->m_subset[i].second[j]; + double time = persObj->m_dt[chIndex]; + unsigned int f = persObj->m_flag[chIndex]; + int timeOffset = persObj->m_timeOffset[chIndex]; + chIndex++; + std::vector<double> val; + std::vector<double> err; + std::vector<int> tri; + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArPhysWave pw(val,err,tri, time,timeOffset, f); + val.clear(); + err.clear(); + tri.clear(); + + PW=pw; + } + } // loop on channels +// std::cout<<std::endl; + } // loop on FEBs + + + log<<MSG::DEBUG << "Corrections reading, ncorr=" << ncorrs << " waveIndex=" << waveIndex << " size=" << persObj->m_vAmplitudes.size() << endreq; + transObj->m_correctionVec.resize(ncorrs); + + for (unsigned int i = 0; i < ncorrs; ++i){ // Loop over corrections + + if (chIndex >= persObj->m_dt.size()) { // check indexes + log << MSG::ERROR << "LArPhysWaveSubsetCnv_p1::persToTrans - PhysWave index too large: WaveIndex/sizeInFile " + << chIndex << " " << persObj->m_dt.size()<<" "<< endreq; + return; + } + + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + LArPhysWave& PW = transObj->m_correctionVec[i].second; + + double time = persObj->m_dt[chIndex]; + unsigned int f = persObj->m_flag[chIndex]; + int timeOffset = persObj->m_timeOffset[chIndex]; + chIndex++; + std::vector<double> val; + std::vector<double> err; + std::vector<int> tri; + for (unsigned int k = 0; k < persObj->m_samples; ++k){ + if (waveIndex>=persObj->m_vAmplitudes.size()) + log << MSG::ERROR << "Persistent LArPhysWave object is inconsistent. i=" << i << " WaveIndes=" << waveIndex << " size=" << persObj->m_vAmplitudes.size() << "samples=" << persObj->m_samples <<endreq; + val.push_back(persObj->m_vAmplitudes[waveIndex]); + err.push_back(persObj->m_vErrors[waveIndex]); + tri.push_back(persObj->m_vTriggers[waveIndex]); + waveIndex++; + } + + LArPhysWave pw(val,err,tri, time,timeOffset, f); + val.clear(); + err.clear(); + tri.clear(); + + PW=pw; + }// over corrections + + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + log<< MSG::DEBUG <<"PhysWave successfully read."<<endreq; +} + + + + + +void +LArPhysWaveSubsetCnv_p1::transToPers(const LArPWTransType* transObj, LArPWPersType* persObj, MsgStream & log){ + + log<<MSG::DEBUG<<"LArPhysWaveSubsetCNV_p1 begin transToPers"<<endreq; + + // Copy conditions + unsigned int nfebs = transObj->m_subset.size(); log<<MSG::DEBUG<<"total febs:"<<nfebs; + unsigned int ncorrs = transObj->m_correctionVec.size(); log<<MSG::DEBUG<<"\t\ttotal corrections: "<<ncorrs<<endreq; + + unsigned int nsubsetsNotEmpty = 0; + unsigned int nchans = 0; + + persObj->m_samples=0; //for now + bool haveSampleSize=false; + + std::vector<unsigned int> febsWithSparseData; // collects IDs of febs with sparse data + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + log<<MSG::DEBUG<<"feb index: "<<i<<" has "<<nfebChans<<" channels. "; + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR << "LArPhysWaveSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans<< endreq; + return; + } + + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty FEBS + + bool isSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { // Loop over channels and check if this subset has sparse data + + const LArPhysWave& PW = transObj->m_subset[i].second[j]; + + if (!isSparse && PW.isEmpty()) { + isSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first);// save febids for sparse subsets + log<<MSG::DEBUG<<"\t\tfebID: "<<transObj->m_subset[i].first<<" is sparse"<<endreq; + } + + if (!PW.isEmpty()){ + nchans++; // count number of channels + if (!haveSampleSize) { + haveSampleSize=true; + persObj->m_samples=PW.getSize(); + } + else + if (persObj->m_samples!=PW.getSize()) { + log << MSG::ERROR << "Waves of unequal length found in same conditions channel. Truncating to the shorter of " + << persObj->m_samples << " and " << PW.getSize() << endreq; + persObj->m_samples=std::min(persObj->m_samples,(unsigned)PW.getSize()); + } + } //else if !PS.isEmpty + + } + +// std::cout<<"\nFeb: "<<i<<" nonemptychannels till now: "<<nchans<<std::endl; + + } // loop over febs + +// std::cout<<"total nonempty febs = "<<nsubsetsNotEmpty<<std::endl; + + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + + persObj->m_subset.m_corrChannels.reserve(ncorrs); + + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); // this stores FEBID + 128 bitmask of existing channels + + persObj->m_dt.reserve(nchans); + persObj->m_vAmplitudes.reserve(nchans*persObj->m_samples); + persObj->m_vErrors.reserve(nchans*persObj->m_samples); + persObj->m_vTriggers.reserve(nchans*persObj->m_samples); + persObj->m_flag.reserve(nchans); + persObj->m_timeOffset.reserve(nchans); + + + int counterSparse=0; + for (unsigned int i = 0; i < nfebs; ++i){ // new loop over febs + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans == 0) continue; // skip subsets without any channels + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); // stores FEBID's of nonempty FEBs + + bool isSparse=false; // this is just to avoid search loop + if (counterSparse < (int)febsWithSparseData.size() && febid == febsWithSparseData[counterSparse]){ + counterSparse++; + isSparse=true; + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveAmplitudes=true; + if (isSparse) { // subset with sparse data + + if (!transObj->m_subset[i].second[j].isEmpty()) { // channel exists + + if (j < chansOffset || (j - chansOffset) > 31) // store the channel number in bit map + log << MSG::ERROR << "LArCWSubsetCnv_p1::tTP - incorrect ch. ind: j, chansOffset: " << j << " " << chansOffset << endreq; + + chansSet |= (1 << (j - chansOffset)); //store the channel number in the bit map + +// std::cout<<"1"; + } + else { // channel does not exist + saveAmplitudes = false; +// std::cout<<"0"; + } + + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; +// std::cout<<" "; + } + } // if sparse + + if (saveAmplitudes) {// save amplitudes, errors and triggers + const LArPhysWave& PW = transObj->m_subset[i].second[j]; + persObj->m_dt.push_back(PW.getDt()); + persObj->m_flag.push_back(PW.getFlag()); + persObj->m_timeOffset.push_back(PW.getTimeOffset()); + std::vector<double> w=PW.getWave(); + std::vector<double> e=PW.getErrors(); + std::vector<int> t=PW.getTriggers(); + for (unsigned int k = 0; k< persObj->m_samples; ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + } + } + + } // over channels +// std::cout<<std::endl; + }// over febs + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // log<<MSG::DEBUG<<"WRITING CORRECTION : "<<i<<endreq; + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + + const LArPhysWave& PW = transObj->m_correctionVec[i].second; + std::vector<double> w=PW.getWave(); + std::vector<double> e=PW.getErrors(); + std::vector<int> t=PW.getTriggers(); + persObj->m_dt.push_back(PW.getDt()); + persObj->m_flag.push_back(PW.getFlag()); + persObj->m_timeOffset.push_back(PW.getTimeOffset()); + persObj->m_samples=w.size(); + for (unsigned int k = 0; k< w.size(); ++k){ + persObj->m_vAmplitudes.push_back(w[k]); + persObj->m_vErrors.push_back(e[k]); + persObj->m_vTriggers.push_back(t[k]); + } + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + log<< MSG::DEBUG <<"PhysWave successfully written down."<<endreq; + +} + diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArRampSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArRampSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8736cbb194a8d2dcf60869a4f735858f2faea49a --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArRampSubsetCnv_p1.cxx @@ -0,0 +1,346 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArRampSubsetCnv_p1.h" + +void +LArRampSubsetCnv_p1::persToTrans(const LArRampPersType* persObj, + LArRampTransType* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nRamps = persObj->m_vRampSize; + unsigned int rampIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty ramp vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has ramps - loop over ramps per channel + // and copy to the persistent object + + // check indexes + if (rampIndex >= persObj->m_vRamp.size()) { + log << MSG::ERROR + << "LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size " + << rampIndex << " " << persObj->m_vRamp.size() << " " + << endreq; + return; + } + + // This channel has ramps, resize vectors + transObj->m_subset[i].second[j].m_vRamp.resize(nRamps); + + for (unsigned int k = 0; k < persObj->m_vRampSize; ++k){ + transObj->m_subset[i].second[j].m_vRamp[k] = persObj->m_vRamp[rampIndex]; + rampIndex++; + } + } + +// static unsigned int nch1 = 0; +// ++nch1; +// std::cout << "persToTrans - i, j, copy " << i << " " << j << " " +// << copyChannel << " " << nch1 +// << " hasSparseData " << hasSparseData +// << " chansSet, chansOffset, ifebWithData " << std::hex +// << chansSet << std::dec << " " << chansOffset << " " << ifebWithData +// << " febids " << febid << " " +// << sparseFebid +// << std::endl; + + } + } + + // Copy corrections + + if (ncorrs) { + // corrs exist - resize vector + std::vector<float> vRamp(nRamps,0.0); + LArRampP1 larRampP1(vRamp); + + transObj->m_correctionVec.resize(ncorrs, LArRampTransType::CorrectionPair(0, larRampP1)); + } + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (rampIndex >= persObj->m_vRamp.size()) { + log << MSG::ERROR + << "LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size " + << rampIndex << " " << persObj->m_vRamp.size() << " " + << endreq; + return; + } + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + // Loop over ramps per channel + for (unsigned int k = 0; k < persObj->m_vRampSize; ++k){ + transObj->m_correctionVec[i].second.m_vRamp[k] = persObj->m_vRamp[rampIndex]; + rampIndex++; + } + } + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + +} + + + + +void +LArRampSubsetCnv_p1::transToPers(const LArRampTransType* transObj, + LArRampPersType* persObj, + MsgStream &log) +{ + + // Copy conditions + + // We copy all ramps into a single vector. + // For the conditions, there are two situations to treat: + // 1) dense data: normal conditions where each feb has 128 + // channels and all channels have data, + // 2) sparse data: conditions data where some channels are + // missing data. This is true for MC conditions (only some + // channels have data, and symmetry is used to obtain + // conditions for the rest of the channels), as well for + // 'normal' conditions it may happen that some channels may + // be missing data. + // + // Treating 1) is straight-forward. For 2) we need to keep track + // of which channels are present. We do so with + // m_subset.m_febsWithSparseData where we store the febid followed by + // four unsigned ints which contain the full bit pattern of the + // channels set (i.e. bits 0-127). + // + // Note that one may also have a subset with all channels missing + // data. In this case, we do not write out the empty subset. + // + // Finally, for corrections, we save the channel ids in + // m_subset.m_corrChannels and the ramps in the same vectors as + // the rest of the conditions data. + // + // For each channel with data, the number of ramps is assumed + // constant. This is calculated at the beginning, along with + // whether a feb is sparse or not. + // + + // Get the number of channels, corrections and the size of ramp + unsigned int nfebs = transObj->m_subset.size(); + unsigned int nsubsetsNotEmpty = 0; + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nchans = 0; + unsigned int nRamps = 0; + bool foundNRamps = false; + std::vector<unsigned int> febsWithSparseData; + + // Find the number of ramps and check for sparse conditions, + // e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArRampSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + + // Loop over channels and check if this subset has sparse data + bool subsetIsSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { + const LArRampP1& ramp = transObj->m_subset[i].second[j]; + if (ramp.m_vRamp.size() == 0) { + if (!subsetIsSparse) { + // save febids for sparse subsets + subsetIsSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first); + } + } + else { + nchans++; // count number of channels + if (!foundNRamps) { + // Save the number of ramps and derivatives from first channels present + nRamps = ramp.m_vRamp.size(); + foundNRamps = true; + } + } + } + } + if (!foundNRamps && ncorrs>0) { + // Save the number of ramps and derivatives from first + // correct - couldn't find it from channels + const LArRampP1& ramp = transObj->m_correctionVec[0].second; + nRamps = ramp.m_vRamp.size(); + } + + + // Save sizes + persObj->m_vRampSize = nRamps; + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + unsigned int nRampsTot = (nchans + ncorrs)*nRamps; + persObj->m_vRamp.reserve(nRampsTot); + + // For subsets with sparse data, reserve space for identifying + // channels written out: + // 1 - febid + // 4 - for 128 bits (4*32) + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); + + // Copy conditions in subset + unsigned int isparse = 0; + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + + + bool isSparse = false; + if (isparse < febsWithSparseData.size() && + febsWithSparseData[isparse] == febid) { + // sparse subset, save channels with data + isparse++; + isSparse = true; + // save febid + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + // Now loop over channels and save ramps and channel number + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveRamps = true; + if (isSparse) { + // subset with sparse data + + if (transObj->m_subset[i].second[j].m_vRamp.size() > 0) { + // store the channel number in bit map + if (j < chansOffset || (j - chansOffset) > 31) { + log << MSG::ERROR + << "LArRampSubsetCnv_p1::transToPers - incorrect channel indexing: j, chansOffset: " << j << " " << chansOffset + << endreq; + } + chansSet |= (1 << (j - chansOffset)); + } + else { + saveRamps = false; + } + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; + } + } + if (saveRamps) { + // save ramps + bool tooSmall=false; + for (unsigned int k = 0; k < nRamps; ++k){ + if (k>=transObj->m_subset[i].second[j].m_vRamp.size()) { + tooSmall=true; + persObj->m_vRamp.push_back(0.0); + } + else + persObj->m_vRamp.push_back(transObj->m_subset[i].second[j].m_vRamp[k]); + } + if (tooSmall) + log << MSG::ERROR << "Feb 0x" << std::hex << febid << std::dec << " channel " << j <<": Ramp object too small. Expected a polynom of degree " + << nRamps << ". Padded with 0.0" << endreq; + } + +// static unsigned int nch = 0; +// ++nch; +// std::cout << "transToPers - i, j, save " << i << " " << j << " " +// << saveRamps << " " << nch << " febid " << febid +// << " chansSet " << std::hex << chansSet << std::dec +// << " chansOffset " << chansOffset +// << std::endl; + + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + bool tooSmall=false; + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // Ramps + for (unsigned int k = 0; k < nRamps; ++k){ + if (k>=transObj->m_correctionVec[i].second.m_vRamp.size()) { + tooSmall=true; + persObj->m_vRamp.push_back(0.0); + } + else + persObj->m_vRamp.push_back(transObj->m_correctionVec[i].second.m_vRamp[k]); + } + if (tooSmall) + log << MSG::ERROR << "Correction index "<< i <<"(channel 0x" << std::hex << transObj->m_correctionVec[i].first << std::dec << + "): Ramp object too small. Expected a polynom of degree " << nRamps << ". Padded with 0.0" << endreq; + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c398be13fcbe1c04e54af6853f247a1dacdc84d7 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p1.cxx @@ -0,0 +1,368 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArShapeSubsetCnv_p1.h" + +void +LArShapeSubsetCnv_p1::persToTrans(const LArShapePersType1* persObj, + LArShapeTransType1* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nShapes = persObj->m_vShapeSize; + unsigned int nShapeDers = persObj->m_vShapeDerSize; + unsigned int shapeIndex = 0; + unsigned int shapederIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty shape vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has shapes - loop over shapes per channel + // and copy to the persistent object + + // check indexes + if (shapeIndex >= persObj->m_vShape.size() || + shapederIndex >= persObj->m_vShapeDer.size()) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p1::persToTrans - shape index too large: shape/size, shapeder/size " + << shapeIndex << " " << persObj->m_vShape.size() << " " + << shapederIndex << " " << persObj->m_vShapeDer.size() + << endreq; + return; + } + + // This channel has shapes, resize vectors + transObj->m_subset[i].second[j].m_vShape.resize(nShapes); + transObj->m_subset[i].second[j].m_vShapeDer.resize(nShapeDers); + + for (unsigned int k = 0; k < persObj->m_vShapeSize; ++k){ + transObj->m_subset[i].second[j].m_vShape[k] = persObj->m_vShape[shapeIndex]; + shapeIndex++; + } + // Loop over shapeders per channel + for (unsigned int k = 0; k < persObj->m_vShapeDerSize; ++k){ + transObj->m_subset[i].second[j].m_vShapeDer[k] = persObj->m_vShapeDer[shapederIndex]; + shapederIndex++; + } + } + +// static unsigned int nch1 = 0; +// ++nch1; +// std::cout << "persToTrans - i, j, copy " << i << " " << j << " " +// << copyChannel << " " << (chansSet & (1 << (j + chansOffset))) << " " +// << (chansSet & (1 << (j - chansOffset))) << " " +// << nch1 +// << " hasSparseData " << hasSparseData +// << " chansSet, chansOffset, ifebWithData " << std::hex +// << chansSet << std::dec << " " << chansOffset << " " << ifebWithData +// << " febids " << febid +// << std::endl; + + } + } + + // Copy corrections + + if (ncorrs) { + // corrs exist - resize vector + std::vector<float> vShape(nShapes,0.0); + std::vector<float> vShapeDer(nShapeDers,0.0); + LArShapeP1 larShapeP1(vShape, vShapeDer); + + transObj->m_correctionVec.resize(ncorrs, LArShapeTransType1::CorrectionPair(0, larShapeP1)); + } + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (shapeIndex >= persObj->m_vShape.size() || + shapederIndex >= persObj->m_vShapeDer.size()) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p1::persToTrans - shape index too large: shape/size, shapeder/size " + << shapeIndex << " " << persObj->m_vShape.size() << " " + << shapederIndex << " " << persObj->m_vShapeDer.size() + << endreq; + return; + } + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + // Loop over shapes per channel + for (unsigned int k = 0; k < persObj->m_vShapeSize; ++k){ + transObj->m_correctionVec[i].second.m_vShape[k] = persObj->m_vShape[shapeIndex]; + shapeIndex++; + } + // Loop over shapeders per channel + for (unsigned int k = 0; k < persObj->m_vShapeDerSize; ++k){ + transObj->m_correctionVec[i].second.m_vShapeDer[k] = persObj->m_vShapeDer[shapederIndex]; + shapederIndex++; + } + } + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + +} + + + + +void +LArShapeSubsetCnv_p1::transToPers(const LArShapeTransType1* transObj, + LArShapePersType1* persObj, + MsgStream &log) +{ + + // Copy conditions + + // We copy all shapes into a single vector and the same for + // shaperDers. + // For the conditions, there are two situations to treat: + // 1) dense data: normal conditions where each feb has 128 + // channels and all channels have data, + // 2) sparse data: conditions data where some channels are + // missing data. This is true for MC conditions (only some + // channels have data, and symmetry is used to obtain + // conditions for the rest of the channels), as well for + // 'normal' conditions it may happen that some channels may + // be missing data. + // + // Treating 1) is straight-forward. For 2) we need to keep track + // of which channels are present. We do so with + // m_subset.m_febsWithSparseData where we store the febid followed by + // four unsigned ints which contain the full bit pattern of the + // channels set (i.e. bits 0-127). + // + // Note that one may also have a subset with all channels missing + // data. In this case, we do not write out the empty subset. + // + // Finally, for corrections, we save the channel ids in + // m_subset.m_corrChannels and the shapes and shapeders in the + // same vectors as the rest of the conditions data. + // + // For each channel with data, the number of shapes and shape + // derivatives is assumed constant. This is calculated at the + // beginning, along with whether a feb is sparse or not. + // + + // Get the number of channels, corrections and the size of shape and shapeder + unsigned int nfebs = transObj->m_subset.size(); + unsigned int nsubsetsNotEmpty = 0; + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nchans = 0; + unsigned int nShapes = 0; + unsigned int nShapeDers = 0; + bool foundNShapes = false; + std::vector<unsigned int> febsWithSparseData; + + // Find the number of shapes/shapeders and check for sparse + // conditions, e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + + // Loop over channels and check if this subset has sparse data + bool subsetIsSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { + const LArShapeP1& shape = transObj->m_subset[i].second[j]; + if (shape.m_vShape.size() == 0) { + if (!subsetIsSparse) { + // save febids for sparse subsets + subsetIsSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first); + } + } + else { + nchans++; // count number of channels + if (!foundNShapes) { + // Save the number of shapes and derivatives from first channels present + nShapes = shape.m_vShape.size(); + nShapeDers = shape.m_vShapeDer.size(); + foundNShapes = true; + } + } + } + } + if (!foundNShapes) { + // Save the number of shapes and derivatives from first + // correct - couldn't find it from channels + const LArShapeP1& shape = transObj->m_correctionVec[0].second; + nShapes = shape.m_vShape.size(); + nShapeDers = shape.m_vShapeDer.size(); + } + if (nShapes == 0 && nShapeDers == 0) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p1::transToPers - cannot get number of shapes and shape derivatives" + << endreq; + return; + } + + // Save sizes + persObj->m_vShapeSize = nShapes; + persObj->m_vShapeDerSize = nShapeDers; + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + unsigned int nShapesTot = (nchans + ncorrs)*nShapes; + unsigned int nShapeDersTot = (nchans + ncorrs)*nShapeDers; + persObj->m_vShape.reserve(nShapesTot); + persObj->m_vShapeDer.reserve(nShapeDersTot); + + // For subsets with sparse data, reserve space for identifying + // channels written out: + // 1 - febid + // 4 - for 128 bits (4*32) + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); + + // Copy conditions in subset + unsigned int isparse = 0; + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + + + bool isSparse = false; + if (isparse < febsWithSparseData.size() && + febsWithSparseData[isparse] == febid) { + // sparse subset, save channels with data + isparse++; + isSparse = true; + // save febid + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + // Now loop over channels and save shapes/shapeders and + // channel number + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveShapes = true; + if (isSparse) { + // subset with sparse data + + if (transObj->m_subset[i].second[j].m_vShape.size() > 0) { + // store the channel number in bit map + if (j < chansOffset || (j - chansOffset) > 31) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p1::transToPers - incorrect channel indexing: j, chansOffset: " << j << " " << chansOffset + << endreq; + } + chansSet |= (1 << (j - chansOffset)); + } + else { + saveShapes = false; + } + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; + } + } + if (saveShapes) { + // save shapes + for (unsigned int k = 0; k < nShapes; ++k){ + persObj->m_vShape.push_back(transObj->m_subset[i].second[j].m_vShape[k]); + } + // save shapeders + for (unsigned int k = 0; k < nShapeDers; ++k){ + persObj->m_vShapeDer.push_back(transObj->m_subset[i].second[j].m_vShapeDer[k]); + } + } + +// static unsigned int nch = 0; +// ++nch; +// std::cout << "transToPers - i, j, save " << i << " " << j << " " +// << saveShapes << " " << nch << " febid " << febid +// << " chansSet " << std::hex << chansSet << std::dec +// << " chansOffset " << chansOffset +// << std::endl; + + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // Shapes + for (unsigned int k = 0; k < nShapes; ++k){ + persObj->m_vShape.push_back(transObj->m_correctionVec[i].second.m_vShape[k]); + } + // ShapeDers + for (unsigned int k = 0; k < nShapeDers; ++k){ + persObj->m_vShapeDer.push_back(transObj->m_correctionVec[i].second.m_vShapeDer[k]); + } + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7073dd1b845699caafc924e959a8256b0d1774eb --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx @@ -0,0 +1,393 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define private public +#define protected public +#include "LArRawConditions/LArConditionsSubset.h" +#undef private +#undef protected + +#include "LArCondTPCnv/LArShapeSubsetCnv_p2.h" + +void +LArShapeSubsetCnv_p2::persToTrans(const LArShapePersType2* persObj, + LArShapeTransType2* transObj, + MsgStream & log) +{ + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned int nPhases = persObj->m_nPhases; + unsigned int nSamples = persObj->m_nSamples; + unsigned int dataIndex = 0; + unsigned int timeIndex = 0; + + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + // Loop over febs + unsigned int febid = 0; + unsigned int ifebWithData = 0; // counter for febs with data + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + febid = transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + bool hasSparseData = false; + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() && + febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) { + // Found feb with sparse data + hasSparseData = true; + ifebWithData++; + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset = 0; + ifebWithData++; + } + + // Loop over channels in feb - only some channels are filled + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + + bool copyChannel = true; + if (hasSparseData) { + if (!(chansSet & (1 << (j - chansOffset)))) { + // Channel is missing data - skip + copyChannel = false; + } + if (j%32 == 31 && j < 126) { + chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData]; + chansOffset += 32; + ifebWithData++; + } + } + if (copyChannel) { + + // Channel has shapes - loop over shapes per channel and + // copy to the persistent object + + // check indexes + if (dataIndex >= persObj->m_vShape.size() || + dataIndex >= persObj->m_vShapeDer.size() || + timeIndex >= persObj->m_timeOffset.size() || + timeIndex >= persObj->m_timeBinWidth.size()) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p2::persToTrans - shape index too large: shapeIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size " + << dataIndex << " " << persObj->m_vShape.size() << " " + << persObj->m_vShapeDer.size() << " " << timeIndex << " " + << persObj->m_timeOffset.size() << " " + << persObj->m_timeBinWidth.size() + << endreq; + return; + } + + LArShapeTransType2::Reference shape = + transObj->m_subset[i].second[j]; + LArShapeP2 tmp (persObj->m_timeOffset[timeIndex], + persObj->m_timeBinWidth[timeIndex], + nPhases, + nSamples, + persObj->m_vShape, + persObj->m_vShapeDer, + dataIndex); + shape.assign (tmp); + ++timeIndex; + dataIndex += nPhases * nSamples; + } + } + } + + // Copy corrections + + if (ncorrs) { + // corrs exist - resize vector + std::vector<float> vSamples(nSamples, 0.0); + std::vector<std::vector<float> > vShape(nPhases, vSamples); + LArShapeP2 larShapeP2(0.0, 0.0, vShape, vShape); + + transObj->m_correctionVec.resize(ncorrs, LArShapeTransType2::CorrectionPair(0, larShapeP2)); + } + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // check indexes + if (dataIndex >= persObj->m_vShape.size() || + dataIndex >= persObj->m_vShapeDer.size() || + timeIndex >= persObj->m_timeOffset.size() || + timeIndex >= persObj->m_timeBinWidth.size()) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p2::persToTrans - data index too large: dataIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size " + << dataIndex << " " << persObj->m_vShape.size() << " " + << persObj->m_vShapeDer.size() << " " << timeIndex << " " + << persObj->m_timeOffset.size() << " " + << persObj->m_timeBinWidth.size() + << endreq; + return; + } + + // copy channel id + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + + LArShapeP2& shape = transObj->m_correctionVec[i].second; + LArShapeP2 tmp (persObj->m_timeOffset[timeIndex], + persObj->m_timeBinWidth[timeIndex], + nPhases, + nSamples, + persObj->m_vShape, + persObj->m_vShapeDer, + dataIndex); + shape.setFrom (tmp); + ++timeIndex; + dataIndex += nPhases * nSamples; + } + + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + transObj->m_subset.trim(); +} + + + + +void +LArShapeSubsetCnv_p2::transToPers(const LArShapeTransType2* transObj, + LArShapePersType2* persObj, + MsgStream &log) +{ + + // Copy conditions + + // We copy all shapes into a few simple vectors. + // For the conditions, there are two situations to treat: + // 1) dense data: normal conditions where each feb has 128 + // channels and all channels have data, + // 2) sparse data: conditions data where some channels are + // missing data. This is true for MC conditions (only some + // channels have data, and symmetry is used to obtain + // conditions for the rest of the channels), as well for + // 'normal' conditions it may happen that some channels may + // be missing data. + // + // Treating 1) is straight-forward. For 2) we need to keep track + // of which channels are present. We do so with + // m_subset.m_febsWithSparseData where we store the febid followed by + // four unsigned ints which contain the full bit pattern of the + // channels set (i.e. bits 0-127). + // + // Note that one may also have a subset with all channels missing + // data. In this case, we do not write out the empty subset. + // + // Finally, for corrections, we save the channel ids in + // m_subset.m_corrChannels and the shapes in the same vectors as the + // rest of the conditions data. + // + // For each channel with data, the number of shapes is assumed + // constant. This is calculated at the beginning, along with + // whether a feb is sparse or not. + // + + // Get the number of channels, corrections and the size of shape vectors + unsigned int nfebs = transObj->m_subset.size(); + unsigned int nsubsetsNotEmpty = 0; + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nchans = 0; + unsigned int nPhases = 0; + unsigned int nSamples = 0; + bool foundShapes = false; + std::vector<unsigned int> febsWithSparseData; + + // Find the number of shapes and check for sparse conditions, + // e.g. MC conditions + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p2::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + + // Loop over channels and check if this subset has sparse data + bool subsetIsSparse = false; + for (unsigned int j = 0; j < nfebChans; ++j) { + LArShapeTransType2::ConstReference shapes = + transObj->m_subset[i].second[j]; + if (shapes.shapeSize() == 0) { + if (!subsetIsSparse) { + // save febids for sparse subsets + subsetIsSparse = true; + febsWithSparseData.push_back(transObj->m_subset[i].first); + } + } + else { + nchans++; // count number of channels + if (!foundShapes) { + // Save the number of phases and samples for each + // shape from first channels present + nPhases = shapes.shapeSize(); + nSamples = shapes.shape(0).size(); + foundShapes = true; + } + } + } + } + if (!foundShapes && ncorrs>0) { + // Save the number of phases and samples for each shape from + // first correction - couldn't find it from channels + const LArShapeP2& shapes = transObj->m_correctionVec[0].second; + nPhases = shapes.shapeSize(); + nSamples = shapes.shape(0).size(); + } + + // Save sizes + persObj->m_nPhases = nPhases; + persObj->m_nSamples = nSamples; + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + unsigned int ndataTot = (nchans + ncorrs)*nPhases*nSamples; + unsigned int nTime = (nchans + ncorrs); + persObj->m_vShape.reserve(ndataTot); + persObj->m_vShapeDer.reserve(ndataTot); + persObj->m_timeOffset.reserve(nTime); + persObj->m_timeBinWidth.reserve(nTime); + + // For subsets with sparse data, reserve space for identifying + // channels written out: + // 1 - febid + // 4 - for 128 bits (4*32) + if (febsWithSparseData.size()) + persObj->m_subset.m_febsWithSparseData.reserve(febsWithSparseData.size()*5); + + // Copy conditions in subset + unsigned int isparse = 0; + for (unsigned int i = 0; i < nfebs; ++i){ + + unsigned int nfebChans = transObj->m_subset[i].second.size(); + + // skip subsets without any channels + if (nfebChans == 0) continue; + + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + + + bool isSparse = false; + if (isparse < febsWithSparseData.size() && + febsWithSparseData[isparse] == febid) { + // sparse subset, save channels with data + isparse++; + isSparse = true; + // save febid + persObj->m_subset.m_febsWithSparseData.push_back(febid); + } + + // Now loop over channels + unsigned int chansSet = 0; + unsigned int chansOffset = 0; + for (unsigned int j = 0; j < nfebChans; ++j){ + + bool saveShapes = true; + if (isSparse) { + // subset with sparse data + if (transObj->m_subset[i].second[j].shapeSize() > 0) { + // store the channel number in bit map + if (j < chansOffset || (j - chansOffset) > 31) { + log << MSG::ERROR + << "LArShapeSubsetCnv_p2::transToPers - incorrect channel indexing: j, chansOffset: " << j << " " << chansOffset + << endreq; + } + chansSet |= (1 << (j - chansOffset)); + } + else { + saveShapes = false; + } + // Save chansSet + if (j == (chansOffset + 31)) { + persObj->m_subset.m_febsWithSparseData.push_back(chansSet); + chansSet = 0; + chansOffset += 32; + } + } + if (saveShapes) { + bool tooSmall=false; + // Loop over phases and samples per channel + for (unsigned int k = 0; k < nPhases; ++k) { + for (unsigned int l = 0; l < nSamples; ++l) { + //check if data object is big enough + if (k>=transObj->m_subset[i].second[j].shapeSize() || l>=transObj->m_subset[i].second[j].shape(k).size()) { + tooSmall=true; + persObj->m_vShape.push_back(0.); + persObj->m_vShapeDer.push_back(0.); + } + else { + persObj->m_vShape.push_back(transObj->m_subset[i].second[j].shape(k)[l]); + persObj->m_vShapeDer.push_back(transObj->m_subset[i].second[j].shapeDer(k)[l]); +// std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel=" +// << j << " Phase="<< k<< " Sample " << l << " Shape=" +// << transObj->m_subset[i].second[j].m_vShape[k][l] << std::endl; + } + } + } + // set time offset and binwidth + persObj->m_timeOffset.push_back(transObj->m_subset[i].second[j].timeOffset()); + persObj->m_timeBinWidth.push_back(transObj->m_subset[i].second[j].timeBinWidth()); + if (tooSmall) + log << MSG::ERROR << "Feb 0x" << std::hex << febid << std::dec << " channel " << j <<": Shape object too small. Expected " + << nPhases << " phases and " << nSamples << " samples. Padded with 0.0" << endreq; + } + +// static unsigned int nch = 0; +// ++nch; +// std::cout << "transToPers - i, j, save " << i << " " << j << " " +// << saveShapes << " " << nch << " febid " << febid +// << " chansSet " << std::hex << chansSet << std::dec +// << " chansOffset " << chansOffset +// << std::endl; + + } + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + // Save channel id in febid vector + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + // Shapes + bool tooSmall=false; + // Loop over phases and samples per channel + for (unsigned int k = 0; k < nPhases; ++k) { + for (unsigned int l = 0; l < nSamples; ++l) { + if (k>=transObj->m_correctionVec[i].second.shapeSize() || l>=transObj->m_correctionVec[i].second.shape(k).size()) { + tooSmall=true; + persObj->m_vShape.push_back(0.); + persObj->m_vShapeDer.push_back(0.); + } + else { + persObj->m_vShape.push_back(transObj->m_correctionVec[i].second.shape(k)[l]); + persObj->m_vShapeDer.push_back(transObj->m_correctionVec[i].second.shapeDer(k)[l]); + } + } + } + // set time offset and binwidth + persObj->m_timeOffset.push_back(transObj->m_correctionVec[i].second.timeOffset()); + persObj->m_timeBinWidth.push_back(transObj->m_correctionVec[i].second.timeBinWidth()); + if (tooSmall) + log << MSG::ERROR << "Correction index "<< i <<"(channel 0x" << std::hex << transObj->m_correctionVec[i].first << std::dec << + "): Shape object too small. Expected " << nPhases << " phases and " << nSamples << " samples. Padded with 0.0" << endreq; + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; + +} diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArSingleFloatSubsetCnv_p1.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArSingleFloatSubsetCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..de5a0d78af8b166567e803e74de3ef9af0822e3c --- /dev/null +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArSingleFloatSubsetCnv_p1.cxx @@ -0,0 +1,112 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h" + +#include "LArElecCalib/LArCalibErrorCode.h" +#include "CopyFloatWithErrorcode.h" + +void +LArSingleFloatSubsetCnv_p1::persToTrans(const SingleFloatPersType* persObj, + SingleFloatTransType* transObj, + MsgStream & /*log*/) { + // Copy conditions + unsigned int ncorrs = persObj->m_subset.m_corrChannels.size(); + unsigned int nfebids = persObj->m_subset.m_febIds.size(); + unsigned index =0; + // resize subset to with then number of febids + transObj->m_subset.resize(nfebids); + + for (unsigned int i = 0; i < nfebids; ++i){ + // Set febid + transObj->m_subset[i].first = persObj->m_subset.m_febIds[i]; + // Fill channels with empty vectors + transObj->m_subset[i].second.resize(NCHANNELPERFEB); + // Loop over channels in feb + for (unsigned int j = 0; j < NCHANNELPERFEB; ++j){ + //transObj->m_subset[i].second[j].m_data=persObj->m_values[index]; + const float& data=persObj->m_values[index]; + if (data<=1.0+LArElecCalib::ERRORCODE) + transObj->m_subset[i].second[j].m_data=LArElecCalib::ERRORCODE; + else + transObj->m_subset[i].second[j].m_data=data; + + // std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel=" + // << j << " Payload= << + ++index; + } + } + + transObj->m_correctionVec.reserve(ncorrs); + + // Loop over corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + transObj->m_correctionVec[i].first = persObj->m_subset.m_corrChannels[i]; + //transObj->m_correctionVec[i].second.m_data=persObj->m_values[index]; + const float& data=persObj->m_values[index]; + if (data<=1.0+LArElecCalib::ERRORCODE) + transObj->m_correctionVec[i].second.m_data=LArElecCalib::ERRORCODE; + else + transObj->m_correctionVec[i].second.m_data=data; + ++index; + } + // Copy the rest + transObj->m_gain = persObj->m_subset.m_gain; + transObj->m_channel = persObj->m_subset.m_channel; + transObj->m_groupingType = persObj->m_subset.m_groupingType; + + return; +} + + + + + +void +LArSingleFloatSubsetCnv_p1::transToPers(const SingleFloatTransType* transObj, + SingleFloatPersType* persObj, + MsgStream &log) +{ + // Get the number of channels, corrections and the size of pedestal and pedestalrms + unsigned int nfebs = transObj->m_subset.size(); + unsigned int ncorrs = transObj->m_correctionVec.size(); + unsigned int nsubsetsNotEmpty = 0; + + for (unsigned int i = 0; i < nfebs; ++i){ + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans != 0 && nfebChans != NCHANNELPERFEB) { + log << MSG::ERROR + << "LArSingleFloatSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans + << endreq; + return; + } + if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets + } + + // Reserve space in vectors + persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty); + persObj->m_subset.m_corrChannels.reserve(ncorrs); + persObj->m_values.reserve(ncorrs+nsubsetsNotEmpty*NCHANNELPERFEB); + + //Copy subsets + for (unsigned int i = 0; i < nfebs; ++i) {//Loop over FEBs + unsigned int nfebChans = transObj->m_subset[i].second.size(); + if (nfebChans==0) continue; + unsigned int febid = transObj->m_subset[i].first; + persObj->m_subset.m_febIds.push_back(febid); + for (unsigned int j=0; j<nfebChans;++j) //Loop over channels in FEB + persObj->m_values.push_back(transObj->m_subset[i].second[j].m_data); + } + + // Copy corrections + for (unsigned int i = 0; i < ncorrs; ++i){ + persObj->m_subset.m_corrChannels.push_back(transObj->m_correctionVec[i].first); + persObj->m_values.push_back(transObj->m_correctionVec[i].second.m_data); + } + + // Copy the rest + persObj->m_subset.m_gain = transObj->m_gain; + persObj->m_subset.m_channel = transObj->m_channel; + persObj->m_subset.m_groupingType = transObj->m_groupingType; +}