Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h"
00018 #include "L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h"
00019
00020 #include "DataFormats/Common/interface/Handle.h"
00021 #include "FWCore/Framework/interface/ESHandle.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023
00024 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00025 #include "L1Trigger/CSCCommonTrigger/interface/CSCTriggerGeometry.h"
00026 #include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h"
00027
00028 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
00029 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00030 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
00031 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
00032 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00033
00034
00035 #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h"
00036 #include "CondFormats/DataRecord/interface/CSCDBL1TPParametersRcd.h"
00037
00038
00039 CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterSet& conf) : iev(0) {
00040
00041 wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
00042 compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
00043
00044 lctBuilder_ = new CSCTriggerPrimitivesBuilder(conf);
00045
00046
00047 produces<CSCALCTDigiCollection>();
00048 produces<CSCCLCTDigiCollection>();
00049 produces<CSCCLCTPreTriggerCollection>();
00050 produces<CSCCorrelatedLCTDigiCollection>();
00051 produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
00052 }
00053
00054 CSCTriggerPrimitivesProducer::~CSCTriggerPrimitivesProducer() {
00055 LogDebug("L1CSCTrigger")
00056 << "deleting trigger primitives after " << iev << " events.";
00057 delete lctBuilder_;
00058 }
00059
00060
00061
00062
00063 void CSCTriggerPrimitivesProducer::produce(edm::Event& ev,
00064 const edm::EventSetup& setup) {
00065
00066 LogDebug("L1CSCTrigger") << "start producing LCTs for event " << ++iev;
00067
00068
00069
00070 {
00071 edm::ESHandle<CSCGeometry> h;
00072 setup.get<MuonGeometryRecord>().get(h);
00073 CSCTriggerGeometry::setGeometry(h);
00074 }
00075
00076
00077 edm::ESHandle<CSCBadChambers> pBadChambers;
00078 setup.get<CSCBadChambersRcd>().get(pBadChambers);
00079
00080
00081
00082
00083 edm::ESHandle<CSCDBL1TPParameters> conf;
00084 setup.get<CSCDBL1TPParametersRcd>().get(conf);
00085 if (conf.product() == 0) {
00086 edm::LogError("L1CSCTPEmulatorConfigError")
00087 << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
00088 << "+++ Cannot continue emulation without these parameters +++\n";
00089 return;
00090 }
00091 lctBuilder_->setConfigParameters(conf.product());
00092
00093
00094 edm::Handle<CSCComparatorDigiCollection> compDigis;
00095 edm::Handle<CSCWireDigiCollection> wireDigis;
00096 ev.getByLabel(compDigiProducer_.label(), compDigiProducer_.instance(), compDigis);
00097 ev.getByLabel(wireDigiProducer_.label(), wireDigiProducer_.instance(), wireDigis);
00098
00099
00100
00101 std::auto_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
00102 std::auto_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
00103 std::auto_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
00104 std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
00105 std::auto_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
00106
00107 if (!wireDigis.isValid()) {
00108 edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
00109 << "+++ Warning: Collection of wire digis with label "
00110 << wireDigiProducer_.label()
00111 << " requested in configuration, but not found in the event..."
00112 << " Skipping production of CSC TP digis +++\n";
00113 }
00114 if (!compDigis.isValid()) {
00115 edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
00116 << "+++ Warning: Collection of comparator digis with label "
00117 << compDigiProducer_.label()
00118 << " requested in configuration, but not found in the event..."
00119 << " Skipping production of CSC TP digis +++\n";
00120 }
00121
00122
00123 if (wireDigis.isValid() && compDigis.isValid()) {
00124 lctBuilder_->build(pBadChambers.product(),
00125 wireDigis.product(), compDigis.product(),
00126 *oc_alct, *oc_clct, *oc_pretrig, *oc_lct, *oc_sorted_lct);
00127 }
00128
00129
00130 ev.put(oc_alct);
00131 ev.put(oc_clct);
00132 ev.put(oc_pretrig);
00133 ev.put(oc_lct);
00134 ev.put(oc_sorted_lct,"MPCSORTED");
00135 }