Skip to content

Commit

Permalink
Clang-Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed May 29, 2019
1 parent 5b62bf9 commit 54ee179
Show file tree
Hide file tree
Showing 19 changed files with 702 additions and 907 deletions.
150 changes: 55 additions & 95 deletions DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h
Expand Up @@ -13,116 +13,76 @@
#include <cstdint>
#include "DataFormats/CTPPSDigi/interface/HPTDCErrorFlags.h"

class CTPPSDiamondDigi{

public:

CTPPSDiamondDigi(unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_);
CTPPSDiamondDigi();
~CTPPSDiamondDigi() {};

/// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags
bool operator==(const CTPPSDiamondDigi& digi) const;

/// Return digi values number

unsigned int getLeadingEdge() const
{
return ledgt;
}

unsigned int getTrailingEdge() const
{
return tedgt;
}

unsigned int getThresholdVoltage() const
{
return threvolt;
}

bool getMultipleHit() const
{
return mhit;
}

HPTDCErrorFlags getHPTDCErrorFlags() const
{
return hptdcerror;
}

/// Set digi values
inline void setLeadingEdge(unsigned int ledgt_)
{
ledgt = ledgt_;
}
inline void setTrailingEdge(unsigned int tedgt_)
{
tedgt = tedgt_;
}
inline void setThresholdVoltage(unsigned int threvolt_)
{
threvolt = threvolt_;
}
inline void setMultipleHit(bool mhit_)
{
mhit = mhit_;
}
inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_)
{
hptdcerror = hptdcerror_;
}


private:
// variable represents leading edge time
unsigned int ledgt;
// variable represents trailing edge time
unsigned int tedgt;
// variable represents threshold voltage
unsigned int threvolt;
// variable represents multi-hit
bool mhit;
HPTDCErrorFlags hptdcerror;
class CTPPSDiamondDigi {
public:
CTPPSDiamondDigi(
unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_);
CTPPSDiamondDigi();
~CTPPSDiamondDigi(){};

/// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags
bool operator==(const CTPPSDiamondDigi& digi) const;

/// Return digi values number

unsigned int getLeadingEdge() const { return ledgt; }

unsigned int getTrailingEdge() const { return tedgt; }

unsigned int getThresholdVoltage() const { return threvolt; }

bool getMultipleHit() const { return mhit; }

HPTDCErrorFlags getHPTDCErrorFlags() const { return hptdcerror; }

/// Set digi values
inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; }
inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; }
inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; }
inline void setMultipleHit(bool mhit_) { mhit = mhit_; }
inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; }

private:
// variable represents leading edge time
unsigned int ledgt;
// variable represents trailing edge time
unsigned int tedgt;
// variable represents threshold voltage
unsigned int threvolt;
// variable represents multi-hit
bool mhit;
HPTDCErrorFlags hptdcerror;
};

#include <iostream>


inline bool operator< (const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other)
{
if( one.getLeadingEdge() < other.getLeadingEdge() )
return true;
if( one.getLeadingEdge() > other.getLeadingEdge() )
inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) {
if (one.getLeadingEdge() < other.getLeadingEdge())
return true;
if (one.getLeadingEdge() > other.getLeadingEdge())
return false;
if( one.getTrailingEdge() < other.getTrailingEdge() )
if (one.getTrailingEdge() < other.getTrailingEdge())
return true;
if( one.getTrailingEdge() > other.getTrailingEdge() )
if (one.getTrailingEdge() > other.getTrailingEdge())
return false;
if( one.getMultipleHit() < other.getMultipleHit() )
if (one.getMultipleHit() < other.getMultipleHit())
return true;
if( one.getMultipleHit() > other.getMultipleHit() )
if (one.getMultipleHit() > other.getMultipleHit())
return false;
if( one.getHPTDCErrorFlags().getErrorFlag() < other.getHPTDCErrorFlags().getErrorFlag() )
if (one.getHPTDCErrorFlags().getErrorFlag() < other.getHPTDCErrorFlags().getErrorFlag())
return true;
if( one.getHPTDCErrorFlags().getErrorFlag() > other.getHPTDCErrorFlags().getErrorFlag() )
if (one.getHPTDCErrorFlags().getErrorFlag() > other.getHPTDCErrorFlags().getErrorFlag())
return false;
if( one.getThresholdVoltage() < other.getThresholdVoltage() )
if (one.getThresholdVoltage() < other.getThresholdVoltage())
return true;
if( one.getThresholdVoltage() > other.getThresholdVoltage() )
if (one.getThresholdVoltage() > other.getThresholdVoltage())
return false;
return false;
}

}

inline std::ostream & operator<<(std::ostream & o, const CTPPSDiamondDigi& digi)
{
return o << " " << digi.getLeadingEdge()
<< " " << digi.getTrailingEdge()
<< " " << digi.getThresholdVoltage()
<< " " << digi.getMultipleHit()
<< " " << digi.getHPTDCErrorFlags().getErrorFlag();
inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) {
return o << " " << digi.getLeadingEdge() << " " << digi.getTrailingEdge() << " " << digi.getThresholdVoltage() << " "
<< digi.getMultipleHit() << " " << digi.getHPTDCErrorFlags().getErrorFlag();
}

#endif

38 changes: 17 additions & 21 deletions DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h
Expand Up @@ -3,10 +3,10 @@

//---------------------------------------------------------------------------
//! \class CTPPSPixelDataError
//! \brief Pixel error -- collection of errors
//! \brief Pixel error -- collection of errors
//!
//! Class storing info about pixel errors
//!
//!
//---------------------------------------------------------------------------

#include "FWCore/Utilities/interface/typedefs.h"
Expand All @@ -16,7 +16,6 @@

class CTPPSPixelDataError {
public:

/// Default constructor
CTPPSPixelDataError();
/// Constructor for 32-bit error word
Expand All @@ -25,36 +24,33 @@ class CTPPSPixelDataError {
CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId);
/// Destructor
~CTPPSPixelDataError();


/// the 32-bit word that contains the error information
inline uint32_t errorWord32() const {return errorWord32_;}
/// the 64-bit word that contains the error information
inline uint64_t errorWord64() const {return errorWord64_;}

/// the 32-bit word that contains the error information
inline uint32_t errorWord32() const { return errorWord32_; }
/// the 64-bit word that contains the error information
inline uint64_t errorWord64() const { return errorWord64_; }
/// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors)
inline int errorType() const {return errorType_;}
/// the fedId where the error occured
inline int fedId() const {return fedId_;}
/// the error message to be displayed with the error
inline const std::string & errorMessage() const {
if(errorType_>=25 && errorType_ <= 37) return errorMessages_[errorType_-24];
inline int errorType() const { return errorType_; }
/// the fedId where the error occured
inline int fedId() const { return fedId_; }
/// the error message to be displayed with the error
inline const std::string& errorMessage() const {
if (errorType_ >= 25 && errorType_ <= 37)
return errorMessages_[errorType_ - 24];
return errorMessages_[0];
}

}

private:

static const std::array<std::string, 14> errorMessages_;

uint64_t errorWord64_;
uint32_t errorWord32_;
uint32_t errorWord32_;
int errorType_;
int fedId_;

};

/// Comparison operators
inline bool operator<( const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) {
inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) {
return one.fedId() < other.fedId();
}

Expand Down
60 changes: 26 additions & 34 deletions DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h
Expand Up @@ -9,66 +9,58 @@

class CTPPSPixelDigi {
public:
CTPPSPixelDigi(int packed_value) : theData(packed_value) {}

CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); }

CTPPSPixelDigi( int packed_value) : theData(packed_value) {}

CTPPSPixelDigi( int row, int col, int adc) {
init( row, col, adc);
}

CTPPSPixelDigi( int chan, int adc) {
std::pair<int,int> rc = channelToPixel(chan);
init( rc.first, rc.second, adc);
CTPPSPixelDigi(int chan, int adc) {
std::pair<int, int> rc = channelToPixel(chan);
init(rc.first, rc.second, adc);
}

CTPPSPixelDigi() : theData(0) {}
CTPPSPixelDigi() : theData(0) {}

/// Access to digi information
int row() const {return (theData >> row_shift) & row_mask;}
int column() const {return (theData >> column_shift) & column_mask;}
unsigned short adc() const {return (theData >> adc_shift) & adc_mask;}
uint32_t packedData() const {return theData;}
int row() const { return (theData >> row_shift) & row_mask; }
int column() const { return (theData >> column_shift) & column_mask; }
unsigned short adc() const { return (theData >> adc_shift) & adc_mask; }
uint32_t packedData() const { return theData; }

static std::pair<int,int> channelToPixel( int ch) {
int row = ( ch >> column_width_ch) & row_mask_ch;
static std::pair<int, int> channelToPixel(int ch) {
int row = (ch >> column_width_ch) & row_mask_ch;
int col = ch & column_mask_ch;
return std::pair<int,int>(row,col);
return std::pair<int, int>(row, col);
}

static int pixelToChannel( int row, int col) {
return (row << column_width_ch) | col;
}
static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; }

int channel() const {return pixelToChannel( row(), column());}
int channel() const { return pixelToChannel(row(), column()); }

/// const values for digi packing with bit structure: adc_bits+col_bits+row_bits
/// const values for digi packing with bit structure: adc_bits+col_bits+row_bits
static const uint32_t row_shift, column_shift, adc_shift;
static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask;
static const uint32_t row_width, column_width, adc_width;
static const uint32_t max_row, max_column, max_adc;

/// const values for channel definition with bit structure: row_bits+col_bits
static const uint32_t column_width_ch;
/// const values for channel definition with bit structure: row_bits+col_bits
static const uint32_t column_width_ch;
static const uint32_t column_mask_ch;
static const uint32_t row_mask_ch;

private:

void init( int row, int col, int adc) ;
private:
void init(int row, int col, int adc);
uint32_t theData;
};
};

/// Comparison operator

inline bool operator<( const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) {
return (one.packedData()&CTPPSPixelDigi::rowcol_mask) < (other.packedData()&CTPPSPixelDigi::rowcol_mask);
inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) {
return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask);
}

#include<iostream>
inline std::ostream & operator<<(std::ostream & o, const CTPPSPixelDigi& digi) {
return o << " " << digi.row() << " " << digi.column()
<< " " << digi.adc();
#include <iostream>
inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) {
return o << " " << digi.row() << " " << digi.column() << " " << digi.adc();
}

#endif
13 changes: 5 additions & 8 deletions DataFormats/CTPPSDigi/interface/CTPPSPixelDigiCollection.h
Expand Up @@ -7,25 +7,22 @@
#include <utility>

class CTPPSPixelDigiCollection {

public:

public:
typedef std::vector<CTPPSPixelDigi>::const_iterator ContainerIterator;
typedef std::pair<ContainerIterator, ContainerIterator> Range;
typedef std::pair<unsigned int, unsigned int> IndexRange;
typedef std::map<unsigned int, IndexRange> Registry;
typedef std::map<unsigned int, IndexRange>::const_iterator RegistryIterator;

CTPPSPixelDigiCollection() {}

void put(Range input, unsigned int detID);
const Range get(unsigned int detID) const;
const std::vector<unsigned int> detIDs() const;
private:

private:
std::vector<CTPPSPixelDigi> container_;
Registry map_;

};

#endif
#endif

0 comments on commit 54ee179

Please sign in to comment.