CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTTrigMatchRPhi Class Reference

#include <DTTTrigMatchRPhi.h>

Inheritance diagram for DTTTrigMatchRPhi:
DTTTrigBaseCorrection

List of all members.

Public Member Functions

virtual DTTTrigData correction (const DTSuperLayerId &)
 DTTTrigMatchRPhi (const edm::ParameterSet &)
virtual void setES (const edm::EventSetup &setup)
virtual ~DTTTrigMatchRPhi ()

Private Attributes

std::string dbLabel
const DTTtrigtTrigMap_

Detailed Description

Concrete implementation of a DTTTrigBaseCorrection. Matches tTrig values for RPhi SL's

Revision:
1.2
Author:
A. Vilela Pereira

Definition at line 22 of file DTTTrigMatchRPhi.h.


Constructor & Destructor Documentation

DTTTrigMatchRPhi::DTTTrigMatchRPhi ( const edm::ParameterSet pset)

Definition at line 22 of file DTTTrigMatchRPhi.cc.

References dtTTrigAnalyzer_cfg::dbLabel, and edm::ParameterSet::getUntrackedParameter().

                                                           {
  dbLabel  = pset.getUntrackedParameter<string>("dbLabel", "");
}
DTTTrigMatchRPhi::~DTTTrigMatchRPhi ( ) [virtual]

Definition at line 26 of file DTTTrigMatchRPhi.cc.

{}

Member Function Documentation

DTTTrigData DTTTrigMatchRPhi::correction ( const DTSuperLayerId slId) [virtual]

Implements DTTTrigBaseCorrection.

Definition at line 35 of file DTTTrigMatchRPhi.cc.

References DTSuperLayerId::chamberId(), Exception, DTTimeUnits::ns, ntuplemaker::status, and DTSuperLayerId::superLayer().

                                                                   {
  
  float tTrigMean,tTrigSigma,kFactor;
  int status = tTrigMap_->get(slId,tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
  // RZ superlayers return the current value
  if(slId.superLayer() == 2){
    if(status != 0) throw cms::Exception("[DTTTrigMatchRPhi]") << "Could not find tTrig entry in DB for"
                                                               << slId << endl;
    return DTTTrigData(tTrigMean,tTrigSigma,kFactor);
  } else{
    DTSuperLayerId partnerSLId(slId.chamberId(),(slId.superLayer() == 1)?3:1);
    float tTrigMeanNew,tTrigSigmaNew,kFactorNew;
    if(!status){ // Gets average of both SuperLayer's
      if(!tTrigMap_->get(partnerSLId,tTrigMeanNew,tTrigSigmaNew,kFactorNew,DTTimeUnits::ns)){
        tTrigMeanNew = (tTrigMean + tTrigMeanNew)/2.;
//         tTrigSigmaNew = sqrt(tTrigSigmaNew*tTrigSigmaNew + tTrigSigma*tTrigSigma)/2.;
        tTrigSigmaNew = (tTrigSigmaNew + tTrigSigma)/2.;

        kFactorNew = kFactor;
        return DTTTrigData(tTrigMeanNew,tTrigSigmaNew,kFactorNew);
      } else return DTTTrigData(tTrigMean,tTrigSigma,kFactor); 
    } else{ // If there is no entry tries to find partner SL and retrieves its value
      if(!tTrigMap_->get(partnerSLId,tTrigMeanNew,tTrigSigmaNew,kFactorNew,DTTimeUnits::ns))
        return DTTTrigData(tTrigMeanNew,tTrigSigmaNew,kFactorNew);
      else { // Both RPhi SL's not present in DB
        throw cms::Exception("[DTTTrigMatchRPhi]") << "Could not find tTrig entry in DB for"
                                                   << slId << "\n" << partnerSLId << endl;
      }
    }
  }
}
void DTTTrigMatchRPhi::setES ( const edm::EventSetup setup) [virtual]

Implements DTTTrigBaseCorrection.

Definition at line 28 of file DTTTrigMatchRPhi.cc.

References dtTTrigAnalyzer_cfg::dbLabel, and edm::EventSetup::get().

                                                    {
  // Get tTrig record from DB
  ESHandle<DTTtrig> tTrig;
  setup.get<DTTtrigRcd>().get(dbLabel,tTrig);
  tTrigMap_ = &*tTrig;
}

Member Data Documentation

std::string DTTTrigMatchRPhi::dbLabel [private]

Definition at line 36 of file DTTTrigMatchRPhi.h.

Definition at line 34 of file DTTTrigMatchRPhi.h.