18 : beamEnergy_(cfg.getParameter<double>(
"beamEnergy")),
19 muonRadiationAlgo_(0),
32 typedef std::vector<double> vdouble;
33 vdouble binningMuonEn = cfg.
getParameter<vdouble>(
"binningMuonEn");
34 int numBinsMuonEn = binningMuonEn.size() - 1;
36 <<
" Invalid Configuration Parameter 'binningMuonEn', must define at least one bin !!\n";
38 unsigned numBinsRadDivMuonEn = cfg.
getParameter<
unsigned>(
"numBinsRadDivMuonEn");
39 double minRadDivMuonEn = cfg.
getParameter<
double>(
"minRadDivMuonEn");
40 double maxRadDivMuonEn = cfg.
getParameter<
double>(
"maxRadDivMuonEn");
42 for (
int iBinMuPlusEn = 0; iBinMuPlusEn < numBinsMuonEn; ++iBinMuPlusEn ) {
43 double minMuPlusEn = binningMuonEn[iBinMuPlusEn];
44 double maxMuPlusEn = binningMuonEn[iBinMuPlusEn + 1];
45 for (
int iBinMuMinusEn = 0; iBinMuMinusEn < numBinsMuonEn; ++iBinMuMinusEn ) {
46 double minMuMinusEn = binningMuonEn[iBinMuMinusEn];
47 double maxMuMinusEn = binningMuonEn[iBinMuMinusEn + 1];
49 new plotEntryType(minMuPlusEn, maxMuPlusEn, minMuMinusEn, maxMuMinusEn,
50 numBinsRadDivMuonEn, minRadDivMuonEn, maxRadDivMuonEn);
56 if ( muonRadiationAlgo_string ==
"" ) {
58 }
else if ( muonRadiationAlgo_string ==
"pythia" ) {
63 }
else if ( muonRadiationAlgo_string ==
"photos" ) {
69 <<
" Invalid Configuration Parameter 'muonRadiationAlgo' = " << muonRadiationAlgo_string <<
" !!\n";
74 for ( std::vector<plotEntryType*>::iterator it =
plotEntries_.begin();
87 for ( std::vector<plotEntryType*>::iterator plotEntry =
plotEntries_.begin();
89 (*plotEntry)->bookHistograms(dir);
95 double evtWeight = 1.0;
96 for ( vInputTag::const_iterator srcWeight =
srcWeights_.begin();
100 evtWeight *= (*weight);
103 if ( evtWeight < 1.e-3 || evtWeight > 1.
e+3 || TMath::IsNaN(evtWeight) )
return;
112 bool genMuonPlus_found =
false;
115 bool genMuonMinus_found =
false;
117 std::vector<int> muonPdgIds;
118 muonPdgIds.push_back(-13);
119 muonPdgIds.push_back(+13);
121 for ( std::vector<reco::CandidateBaseRef>::const_iterator selectedMuon = selectedMuons.begin();
122 selectedMuon != selectedMuons.end(); ++selectedMuon ) {
124 if ( genMuon_matched && genMuon_matched->
charge() > +0.5 ) {
125 genMuonPlusP4_beforeRad = genMuon_matched->
p4();
126 genMuonPlusP4_afterRad = genMuonPlusP4_beforeRad;
128 genMuonPlus_found =
true;
130 if ( genMuon_matched && genMuon_matched->
charge() < -0.5 ) {
131 genMuonMinusP4_beforeRad = genMuon_matched->
p4();
132 genMuonMinusP4_afterRad = genMuonMinusP4_beforeRad;
134 genMuonMinus_found =
true;
138 if ( !(genMuonPlus_found && genMuonMinus_found) )
return;
140 double muonPlusRad = 0.;
141 int muonPlusRad_error = 0;
142 double muonMinusRad = 0.;
143 int muonMinusRad_error = 0;
148 muonPlusRad = genMuonPlusP4_beforeRad.E() - genMuonPlusP4_afterRad.E();
149 muonMinusRad = genMuonMinusP4_beforeRad.E() - genMuonMinusP4_afterRad.E();
152 if ( muonPlusRad_error || muonMinusRad_error )
return;
154 for ( std::vector<plotEntryType*>::iterator plotEntry =
plotEntries_.begin();
156 (*plotEntry)->fillHistograms(genMuonPlusP4_afterRad.E(), muonPlusRad, genMuonMinusP4_afterRad.E(), muonMinusRad, evtWeight);
T getParameter(std::string const &) const
edm::InputTag srcGenParticles_
GenMuonRadiationAlgorithm * muonRadiationAlgo_
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag srcSelectedMuons_
TFileDirectory & tFileDirectory()
GenMuonRadCorrAnalyzer(const edm::ParameterSet &)
void addParameter(std::string const &name, T const &value)
virtual int charge() const
electric charge
const reco::GenParticle * findGenParticleForMCEmbedding(const reco::Candidate::LorentzVector &, const reco::GenParticleCollection &, double, int, const std::vector< int > *, bool)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
~GenMuonRadCorrAnalyzer()
void compGenMuonP4afterRad(const reco::GenParticle *, reco::Candidate::LorentzVector &)
reco::Candidate::LorentzVector compFSR(const edm::StreamID &streamID, const reco::Candidate::LorentzVector &, int, const reco::Candidate::LorentzVector &, int &)
std::vector< edm::InputTag > vInputTag
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
math::XYZTLorentzVector LorentzVector
Lorentz vector.
StreamID streamID() const
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
std::vector< plotEntryType * > plotEntries_