Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <memory>
00011 #include "boost/shared_ptr.hpp"
00012
00013
00014 #include "CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.h"
00015 #include "FWCore/Framework/interface/SourceFactory.h"
00016
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/Framework/interface/ESTransientHandle.h"
00019 #include "FWCore/Framework/interface/EventSetup.h"
00020
00021 #include "CondFormats/DTObjects/interface/DTT0.h"
00022 #include "CondFormats/DataRecord/interface/DTT0Rcd.h"
00023 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
00024
00025 #include "Geometry/MuonNumbering/interface/MuonDDDConstants.h"
00026 #include <DetectorDescription/Core/interface/DDCompactView.h>
00027 #include "CalibMuon/DTCalibration/plugins/DTGeometryParserFromDDD.h"
00028
00029 using namespace std;
00030
00031 DTFakeT0ESProducer::DTFakeT0ESProducer(const edm::ParameterSet& pset)
00032 {
00033
00034 setWhatProduced(this,&DTFakeT0ESProducer::produce);
00035
00036 findingRecord<DTT0Rcd>();
00037
00038
00039 t0Mean = pset.getParameter<double>("t0Mean");
00040 t0Sigma = pset.getParameter<double>("t0Sigma");
00041 }
00042
00043
00044 DTFakeT0ESProducer::~DTFakeT0ESProducer(){
00045 }
00046
00047
00048
00049 DTT0* DTFakeT0ESProducer::produce(const DTT0Rcd& iRecord){
00050
00051 parseDDD(iRecord);
00052 DTT0* t0Map = new DTT0();
00053
00054
00055 for(map<DTLayerId, pair <unsigned int,unsigned int> >::const_iterator lIdWire = theLayerIdWiresMap.begin();
00056 lIdWire != theLayerIdWiresMap.end();
00057 lIdWire++){
00058 int firstWire = ((*lIdWire).second).first;
00059 int nWires = ((*lIdWire).second).second;
00060
00061 for(int wire=0; wire < nWires; wire++){
00062 t0Map->set(DTWireId((*lIdWire).first, wire + firstWire), t0Mean, t0Sigma, DTTimeUnits::counts);
00063 }
00064 }
00065
00066 return t0Map;
00067 }
00068
00069 void DTFakeT0ESProducer::parseDDD(const DTT0Rcd& iRecord){
00070
00071 edm::ESTransientHandle<DDCompactView> cpv;
00072 edm::ESHandle<MuonDDDConstants> mdc;
00073
00074 iRecord.getRecord<IdealGeometryRecord>().get(cpv);
00075 iRecord.getRecord<MuonNumberingRecord>().get(mdc);
00076
00077 DTGeometryParserFromDDD parser(&(*cpv), *mdc, theLayerIdWiresMap);
00078 }
00079
00080 void DTFakeT0ESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue&,
00081 edm::ValidityInterval & oValidity){
00082 oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(),edm::IOVSyncValue::endOfTime());
00083 }
00084
00085