31 using namespace muonisolation;
36 static const std::string metname =
"RecoMuon|MuonIsolationProducers|MuIsoDepositProducer";
37 LogDebug(metname) <<
" MuIsoDepositProducer CTOR";
45 bool readFromRecoTrack = theInputType ==
"TrackCollection";
46 bool readFromRecoMuon = theInputType ==
"MuonCollection";
47 bool readFromCandidateView = theInputType ==
"CandidateView";
48 if (readFromRecoTrack) {
50 }
else if (readFromRecoMuon) {
52 }
else if (readFromCandidateView) {
55 throw cms::Exception(
"Configuration") <<
"Inconsistent configuration or failure to read Candidate-muon view";
62 .getParameter<std::vector<std::string>>(
"DepositInstanceLabels");
75 LogDebug(metname) <<
" Load extractor..." << extractorName;
80 LogDebug(
"RecoMuon/MuIsoDepositProducer") <<
" MuIsoDepositProducer DTOR";
85 static const std::string metname =
"RecoMuon|MuonIsolationProducers|MuIsoDepositProducer";
87 LogDebug(metname) <<
" Muon Deposit producing..."
88 <<
" BEGINING OF EVENT "
89 <<
"================================";
94 LogTrace(metname) <<
" Taking the muons: "
101 unsigned int nMuons = 0;
103 bool readFromRecoTrack =
theInputType ==
"TrackCollection";
104 bool readFromRecoMuon =
theInputType ==
"MuonCollection";
105 bool readFromCandidateView =
theInputType ==
"CandidateView";
107 if (readFromRecoMuon) {
109 nMuons = muons->size();
110 LogDebug(metname) <<
"Got Muons of size " << nMuons;
112 if (readFromRecoTrack) {
114 nMuons = tracks->size();
115 LogDebug(metname) <<
"Got MuonTracks of size " << nMuons;
119 unsigned int nCands = cands->size();
122 if (nMuons != nCands)
123 edm::LogError(metname) <<
"Inconsistent configuration or failure to read Candidate-muon view";
126 LogDebug(metname) <<
"Got candidate view with size " << nMuons;
129 static const unsigned int MAX_DEPS = 10;
130 std::unique_ptr<reco::IsoDepositMap> depMaps[MAX_DEPS];
133 LogError(metname) <<
"Unable to handle more than 10 input deposits";
134 for (
unsigned int i = 0;
i < nDeps; ++
i) {
135 depMaps[
i] = std::make_unique<reco::IsoDepositMap>();
142 std::vector<std::vector<IsoDeposit>> deps2D(nDeps, std::vector<IsoDeposit>(nMuons));
144 for (
unsigned int i = 0;
i < nMuons; ++
i) {
146 if (readFromRecoMuon) {
154 if (!(*muons)[
i].combinedMuon().isNull()) {
156 }
else if (!(*muons)[
i].
track().isNull()) {
162 if (!(*muons)[
i].
track().isNull()) {
171 }
else if (readFromRecoTrack) {
177 deps2D[0][
i] =
theExtractor->deposit(event, eventSetup, (*cands)[
i]);
179 deps2D[0][
i] =
theExtractor->deposit(event, eventSetup, muRef);
182 std::vector<IsoDeposit>
deps(nDeps);
184 deps =
theExtractor->deposits(event, eventSetup, (*cands)[
i]);
186 deps =
theExtractor->deposits(event, eventSetup, muRef);
187 for (
unsigned int iDep = 0; iDep < nDeps; ++iDep) {
188 deps2D[iDep][
i] = deps[iDep];
194 for (
unsigned int iDep = 0; iDep < nDeps; ++iDep) {
196 for (
unsigned int iMu = 0; iMu < nMuons; ++iMu) {
198 LogTrace(metname) << deps2D[iDep][iMu].print();
205 if (readFromRecoMuon) {
207 }
else if (readFromRecoTrack) {
209 }
else if (readFromCandidateView) {
212 edm::LogError(metname) <<
"Inconsistent configuration: unknown type requested";
220 for (
unsigned int iMap = 0; iMap < nDeps; ++iMap) {
222 << depMaps[iMap]->size() <<
" into edm::Event";
226 LogTrace(metname) <<
" END OF EVENT "
227 <<
"================================";
bool theExtractForCandidate
constexpr unsigned int index() const noexcept
std::vector< std::string > theDepositNames
MuIsoDepositProducer(const edm::ParameterSet &)
constructor
const std::string metname
#define DEFINE_FWK_MODULE(type)
bool theMultipleDepositsFlag
void insert(const H &h, I begin, I end)
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
auto const & tracks
cannot be loose
Log< level::Error, false > LogError
~MuIsoDepositProducer() override
destructor
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
edm::EDGetToken theMuonCollectionTag
std::string theMuonTrackRefType
T getParameter(std::string const &) const
Log< level::Warning, false > LogWarning
void produce(edm::Event &, const edm::EventSetup &) override
data making method