-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Premix option c, with 2 tags, ECAL, 11_0_X #27974
Closed
amassiro
wants to merge
14
commits into
cms-sw:master
from
amassiro:amassiro_premix_OptionC_2tags_ECAL
Closed
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e4137ba
first commit: still 1 as default ratio, to be fixed
amassiro 03ab99b
now handling time correctly
amassiro dc49146
now it works properly, with the ratio of two Laser Corrections based …
amassiro 71bf619
fix to deal with run and not time for time dependent MC
amassiro c06e80a
new files
amassiro bf32aba
update to deal with new procedure and new files
amassiro e3a07d8
adapt to new format
amassiro dfe420a
update to load correctly new tag MC
amassiro ce44d01
just some cleaning
amassiro 31a0f90
code-format run
amassiro fc64b7b
fix to remove warning in compilation
amassiro 7f2f831
code format
amassiro 96e19d3
cleaning commented code and use of messagelogger instead of cout
amassiro 260a61d
code format
amassiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecordMC.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Toyoko Orimoto (Caltech), 10 July 2007 | ||
// Andrea Massironi, 3 Aug 2019 | ||
// | ||
|
||
#ifndef ECALLASERCORRECTION_ECALLASERDBRECORDMC_H | ||
#define ECALLASERCORRECTION_ECALLASERDBRECORDMC_H | ||
|
||
#include "boost/mpl/vector.hpp" | ||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
// #include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
|
||
#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosMCRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" | ||
|
||
// class EcalLaserDbRecordMC : public edm::eventsetup::EventSetupRecordMCImplementation<EcalLaserDbRecordMC> {}; | ||
|
||
class EcalLaserDbRecordMC | ||
: public edm::eventsetup::DependentRecordImplementation<EcalLaserDbRecordMC, | ||
boost::mpl::vector<EcalLaserAlphasRcd, | ||
EcalLaserAPDPNRatiosRefRcd, | ||
EcalLaserAPDPNRatiosMCRcd, | ||
EcalLinearCorrectionsRcd> > {}; | ||
|
||
#endif /* ECALLASERCORRECTION_ECALLASERDBRECORDMC_H */ |
49 changes: 49 additions & 0 deletions
49
CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbServiceMC.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Toyoko Orimoto (Caltech), 10 July 2007 | ||
// | ||
|
||
#ifndef EcalLaserDbServiceMC_h | ||
#define EcalLaserDbServiceMC_h | ||
|
||
#include <memory> | ||
#include <tbb/concurrent_unordered_set.h> | ||
|
||
#include "DataFormats/DetId/interface/DetId.h" | ||
#include "DataFormats/EcalDetId/interface/EBDetId.h" | ||
#include "DataFormats/EcalDetId/interface/EEDetId.h" | ||
#include "DataFormats/Provenance/interface/Timestamp.h" | ||
|
||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
||
#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" | ||
#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" | ||
#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosMC.h" | ||
#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" | ||
|
||
class EcalLaserDbServiceMC { | ||
public: | ||
EcalLaserDbServiceMC(); | ||
|
||
const EcalLaserAlphas* getAlphas() const; | ||
const EcalLaserAPDPNRatiosRef* getAPDPNRatiosRef() const; | ||
const EcalLaserAPDPNRatiosMC* getAPDPNRatiosMC() const; | ||
const EcalLinearCorrections* getLinearCorrections() const; | ||
float getLaserCorrection(DetId const& xid, edm::Timestamp const& iTime) const; | ||
|
||
void setAlphaData(const EcalLaserAlphas* fItem) { mAlphas_ = fItem; } | ||
void setAPDPNRefData(const EcalLaserAPDPNRatiosRef* fItem) { mAPDPNRatiosRef_ = fItem; } | ||
void setAPDPNData(const EcalLaserAPDPNRatiosMC* fItem) { mAPDPNRatiosMC_ = fItem; } | ||
void setLinearCorrectionsData(const EcalLinearCorrections* fItem) { mLinearCorrections_ = fItem; } | ||
|
||
private: | ||
const EcalLaserAlphas* mAlphas_; | ||
const EcalLaserAPDPNRatiosRef* mAPDPNRatiosRef_; | ||
const EcalLaserAPDPNRatiosMC* mAPDPNRatiosMC_; | ||
const EcalLinearCorrections* mLinearCorrections_; | ||
|
||
typedef tbb::concurrent_unordered_set<uint32_t> ErrorMapT; | ||
mutable ErrorMapT channelsWithInvalidCorrection_; | ||
}; | ||
|
||
#endif |
90 changes: 90 additions & 0 deletions
90
CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionServiceMC.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
// Toyoko Orimoto (Caltech), 10 July 2007 | ||
// Andrea Massironi, 3 Aug 2019 | ||
// | ||
|
||
// system include files | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbServiceMC.h" | ||
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecordMC.h" | ||
|
||
#include "CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionServiceMC.h" | ||
|
||
EcalLaserCorrectionServiceMC::EcalLaserCorrectionServiceMC(const edm::ParameterSet& fConfig) | ||
: ESProducer() | ||
// mDumpRequest (), | ||
// mDumpStream(0) | ||
{ | ||
//the following line is needed to tell the framework what | ||
// data is being produced | ||
// setWhatProduced (this, (dependsOn (&EcalLaserCorrectionServiceMC::apdpnCallback))); | ||
|
||
setWhatProduced(this); | ||
|
||
//now do what ever other initialization is needed | ||
|
||
// mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>()); | ||
// if (!mDumpRequest.empty()) { | ||
// std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", ""); | ||
// mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str()); | ||
// } | ||
} | ||
|
||
EcalLaserCorrectionServiceMC::~EcalLaserCorrectionServiceMC() { | ||
// do anything here that needs to be done at desctruction time | ||
// (e.g. close files, deallocate resources etc.) | ||
// if (mDumpStream != &std::cout) delete mDumpStream; | ||
} | ||
|
||
// | ||
// member functions | ||
// | ||
|
||
// ------------ method called to produce the data ------------ | ||
std::shared_ptr<EcalLaserDbServiceMC> EcalLaserCorrectionServiceMC::produce(const EcalLaserDbRecordMC& record) { | ||
auto host = holder_.makeOrGet([]() { return new HostType; }); | ||
|
||
host->ifRecordChanges<EcalLinearCorrectionsRcd>(record, | ||
[this, h = host.get()](auto const& rec) { setupLinear(rec, *h); }); | ||
|
||
host->ifRecordChanges<EcalLaserAPDPNRatiosMCRcd>(record, | ||
[this, h = host.get()](auto const& rec) { setupApdpn(rec, *h); }); | ||
|
||
host->ifRecordChanges<EcalLaserAPDPNRatiosRefRcd>( | ||
record, [this, h = host.get()](auto const& rec) { setupApdpnRef(rec, *h); }); | ||
|
||
host->ifRecordChanges<EcalLaserAlphasRcd>(record, [this, h = host.get()](auto const& rec) { setupAlpha(rec, *h); }); | ||
|
||
return host; // automatically converts to std::shared_ptr<EcalLaserDbServiceMC> | ||
} | ||
|
||
void EcalLaserCorrectionServiceMC::setupAlpha(const EcalLaserAlphasRcd& fRecord, EcalLaserDbServiceMC& service) { | ||
edm::ESHandle<EcalLaserAlphas> item; | ||
fRecord.get(item); | ||
service.setAlphaData(item.product()); | ||
} | ||
|
||
void EcalLaserCorrectionServiceMC::setupApdpnRef(const EcalLaserAPDPNRatiosRefRcd& fRecord, | ||
EcalLaserDbServiceMC& service) { | ||
edm::ESHandle<EcalLaserAPDPNRatiosRef> item; | ||
fRecord.get(item); | ||
service.setAPDPNRefData(item.product()); | ||
} | ||
|
||
void EcalLaserCorrectionServiceMC::setupApdpn(const EcalLaserAPDPNRatiosMCRcd& fRecord, EcalLaserDbServiceMC& service) { | ||
edm::ESHandle<EcalLaserAPDPNRatiosMC> item; | ||
fRecord.get(item); | ||
service.setAPDPNData(item.product()); | ||
} | ||
|
||
void EcalLaserCorrectionServiceMC::setupLinear(const EcalLinearCorrectionsRcd& fRecord, EcalLaserDbServiceMC& service) { | ||
edm::ESHandle<EcalLinearCorrections> item; | ||
fRecord.get(item); | ||
service.setLinearCorrectionsData(item.product()); | ||
} | ||
|
||
DEFINE_FWK_EVENTSETUP_MODULE(EcalLaserCorrectionServiceMC); |
47 changes: 47 additions & 0 deletions
47
CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionServiceMC.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Toyoko Orimoto (Caltech), 10 July 2007 | ||
// Andrea Massironi, 3 Aug 2019 | ||
// | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
#include "FWCore/Framework/interface/ESProductHost.h" | ||
#include "FWCore/Utilities/interface/ReusableObjectHolder.h" | ||
|
||
class EcalLaserDbServiceMC; | ||
class EcalLaserDbRecordMC; | ||
|
||
#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosMCRcd.h" | ||
#include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" | ||
|
||
class EcalLaserCorrectionServiceMC : public edm::ESProducer { | ||
public: | ||
EcalLaserCorrectionServiceMC(const edm::ParameterSet&); | ||
~EcalLaserCorrectionServiceMC() override; | ||
|
||
std::shared_ptr<EcalLaserDbServiceMC> produce(const EcalLaserDbRecordMC&); | ||
|
||
private: | ||
using HostType = edm::ESProductHost<EcalLaserDbServiceMC, | ||
EcalLaserAlphasRcd, | ||
EcalLaserAPDPNRatiosRefRcd, | ||
EcalLaserAPDPNRatiosMCRcd, | ||
EcalLinearCorrectionsRcd>; | ||
|
||
void setupAlpha(const EcalLaserAlphasRcd& fRecord, EcalLaserDbServiceMC& service); | ||
void setupApdpnRef(const EcalLaserAPDPNRatiosRefRcd& fRecord, EcalLaserDbServiceMC& service); | ||
void setupApdpn(const EcalLaserAPDPNRatiosMCRcd& fRecord, EcalLaserDbServiceMC& service); | ||
void setupLinear(const EcalLinearCorrectionsRcd& fRecord, EcalLaserDbServiceMC& service); | ||
|
||
// ----------member data --------------------------- | ||
edm::ReusableObjectHolder<HostType> holder_; | ||
|
||
// std::vector<std::string> mDumpRequest; | ||
// std::ostream* mDumpStream; | ||
}; |
5 changes: 5 additions & 0 deletions
5
CalibCalorimetry/EcalLaserCorrection/src/EcalLaserDbRecordMC.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecordMC.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
|
||
EVENTSETUP_RECORD_REG(EcalLaserDbRecordMC); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amassiro why all this commented code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove it if needed.
I followed the same structure as
https://github.com/cms-sw/cmssw/blob/master/CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionService.cc
... where also there a lot of commented code is written.