Skip to content

Commit 9e18673

Browse files
committed
Lorentz angle by module
1 parent 3be1d3a commit 9e18673

File tree

3 files changed

+326
-71
lines changed

3 files changed

+326
-71
lines changed

CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleDB.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ class SiPixelLorentzAngleDB : public edm::EDAnalyzer
3939

4040
private:
4141

42+
unsigned int HVgroup(unsigned int panel, unsigned int module);
43+
4244
std::vector< std::pair<uint32_t, float> > detid_la;
4345
edm::ParameterSet conf_;
4446
double magneticField_;
4547
std::string recordName_;
46-
float bPixLorentzAnglePerTesla_;
47-
float fPixLorentzAnglePerTesla_;
48+
// float bPixLorentzAnglePerTesla_;
49+
// float fPixLorentzAnglePerTesla_;
50+
//hp
51+
typedef std::vector< edm::ParameterSet > Parameters;
52+
Parameters BPixParameters_;
53+
Parameters FPixParameters_;
54+
4855
std::string fileName_;
4956
bool useFile_;
5057
};

CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngleDB.cc

+80-21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <fstream>
55
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
66
#include "CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleDB.h"
7+
#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
8+
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
79
#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h"
810
#include "FWCore/Framework/interface/ESHandle.h"
911
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
@@ -25,11 +27,13 @@ SiPixelLorentzAngleDB::SiPixelLorentzAngleDB(edm::ParameterSet const& conf) :
2527
conf_(conf){
2628
magneticField_ = conf_.getParameter<double>("magneticField");
2729
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");
3032
useFile_ = conf_.getParameter<bool>("useFile");
3133
fileName_ = conf_.getParameter<string>("fileName");
3234

35+
BPixParameters_ = conf_.getUntrackedParameter<Parameters>("BPixParameters");
36+
FPixParameters_ = conf_.getUntrackedParameter<Parameters>("FPixParameters");
3337
}
3438

3539
//BeginJob
@@ -57,30 +61,60 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup&
5761

5862
for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
5963

60-
if( dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
61-
DetId detid=(*it)->geographicalId();
64+
if( dynamic_cast<PixelGeomDetUnit*>((*it))!=0){
65+
DetId detid=(*it)->geographicalId();
6266

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)) {
7269

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+
}
7392

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)) {
7695

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;
83115
}
116+
117+
}
84118

85119
}
86120

@@ -112,7 +146,32 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup&
112146

113147
}
114148

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+
115172
void SiPixelLorentzAngleDB::endJob(){
116173

117174

118175
}
176+
177+

0 commit comments

Comments
 (0)