-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update HCAL Packing/Unpacking #7950
Merged
davidlange6
merged 22 commits into
cms-sw:CMSSW_7_5_X
from
UMN-CMS:amc13_onto_from-CMSSW_7_5_X_2015-02-25-0200_extra
Mar 10, 2015
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e93d836
Remove flavor 3 checking as it no longer exists
2aaf4cf
Rename rising/falling to leading/trailing edge
47baf26
Add ok() method to HcalUHTRData::const_iterator
adf9089
Fix ++ operator for HcalUHTRData::const_iterator
424590f
Initial version of the container for Alex to play with
jmmans 93a2401
Finish basic work on QIE10DataFrame and collection for the same. Sho…
jmmans a342172
Add QIE10 to Hcal Unpacker and DigiDump
c6c2d87
Fix masking error
jmmans 089a877
Add QIE11 in to this branch as well to provide full support
jmmans 2d24831
Add version to the TrigTowerDetId
jmmans e14ae80
Added HCAL TP version checking to L1RCT
194a1da
Add HcalTrigTowerDetId constructor with version
c979fc4
Add HT versions to HcalText2DetIdConverter.cc
568065f
Fix "Firmware Flavor" handling in hcalRawToDigi
05f2075
Fix minor bugs in HcalPacker.cc
9e9af2e
processTrig now returns the size correctly
152f814
Add braces to if and for statements in HcalPacker
527c056
Add reporting of the dataset at the beginning of each group of digis.…
jmmans 99a689e
Fix issue with packing of the orbit number in the DCC Header
jmmans b807275
Don't keep fully-zero TP digis
jmmans 9257351
Fixed issue with no-precision-digis channels resulting in bad DQM output
jmmans a0144a6
Fix modulo bug
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add masks and offsets constants to be used in these methods; in order to avoid magic numbers scattered in many places. |
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already pointed out by @slava77 in https://github.com/cms-sw/cmssw/pull/7950/files#r25869739 please avoid magic numbers (in this case
0
and1
for the version,10
for the digits).