CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
TauSpinnerTableProducer Class Reference
Inheritance diagram for TauSpinnerTableProducer:
edm::one::EDProducer< edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () final
 
void produce (edm::Event &, const edm::EventSetup &) final
 
 TauSpinnerTableProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

TauSpinner::SimpleParticle convertToSimplePart (const reco::GenParticle &input_part) const
 
void getBosons (edm::RefVector< edm::View< reco::GenParticle >> &bosons, const edm::View< reco::GenParticle > &parts) const
 
void printModuleInfo (edm::ParameterSet const &config) const
 

Static Private Member Functions

static reco::GenParticleRef getLastCopy (const reco::GenParticleRef &part)
 
static bool getTauDaughters (reco::GenParticleRefVector &tau_daughters, const reco::GenParticle &tau)
 
static void getTaus (reco::GenParticleRefVector &taus, const reco::GenParticle &boson)
 
static std::vector< std::pair< std::string, double > > nameAndValue (const std::vector< double > &val_vec)
 

Private Attributes

const int bosonPdgId_
 
const double cmsE_
 
const double default_weight_
 
const edm::EDGetTokenT< edm::View< reco::GenParticle > > genPartsToken_
 
const int ipol_
 
const bool ipp_
 
const std::string name_
 
const int nonSM2_
 
const int nonSMN_
 
std::atomic< unsigned int > nWarnings {0}
 
const std::string tauSpinnerPDF_
 
const std::vector< std::pair< std::string, double > > theta_vec_
 

Static Private Attributes

static const unsigned int nMaxWarnings = 10
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Produces FlatTable with TauSpinner weights for H->tau,tau events

Original Author: D. Winterbottom (IC) Update and adaptation to NanoAOD: M. Bluj (NCBJ)

Definition at line 29 of file TauSpinnerTableProducer.cc.

Constructor & Destructor Documentation

◆ TauSpinnerTableProducer()

TauSpinnerTableProducer::TauSpinnerTableProducer ( const edm::ParameterSet config)
explicit

Definition at line 102 of file TauSpinnerTableProducer.cc.

References edm::SharedResourceNames::kTauola, and printModuleInfo().

103  : genPartsToken_(consumes(config.getParameter<edm::InputTag>("src"))),
104  name_(config.getParameter<std::string>("name")),
105  theta_vec_(nameAndValue(config.getParameter<std::vector<double>>("theta"))),
106  bosonPdgId_(config.getParameter<int>("bosonPdgId")),
108  "NNPDF31_nnlo_hessian_pdfas"), // PDF set for TauSpinner, relevant only in case of Z/gamma* polarization weights (set "sensible" default)
109  ipp_(true), // pp collisions
110  ipol_(0),
111  nonSM2_(0),
112  nonSMN_(0),
113  cmsE_(
114  13600), // collision energy in GeV, relevant only in case of Z/gamma* polarization weights (set "sensible" default)
115  default_weight_(config.getParameter<double>(
116  "defaultWeight")) // default weight stored in case of presence of a tau decay unsupported by TauSpinner
117 {
119 
120  // State that we use tauola/tauspinner resource
121  usesResource(edm::SharedResourceNames::kTauola);
122 
123  produces<nanoaod::FlatTable>();
124 }
void printModuleInfo(edm::ParameterSet const &config) const
static const std::string kTauola
Definition: config.py:1
static std::vector< std::pair< std::string, double > > nameAndValue(const std::vector< double > &val_vec)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::View< reco::GenParticle > > genPartsToken_
const std::vector< std::pair< std::string, double > > theta_vec_

Member Function Documentation

◆ beginJob()

void TauSpinnerTableProducer::beginJob ( void  )
finalvirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 177 of file TauSpinnerTableProducer.cc.

References cmsE_, initialize(), ipol_, ipp_, nonSM2_, nonSMN_, and tauSpinnerPDF_.

177  {
178  // Initialize TauSpinner
179  Tauolapp::Tauola::setNewCurrents(0);
181  LHAPDF::initPDFSetByName(tauSpinnerPDF_);
182  TauSpinner::initialize_spinner(ipp_, ipol_, nonSM2_, nonSMN_, cmsE_);
183 }
static AlgebraicMatrix initialize()

◆ convertToSimplePart()

TauSpinner::SimpleParticle TauSpinnerTableProducer::convertToSimplePart ( const reco::GenParticle input_part) const
inlineprivate

Definition at line 52 of file TauSpinnerTableProducer.cc.

References reco::LeafCandidate::energy(), reco::LeafCandidate::pdgId(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by produce().

52  {
53  return TauSpinner::SimpleParticle(
54  input_part.px(), input_part.py(), input_part.pz(), input_part.energy(), input_part.pdgId());
55  }
double pz() const final
z coordinate of momentum vector
int pdgId() const final
PDG identifier.
double px() const final
x coordinate of momentum vector
double py() const final
y coordinate of momentum vector
double energy() const final
energy

◆ fillDescriptions()

static void TauSpinnerTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 35 of file TauSpinnerTableProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

35  {
37  desc.add<edm::InputTag>("src")->setComment("input genParticle collection");
38  desc.add<std::string>("name")->setComment("name of the TauSpinner weights table");
39  desc.add<std::vector<double>>("theta")->setComment("values of CP-even and CP-odd tau Yukawa mixing angle");
40  desc.ifValue(edm::ParameterDescription<int>("bosonPdgId", 25, true), edm::allowedValues<int>(25, 35, 36))
41  ->setComment("boson pdgId, default: 25"); // Allow only neutral Higgs bosons
42  desc.add<double>("defaultWeight", 1)
43  ->setComment("default weight stored in case of presence of a tau decay unsupported by TauSpinner");
44  descriptions.addWithDefaultLabel(desc);
45  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ getBosons()

void TauSpinnerTableProducer::getBosons ( edm::RefVector< edm::View< reco::GenParticle >> &  bosons,
const edm::View< reco::GenParticle > &  parts 
) const
private

Definition at line 126 of file TauSpinnerTableProducer.cc.

References funct::abs(), bosonPdgId_, and heavyIonCSV_trainingSettings::idx.

Referenced by produce().

127  {
128  unsigned idx = 0;
129  for (const auto &part : parts) {
130  if (std::abs(part.pdgId()) == bosonPdgId_ && part.isLastCopy()) {
132  bosons.push_back(partRef);
133  }
134  ++idx;
135  }
136 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
part
Definition: HCALResponse.h:20
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67

◆ getLastCopy()

reco::GenParticleRef TauSpinnerTableProducer::getLastCopy ( const reco::GenParticleRef part)
staticprivate

Definition at line 138 of file TauSpinnerTableProducer.cc.

Referenced by getTaus().

138  {
139  if (part->statusFlags().isLastCopy())
140  return part;
141  for (const auto &daughter : part->daughterRefVector()) {
142  if (daughter->pdgId() == part->pdgId() && daughter->statusFlags().fromHardProcess()) {
143  return getLastCopy(daughter);
144  }
145  }
146  throw std::runtime_error("getLastCopy: no last copy found");
147 }
static reco::GenParticleRef getLastCopy(const reco::GenParticleRef &part)
part
Definition: HCALResponse.h:20

◆ getTauDaughters()

bool TauSpinnerTableProducer::getTauDaughters ( reco::GenParticleRefVector tau_daughters,
const reco::GenParticle tau 
)
staticprivate

Definition at line 156 of file TauSpinnerTableProducer.cc.

References funct::abs(), and edm::RefVector< C, T, F >::push_back().

Referenced by produce().

156  {
157  static const std::set<int> directTauProducts = {11, 12, 13, 14, 16, 22};
158  static const std::set<int> finalHadrons = {111, 130, 211, 310, 311, 321};
159  static const std::set<int> intermediateHadrons = {221, 223, 323};
160  for (auto daughterRef : tau.daughterRefVector()) {
161  const int daughter_pdgId = std::abs(daughterRef->pdgId());
162  if ((std::abs(tau.pdgId()) == 15 && directTauProducts.count(daughter_pdgId)) ||
163  finalHadrons.count(daughter_pdgId)) {
164  tau_daughters.push_back(daughterRef);
165  } else if (intermediateHadrons.count(daughter_pdgId)) {
166  if (!getTauDaughters(tau_daughters, *daughterRef))
167  return false;
168  } else {
169  edm::LogWarning("TauSpinnerTableProducer::getTauDaughters")
170  << "Unsupported decay with " << daughter_pdgId << " being daughter of " << std::abs(tau.pdgId()) << "\n";
171  return false;
172  }
173  }
174  return true;
175 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool getTauDaughters(reco::GenParticleRefVector &tau_daughters, const reco::GenParticle &tau)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
Log< level::Warning, false > LogWarning

◆ getTaus()

void TauSpinnerTableProducer::getTaus ( reco::GenParticleRefVector taus,
const reco::GenParticle boson 
)
staticprivate

Definition at line 149 of file TauSpinnerTableProducer.cc.

References funct::abs(), reco::CompositeRefCandidateT< D >::daughterRefVector(), getLastCopy(), and Tau3MuMonitor_cff::taus.

Referenced by produce().

149  {
150  for (const auto &daughterRef : boson.daughterRefVector()) {
151  if (std::abs(daughterRef->pdgId()) == 15)
152  taus.push_back(getLastCopy(daughterRef));
153  }
154 }
const daughters & daughterRefVector() const
references to daughtes
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static reco::GenParticleRef getLastCopy(const reco::GenParticleRef &part)

◆ nameAndValue()

static std::vector<std::pair<std::string, double> > TauSpinnerTableProducer::nameAndValue ( const std::vector< double > &  val_vec)
inlinestaticprivate

Definition at line 57 of file TauSpinnerTableProducer.cc.

References mergeVDriftHistosByStation::name, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and heppy_batch::val.

57  {
58  std::vector<std::pair<std::string, double>> out;
59  for (auto val : val_vec) {
61  name.erase(name.find_last_not_of('0') + 1, std::string::npos);
62  name.erase(name.find_last_not_of('.') + 1, std::string::npos);
63  size_t pos = name.find(".");
64  if (pos != std::string::npos)
65  name.replace(pos, 1, "p");
66  pos = name.find("-");
67  if (pos != std::string::npos)
68  name.replace(pos, 1, "minus");
69  out.push_back(std::make_pair(name, val));
70  }
71  return out;
72  }
static std::string to_string(const XMLCh *ch)

◆ printModuleInfo()

void TauSpinnerTableProducer::printModuleInfo ( edm::ParameterSet const &  config) const
inlineprivate

Definition at line 74 of file TauSpinnerTableProducer.cc.

References gather_cfg::cout, alcaDQMUpload::encode(), AlCaHLTBitMon_QueryRunRegistry::string, tauSpinnerTable_cfi::theta, and theta_vec_.

Referenced by TauSpinnerTableProducer().

74  {
75  std::cout << std::string(78, '-') << "\n";
76  std::cout << config.getParameter<std::string>("@module_type") << '/'
77  << config.getParameter<std::string>("@module_label") << "\n";
78  std::cout << "Input collection: " << config.getParameter<edm::InputTag>("src").encode() << '\n';
79  std::cout << "Table name: " << config.getParameter<std::string>("name") << '\n';
80  std::string thetaStr;
81  for (const auto &theta : theta_vec_)
82  thetaStr += theta.first + ",";
83  std::cout << "Theta: " << thetaStr << std::endl;
84  }
Definition: config.py:1
const std::vector< std::pair< std::string, double > > theta_vec_
def encode(args, files)

◆ produce()

void TauSpinnerTableProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
finalvirtual

Implements edm::one::EDProducerBase.

Definition at line 185 of file TauSpinnerTableProducer.cc.

References convertToSimplePart(), funct::cos(), default_weight_, genPartsToken_, getBosons(), getTauDaughters(), getTaus(), mps_fire::i, M_PI, eostools::move(), name_, nMaxWarnings, nWarnings, funct::sin(), edm::RefVector< C, T, F >::size(), Tau3MuMonitor_cff::taus, tauSpinnerTable_cfi::theta, theta_vec_, and hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights.

185  {
186  // Input gen-particles collection
187  auto const &genParts = event.get(genPartsToken_);
188 
189  // Output table
190  auto wtTable = std::make_unique<nanoaod::FlatTable>(1, name_, true);
191  wtTable->setDoc("TauSpinner weights");
192 
193  // Search for boson
195  getBosons(bosons, genParts);
196  if (bosons.size() !=
197  1) { // no boson found or more than one found, produce table with default weights (expected for non HTT samples)
198  if (++nWarnings < nMaxWarnings)
199  edm::LogWarning("TauSpinnerTableProducer::produce")
200  << "Current event has " << bosons.size()
201  << " Higgs bosons while there must be exactly one; table with default weights is produced.\n";
202  // Fill table with default values
203  for (const auto &theta : theta_vec_) {
204  wtTable->addColumnValue<double>(
205  "weight_cp_" + theta.first, default_weight_, "TauSpinner weight for theta_CP = " + theta.first);
206  wtTable->addColumnValue<double>(
207  "weight_cp_" + theta.first + "_alt",
209  "TauSpinner weight for theta_CP = " + theta.first + " (alternative hadronic currents)");
210  }
211  event.put(std::move(wtTable));
212  return;
213  }
214 
215  // Search for taus from boson decay
217  getTaus(taus, *bosons[0]);
218  if (taus.size() !=
219  2) { // boson does not decay to tau pair, produce table with default weights (expected for non HTT samples)
220  if (++nWarnings < nMaxWarnings)
221  edm::LogWarning("TauSpinnerTableProducer::produce")
222  << "Current event has " << taus.size()
223  << " taus from boson decay while there must be exactly one pair; table with default weights is produced.\n";
224  // Fill table with default values
225  for (const auto &theta : theta_vec_) {
226  wtTable->addColumnValue<double>(
227  "weight_cp_" + theta.first, default_weight_, "TauSpinner weight for theta_CP = " + theta.first);
228  wtTable->addColumnValue<double>(
229  "weight_cp_" + theta.first + "_alt",
231  "TauSpinner weight for theta_CP = " + theta.first + " (alternative hadronic currents)");
232  }
233  event.put(std::move(wtTable));
234  return;
235  }
236 
237  // Get tau daughters and convert all particles to TauSpinner format
238  TauSpinner::SimpleParticle simple_boson = convertToSimplePart(*bosons[0]);
239  std::array<TauSpinner::SimpleParticle, 2> simple_taus;
240  std::array<std::vector<TauSpinner::SimpleParticle>, 2> simple_tau_daughters;
241  bool supportedDecays = true;
242  for (size_t tau_idx = 0; tau_idx < 2; ++tau_idx) {
243  simple_taus[tau_idx] = convertToSimplePart(*taus[tau_idx]);
244  reco::GenParticleRefVector tau_daughters;
245  supportedDecays &= getTauDaughters(tau_daughters, *taus[tau_idx]);
246  for (const auto &daughterRef : tau_daughters)
247  simple_tau_daughters[tau_idx].push_back(convertToSimplePart(*daughterRef));
248  }
249 
250  // Compute TauSpinner weights and fill table
251  std::array<double, 2> weights;
252  for (const auto &theta : theta_vec_) {
253  // Can make this more general by having boson pdgid as input or have option for set boson type
254  TauSpinner::setHiggsParametersTR(-cos(2 * M_PI * theta.second),
255  cos(2 * M_PI * theta.second),
256  -sin(2 * M_PI * theta.second),
257  -sin(2 * M_PI * theta.second));
258  for (size_t i = 0; i < weights.size(); ++i) {
259  Tauolapp::Tauola::setNewCurrents(i);
260  weights[i] =
261  supportedDecays
262  ? TauSpinner::calculateWeightFromParticlesH(
263  simple_boson, simple_taus[0], simple_taus[1], simple_tau_daughters[0], simple_tau_daughters[1])
264  : default_weight_;
265  }
266  // Nominal weights for setNewCurrents(0)
267  wtTable->addColumnValue<double>(
268  "weight_cp_" + theta.first, weights[0], "TauSpinner weight for theta_CP=" + theta.first);
269  // Weights for alternative hadronic currents (can be used for uncertainty estimates)
270  wtTable->addColumnValue<double>(
271  "weight_cp_" + theta.first + "_alt",
272  weights[1],
273  "TauSpinner weight for theta_CP=" + theta.first + " (alternative hadronic currents)");
274  }
275 
276  event.put(std::move(wtTable));
277 }
TauSpinner::SimpleParticle convertToSimplePart(const reco::GenParticle &input_part) const
static void getTaus(reco::GenParticleRefVector &taus, const reco::GenParticle &boson)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static bool getTauDaughters(reco::GenParticleRefVector &tau_daughters, const reco::GenParticle &tau)
#define M_PI
const edm::EDGetTokenT< edm::View< reco::GenParticle > > genPartsToken_
void getBosons(edm::RefVector< edm::View< reco::GenParticle >> &bosons, const edm::View< reco::GenParticle > &parts) const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
const std::vector< std::pair< std::string, double > > theta_vec_
std::atomic< unsigned int > nWarnings
static const unsigned int nMaxWarnings
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bosonPdgId_

const int TauSpinnerTableProducer::bosonPdgId_
private

Definition at line 89 of file TauSpinnerTableProducer.cc.

Referenced by getBosons().

◆ cmsE_

const double TauSpinnerTableProducer::cmsE_
private

Definition at line 95 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ default_weight_

const double TauSpinnerTableProducer::default_weight_
private

Definition at line 96 of file TauSpinnerTableProducer.cc.

Referenced by produce().

◆ genPartsToken_

const edm::EDGetTokenT<edm::View<reco::GenParticle> > TauSpinnerTableProducer::genPartsToken_
private

Definition at line 86 of file TauSpinnerTableProducer.cc.

Referenced by produce().

◆ ipol_

const int TauSpinnerTableProducer::ipol_
private

Definition at line 92 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ ipp_

const bool TauSpinnerTableProducer::ipp_
private

Definition at line 91 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ name_

const std::string TauSpinnerTableProducer::name_
private

Definition at line 87 of file TauSpinnerTableProducer.cc.

Referenced by produce().

◆ nMaxWarnings

const unsigned int TauSpinnerTableProducer::nMaxWarnings = 10
staticprivate

Definition at line 99 of file TauSpinnerTableProducer.cc.

Referenced by produce().

◆ nonSM2_

const int TauSpinnerTableProducer::nonSM2_
private

Definition at line 93 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ nonSMN_

const int TauSpinnerTableProducer::nonSMN_
private

Definition at line 94 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ nWarnings

std::atomic<unsigned int> TauSpinnerTableProducer::nWarnings {0}
private

Definition at line 98 of file TauSpinnerTableProducer.cc.

Referenced by produce().

◆ tauSpinnerPDF_

const std::string TauSpinnerTableProducer::tauSpinnerPDF_
private

Definition at line 90 of file TauSpinnerTableProducer.cc.

Referenced by beginJob().

◆ theta_vec_

const std::vector<std::pair<std::string, double> > TauSpinnerTableProducer::theta_vec_
private

Definition at line 88 of file TauSpinnerTableProducer.cc.

Referenced by printModuleInfo(), and produce().