Skip to content

Commit

Permalink
Clang-Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed May 31, 2019
1 parent 3393a30 commit df3006f
Show file tree
Hide file tree
Showing 199 changed files with 17,577 additions and 15,917 deletions.
164 changes: 75 additions & 89 deletions EventFilter/CastorRawToDigi/interface/CastorCORData.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,37 @@
*/

class CastorCORData {
public:
static const int CHANNELS_PER_SPIGOT ;// = 36;
static const int MAXIMUM_SAMPLES_PER_CHANNEL;// = 20;
public:
static const int CHANNELS_PER_SPIGOT; // = 36;
static const int MAXIMUM_SAMPLES_PER_CHANNEL; // = 20;

CastorCORData();
~CastorCORData() { if (m_ownData!=nullptr) delete [] m_ownData; }
~CastorCORData() {
if (m_ownData != nullptr)
delete[] m_ownData;
}
CastorCORData(int version_to_create);
CastorCORData(const unsigned short* data, int length);
CastorCORData(const CastorCORData&);

CastorCORData& operator=(const CastorCORData&);
void allocate(int version_to_create=0);
void allocate(int version_to_create = 0);
void adoptData(const unsigned short* data, int length);

/** \brief Get the version number of this event */
inline int getFormatVersion() const { return m_formatVersion; }

/** \brief Get a pointer to the raw data */
inline const unsigned short* getRawData() const { return m_rawConst; }

/** \brief Get the length of the raw data */
inline const int getRawLength() const { return m_rawLength; }

/** \brief Check for a good event
Requires a minimum length, matching wordcount and length, not an
empty event */
bool check() const;

/** \brief Obtain the starting and ending pointers for external
unpacking of the data
\param daq_first Pointer to a pointer to the start of the DAQ data
Expand All @@ -48,52 +51,50 @@ class CastorCORData {
\param tp_last Pointer to a pointer to the end of the TP data
*/
//void dataPointers(const unsigned short** daq_first,
//const unsigned short** daq_last,
//const unsigned short** tp_first,
//const unsigned short** tp_last);


//const unsigned short** daq_last,
//const unsigned short** tp_first,
//const unsigned short** tp_last);

/** \brief Unpack the HTR data into TP and DAQ data sorted by channel
\param daq_lengths unsigned char[24] of lengths. High bit set
indicates error with this channel
\param daq_samples unsigned short [24*20] of data
\param tp_lengths unsigned char[24] of lengths
\param tp_samples unsigned short [24*20] of data
*/
void unpack(unsigned char* daq_lengths, unsigned short* daq_samples,
unsigned char* tp_lengths, unsigned short* tp_samples) const;

void unpack(unsigned char* daq_lengths,
unsigned short* daq_samples,
unsigned char* tp_lengths,
unsigned short* tp_samples) const;

/** \brief Unpack special histogramming mode data
\param fiber
\param fiberchan
\param capid Capacitor id for which to extract a histogram
\param histogram unsigned int[32] into which the data should be
deposited
*/
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned
short* histogram) const;

bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short* histogram) const;

/** \brief Unpack the HTR data into TP and DAQ data sorted by channel
\param daq_lengths unsigned char[24] of lengths
\param daq_samples unsigned short [24*20] of data
\param tp_lengths unsigned char[24] of lengths
\param tp_samples unsigned short [24*20] of data
*/
void pack(unsigned char* daq_lengths, unsigned short* daq_samples,
unsigned char* tp_lengths, unsigned short* tp_samples, bool
do_capid=false);
void pack(unsigned char* daq_lengths,
unsigned short* daq_samples,
unsigned char* tp_lengths,
unsigned short* tp_samples,
bool do_capid = false);
/** \brief pack header and trailer (call _after_ pack)*/
void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int
orbitn, int pipeline, int ndd, int nps, int firmwareRev=0);
void packHeaderTrailer(
int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev = 0);

/** \brief Get the HTR event number */
inline unsigned int getL1ANumber() const {
return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8);
}
inline unsigned int getL1ANumber() const { return (m_rawConst[0] & 0xFF) + (m_rawConst[1] << 8); }
/** \brief Get the HTR bunch number */
inline unsigned int getBunchNumber() const {
return (m_rawConst[4]&0xFFF);
}
inline unsigned int getBunchNumber() const { return (m_rawConst[4] & 0xFFF); }
/** \brief Get the HTR orbit number */
unsigned int getOrbitNumber() const;
/** \brief Get the HTR submodule number */
Expand All @@ -113,7 +114,7 @@ class CastorCORData {
bool isUnsuppressed() const;
/** \brief Was this channel passed as part of Mark&Pass ZS?*/
bool wasMarkAndPassZS(int fiber, int fiberchan) const;

/** \brief Is this event a pattern-ram event? */
bool isPatternRAMEvent() const;
/** \brief Is this event a histogram event? (do not call standard
Expand All @@ -127,8 +128,7 @@ class CastorCORData {
/** \brief Get the COR firmware version */
unsigned int getFirmwareRevision() const;
/** \brief Get the errors word */
inline unsigned int getErrorsWord() const {
return m_rawConst[2]&0xFFFF; }
inline unsigned int getErrorsWord() const { return m_rawConst[2] & 0xFFFF; }
/** \brief Get the total number of precision data 16-bit words */
int getNPrecisionWords() const;
/** \brief Get the number of daq data samples per channel when not zero-suppressed */
Expand All @@ -139,65 +139,53 @@ class CastorCORData {
/** \brief Get the number of presamples in daq data */
int getNPS() const;

/** \brief Get DLLunlock bits */
inline unsigned int getDLLunlock() const {
return (m_rawConst[5]>>2)&0x3; }
/** \brief Get DLLunlock bits */
inline unsigned int getDLLunlock() const { return (m_rawConst[5] >> 2) & 0x3; }

/** \brief Get TTCready bits */
inline unsigned int getTTCready() const {
return m_rawConst[5]&0x3; }
/** \brief Get TTCready bits */
inline unsigned int getTTCready() const { return m_rawConst[5] & 0x3; }

/** \brief Get the BCN of the Fiber Orbit Messages */
/** \brief Get the BCN of the Fiber Orbit Messages */
inline unsigned int getFib1OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 12] & 0xFFF);
}
inline unsigned int getFib2OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 11] & 0xFFF);
}

inline unsigned int getFib3OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 10] & 0xFFF);
}

inline unsigned int getFib4OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 9] & 0xFFF);
}

inline unsigned int getFib5OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 8] & 0xFFF);
}

inline unsigned int getFib6OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 7] & 0xFFF);
}

inline unsigned int getFib7OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF);
}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 6] & 0xFFF);
}

inline unsigned int getFib8OrbMsgBCN() const {
return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF);
}



/** \brief Get the COR Ext Header words*/
inline unsigned int getExtHdr1() const {
return (m_rawConst[0]);}
inline unsigned int getExtHdr2() const {
return (m_rawConst[1]); }
inline unsigned int getExtHdr3() const {
return (m_rawConst[2]);}
inline unsigned int getExtHdr4() const {
return (m_rawConst[3]); }
inline unsigned int getExtHdr5() const {
return (m_rawConst[4]);}
inline unsigned int getExtHdr6() const {
return (m_rawConst[5]);}
inline unsigned int getExtHdr7() const {
return (m_rawConst[6]);}
inline unsigned int getExtHdr8() const {
return (m_rawConst[7]);}
return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 5] & 0xFFF);
}

/** \brief Get the COR Ext Header words*/
inline unsigned int getExtHdr1() const { return (m_rawConst[0]); }
inline unsigned int getExtHdr2() const { return (m_rawConst[1]); }
inline unsigned int getExtHdr3() const { return (m_rawConst[2]); }
inline unsigned int getExtHdr4() const { return (m_rawConst[3]); }
inline unsigned int getExtHdr5() const { return (m_rawConst[4]); }
inline unsigned int getExtHdr6() const { return (m_rawConst[5]); }
inline unsigned int getExtHdr7() const { return (m_rawConst[6]); }
inline unsigned int getExtHdr8() const { return (m_rawConst[7]); }

/* unsigned int getFib1OrbMsgBCN() const;
unsigned int getFib2OrbMsgBCN() const;
Expand All @@ -212,18 +200,16 @@ class CastorCORData {
/** \brief Was there an error on the given fiber for this event (only
in histogram mode!) */
// bool wasHistogramError(int ifiber) const;

protected:
void determineSectionLengths(int& tpWords, int& daqWords, int&
headerWords, int& trailerWords, int& triggerWords) const;
void determineSectionLengths(
int& tpWords, int& daqWords, int& headerWords, int& trailerWords, int& triggerWords) const;
void determineStaticLengths(int& headerWords, int& trailerWords, int& triggerWords) const;
int m_formatVersion;
int m_rawLength;
const unsigned short* m_rawConst; // pointer to actual raw data
unsigned short* m_ownData; // local block in raw data format
unsigned short* m_unpackedData; // local data in usable format

const unsigned short* m_rawConst; // pointer to actual raw data
unsigned short* m_ownData; // local block in raw data format
unsigned short* m_unpackedData; // local data in usable format
};

#endif

Loading

0 comments on commit df3006f

Please sign in to comment.