CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripLorentzAngleGenerator Class Reference

#include <SiStripLorentzAngleGenerator.h>

Inheritance diagram for SiStripLorentzAngleGenerator:
SiStripDepCondObjBuilderBase< SiStripLorentzAngle, TrackerTopology >

Public Member Functions

void getObj (SiStripLorentzAngle *&obj, const TrackerTopology *tTopo)
 
 SiStripLorentzAngleGenerator (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripLorentzAngleGenerator ()
 
- Public Member Functions inherited from SiStripDepCondObjBuilderBase< SiStripLorentzAngle, TrackerTopology >
virtual bool checkForCompatibility (std::string ss)
 
virtual void getMetaDataString (std::stringstream &ss)
 
virtual void initialize ()
 
 SiStripDepCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripDepCondObjBuilderBase ()
 

Private Member Functions

SiStripLorentzAnglecreateObject (const TrackerTopology *tTopo)
 
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. More...
 

Private Attributes

float hallMobility_
 

Additional Inherited Members

- Protected Attributes inherited from SiStripDepCondObjBuilderBase< SiStripLorentzAngle, TrackerTopology >
edm::ParameterSet _pset
 
SiStripLorentzAngleobj_
 

Detailed Description

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 23 of file SiStripLorentzAngleGenerator.h.

Constructor & Destructor Documentation

SiStripLorentzAngleGenerator::SiStripLorentzAngleGenerator ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 20 of file SiStripLorentzAngleGenerator.cc.

20  :
22 {
23  edm::LogInfo("SiStripLorentzAngleGenerator") << "[SiStripLorentzAngleGenerator::SiStripLorentzAngleGenerator]";
24 }
SiStripDepCondObjBuilderBase(const edm::ParameterSet &pset)
SiStripLorentzAngleGenerator::~SiStripLorentzAngleGenerator ( )

Definition at line 27 of file SiStripLorentzAngleGenerator.cc.

27  {
28  edm::LogInfo("SiStripLorentzAngleGenerator") << "[SiStripLorentzAngleGenerator::~SiStripLorentzAngleGenerator]";
29 }

Member Function Documentation

SiStripLorentzAngle * SiStripLorentzAngleGenerator::createObject ( const TrackerTopology tTopo)
private

Definition at line 48 of file SiStripLorentzAngleGenerator.cc.

References SiStripDepCondObjBuilderBase< SiStripLorentzAngle, TrackerTopology >::_pset, gather_cfg::cout, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), hallMobility_, getGTfromDQMFile::obj, SiStripLorentzAngle::putLorentzAngle(), matplotRender::reader, setHallMobility(), setUniform(), redigi_cff::SiStripLorentzAngle, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecRing(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, StripSubdetector::TOB, TrackerTopology::tobLayer(), and create_public_lumi_plots::transform.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::dropEvent(), and getObj().

49 {
51 
53 
54  std::vector<double> TIB_EstimatedValuesMin(_pset.getParameter<std::vector<double> >("TIB_EstimatedValuesMin"));
55  std::vector<double> TIB_EstimatedValuesMax(_pset.getParameter<std::vector<double> >("TIB_EstimatedValuesMax"));
56  std::vector<double> TOB_EstimatedValuesMin(_pset.getParameter<std::vector<double> >("TOB_EstimatedValuesMin"));
57  std::vector<double> TOB_EstimatedValuesMax(_pset.getParameter<std::vector<double> >("TOB_EstimatedValuesMax"));
58  std::vector<double> TIB_PerCent_Errs(_pset.getParameter<std::vector<double> >("TIB_PerCent_Errs"));
59  std::vector<double> TOB_PerCent_Errs(_pset.getParameter<std::vector<double> >("TOB_PerCent_Errs"));
60 
61  // If max values are passed they must be equal in number to the min values.
62  if( (TIB_EstimatedValuesMax.size() != 0 && (TIB_EstimatedValuesMin.size() != TIB_EstimatedValuesMax.size())) ||
63  (TOB_EstimatedValuesMax.size() != 0 && (TOB_EstimatedValuesMin.size() != TOB_EstimatedValuesMax.size())) ) {
64  std::cout << "ERROR: size of min and max values is different" << std::endl;
65  std::cout << "TIB_EstimatedValuesMin.size() = " << TIB_EstimatedValuesMin.size() << ", TIB_EstimatedValuesMax.size() " << TIB_EstimatedValuesMax.size() << std::endl;
66  std::cout << "TOB_EstimatedValuesMin.size() = " << TOB_EstimatedValuesMin.size() << ", TOB_EstimatedValuesMax.size() " << TOB_EstimatedValuesMax.size() << std::endl;
67  }
68  std::vector<bool> uniformTIB(TIB_EstimatedValuesMin.size(), false);
69  std::vector<bool> uniformTOB(TOB_EstimatedValuesMin.size(), false);
70 
71  setUniform(TIB_EstimatedValuesMin, TIB_EstimatedValuesMax, uniformTIB);
72  setUniform(TOB_EstimatedValuesMin, TOB_EstimatedValuesMax, uniformTOB);
73 
75 
76  // Compute standard deviations
77  std::vector<double> StdDevs_TIB(TIB_EstimatedValuesMin.size(), 0);
78  std::vector<double> StdDevs_TOB(TOB_EstimatedValuesMin.size(), 0);
79  transform(TIB_EstimatedValuesMin.begin(), TIB_EstimatedValuesMin.end(), TIB_PerCent_Errs.begin(), StdDevs_TIB.begin(), computeSigma);
80  transform(TOB_EstimatedValuesMin.begin(), TOB_EstimatedValuesMin.end(), TOB_PerCent_Errs.begin(), StdDevs_TOB.begin(), computeSigma);
81 
82  // Compute mean values to be used with TID and TEC
83  double TIBmeanValueMin = std::accumulate( TIB_EstimatedValuesMin.begin(), TIB_EstimatedValuesMin.end(), 0.)/double(TIB_EstimatedValuesMin.size());
84  double TIBmeanValueMax = std::accumulate( TIB_EstimatedValuesMax.begin(), TIB_EstimatedValuesMax.end(), 0.)/double(TIB_EstimatedValuesMax.size());
85  double TOBmeanValueMin = std::accumulate( TOB_EstimatedValuesMin.begin(), TOB_EstimatedValuesMin.end(), 0.)/double(TOB_EstimatedValuesMin.size());
86  double TOBmeanValueMax = std::accumulate( TOB_EstimatedValuesMax.begin(), TOB_EstimatedValuesMax.end(), 0.)/double(TOB_EstimatedValuesMax.size());
87  double TIBmeanPerCentError = std::accumulate( TIB_PerCent_Errs.begin(), TIB_PerCent_Errs.end(), 0.)/double(TIB_PerCent_Errs.size());
88  double TOBmeanPerCentError = std::accumulate( TOB_PerCent_Errs.begin(), TOB_PerCent_Errs.end(), 0.)/double(TOB_PerCent_Errs.size());
89  double TIBmeanStdDev = (TIBmeanPerCentError/100)*TIBmeanValueMin;
90  double TOBmeanStdDev = (TOBmeanPerCentError/100)*TOBmeanValueMin;
91 
92  const std::vector<uint32_t> DetIds = reader.getAllDetIds();
93  for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++){
94  const DetId detectorId=DetId(*detit);
95  const int subDet = detectorId.subdetId();
96 
97  hallMobility_ = 0;
98 
99  int layerId = 0;
100 
101  if(subDet == int (StripSubdetector::TIB)) {
102  layerId = tTopo->tibLayer(detectorId) -1;
103  setHallMobility( TIB_EstimatedValuesMin[layerId], TIB_EstimatedValuesMax[layerId], StdDevs_TIB[layerId], uniformTIB[layerId] );
104  }
105  else if(subDet == int (StripSubdetector::TOB)) {
106  layerId = tTopo->tobLayer(detectorId) -1;
107  setHallMobility( TOB_EstimatedValuesMin[layerId], TOB_EstimatedValuesMax[layerId], StdDevs_TOB[layerId], uniformTOB[layerId] );
108  }
109  else if(subDet == int (StripSubdetector::TID)) {
110  // ATTENTION: as of now the uniform generation for TID is decided by the setting for layer 0 of TIB
111  setHallMobility( TIBmeanValueMin, TIBmeanValueMax, TIBmeanStdDev, uniformTIB[0] );
112  }
113  if(subDet == int (StripSubdetector::TEC)){
114  if(tTopo->tecRing(detectorId)<5){
115  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TIB
116  setHallMobility( TIBmeanValueMin, TIBmeanValueMax, TIBmeanStdDev, uniformTIB[0] );
117  }else{
118  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TOB
119  setHallMobility( TOBmeanValueMin, TOBmeanValueMax, TOBmeanStdDev, uniformTOB[0] );
120  }
121  }
122 
123  if ( ! obj->putLorentzAngle(*detit, hallMobility_) ) {
124  edm::LogError("SiStripLorentzAngleGenerator")<<" detid already exists"<<std::endl;
125  }
126  }
127  return obj;
128 }
T getParameter(std::string const &) const
tuple SiStripLorentzAngle
Definition: redigi_cff.py:15
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...
unsigned int tibLayer(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
bool putLorentzAngle(const uint32_t &, float)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
void setHallMobility(const double &meanMin, const double &meanMax, const double &sigma, const bool uniform)
unsigned int tobLayer(const DetId &id) const
void SiStripLorentzAngleGenerator::getObj ( SiStripLorentzAngle *&  obj,
const TrackerTopology depObj 
)
inlinevirtual

Returns the CondObj

Reimplemented from SiStripDepCondObjBuilderBase< SiStripLorentzAngle, TrackerTopology >.

Definition at line 29 of file SiStripLorentzAngleGenerator.h.

References createObject().

29 {obj=createObject(tTopo);}
SiStripLorentzAngle * createObject(const TrackerTopology *tTopo)
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.

  • If a min and max value were passed it takes the value from a uniform distribution.
  • If only a single value was passed and the error is set != 0 it takes the value from a gaussian distribution.
  • If the error is 0 and only one value is passed it takes the fixed min value.

Definition at line 31 of file SiStripLorentzAngleGenerator.cc.

References hallMobility_.

Referenced by createObject().

31  {
32  if( uniform ) hallMobility_ = CLHEP::RandFlat::shoot(meanMin, meanMax);
33  else if( sigma>0 ) hallMobility_ = CLHEP::RandGauss::shoot(meanMin, sigma);
34  else hallMobility_ = meanMin;
35 }
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 37 of file SiStripLorentzAngleGenerator.cc.

References bookConverter::max, and min().

Referenced by createObject().

37  {
38  if( estimatedValuesMax.size() != 0 ) {
39  std::vector<double>::const_iterator min = estimatedValuesMin.begin();
40  std:: vector<double>::const_iterator max = estimatedValuesMax.begin();
41  std::vector<bool>::iterator uniformIt = uniform.begin();
42  for( ; min != estimatedValuesMin.end(); ++min, ++max, ++uniformIt ) {
43  if( *min != *max ) *uniformIt = true;
44  }
45  }
46 }
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

float SiStripLorentzAngleGenerator::hallMobility_
private

Definition at line 34 of file SiStripLorentzAngleGenerator.h.

Referenced by createObject(), and setHallMobility().