From 1be9a153a54aea07928ae4f064241588e0146193 Mon Sep 17 00:00:00 2001 From: Oz Date: Wed, 21 Apr 2021 17:38:48 +0200 Subject: [PATCH 1/6] Change pixel CPE template reco's to use LA value from DB in case of template reco failures. Also cleanup naming of some pixel CPE configuration parameters --- .../SiPixelRecHits/interface/PixelCPEBase.h | 4 +- .../PixelCPEClusterRepairESProducer.cc | 24 +++++--- .../plugins/PixelCPEFastESProducer.cc | 2 - .../plugins/PixelCPEGenericESProducer.cc | 6 +- .../plugins/PixelCPETemplateRecoESProducer.cc | 21 ++++--- .../SiPixelRecHits/src/PixelCPEBase.cc | 8 ++- .../src/PixelCPEClusterRepair.cc | 59 ++++++++++--------- .../src/PixelCPETemplateReco.cc | 56 ++++++++---------- 8 files changed, 92 insertions(+), 88 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h index 05e59585ba6ba..e1283aa69a0b8 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h @@ -238,7 +238,9 @@ class PixelCPEBase : public PixelClusterParameterEstimator { const SiPixelTemplateDBObject* templateDBobject_; bool alpha2Order; // switch on/off E.B effect. - bool DoLorentz_; + bool useLAFromDB_; //Use LA value from the database (used for generic CPE or in template CPE if an error) + + bool doLorentzFromAlignment_; bool LoadTemplatesFromDB_; //errors for template reco for edge hits, based on observed residuals from diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc index 0796fe183e1dc..f584acd652440 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc @@ -34,7 +34,8 @@ class PixelCPEClusterRepairESProducer : public edm::ESProducer { edm::ESGetToken templateDBobject2DToken_; edm::ParameterSet pset_; - bool DoLorentz_; + bool doLorentzFromAlignment_; + bool useLAFromDB_; }; using namespace edm; @@ -42,8 +43,8 @@ using namespace edm; PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::ParameterSet& p) { std::string myname = p.getParameter("ComponentName"); - //DoLorentz_ = p.getParameter("DoLorentz"); // True when LA from alignment is used - DoLorentz_ = p.getParameter("DoLorentz"); + useLAFromDB_ = p.getParameter("useLAFromDB"); + doLorentzFromAlignment_ = p.getParameter("doLorentzFromAlignment"); pset_ = p; auto c = setWhatProduced(this, myname); @@ -52,11 +53,15 @@ PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::Para hTTToken_ = c.consumes(); templateDBobjectToken_ = c.consumes(); templateDBobject2DToken_ = c.consumes(); - if (DoLorentz_) { + + char const* laLabel = ""; // standard LA, from calibration, label="" + lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel)); + + if (doLorentzFromAlignment_) { lorentzAngleToken_ = c.consumes(edm::ESInputTag("", "fromAlignment")); - } - //std::cout<<" from ES Producer Templates "< PixelCPEClusterRepairESProducer::produce( const TkPixelCPERecord& iRecord) { - // Normal, default LA actually is NOT needed - // null is ok becuse LA is not use by templates in this mode + // Normal, default LA is used in case of template failure, load it unless + // turned off + // if turned off, null is ok, becomes zero const SiPixelLorentzAngle* lorentzAngleProduct = nullptr; - if (DoLorentz_) { // LA correction from alignment + if (useLAFromDB_ || doLorentzFromAlignment_) { lorentzAngleProduct = &iRecord.get(lorentzAngleToken_); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc index 332baabe8842a..8cccb017f6887 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc @@ -89,8 +89,6 @@ void PixelCPEFastESProducer::fillDescriptions(edm::ConfigurationDescriptions& de // specific to PixelCPEFastESProducer desc.add("ComponentName", "PixelCPEFast"); desc.add("MagneticFieldRecord", edm::ESInputTag()); - desc.add("useLAAlignmentOffsets", false); - desc.add("DoLorentz", false); descriptions.add("PixelCPEFastESProducer", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index 66aa5884de014..4e0eed0872257 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -45,9 +45,9 @@ PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet& p) // Use LA-width from DB. If both (upper and this) are false LA-width is calcuated from LA-offset useLAWidthFromDB_ = p.getParameter("useLAWidthFromDB"); // Use Alignment LA-offset - const bool useLAAlignmentOffsets = p.getParameter("useLAAlignmentOffsets"); + const bool doLorentzFromAlignment = p.getParameter("doLorentzFromAlignment"); char const* laLabel = ""; // standard LA, from calibration, label="" - if (useLAAlignmentOffsets) { + if (doLorentzFromAlignment) { laLabel = "fromAlignment"; } @@ -108,8 +108,6 @@ void PixelCPEGenericESProducer::fillDescriptions(edm::ConfigurationDescriptions& // specific to PixelCPEGenericESProducer desc.add("ComponentName", "PixelCPEGeneric"); desc.add("MagneticFieldRecord", edm::ESInputTag("")); - desc.add("useLAAlignmentOffsets", false); - desc.add("DoLorentz", false); descriptions.add("_generic_default", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc index 7baf430c3af04..a7989dd0ff26e 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc @@ -30,7 +30,8 @@ class PixelCPETemplateRecoESProducer : public edm::ESProducer { edm::ESGetToken templateDBobjectToken_; edm::ParameterSet pset_; - bool DoLorentz_; + bool doLorentzFromAlignment_; + bool useLAFromDB_; }; using namespace edm; @@ -38,8 +39,8 @@ using namespace edm; PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::ParameterSet& p) { std::string myname = p.getParameter("ComponentName"); - //DoLorentz_ = p.getParameter("DoLorentz"); // True when LA from alignment is used - DoLorentz_ = p.getParameter("DoLorentz"); + useLAFromDB_ = p.getParameter("useLAFromDB"); + doLorentzFromAlignment_ = p.getParameter("doLorentzFromAlignment"); pset_ = p; auto c = setWhatProduced(this, myname); @@ -47,7 +48,11 @@ PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::Parame pDDToken_ = c.consumes(); hTTToken_ = c.consumes(); templateDBobjectToken_ = c.consumes(); - if (DoLorentz_) { + + char const* laLabel = ""; // standard LA, from calibration, label="" + lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel)); + + if (doLorentzFromAlignment_) { lorentzAngleToken_ = c.consumes(edm::ESInputTag("", "fromAlignment")); } //std::cout<<" from ES Producer Templates "< PixelCPETemplateRecoESProducer::produce( const TkPixelCPERecord& iRecord) { - // Normal, deafult LA actually is NOT needed - // null is ok becuse LA is not use by templates in this mode + // Normal, default LA is used in case of template failure, load it unless + // turned off + // if turned off, null is ok, becomes zero const SiPixelLorentzAngle* lorentzAngleProduct = nullptr; - if (DoLorentz_) { // LA correction from alignment + if (useLAFromDB_ || doLorentzFromAlignment_) { lorentzAngleProduct = &iRecord.get(lorentzAngleToken_); } @@ -81,7 +87,6 @@ void PixelCPETemplateRecoESProducer::fillDescriptions(edm::ConfigurationDescript // specific to PixelCPETemplateRecoESProducer desc.add("ComponentName", "PixelCPETemplateReco"); - desc.add("DoLorentz", true); descriptions.add("_templates_default", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc index 90f29daa31e95..818ed66cdc2e4 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc @@ -106,7 +106,8 @@ PixelCPEBase::PixelCPEBase(edm::ParameterSet const& conf, // For Templates only // Compute the Lorentz shifts for this detector element for templates (from Alignment) - DoLorentz_ = conf.getParameter("DoLorentz"); + doLorentzFromAlignment_ = conf.getParameter("doLorentzFromAlignment"); + useLAFromDB_ = conf.getParameter("useLAFromDB"); LogDebug("PixelCPEBase") << " LA constants - " << lAOffset_ << " " << lAWidthBPix_ << " " << lAWidthFPix_ << endl; //dk @@ -194,7 +195,8 @@ void PixelCPEBase::fillDetParams() { p.bx = Bfield.x(); //--- Compute the Lorentz shifts for this detector element - if ((theFlag_ == 0) || DoLorentz_) { // do always for generic and if(DOLorentz) for templates + if ((theFlag_ == 0) || useLAFromDB_ || + doLorentzFromAlignment_) { // do always for generic and if(DOLorentz) for templates p.driftDirection = driftDirection(p, Bfield); computeLorentzShifts(p); } @@ -470,4 +472,6 @@ void PixelCPEBase::fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add("lAOffset", 0.0); desc.add("lAWidthBPix", 0.0); desc.add("lAWidthFPix", 0.0); + desc.add("doLorentzFromAlignment", false); + desc.add("useLAFromDB", true); } diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc index 51b75525c7218..c443f4e50fd35 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -324,6 +324,11 @@ void PixelCPEClusterRepair::callTempReco1D(DetParam const& theDetParam, // We have a boolean denoting whether the reco failed or not theClusterParam.hasFilledProb_ = false; + // In case of template reco failure, these are the lorentz drift corrections + // to be applied + float lorentzshiftX = 0.5f * theDetParam.lorentzShiftInCmX; + float lorentzshiftY = 0.5f * theDetParam.lorentzShiftInCmY; + // ****************************************************************** //--- Call normal TemplateReco // @@ -363,30 +368,24 @@ void PixelCPEClusterRepair::callTempReco1D(DetParam const& theDetParam, theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; theClusterParam.qBin_ = 0; + // + // Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift + // Future improvement would be to call generic reco instead - // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - // To do: call PixelCPEGeneric whenever PixelTempReco1D fails - float lorentz_drift = -999.9; - if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) - lorentz_drift = 60.0f; // in microns - else - lorentz_drift = 10.0f; // in microns - // GG: trk angles needed to correct for bows/kinks if (theClusterParam.with_track_angle) { theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } else { edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" << "Should never be here. PixelCPEClusterRepair should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); + theClusterParam.templXrec_ = + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; + theClusterParam.templYrec_ = + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } } else { //--- Template Reco succeeded. The probabilities are filled. @@ -423,6 +422,11 @@ void PixelCPEClusterRepair::callTempReco2D(DetParam const& theDetParam, // We have a boolean denoting whether the reco failed or not theClusterParam.hasFilledProb_ = false; + // In case of template reco failure, these are the lorentz drift corrections + // to be applied + float lorentzshiftX = 0.5f * theDetParam.lorentzShiftInCmX; + float lorentzshiftY = 0.5f * theDetParam.lorentzShiftInCmY; + // ****************************************************************** //--- Call 2D TemplateReco // @@ -482,29 +486,26 @@ void PixelCPEClusterRepair::callTempReco2D(DetParam const& theDetParam, theClusterParam.probabilityX_ = theClusterParam.probabilityY_ = theClusterParam.probabilityQ_ = 0.f; theClusterParam.qBin_ = 0; - // GG: what do we do in this case? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - float lorentz_drift = -999.9; - if (!GeomDetEnumerators::isEndcap(theDetParam.thePart)) - lorentz_drift = 60.0f; // in microns // &&& replace with a constant (globally) - else - lorentz_drift = 10.0f; // in microns - // GG: trk angles needed to correct for bows/kinks + + // 2D Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift + // Future improvement would be to call generic reco instead + if (theClusterParam.with_track_angle) { theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } else { edm::LogError("PixelCPEClusterRepair") << "@SUB = PixelCPEClusterRepair::localPosition" << "Should never be here. PixelCPEClusterRepair should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); + theClusterParam.templXrec_ = + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; + theClusterParam.templYrec_ = + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } + } else { //--- Template Reco succeeded. theClusterParam.hasFilledProb_ = true; diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc index 9d90a41e606ad..0caf4e0fa17db 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc @@ -151,6 +151,13 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus // Store these offsets (to be added later) in a LocalPoint after tranforming // them from measurement units (pixel units) to local coordinates (cm) + // + // + + // In case of template reco failure, these are the lorentz drift corrections + // to be applied + float lorentzshiftX = 0.5f * theDetParam.lorentzShiftInCmX; + float lorentzshiftY = 0.5f * theDetParam.lorentzShiftInCmY; // ggiurgiu@jhu.edu 12/09/2010 : update call with trk angles needed for bow/kink corrections LocalPoint lp; @@ -255,29 +262,22 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus LogDebug("PixelCPETemplateReco::localPosition") << "reconstruction failed with error " << theClusterParam.ierr << "\n"; - // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - // To do: call PixelCPEGeneric whenever PixelTempReco1D fails - float lorentz_drift = -999.9; - if (!fpix) - lorentz_drift = 60.0f; // in microns - else - lorentz_drift = 10.0f; // in microns + // Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift + // Future improvement would be to call generic reco instead + // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks if (theClusterParam.with_track_angle) { theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } else { edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition" << "Should never be here. PixelCPETemplateReco should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX; + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY; } } else if UNLIKELY (UseClusterSplitter_ && theClusterParam.templQbin_ == 0) { edm::LogError("PixelCPETemplateReco") << " PixelCPETemplateReco: Qbin = 0 but using cluster splitter, we should " @@ -315,33 +315,23 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus */ if (theClusterParam.ierr != 0) { - LogDebug("PixelCPETemplateReco::localPosition") - << "reconstruction failed with error " << theClusterParam.ierr << "\n"; - - // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns - // In the x case, apply a rough Lorentz drift average correction - // To do: call PixelCPEGeneric whenever PixelTempReco1D fails - float lorentz_drift = -999.9f; - if (!fpix) - lorentz_drift = 60.0f; // in microns - else - lorentz_drift = 10.0f; // in microns + // Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift + // Future improvement would be to call generic reco instead // ggiurgiu@jhu.edu, 12/09/2010 : trk angles needed to correct for bows/kinks if (theClusterParam.with_track_angle) { theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) - - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred); + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } else { edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition" << "Should never be here. PixelCPETemplateReco should always be called " "with track angles. This is a bad error !!! "; - - theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) - - lorentz_drift * micronsToCm; // very rough Lorentz drift correction - theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()); + theClusterParam.templXrec_ = + theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; + theClusterParam.templYrec_ = + theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; } } else { // go from micrometer to centimeter @@ -377,7 +367,7 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus theClusterParam.templYrec_ += lp.y(); // Compute the Alignment Group Corrections [template ID should already be selected from call to reco procedure] - if (DoLorentz_) { + if (doLorentzFromAlignment_) { // Do only if the lotentzshift has meaningfull numbers if (theDetParam.lorentzShiftInCmX != 0.0 || theDetParam.lorentzShiftInCmY != 0.0) { // the LA width/shift returned by templates use (+) From 4d3f8c30f58fefdaf7ee144c75f9b581ae8e231b Mon Sep 17 00:00:00 2001 From: Oz Date: Wed, 21 Apr 2021 22:40:50 +0200 Subject: [PATCH 2/6] Update HLT configs to match new pixel CPE parameters --- .../Configuration/python/customizeHLTforCMSSW.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index d2ae065a20beb..3a52e481801fc 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,11 +129,26 @@ def customiseFor2018Input(process): return process +def customiseForPixelCPE(process): + """Customize HLT menu to remove deprecated parameters for pixel Generic and Template CPE's """ + for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"): + if hasattr(producer, "DoLorentz"): + del producer.DoLorentz + if hasattr(producer, "useLAAlignmentOffsets"): + del producer.useLAAlignmentOffsets + + for producer in esproducers_by_type(process, "PixelCPETemplateRecoESProducer"): + if hasattr(producer, "DoLorentz"): + del producer.DoLorentz + return process + + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) + process = customiseForPixelCPE(process) return process From 1d541ae6d3da77c6cf54fb48c4447e1393471fd3 Mon Sep 17 00:00:00 2001 From: Oz Date: Thu, 22 Apr 2021 17:11:00 +0200 Subject: [PATCH 3/6] Update HLT customisation function name to refer to PR number --- HLTrigger/Configuration/python/customizeHLTforCMSSW.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 3a52e481801fc..496c05cd357b4 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,7 +129,7 @@ def customiseFor2018Input(process): return process -def customiseForPixelCPE(process): +def customiseFor33495(process): """Customize HLT menu to remove deprecated parameters for pixel Generic and Template CPE's """ for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"): if hasattr(producer, "DoLorentz"): @@ -149,6 +149,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseForPixelCPE(process) + process = customiseFor33495(process) return process From 299935135eb28513d624ee29e40460cb7b99fc96 Mon Sep 17 00:00:00 2001 From: Oz Date: Mon, 26 Apr 2021 18:11:32 +0200 Subject: [PATCH 4/6] Cleanup CPE ES producers and don't use loc_trk_pred when template reco's fail without track angles --- .../plugins/PixelCPEClusterRepairESProducer.cc | 12 +++--------- .../plugins/PixelCPEGenericESProducer.cc | 3 --- .../plugins/PixelCPETemplateRecoESProducer.cc | 10 +++------- RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc | 2 +- .../SiPixelRecHits/src/PixelCPEClusterRepair.cc | 12 ++++-------- .../SiPixelRecHits/src/PixelCPETemplateReco.cc | 6 ++---- 6 files changed, 13 insertions(+), 32 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc index f584acd652440..1c97241056c31 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc @@ -53,14 +53,9 @@ PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::Para hTTToken_ = c.consumes(); templateDBobjectToken_ = c.consumes(); templateDBobject2DToken_ = c.consumes(); - - char const* laLabel = ""; // standard LA, from calibration, label="" - lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel)); - - if (doLorentzFromAlignment_) { - lorentzAngleToken_ = c.consumes(edm::ESInputTag("", "fromAlignment")); - - //std::cout<<" from ES Producer Templates "<("DoLorentz", true); descriptions.add("_templates2_default", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index 4e0eed0872257..c340730977634 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -66,9 +66,6 @@ PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet& p) if (UseErrorsFromTemplates_) { genErrorDBObjectToken_ = c.consumes(); } - - //std::cout<<" ESProducer "< PixelCPEGenericESProducer::produce(const TkPixelCPERecord& iRecord) { diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc index a7989dd0ff26e..696d3700f96f7 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc @@ -48,14 +48,10 @@ PixelCPETemplateRecoESProducer::PixelCPETemplateRecoESProducer(const edm::Parame pDDToken_ = c.consumes(); hTTToken_ = c.consumes(); templateDBobjectToken_ = c.consumes(); - - char const* laLabel = ""; // standard LA, from calibration, label="" - lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel)); - - if (doLorentzFromAlignment_) { - lorentzAngleToken_ = c.consumes(edm::ESInputTag("", "fromAlignment")); + if (useLAFromDB_ || doLorentzFromAlignment_) { + char const* laLabel = doLorentzFromAlignment_ ? "fromAlignment" : ""; + lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel)); } - //std::cout<<" from ES Producer Templates "< PixelCPETemplateRecoESProducer::produce( diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc index 818ed66cdc2e4..812839a7a4f72 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc @@ -196,7 +196,7 @@ void PixelCPEBase::fillDetParams() { //--- Compute the Lorentz shifts for this detector element if ((theFlag_ == 0) || useLAFromDB_ || - doLorentzFromAlignment_) { // do always for generic and if(DOLorentz) for templates + doLorentzFromAlignment_) { // do always for generic and if using LA from DB or alignment for templates p.driftDirection = driftDirection(p, Bfield); computeLorentzShifts(p); } diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc index c443f4e50fd35..ac84748b74be1 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc @@ -382,10 +382,8 @@ void PixelCPEClusterRepair::callTempReco1D(DetParam const& theDetParam, << "Should never be here. PixelCPEClusterRepair should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; - theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX; + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY; } } else { //--- Template Reco succeeded. The probabilities are filled. @@ -500,10 +498,8 @@ void PixelCPEClusterRepair::callTempReco2D(DetParam const& theDetParam, << "Should never be here. PixelCPEClusterRepair should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; - theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX; + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY; } } else { diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc index 0caf4e0fa17db..48752c6e12757 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc @@ -328,10 +328,8 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition" << "Should never be here. PixelCPETemplateReco should always be called " "with track angles. This is a bad error !!! "; - theClusterParam.templXrec_ = - theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX; - theClusterParam.templYrec_ = - theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY; + theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX; + theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY; } } else { // go from micrometer to centimeter From 4b14c61b3d14300af3aeb2f372d7817a8cae006e Mon Sep 17 00:00:00 2001 From: Oz Amram Date: Tue, 20 Apr 2021 17:07:10 -0500 Subject: [PATCH 5/6] Update template and gen errors for geometries with 3D pixels --- Configuration/AlCa/python/autoCondPhase2.py | 10 ++++++---- .../python/upgradeWorkflowComponents.py | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Configuration/AlCa/python/autoCondPhase2.py b/Configuration/AlCa/python/autoCondPhase2.py index 6106d6e7c0ada..cae53c3a1acc0 100644 --- a/Configuration/AlCa/python/autoCondPhase2.py +++ b/Configuration/AlCa/python/autoCondPhase2.py @@ -65,16 +65,18 @@ 'T15' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v6.1.5_25x100_v3_mc',SiPixelGenErrorRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V 'T21' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v6.1.5_25x100_v3_mc',SiPixelGenErrorRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V 'T22' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v6.1.5_50x50_v5_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 50um (local-x) x 50um (local-y) , VBias=350V - 'T25' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v7.0.2_25x100_v1_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-03-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1 - 'T26' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v7.0.3_mixed_v1_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-03-17 20:00:00"] ), ), # TBPX cells are 25um (local-x) x 100um (local-y), TFPX TEPX 50 um x 50 um , VBias=350V, 3D pixels in TBPX L1 + 'T23' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v7.0.0_25x100_v2_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1+L2 and TFPX R1 + 'T25' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v7.0.2_25x100_v2_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1 + 'T26' : ( ','.join( [ 'SiPixelGenErrorDBObject_phase2_IT_v7.0.3_mixed_v2_mc' ,SiPixelGenErrorRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # TBPX cells are 25um (local-x) x 100um (local-y), TFPX TEPX 50 um x 50 um , VBias=350V, 3D pixels in TBPX L1 } allTags["Template"] = { 'T15' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v6.1.5_25x100_v3_mc',SiPixelTemplatesRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V 'T21' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v6.1.5_25x100_v3_mc',SiPixelTemplatesRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V 'T22' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v6.1.5_50x50_v5_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-01-27 10:00:00"] ), ), # cell is 50um (local-x) x 50um (local-y) , VBias=350V - 'T25' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v7.0.2_25x100_v1_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-03-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1 - 'T26' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v7.0.3_mixed_v1_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-03-17 20:00:00"] ), ), # TBPX cells are 25um (local-x) x 100um (local-y), TFPX TEPX 50 um x 50 um , VBias=350V, 3D pixels in TBPX L1 + 'T23' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v7.0.0_25x100_v2_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1+L2 and TFPX R1 + 'T25' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v7.0.2_25x100_v2_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # cell is 25um (local-x) x 100um (local-y) , VBias=350V, 3D pixels in TBPX L1 + 'T26' : ( ','.join( [ 'SiPixelTemplateDBObject_phase2_IT_v7.0.3_mixed_v2_mc' ,SiPixelTemplatesRecord,connectionString, "", "2021-04-17 20:00:00"] ), ), # TBPX cells are 25um (local-x) x 100um (local-y), TFPX TEPX 50 um x 50 um , VBias=350V, 3D pixels in TBPX L1 } ## diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8cb2536190963..c4c6d0005c799 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1148,7 +1148,6 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Geom' : 'Extended2026D79', # N.B.: Geometry with 3D pixels in the Inner Tracker. 'HLTmenu': '@fake2', 'GT' : 'auto:phase2_realistic_T23', - 'ProcessModifier': 'PixelCPEGeneric', # This swaps template reco CPE for generic reco CPE 'Era' : 'Phase2C11I13T23M9', # customizes for 3D Pixels and Muon M9 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], }, From 64ab2c307e4be193ada9aa6eb5b51252fd2893da Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 20 May 2021 12:50:37 +0200 Subject: [PATCH 6/6] revert changes breaking online HLT menu in production release --- .../Configuration/python/customizeHLTforCMSSW.py | 15 --------------- .../plugins/PixelCPEFastESProducer.cc | 2 ++ .../plugins/PixelCPEGenericESProducer.cc | 2 ++ .../plugins/PixelCPETemplateRecoESProducer.cc | 1 + 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 496c05cd357b4..d2ae065a20beb 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,26 +129,11 @@ def customiseFor2018Input(process): return process -def customiseFor33495(process): - """Customize HLT menu to remove deprecated parameters for pixel Generic and Template CPE's """ - for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - if hasattr(producer, "useLAAlignmentOffsets"): - del producer.useLAAlignmentOffsets - - for producer in esproducers_by_type(process, "PixelCPETemplateRecoESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - return process - - # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseFor33495(process) return process diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc index 8cccb017f6887..3e12226ba065b 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc @@ -89,6 +89,8 @@ void PixelCPEFastESProducer::fillDescriptions(edm::ConfigurationDescriptions& de // specific to PixelCPEFastESProducer desc.add("ComponentName", "PixelCPEFast"); desc.add("MagneticFieldRecord", edm::ESInputTag()); + desc.addOptional("useLAAlignmentOffsets", false)->setComment("deprecated"); + desc.addOptional("DoLorentz", false)->setComment("deprecated"); descriptions.add("PixelCPEFastESProducer", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index c340730977634..d0d92f1baef3f 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -105,6 +105,8 @@ void PixelCPEGenericESProducer::fillDescriptions(edm::ConfigurationDescriptions& // specific to PixelCPEGenericESProducer desc.add("ComponentName", "PixelCPEGeneric"); desc.add("MagneticFieldRecord", edm::ESInputTag("")); + desc.addOptional("useLAAlignmentOffsets", false)->setComment("deprecated"); + desc.addOptional("DoLorentz", false)->setComment("deprecated"); descriptions.add("_generic_default", desc); } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc index 696d3700f96f7..e464009338f6f 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPETemplateRecoESProducer.cc @@ -83,6 +83,7 @@ void PixelCPETemplateRecoESProducer::fillDescriptions(edm::ConfigurationDescript // specific to PixelCPETemplateRecoESProducer desc.add("ComponentName", "PixelCPETemplateReco"); + desc.addOptional("DoLorentz", true)->setComment("deprecated"); descriptions.add("_templates_default", desc); }