CMS 3D CMS Logo

EcalLaserCorrectionService.cc
Go to the documentation of this file.
1 //
2 // Toyoko Orimoto (Caltech), 10 July 2007
3 //
4 
5 // system include files
6 #include <iostream>
7 #include <fstream>
8 
10 
13 
15 
16 
18  : ESProducer()
19  // mDumpRequest (),
20  // mDumpStream(0)
21 {
22  //the following line is needed to tell the framework what
23  // data is being produced
24  // setWhatProduced (this, (dependsOn (&EcalLaserCorrectionService::apdpnCallback)));
25 
26  setWhatProduced (this);
27 
28  //now do what ever other initialization is needed
29 
30  // mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
31  // if (!mDumpRequest.empty()) {
32  // std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
33  // mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
34  // }
35 }
36 
37 
39 {
40 
41  // do anything here that needs to be done at desctruction time
42  // (e.g. close files, deallocate resources etc.)
43  // if (mDumpStream != &std::cout) delete mDumpStream;
44 }
45 
46 
47 //
48 // member functions
49 //
50 
51 // ------------ method called to produce the data ------------
52 std::shared_ptr<EcalLaserDbService> EcalLaserCorrectionService::produce( const EcalLaserDbRecord& record)
53 {
54  auto host = holder_.makeOrGet([]() {
55  return new HostType;
56  });
57 
58  host->ifRecordChanges<EcalLinearCorrectionsRcd>(record,
59  [this,h=host.get()](auto const& rec) {
60  setupLinear(rec, *h);
61  });
62 
63  host->ifRecordChanges<EcalLaserAPDPNRatiosRcd>(record,
64  [this,h=host.get()](auto const& rec) {
65  setupApdpn(rec, *h);
66  });
67 
68  host->ifRecordChanges<EcalLaserAPDPNRatiosRefRcd>(record,
69  [this,h=host.get()](auto const& rec) {
70  setupApdpnRef(rec, *h);
71  });
72 
73  host->ifRecordChanges<EcalLaserAlphasRcd>(record,
74  [this,h=host.get()](auto const& rec) {
75  setupAlpha(rec, *h);
76  });
77 
78  return host; // automatically converts to std::shared_ptr<EcalLaserDbService>
79 }
80 
84  fRecord.get (item);
85  service.setAlphaData (item.product ());
86 }
87 
91  fRecord.get (item);
92  service.setAPDPNRefData (item.product ());
93 }
94 
98  fRecord.get (item);
99  service.setAPDPNData (item.product ());
100 }
101 
105  fRecord.get (item);
106  service.setLinearCorrectionsData (item.product ());
107 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
EcalLaserCorrectionService(const edm::ParameterSet &)
host
Definition: query.py:115
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
JetCorrectorParameters::Record record
Definition: classes.h:7
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
void setupLinear(const EcalLinearCorrectionsRcd &fRecord, EcalLaserDbService &service)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void setAlphaData(const EcalLaserAlphas *fItem)
edm::ESProductHost< EcalLaserDbService, EcalLaserAlphasRcd, EcalLaserAPDPNRatiosRefRcd, EcalLaserAPDPNRatiosRcd, EcalLinearCorrectionsRcd > HostType
void setLinearCorrectionsData(const EcalLinearCorrections *fItem)
void setupAlpha(const EcalLaserAlphasRcd &fRecord, EcalLaserDbService &service)
edm::ReusableObjectHolder< HostType > holder_
void setAPDPNData(const EcalLaserAPDPNRatios *fItem)
std::shared_ptr< EcalLaserDbService > produce(const EcalLaserDbRecord &)
void setupApdpnRef(const EcalLaserAPDPNRatiosRefRcd &fRecord, EcalLaserDbService &service)
void setAPDPNRefData(const EcalLaserAPDPNRatiosRef *fItem)
T const * product() const
Definition: ESHandle.h:86
void setupApdpn(const EcalLaserAPDPNRatiosRcd &fRecord, EcalLaserDbService &service)