CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTrigGeomUtils Class Reference

#include <DTTrigGeomUtils.h>

List of all members.

Public Member Functions

void computeSCCoordinates (const DTRecSegment4D *track, int &scsec, float &x, float &xdir, float &y, float &ydir)
 Compute track coordinates with SC sector numbering.
 DTTrigGeomUtils (edm::ESHandle< DTGeometry > muonGeom, bool dirInDeg=true)
 Constructor.
bool hasPosRF (int wh, int sec)
 Checks id the chamber has positive RF;.
void phiRange (const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
 Compute phi range in local chamber coordinates.
void thetaRange (const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
 Compute theta range in local chamber coordinates.
float trigDir (const L1MuDTChambPhDigi *trig)
 Return local direction (trigger RF) for a given trigger primitive.
float trigPos (const L1MuDTChambPhDigi *trig)
 Return local position (trigger RF) for a given trigger primitive.
void trigToSeg (int st, float &x, float dir)
 Compute Trigger x coordinate in chamber RF.
virtual ~DTTrigGeomUtils ()
 Destructor.

Private Attributes

edm::ESHandle< DTGeometrymuonGeom_
float radToDeg_
float xCenter_ [2]
float zcn_ [4]

Detailed Description

Definition at line 23 of file DTTrigGeomUtils.h.


Constructor & Destructor Documentation

DTTrigGeomUtils::DTTrigGeomUtils ( edm::ESHandle< DTGeometry muonGeom,
bool  dirInDeg = true 
)

Constructor.

Definition at line 33 of file DTTrigGeomUtils.cc.

References DTChamberId, DTSuperLayerId, muonGeom_, pi, GeomDet::position(), radToDeg_, DTChamber::superLayer(), GeomDet::surface(), GloballyPositioned< T >::toLocal(), GeomDet::toLocal(), x, xCenter_, z, and zcn_.

                                                                             : muonGeom_(muonGeom) {

  radToDeg_ = dirInDeg ? 180./Geom::pi() : 1;

  for (int ist=1; ist<=4; ++ist) {
    const DTChamberId chId(-2,ist,4);
    const DTChamber *chamb = muonGeom_->chamber(chId);
    const DTSuperLayer *sl1 = chamb->superLayer(DTSuperLayerId(chId,1));
    const DTSuperLayer *sl3 = chamb->superLayer(DTSuperLayerId(chId,3));
    zcn_[ist-1] = .5*(chamb->surface().toLocal(sl1->position()).z() + chamb->surface().toLocal(sl3->position()).z());
  }
  
  const DTChamber* chamb   = muonGeom_->chamber(DTChamberId(-2,4,13));
  const DTChamber* scchamb = muonGeom_->chamber(DTChamberId(-2,4,4));
  xCenter_[0] = scchamb->toLocal(chamb->position()).x()*.5;
  chamb   = muonGeom_->chamber(DTChamberId(-2,4,14));
  scchamb = muonGeom_->chamber(DTChamberId(-2,4,10));
  xCenter_[1] = scchamb->toLocal(chamb->position()).x()*.5;
      
  
}
DTTrigGeomUtils::~DTTrigGeomUtils ( ) [virtual]

Destructor.

Definition at line 56 of file DTTrigGeomUtils.cc.

                                  {

}

Member Function Documentation

void DTTrigGeomUtils::computeSCCoordinates ( const DTRecSegment4D track,
int &  scsec,
float &  x,
float &  xdir,
float &  y,
float &  ydir 
)

Compute track coordinates with SC sector numbering.

Definition at line 61 of file DTTrigGeomUtils.cc.

References abs, DTRecSegment4D::chamberId(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), radToDeg_, DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), PV3DBase< T, PVType, FrameType >::x(), xCenter_, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTLocalTriggerLutTask::analyze(), DTTriggerEfficiencyTask::analyze(), and DTLocalTriggerTask::runSegmentAnalysis().

                                                                                                                               {

  int sector = track->chamberId().sector();
  int station = track->chamberId().station();
  xdir = atan(track->localDirection().x()/ track->localDirection().z())*radToDeg_;
  ydir = atan(track->localDirection().y()/ track->localDirection().z())*radToDeg_;


  scsec = sector>12 ? sector==13 ? 4 : 10 : sector;
  float xcenter = (scsec==4||scsec==10) ? (sector-12.9)/abs(sector-12.9)*xCenter_[(sector==10||sector==14)] : 0.;
  x = track->localPosition().x()+xcenter*(station==4);
  y = track->localPosition().y();

}
bool DTTrigGeomUtils::hasPosRF ( int  wh,
int  sec 
) [inline]

Checks id the chamber has positive RF;.

Definition at line 52 of file DTTrigGeomUtils.h.

Referenced by trigDir(), and trigPos().

{ return wh>0 || (wh==0 && sec%4>1); };
void DTTrigGeomUtils::phiRange ( const DTChamberId id,
float &  min,
float &  max,
int &  nbins,
float  step = 15 
)

Compute phi range in local chamber coordinates.

Definition at line 77 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), DTLayerId, min, muonGeom_, DTLayer::specificTopology(), and relativeConstraints::station.

Referenced by DTTriggerEfficiencyTest::bookChambHistos(), and DTLocalTriggerBaseTask::bookHistos().

                                                                                                   {

  int station = id.station();
  int sector  = id.sector(); 
  
  const DTLayer  *layer = muonGeom_->layer(DTLayerId(id,1,1));
  DTTopology topo = layer->specificTopology();
  double range = topo.channels()*topo.cellWidth();
  min = -range*.5;
  max =  range*.5;

  if (station==4 && (sector==4 || sector == 10)){
    min = -range-10;
    max =  range+10;
  }
  nbins = static_cast<int>((max-min)/step);

  return;
 
}
void DTTrigGeomUtils::thetaRange ( const DTChamberId id,
float &  min,
float &  max,
int &  nbins,
float  step = 15 
)

Compute theta range in local chamber coordinates.

Definition at line 99 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), DTLayerId, min, muonGeom_, and DTLayer::specificTopology().

Referenced by DTTriggerEfficiencyTest::bookChambHistos().

                                                                                                     {

  const DTLayer  *layer = muonGeom_->layer(DTLayerId(id,2,1));
  DTTopology topo = layer->specificTopology();
  double range = topo.channels()*topo.cellWidth();
  min = -range*.5;
  max =  range*.5;

  nbins = static_cast<int>((max-min)/step);

  return;
 
}
float DTTrigGeomUtils::trigDir ( const L1MuDTChambPhDigi trig)

Return local direction (trigger RF) for a given trigger primitive.

Definition at line 153 of file DTTrigGeomUtils.cc.

References dir, hasPosRF(), phi, L1MuDTChambPhDigi::phi(), L1MuDTChambPhDigi::phiB(), radToDeg_, L1MuDTChambPhDigi::scNum(), and L1MuDTChambPhDigi::whNum().

Referenced by DTLocalTriggerLutTask::analyze(), DTLocalTriggerBaseTask::runDCCAnalysis(), DTLocalTriggerTask::runDCCAnalysis(), and DTLocalTriggerTask::runSegmentAnalysis().

                                                           {


  int wh   = trig->whNum();
  int sec  = trig->scNum()+1;
  int phi  = trig->phi();
  int phib = trig->phiB();

  float dir = (phib/512.+phi/4096.)*radToDeg_;

  // change sign in case of negative wheels
  if (!hasPosRF(wh,sec)) { dir = -dir; }

  return dir;

}
float DTTrigGeomUtils::trigPos ( const L1MuDTChambPhDigi trig)

Return local position (trigger RF) for a given trigger primitive.

Definition at line 114 of file DTTrigGeomUtils.cc.

References funct::cos(), DTChamberId, hasPosRF(), muonGeom_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, L1MuDTChambPhDigi::phi(), Geom::pi(), alignCSCRings::r, L1MuDTChambPhDigi::scNum(), L1MuDTChambPhDigi::stNum(), funct::tan(), L1MuDTChambPhDigi::whNum(), x, xCenter_, and zcn_.

Referenced by DTLocalTriggerLutTask::analyze(), DTLocalTriggerBaseTask::runDCCAnalysis(), DTLocalTriggerTask::runDCCAnalysis(), and DTLocalTriggerTask::runSegmentAnalysis().

                                                           {

  
  int wh   = trig->whNum();
  int sec  = trig->scNum()+1;
  int st   = trig->stNum();
  int phi  = trig->phi();

  float phin = (sec-1)*Geom::pi()/6;
  float phicenter = 0;
  float r = 0;
  float xcenter = 0;

  if (sec==4 && st==4) {
    GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,13))->position() : muonGeom_->chamber(DTChamberId(wh,st,4))->position();
    xcenter = phi>0 ? xCenter_[0] : -xCenter_[0];
    phicenter =  gpos.phi();
    r = gpos.perp();
  } else if (sec==10 && st==4) {
    GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,14))->position() : muonGeom_->chamber(DTChamberId(wh,st,10))->position();
    xcenter = phi>0 ? xCenter_[1] : -xCenter_[1];  
    phicenter =  gpos.phi();
    r = gpos.perp();
  } else {
    GlobalPoint gpos = muonGeom_->chamber(DTChamberId(wh,st,sec))->position();
    phicenter =  gpos.phi();
    r = gpos.perp();
  }  

  float deltaphi = phicenter-phin;
  float x = (tan(phi/4096.)-tan(deltaphi))*(r*cos(deltaphi) - zcn_[st-1]); //zcn is in local coordinates -> z invreases approching to vertex
  if (hasPosRF(wh,sec)){ x = -x; } // change sign in case of positive wheels
  x+=xcenter;

  return x;

}
void DTTrigGeomUtils::trigToSeg ( int  st,
float &  x,
float  dir 
) [inline]

Compute Trigger x coordinate in chamber RF.

Definition at line 49 of file DTTrigGeomUtils.h.

References radToDeg_, funct::tan(), and zcn_.

Referenced by DTLocalTriggerLutTask::analyze(), and DTLocalTriggerTask::runSegmentAnalysis().

{ x -= tan(dir/radToDeg_)*zcn_[st-1]; };

Member Data Documentation

Definition at line 52 of file DTTrigGeomUtils.h.

Referenced by DTTrigGeomUtils(), phiRange(), thetaRange(), and trigPos().

float DTTrigGeomUtils::radToDeg_ [private]

Definition at line 58 of file DTTrigGeomUtils.h.

Referenced by computeSCCoordinates(), DTTrigGeomUtils(), trigDir(), and trigToSeg().

float DTTrigGeomUtils::xCenter_[2] [private]

Definition at line 59 of file DTTrigGeomUtils.h.

Referenced by computeSCCoordinates(), DTTrigGeomUtils(), and trigPos().

float DTTrigGeomUtils::zcn_[4] [private]

Definition at line 57 of file DTTrigGeomUtils.h.

Referenced by DTTrigGeomUtils(), trigPos(), and trigToSeg().