Skip to content

Commit

Permalink
initial commit of L1Trigger/L1TMuonOverlapPhase1
Browse files Browse the repository at this point in the history
the sources were copied from the branch kbunkow/from-CMSSW_11_1_3_KB_v3
and modified:
-	changing the include path of the CSCConstants.h,
-	adding some missing root includes
-	XMLConfigReader::readLUTs - fill distPhiShift in the LUTs; calculating
totalInWidth (previously the values were hardcoded);  added flag
useMeanDistPhi1 (set to false); added parameter buildEmptyPatterns in
the readPatterns
-	ProcessorBase::configure - initializing distPhiShift from LUT
-	L1TMuonOverlapPhase1ParamsESProducer::readPatternsXML  -  added
reading selDistPhiShift to the LUTs
-	OMTFConfiguration::configure - added setup for the fwVersion() == 8
  • Loading branch information
Karol Bunkowski committed Aug 24, 2021
1 parent 00bebb2 commit 70ff9c2
Show file tree
Hide file tree
Showing 115 changed files with 18,953 additions and 0 deletions.
7 changes: 7 additions & 0 deletions L1Trigger/L1TMuonOverlapPhase1/.gitignore
@@ -0,0 +1,7 @@
/.cproject
/.project
/.pydevproject
/.settings
/test/*.xml
/test/*.root
/test/*.txt
45 changes: 45 additions & 0 deletions L1Trigger/L1TMuonOverlapPhase1/BuildFile.xml
@@ -0,0 +1,45 @@
<export>
<lib name="1"/>
<use name="DataFormats/L1TMuon"/>
<use name="L1Trigger/RPCTrigger"/>
<use name="DataFormats/L1TMuon"/>
<use name="Geometry/Records"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/CSCGeometry"/>
<use name="Geometry/RPCGeometry"/>
<use name="root"/>
<use name="xerces-c"/>
</export>

<flags ADD_SUBDIR="1"/>

<use name="xerces-c"/>
<use name="root"/>
<use name="roofit"/>

<!-- <use lib=boost_timer /> -->
<lib name="boost_timer" />

<use name="L1Trigger/RPCTrigger"/>
<use name="L1Trigger/DTUtilities"/>
<use name="L1Trigger/L1TMuon" />

<use name="DataFormats/L1TMuon"/>
<use name="DataFormats/L1DTTrackFinder"/>

<use name="Geometry/Records"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/CSCGeometry"/>
<use name="Geometry/RPCGeometry"/>

<use name="SimDataFormats/DigiSimLinks"/>
<use name="SimDataFormats/Vertex"/>
<use name="SimDataFormats/TrackingAnalysis"/>

<use name="PhysicsTools/UtilAlgos"/>
<use name="FWCore/ServiceRegistry"/>

<use name="TrackingTools/Records" />
<use name="TrackingTools/TrajectoryState" />
<use name="TrackingTools/GeomPropagators" />

82 changes: 82 additions & 0 deletions L1Trigger/L1TMuonOverlapPhase1/interface/AlgoMuonBase.h
@@ -0,0 +1,82 @@
/*
* AlgoMuonBase.h
*
* Created on: Mar 1, 2019
* Author: Karol Bunkowski kbunkow@cern.ch
*/

#ifndef INTERFACE_ALGOMUONBASE_H_
#define INTERFACE_ALGOMUONBASE_H_

#include "L1Trigger/L1TMuonOverlapPhase1/interface/ProcConfigurationBase.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/StubResult.h"
#include "boost/dynamic_bitset.hpp"

class AlgoMuonBase {
public:
AlgoMuonBase(){};

AlgoMuonBase(const ProcConfigurationBase* config);
virtual ~AlgoMuonBase();

virtual int getEtaHw() const = 0;

virtual bool isValid() const = 0;

//virtual void setValid(bool valid) = 0;

virtual unsigned int getFiredLayerCnt() const {
unsigned int count = 0;
for (auto& firedLayerBits : firedLayerBitsInBx) {
count += firedLayerBits.count();
}
return count;
}

virtual unsigned int getFiredLayerCnt(int bx) const { return firedLayerBitsInBx.at(bx).count(); }

boost::dynamic_bitset<> getFiredLayerBits()
const { //TODO make it virtual, and change the return type in in the AlgoMuon to dynamic_bitset<>
boost::dynamic_bitset<> firedLayerBitsSum(firedLayerBitsInBx[0].size());
for (auto& firedLayerBits : firedLayerBitsInBx) {
firedLayerBitsSum |= firedLayerBits;
}
return firedLayerBitsSum;
}

virtual bool isLayerFired(unsigned int iLayer, unsigned int bx) const { return firedLayerBitsInBx.at(bx)[iLayer]; }

virtual double getPdfSum() const = 0;

/* virtual const bool isKilled() const = 0;
virtual void kill() = 0;*/

//virtual bool isLayerFired(unsigned int iLayer) const = 0;

virtual const StubResult& getStubResult(unsigned int iLayer) const = 0;

virtual const StubResults& getStubResults() const = 0;

//virtual const boost::dynamic_bitset<>& getFiredLayerBits() const = 0;

virtual void setBeta(float beta) { this->beta = beta; }

virtual float getBeta() const { return beta; }

virtual double getSimBeta() const { return 0; }

virtual float getBetaLikelihood() const { return betaLikelihood; }

virtual void setBetaLikelihood(float betaLikelihood = 0) { this->betaLikelihood = betaLikelihood; }

protected:
float beta = 0; //zero means it is not measured
float betaLikelihood = 0; //beta measurement goodness, likelihood of return beta hypothesis

///bits representing fired logicLayers (including bending layers),
std::vector<boost::dynamic_bitset<> > firedLayerBitsInBx;
};

#endif /* INTERFACE_ALGOMUONBASE_H_ */
119 changes: 119 additions & 0 deletions L1Trigger/L1TMuonOverlapPhase1/interface/AngleConverterBase.h
@@ -0,0 +1,119 @@
#ifndef ANGLECONVERTER_H
#define ANGLECONVERTER_H

#include "L1Trigger/L1TMuonOverlapPhase1/interface/ProcConfigurationBase.h"

#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "FWCore/Framework/interface/ESWatcher.h"

#include <memory>

namespace edm {
class EventSetup;
}

class RPCGeometry;
class CSCGeometry;
class CSCLayer;
class DTGeometry;

class L1MuDTChambPhDigi;
class L1MuDTChambThDigi;
class L1MuDTChambThContainer;
class CSCCorrelatedLCTDigi;
class RPCDigi;

class DTChamberId;
class CSCDetId;
class RPCDetId;

struct EtaValue {
int eta = 0;
///error of the eta measurement
int etaSigma = 0;
int quality = 0;

int bx = 0;
int timing = 0; //sub-bx timing, should be already in scale common for all muon subsystems
};

struct MuonGeometryTokens {
edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeometryEsToken;
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> cscGeometryEsToken;
edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeometryEsToken;
};

class AngleConverterBase {
public:
AngleConverterBase();
virtual ~AngleConverterBase();

///Update the Geometry with current Event Setup
virtual void checkAndUpdateGeometry(const edm::EventSetup&,
const ProcConfigurationBase* config,
const MuonGeometryTokens& muonGeometryTokens);

/// get phi of DT,CSC and RPC azimutal angle digi in processor scale, used by OMTF algorithm.
/// in case of wrong phi returns OMTFConfiguration::instance()->nPhiBins
/// phiZero - desired phi where the scale should start, should be in the desired scale, use getProcessorPhiZero to obtain it
virtual int getProcessorPhi(int phiZero, l1t::tftype part, int dtScNum, int dtPhi) const;

virtual int getProcessorPhi(int phiZero,
l1t::tftype part,
const CSCDetId& csc,
const CSCCorrelatedLCTDigi& digi) const;

virtual int getProcessorPhi(unsigned int iProcessor,
l1t::tftype part,
const RPCDetId& rollId,
const unsigned int& digi) const;
virtual int getProcessorPhi(int phiZero,
l1t::tftype part,
const RPCDetId& rollId,
const unsigned int& digi1,
const unsigned int& digi2) const;

///returns the eta position of the DT chamber
///(n.b. in the DT phi and eta segments are independent)
virtual EtaValue getGlobalEtaDt(const DTChamberId& detId) const;

//adds the eta segments from the thetaDigi to etaSegments
virtual void getGlobalEta(const L1MuDTChambThDigi& thetaDigi, std::vector<EtaValue>& etaSegments) const;
virtual std::vector<EtaValue> getGlobalEta(const L1MuDTChambThContainer* dtThDigis, int bxFrom, int bxTo);

///Convert local eta coordinate to global digital microGMT scale.
virtual EtaValue getGlobalEta(const CSCDetId& detId, const CSCCorrelatedLCTDigi& aDigi) const;

///returns the eta position of the CSC chamber
virtual EtaValue getGlobalEtaCsc(const CSCDetId& detId) const;

///Convert local eta coordinate to global digital microGMT scale.
///EtaValue::etaSigma is half of the strip
virtual EtaValue getGlobalEta(unsigned int rawid, const unsigned int& aDigi) const;

float cscChamberEtaSize(const CSCDetId& id) const;

protected:
///Check orientation of strips in given CSC chamber
virtual bool isCSCCounterClockwise(const std::unique_ptr<const CSCLayer>& layer) const;

///Find BTI group
virtual const int findBTIgroup(const L1MuDTChambPhDigi& aDigi, const L1MuDTChambThContainer* dtThDigis);

// pointers to the current geometry records
unsigned long long _geom_cache_id = 0;
edm::ESHandle<RPCGeometry> _georpc;
edm::ESHandle<CSCGeometry> _geocsc;
edm::ESHandle<DTGeometry> _geodt;

edm::ESWatcher<MuonGeometryRecord> muonGeometryRecordWatcher;

const ProcConfigurationBase* config = nullptr;
///Number of phi bins along 2Pi.
unsigned int nPhiBins = 0;
};

#endif
90 changes: 90 additions & 0 deletions L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h
@@ -0,0 +1,90 @@
/*
* MuonStub.h
*
* Created on: Dec 21, 2018
* Author: kbunkow
*
* MuonStub - data structure for algorithm input
*/

#ifndef MUONOVERLAP_MUONSTUB_H_
#define MUONOVERLAP_MUONSTUB_H_

#include <vector>
#include <memory>

struct MuonStub {
public:
enum Type {
EMPTY,
DT_PHI,
DT_THETA,
DT_PHI_ETA,
DT_HIT,
RPC,
CSC_PHI,
CSC_ETA,
CSC_PHI_ETA,
BARREL_SUPER_SEG,
TTTRACK_REF //for ttTrack correlation algorithm with the reference stub
};

/* enum EtaType {
NO_ETA,
CORSE,
FINE,
//add other if needed
};*/

MuonStub();

MuonStub(int phiHw, int phiBHw) : phiHw(phiHw), phiBHw(phiBHw){};

virtual ~MuonStub();

Type type = EMPTY;

int phiHw = 0;
int phiBHw = 0;

static const int EMTPY_PHI = 0xffffff;

int etaHw = 0;
int etaSigmaHw = 0; ///error of the eta measurement
int qualityHw = 0;

int bx = 0;
int timing = 0;
//example use: 1 if phi segment uniquely assigned to eta segment
//EtaType etaType = NO_ETA;
//int isPhiFine = 0;

//used to address LUTs
unsigned int logicLayer = 0;

//int inputNumHw = -1;

//layer number in hardware convention
//int layerHw = -1;
//int subLayerHw = -1;

//int station = -1;

int roll = 0;

int detId = 0;

//float phi = 0; //radians
//float eta = 0;

friend std::ostream& operator<<(std::ostream& out, const MuonStub& stub);
};

typedef std::vector<MuonStub> MuonStubs1D;
typedef std::vector<MuonStubs1D> MuonStubs2D;

typedef std::shared_ptr<const MuonStub> MuonStubPtr;
typedef std::vector<MuonStubPtr> MuonStubPtrs1D;
typedef std::vector<MuonStubPtrs1D> MuonStubPtrs2D;

#endif /* MUONOVERLAP_MUONSTUB_H_ */

0 comments on commit 70ff9c2

Please sign in to comment.