Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-25 01:53:49

0001 // -*- C++ -*-
0002 //
0003 // Package:    RPCPointProducer
0004 // Class:      RPCPointProducer
0005 //
0006 /**\class RPCPointProducer RPCPointProducer.cc Analysis/RPCPointProducer/src/RPCPointProducer.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Camilo Andres Carrillo Montoya
0015 //         Created:  Wed Sep 16 14:56:18 CEST 2009
0016 //
0017 //
0018 
0019 #include "RPCPointProducer.h"
0020 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 
0024 // system include files
0025 
0026 #include <memory>
0027 #include <ctime>
0028 
0029 // user include files
0030 
0031 void RPCPointProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0032   edm::ParameterSetDescription desc;
0033   desc.add<bool>("incldt", true);
0034   desc.add<bool>("inclcsc", true);
0035   desc.add<bool>("incltrack", false);
0036   desc.addUntracked<bool>("debug", false);
0037   desc.add<double>("rangestrips", 4.);
0038   desc.add<double>("rangestripsRB4", 4.);
0039   desc.add<double>("MinCosAng", 0.85);
0040   desc.add<double>("MaxD", 80.0);
0041   desc.add<double>("MaxDrb4", 150.0);
0042   desc.add<double>("ExtrapolatedRegion", 0.5);
0043   desc.add<edm::InputTag>("cscSegments", edm::InputTag("hltCscSegments"));
0044   desc.add<edm::InputTag>("dt4DSegments", edm::InputTag("hltDt4DSegments"));
0045   desc.add<edm::InputTag>("tracks", edm::InputTag("standAloneMuons"));
0046   desc.add<int>("minBX", -2);
0047   desc.add<int>("maxBX", 2);
0048   edm::ParameterSetDescription descNested;
0049   descNested.add<bool>("DoPredictionsOnly", false);
0050   descNested.add<std::string>("Fitter", "KFFitterForRefitInsideOut");
0051   descNested.add<std::string>("TrackerRecHitBuilder", "WithTrackAngle");
0052   descNested.add<std::string>("Smoother", "KFSmootherForRefitInsideOut");
0053   descNested.add<std::string>("MuonRecHitBuilder", "MuonRecHitBuilder");
0054   descNested.add<std::string>("RefitDirection", "alongMomentum");
0055   descNested.add<bool>("RefitRPCHits", false);
0056   descNested.add<std::string>("Propagator", "SmartPropagatorAnyRKOpposite");
0057   desc.add<edm::ParameterSetDescription>("TrackTransformer", descNested);
0058 
0059   descriptions.add("rpcPointProducer", desc);
0060 }
0061 
0062 RPCPointProducer::RPCPointProducer(const edm::ParameterSet& iConfig)
0063     : incldt(iConfig.getParameter<bool>("incldt")),
0064       inclcsc(iConfig.getParameter<bool>("inclcsc")),
0065       incltrack(iConfig.getParameter<bool>("incltrack")),
0066       debug(iConfig.getUntrackedParameter<bool>("debug")),
0067       MinCosAng(iConfig.getParameter<double>("MinCosAng")),
0068       MaxD(iConfig.getParameter<double>("MaxD")),
0069       MaxDrb4(iConfig.getParameter<double>("MaxDrb4")),
0070       ExtrapolatedRegion(iConfig.getParameter<double>("ExtrapolatedRegion")) {
0071   if (incldt) {
0072     dt4DSegments = consumes<DTRecSegment4DCollection>(iConfig.getParameter<edm::InputTag>("dt4DSegments"));
0073     dtSegtoRPC = std::make_unique<DTSegtoRPC>(consumesCollector(), iConfig);
0074   }
0075   if (inclcsc) {
0076     cscSegments = consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("cscSegments"));
0077     cscSegtoRPC = std::make_unique<CSCSegtoRPC>(consumesCollector(), iConfig);
0078   }
0079   if (incltrack) {
0080     tracks = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
0081     tracktoRPC = std::make_unique<TracktoRPC>(iConfig.getParameter<edm::ParameterSet>("TrackTransformer"),
0082                                               iConfig.getParameter<edm::InputTag>("tracks"),
0083                                               consumesCollector());
0084   }
0085 
0086   produces<RPCRecHitCollection>("RPCDTExtrapolatedPoints");
0087   produces<RPCRecHitCollection>("RPCCSCExtrapolatedPoints");
0088   produces<RPCRecHitCollection>("RPCTrackExtrapolatedPoints");
0089 }
0090 
0091 void RPCPointProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0092   if (incldt) {
0093     edm::Handle<DTRecSegment4DCollection> all4DSegments;
0094     iEvent.getByToken(dt4DSegments, all4DSegments);
0095     if (all4DSegments.isValid()) {
0096       iEvent.put(dtSegtoRPC->thePoints(all4DSegments.product(), iSetup, debug, ExtrapolatedRegion),
0097                  "RPCDTExtrapolatedPoints");
0098     } else {
0099       if (debug)
0100         LogDebug("RPCPointProducer") << "RPCHLT Invalid DTSegments collection" << std::endl;
0101     }
0102   }
0103 
0104   if (inclcsc) {
0105     edm::Handle<CSCSegmentCollection> allCSCSegments;
0106     iEvent.getByToken(cscSegments, allCSCSegments);
0107     if (allCSCSegments.isValid()) {
0108       iEvent.put(cscSegtoRPC->thePoints(allCSCSegments.product(), iSetup, debug, ExtrapolatedRegion),
0109                  "RPCCSCExtrapolatedPoints");
0110     } else {
0111       if (debug)
0112         LogDebug("RPCPointProducer") << "RPCHLT Invalid CSCSegments collection" << std::endl;
0113     }
0114   }
0115   if (incltrack) {
0116     edm::Handle<reco::TrackCollection> alltracks;
0117     iEvent.getByToken(tracks, alltracks);
0118     if (!(alltracks->empty())) {
0119       iEvent.put(tracktoRPC->thePoints(alltracks.product(), iSetup, debug), "RPCTrackExtrapolatedPoints");
0120     } else {
0121       if (debug)
0122         LogDebug("RPCPointProducer") << "RPCHLT Invalid Tracks collection" << std::endl;
0123     }
0124   }
0125 }