-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7950 from UMN-CMS/amc13_onto_from-CMSSW_7_5_X_201…
…5-02-25-0200_extra Update HCAL Packing/Unpacking
- Loading branch information
Showing
22 changed files
with
426 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#ifndef DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H | ||
#define DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H | ||
|
||
#include "DataFormats/HcalDetId/interface/HcalDetId.h" | ||
#include "DataFormats/Common/interface/DataFrame.h" | ||
#include <ostream> | ||
|
||
/** Precision readout digi from QIE10 including TDC information | ||
*/ | ||
class QIE10DataFrame : protected edm::DataFrame { | ||
public: | ||
|
||
static const int WORDS_PER_SAMPLE = 2; | ||
static const int HEADER_WORDS = 1; | ||
|
||
QIE10DataFrame() { } | ||
QIE10DataFrame(const edm::DataFrameContainer& c, edm::DataFrame::size_type i) : edm::DataFrame(c,i) { } | ||
QIE10DataFrame(edm::DataFrame df) : edm::DataFrame(df) { } | ||
|
||
class Sample { | ||
public: | ||
Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame),i_(i) { } | ||
int adc() const { return frame_[i_]&0xFF; } | ||
int le_tdc() const { return frame_[i_+1]&0x3F; } | ||
int te_tdc() const { return (frame_[i_]>>6)&0x1F; } | ||
bool ok() const { return frame_[i_]&0x1000; } | ||
bool soi() const { return frame_[i_]&0x2000; } | ||
int capid() const { return (frame_[i_+1]>>12)&0x3; } | ||
private: | ||
const edm::DataFrame& frame_; | ||
edm::DataFrame::size_type i_; | ||
}; | ||
|
||
/// Get the detector id | ||
DetId detid() const { return DetId(id()); } | ||
/// total number of samples in the digi | ||
int samples() const { return (size()-1)/2; } | ||
/// get the flavor of the frame | ||
int flavor() const { return ((edm::DataFrame::operator[](0)>>12)&0x7); } | ||
/// was there a link error? | ||
bool linkError() const { return edm::DataFrame::operator[](0)&0x800; } | ||
/// was this a mark-and-pass ZS event? | ||
bool wasMarkAndPass() const {return edm::DataFrame::operator[](0)&0x100; } | ||
/// get the sample | ||
inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(*this,i*2+1); } | ||
/// set the sample contents | ||
void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int fe_tdc, int capid, bool soi=false, bool ok=true); | ||
|
||
}; | ||
|
||
std::ostream& operator<<(std::ostream&, const QIE10DataFrame&); | ||
|
||
|
||
#endif // DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H | ||
#define DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H | ||
|
||
#include "DataFormats/HcalDetId/interface/HcalDetId.h" | ||
#include "DataFormats/Common/interface/DataFrame.h" | ||
#include <ostream> | ||
|
||
/** Precision readout digi from QIE11 including TDC information | ||
*/ | ||
class QIE11DataFrame : protected edm::DataFrame { | ||
public: | ||
|
||
static const int WORDS_PER_SAMPLE = 1; | ||
static const int HEADER_WORDS = 1; | ||
|
||
QIE11DataFrame() { } | ||
QIE11DataFrame(const edm::DataFrameContainer& c, edm::DataFrame::size_type i) : edm::DataFrame(c,i) { } | ||
QIE11DataFrame(edm::DataFrame df) : edm::DataFrame(df) { } | ||
|
||
class Sample { | ||
public: | ||
Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame),i_(i) { } | ||
int adc() const { return frame_[i_]&0xFF; } | ||
int tdc() const { return (frame_[i_]>>8)&0x3F; } | ||
bool soi() const { return frame_[i_]&0x4000; } | ||
int capid() const { return ((((frame_[0]>>8)&0x3)+i_)%4); } | ||
private: | ||
const edm::DataFrame& frame_; | ||
edm::DataFrame::size_type i_; | ||
}; | ||
|
||
/// Get the detector id | ||
DetId detid() const { return DetId(id()); } | ||
/// total number of samples in the digi | ||
int samples() const { return (size()-1)/2; } | ||
/// get the flavor of the frame | ||
int flavor() const { return ((edm::DataFrame::operator[](0)>>12)&0x7); } | ||
/// was there a link error? | ||
bool linkError() const { return edm::DataFrame::operator[](0)&0x800; } | ||
/// was there a capid rotation error? | ||
bool capidError() const { return edm::DataFrame::operator[](0)&0x400; } | ||
/// was this a mark-and-pass ZS event? | ||
bool wasMarkAndPass() const {return (flavor()==1); } | ||
/// get the sample | ||
inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(*this,i+1); } | ||
void setCapid0(int cap0); | ||
/// set the sample contents | ||
void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false); | ||
|
||
}; | ||
|
||
std::ostream& operator<<(std::ostream&, const QIE11DataFrame&); | ||
|
||
|
||
#endif // DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" | ||
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" | ||
|
||
void QIE10DataFrame::setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int fe_tdc, int capid, bool soi, bool ok) { | ||
if (isample>=size()) return; | ||
edm::DataFrame::operator[](isample*2+1)=(adc&0xFF)|(soi?(0x2000):(0))|(ok?(0x1000):(0)); | ||
edm::DataFrame::operator[](isample*2+2)=(le_tdc&0x3F)|((fe_tdc&0x1F)<<6)|((capid&0x3)<<12)|0x4000; | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& s, const QIE10DataFrame& digi) { | ||
if (digi.detid().det()==DetId::Hcal) { | ||
s << HcalGenericDetId(digi.detid()); | ||
} else { | ||
s << "DetId(" << digi.detid().rawId() << ")"; | ||
} | ||
s << " " << digi.samples() << " samples"; | ||
if (digi.linkError()) s << " LinkError "; | ||
if (digi.wasMarkAndPass()) s << " MaP "; | ||
s << std::endl; | ||
for (int i=0; i<digi.samples(); i++) { | ||
s << " ADC=" << digi[i].adc() << " TDC(LE)=" << digi[i].le_tdc() << " TDC(TE)=" << digi[i].te_tdc() << " CAPID=" << digi[i].capid(); | ||
if (digi[i].soi()) s << " SOI "; | ||
if (!digi[i].ok()) s << " !OK "; | ||
s << std::endl; | ||
} | ||
return s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" | ||
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" | ||
|
||
void QIE11DataFrame::setCapid0(int cap0) { | ||
edm::DataFrame::operator[](0)&=0xFCFF; | ||
edm::DataFrame::operator[](0)|=((cap0&0x3)<<8); | ||
} | ||
|
||
void QIE11DataFrame::setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi) { | ||
if (isample>=size()) return; | ||
edm::DataFrame::operator[](isample+1)=(adc&0xFF)|(soi?(0x4000):(0))|((tdc&0x3F)<<8); | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& s, const QIE11DataFrame& digi) { | ||
if (digi.detid().det()==DetId::Hcal) { | ||
s << HcalGenericDetId(digi.detid()); | ||
} else { | ||
s << "DetId(" << digi.detid().rawId() << ")"; | ||
} | ||
s << " " << digi.samples() << " samples"; | ||
if (digi.linkError()) s << " LinkError "; | ||
if (digi.capidError()) s << " CapIdError "; | ||
if (digi.wasMarkAndPass()) s << " M&P "; | ||
s << std::endl; | ||
for (int i=0; i<digi.samples(); i++) { | ||
s << " ADC=" << digi[i].adc() << " TDC=" << digi[i].tdc() << " CAPID=" << digi[i].capid(); | ||
if (digi[i].soi()) s << " SOI "; | ||
s << std::endl; | ||
} | ||
return s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.