Skip to content

Commit

Permalink
Merge pull request cms-sw#89 from akalinow/DT_theta
Browse files Browse the repository at this point in the history
Update on eta of DT hits.
  • Loading branch information
akalinow committed Nov 10, 2015
2 parents 703bb3a + 2a14167 commit 2928146
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 28 deletions.
14 changes: 11 additions & 3 deletions L1Trigger/L1TMuonTrackFinderOverlap/interface/AngleConverter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __GEOMETRYTRANSLATOR_H__
#define ___GEOMETRYTRANSLATOR_H__
#ifndef __ANGLECONVERTER_H__
#define __ANGLECONVERTER_H__

#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
Expand All @@ -15,6 +15,7 @@ class CSCLayer;
class DTGeometry;

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

Expand All @@ -38,7 +39,8 @@ class RPCDigi;
float getGlobalPhi(unsigned int rawid, const RPCDigi &aDigi);

///Convert local eta coordinate to global digital microGMT scale.
int getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aDigi);
int getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aDigi,
const L1MuDTChambThContainer *dtThDigis);

///Convert local eta coordinate to global digital microGMT scale.
int getGlobalEta(unsigned int rawid, const CSCCorrelatedLCTDigi &aDigi);
Expand All @@ -48,7 +50,13 @@ class RPCDigi;

private:

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


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

// pointers to the current geometry records
unsigned long long _geom_cache_id;
Expand Down
47 changes: 32 additions & 15 deletions L1Trigger/L1TMuonTrackFinderOverlap/src/AngleConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
#include "DataFormats/RPCDigi/interface/RPCDigi.h"

#include <cmath>
Expand Down Expand Up @@ -141,10 +142,11 @@ int AngleConverter::getGlobalPhi(unsigned int rawid, const CSCCorrelatedLCTDigi
}
///////////////////////////////////////
///////////////////////////////////////
int AngleConverter::getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aDigi){
int AngleConverter::getGlobalEta(unsigned int rawid,
const L1MuDTChambPhDigi &aDigi,
const L1MuDTChambThContainer *dtThDigis){


int theta_bti_group = 3;//TEST
const DTChamberId baseid(aDigi.whNum(),aDigi.stNum(),aDigi.scNum()+1);

// do not use this pointer for anything other than creating a trig geom
Expand All @@ -160,7 +162,7 @@ int AngleConverter::getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aD
// TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
const int NBTI_theta = ( (baseid.station() != 4) ?
trig_geom->nCell(2) : trig_geom->nCell(3) );
const int bti_group = theta_bti_group;
const int bti_group = findBTIgroup(aDigi,dtThDigis);
const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1;
DTBtiId thetaBTI;
if ( baseid.station() != 4 && bti_group != -1) {
Expand All @@ -171,10 +173,8 @@ int AngleConverter::getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aD
thetaBTI = DTBtiId(baseid,3,1);
}
const GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI);
return theta_gp.theta();

return 0;

int iEta = theta_gp.eta()/2.61*240;
return iEta;
}
///////////////////////////////////////
///////////////////////////////////////
Expand Down Expand Up @@ -243,7 +243,6 @@ int AngleConverter::getGlobalEta(unsigned int rawid, const CSCCorrelatedLCTDigi
layer.release();

int iEta = final_gp.eta()/2.61*240;

return iEta;
}
///////////////////////////////////////
Expand All @@ -264,13 +263,6 @@ int AngleConverter::getGlobalEta(unsigned int rawid, const RPCDigi &aDigi){
}
///////////////////////////////////////
///////////////////////////////////////







bool AngleConverter::
isCSCCounterClockwise(const std::unique_ptr<const CSCLayer>& layer) const {
const int nStrips = layer->geometry()->numberOfStrips();
Expand All @@ -279,3 +271,28 @@ isCSCCounterClockwise(const std::unique_ptr<const CSCLayer>& layer) const {
return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) ||
(std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) );
}
///////////////////////////////////////
///////////////////////////////////////
const int AngleConverter::findBTIgroup(const L1MuDTChambPhDigi &aDigi,
const L1MuDTChambThContainer *dtThDigis){

int bti_group = -1;

const L1MuDTChambThDigi *theta_segm = dtThDigis->chThetaSegm(aDigi.whNum(),
aDigi.stNum(),
aDigi.scNum(),
aDigi.bxNum());
if(!theta_segm) return bti_group;

for(unsigned int i = 0; i < 7; ++i ){
if(theta_segm->position(i) && bti_group<0) bti_group = i;
///If there are more than one theta digi we do not take is
///due to unresolvet ambiguity. In this case we take eta of the
///middle of the chamber.
else if(theta_segm->position(i) && bti_group>-1) return -1;
}

return bti_group;
}
///////////////////////////////////////
///////////////////////////////////////
5 changes: 4 additions & 1 deletion L1Trigger/L1TMuonTrackFinderOverlap/src/OMTFSorter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ void OMTFSorter::sortProcessor(const std::vector<OMTFProcessor::resultsMap> & pr
candidate.setHwEta(myCand.eta);//eta scale set during input making in OMTFInputmaker
candidate.setHwPhi(myCand.phi);
candidate.setHwSign(myCand.charge+1*(myCand.charge<0));
candidate.setHwQual(bits.count());
///Quality is set to number of leayers hit.
///DT bending and position hit is counted as one.
///thus we subtract 1 for each DT station hit.
candidate.setHwQual(bits.count() - bits.test(0) - bits.test(2) - bits.test(4));
std::map<int, int> trackAddr;
trackAddr[0] = myCand.hits;
trackAddr[1] = myCand.refLayer;
Expand Down
21 changes: 12 additions & 9 deletions L1Trigger/L1TMuonTrackFinderOverlap/src/OMTFinputMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ bool OMTFinputMaker::acceptDigi(uint32_t rawId,
break;
}
case MuonSubdetId::CSC: {

CSCDetId csc(rawId);
if(type==l1t::tftype::omtf_pos &&
(csc.endcap()==2 || csc.ring()==1 || csc.station()==4)) return false;
Expand All @@ -121,23 +122,22 @@ bool OMTFinputMaker::acceptDigi(uint32_t rawId,
) return false;

aSector = csc.chamber();

aMin = OMTFConfiguration::endcap10DegMin[iProcessor];
aMax = OMTFConfiguration::endcap10DegMax[iProcessor];

if( (type==l1t::tftype::emtf_pos || type==l1t::tftype::emtf_neg) &&
csc.station()>1 && csc.ring()==1){
aMin = OMTFConfiguration::endcap20DegMin[iProcessor];
aMax = OMTFConfiguration::endcap20DegMax[iProcessor];
}
}
break;
}
}
}

if(aMax>aMin && aSector>=aMin && aSector<=aMax) return true;
if(aMax<aMin && (aSector>=aMin || aSector<=aMax)) return true;


return false;
}
///////////////////////////////////////
Expand Down Expand Up @@ -233,15 +233,17 @@ void OMTFinputMaker::processDT(const L1MuDTChambPhContainer *dtPhDigis,
///Check it the data fits into given processor input range
if(!acceptDigi(detid.rawId(), iProcessor, type)) continue;
///Check Trigger primitive quality
///Ts2Tag() == 0 - take only first track from DT Trigger Server
///BxCnt() == 0 - ??
///code()>=3 - take only double layer hits, HH, HL and LL
if (digiIt.bxNum()!= 0 || digiIt.BxCnt()!= 0 || digiIt.Ts2Tag()!= 0 || digiIt.code()<4) continue;

unsigned int hwNumber = OMTFConfiguration::getLayerNumber(detid.rawId());
if(OMTFConfiguration::hwToLogicLayer.find(hwNumber)==OMTFConfiguration::hwToLogicLayer.end()) continue;

unsigned int iLayer = OMTFConfiguration::hwToLogicLayer[hwNumber];
int iPhi = katownik->getGlobalPhi(detid.rawId(), digiIt);
int iEta = 0.9/2.61*240;//Temporary value.
if(detid.wheel()<0) iEta*=-1;
int iEta = katownik->getGlobalEta(detid.rawId(), digiIt, dtThDigis);
unsigned int iInput= getInputNumber(detid.rawId(), iProcessor, type);

myInput->addLayerHit(iLayer,iInput,iPhi,iEta);
Expand All @@ -256,10 +258,11 @@ void OMTFinputMaker::processCSC(const CSCCorrelatedLCTDigiCollection *cscDigis,
l1t::tftype type){

if(!cscDigis) return;

auto chamber = cscDigis->begin();
auto chend = cscDigis->end();
for( ; chamber != chend; ++chamber ) {
for( ; chamber != chend; ++chamber ) {

unsigned int rawid = (*chamber).first;
///Check it the data fits into given processor input range
if(!acceptDigi(rawid, iProcessor, type)) continue;
Expand All @@ -275,7 +278,7 @@ void OMTFinputMaker::processCSC(const CSCCorrelatedLCTDigiCollection *cscDigis,
unsigned int hwNumber = OMTFConfiguration::getLayerNumber(rawid);
if(OMTFConfiguration::hwToLogicLayer.find(hwNumber)==OMTFConfiguration::hwToLogicLayer.end()) continue;

unsigned int iLayer = OMTFConfiguration::hwToLogicLayer[hwNumber];
unsigned int iLayer = OMTFConfiguration::hwToLogicLayer[hwNumber];
int iPhi = katownik->getGlobalPhi(rawid, *digi);
int iEta = katownik->getGlobalEta(rawid, *digi);
///Accept CSC digis only up to eta=1.26.
Expand Down

0 comments on commit 2928146

Please sign in to comment.