CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
ProcessorBase< GoldenPatternType > Class Template Reference

#include <ProcessorBase.h>

Inheritance diagram for ProcessorBase< GoldenPatternType >:
OMTFProcessor< GoldenPatternType >

Public Member Functions

virtual void addGP (GoldenPatternType *aGP)
 Add GoldenPattern to pattern vec. More...
 
virtual bool configure (OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
 Fill GP vec with patterns from CondFormats object. More...
 
const std::vector< OMTFConfiguration::PatternPt > & getPatternPtRange () const
 
virtual GoldenPatternVec< GoldenPatternType > & getPatterns ()
 Return vector of GoldenPatterns. More...
 
virtual void initPatternPtRange (bool firstPatFrom0)
 
virtual void printInfo () const
 
 ProcessorBase (OMTFConfiguration *omtfConfig, const L1TMuonOverlapParams *omtfPatterns)
 
 ProcessorBase (OMTFConfiguration *omtfConfig, GoldenPatternVec< GoldenPatternType > &&gps)
 
virtual void resetConfiguration ()
 Reset all configuration parameters. More...
 
virtual ~ProcessorBase ()
 

Protected Member Functions

virtual MuonStubPtrs1D restrictInput (unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput &input)
 

Protected Attributes

const OMTFConfigurationmyOmtfConfig
 
std::vector< OMTFConfiguration::PatternPtpatternPts
 
GoldenPatternVec< GoldenPatternType > theGPs
 vector holding Golden Patterns More...
 

Detailed Description

template<class GoldenPatternType>
class ProcessorBase< GoldenPatternType >

Definition at line 21 of file ProcessorBase.h.

Constructor & Destructor Documentation

◆ ProcessorBase() [1/2]

template<class GoldenPatternType>
ProcessorBase< GoldenPatternType >::ProcessorBase ( OMTFConfiguration omtfConfig,
const L1TMuonOverlapParams omtfPatterns 
)
inline

Definition at line 23 of file ProcessorBase.h.

References ProcessorBase< GoldenPatternType >::configure().

23  : myOmtfConfig(omtfConfig) {
24  configure(omtfConfig, omtfPatterns);
25  };
virtual bool configure(OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
Fill GP vec with patterns from CondFormats object.
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54

◆ ProcessorBase() [2/2]

template<class GoldenPatternType >
ProcessorBase< GoldenPatternType >::ProcessorBase ( OMTFConfiguration omtfConfig,
GoldenPatternVec< GoldenPatternType > &&  gps 
)

omtfConfig is not const, because the omtfConfig->setPatternPtRange is called inside the constructor takes the ownership of the gps (uses move)

Definition at line 21 of file ProcessorBase.cc.

References ProcessorBase< GoldenPatternType >::getPatternPtRange(), runTauDisplay::gp, ProcessorBase< GoldenPatternType >::initPatternPtRange(), ProcessorBase< GoldenPatternType >::myOmtfConfig, OMTFConfiguration::setPatternPtRange(), and ProcessorBase< GoldenPatternType >::theGPs.

23  : myOmtfConfig(omtfConfig), theGPs(std::move(gps)) {
24  for (auto& gp : theGPs) {
25  gp->setConfig(myOmtfConfig);
26  }
27 
28  initPatternPtRange(true);
29 
30  omtfConfig->setPatternPtRange(getPatternPtRange());
31 };
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57
const std::vector< OMTFConfiguration::PatternPt > & getPatternPtRange() const
Definition: ProcessorBase.h:47
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54
void setPatternPtRange(const std::vector< PatternPt > &patternPts)
virtual void initPatternPtRange(bool firstPatFrom0)
def move(src, dest)
Definition: eostools.py:511

◆ ~ProcessorBase()

template<class GoldenPatternType>
virtual ProcessorBase< GoldenPatternType >::~ProcessorBase ( )
inlinevirtual

Definition at line 31 of file ProcessorBase.h.

31 {}

Member Function Documentation

◆ addGP()

template<class GoldenPatternType >
void ProcessorBase< GoldenPatternType >::addGP ( GoldenPatternType *  aGP)
virtual

Add GoldenPattern to pattern vec.

Definition at line 138 of file ProcessorBase.cc.

138  {
139  theGPs.emplace_back(std::unique_ptr<GoldenPatternType>(aGP));
140 }
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57

◆ configure()

template<class GoldenPatternType >
bool ProcessorBase< GoldenPatternType >::configure ( OMTFConfiguration omtfParams,
const L1TMuonOverlapParams omtfPatterns 
)
virtual

Fill GP vec with patterns from CondFormats object.

Mean dist phi data

Pdf data

Definition at line 41 of file ProcessorBase.cc.

References L1TMuonOverlapParams::chargeLUT(), l1t::LUT::data(), L1TMuonOverlapParams::distPhiShiftLUT(), L1TMuonOverlapParams::etaLUT(), Phase2L1GMT::etaLUT, watchdog::group, L1TowerCalibrationProducer_cfi::iEta, createfilelist::int, LogTrace, L1TMuonOverlapParams::meanDistPhiLUT(), l1t::LUT::nrBitsData(), L1TMuonOverlapParams::pdfLUT(), Phase2L1GMT::ptLUT, L1TMuonOverlapParams::ptLUT(), and OMTFConfiguration::setPatternPtRange().

Referenced by ProcessorBase< GoldenPatternType >::ProcessorBase().

42  {
44 
45  myOmtfConfig = omtfConfig;
46 
47  const l1t::LUT* chargeLUT = omtfPatterns->chargeLUT();
48  const l1t::LUT* etaLUT = omtfPatterns->etaLUT();
49  const l1t::LUT* ptLUT = omtfPatterns->ptLUT();
50  const l1t::LUT* pdfLUT = omtfPatterns->pdfLUT();
51  const l1t::LUT* meanDistPhiLUT = omtfPatterns->meanDistPhiLUT();
52  const l1t::LUT* distPhiShiftLUT = omtfPatterns->distPhiShiftLUT();
53 
54  unsigned int nGPs = myOmtfConfig->nGoldenPatterns();
55  edm::LogVerbatim("OMTFReconstruction")
56  << "ProcessorBase<>::configure. Building patterns from L1TMuonOverlapParams (LUTs). nGoldenPatterns() " << nGPs
57  << std::endl;
58 
59  unsigned int address = 0;
60  unsigned int iEta, iPt;
61  int iCharge;
62  //int meanDistPhiSize = myOmtfConfig->nLayers() * myOmtfConfig->nRefLayers() * myOmtfConfig->nGoldenPatterns();
63 
64  unsigned int group = 0;
65  unsigned int indexInGroup = 0;
66  for (unsigned int iGP = 0; iGP < nGPs; ++iGP) {
67  address = iGP;
68  iEta = etaLUT->data(address);
69  iCharge = chargeLUT->data(address) == 0 ? -1 : 1;
70  iPt = ptLUT->data(address);
71 
72  //the patterns in the LUTs should contain the empty patterns, only then the group and indexInGroup calculation works
74  indexInGroup = iGP % myOmtfConfig->patternsInGroup + 1;
75  Key aKey(iEta, iPt, iCharge, theGPs.size(), group, indexInGroup);
76  if (iPt == 0) {
77  LogTrace("OMTFReconstruction") << "skipping empty pattern " << aKey << " " << std::endl;
78  //<<myOmtfConfig->getPatternPtRange(iGP).ptFrom<<" - "<<myOmtfConfig->getPatternPtRange(iGP).ptTo<<" GeV"<<std::endl; PatternPtRange is not initialized here yet, so do not use it!!!!
79  continue;
80  }
81 
82  LogTrace("OMTFReconstruction") << "adding pattern " << aKey << " " << std::endl;
83  //<<myOmtfConfig->getPatternPtRange(iGP).ptFrom<<" - "<<myOmtfConfig->getPatternPtRange(iGP).ptTo<<" GeV"<<std::endl; PatternPtRange is not initialized here yet, so do not use it!!!!
84 
85  GoldenPatternType* aGP = new GoldenPatternType(aKey, myOmtfConfig);
86 
87  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
88  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
89  address = iRefLayer + iLayer * myOmtfConfig->nRefLayers() +
91 
93  //LUT values are only positive, therefore to have negative meanDistPh half of the max LUT value is subtracted
94  int value = meanDistPhiLUT->data(address) - (1 << (meanDistPhiLUT->nrBitsData() - 1));
95  aGP->setMeanDistPhiValue(value, iLayer, iRefLayer, 0);
96 
97  /* uncomment this if you need meanDistPhi1 in the LUTs (and set useMeanDistPhi1 in XMLConfigReader::readLUTs)
98  if ( (1 << meanDistPhiLUT->nrBitsAddress()) > 2 * meanDistPhiSize ) {
99  //for the version of the meanDistPhi which have two values for each gp,iLayer,iRefLayer, FIXME: do it a better way
100  value = meanDistPhiLUT->data(address + meanDistPhiSize) - (1 << (meanDistPhiLUT->nrBitsData() - 1));
101  //the second meanDistPhi is in the LUT at the position (address+meanDistPhiSize)
102  aGP->setMeanDistPhiValue(value, iLayer, iRefLayer, 1);
103  }*/
104 
105  //selDistPhiShift, if the distPhiShiftLUT is nullptr, it means it was not present in the L1TMuonOverlapParamsRcd
106  if (distPhiShiftLUT) {
107  value = distPhiShiftLUT->data(address); //distPhiShiftLUT values are only positive
108  aGP->setDistPhiBitShift(value, iLayer, iRefLayer);
109  }
110  }
112  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
113  for (unsigned int iPdf = 0; iPdf < (unsigned int)(1 << myOmtfConfig->nPdfAddrBits()); ++iPdf) {
114  address = iPdf + iRefLayer * (1 << myOmtfConfig->nPdfAddrBits()) +
115  iLayer * myOmtfConfig->nRefLayers() * (1 << myOmtfConfig->nPdfAddrBits()) +
117  int value = pdfLUT->data(address); //here only int is possible
118  aGP->setPdfValue(value, iLayer, iRefLayer, iPdf);
119 
120  //LogTrace("OMTFReconstruction") <<" iLayer "<<iLayer<<" iRefLayer "<<iRefLayer<<" iPdf "<<iPdf << " address "<<address<<" value "<<value<<std::endl;
121  }
122  }
123  }
124 
125  addGP(aGP);
126  }
127 
128  initPatternPtRange(true);
129 
130  omtfConfig->setPatternPtRange(getPatternPtRange());
131 
132  return true;
133 }
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57
Log< level::Info, true > LogVerbatim
const l1t::LUT * chargeLUT() const
Golden Patterns definitions.
unsigned int nrBitsData() const
Definition: LUT.h:53
const std::vector< OMTFConfiguration::PatternPt > & getPatternPtRange() const
Definition: ProcessorBase.h:47
virtual void addGP(GoldenPatternType *aGP)
Add GoldenPattern to pattern vec.
const l1t::LUT * distPhiShiftLUT() const
unsigned int nGoldenPatterns() const
#define LogTrace(id)
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54
unsigned int nPdfAddrBits() const
int data(unsigned int address) const
Definition: LUT.h:46
const l1t::LUT * pdfLUT() const
unsigned int nLayers() const
Definition: value.py:1
static const unsigned int patternsInGroup
unsigned int nRefLayers() const
Definition: LUT.h:29
virtual void initPatternPtRange(bool firstPatFrom0)
const ap_uint< BITSPT > ptLUT[1858]
Definition: Constants.h:115
const l1t::LUT * meanDistPhiLUT() const
const l1t::LUT * ptLUT() const
const l1t::LUT * etaLUT() const
virtual void resetConfiguration()
Reset all configuration parameters.
const uint etaLUT[4082]
Definition: Constants.h:218

◆ getPatternPtRange()

template<class GoldenPatternType>
const std::vector<OMTFConfiguration::PatternPt>& ProcessorBase< GoldenPatternType >::getPatternPtRange ( ) const
inline

Definition at line 47 of file ProcessorBase.h.

References ProcessorBase< GoldenPatternType >::patternPts.

Referenced by ProcessorBase< GoldenPatternType >::ProcessorBase().

47 { return patternPts; }
std::vector< OMTFConfiguration::PatternPt > patternPts
Definition: ProcessorBase.h:66

◆ getPatterns()

template<class GoldenPatternType>
virtual GoldenPatternVec<GoldenPatternType>& ProcessorBase< GoldenPatternType >::getPatterns ( )
inlinevirtual

Return vector of GoldenPatterns.

Definition at line 34 of file ProcessorBase.h.

References ProcessorBase< GoldenPatternType >::theGPs.

34 { return theGPs; };
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57

◆ initPatternPtRange()

template<class GoldenPatternType >
void ProcessorBase< GoldenPatternType >::initPatternPtRange ( bool  firstPatFrom0)
virtual

Definition at line 169 of file ProcessorBase.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, OMTFConfiguration::PatternPt::charge, crabWrapper::key, OMTFConfiguration::PatternPt::ptFrom, OMTFConfiguration::PatternPt::ptTo, and AlignmentTrackSelector_cfi::theCharge.

Referenced by ProcessorBase< GoldenPatternType >::ProcessorBase().

169  {
170  patternPts.clear();
171 
172  bool firstPos = firstPatFrom0;
173  bool firstNeg = firstPatFrom0;
174  for (unsigned int iPat = 0; iPat < theGPs.size(); iPat++) {
176  int charge = theGPs[iPat]->key().theCharge;
177  if (theGPs[iPat] == nullptr || theGPs[iPat]->key().thePt == 0) {
178  patternPts.push_back(patternPt);
179  continue;
180  }
181 
182  patternPt.ptFrom = myOmtfConfig->hwPtToGev(theGPs[iPat]->key().thePt);
183  if (firstPos && theGPs[iPat]->key().theCharge == 1) {
184  patternPt.ptFrom = 0;
185  firstPos = false;
186  }
187  if (firstNeg && theGPs[iPat]->key().theCharge == -1) {
188  patternPt.ptFrom = 0;
189  firstNeg = false;
190  }
191 
192  unsigned int iPat1 = iPat;
193  while (true) { //to skip the empty patterns with pt=0 and patterns with opposite charge
194  iPat1++;
195  if (iPat1 == theGPs.size())
196  break;
197  if (theGPs[iPat1]->key().thePt != 0 && theGPs[iPat1]->key().theCharge == charge)
198  break;
199  }
200 
201  if (iPat1 == theGPs.size())
202  patternPt.ptTo = 10000; //inf
203  else
204  patternPt.ptTo = myOmtfConfig->hwPtToGev(theGPs[iPat1]->key().thePt);
205 
206  patternPt.charge = charge;
207  patternPts.push_back(patternPt);
208  }
209 
210  //debug
211  /* for(unsigned int iPat = 0; iPat < theGPs.size(); iPat++) {
212  LogTrace("OMTFReconstruction") <<theGPs[iPat]->key()<<" ptFrom "<<patternPts[iPat].ptFrom<<" ptFrom "<<patternPts[iPat].ptTo<<std::endl;
213  }*/
214 
215  edm::LogTrace_("OMTFReconstruction") << __FUNCTION__ << ":" << __LINE__ << " patternPts.size() " << patternPts.size()
216  << endl;
217 }
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54
pattern pt range in Gev
double hwPtToGev(int hwPt) const override
uGMT pt scale conversion
std::vector< OMTFConfiguration::PatternPt > patternPts
Definition: ProcessorBase.h:66

◆ printInfo()

template<class GoldenPatternType >
void ProcessorBase< GoldenPatternType >::printInfo ( ) const
virtual

Reimplemented in OMTFProcessor< GoldenPatternType >.

Definition at line 220 of file ProcessorBase.cc.

References runTauDisplay::gp.

Referenced by OMTFProcessor< GoldenPatternType >::printInfo().

220  {
222 
223  edm::LogVerbatim("OMTFReconstruction") << "\npatterns:" << std::endl;
224  unsigned int patNum = 0;
225  for (auto& gp : theGPs) {
226  edm::LogVerbatim("OMTFReconstruction")
227  << std::setw(2) << patNum << " " << gp->key() << " " << myOmtfConfig->getPatternPtRange(patNum).ptFrom << " - "
228  << myOmtfConfig->getPatternPtRange(patNum).ptTo << " GeV" << std::endl;
229  patNum++;
230  }
231 
232  /* //can be useful for debug, uncomment if needed
233  XMLConfigWriter xmlWriter(this->myOmtfConfig, false, false);
234  xmlWriter.writeGPs(this->theGPs, "patternsAsInTheProcessor.xml");*/
235 }
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57
Log< level::Info, true > LogVerbatim
void printConfig() const
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54
PatternPt getPatternPtRange(unsigned int patNum) const

◆ resetConfiguration()

template<class GoldenPatternType >
void ProcessorBase< GoldenPatternType >::resetConfiguration ( )
virtual

Reset all configuration parameters.

Reimplemented in OMTFProcessor< GoldenPatternType >.

Definition at line 34 of file ProcessorBase.cc.

34  {
35  theGPs.clear();
36 }
GoldenPatternVec< GoldenPatternType > theGPs
vector holding Golden Patterns
Definition: ProcessorBase.h:57

◆ restrictInput()

template<class GoldenPatternType >
MuonStubPtrs1D ProcessorBase< GoldenPatternType >::restrictInput ( unsigned int  iProcessor,
unsigned int  iCone,
unsigned int  iLayer,
const OMTFinput input 
)
protectedvirtual

Remove hits whis are outside input range for given processor and cone

Definition at line 145 of file ProcessorBase.cc.

References input.

148  {
149  MuonStubPtrs1D layerStubs;
150 
151  unsigned int iStart = myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].first;
152  unsigned int iEnd = iStart + myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].second - 1;
153 
154  for (unsigned int iInput = 0; iInput < input.getMuonStubs()[iLayer].size(); ++iInput) {
155  if (iInput >= iStart && iInput <= iEnd) {
156  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
157  layerStubs.push_back(input.getMuonStub(iLayer - 1, iInput));
158  } else
159  layerStubs.push_back(input.getMuonStub(iLayer, iInput)); //input.getHitPhi(iLayer, iInput)
160  }
161  }
162  //LogTrace("OMTFReconstruction") <<__FUNCTION__<<":"<<__LINE__<<" layerHits.size() "<<layerHits.size()<<std::endl;
163  return layerStubs;
164 }
static std::string const input
Definition: EdmProvDump.cc:47
const OMTFConfiguration * myOmtfConfig
Definition: ProcessorBase.h:54
const vector3D_pair & getConnections() const
std::vector< MuonStubPtr > MuonStubPtrs1D
Definition: MuonStub.h:66
bool isBendingLayer(unsigned int iLayer) const override

Member Data Documentation

◆ myOmtfConfig

template<class GoldenPatternType>
const OMTFConfiguration* ProcessorBase< GoldenPatternType >::myOmtfConfig
protected

Configuration of the algorithm. This object does not contain the patterns data.

Definition at line 54 of file ProcessorBase.h.

Referenced by ProcessorBase< GoldenPatternType >::ProcessorBase().

◆ patternPts

template<class GoldenPatternType>
std::vector<OMTFConfiguration::PatternPt> ProcessorBase< GoldenPatternType >::patternPts
protected

◆ theGPs

template<class GoldenPatternType>
GoldenPatternVec<GoldenPatternType> ProcessorBase< GoldenPatternType >::theGPs
protected

vector holding Golden Patterns

Definition at line 57 of file ProcessorBase.h.

Referenced by ProcessorBase< GoldenPatternType >::getPatterns(), and ProcessorBase< GoldenPatternType >::ProcessorBase().