47 bool tryAOD()
const{
return data_==AUTO || data_==AOD;}
48 bool tryMiniAOD()
const{
return data_==AUTO || data_==MINIAOD;}
63 const std::vector<T> &
values,
79 for(
auto&
tag : tags) {
82 tokens.push_back(token);
90 auto tagsAOD =iPara.
getParameter<std::vector<edm::InputTag> >(tagAOD);
91 auto tagsMiniAOD =iPara.
getParameter<std::vector<edm::InputTag> >(tagMiniAOD);
94 tokens.resize(maxSize);
96 for(
size_t tagNr=0;tagNr<tagsAOD.size();tagNr++) {
101 for(
size_t tagNr=0;tagNr<tagsMiniAOD.size();tagNr++) {
120 std::vector<edm::Handle<T> > handles(tokens.size());
121 if(tokens.empty())
return handles;
122 if(!tokens[0].
aod.isUninitialized()) iEvent.
getByToken(tokens[0].aod,handles[0]);
123 bool isAOD = handles[0].isValid();
124 if(!isAOD && !tokens[0].
miniAOD.isUninitialized() ) iEvent.
getByToken(tokens[0].miniAOD,handles[0]);
126 for(
size_t tokenNr=1;tokenNr<tokens.size();tokenNr++){
127 auto token = isAOD ? tokens[tokenNr].aod : tokens[tokenNr].miniAOD;
128 if(!token.isUninitialized()) iEvent.
getByToken(token,handles[tokenNr]);
138 std::vector<DualToken<pat::PackedCandidateCollection> >
candTokens_;
184 std::vector<float> eleTrkPtIso;
185 std::vector<int> eleNrSaturateIn5x5;
186 for(
size_t eleNr=0;eleNr<eleHandle->size();eleNr++){
187 auto elePtr = eleHandle->ptrAt(eleNr);
188 eleTrkPtIso.push_back(
calTrkIso(*elePtr,*eleHandle,candHandles));
189 eleNrSaturateIn5x5.push_back(
nrSaturatedCrysIn5x5(*elePtr,ebRecHitHandle,eeRecHitHandle,caloTopoHandle));
214 for(
auto&
handle: handles){
226 const std::vector<T> &
values,
242 desc.
add<std::vector<edm::InputTag> >(
"candsAOD",{
edm::InputTag(
"packedCandidates")});
247 desc.
add<std::vector<edm::InputTag> >(
"candsMiniAOD",{
edm::InputTag(
"packedCandidates")});
249 desc.
add<
int>(
"dataFormat",0);
T getParameter(std::string const &) const
EleTkIsolFromCands trkIsoCalc_
DualToken< EcalRecHitCollection > ebRecHitToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< T > miniAOD
#define DEFINE_FWK_MODULE(type)
static void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< T > &values, const std::string &label)
virtual void produce(edm::Event &, const edm::EventSetup &) override
static int nrSaturatedCrysIn5x5(const reco::GsfElectron &ele, edm::Handle< EcalRecHitCollection > &ebHits, edm::Handle< EcalRecHitCollection > &eeHits, edm::ESHandle< CaloTopology > &caloTopo)
void insert(const H &h, I begin, I end)
std::vector< DualToken< pat::PackedCandidateCollection > > candTokens_
double calIsolPt(const reco::TrackBase &trk, const pat::PackedCandidateCollection &cands, const edm::View< reco::GsfElectron > &eles)
~ElectronHEEPIDValueMapProducer()
std::vector< edm::Handle< T > > getHandles(const edm::Event &iEvent, const std::vector< DualToken< T > > &tokens)
void setToken(edm::EDGetTokenT< T > &token, const edm::ParameterSet &iPara, const std::string &tag)
void addDefault(ParameterSetDescription const &psetDescription)
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
DualToken< edm::View< reco::GsfElectron > > eleToken_
void setToken(DualToken< T > &token, const edm::ParameterSet &iPara, const std::string &tagAOD, const std::string &tagMiniAOD, DataFormat format)
static edm::ParameterSetDescription pSetDescript()
DualToken< EcalRecHitCollection > eeRecHitToken_
static const std::string eleNrSaturateIn5x5Label_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isNull() const
Checks for null.
static const std::string eleTrkPtIsoLabel_
void setToken(std::vector< DualToken< T > > &tokens, const edm::ParameterSet &iPara, const std::string &tagAOD, const std::string &tagMiniAOD, DataFormat format)
T const * product() const
float calTrkIso(const reco::GsfElectron &ele, const edm::View< reco::GsfElectron > &eles, const std::vector< edm::Handle< pat::PackedCandidateCollection > > &handles)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setToken(std::vector< edm::EDGetTokenT< T > > &tokens, const edm::ParameterSet &iPara, const std::string &tagName)
ElectronHEEPIDValueMapProducer(const edm::ParameterSet &)
edm::EDGetTokenT< T > aod
edm::Handle< T > getHandle(const edm::Event &iEvent, const edm::EDGetTokenT< T > &token)
edm::Handle< T > getHandle(const edm::Event &iEvent, const DualToken< T > &token)
void setToken(edm::EDGetTokenT< T > &token, edm::InputTag tag)
T const * product() const
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack