Skip to content

Commit

Permalink
Merge pull request cms-sw#68 from gpetruc/update_upstream_39
Browse files Browse the repository at this point in the history
Update to l1t-phase2-v3.3.39 tag
  • Loading branch information
gpetruc committed Aug 4, 2021
2 parents 686d277 + 8653dc8 commit 3421451
Show file tree
Hide file tree
Showing 92 changed files with 9,826 additions and 669 deletions.
13 changes: 13 additions & 0 deletions DataFormats/L1TMuonPhase2/BuildFile.xml
@@ -0,0 +1,13 @@
<export>
<lib name="1"/>
</export>
<use name="DataFormats/CSCDigi"/>
<use name="DataFormats/L1DTTrackFinder"/>
<use name="DataFormats/GEMDigi"/>
<use name="DataFormats/MuonDetId"/>
<use name="DataFormats/L1CSCTrackFinder"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/Candidate"/>
<use name="DataFormats/L1Trigger"/>
<use name="rootrflx"/>
<flags ADD_SUBDIR="1"/>
143 changes: 143 additions & 0 deletions DataFormats/L1TMuonPhase2/interface/MuonStub.h
@@ -0,0 +1,143 @@
//-------------------------------------------------
//
/** \class MuonStub
*
* Class that creates a super-primitive for all chambers
*
*
* M.Bachtis (UCLA)
*/
//
//--------------------------------------------------
#ifndef L1TMUPHASE2GMTSTUB_H
#define L1TMUPHASE2GMTSTUB_H
//---------------
// C++ Headers --
//---------------

#include <iosfwd>
#include <vector>

//----------------------
// Base Class Headers --
//----------------------

//------------------------------------
// Collaborating Class Declarations --
//------------------------------------

//#include "DataFormats/L1TMuon/interface/BMTF/L1MuBMTrackSegLoc.h"
#include "DataFormats/L1Trigger/interface/BXVector.h"
#include "DataFormats/Common/interface/Ref.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

// ---------------------
// -- Class Interface --
// ---------------------

namespace l1t {

class MuonStub;

typedef std::vector<MuonStub> MuonStubCollection;
typedef edm::Ref<MuonStubCollection> MuonStubRef;
typedef std::vector<edm::Ref<MuonStubCollection> > MuonStubRefVector;

class MuonStub {
public:
/// default constructor
MuonStub();

/// constructor
MuonStub(int etaRegion,
int phiRegion,
int depthRegion,
uint tfLayer,
int coord1,
int coord2,
int id,
int bx,
int quality,
int eta1 = 0,
int eta2 = 0,
int etaQuality = -1,
int type = 0);
~MuonStub();
/// return wheel
inline int etaRegion() const { return etaRegion_; }
/// return sector
inline int phiRegion() const { return phiRegion_; }
/// return station
inline int depthRegion() const { return depthRegion_; }
/// return track finder layer
inline uint tfLayer() const { return tfLayer_; }
/// return phi
inline int coord1() const { return coord1_; }
/// return phib
inline int coord2() const { return coord2_; }
/// return quality code
inline int quality() const { return quality_; }
/// return tag (second TS tag)
inline int id() const { return id_; }
/// return bunch crossing
inline int bxNum() const { return bxNum_; }

/// return eta
inline int eta1() const { return eta1_; }
inline int eta2() const { return eta2_; }
/// return first eta quality
inline int etaQuality() const { return etaQuality_; }
//return type
inline int type() const { return type_; }

inline bool isBarrel() const { return (type_ == 1); }
inline bool isEndcap() const { return (type_ == 0); }

inline double offline_coord1() const { return offline_coord1_; }
inline double offline_coord2() const { return offline_coord2_; }
inline double offline_eta1() const { return offline_eta1_; }
inline double offline_eta2() const { return offline_eta2_; }

void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) {
offline_coord1_ = coord1;
offline_coord2_ = coord2;
offline_eta1_ = eta1;
offline_eta2_ = eta2;
}
void setEta(int eta1, int eta2, int etaQ) {
eta1_ = eta1;
eta2_ = eta2;
etaQuality_ = etaQ;
}

void setID(int id) { id_ = id; }
/// equal operator
bool operator==(const MuonStub&) const;
/// unequal operator
bool operator!=(const MuonStub&) const;

void print() const;

private:
int etaRegion_; //In the barrel this is wheel. In the endcap it is 6-ring
int phiRegion_; //In the barrel it is sector. In the endcap it is chamber
int depthRegion_; //Station
uint tfLayer_; //TF Layer
int coord1_; // global position angle in units of 30 degrees/2048
int coord2_; // bending angle only in barrel for now
int id_; // stub id in case of more stubs per chamber
int quality_; //
int bxNum_; // bunch crossing identifier
int eta1_; // eta coordinate - in units of 3.0/512.
int eta2_; // eta coordinate - in units of 3.0/512.
int etaQuality_; // quality of the eta information
int type_; //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap
/////////members that are not hardware but used for offline studies///////////////////////////////
double offline_coord1_; //offline coordinate 1
double offline_coord2_; //offline coordinate two
double offline_eta1_; //offline eta1
double offline_eta2_; //offline eta2
};

} // namespace l1t
#endif
60 changes: 60 additions & 0 deletions DataFormats/L1TMuonPhase2/interface/SAMuon.h
@@ -0,0 +1,60 @@
#ifndef DataFormatsL1TMuonPhase2_SAMuon_h
#define DataFormatsL1TMuonPhase2_SAMuon_h

#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/L1Trigger/interface/Muon.h"
#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1t {

class SAMuon;

typedef std::vector<SAMuon> SAMuonCollection;
typedef edm::Ref<SAMuonCollection> SAMuonRef;
typedef std::vector<edm::Ref<SAMuonCollection> > SAMuonRefVector;

class SAMuon : public L1Candidate {
public:
SAMuon();

SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality);

~SAMuon() override;

const bool hwCharge() const { return hwCharge_; }
const int hwZ0() const { return hwZ0_; }
const int hwD0() const { return hwD0_; }
const uint hwBeta() const { return hwBeta_; }
void setBeta(uint beta) { hwBeta_ = beta; }

const uint64_t word() const { return word_; }
void setWord(uint64_t word) { word_ = word; }
void print() const;

bool operator<(const SAMuon& other) const {
if (hwPt() == other.hwPt())
return (hwEta() < other.hwEta());
else
return (hwPt() < other.hwPt());
}
bool operator>(const SAMuon& other) const {
if (hwPt() == other.hwPt())
return (hwEta() > other.hwEta());
else
return (hwPt() > other.hwPt());
}

private:
bool hwCharge_;
int hwZ0_;
int hwD0_;
uint hwBeta_;
uint64_t word_;
};
} // namespace l1t

#endif
74 changes: 74 additions & 0 deletions DataFormats/L1TMuonPhase2/interface/TrackerMuon.h
@@ -0,0 +1,74 @@
#ifndef DataFormatsL1TMuonPhase2_TrackerMuon_h
#define DataFormatsL1TMuonPhase2_TrackerMuon_h

#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
#include "DataFormats/L1TMuonPhase2/interface/MuonStub.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1t {

class TrackerMuon;

typedef std::vector<TrackerMuon> TrackerMuonCollection;
typedef edm::Ref<TrackerMuonCollection> TrackerMuonRef;
typedef std::vector<edm::Ref<TrackerMuonCollection> > TrackerMuonRefVector;

class TrackerMuon : public L1Candidate {
public:
typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType;
typedef std::vector<L1TTTrackType> L1TTTrackCollection;

TrackerMuon();

TrackerMuon(
const edm::Ptr<L1TTTrackType>& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality);

~TrackerMuon() override;

const edm::Ptr<L1TTTrackType>& trkPtr() const { return trkPtr_; }
const edm::Ref<l1t::RegionalMuonCandBxCollection>& muonRef() const { return muRef_; }

const bool hwCharge() const { return hwCharge_; }
const int hwZ0() const { return hwZ0_; }
const int hwD0() const { return hwD0_; }
const int hwIsoSum() const { return hwIsoSum_; }
const int hwIsoSumAp() const { return hwIsoSumAp_; }
const uint hwBeta() const { return hwBeta_; }
void setBeta(uint beta) { hwBeta_ = beta; }
void setMuonRef(const edm::Ref<l1t::RegionalMuonCandBxCollection>& p) { muRef_ = p; }
void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }
void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; }

const uint64_t word() const { return word_; }
void setWord(uint64_t word) { word_ = word; }
void print() const;
const MuonStubRefVector stubs() const { return stubs_; }
void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); }

bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); }
bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); }

private:
// used for the Naive producer
edm::Ptr<L1TTTrackType> trkPtr_;
bool hwCharge_;
int hwZ0_;
int hwD0_;
uint hwBeta_;
uint64_t word_;
//Store the eneryg sum for isolation
int hwIsoSum_;
//Store the eneryg sum for isolation with ap_type
int hwIsoSumAp_;

edm::Ref<l1t::RegionalMuonCandBxCollection> muRef_;
MuonStubRefVector stubs_;
};
} // namespace l1t

#endif
89 changes: 89 additions & 0 deletions DataFormats/L1TMuonPhase2/src/MuonStub.cc
@@ -0,0 +1,89 @@
#include "DataFormats/L1TMuonPhase2/interface/MuonStub.h"

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;
using namespace l1t;
MuonStub::MuonStub()
: etaRegion_(0),
phiRegion_(0),
depthRegion_(0),
coord1_(0),
coord2_(0),
id_(0),
quality_(-1),
bxNum_(17),
eta1_(0),
eta2_(0),
etaQuality_(-1),
type_(0) {}

MuonStub::MuonStub(int etaRegion,
int phiRegion,
int depthRegion,
uint tfLayer,
int coord1,
int coord2,
int id,
int bx,
int quality,
int eta1,
int eta2,
int etaQuality,
int type)
: etaRegion_(etaRegion),
phiRegion_(phiRegion),
depthRegion_(depthRegion),
tfLayer_(tfLayer),
coord1_(coord1),
coord2_(coord2),
id_(id),
quality_(quality),
bxNum_(bx),
eta1_(eta1),
eta2_(eta2),
etaQuality_(etaQuality),
type_(type) {}

MuonStub::~MuonStub() {}

bool MuonStub::operator==(const MuonStub& id) const {
if (etaRegion_ != id.etaRegion_)
return false;
if (phiRegion_ != id.phiRegion_)
return false;
if (depthRegion_ != id.depthRegion_)
return false;
if (id_ != id.id_)
return false;
if (coord1_ != id.coord1_)
return false;
if (coord2_ != id.coord2_)
return false;
if (quality_ != id.quality_)
return false;
if (bxNum_ != id.bxNum_)
return false;
if (eta1_ != id.eta1_)
return false;
if (eta2_ != id.eta2_)
return false;
if (etaQuality_ != id.etaQuality_)
return false;
if (type_ != id.type_)
return false;
return true;
}

//
// output stream operator for phi track segments
//

void MuonStub::print() const {
LogDebug("MuonStub") << " MuonStub : BX=" << bxNum_ << " etaRegion=" << etaRegion_ << " phiRegion=" << phiRegion_
<< " depth=" << depthRegion_ << " ID=" << id_ << " coord1=" << coord1_ << " coord2=" << coord2_
<< " quality=" << quality_ << " eta1=" << eta1_ << " eta2=" << eta2_
<< " etaQuality=" << etaQuality_ << " type=" << type_;
}

0 comments on commit 3421451

Please sign in to comment.