Skip to content

Commit

Permalink
EgammaAnalysis consumes migration.
Browse files Browse the repository at this point in the history
EgammaAnalysis consumes migration.
  • Loading branch information
Volker Adler committed Mar 19, 2014
1 parent a29b121 commit 7937259
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 110 deletions.
15 changes: 8 additions & 7 deletions EgammaAnalysis/CSA07Skims/interface/EgammaProbeSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

/** \class EgammaProbeSelector
*
*
* Filter to select events passing
*
* Filter to select events passing
* offline jets and superclusters
*
*
Expand All @@ -23,7 +23,8 @@
#include "FWCore/Utilities/interface/InputTag.h"



#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"

#include <math.h>

Expand All @@ -38,14 +39,14 @@ class EgammaProbeSelector : public edm::EDFilter {
private:
bool debug;

edm::InputTag jetLabel;
edm::EDGetTokenT<reco::CaloJetCollection> jetToken;
int minNumberOfjets;
double jetEtMin;
double jetEtaMin;
double jetEtaMax;

edm::InputTag scLabel;
edm::InputTag scEELabel;
edm::EDGetTokenT<reco::SuperClusterCollection> scToken;
edm::EDGetTokenT<reco::SuperClusterCollection> scEEToken;
int minNumberOfSuperClusters;
double scEtMin;
double scEtaMin;
Expand All @@ -56,4 +57,4 @@ class EgammaProbeSelector : public edm::EDFilter {
#endif



66 changes: 32 additions & 34 deletions EgammaAnalysis/CSA07Skims/src/EgammaProbeSelector.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

/** \class EgammaProbeSelector
*
*
*
* This class is an EDFilter for heavy W+jet and Z+jet events
*
*
*/

#include "EgammaAnalysis/CSA07Skims/interface/EgammaProbeSelector.h"
#include "DataFormats/JetReco/interface/Jet.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <iostream>
#include <TMath.h>

using namespace edm;
Expand All @@ -22,18 +20,18 @@ using namespace reco;


EgammaProbeSelector::EgammaProbeSelector(const edm::ParameterSet& iConfig) {
jetLabel = iConfig.getParameter<InputTag>("JetCollection");

jetToken = consumes<CaloJetCollection>(iConfig.getParameter<InputTag>("JetCollection"));
minNumberOfjets = iConfig.getParameter<int>("MinNumberOfJets");
jetEtMin = iConfig.getParameter<double>("JetEtMin");
jetEtaMin = iConfig.getParameter<double>("JetEtaMin");
jetEtaMax = iConfig.getParameter<double>("JetEtaMax");

nEvents = 0;
nSelectedEvents = 0;
scLabel = iConfig.getParameter<InputTag>("SuperClusterBarrelCollection");
scEELabel = iConfig.getParameter<InputTag>("SuperClusterEndCapCollection");

scToken = consumes<SuperClusterCollection>(iConfig.getParameter<InputTag>("SuperClusterBarrelCollection"));
scEEToken = consumes<SuperClusterCollection>(iConfig.getParameter<InputTag>("SuperClusterEndCapCollection"));
minNumberOfSuperClusters = iConfig.getParameter<int>("MinNumberOfSuperClusters");
scEtMin = iConfig.getParameter<double>("ScEtMin");
scEtaMin = iConfig.getParameter<double>("ScEtaMin");
Expand All @@ -42,72 +40,72 @@ EgammaProbeSelector::EgammaProbeSelector(const edm::ParameterSet& iConfig) {


EgammaProbeSelector::~EgammaProbeSelector(){
edm::LogVerbatim("EgammaProbeSelector")
edm::LogVerbatim("EgammaProbeSelector")
<< " Number_events_read " << nEvents
<< " Number_events_kept " << nSelectedEvents
<< " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;

}


bool EgammaProbeSelector::filter(edm::Event& iEvent, const edm::EventSetup& iSetup ){
int nSC = 0;
int nJets = 0;
int nJets = 0;
nEvents++;

// Get reconstructed Jets, check their Et and eta, and count their number
Handle<CaloJetCollection> jetHandle;
iEvent.getByLabel(jetLabel,jetHandle);
iEvent.getByToken(jetToken,jetHandle);

if(jetHandle.isValid()){
const reco::CaloJetCollection & jets = *(jetHandle.product());
CaloJetCollection::const_iterator ijet;
for(ijet = jets.begin(); ijet!= jets.end(); ijet++){
if(ijet->pt() > jetEtMin &&
if(ijet->pt() > jetEtMin &&
ijet->eta() > jetEtaMin &&
ijet->eta() < jetEtaMax )
nJets++;
ijet->eta() < jetEtaMax )
nJets++;
}
}

// Get Super Clusters, check their Et and eta, and count their number
// EB
Handle<reco::SuperClusterCollection> scHandle;
iEvent.getByLabel(scLabel,scHandle);
iEvent.getByToken(scToken,scHandle);

if(scHandle.isValid()){
const reco::SuperClusterCollection & SCs = *(scHandle.product());
for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();

for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();
scIt!= SCs.end(); scIt++){

double scEt = scIt->energy() * TMath::Sin(scIt->position().theta());
double _eta = scIt->position().eta();
if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
}
}

// EE
Handle<reco::SuperClusterCollection> scEEHandle;
iEvent.getByLabel(scEELabel,scEEHandle);
iEvent.getByToken(scEEToken,scEEHandle);

if(scEEHandle.isValid()){
const reco::SuperClusterCollection & SCs = *(scEEHandle.product());
for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();
for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();
scIt!= SCs.end(); scIt++){
double scEt = scIt->energy() * TMath::Sin(scIt->position().theta());

double scEt = scIt->energy() * TMath::Sin(scIt->position().theta());
double _eta = scIt->position().eta();
if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
}
}
}

// Make final desicion on passed events
bool accepted = false;
if(nJets >= minNumberOfjets || nSC >=minNumberOfSuperClusters) {
accepted = true;
nSelectedEvents++;
}

return accepted;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DataFormats/EgammaReco/interface/PreshowerClusterShape.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"

#include "RecoEcal/EgammaClusterAlgos/interface/EndcapPiZeroDiscriminatorAlgo.h"

#include "TH1.h"
Expand All @@ -36,24 +40,24 @@ class PiZeroDiscriminatorProducer : public edm::EDProducer {
int nEvt_; // internal counter of events

//clustering parameters:
std::string preshClusterShapeCollectionX_; // secondary name to be given to collection of cluster produced in this module
std::string preshClusterShapeCollectionY_;
std::string preshClusterShapeProducer_;
edm::EDGetTokenT<reco::PreshowerClusterShapeCollection> pPreshowerShapeClustersXToken_;
edm::EDGetTokenT<reco::PreshowerClusterShapeCollection> pPreshowerShapeClustersYToken_;

std::string photonCorrCollectionProducer_;
std::string correctedPhotonCollection_;
edm::EDGetTokenT<reco::PhotonCollection> correctedPhotonToken_;
std::string PhotonPi0DiscriminatorAssociationMap_;

edm::InputTag barrelRecHitCollection_;
edm::EDGetTokenT<EcalRecHitCollection> barrelRecHitCollectionToken_;
edm::InputTag endcapRecHitCollection_;
edm::EDGetTokenT<EcalRecHitCollection> endcapRecHitCollectionToken_;

int EScorr_;

int EScorr_;
int preshNst_;

int preshNst_;

double preshStripECut_;
double w0_;

double w0_;

EndcapPiZeroDiscriminatorAlgo * presh_pi0_algo; // algorithm doing the real work
enum DebugLevel_pi0 { pDEBUG = 0, pINFO = 1, pERROR = 2 };
Expand Down
Loading

0 comments on commit 7937259

Please sign in to comment.