39 static const std::string metname =
"RecoMuon|MuonIsolationProducers|MuIsoDepositProducer";
40 LogDebug(metname)<<
" MuIsoDepositProducer CTOR";
48 bool readFromRecoTrack = theInputType ==
"TrackCollection";
49 bool readFromRecoMuon = theInputType ==
"MuonCollection";
50 bool readFromCandidateView = theInputType ==
"CandidateView";
51 if(readFromRecoTrack){
53 }
else if(readFromRecoMuon) {
55 }
else if (readFromCandidateView) {
58 throw cms::Exception(
"Configuration")<<
"Inconsistent configuration or failure to read Candidate-muon view";
67 .getParameter<std::vector<std::string> >(
"DepositInstanceLabels");
79 LogDebug(metname)<<
" Load extractor..."<<extractorName;
84 LogDebug(
"RecoMuon/MuIsoDepositProducer")<<
" MuIsoDepositProducer DTOR";
89 static const std::string metname =
"RecoMuon|MuonIsolationProducers|MuIsoDepositProducer";
91 LogDebug(metname)<<
" Muon Deposit producing..." 92 <<
" BEGINING OF EVENT " <<
"================================";
107 bool readFromRecoTrack =
theInputType ==
"TrackCollection";
108 bool readFromRecoMuon =
theInputType ==
"MuonCollection";
109 bool readFromCandidateView =
theInputType ==
"CandidateView";
111 if (readFromRecoMuon){
113 nMuons = muons->size();
117 if (readFromRecoTrack){
119 nMuons = tracks->size();
124 unsigned int nCands = cands->size();
127 if (nMuons != nCands)
edm::LogError(metname)<<
"Inconsistent configuration or failure to read Candidate-muon view";
133 static const unsigned int MAX_DEPS=10;
134 std::unique_ptr<reco::IsoDepositMap> depMaps[MAX_DEPS];
136 if (nDeps >10 )
LogError(metname)<<
"Unable to handle more than 10 input deposits";
137 for (
unsigned int i =0;
i<nDeps; ++
i){
138 depMaps[
i] = std::make_unique<reco::IsoDepositMap>();
146 std::vector<std::vector<IsoDeposit> > deps2D(nDeps, std::vector<IsoDeposit>(nMuons));
150 if (readFromRecoMuon){
158 if (!(*muons)[
i].combinedMuon().isNull()){
160 }
else if (!(*muons)[
i].
track().isNull()){
166 if (!(*muons)[
i].
track().isNull()){
175 }
else if (readFromRecoTrack){
181 else deps2D[0][
i] =
theExtractor->deposit(event, eventSetup, muRef);
184 std::vector<IsoDeposit>
deps(nDeps);
186 else 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 <<
" for a muon at index "<<iMu;
199 LogTrace(metname)<<deps2D[iDep][iMu].print();
206 if (readFromRecoMuon){
208 }
else if (readFromRecoTrack){
210 }
else if (readFromCandidateView){
213 edm::LogError(metname)<<
"Inconsistent configuration: unknown type requested";
222 for (
unsigned int iMap = 0; iMap < nDeps; ++iMap){
224 <<
" of size "<<depMaps[iMap]->size()
225 <<
" into edm::Event";
229 LogTrace(metname) <<
" END OF EVENT " <<
"================================";
T getParameter(std::string const &) const
bool theExtractForCandidate
std::vector< std::string > theDepositNames
MuIsoDepositProducer(const edm::ParameterSet &)
constructor
const std::string metname
bool theMultipleDepositsFlag
void insert(const H &h, I begin, I end)
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
~MuIsoDepositProducer() override
destructor
#define DEFINE_FWK_MODULE(type)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
edm::EDGetToken theMuonCollectionTag
std::string theMuonTrackRefType
void produce(edm::Event &, const edm::EventSetup &) override
data making method
unsigned int index() const
T get(const Candidate &c)