Skip to content

Commit

Permalink
cleanup CPE
Browse files Browse the repository at this point in the history
  • Loading branch information
ahinzmann committed May 13, 2016
1 parent 40be73e commit 166eeb9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 108 deletions.
13 changes: 0 additions & 13 deletions RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGeneric.h
Expand Up @@ -43,8 +43,6 @@
#include <utility>
#include <vector>

#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

#if 0
/** \class PixelCPEGeneric
* Perform the position and error evaluation of pixel hits using
Expand Down Expand Up @@ -82,15 +80,9 @@ class PixelCPEGeneric : public PixelCPEBase
float dx2 ; // CPE Generic x-bias for single double-pixel cluster
};

#ifdef NEW_CPEERROR
PixelCPEGeneric(edm::ParameterSet const& conf, const MagneticField *,
const TrackerGeometry&, const TrackerTopology&, const SiPixelLorentzAngle *,
const SiPixelGenErrorDBObject *, const SiPixelLorentzAngle *);
#else
PixelCPEGeneric(edm::ParameterSet const& conf, const MagneticField *, const TrackerGeometry&, const TrackerTopology&,
const SiPixelLorentzAngle *, const SiPixelGenErrorDBObject *,
const SiPixelTemplateDBObject *,const SiPixelLorentzAngle *);
#endif

~PixelCPEGeneric() {;}

Expand Down Expand Up @@ -165,11 +157,6 @@ class PixelCPEGeneric : public PixelCPEBase
std::vector< SiPixelGenErrorStore > thePixelGenError_;
//SiPixelCPEGenericDBErrorParametrization * genErrorsFromDB_;

#ifndef NEW_CPEERROR
// For old template errors
std::vector< SiPixelTemplateStore > thePixelTemp_;
#endif

};

#endif
Expand Down
Expand Up @@ -19,8 +19,6 @@
#include <string>
#include <memory>

#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

using namespace edm;

PixelCPEGenericESProducer::PixelCPEGenericESProducer(const edm::ParameterSet & p)
Expand Down Expand Up @@ -77,7 +75,6 @@ PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){

const SiPixelGenErrorDBObject * genErrorDBObjectProduct = 0;

#ifdef NEW_CPEERROR
// Errors take only from new GenError
ESHandle<SiPixelGenErrorDBObject> genErrorDBObject;
if(UseErrorsFromTemplates_) { // do only when generrors are needed
Expand All @@ -91,24 +88,6 @@ PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){
*hTT.product(),lorentzAngle.product(),
genErrorDBObjectProduct,lorentzAngleWidthProduct);

#else // old full templates, not used anymore
// Errors can be used from tempaltes or from GenError, for testing only
const bool useNewSimplerErrors = false;
if(useNewSimplerErrors) { // new genError object
ESHandle<SiPixelGenErrorDBObject> genErrorDBObject;
iRecord.getRecord<SiPixelGenErrorDBObjectRcd>().get(genErrorDBObject); //needs new TKPixelCPERecord.h
genErrorDBObjectProduct = genErrorDBObject.product();
}

// errors come from templates
ESHandle<SiPixelTemplateDBObject> templateDBobject;
iRecord.getRecord<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject);

cpe_ = std::make_shared<PixelCPEGeneric>(
pset_,magfield.product(),*pDD.product(),*hTT.product(),lorentzAngle.product(),genErrorDBObjectProduct,
templateDBobject.product(),lorentzAngleWidthProduct);
#endif

return cpe_;
}

Expand Down
20 changes: 0 additions & 20 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc
Expand Up @@ -25,15 +25,6 @@

using namespace std;

#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

namespace {
#ifndef NEW_CPEERROR
//const bool useNewSimplerErrors = true;
const bool useNewSimplerErrors = false; // must be tha same as in generic
#endif
}

//-----------------------------------------------------------------------------
// A constructor run for generic and templates
//
Expand Down Expand Up @@ -67,11 +58,7 @@ PixelCPEBase::PixelCPEBase(edm::ParameterSet const & conf,
//cout<<" new errors "<<genErrorDBObject<<" "<<genErrorDBObject_<<endl;

//-- Template Calibration Object from DB
#ifdef NEW_CPEERROR
if(theFlag_!=0) templateDBobject_ = templateDBobject; // flag to check if it is generic or templates
#else
templateDBobject_ = templateDBobject;
#endif

// Configurables
// For both templates & generic
Expand Down Expand Up @@ -186,15 +173,8 @@ void PixelCPEBase::fillDetParams()
// Cache the det id for templates and generic erros

if(theFlag_==0) { // for generic
#ifdef NEW_CPEERROR
if(LoadTemplatesFromDB_ ) // do only if genError requested
p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
#else
if(useNewSimplerErrors)
p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
else
p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId().rawId());
#endif
} else { // for templates
p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId());
}
Expand Down
54 changes: 0 additions & 54 deletions RecoLocalTracker/SiPixelRecHits/src/PixelCPEGeneric.cc
Expand Up @@ -17,8 +17,6 @@
#include <iostream>
using namespace std;

#define NEW_CPEERROR // must be constistent with base.cc, generic cc/h and genericProducer.cc

namespace {
constexpr float micronsToCm = 1.0e-4;
const bool MYDEBUG = false;
Expand All @@ -27,7 +25,6 @@ namespace {
//-----------------------------------------------------------------------------
//! The constructor.
//-----------------------------------------------------------------------------
#ifdef NEW_CPEERROR
PixelCPEGeneric::PixelCPEGeneric(edm::ParameterSet const & conf,
const MagneticField * mag,
const TrackerGeometry& geom,
Expand All @@ -36,17 +33,6 @@ PixelCPEGeneric::PixelCPEGeneric(edm::ParameterSet const & conf,
const SiPixelGenErrorDBObject * genErrorDBObject,
const SiPixelLorentzAngle * lorentzAngleWidth=0)
: PixelCPEBase(conf, mag, geom, ttopo, lorentzAngle, genErrorDBObject, 0,lorentzAngleWidth,0) {
#else
PixelCPEGeneric::PixelCPEGeneric(edm::ParameterSet const & conf,
const MagneticField * mag,
const TrackerGeometry& geom,
const TrackerTopology& ttopo,
const SiPixelLorentzAngle * lorentzAngle,
const SiPixelGenErrorDBObject * genErrorDBObject,
const SiPixelTemplateDBObject * templateDBobject,
const SiPixelLorentzAngle * lorentzAngleWidth=0)
: PixelCPEBase(conf, mag, geom, ttopo, lorentzAngle, genErrorDBObject, templateDBobject,lorentzAngleWidth,0) {
#endif

if (theVerboseLevel > 0)
LogDebug("PixelCPEGeneric")
Expand Down Expand Up @@ -95,8 +81,6 @@ PixelCPEGeneric::PixelCPEGeneric(edm::ParameterSet const & conf,
// Use errors from templates or from GenError
if ( UseErrorsFromTemplates_ ) {

#ifdef NEW_CPEERROR

if ( LoadTemplatesFromDB_ ) { // From DB
if ( !SiPixelGenError::pushfile( *genErrorDBObject_, thePixelGenError_) )
throw cms::Exception("InvalidCalibrationLoaded")
Expand All @@ -109,24 +93,6 @@ PixelCPEGeneric::PixelCPEGeneric(edm::ParameterSet const & conf,
<< "ERROR: GenErrors not loaded correctly from text file. Reconstruction will fail.";
} // if load from DB

#else

if ( LoadTemplatesFromDB_ ) {
// Initialize template store to the selected ID [Morris, 6/25/08]
if ( !SiPixelTemplate::pushfile( *templateDBobject_, thePixelTemp_) )
throw cms::Exception("InvalidCalibrationLoaded")
<< "ERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
<< ( *templateDBobject_ ).version();
if(MYDEBUG) cout<<"Loaded templateDBobject "<<( *templateDBobject_ ).version()<<endl;

} else {
if ( !SiPixelTemplate::pushfile( -999, thePixelTemp_ ) )
throw cms::Exception("InvalidCalibrationLoaded")
<< "ERROR: Templates not loaded correctly from text file. Reconstruction will fail.";
} // if load from DB

#endif // NEW_CPEERROR

} else {
if(MYDEBUG) cout<<" Use simple parametrised errors "<<endl;
} // if ( UseErrorsFromTemplates_ )
Expand Down Expand Up @@ -230,8 +196,6 @@ PixelCPEGeneric::localPosition(DetParam const & theDetParam, ClusterParam & theC
theClusterParam.dx2 = -999.9; // CPE Generic x-bias for single double-pixel cluster


#ifdef NEW_CPEERROR

SiPixelGenError gtempl(thePixelGenError_);
int gtemplID_ = theDetParam.detTemplateId;

Expand All @@ -253,24 +217,6 @@ PixelCPEGeneric::localPosition(DetParam const & theDetParam, ClusterParam & theC
if(MYDEBUG) cout<< " redefine la width (gen-error) "<< chargeWidthX<<" "<< chargeWidthY <<endl;
}
if(MYDEBUG) cout<<" GenError: "<<gtemplID_<<endl;

#else // select templates

SiPixelTemplate templ(thePixelTemp_);
int templID_ = theDetParam.detTemplateId;

theClusterParam.qBin_ = templ.qbin( templID_, theClusterParam.cotalpha, theClusterParam.cotbeta, locBz, qclus, // inputs
theClusterParam.pixmx, // returned by reference
theClusterParam.sigmay, theClusterParam.deltay, theClusterParam.sigmax, theClusterParam.deltax, // returned by reference
theClusterParam.sy1, theClusterParam.dy1, theClusterParam.sy2, theClusterParam.dy2, theClusterParam.sx1, theClusterParam.dx1, theClusterParam.sx2, theClusterParam.dx2 ); // returned by reference

//if(MYDEBUG) {
//cout<<" errors "<<templID_<<" "<<theClusterParam.qBin_<<" "<<theClusterParam.sigmax<<" "<<theClusterParam.sigmay<<endl;
//int templID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId().rawId());
//if(templID0!=templID_) cout<<" different id"<< templID_<<" "<<templID0<<endl;
//}

#endif // NEW_CPEERROR

// These numbers come in microns from the qbin(...) call. Transform them to cm.
theClusterParam.deltax = theClusterParam.deltax * micronsToCm;
Expand Down

0 comments on commit 166eeb9

Please sign in to comment.