diff --git a/Event/xAOD/xAODEventInfo/Root/EventInfoAuxContainer_v1.cxx b/Event/xAOD/xAODEventInfo/Root/EventInfoAuxContainer_v1.cxx index 22f8bbcbcbf8b22ad2d9d83ea36834a206aade26..095d6e07a61a469b21cca0ed58cfd47640d841ae 100644 --- a/Event/xAOD/xAODEventInfo/Root/EventInfoAuxContainer_v1.cxx +++ b/Event/xAOD/xAODEventInfo/Root/EventInfoAuxContainer_v1.cxx @@ -49,6 +49,10 @@ namespace xAOD { AUX_VARIABLE( mcChannelNumber ); AUX_VARIABLE( mcEventNumber ); AUX_VARIABLE( mcEventWeights ); + + // Pileup information: + AUX_VARIABLE( pileUpMixtureIDLowBits ); + AUX_VARIABLE( pileUpMixtureIDHighBits ); } /** diff --git a/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx b/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx index dcf950f390e2c2dcf997da62d6b088c2f63875e0..9fabf1a9c85a18a112a54110aa6511289f32563a 100644 --- a/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx +++ b/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx @@ -350,6 +350,37 @@ namespace xAOD { AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, float, averageInteractionsPerCrossing, setAverageInteractionsPerCrossing ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + pileUpMixtureIDLowBits, + setPileUpMixtureIDLowBits ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + pileUpMixtureIDHighBits, + setPileUpMixtureIDHighBits ) + + EventInfo_v1::PileUpMixtureID EventInfo_v1::pileUpMixtureID() const { + + static const Accessor< unsigned long long > accLow( "pileUpMixtureIDLowBits" ); + static const Accessor< unsigned long long > accHigh( "pileUpMixtureIDHighBits" ); + + PileUpMixtureID id{}; + + // We need to check if the values are actually stored + if ( accLow.isAvailable( *this ) && accHigh.isAvailable( *this ) ) { + id.lowBits = pileUpMixtureIDLowBits(); + id.highBits = pileUpMixtureIDHighBits(); + } + + return id; + + } + + void EventInfo_v1::setPileUpMixtureID( const PileUpMixtureID& value ) { + + setPileUpMixtureIDLowBits( value.lowBits ); + setPileUpMixtureIDHighBits( value.highBits ); + + } EventInfo_v1::SubEvent:: SubEvent( int16_t time, uint16_t index, PileUpType type, @@ -966,4 +997,48 @@ namespace xAOD { return out; } + /// This operator is provided to make it convenient to print debug messages + /// including information about the PileUpMixtureID in hex. + /// + /// @param out The output stream to write PileUpMixtureID information to + /// @param id The PileUpMixtureID object to print information about + /// @returns The same output stream that the operator received + /// + std::ostream& operator<<( std::ostream &out, + const xAOD::EventInfo_v1::PileUpMixtureID& id ) { + + // Get the current state of the stream: + const char fillChar = out.fill(); + const std::ios_base::fmtflags flags = out.flags(); + const std::streamsize width = out.width(); + + // Do the printout: + out << std::hex << std::setw( 16 ) << std::setfill( '0' ); + out << id.lowBits; + out << id.highBits; + + // Restore the original state of the stream: + out.fill( fillChar ); + out.flags( flags ); + out.width( width ); + + + // Return the stream: + return out; + } + + /// This operator is provided to make it convenient to compare two + /// instances of PileUpMixtureID directly. + /// + /// @param a The PileUpMixtureID object to compare + /// @param b The PileUpMixtureID object to compare + /// @returns Comparison result + /// + bool operator== ( const xAOD::EventInfo_v1::PileUpMixtureID& a, + const xAOD::EventInfo_v1::PileUpMixtureID& b ) { + + return a.lowBits == b.lowBits && a.highBits == b.highBits; + + } + } // namespace xAOD diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h index d26545d105c7de9b167b87d3c2db68c3f999d846..cbae095f29c357c1103555d169d9081dad19f752 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h @@ -115,7 +115,11 @@ namespace xAOD { std::vector< std::vector< float > > mcEventWeights; /// @} - + /// @name Pileup information + /// @{ + std::vector< unsigned long long > pileUpMixtureIDLowBits; + std::vector< unsigned long long > pileUpMixtureIDHighBits; + /// @} /// Keep track of the event status flags. /// The set bits here correspond to the auxids of all unlocked diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h index fde9e62af7e9dbe7a554360e15b78f3fc6cf2721..dbc7ee3fa74304ae1eaa36ee130ec11b2d30f183 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h @@ -245,6 +245,27 @@ namespace xAOD { /// Set average interactions per crossing for all BCIDs void setAverageInteractionsPerCrossing( float value ); + /// Unique pile-up mixture identifier definition + struct PileUpMixtureID { + unsigned long long lowBits{}; + unsigned long long highBits{}; + }; + + /// Unique pile-up mixture identifier + PileUpMixtureID pileUpMixtureID() const; + /// Set unique pile-up mixture identifier + void setPileUpMixtureID( const PileUpMixtureID &value ); + + /// Unique pile-up mixture identifier low bits + unsigned long long pileUpMixtureIDLowBits() const; + /// Set unique pile-up mixture identifier low bits + void setPileUpMixtureIDLowBits( unsigned long long value ); + + /// Unique pile-up mixture identifier high bits + unsigned long long pileUpMixtureIDHighBits() const; + /// Set unique pile-up mixture identifier high bits + void setPileUpMixtureIDHighBits( unsigned long long value ); + /// Enumerator describing the types of pileup events enum PileUpType { Unknown = 99, ///< Type not known/specified @@ -498,8 +519,11 @@ namespace xAOD { }; // class EventInfo_v1 - /// A helper operator to be able to print debug messages easily + /// A helper operators to be able to print debug messages easily std::ostream& operator<< ( std::ostream& out, const xAOD::EventInfo_v1& ei ); + std::ostream& operator<< ( std::ostream& out, const xAOD::EventInfo_v1::PileUpMixtureID& id ); + /// PileUpMixtureID comparison helper operator + bool operator== ( const xAOD::EventInfo_v1::PileUpMixtureID& a, const xAOD::EventInfo_v1::PileUpMixtureID& b ); } // namespace xAOD