4
4
#include < fstream>
5
5
#include " CondCore/DBOutputService/interface/PoolDBOutputService.h"
6
6
#include " CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleDB.h"
7
+ #include " DataFormats/SiPixelDetId/interface/PXBDetId.h"
8
+ #include " DataFormats/SiPixelDetId/interface/PXFDetId.h"
7
9
#include " CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h"
8
10
#include " FWCore/Framework/interface/ESHandle.h"
9
11
#include " Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
@@ -25,11 +27,13 @@ SiPixelLorentzAngleDB::SiPixelLorentzAngleDB(edm::ParameterSet const& conf) :
25
27
conf_(conf){
26
28
magneticField_ = conf_.getParameter <double >(" magneticField" );
27
29
recordName_ = conf_.getUntrackedParameter <std::string>(" record" ," SiPixelLorentzAngleRcd" );
28
- bPixLorentzAnglePerTesla_ = (float )conf_.getParameter <double >(" bPixLorentzAnglePerTesla" );
29
- fPixLorentzAnglePerTesla_ = (float )conf_.getParameter <double >(" fPixLorentzAnglePerTesla" );
30
+ // bPixLorentzAnglePerTesla_ = (float)conf_.getParameter<double>("bPixLorentzAnglePerTesla");
31
+ // fPixLorentzAnglePerTesla_ = (float)conf_.getParameter<double>("fPixLorentzAnglePerTesla");
30
32
useFile_ = conf_.getParameter <bool >(" useFile" );
31
33
fileName_ = conf_.getParameter <string>(" fileName" );
32
34
35
+ BPixParameters_ = conf_.getUntrackedParameter <Parameters>(" BPixParameters" );
36
+ FPixParameters_ = conf_.getUntrackedParameter <Parameters>(" FPixParameters" );
33
37
}
34
38
35
39
// BeginJob
@@ -57,30 +61,60 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup&
57
61
58
62
for (TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits ().begin (); it != pDD->detUnits ().end (); it++){
59
63
60
- if ( dynamic_cast <PixelGeomDetUnit*>((*it))!=0 ){
61
- DetId detid=(*it)->geographicalId ();
64
+ if ( dynamic_cast <PixelGeomDetUnit*>((*it))!=0 ){
65
+ DetId detid=(*it)->geographicalId ();
62
66
63
- // fill bpix values for LA
64
- if (detid.subdetId () == static_cast <int >(PixelSubdetector::PixelBarrel)) {
65
-
66
- if (!useFile_){
67
- if ( ! LorentzAngle->putLorentzAngle (detid.rawId (),bPixLorentzAnglePerTesla_) )
68
- edm::LogError (" SiPixelLorentzAngleDB" )<<" [SiPixelLorentzAngleDB::analyze] detid already exists" <<std::endl;
69
- } else {
70
- cout << " method for reading file not implemented yet" << endl;
71
- }
67
+ // fill bpix values for LA
68
+ if (detid.subdetId () == static_cast <int >(PixelSubdetector::PixelBarrel)) {
72
69
70
+ PXBDetId pxdetid = PXBDetId (detid);
71
+ cout << " hp:barrel:" << " layer=" << pxdetid.layer () << " ladder=" << pxdetid.ladder () << " module=" << pxdetid.module () << endl;
72
+
73
+ if (!useFile_){
74
+ /* hp
75
+ if ( ! LorentzAngle->putLorentzAngle(detid.rawId(),bPixLorentzAnglePerTesla_) )
76
+ edm::LogError("SiPixelLorentzAngleDB")<<"[SiPixelLorentzAngleDB::analyze] detid already exists"<<std::endl;
77
+ */
78
+ // hp
79
+ for (Parameters::iterator it = BPixParameters_.begin (); it != BPixParameters_.end (); ++it) {
80
+ // cout << " PSet: " << *it << ", module = " << it->getParameter<unsigned int>("module") << endl;
81
+ if ( it->getParameter <unsigned int >(" module" ) == pxdetid.module () && it->getParameter <unsigned int >(" layer" ) == pxdetid.layer () )
82
+ {
83
+ float lorentzangle = (float )it->getParameter <double >(" angle" );
84
+ LorentzAngle->putLorentzAngle (detid.rawId (),lorentzangle);
85
+ }
86
+ }
87
+
88
+ } else {
89
+ // cout << "method for reading file not implemented yet" << endl;
90
+ edm::LogError (" SiPixelLorentzAngleDB" )<<" [SiPixelLorentzAngleDB::analyze] method for reading file not implemented yet" << std::endl;
91
+ }
73
92
74
- // fill bpix values for LA
75
- } else if (detid.subdetId () == static_cast <int >(PixelSubdetector::PixelEndcap)) {
93
+ // fill fpix values for LA
94
+ } else if (detid.subdetId () == static_cast <int >(PixelSubdetector::PixelEndcap)) {
76
95
77
- if ( ! LorentzAngle->putLorentzAngle (detid.rawId (),fPixLorentzAnglePerTesla_ ) )
78
- edm::LogError (" SiPixelLorentzAngleDB" )<<" [SiPixelLorentzAngleDB::analyze] detid already exists" <<std::endl;
79
- } else {
80
- edm::LogError (" SiPixelLorentzAngleDB" )<<" [SiPixelLorentzAngleDB::analyze] detid is Pixel but neither bpix nor fpix" <<std::endl;
81
- }
82
-
96
+ // hp
97
+ PXFDetId pxdetid = PXFDetId (detid);
98
+ cout << " hp:endcap:" << " side=" << pxdetid.side () << " disk=" << pxdetid.disk () << " blade=" << pxdetid.blade () << " panel=" << pxdetid.panel () << " module=" << pxdetid.module () << endl;
99
+ /* hp
100
+ if ( ! LorentzAngle->putLorentzAngle(detid.rawId(),fPixLorentzAnglePerTesla_) ) edm::LogError("SiPixelLorentzAngleDB")<<"[SiPixelLorentzAngleDB::analyze] detid already exists"<<std::endl;
101
+ */
102
+
103
+ // hp
104
+ for (Parameters::iterator it = FPixParameters_.begin (); it != FPixParameters_.end (); ++it) {
105
+ // cout << " PSet: " << *it << ", module = " << it->getParameter<unsigned int>("module") << endl;
106
+ if ( it->getParameter <unsigned int >(" side" ) == pxdetid.side () && it->getParameter <unsigned int >(" disk" ) == pxdetid.disk () && it->getParameter <unsigned int >(" HVgroup" ) == HVgroup (pxdetid.panel (),pxdetid.module ()) )
107
+ {
108
+ float lorentzangle = (float )it->getParameter <double >(" angle" );
109
+ LorentzAngle->putLorentzAngle (detid.rawId (),lorentzangle);
110
+ }
111
+ }
112
+
113
+ } else {
114
+ edm::LogError (" SiPixelLorentzAngleDB" )<<" [SiPixelLorentzAngleDB::analyze] detid is Pixel but neither bpix nor fpix" <<std::endl;
83
115
}
116
+
117
+ }
84
118
85
119
}
86
120
@@ -112,7 +146,32 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup&
112
146
113
147
}
114
148
149
+
150
+ unsigned int SiPixelLorentzAngleDB::HVgroup (unsigned int panel, unsigned int module){
151
+
152
+ if ( 1 == panel && ( 1 == module || 2 == module )) {
153
+ return 1 ;
154
+ }
155
+ else if ( 1 == panel && ( 3 == module || 4 == module )) {
156
+ return 2 ;
157
+ }
158
+ else if ( 2 == panel && 1 == module ) {
159
+ return 1 ;
160
+ }
161
+ else if ( 2 == panel && ( 2 == module || 3 == module )) {
162
+ return 2 ;
163
+ }
164
+ else {
165
+ cout << " *** error *** in SiPixelLorentzAngleDB::HVgroup(...), panel = " << panel << " , module = " << module << endl;
166
+ return 0 ;
167
+ }
168
+
169
+ }
170
+
171
+
115
172
void SiPixelLorentzAngleDB::endJob (){
116
173
117
174
118
175
}
176
+
177
+
0 commit comments