Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:10:59

0001 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecHitDProducer.h>
0002 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecHitDBuilder.h>
0003 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecoConditions.h>
0004 
0005 #include <FWCore/Framework/interface/Frameworkfwd.h>
0006 #include <FWCore/Framework/interface/Event.h>
0007 #include <FWCore/Framework/interface/MakerMacros.h>
0008 #include <DataFormats/Common/interface/Handle.h>
0009 #include <FWCore/Framework/interface/ESHandle.h>
0010 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0011 #include <FWCore/Utilities/interface/Exception.h>
0012 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0013 
0014 #include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h>
0015 
0016 CSCRecHitDProducer::CSCRecHitDProducer(const edm::ParameterSet& ps)
0017     : iRun(0),
0018       useCalib(ps.getParameter<bool>("CSCUseCalibrations")),
0019       useStaticPedestals(ps.getParameter<bool>("CSCUseStaticPedestals")),
0020       useTimingCorrections(ps.getParameter<bool>("CSCUseTimingCorrections")),
0021       useGasGainCorrections(ps.getParameter<bool>("CSCUseGasGainCorrections"))
0022 
0023 {
0024   s_token = consumes<CSCStripDigiCollection>(ps.getParameter<edm::InputTag>("stripDigiTag"));
0025   w_token = consumes<CSCWireDigiCollection>(ps.getParameter<edm::InputTag>("wireDigiTag"));
0026   cscGeom_token = esConsumes<CSCGeometry, MuonGeometryRecord>();
0027 
0028   recHitBuilder_ = new CSCRecHitDBuilder(ps);                        // pass on the parameter sets
0029   recoConditions_ = new CSCRecoConditions(ps, consumesCollector());  // access to conditions data
0030 
0031   recHitBuilder_->setConditions(recoConditions_);  // pass down to who needs access
0032 
0033   // register what this produces
0034   produces<CSCRecHit2DCollection>();
0035 }
0036 
0037 CSCRecHitDProducer::~CSCRecHitDProducer() {
0038   delete recHitBuilder_;
0039   delete recoConditions_;
0040 }
0041 
0042 void CSCRecHitDProducer::produce(edm::Event& ev, const edm::EventSetup& setup) {
0043   // Dumps the message TWICE if both categories are set!
0044   //  LogTrace("CSCRecHitDProducer|CSCRecHit")<< "[CSCRecHitDProducer] starting event " << ev.id().event() << " of run " << ev.id().run();
0045   LogTrace("CSCRecHit") << "[CSCRecHitDProducer] starting event " << ev.id().event() << " of run " << ev.id().run();
0046   // find the geometry for this event & cache it in the builder
0047   edm::ESHandle<CSCGeometry> h = setup.getHandle(cscGeom_token);
0048   const CSCGeometry* pgeom = &*h;
0049   recHitBuilder_->setGeometry(pgeom);
0050 
0051   // access conditions data for this event
0052   if (useCalib || useStaticPedestals || useTimingCorrections || useGasGainCorrections) {
0053     recoConditions_->initializeEvent(setup);
0054   }
0055 
0056   // Get the collections of strip & wire digis from event
0057   edm::Handle<CSCStripDigiCollection> stripDigis;
0058   edm::Handle<CSCWireDigiCollection> wireDigis;
0059 
0060   ev.getByToken(s_token, stripDigis);
0061   ev.getByToken(w_token, wireDigis);
0062 
0063   // Create empty collection of rechits
0064   auto oc = std::make_unique<CSCRecHit2DCollection>();
0065 
0066   // Fill the CSCRecHit2DCollection
0067   recHitBuilder_->build(stripDigis.product(), wireDigis.product(), *oc);
0068 
0069   // Put collection in event
0070   LogTrace("CSCRecHit") << "[CSCRecHitDProducer] putting collection of " << oc->size() << " rechits into event.";
0071   ev.put(std::move(oc));
0072 }
0073 
0074 void CSCRecHitDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0075   edm::ParameterSetDescription desc;
0076   desc.add<double>("CSCStripPeakThreshold", 10.0);
0077   desc.add<double>("CSCStripClusterChargeCut", 25.0);
0078   desc.add<double>("CSCStripxtalksOffset", 0.03);
0079   desc.add<bool>("UseAverageTime", false);
0080   desc.add<bool>("UseParabolaFit", false);
0081   desc.add<bool>("UseFivePoleFit", true);
0082   desc.add<int>("CSCWireClusterDeltaT", 1);
0083   desc.add<bool>("CSCUseCalibrations", true);
0084   desc.add<bool>("CSCUseStaticPedestals", false);
0085   desc.add<int>("CSCNoOfTimeBinsForDynamicPedestal", 2);
0086   desc.add<edm::InputTag>("wireDigiTag", edm::InputTag("muonCSCDigis", "MuonCSCWireDigi"));
0087   desc.add<edm::InputTag>("stripDigiTag", edm::InputTag("muonCSCDigis", "MuonCSCStripDigi"));
0088   desc.add<bool>("readBadChannels", true);
0089   desc.add<bool>("readBadChambers", true);
0090   desc.add<bool>("CSCUseTimingCorrections", true);
0091   desc.add<bool>("CSCUseGasGainCorrections", true);
0092   desc.addUntracked<bool>("CSCDebug", false);
0093   desc.add<int>("CSCstripWireDeltaTime", 8);
0094 
0095   desc.add<double>("XTasymmetry_ME1a", 0.023), desc.add<double>("XTasymmetry_ME1b", 0.01),
0096       desc.add<double>("XTasymmetry_ME12", 0.015), desc.add<double>("XTasymmetry_ME13", 0.02),
0097       desc.add<double>("XTasymmetry_ME21", 0.023), desc.add<double>("XTasymmetry_ME22", 0.023),
0098       desc.add<double>("XTasymmetry_ME31", 0.023), desc.add<double>("XTasymmetry_ME32", 0.023),
0099       desc.add<double>("XTasymmetry_ME41", 0.023), desc.add<double>("ConstSyst_ME1a", 0.01),
0100       desc.add<double>("ConstSyst_ME1b", 0.02), desc.add<double>("ConstSyst_ME12", 0.02),
0101       desc.add<double>("ConstSyst_ME13", 0.03), desc.add<double>("ConstSyst_ME21", 0.03),
0102       desc.add<double>("ConstSyst_ME22", 0.03), desc.add<double>("ConstSyst_ME31", 0.03),
0103       desc.add<double>("ConstSyst_ME32", 0.03), desc.add<double>("ConstSyst_ME41", 0.03),
0104       desc.add<double>("NoiseLevel_ME1a", 9.0), desc.add<double>("NoiseLevel_ME1b", 6.0),
0105       desc.add<double>("NoiseLevel_ME12", 7.0), desc.add<double>("NoiseLevel_ME13", 4.0),
0106       desc.add<double>("NoiseLevel_ME21", 5.0), desc.add<double>("NoiseLevel_ME22", 7.0),
0107       desc.add<double>("NoiseLevel_ME31", 5.0), desc.add<double>("NoiseLevel_ME32", 7.0),
0108       desc.add<double>("NoiseLevel_ME41", 5.0);
0109 
0110   desc.add<bool>("CSCUseReducedWireTimeWindow", false);
0111   desc.add<int>("CSCWireTimeWindowLow", 0);
0112   desc.add<int>("CSCWireTimeWindowHigh", 15);
0113   descriptions.add("cscRecHitDProducer", desc);
0114 }
0115 
0116 //define this as a plug-in
0117 DEFINE_FWK_MODULE(CSCRecHitDProducer);