Skip to content

Commit

Permalink
Merge pull request #35604 from tvami/ModernizeCPECode_v2
Browse files Browse the repository at this point in the history
Misc changes in SiPixel CPE object code in `CondTools/SiPixel`
  • Loading branch information
cmsbuild authored Oct 12, 2021
2 parents 2429e9e + 93e8741 commit 1adfdc9
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 124 deletions.
16 changes: 3 additions & 13 deletions CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const
//Barrel Pixels first
if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) {
edm::LogPrint("SiPixel2DTemplateDBObjectUploader") << "--- IN THE BARREL ---\n";

//Get the layer, ladder, and module corresponding to this detID
layer = tTopo->pxbLayer(detid.rawId());
ladder = tTopo->pxbLadder(detid.rawId());
Expand Down Expand Up @@ -200,17 +198,12 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const
if (thisID == 10000 || (!(*obj).putTemplateID(detid.rawId(), thisID)))
edm::LogPrint("SiPixel2DTemplateDBObjectUploader")
<< " Could not fill barrel layer " << layer << ", module " << module << "\n";
// ----- debug:
edm::LogPrint("SiPixel2DTemplateDBObjectUploader")
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module
<< ".\n"; //Uncomment to read out exact position of each element.
// -----
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module;
}
//Now endcaps
else if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) {
edm::LogPrint("SiPixel2DTemplateDBObjectUploader") << "--- IN AN ENDCAP ---\n";

//Get the DetId's disk, blade, side, panel, and module
disk = tTopo->pxfDisk(detid.rawId()); //1,2,3
blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56)
Expand Down Expand Up @@ -251,21 +244,18 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const
edm::LogPrint("SiPixel2DTemplateDBObjectUploader")
<< " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", and panel "
<< panel << ".\n";
// ----- debug:
edm::LogPrint("SiPixel2DTemplateDBObjectUploader")
<< "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade
<< ", and panel " << panel << ".\n"; //Uncomment to read out exact position of each element.
// -----
<< ", and panel " << panel;
} else {
continue;
}

//Print out the assignment of this detID
short mapnum;
edm::LogPrint("SiPixel2DTemplateDBObjectUploader") << "checking map:\n";
mapnum = (*obj).getTemplateID(detid.rawId());
edm::LogPrint("SiPixel2DTemplateDBObjectUploader")
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n";
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n";
}
}

Expand Down
18 changes: 4 additions & 14 deletions CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed
//Barrel Pixels first
if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) {
edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "--- IN THE BARREL ---\n";

//Get the layer, ladder, and module corresponding to this DetID
layer = tTopo->pxbLayer(detid.rawId());
ladder = tTopo->pxbLadder(detid.rawId());
Expand Down Expand Up @@ -215,17 +213,12 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed
if (thisID == 10000 || (!(*obj).putGenErrorID(detid.rawId(), thisID)))
edm::LogPrint("SiPixelGenErrorDBObjectUploader")
<< " Could not fill barrel layer " << layer << ", module " << module << "\n";
// ----- debug:
edm::LogPrint("SiPixelGenErrorDBObjectUploader")
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module
<< ".\n"; //Uncomment to read out exact position of each element.
// -----
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module;
}
//Now endcaps
else if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) {
edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "--- IN AN ENDCAP ---\n";

//Get the DetID's disk, blade, side, panel, and module
disk = tTopo->pxfDisk(detid.rawId()); //1,2,3
blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56)
Expand Down Expand Up @@ -265,20 +258,17 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed
edm::LogPrint("SiPixelGenErrorDBObjectUploader")
<< " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", panel "
<< panel << ".\n";
// ----- debug:
edm::LogPrint("SiPixelGenErrorDBObjectUploader")
<< "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade << ", panel "
<< panel << ".\n"; //Uncomment to read out exact position of each element.
edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "This is an endcap element with: side " << side << ", disk "
<< disk << ", blade " << blade << ", panel " << panel;
} else {
continue;
}

//Print out the assignment of this DetID
short mapnum;
edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "checking map:\n";
mapnum = (*obj).getGenErrorID(detid.rawId());
edm::LogPrint("SiPixelGenErrorDBObjectUploader")
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n";
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n";
}
}

Expand Down
18 changes: 4 additions & 14 deletions CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed
//Barrel Pixels first
if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) {
edm::LogPrint("SiPixelTemplateDBObjectUploader") << "--- IN THE BARREL ---\n";

//Get the layer, ladder, and module corresponding to this detID
layer = tTopo->pxbLayer(detid.rawId());
ladder = tTopo->pxbLadder(detid.rawId());
Expand Down Expand Up @@ -209,17 +207,12 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed
if (thisID == 10000 || (!obj.putTemplateID(detid.rawId(), thisID)))
edm::LogPrint("SiPixelTemplateDBObjectUploader")
<< " Could not fill barrel layer " << layer << ", module " << module << "\n";
// ----- debug:
edm::LogPrint("SiPixelTemplateDBObjectUploader")
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module
<< ".\n"; //Uncomment to read out exact position of each element.
// -----
<< "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module;
}
//Now endcaps
else if ((phase == 1 && detid.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) ||
(phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) {
edm::LogPrint("SiPixelTemplateDBObjectUploader") << "--- IN AN ENDCAP ---\n";

//Get the DetId's disk, blade, side, panel, and module
disk = tTopo->pxfDisk(detid.rawId()); //1,2,3
blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56)
Expand Down Expand Up @@ -259,20 +252,17 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed
edm::LogPrint("SiPixelTemplateDBObjectUploader")
<< " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", and panel "
<< panel << ".\n";
// ----- debug:
edm::LogPrint("SiPixelTemplateDBObjectUploader")
<< "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade
<< ", and panel " << panel << ".\n"; //Uncomment to read out exact position of each element.
edm::LogPrint("SiPixelTemplateDBObjectUploader") << "This is an endcap element with: side " << side << ", disk "
<< disk << ", blade " << blade << ", and panel " << panel;
} else {
continue;
}

//Print out the assignment of this detID
short mapnum;
edm::LogPrint("SiPixelTemplateDBObjectUploader") << "checking map:\n";
mapnum = obj.getTemplateID(detid.rawId());
edm::LogPrint("SiPixelTemplateDBObjectUploader")
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n";
<< "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
MagFieldString+=magfieldstrsplit[1]

#open the map file
mapfile = open(options.Map,'rU', newline='')
mapfile = open(options.Map,'r', newline='')
#read the csv file into a reader
mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar)
#separate into the different sections
Expand Down
Loading

0 comments on commit 1adfdc9

Please sign in to comment.