Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:37

0001 // -*- C++ -*-
0002 //
0003 // Package:    TrackAssociator
0004 // Class:      TrackAssociatorParameters
0005 //
0006 /*
0007 
0008  Description: track associator parameters
0009 
0010 */
0011 //
0012 // Original Author:  Dmytro Kovalskyi
0013 //
0014 //
0015 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0016 #include "TrackingTools/TrackAssociator/interface/TrackAssociatorParameters.h"
0017 
0018 void TrackAssociatorParameters::loadParameters(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) {
0019   dREcal = iConfig.getParameter<double>("dREcal");
0020   dRHcal = iConfig.getParameter<double>("dRHcal");
0021   dRMuon = iConfig.getParameter<double>("dRMuon");
0022 
0023   dREcalPreselection = iConfig.getParameter<double>("dREcalPreselection");
0024   dRHcalPreselection = iConfig.getParameter<double>("dRHcalPreselection");
0025   dRMuonPreselection = iConfig.getParameter<double>("dRMuonPreselection");
0026   dRPreshowerPreselection = iConfig.getParameter<double>("dRPreshowerPreselection");
0027 
0028   muonMaxDistanceX = iConfig.getParameter<double>("muonMaxDistanceX");
0029   muonMaxDistanceY = iConfig.getParameter<double>("muonMaxDistanceY");
0030   muonMaxDistanceSigmaX = iConfig.getParameter<double>("muonMaxDistanceSigmaX");
0031   muonMaxDistanceSigmaY = iConfig.getParameter<double>("muonMaxDistanceSigmaY");
0032 
0033   useEcal = iConfig.getParameter<bool>("useEcal");
0034   useHcal = iConfig.getParameter<bool>("useHcal");
0035   useHO = iConfig.getParameter<bool>("useHO");
0036   useCalo = iConfig.getParameter<bool>("useCalo");
0037   useMuon = iConfig.getParameter<bool>("useMuon");
0038   usePreshower = iConfig.getParameter<bool>("usePreshower");
0039   useGEM = iConfig.getParameter<bool>("useGEM");
0040   useME0 = iConfig.getParameter<bool>("useME0");
0041   preselectMuonTracks = iConfig.getParameter<bool>("preselectMuonTracks");
0042 
0043   theEBRecHitCollectionLabel = iConfig.getParameter<edm::InputTag>("EBRecHitCollectionLabel");
0044   theEERecHitCollectionLabel = iConfig.getParameter<edm::InputTag>("EERecHitCollectionLabel");
0045   theCaloTowerCollectionLabel = iConfig.getParameter<edm::InputTag>("CaloTowerCollectionLabel");
0046   theHBHERecHitCollectionLabel = iConfig.getParameter<edm::InputTag>("HBHERecHitCollectionLabel");
0047   theHORecHitCollectionLabel = iConfig.getParameter<edm::InputTag>("HORecHitCollectionLabel");
0048   theDTRecSegment4DCollectionLabel = iConfig.getParameter<edm::InputTag>("DTRecSegment4DCollectionLabel");
0049   theCSCSegmentCollectionLabel = iConfig.getParameter<edm::InputTag>("CSCSegmentCollectionLabel");
0050   theGEMSegmentCollectionLabel = iConfig.getParameter<edm::InputTag>("GEMSegmentCollectionLabel");
0051   theME0SegmentCollectionLabel = iConfig.getParameter<edm::InputTag>("ME0SegmentCollectionLabel");
0052   if (preselectMuonTracks) {
0053     theRPCHitCollectionLabel = iConfig.getParameter<edm::InputTag>("RPCHitCollectionLabel");
0054     theGEMHitCollectionLabel = iConfig.getParameter<edm::InputTag>("GEMHitCollectionLabel");
0055     theME0HitCollectionLabel = iConfig.getParameter<edm::InputTag>("ME0HitCollectionLabel");
0056   }
0057 
0058   accountForTrajectoryChangeCalo = iConfig.getParameter<bool>("accountForTrajectoryChangeCalo");
0059   // accountForTrajectoryChangeMuon   = iConfig.getParameter<bool>("accountForTrajectoryChangeMuon");
0060 
0061   truthMatch = iConfig.getParameter<bool>("truthMatch");
0062   muonMaxDistanceSigmaY = iConfig.getParameter<double>("trajectoryUncertaintyTolerance");
0063 
0064   if (useEcal) {
0065     EBRecHitsToken = iC.consumes<EBRecHitCollection>(theEBRecHitCollectionLabel);
0066     EERecHitsToken = iC.consumes<EERecHitCollection>(theEERecHitCollectionLabel);
0067   }
0068   if (useCalo)
0069     caloTowersToken = iC.consumes<CaloTowerCollection>(theCaloTowerCollectionLabel);
0070   if (useHcal)
0071     HBHEcollToken = iC.consumes<HBHERecHitCollection>(theHBHERecHitCollectionLabel);
0072   if (useHO)
0073     HOcollToken = iC.consumes<HORecHitCollection>(theHORecHitCollectionLabel);
0074   if (useMuon) {
0075     dtSegmentsToken = iC.consumes<DTRecSegment4DCollection>(theDTRecSegment4DCollectionLabel);
0076     cscSegmentsToken = iC.consumes<CSCSegmentCollection>(theCSCSegmentCollectionLabel);
0077     if (useGEM)
0078       gemSegmentsToken = iC.consumes<GEMSegmentCollection>(theGEMSegmentCollectionLabel);
0079     if (useME0)
0080       me0SegmentsToken = iC.consumes<ME0SegmentCollection>(theME0SegmentCollectionLabel);
0081     if (preselectMuonTracks) {
0082       rpcHitsToken = iC.consumes<RPCRecHitCollection>(theRPCHitCollectionLabel);
0083       gemHitsToken = iC.consumes<GEMRecHitCollection>(theGEMHitCollectionLabel);
0084       me0HitsToken = iC.consumes<ME0RecHitCollection>(theME0HitCollectionLabel);
0085     }
0086   }
0087   if (truthMatch) {
0088     simTracksToken = iC.consumes<edm::SimTrackContainer>(edm::InputTag("g4SimHits"));
0089     simVerticesToken = iC.consumes<edm::SimVertexContainer>(edm::InputTag("g4SimHits"));
0090     simEcalHitsEBToken = iC.consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalHitsEB"));
0091     simEcalHitsEEToken = iC.consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalHitsEE"));
0092     simHcalHitsToken = iC.consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "HcalHits"));
0093   }
0094 
0095   ecalDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "EcalDetIdAssociator"));
0096   hcalDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "HcalDetIdAssociator"));
0097   hoDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "HODetIdAssociator"));
0098   caloDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "CaloDetIdAssociator"));
0099   muonDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"));
0100   preshowerDetIdAssociatorToken = iC.esConsumes(edm::ESInputTag("", "PreshowerDetIdAssociator"));
0101   theCaloGeometryToken = iC.esConsumes();
0102   theTrackingGeometryToken = iC.esConsumes();
0103   bFieldToken = iC.esConsumes();
0104 }
0105 
0106 TrackAssociatorParameters::TrackAssociatorParameters(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) {
0107   loadParameters(iConfig, iC);
0108 }
0109 
0110 void TrackAssociatorParameters::fillPSetDescription(edm::ParameterSetDescription& desc) {
0111   desc.setComment("Auxilliary class to store parameters for track association");
0112   // the following setup is the one from TrackingTools/TrackAssociator/python/default_cfi.py
0113   desc.add<bool>("accountForTrajectoryChangeCalo", false);
0114   desc.add<bool>("propagateAllDirections", true);
0115   desc.add<bool>("truthMatch", false);
0116   desc.add<bool>("useCalo", false);
0117   desc.add<bool>("useEcal", true);
0118   desc.add<bool>("useGEM", false);
0119   desc.add<bool>("useHO", true);
0120   desc.add<bool>("useHcal", true);
0121   desc.add<bool>("useME0", false);
0122   desc.add<bool>("useMuon", true);
0123   desc.add<bool>("usePreshower", false);
0124   desc.add<bool>("preselectMuonTracks", false);
0125   desc.add<double>("dREcal", 9999.0);
0126   desc.add<double>("dREcalPreselection", 0.05);
0127   desc.add<double>("dRHcal", 9999.0);
0128   desc.add<double>("dRHcalPreselection", 0.2);
0129   desc.add<double>("dRMuon", 9999.0);
0130   desc.add<double>("dRMuonPreselection", 0.2);
0131   desc.add<double>("dRPreshowerPreselection", 0.2);
0132   desc.add<double>("muonMaxDistanceSigmaX", 0.0);
0133   desc.add<double>("muonMaxDistanceSigmaY", 0.0);
0134   desc.add<double>("muonMaxDistanceX", 5.0);
0135   desc.add<double>("muonMaxDistanceY", 5.0);
0136   desc.add<double>("trajectoryUncertaintyTolerance", -1.0);
0137   desc.add<edm::InputTag>("CSCSegmentCollectionLabel", edm::InputTag("cscSegments"));
0138   desc.add<edm::InputTag>("CaloTowerCollectionLabel", edm::InputTag("towerMaker"));
0139   desc.add<edm::InputTag>("DTRecSegment4DCollectionLabel", edm::InputTag("dt4DSegments"));
0140   desc.add<edm::InputTag>("EBRecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
0141   desc.add<edm::InputTag>("EERecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
0142   desc.add<edm::InputTag>("GEMSegmentCollectionLabel", edm::InputTag("gemSegments"));
0143   desc.add<edm::InputTag>("HBHERecHitCollectionLabel", edm::InputTag("hbreco"));
0144   desc.add<edm::InputTag>("HORecHitCollectionLabel", edm::InputTag("horeco"));
0145   desc.add<edm::InputTag>("ME0SegmentCollectionLabel", edm::InputTag("me0Segments"));
0146   desc.add<edm::InputTag>("RPCHitCollectionLabel", edm::InputTag("rpcRecHits"));
0147   desc.add<edm::InputTag>("GEMHitCollectionLabel", edm::InputTag("gemRecHits"));
0148   desc.add<edm::InputTag>("ME0HitCollectionLabel", edm::InputTag("me0RecHits"));
0149 }