Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:40

0001 /**
0002  * \file IntegratedCalibrationBase.cc
0003  *
0004  *  \author Gero Flucke
0005  *  \date August 2012
0006  *  $Revision: 1.77 $
0007  *  $Date: 2011/09/06 13:46:08 $
0008  *  (last update by $Author: mussgill $)
0009  */
0010 
0011 #include "Alignment/CommonAlignmentAlgorithm/interface/IntegratedCalibrationBase.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0014 
0015 // Already included in header:
0016 //#include <vector>
0017 //#include <utility>
0018 
0019 //============================================================================
0020 IntegratedCalibrationBase::IntegratedCalibrationBase(const edm::ParameterSet &cfg)
0021     : name_(cfg.getParameter<std::string>("calibrationName")) {}
0022 
0023 //============================================================================
0024 std::vector<IntegratedCalibrationBase::Values> IntegratedCalibrationBase::derivatives(
0025     const TrackingRecHit &hit,
0026     const TrajectoryStateOnSurface &tsos,
0027     const edm::EventSetup &setup,
0028     const EventInfo &eventInfo) const {
0029   // Prepare result vector, initialised all with 0.:
0030   std::vector<Values> result(this->numParameters(), Values(0., 0.));
0031 
0032   // Get non-zero derivatives and their index:
0033   std::vector<ValuesIndexPair> derivsIndexPairs;
0034   const unsigned int numNonZero = this->derivatives(derivsIndexPairs, hit, tsos, setup, eventInfo);
0035 
0036   // Put non-zero values into result:
0037   for (unsigned int i = 0; i < numNonZero; ++i) {
0038     const ValuesIndexPair &valuesIndex = derivsIndexPairs[i];
0039     result[valuesIndex.second] = valuesIndex.first;
0040   }
0041 
0042   return result;
0043 }