1 #ifndef TauAnalysis_MCEmbeddingTools_EmbeddingKineReweightProducer_h
2 #define TauAnalysis_MCEmbeddingTools_EmbeddingKineReweightProducer_h
57 if ( variable ==
"genDiTauPt" ) {
60 }
else if ( variable ==
"genDiTauMass" ) {
63 }
else if ( variable ==
"genDiTauMassVsGenDiTauPt" ) {
66 }
else if ( variable ==
"genTau2PtVsGenTau1Pt" ) {
69 }
else if ( variable ==
"genTau2EtaVsGenTau1Eta" ) {
73 <<
" Invalid Configuration Parameter 'variable' = " << variable <<
" !!\n";
75 TH1*
lut =
dynamic_cast<TH1*
>(inputFile.Get(lutName.data()));
78 <<
" Failed to load LUT = " << lutName <<
" from file = " << inputFile.GetName() <<
" !!\n";
80 if ( !
lut_->GetSumw2N() )
lut_->Sumw2();
104 bool genTauFound =
false;
109 if ( !(genTau1 && genTau2) ) {
110 std::cerr <<
"Failed to find daughters of genDiTau --> skipping !!" << std::endl;
115 if ( genTau1->
charge() > +0.5 && genTau2->
charge() < -0.5 ) {
116 genTauPlus = genTau1;
117 genTauMinus = genTau2;
118 }
else if ( genTau1->
charge() < -0.5 && genTau2->
charge() > +0.5 ) {
119 genTauPlus = genTau2;
120 genTauMinus = genTau1;
122 std::cerr <<
"Failed to find daughters of genDiTau --> skipping !!" << std::endl;
125 if ( genTauPlus && genTauMinus ) {
127 x = genTauPlus->
pt();
128 y = genTauMinus->
pt();
130 x = genTauPlus->
eta();
131 y = genTauMinus->
eta();
136 if ( !genTauFound ) {
138 <<
"Failed to find gen. Tau decay products --> returning weight = 1.0 !!" << std::endl;
142 int idxBinX =
xAxis_->FindBin(x);
143 if ( idxBinX <= 1 ) idxBinX = 1;
146 int idxBinY =
yAxis_->FindBin(y);
147 if ( idxBinY <= 1 ) idxBinY = 1;
virtual float mass() const =0
mass
lutEntryType(TFile &inputFile, const std::string &variable, const std::string &lutName)
virtual float eta() const =0
momentum pseudorapidity
edm::InputTag srcGenDiTaus_
virtual size_type numberOfDaughters() const
number of daughters
virtual float pt() const =0
transverse momentum
std::vector< lutEntryType * > lutEntries_
std::string variableName_
virtual int charge() const =0
electric charge
double operator()(const reco::Candidate &genDiTau) const
~EmbeddingKineReweightProducer()
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
void produce(edm::Event &, const edm::EventSetup &)
EmbeddingKineReweightProducer(const edm::ParameterSet &)