Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-31 02:17:41

0001 /**
0002   \class    TSGForOI
0003   \brief    Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner
0004   \author   Benjamin Radburn-Smith, Santiago Folgueras
0005  */
0006 
0007 #include "RecoMuon/TrackerSeedGenerator/plugins/TSGForOI.h"
0008 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0009 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0010 
0011 #include <memory>
0012 
0013 using namespace edm;
0014 using namespace std;
0015 
0016 TSGForOI::TSGForOI(const edm::ParameterSet& iConfig)
0017     : src_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("src"))),
0018       estimatorToken_(esConsumes(edm::ESInputTag("", (iConfig.getParameter<std::string>("estimator"))))),
0019       magfieldToken_(esConsumes()),
0020       tmpTkGeometryToken_(esConsumes()),
0021       geometryToken_(esConsumes()),
0022       tTopoToken_(esConsumes()),
0023       smartOppositeToken_(esConsumes(edm::ESInputTag("", "hltESPSmartPropagatorAnyOpposite"))),
0024       shpOppositeToken_(esConsumes(edm::ESInputTag("", "hltESPSteppingHelixPropagatorOpposite"))),
0025       numOfMaxSeedsParam_(iConfig.getParameter<uint32_t>("maxSeeds")),
0026       numOfLayersToTry_(iConfig.getParameter<int32_t>("layersToTry")),
0027       numOfHitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")),
0028       fixedErrorRescalingForHits_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHits")),
0029       fixedErrorRescalingForHitless_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHitless")),
0030       adjustErrorsDynamicallyForHits_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHits")),
0031       adjustErrorsDynamicallyForHitless_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHitless")),
0032       minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")),
0033       maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")),
0034       useHitLessSeeds_(iConfig.getParameter<bool>("UseHitLessSeeds")),
0035       useStereoLayersInTEC_(iConfig.getParameter<bool>("UseStereoLayersInTEC")),
0036       updator_(new KFUpdator()),
0037       measurementTrackerTag_(
0038           consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent"))),
0039       pT1_(iConfig.getParameter<double>("pT1")),
0040       pT2_(iConfig.getParameter<double>("pT2")),
0041       pT3_(iConfig.getParameter<double>("pT3")),
0042       eta1_(iConfig.getParameter<double>("eta1")),
0043       eta2_(iConfig.getParameter<double>("eta2")),
0044       SF1_(iConfig.getParameter<double>("SF1")),
0045       SF2_(iConfig.getParameter<double>("SF2")),
0046       SF3_(iConfig.getParameter<double>("SF3")),
0047       SF4_(iConfig.getParameter<double>("SF4")),
0048       SF5_(iConfig.getParameter<double>("SF5")),
0049       tsosDiff_(iConfig.getParameter<double>("tsosDiff")),
0050       propagatorName_(iConfig.getParameter<std::string>("propagatorName")),
0051       theCategory(string("Muon|RecoMuon|TSGForOI")),
0052       propagatorAlongToken_(esConsumes(edm::ESInputTag("", propagatorName_))),
0053       propagatorOppositeToken_(esConsumes(edm::ESInputTag("", propagatorName_))) {
0054   produces<std::vector<TrajectorySeed> >();
0055 }
0056 
0057 TSGForOI::~TSGForOI() {}
0058 
0059 void TSGForOI::produce(edm::StreamID sid, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0060   /// Init variables
0061   unsigned int numOfMaxSeeds = numOfMaxSeedsParam_;
0062   unsigned int numSeedsMade = 0;
0063   bool analysedL2 = false;
0064   unsigned int layerCount = 0;
0065 
0066   /// Surface used to make a TSOS at the PCA to the beamline
0067   Plane::PlanePointer dummyPlane = Plane::build(Plane::PositionType(), Plane::RotationType());
0068 
0069   /// Read ESHandles
0070   edm::Handle<MeasurementTrackerEvent> measurementTrackerH;
0071   edm::ESHandle<Chi2MeasurementEstimatorBase> estimatorH = iSetup.getHandle(estimatorToken_);
0072   edm::ESHandle<MagneticField> magfieldH = iSetup.getHandle(magfieldToken_);
0073   edm::ESHandle<Propagator> propagatorAlongH = iSetup.getHandle(propagatorAlongToken_);
0074   edm::ESHandle<Propagator> propagatorOppositeH = iSetup.getHandle(propagatorOppositeToken_);
0075   edm::ESHandle<TrackerGeometry> tmpTkGeometryH = iSetup.getHandle(tmpTkGeometryToken_);
0076   edm::ESHandle<GlobalTrackingGeometry> geometryH = iSetup.getHandle(geometryToken_);
0077 
0078   iEvent.getByToken(measurementTrackerTag_, measurementTrackerH);
0079 
0080   /// Read L2 track collection
0081   edm::Handle<reco::TrackCollection> l2TrackCol;
0082   iEvent.getByToken(src_, l2TrackCol);
0083 
0084   //    The product:
0085   std::unique_ptr<std::vector<TrajectorySeed> > result(new std::vector<TrajectorySeed>());
0086 
0087   //    Get vector of Detector layers once:
0088   std::vector<BarrelDetLayer const*> const& tob = measurementTrackerH->geometricSearchTracker()->tobLayers();
0089   std::vector<ForwardDetLayer const*> const& tecPositive =
0090       tmpTkGeometryH->isThere(GeomDetEnumerators::P2OTEC)
0091           ? measurementTrackerH->geometricSearchTracker()->posTidLayers()
0092           : measurementTrackerH->geometricSearchTracker()->posTecLayers();
0093   std::vector<ForwardDetLayer const*> const& tecNegative =
0094       tmpTkGeometryH->isThere(GeomDetEnumerators::P2OTEC)
0095           ? measurementTrackerH->geometricSearchTracker()->negTidLayers()
0096           : measurementTrackerH->geometricSearchTracker()->negTecLayers();
0097   const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_);
0098 
0099   //    Get the suitable propagators:
0100   std::unique_ptr<Propagator> propagatorAlong = SetPropagationDirection(*propagatorAlongH, alongMomentum);
0101   std::unique_ptr<Propagator> propagatorOpposite = SetPropagationDirection(*propagatorOppositeH, oppositeToMomentum);
0102 
0103   edm::ESHandle<Propagator> SmartOpposite = iSetup.getHandle(smartOppositeToken_);
0104   edm::ESHandle<Propagator> SHPOpposite = iSetup.getHandle(shpOppositeToken_);
0105 
0106   //    Loop over the L2's and make seeds for all of them:
0107   LogTrace(theCategory) << "TSGForOI::produce: Number of L2's: " << l2TrackCol->size();
0108   for (unsigned int l2TrackColIndex(0); l2TrackColIndex != l2TrackCol->size(); ++l2TrackColIndex) {
0109     const reco::TrackRef l2(l2TrackCol, l2TrackColIndex);
0110     std::unique_ptr<std::vector<TrajectorySeed> > out(new std::vector<TrajectorySeed>());
0111     LogTrace("TSGForOI") << "TSGForOI::produce: L2 muon pT, eta, phi --> " << l2->pt() << " , " << l2->eta() << " , "
0112                          << l2->phi() << endl;
0113 
0114     FreeTrajectoryState fts = trajectoryStateTransform::initialFreeState(*l2, magfieldH.product());
0115     dummyPlane->move(fts.position() - dummyPlane->position());
0116     TrajectoryStateOnSurface tsosAtIP = TrajectoryStateOnSurface(fts, *dummyPlane);
0117     LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
0118 
0119     // get the TSOS on the innermost layer of the L2.
0120     TrajectoryStateOnSurface tsosAtMuonSystem =
0121         trajectoryStateTransform::innerStateOnSurface(*l2, *geometryH, magfieldH.product());
0122     LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem << endl;
0123 
0124     LogTrace("TSGForOI") << "TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors"
0125                          << endl;
0126     StateOnTrackerBound fromInside(propagatorAlong.get());
0127     TrajectoryStateOnSurface outerTkStateInside = fromInside(fts);
0128 
0129     StateOnTrackerBound fromOutside(&*SmartOpposite);
0130     TrajectoryStateOnSurface outerTkStateOutside = fromOutside(tsosAtMuonSystem);
0131 
0132     // for now only checking if the two positions (using updated and not-updated) agree withing certain extent,
0133     // will probably have to design something fancier for the future.
0134     auto dist = 0.0;
0135     bool useBoth = false;
0136     if (outerTkStateInside.isValid() && outerTkStateOutside.isValid()) {
0137       dist = match_Chi2(outerTkStateInside, outerTkStateOutside);
0138     }
0139     if (dist > tsosDiff_) {
0140       useBoth = true;
0141     }
0142 
0143     numSeedsMade = 0;
0144     analysedL2 = false;
0145 
0146     // if both TSOSs agree, use only the one at vertex, as it uses more information. If they do not agree, search for seed based on both
0147 
0148     //      BARREL
0149     if (std::abs(l2->eta()) < maxEtaForTOB_) {
0150       layerCount = 0;
0151       for (auto it = tob.rbegin(); it != tob.rend(); ++it) {  //This goes from outermost to innermost layer
0152         LogTrace("TSGForOI") << "TSGForOI::produce: looping in TOB layer " << layerCount << endl;
0153         findSeedsOnLayer(tTopo,
0154                          **it,
0155                          tsosAtIP,
0156                          *(propagatorAlong.get()),
0157                          *(propagatorOpposite.get()),
0158                          l2,
0159                          estimatorH,
0160                          measurementTrackerH,
0161                          numSeedsMade,
0162                          numOfMaxSeeds,
0163                          layerCount,
0164                          analysedL2,
0165                          out);
0166       }
0167       if (useBoth) {
0168         numSeedsMade = 0;
0169         for (auto it = tob.rbegin(); it != tob.rend(); ++it) {  //This goes from outermost to innermost layer
0170           LogTrace("TSGForOI") << "TSGForOI::produce: looping in TOB layer " << layerCount << endl;
0171           findSeedsOnLayer(tTopo,
0172                            **it,
0173                            tsosAtMuonSystem,
0174                            *(propagatorOpposite.get()),
0175                            *(propagatorOpposite.get()),
0176                            l2,
0177                            estimatorH,
0178                            measurementTrackerH,
0179                            numSeedsMade,
0180                            numOfMaxSeeds,
0181                            layerCount,
0182                            analysedL2,
0183                            out);
0184         }
0185       }
0186     }
0187     //      Reset Number of seeds if in overlap region:
0188 
0189     if (std::abs(l2->eta()) > minEtaForTEC_ && std::abs(l2->eta()) < maxEtaForTOB_) {
0190       numSeedsMade = 0;
0191     }
0192 
0193     //      ENDCAP+
0194     if (l2->eta() > minEtaForTEC_) {
0195       layerCount = 0;
0196       for (auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
0197         LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
0198         findSeedsOnLayer(tTopo,
0199                          **it,
0200                          tsosAtIP,
0201                          *(propagatorAlong.get()),
0202                          *(propagatorOpposite.get()),
0203                          l2,
0204                          estimatorH,
0205                          measurementTrackerH,
0206                          numSeedsMade,
0207                          numOfMaxSeeds,
0208                          layerCount,
0209                          analysedL2,
0210                          out);
0211       }
0212       if (useBoth) {
0213         numSeedsMade = 0;
0214         for (auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
0215           LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
0216           findSeedsOnLayer(tTopo,
0217                            **it,
0218                            tsosAtMuonSystem,
0219                            *(propagatorOpposite.get()),
0220                            *(propagatorOpposite.get()),
0221                            l2,
0222                            estimatorH,
0223                            measurementTrackerH,
0224                            numSeedsMade,
0225                            numOfMaxSeeds,
0226                            layerCount,
0227                            analysedL2,
0228                            out);
0229         }
0230       }
0231     }
0232 
0233     //      ENDCAP-
0234     if (l2->eta() < -minEtaForTEC_) {
0235       layerCount = 0;
0236       for (auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
0237         LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
0238         findSeedsOnLayer(tTopo,
0239                          **it,
0240                          tsosAtIP,
0241                          *(propagatorAlong.get()),
0242                          *(propagatorOpposite.get()),
0243                          l2,
0244                          estimatorH,
0245                          measurementTrackerH,
0246                          numSeedsMade,
0247                          numOfMaxSeeds,
0248                          layerCount,
0249                          analysedL2,
0250                          out);
0251       }
0252       if (useBoth) {
0253         numSeedsMade = 0;
0254         for (auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
0255           LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
0256           findSeedsOnLayer(tTopo,
0257                            **it,
0258                            tsosAtMuonSystem,
0259                            *(propagatorOpposite.get()),
0260                            *(propagatorOpposite.get()),
0261                            l2,
0262                            estimatorH,
0263                            measurementTrackerH,
0264                            numSeedsMade,
0265                            numOfMaxSeeds,
0266                            layerCount,
0267                            analysedL2,
0268                            out);
0269         }
0270       }
0271     }
0272 
0273     for (std::vector<TrajectorySeed>::iterator it = out->begin(); it != out->end(); ++it) {
0274       result->push_back(*it);
0275     }
0276   }  //L2Collection
0277   edm::LogInfo(theCategory) << "TSGForOI::produce: number of seeds made: " << result->size();
0278 
0279   iEvent.put(std::move(result));
0280 }
0281 
0282 void TSGForOI::findSeedsOnLayer(const TrackerTopology* tTopo,
0283                                 const GeometricSearchDet& layer,
0284                                 const TrajectoryStateOnSurface& tsosAtIP,
0285                                 const Propagator& propagatorAlong,
0286                                 const Propagator& propagatorOpposite,
0287                                 const reco::TrackRef l2,
0288                                 edm::ESHandle<Chi2MeasurementEstimatorBase>& estimatorH,
0289                                 edm::Handle<MeasurementTrackerEvent>& measurementTrackerH,
0290                                 unsigned int& numSeedsMade,
0291                                 unsigned int& numOfMaxSeeds,
0292                                 unsigned int& layerCount,
0293                                 bool& analysedL2,
0294                                 std::unique_ptr<std::vector<TrajectorySeed> >& out) const {
0295   if (numSeedsMade > numOfMaxSeeds)
0296     return;
0297   LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: numSeedsMade = " << numSeedsMade
0298                        << " , layerCount = " << layerCount << endl;
0299 
0300   double errorSFHits = 1.0;
0301   double errorSFHitless = 1.0;
0302   if (!adjustErrorsDynamicallyForHits_)
0303     errorSFHits = fixedErrorRescalingForHits_;
0304   else
0305     errorSFHits = calculateSFFromL2(l2);
0306   if (!adjustErrorsDynamicallyForHitless_)
0307     errorSFHitless = fixedErrorRescalingForHitless_;
0308 
0309   // Hitless:  TO Be discarded from here at some point.
0310   if (useHitLessSeeds_) {
0311     LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start hitless" << endl;
0312     std::vector<GeometricSearchDet::DetWithState> dets;
0313     layer.compatibleDetsV(tsosAtIP, propagatorAlong, *estimatorH, dets);
0314     if (!dets.empty()) {
0315       auto const& detOnLayer = dets.front().first;
0316       auto const& tsosOnLayer = dets.front().second;
0317       LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: tsosOnLayer " << tsosOnLayer << endl;
0318       if (!tsosOnLayer.isValid()) {
0319         edm::LogInfo(theCategory) << "ERROR!: Hitless TSOS is not valid!";
0320       } else {
0321         // calculate SF from L2 (only once -- if needed)
0322         if (!analysedL2 && adjustErrorsDynamicallyForHitless_) {
0323           errorSFHitless = calculateSFFromL2(l2);
0324           analysedL2 = true;
0325         }
0326 
0327         dets.front().second.rescaleError(errorSFHitless);
0328         PTrajectoryStateOnDet const& ptsod =
0329             trajectoryStateTransform::persistentState(tsosOnLayer, detOnLayer->geographicalId().rawId());
0330         TrajectorySeed::RecHitContainer rHC;
0331         out->push_back(TrajectorySeed(ptsod, rHC, oppositeToMomentum));
0332         LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
0333         numSeedsMade++;
0334       }
0335     }
0336   }
0337 
0338   // Hits:
0339   if (layerCount > numOfLayersToTry_)
0340     return;
0341   LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start Hits" << endl;
0342   if (makeSeedsFromHits(tTopo,
0343                         layer,
0344                         tsosAtIP,
0345                         *out,
0346                         propagatorAlong,
0347                         *measurementTrackerH,
0348                         estimatorH,
0349                         numSeedsMade,
0350                         errorSFHits,
0351                         l2->eta()))
0352     ++layerCount;
0353 }
0354 
0355 double TSGForOI::calculateSFFromL2(const reco::TrackRef track) const {
0356   double theSF = 1.0;
0357   //    L2 direction vs pT blowup - as was previously done:
0358   //    Split into 4 pT ranges: <pT1_, pT1_<pT2_, pT2_<pT3_, <pT4_: 13,30,70
0359   //    Split into 2 eta ranges for the middle two pT ranges: 1.0,1.4
0360   double abseta = std::abs(track->eta());
0361   if (track->pt() <= pT1_)
0362     theSF = SF1_;
0363   if (track->pt() > pT1_ && track->pt() <= pT2_) {
0364     if (abseta <= eta1_)
0365       theSF = SF3_;
0366     if (abseta > eta1_ && abseta <= eta2_)
0367       theSF = SF2_;
0368     if (abseta > eta2_)
0369       theSF = SF3_;
0370   }
0371   if (track->pt() > pT2_ && track->pt() <= pT3_) {
0372     if (abseta <= eta1_)
0373       theSF = SF5_;
0374     if (abseta > eta1_ && abseta <= eta2_)
0375       theSF = SF4_;
0376     if (abseta > eta2_)
0377       theSF = SF5_;
0378   }
0379   if (track->pt() > pT3_)
0380     theSF = SF5_;
0381 
0382   LogTrace(theCategory) << "TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
0383   return theSF;
0384 }
0385 
0386 int TSGForOI::makeSeedsFromHits(const TrackerTopology* tTopo,
0387                                 const GeometricSearchDet& layer,
0388                                 const TrajectoryStateOnSurface& tsosAtIP,
0389                                 std::vector<TrajectorySeed>& out,
0390                                 const Propagator& propagatorAlong,
0391                                 const MeasurementTrackerEvent& measurementTracker,
0392                                 edm::ESHandle<Chi2MeasurementEstimatorBase>& estimatorH,
0393                                 unsigned int& numSeedsMade,
0394                                 const double errorSF,
0395                                 const double l2Eta) const {
0396   //        Error Rescaling:
0397   TrajectoryStateOnSurface onLayer(tsosAtIP);
0398   onLayer.rescaleError(errorSF);
0399 
0400   std::vector<GeometricSearchDet::DetWithState> dets;
0401   layer.compatibleDetsV(onLayer, propagatorAlong, *estimatorH, dets);
0402 
0403   //    Find Measurements on each DetWithState:
0404   LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: find measurements on each detWithState  " << dets.size() << endl;
0405   std::vector<TrajectoryMeasurement> meas;
0406   for (std::vector<GeometricSearchDet::DetWithState>::iterator it = dets.begin(); it != dets.end(); ++it) {
0407     MeasurementDetWithData det = measurementTracker.idToDet(it->first->geographicalId());
0408     if (det.isNull()) {
0409       continue;
0410     }
0411     if (!it->second.isValid())
0412       continue;  //Skip if TSOS is not valid
0413 
0414     std::vector<TrajectoryMeasurement> mymeas =
0415         det.fastMeasurements(it->second, onLayer, propagatorAlong, *estimatorH);  //Second TSOS is not used
0416     for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2;
0417          ++it2) {
0418       if (it2->recHit()->isValid())
0419         meas.push_back(*it2);  //Only save those which are valid
0420     }
0421   }
0422 
0423   //    Update TSOS using TMs after sorting, then create Trajectory Seed and put into vector:
0424   LogTrace("TSGForOI")
0425       << "TSGForOI::findSeedsOnLayer: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = "
0426       << meas.size() << endl;
0427   unsigned int found = 0;
0428   std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
0429   for (std::vector<TrajectoryMeasurement>::const_iterator it = meas.begin(); it != meas.end(); ++it) {
0430     TrajectoryStateOnSurface updatedTSOS = updator_->update(it->forwardPredictedState(), *it->recHit());
0431     LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
0432     if (not updatedTSOS.isValid())
0433       continue;
0434 
0435     // CHECK if is StereoLayer:
0436     if (useStereoLayersInTEC_ && (fabs(l2Eta) > 0.8 && fabs(l2Eta) < 1.6)) {
0437       DetId detid = ((*it).recHit()->hit())->geographicalId();
0438       if (detid.subdetId() == StripSubdetector::TEC) {
0439         if (!tTopo->tecIsStereo(detid.rawId()))
0440           break;  // try another layer
0441       }
0442     }
0443 
0444     edm::OwnVector<TrackingRecHit> seedHits;
0445     seedHits.push_back(*it->recHit()->hit());
0446     PTrajectoryStateOnDet const& pstate =
0447         trajectoryStateTransform::persistentState(updatedTSOS, it->recHit()->geographicalId().rawId());
0448     LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.size() << endl;
0449     TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
0450     out.push_back(seed);
0451     found++;
0452     numSeedsMade++;
0453     if (found == numOfHitsToTry_)
0454       break;
0455   }
0456   return found;
0457 }
0458 //
0459 //// calculate Chi^2 of two trajectory states
0460 ////
0461 
0462 double TSGForOI::match_Chi2(const TrajectoryStateOnSurface& tsos1, const TrajectoryStateOnSurface& tsos2) const {
0463   if (!tsos1.isValid() || !tsos2.isValid())
0464     return -1.;
0465 
0466   AlgebraicVector5 v(tsos1.localParameters().vector() - tsos2.localParameters().vector());
0467   AlgebraicSymMatrix55 m(tsos1.localError().matrix() + tsos2.localError().matrix());
0468 
0469   bool ierr = !m.Invert();
0470 
0471   if (ierr) {
0472     edm::LogInfo("TSGForOI") << "Error inverting covariance matrix";
0473     return -1;
0474   }
0475 
0476   double est = ROOT::Math::Similarity(v, m);
0477 
0478   return est;
0479 }
0480 
0481 void TSGForOI::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0482   edm::ParameterSetDescription desc;
0483   desc.add<edm::InputTag>("src", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
0484   desc.add<int>("layersToTry", 1);
0485   desc.add<double>("fixedErrorRescaleFactorForHitless", 2.0);
0486   desc.add<int>("hitsToTry", 1);
0487   desc.add<bool>("adjustErrorsDynamicallyForHits", false);
0488   desc.add<bool>("adjustErrorsDynamicallyForHitless", false);
0489   desc.add<edm::InputTag>("MeasurementTrackerEvent", edm::InputTag("hltSiStripClusters"));
0490   desc.add<bool>("UseHitLessSeeds", true);
0491   desc.add<bool>("UseStereoLayersInTEC", false);
0492   desc.add<std::string>("estimator", "hltESPChi2MeasurementEstimator100");
0493   desc.add<double>("maxEtaForTOB", 1.2);
0494   desc.add<double>("minEtaForTEC", 0.8);
0495   desc.addUntracked<bool>("debug", true);
0496   desc.add<double>("fixedErrorRescaleFactorForHits", 2.0);
0497   desc.add<unsigned int>("maxSeeds", 1);
0498   desc.add<double>("pT1", 13.0);
0499   desc.add<double>("pT2", 30.0);
0500   desc.add<double>("pT3", 70.0);
0501   desc.add<double>("eta1", 1.0);
0502   desc.add<double>("eta2", 1.4);
0503   desc.add<double>("SF1", 3.0);
0504   desc.add<double>("SF2", 4.0);
0505   desc.add<double>("SF3", 5.0);
0506   desc.add<double>("SF4", 7.0);
0507   desc.add<double>("SF5", 10.0);
0508   desc.add<double>("tsosDiff", 0.03);
0509   desc.add<std::string>("propagatorName", "PropagatorWithMaterial");
0510   descriptions.add("TSGForOI", desc);
0511 }
0512 
0513 DEFINE_FWK_MODULE(TSGForOI);