#include <SiStripLorentzAngleGenerator.h>
Public Member Functions | |
void | getObj (SiStripLorentzAngle *&obj) |
SiStripLorentzAngleGenerator (const edm::ParameterSet &, const edm::ActivityRegistry &) | |
~SiStripLorentzAngleGenerator () | |
Private Member Functions | |
void | createObject () |
void | setHallMobility (const double &meanMin, const double &meanMax, const double &sigma, const bool uniform) |
void | setUniform (const std::vector< double > &TIB_EstimatedValuesMin, const std::vector< double > &TIB_EstimatedValuesMax, std::vector< bool > &uniformTIB) |
Method used to determine whether to generate with a uniform distribution for each layer. | |
Private Attributes | |
float | hallMobility_ |
Generator of the ideal/fake conditions for the LorentzAngle.
It receives input values with layer granularity and it is able to perform gaussian smearing or use a uniform distribution at the module level.
Depending on the parameters passed via cfg, it is able to generate the values per DetId with a gaussian distribution and a uniform distribution. When setting the sigma of the gaussian to 0 and passing a single value the generated values are fixed.
For TID and TEC the decision to generate with a uniform distribution comes from the setting for the first layers of TIB and TOB.
Definition at line 22 of file SiStripLorentzAngleGenerator.h.
SiStripLorentzAngleGenerator::SiStripLorentzAngleGenerator | ( | const edm::ParameterSet & | iConfig, |
const edm::ActivityRegistry & | aReg | ||
) | [explicit] |
Definition at line 22 of file SiStripLorentzAngleGenerator.cc.
: SiStripCondObjBuilderBase<SiStripLorentzAngle>::SiStripCondObjBuilderBase(iConfig) { edm::LogInfo("SiStripLorentzAngleGenerator") << "[SiStripLorentzAngleGenerator::SiStripLorentzAngleGenerator]"; }
SiStripLorentzAngleGenerator::~SiStripLorentzAngleGenerator | ( | ) |
Definition at line 29 of file SiStripLorentzAngleGenerator.cc.
{ edm::LogInfo("SiStripLorentzAngleGenerator") << "[SiStripLorentzAngleGenerator::~SiStripLorentzAngleGenerator]"; }
void SiStripLorentzAngleGenerator::createObject | ( | ) | [private] |
Definition at line 50 of file SiStripLorentzAngleGenerator.cc.
References SiStripCondObjBuilderBase< SiStripLorentzAngle >::_pset, gather_cfg::cout, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllDetIds(), edm::ParameterSet::getParameter(), hallMobility_, TIBDetId::layer(), TOBDetId::layer(), SiStripCondObjBuilderBase< SiStripLorentzAngle >::obj_, SiStripLorentzAngle::putLorentzAngle(), TECDetId::ringNumber(), setHallMobility(), setUniform(), redigi_cff::SiStripLorentzAngle, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.
Referenced by getObj().
{ obj_ = new SiStripLorentzAngle(); edm::FileInPath fp_ = _pset.getParameter<edm::FileInPath>("file"); std::vector<double> TIB_EstimatedValuesMin(_pset.getParameter<std::vector<double> >("TIB_EstimatedValuesMin")); std::vector<double> TIB_EstimatedValuesMax(_pset.getParameter<std::vector<double> >("TIB_EstimatedValuesMax")); std::vector<double> TOB_EstimatedValuesMin(_pset.getParameter<std::vector<double> >("TOB_EstimatedValuesMin")); std::vector<double> TOB_EstimatedValuesMax(_pset.getParameter<std::vector<double> >("TOB_EstimatedValuesMax")); std::vector<double> TIB_PerCent_Errs(_pset.getParameter<std::vector<double> >("TIB_PerCent_Errs")); std::vector<double> TOB_PerCent_Errs(_pset.getParameter<std::vector<double> >("TOB_PerCent_Errs")); // If max values are passed they must be equal in number to the min values. if( (TIB_EstimatedValuesMax.size() != 0 && (TIB_EstimatedValuesMin.size() != TIB_EstimatedValuesMax.size())) || (TOB_EstimatedValuesMax.size() != 0 && (TOB_EstimatedValuesMin.size() != TOB_EstimatedValuesMax.size())) ) { std::cout << "ERROR: size of min and max values is different" << std::endl; std::cout << "TIB_EstimatedValuesMin.size() = " << TIB_EstimatedValuesMin.size() << ", TIB_EstimatedValuesMax.size() " << TIB_EstimatedValuesMax.size() << std::endl; std::cout << "TOB_EstimatedValuesMin.size() = " << TOB_EstimatedValuesMin.size() << ", TOB_EstimatedValuesMax.size() " << TOB_EstimatedValuesMax.size() << std::endl; } std::vector<bool> uniformTIB(TIB_EstimatedValuesMin.size(), false); std::vector<bool> uniformTOB(TOB_EstimatedValuesMin.size(), false); setUniform(TIB_EstimatedValuesMin, TIB_EstimatedValuesMax, uniformTIB); setUniform(TOB_EstimatedValuesMin, TOB_EstimatedValuesMax, uniformTOB); SiStripDetInfoFileReader reader(fp_.fullPath()); // Compute standard deviations std::vector<double> StdDevs_TIB(TIB_EstimatedValuesMin.size(), 0); std::vector<double> StdDevs_TOB(TOB_EstimatedValuesMin.size(), 0); transform(TIB_EstimatedValuesMin.begin(), TIB_EstimatedValuesMin.end(), TIB_PerCent_Errs.begin(), StdDevs_TIB.begin(), computeSigma); transform(TOB_EstimatedValuesMin.begin(), TOB_EstimatedValuesMin.end(), TOB_PerCent_Errs.begin(), StdDevs_TOB.begin(), computeSigma); // Compute mean values to be used with TID and TEC double TIBmeanValueMin = std::accumulate( TIB_EstimatedValuesMin.begin(), TIB_EstimatedValuesMin.end(), 0.)/double(TIB_EstimatedValuesMin.size()); double TIBmeanValueMax = std::accumulate( TIB_EstimatedValuesMax.begin(), TIB_EstimatedValuesMax.end(), 0.)/double(TIB_EstimatedValuesMax.size()); double TOBmeanValueMin = std::accumulate( TOB_EstimatedValuesMin.begin(), TOB_EstimatedValuesMin.end(), 0.)/double(TOB_EstimatedValuesMin.size()); double TOBmeanValueMax = std::accumulate( TOB_EstimatedValuesMax.begin(), TOB_EstimatedValuesMax.end(), 0.)/double(TOB_EstimatedValuesMax.size()); double TIBmeanPerCentError = std::accumulate( TIB_PerCent_Errs.begin(), TIB_PerCent_Errs.end(), 0.)/double(TIB_PerCent_Errs.size()); double TOBmeanPerCentError = std::accumulate( TOB_PerCent_Errs.begin(), TOB_PerCent_Errs.end(), 0.)/double(TOB_PerCent_Errs.size()); double TIBmeanStdDev = (TIBmeanPerCentError/100)*TIBmeanValueMin; double TOBmeanStdDev = (TOBmeanPerCentError/100)*TOBmeanValueMin; const std::vector<uint32_t> DetIds = reader.getAllDetIds(); for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++){ hallMobility_ = 0; StripSubdetector subid(*detit); int layerId = 0; if(subid.subdetId() == int (StripSubdetector::TIB)) { TIBDetId theTIBDetId(*detit); layerId = theTIBDetId.layer() - 1; setHallMobility( TIB_EstimatedValuesMin[layerId], TIB_EstimatedValuesMax[layerId], StdDevs_TIB[layerId], uniformTIB[layerId] ); } else if(subid.subdetId() == int (StripSubdetector::TOB)) { TOBDetId theTOBDetId(*detit); layerId = theTOBDetId.layer() - 1; setHallMobility( TOB_EstimatedValuesMin[layerId], TOB_EstimatedValuesMax[layerId], StdDevs_TOB[layerId], uniformTOB[layerId] ); } else if(subid.subdetId() == int (StripSubdetector::TID)) { // ATTENTION: as of now the uniform generation for TID is decided by the setting for layer 0 of TIB setHallMobility( TIBmeanValueMin, TIBmeanValueMax, TIBmeanStdDev, uniformTIB[0] ); } if(subid.subdetId() == int (StripSubdetector::TEC)){ TECDetId TECid = TECDetId(*detit); if(TECid.ringNumber()<5){ // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TIB setHallMobility( TIBmeanValueMin, TIBmeanValueMax, TIBmeanStdDev, uniformTIB[0] ); }else{ // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TOB setHallMobility( TOBmeanValueMin, TOBmeanValueMax, TOBmeanStdDev, uniformTOB[0] ); } } if ( ! obj_->putLorentzAngle(*detit, hallMobility_) ) { edm::LogError("SiStripLorentzAngleGenerator")<<" detid already exists"<<std::endl; } } }
void SiStripLorentzAngleGenerator::getObj | ( | SiStripLorentzAngle *& | obj | ) | [inline, virtual] |
Returns the CondObj
Reimplemented from SiStripCondObjBuilderBase< SiStripLorentzAngle >.
Definition at line 28 of file SiStripLorentzAngleGenerator.h.
References createObject(), and SiStripCondObjBuilderBase< SiStripLorentzAngle >::obj_.
{createObject(); obj=obj_;}
void SiStripLorentzAngleGenerator::setHallMobility | ( | const double & | meanMin, |
const double & | meanMax, | ||
const double & | sigma, | ||
const bool | uniform | ||
) | [private] |
This method fills the hallMobility_ variable with different values according to the parameters passed in the cfg.
Definition at line 33 of file SiStripLorentzAngleGenerator.cc.
References hallMobility_.
Referenced by createObject().
{ if( uniform ) hallMobility_ = CLHEP::RandFlat::shoot(meanMin, meanMax); else if( sigma>0 ) hallMobility_ = CLHEP::RandGauss::shoot(meanMin, sigma); else hallMobility_ = meanMin; }
void SiStripLorentzAngleGenerator::setUniform | ( | const std::vector< double > & | TIB_EstimatedValuesMin, |
const std::vector< double > & | TIB_EstimatedValuesMax, | ||
std::vector< bool > & | uniformTIB | ||
) | [private] |
Method used to determine whether to generate with a uniform distribution for each layer.
Definition at line 39 of file SiStripLorentzAngleGenerator.cc.
Referenced by createObject().
{ if( estimatedValuesMax.size() != 0 ) { std::vector<double>::const_iterator min = estimatedValuesMin.begin(); std:: vector<double>::const_iterator max = estimatedValuesMax.begin(); std::vector<bool>::iterator uniformIt = uniform.begin(); for( ; min != estimatedValuesMin.end(); ++min, ++max, ++uniformIt ) { if( *min != *max ) *uniformIt = true; } } }
float SiStripLorentzAngleGenerator::hallMobility_ [private] |
Definition at line 33 of file SiStripLorentzAngleGenerator.h.
Referenced by createObject(), and setHallMobility().