CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelCPEGenericESProducer.cc
Go to the documentation of this file.
8 
13 
14 // new record
16 
17 
18 #include <string>
19 #include <memory>
20 
21 #define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc
22 
23 using namespace edm;
24 
26 {
27  std::string myname = p.getParameter<std::string>("ComponentName");
28  // Use LA-width from DB. If both (upper and this) are false LA-width is calcuated from LA-offset
29  useLAWidthFromDB_ = p.existsAs<bool>("useLAWidthFromDB")?
30  p.getParameter<bool>("useLAWidthFromDB"):false;
31  // Use Alignment LA-offset
32  useLAAlignmentOffsets_ = p.existsAs<bool>("useLAAlignmentOffsets")?
33  p.getParameter<bool>("useLAAlignmentOffsets"):false;
34  magname_ = p.existsAs<edm::ESInputTag>("MagneticFieldRecord")?
35  p.getParameter<edm::ESInputTag>("MagneticFieldRecord"):edm::ESInputTag("");
36 
37  pset_ = p;
38  setWhatProduced(this,myname);
39 
40  //std::cout<<" ESProducer "<<myname<<" "<<useLAWidthFromDB_<<" "<<useLAAlignmentOffsets_<<std::endl; //dk
41 
42 }
43 
45 
46 boost::shared_ptr<PixelClusterParameterEstimator>
48 
50  iRecord.getRecord<IdealMagneticFieldRecord>().get( magname_, magfield );
51 
53  iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD );
54 
56  iRecord.getRecord<TrackerDigiGeometryRecord>().getRecord<IdealGeometryRecord>().get(hTT);
57 
58  // Lorant angle for offsets
59  ESHandle<SiPixelLorentzAngle> lorentzAngle;
60  if(useLAAlignmentOffsets_) // LA offsets from alignment
61  iRecord.getRecord<SiPixelLorentzAngleRcd>().get("fromAlignment",lorentzAngle );
62  else // standard LA, from calibration, label=""
63  iRecord.getRecord<SiPixelLorentzAngleRcd>().get(lorentzAngle );
64 
65  // add the new la width object
66  ESHandle<SiPixelLorentzAngle> lorentzAngleWidth;
67  const SiPixelLorentzAngle * lorentzAngleWidthProduct = 0;
68  if(useLAWidthFromDB_) { // use the width LA
69  iRecord.getRecord<SiPixelLorentzAngleRcd>().get("forWidth",lorentzAngleWidth );
70  lorentzAngleWidthProduct = lorentzAngleWidth.product();
71  } else { lorentzAngleWidthProduct = NULL;} // do not use it
72  //std::cout<<" la width "<<lorentzAngleWidthProduct<<std::endl; //dk
73 
74  const SiPixelGenErrorDBObject * genErrorDBObjectProduct = 0;
75 
76 #ifdef NEW_CPEERROR
77  // Errors take only from new GenError
78  ESHandle<SiPixelGenErrorDBObject> genErrorDBObject;
79  iRecord.getRecord<SiPixelGenErrorDBObjectRcd>().get(genErrorDBObject); //needs new TKPixelCPERecord.h
80  genErrorDBObjectProduct = genErrorDBObject.product();
81 
82  cpe_ = boost::shared_ptr<PixelClusterParameterEstimator>(new PixelCPEGeneric(
83  pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngle.product(),genErrorDBObjectProduct,
84  lorentzAngleWidthProduct) );
85 
86 #else
87  // Errors can be used from tempaltes or from GenError, for testing only
88  const bool useNewSimplerErrors = false;
89  if(useNewSimplerErrors) { // new genError object
90  ESHandle<SiPixelGenErrorDBObject> genErrorDBObject;
91  iRecord.getRecord<SiPixelGenErrorDBObjectRcd>().get(genErrorDBObject); //needs new TKPixelCPERecord.h
92  genErrorDBObjectProduct = genErrorDBObject.product();
93  }
94 
95  // errors come from templates
96  ESHandle<SiPixelTemplateDBObject> templateDBobject;
97  iRecord.getRecord<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject);
98 
99  cpe_ = boost::shared_ptr<PixelClusterParameterEstimator>(new PixelCPEGeneric(
100  pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngle.product(),genErrorDBObjectProduct,
101  templateDBobject.product(),lorentzAngleWidthProduct) );
102 #endif
103 
104  return cpe_;
105 }
106 
107 
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
tuple magfield
Definition: HLT_ES_cff.py:2311
#define NULL
Definition: scimark2.h:8
void get(HolderT &iHolder) const
T const * product() const
Definition: ESHandle.h:86
boost::shared_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
PixelCPEGenericESProducer(const edm::ParameterSet &p)