forked from cms-sw/cmssw
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 cms-sw#67 from jbsauvan/triggercell-dataformat-pre9
Triggercell dataformat (pre9 backport)
- Loading branch information
Showing
21 changed files
with
1,253 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef DataFormats_L1TCalorimeter_HGCalTriggerCell_h | ||
#define DataFormats_L1TCalorimeter_HGCalTriggerCell_h | ||
|
||
|
||
#include "DataFormats/L1Trigger/interface/L1Candidate.h" | ||
#include "DataFormats/L1Trigger/interface/BXVector.h" | ||
|
||
namespace l1t | ||
{ | ||
|
||
class HGCalTriggerCell; | ||
typedef BXVector<HGCalTriggerCell> HGCalTriggerCellBxCollection; | ||
|
||
class HGCalTriggerCell : public L1Candidate | ||
{ | ||
|
||
public: | ||
|
||
HGCalTriggerCell() {} | ||
|
||
HGCalTriggerCell( const LorentzVector& p4, | ||
int pt=0, | ||
int eta=0, | ||
int phi=0, | ||
int qual=0, | ||
uint32_t detid=0); | ||
|
||
~HGCalTriggerCell(); | ||
|
||
void setDetId(uint32_t detid) {detid_ = detid;} | ||
|
||
uint32_t detId() const {return detid_;} | ||
|
||
private: | ||
uint32_t detid_; | ||
|
||
}; | ||
|
||
} | ||
|
||
#endif |
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,20 @@ | ||
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" | ||
|
||
using namespace l1t; | ||
|
||
HGCalTriggerCell:: | ||
HGCalTriggerCell( const LorentzVector& p4, | ||
int pt, | ||
int eta, | ||
int phi, | ||
int qual, | ||
uint32_t detid): | ||
L1Candidate(p4, pt, eta, phi, qual), | ||
detid_(detid) | ||
{ | ||
} | ||
|
||
HGCalTriggerCell:: | ||
~HGCalTriggerCell() | ||
{ | ||
} |
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
40 changes: 40 additions & 0 deletions
40
L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellBestChoiceCodec.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,40 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalTriggerCellBestChoiceCodec_h__ | ||
#define __L1Trigger_L1THGCal_HGCalTriggerCellBestChoiceCodec_h__ | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerFECodecBase.h" | ||
#include "L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellBestChoiceCodecImpl.h" | ||
|
||
|
||
inline std::ostream& operator<<(std::ostream& o, const HGCalTriggerCellBestChoiceDataPayload& data) | ||
{ | ||
for(const auto& dat : data.payload) | ||
{ | ||
o << "(" << std::hex << dat.detId() | ||
<< std::dec << " " << dat.hwPt() << ") "; | ||
} | ||
o << "\n"; | ||
return o; | ||
} | ||
|
||
|
||
class HGCalTriggerCellBestChoiceCodec : public HGCalTriggerFE::Codec<HGCalTriggerCellBestChoiceCodec,HGCalTriggerCellBestChoiceDataPayload> | ||
{ | ||
public: | ||
typedef HGCalTriggerCellBestChoiceDataPayload data_type; | ||
|
||
HGCalTriggerCellBestChoiceCodec(const edm::ParameterSet& conf); | ||
|
||
void setDataPayloadImpl(const HGCEEDigiCollection& ee, | ||
const HGCHEDigiCollection& fh, | ||
const HGCHEDigiCollection& bh ); | ||
|
||
void setDataPayloadImpl(const l1t::HGCFETriggerDigi& digi); | ||
|
||
std::vector<bool> encodeImpl(const data_type&) const ; | ||
data_type decodeImpl(const std::vector<bool>&, const uint32_t) const; | ||
|
||
private: | ||
HGCalTriggerCellBestChoiceCodecImpl codecImpl_; | ||
}; | ||
|
||
#endif |
76 changes: 76 additions & 0 deletions
76
L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellBestChoiceCodecImpl.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,76 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalTriggerCellBestChoiceCodecImpl_h__ | ||
#define __L1Trigger_L1THGCal_HGCalTriggerCellBestChoiceCodecImpl_h__ | ||
|
||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" | ||
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" | ||
|
||
#include <array> | ||
#include <vector> | ||
|
||
|
||
struct HGCalTriggerCellBestChoiceDataPayload | ||
{ | ||
typedef std::vector<l1t::HGCalTriggerCell> trigger_cell_list; // list of trigger cell | ||
trigger_cell_list payload; | ||
|
||
void reset() | ||
{ | ||
payload.clear(); | ||
} | ||
}; | ||
|
||
|
||
|
||
class HGCalTriggerCellBestChoiceCodecImpl | ||
{ | ||
public: | ||
typedef HGCalTriggerCellBestChoiceDataPayload data_type; | ||
|
||
HGCalTriggerCellBestChoiceCodecImpl(const edm::ParameterSet& conf); | ||
|
||
std::vector<bool> encode(const data_type&, const HGCalTriggerGeometryBase&) const ; | ||
data_type decode(const std::vector<bool>&, const uint32_t, const HGCalTriggerGeometryBase&) const; | ||
|
||
void linearize(const std::vector<HGCDataFrame<HGCalDetId,HGCSample>>&, | ||
std::vector<std::pair<HGCalDetId, uint32_t > >&); | ||
|
||
void triggerCellSums(const HGCalTriggerGeometryBase& , | ||
const std::vector<std::pair<HGCalDetId, uint32_t > >&, | ||
data_type&); | ||
void bestChoiceSelect(data_type&); | ||
|
||
// Retrieve parameters | ||
size_t nCellsInModule() const {return nCellsInModule_;} | ||
size_t nData() const {return nData_;} | ||
size_t dataLength() const {return dataLength_;} | ||
double linLSB() const {return linLSB_;} | ||
double adcsaturation() const {return adcsaturation_;} | ||
uint32_t adcnBits() const {return adcnBits_;} | ||
double tdcsaturation() const {return tdcsaturation_;} | ||
uint32_t tdcnBits() const {return tdcnBits_;} | ||
double tdcOnsetfC() const {return tdcOnsetfC_;} | ||
uint32_t triggerCellTruncationBits() const {return triggerCellTruncationBits_;} | ||
uint32_t triggerCellSaturationBits() const {return triggerCellSaturationBits_;} | ||
|
||
|
||
private: | ||
size_t nData_; | ||
size_t dataLength_; | ||
size_t nCellsInModule_; | ||
double linLSB_; | ||
double adcsaturation_; | ||
uint32_t adcnBits_; | ||
double tdcsaturation_ ; | ||
uint32_t tdcnBits_ ; | ||
double tdcOnsetfC_ ; | ||
double adcLSB_; | ||
double tdcLSB_; | ||
uint32_t triggerCellTruncationBits_; | ||
uint32_t triggerCellSaturationBits_; | ||
|
||
}; | ||
|
||
#endif |
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
Oops, something went wrong.