CMS 3D CMS Logo

Public Member Functions | Private Attributes

dtCalibration::DTT0FillChamberFromDB Class Reference

#include <DTT0FillChamberFromDB.h>

Inheritance diagram for dtCalibration::DTT0FillChamberFromDB:
dtCalibration::DTT0BaseCorrection

List of all members.

Public Member Functions

virtual DTT0Data correction (const DTWireId &)
 DTT0FillChamberFromDB (const edm::ParameterSet &)
virtual void setES (const edm::EventSetup &setup)
virtual ~DTT0FillChamberFromDB ()

Private Attributes

std::string chamberRef_
DTChamberId chosenChamberId_
std::string dbLabelRef_
const DTT0t0Map_
const DTT0t0MapRef_

Detailed Description

Definition at line 25 of file DTT0FillChamberFromDB.h.


Constructor & Destructor Documentation

DTT0FillChamberFromDB::DTT0FillChamberFromDB ( const edm::ParameterSet pset)

Definition at line 27 of file DTT0FillChamberFromDB.cc.

References chamberRef_, chosenChamberId_, and DTChamberId.

                                                                    :
  dbLabelRef_( pset.getParameter<string>("dbLabelRef") ),
  chamberRef_( pset.getParameter<string>("chamberId") ) {

  //DTChamberId chosenChamberId;
  if( chamberRef_ != "" && chamberRef_ != "None" ){
    stringstream linestr;
    int selWheel, selStation, selSector;
    linestr << chamberRef_;
    linestr >> selWheel >> selStation >> selSector;
    chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
    LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Chosen chamber: " << chosenChamberId_ << endl;
  }
  //FIXME: Check if chosen chamber is valid.

}
DTT0FillChamberFromDB::~DTT0FillChamberFromDB ( ) [virtual]

Definition at line 44 of file DTT0FillChamberFromDB.cc.

                                              {
}

Member Function Documentation

DTT0Data DTT0FillChamberFromDB::correction ( const DTWireId wireId) [virtual]

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 62 of file DTT0FillChamberFromDB.cc.

References DTSuperLayerId::chamberId(), chamberRef_, chosenChamberId_, DTTimeUnits::counts, Exception, DTT0::get(), DTWireId::layerId(), ntuplemaker::status, DTLayerId::superlayerId(), t0Map_, and t0MapRef_.

                                                                 {
  // If wire belongs to chosen chamber, use t0 value from reference DB
  // Otherwise use value from default DB
 
  DTChamberId chamberId = wireId.layerId().superlayerId().chamberId();

  if( chamberRef_ != "" && chamberRef_ != "None" && chamberId == chosenChamberId_ ){
     // Access reference DB
     float t0MeanRef,t0RMSRef;
     int statusRef = t0MapRef_->get(wireId,t0MeanRef,t0RMSRef,DTTimeUnits::counts);
     if(!statusRef){
        return DTT0Data(t0MeanRef,t0RMSRef);
     } else{
        //... 
        throw cms::Exception("[DTT0FillChamberFromDB]") << "Could not find t0 entry in reference DB for"
                                                        << wireId << endl;
     }
  } else{
     // Access default DB
     float t0Mean,t0RMS;
     int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
     if(!status){
        return DTT0Data(t0Mean,t0RMS);
     } else{
        //... 
        throw cms::Exception("[DTT0FillChamberFromDB]") << "Could not find t0 entry in DB for"
                                                        << wireId << endl;
     }
  }
}
void DTT0FillChamberFromDB::setES ( const edm::EventSetup setup) [virtual]

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 47 of file DTT0FillChamberFromDB.cc.

References dbLabelRef_, edm::EventSetup::get(), t0Map_, and t0MapRef_.

                                                         {
  // Get t0 record from DB
  ESHandle<DTT0> t0H;
  setup.get<DTT0Rcd>().get(t0H);
  t0Map_ = &*t0H;
  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] T0 version: " << t0H->version();

  // Get reference t0 DB 
  ESHandle<DTT0> t0RefH;
  setup.get<DTT0Rcd>().get(dbLabelRef_,t0RefH);
  t0MapRef_ = &*t0RefH;
  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Reference T0 version: " << t0RefH->version();

}

Member Data Documentation

Definition at line 38 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

Definition at line 40 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

Definition at line 37 of file DTT0FillChamberFromDB.h.

Referenced by setES().

Definition at line 43 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().

Definition at line 42 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().