Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin committed Aug 2, 2022
1 parent a5a6c3b commit af71bd7
Show file tree
Hide file tree
Showing 26 changed files with 245 additions and 376 deletions.
15 changes: 10 additions & 5 deletions DataFormats/CSCDigi/interface/CSCShowerDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ class CSCShowerDigi {
// Run-3 definitions as provided in DN-20-033
enum Run3Shower { kInvalid = 0, kLoose = 1, kNominal = 2, kTight = 3 };
// Shower types. and showers from OTMB/TMB are assigned with kLCTShower
enum ShowerType { kInvalidShower = 0, kALCTShower = 1, kCLCTShower = 2, kLCTShower = 3};
enum ShowerType { kInvalidShower = 0, kALCTShower = 1, kCLCTShower = 2, kLCTShower = 3 };

/// Constructors
CSCShowerDigi(const uint16_t inTimeBits, const uint16_t outTimeBits, const uint16_t cscID,
const uint16_t bx, const uint16_t showerType, const uint16_t wireNHits, const uint16_t compNHits);
CSCShowerDigi(const uint16_t inTimeBits,
const uint16_t outTimeBits,
const uint16_t cscID,
const uint16_t bx,
const uint16_t showerType,
const uint16_t wireNHits,
const uint16_t compNHits);
/// default
CSCShowerDigi();

Expand All @@ -36,15 +41,15 @@ class CSCShowerDigi {
uint16_t bitsInTime() const { return bitsInTime_; }
uint16_t bitsOutOfTime() const { return bitsOutOfTime_; }

uint16_t getBX() const {return bx_; }
uint16_t getBX() const { return bx_; }
uint16_t getCSCID() const { return cscID_; }
uint16_t getShowerType() const { return showerType_; }
uint16_t getWireNHits() const { return wireNHits_; }
uint16_t getComparatorNHits() const { return comparatorNHits_; }

/// set cscID
void setCSCID(const uint16_t c) { cscID_ = c; }
void setBX(const uint16_t bx) {bx_ = bx; }
void setBX(const uint16_t bx) { bx_ = bx; }

private:
uint16_t bitsInTime_;
Expand Down
33 changes: 22 additions & 11 deletions DataFormats/CSCDigi/src/CSCShowerDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@
using namespace std;

/// Constructors
CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, const uint16_t bitsOutOfTime, const uint16_t cscID,
const uint16_t bx, const uint16_t showerType, const uint16_t wireNHits, const uint16_t compNHits)
: bitsInTime_(bitsInTime), bitsOutOfTime_(bitsOutOfTime), cscID_(cscID),
bx_(bx), showerType_(showerType), wireNHits_(wireNHits), comparatorNHits_(compNHits) {}
CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime,
const uint16_t bitsOutOfTime,
const uint16_t cscID,
const uint16_t bx,
const uint16_t showerType,
const uint16_t wireNHits,
const uint16_t compNHits)
: bitsInTime_(bitsInTime),
bitsOutOfTime_(bitsOutOfTime),
cscID_(cscID),
bx_(bx),
showerType_(showerType),
wireNHits_(wireNHits),
comparatorNHits_(compNHits) {}

/// Default
CSCShowerDigi::CSCShowerDigi() : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0),
bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0){}
CSCShowerDigi::CSCShowerDigi()
: bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0) {}

void CSCShowerDigi::clear() {
bitsInTime_ = 0;
Expand Down Expand Up @@ -46,15 +56,16 @@ bool CSCShowerDigi::isTightOutOfTime() const { return bitsOutOfTime() >= kTight;
bool CSCShowerDigi::isValidShowerType() const { return showerType_ > kInvalidShower; }

std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) {

unsigned int showerType = digi.getShowerType();
std::string compHitsStr(", comparatorHits ");
compHitsStr += std::to_string(digi.getComparatorNHits());
std::string wireHitsStr(", wireHits ");
wireHitsStr += std::to_string(digi.getWireNHits());

return o <<(showerType == 0 ? "Invalid ShowerType" : (showerType == 1 ? "ALCTShower" : (showerType == 2 ? "CLCTShower" : "correlatedLCTShower")))
<<": bx "<< digi.getBX() <<", in-time bits " << digi.bitsInTime() << ", out-of-time bits " << digi.bitsOutOfTime()
<< ((showerType == 1 or showerType == 3 ) ? wireHitsStr : "")
<< ((showerType == 2 or showerType == 3 ) ? compHitsStr : "") << ";";
return o << (showerType == 0
? "Invalid ShowerType"
: (showerType == 1 ? "ALCTShower" : (showerType == 2 ? "CLCTShower" : "correlatedLCTShower")))
<< ": bx " << digi.getBX() << ", in-time bits " << digi.bitsInTime() << ", out-of-time bits "
<< digi.bitsOutOfTime() << ((showerType == 1 or showerType == 3) ? wireHitsStr : "")
<< ((showerType == 2 or showerType == 3) ? compHitsStr : "") << ";";
}
169 changes: 0 additions & 169 deletions DataFormats/CSCDigi/src/classes_def.xml.generated

This file was deleted.

2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class CSCALCTHeader {
if ((!theALCTs.empty()) && (theALCTs.size() == unsigned(header2007.lctBins * 2))) {
for (unsigned bx = 0; bx < header2007.lctBins; bx++) {
//CSCID is set to be 0
//ALCTshower, showerType_= 1, wireNHits and ComparatorNHits are not available in data
//ALCTshower, showerType_= 1, wireNHits and ComparatorNHits are not available in data
results.push_back(CSCShowerDigi(theALCTs[bx * 2].reserved & 0x3, 0, 0, bx, 1, 0, 0));
}
return results;
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CSCTMBHeader {

uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }

uint16_t L1AMatchTime() const {return theHeaderFormat->L1AMatchTime(); }
uint16_t L1AMatchTime() const { return theHeaderFormat->L1AMatchTime(); }
/// will throw if the cast fails
CSCTMBHeader2007 tmbHeader2007() const;
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const;
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2006 : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return (bits.clct0_sync_err | bits.clct1_sync_err); }
uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

/// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return (bits.clct0_sync_err | bits.clct1_sync_err); }
uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

/// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2007_rev0x50c3 : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

/// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

/// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_CCLUT : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return 0; }
uint16_t syncErrorMPC1() const override { return 0; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; }
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_GEM : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return 0; }
uint16_t syncErrorMPC1() const override { return 0; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; }
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_Run2 : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_TMB : public CSCVTMBHeaderFormat {
uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
uint16_t syncErrorMPC0() const override { return 0; }
uint16_t syncErrorMPC1() const override { return 0; }
uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; }
uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }

// == Run 3 CSC-GEM Trigger Format
uint16_t clct0_ComparatorCode() const override { return 0; }
Expand Down
1 change: 0 additions & 1 deletion EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class CSCVTMBHeaderFormat {

virtual void print(std::ostream& os) const = 0;


protected:
void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
};
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/CSCRawToDigi/src/CSCALCTHeader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void CSCALCTHeader::addShower(const std::vector<CSCShowerDigi> &digis) {
if (bx < (int)header2007.lctBins) {
const CSCShowerDigi &digi = digis[bx];
int i = bx * 2;
unsigned hmt_bits = digi.isValid() ? digi.bitsInTime() : 0;
unsigned hmt_bits = digi.isValid() ? digi.bitsInTime() : 0;
theALCTs[i].reserved = hmt_bits & 0x3;
theALCTs[i + 1].reserved = hmt_bits & 0x3;
}
Expand Down
Loading

0 comments on commit af71bd7

Please sign in to comment.