CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
BPHWriteSpecificDecay Class Reference

#include <BPHWriteSpecificDecay.h>

Inheritance diagram for BPHWriteSpecificDecay:
BPHAnalyzerWrapper< BPHModuleWrapper::one_producer > edm::one::EDProducer< T > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
 BPHWriteSpecificDecay (const edm::ParameterSet &ps)
 
void endJob () override
 
virtual void fill (edm::Event &ev, const edm::EventSetup &es)
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 ~BPHWriteSpecificDecay () override
 
- Public Member Functions inherited from edm::one::EDProducer< T >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 Types

typedef edm::Ref< pat::CompositeCandidateCollectioncompcc_ref
 
enum  parType {
  ptMin, etaMax, mPsiMin, mPsiMax,
  mKx0Min, mKx0Max, mPhiMin, mPhiMax,
  massMin, massMax, probMin, mFitMin,
  mFitMax, constrMass, constrSigma, constrMJPsi,
  writeCandidate
}
 
enum  recoType {
  Onia, Pmm, Psi1, Psi2,
  Ups, Ups1, Ups2, Ups3,
  Kx0, Pkk, Bu, Bd,
  Bs
}
 
typedef edm::Ref< std::vector< reco::Vertex > > vertex_ref
 

Private Member Functions

void setRecoParameters (const edm::ParameterSet &ps)
 
template<class T >
edm::OrphanHandle< pat::CompositeCandidateCollectionwrite (edm::Event &ev, const std::vector< T > &list, const std::string &name)
 

Private Attributes

std::string bdName
 
std::string bsName
 
std::string buName
 
std::string ccCandsLabel
 
BPHTokenWrapper< std::vector< pat::CompositeCandidate > > ccCandsToken
 
std::map< const BPHRecoCandidate *, compcc_refccRefMap
 
std::map< std::string, parTypefMap
 
std::string gpCandsLabel
 
BPHTokenWrapper< std::vector< pat::GenericParticle > > gpCandsToken
 
std::map< const BPHRecoCandidate *, const BPHRecoCandidate * > jPsiOMap
 
std::vector< BPHRecoConstCandPtrlBd
 
std::vector< BPHRecoConstCandPtrlBs
 
std::vector< BPHRecoConstCandPtrlBu
 
std::vector< BPHPlusMinusConstCandPtrlFull
 
std::vector< BPHPlusMinusConstCandPtrlJPsi
 
std::vector< BPHRecoConstCandPtrlSd
 
std::vector< BPHRecoConstCandPtrlSs
 
std::string oniaName
 
std::map< recoType, std::map< parType, double > > parMap
 
std::string patMuonLabel
 
BPHTokenWrapper< pat::MuonCollectionpatMuonToken
 
std::string pcCandsLabel
 
BPHTokenWrapper< std::vector< BPHTrackReference::candidate > > pcCandsToken
 
std::string pfCandsLabel
 
BPHTokenWrapper< std::vector< reco::PFCandidate > > pfCandsToken
 
std::map< std::string, parTypepMap
 
std::string pVertexLabel
 
BPHTokenWrapper< std::vector< reco::Vertex > > pVertexToken
 
std::map< const BPHRecoCandidate *, vertex_refpvRefMap
 
bool recoBd
 
bool recoBs
 
bool recoBu
 
bool recoKx0
 
bool recoOnia
 
bool recoPkk
 
std::map< std::string, recoTyperMap
 
std::string sdName
 
std::string ssName
 
bool useCC
 
bool useGP
 
bool usePC
 
bool usePF
 
bool usePM
 
bool usePV
 
bool writeBd
 
bool writeBs
 
bool writeBu
 
bool writeKx0
 
bool writeMomentum
 
bool writeOnia
 
bool writePkk
 
bool writeVertex
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 BPHAnalyzerWrapper< BPHModuleWrapper::one_producer >
void consume (BPHTokenWrapper< Obj > &tw, const std::string &label)
 
void consume (BPHTokenWrapper< Obj > &tw, const edm::InputTag &tag)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 33 of file BPHWriteSpecificDecay.h.

Member Typedef Documentation

Definition at line 118 of file BPHWriteSpecificDecay.h.

typedef edm::Ref< std::vector<reco::Vertex> > BPHWriteSpecificDecay::vertex_ref
private

Definition at line 116 of file BPHWriteSpecificDecay.h.

Member Enumeration Documentation

Enumerator
ptMin 
etaMax 
mPsiMin 
mPsiMax 
mKx0Min 
mKx0Max 
mPhiMin 
mPhiMax 
massMin 
massMax 
probMin 
mFitMin 
mFitMax 
constrMass 
constrSigma 
constrMJPsi 
writeCandidate 

Definition at line 81 of file BPHWriteSpecificDecay.h.

Constructor & Destructor Documentation

BPHWriteSpecificDecay::BPHWriteSpecificDecay ( const edm::ParameterSet ps)
explicit

Definition at line 52 of file BPHWriteSpecificDecay.cc.

References ALCARECOTkAlBeamHalo_cff::etaMax, edm::ParameterSet::getParameter(), bVertexFilter_cfi::massMax, ptMin, SET_PAR, and boostedElectronIsolation_cff::usePV.

52  {
53 
54  usePV = ( SET_PAR( string, pVertexLabel, ps ) != "" );
55  usePM = ( SET_PAR( string, patMuonLabel, ps ) != "" );
56  useCC = ( SET_PAR( string, ccCandsLabel, ps ) != "" );
57  usePF = ( SET_PAR( string, pfCandsLabel, ps ) != "" );
58  usePC = ( SET_PAR( string, pcCandsLabel, ps ) != "" );
59  useGP = ( SET_PAR( string, gpCandsLabel, ps ) != "" );
60  SET_PAR( string, oniaName, ps );
61  SET_PAR( string, sdName, ps );
62  SET_PAR( string, ssName, ps );
63  SET_PAR( string, buName, ps );
64  SET_PAR( string, bdName, ps );
65  SET_PAR( string, bsName, ps );
66 
67  SET_PAR( bool, writeMomentum, ps );
68  SET_PAR( bool, writeVertex , ps );
69 
70  rMap["Onia" ] = Onia;
71  rMap["PHiMuMu"] = Pmm;
72  rMap["Psi1" ] = Psi1;
73  rMap["Psi2" ] = Psi2;
74  rMap["Ups" ] = Ups;
75  rMap["Ups1" ] = Ups1;
76  rMap["Ups2" ] = Ups2;
77  rMap["Ups3" ] = Ups3;
78  rMap["Kx0" ] = Kx0;
79  rMap["PhiKK" ] = Pkk;
80  rMap["Bu" ] = Bu;
81  rMap["Bd" ] = Bd;
82  rMap["Bs" ] = Bs;
83 
84  pMap["ptMin" ] = ptMin;
85  pMap["etaMax" ] = etaMax;
86  pMap["mJPsiMin" ] = mPsiMin;
87  pMap["mJPsiMax" ] = mPsiMax;
88  pMap["mKx0Min" ] = mKx0Min;
89  pMap["mKx0Max" ] = mKx0Max;
90  pMap["mPhiMin" ] = mPhiMin;
91  pMap["mPhiMax" ] = mPhiMax;
92  pMap["massMin" ] = massMin;
93  pMap["massMax" ] = massMax;
94  pMap["probMin" ] = probMin;
95  pMap["massFitMin" ] = mFitMin;
96  pMap["massFitMax" ] = mFitMax;
97  pMap["constrMass" ] = constrMass;
98  pMap["constrSigma"] = constrSigma;
99 
100  fMap["constrMJPsi" ] = constrMJPsi;
101  fMap["writeCandidate"] = writeCandidate;
102 
103  recoOnia =
104  recoKx0 = writeKx0 =
105  recoPkk = writePkk =
106  recoBu = writeBu =
107  recoBd = writeBd =
108  recoBs = writeBs = false;
109 
110  writeOnia = true;
111  const vector<edm::ParameterSet> recoSelect =
112  ps.getParameter< vector<edm::ParameterSet> >( "recoSelect" );
113  int iSel;
114  int nSel = recoSelect.size();
115  for ( iSel = 0; iSel < nSel; ++iSel ) setRecoParameters( recoSelect[iSel] );
116  if ( !recoOnia ) writeOnia = false;
117 
118  if ( recoBu ) recoOnia = true;
119  if ( recoBd ) recoOnia = recoKx0 = true;
120  if ( recoBs ) recoOnia = recoPkk = true;
121  if ( writeBu ) writeOnia = true;
122  if ( writeBd ) writeOnia = writeKx0 = true;
123  if ( writeBs ) writeOnia = writePkk = true;
124 
125  if ( usePV ) consume< vector<reco::Vertex > >( pVertexToken,
126  pVertexLabel );
127  if ( usePM ) consume< pat::MuonCollection >( patMuonToken,
128  patMuonLabel );
129  if ( useCC ) consume< vector<pat::CompositeCandidate > >( ccCandsToken,
130  ccCandsLabel );
131  if ( usePF ) consume< vector<reco::PFCandidate > >( pfCandsToken,
132  pfCandsLabel );
133  if ( usePC ) consume< vector<BPHTrackReference::candidate> >( pcCandsToken,
134  pcCandsLabel );
135  if ( useGP ) consume< vector<pat::GenericParticle > >( gpCandsToken,
136  gpCandsLabel );
137 
138  if ( writeOnia ) produces<pat::CompositeCandidateCollection>( oniaName );
139  if ( writeKx0 ) produces<pat::CompositeCandidateCollection>( sdName );
140  if ( writePkk ) produces<pat::CompositeCandidateCollection>( ssName );
141  if ( writeBu ) produces<pat::CompositeCandidateCollection>( buName );
142  if ( writeBd ) produces<pat::CompositeCandidateCollection>( bdName );
143  if ( writeBs ) produces<pat::CompositeCandidateCollection>( bsName );
144 
145 }
T getParameter(std::string const &) const
BPHTokenWrapper< std::vector< reco::PFCandidate > > pfCandsToken
BPHTokenWrapper< std::vector< pat::CompositeCandidate > > ccCandsToken
std::map< std::string, recoType > rMap
#define SET_PAR(TYPE, NAME, PSET)
std::map< std::string, parType > pMap
BPHTokenWrapper< pat::MuonCollection > patMuonToken
BPHTokenWrapper< std::vector< reco::Vertex > > pVertexToken
BPHTokenWrapper< std::vector< pat::GenericParticle > > gpCandsToken
BPHTokenWrapper< std::vector< BPHTrackReference::candidate > > pcCandsToken
void setRecoParameters(const edm::ParameterSet &ps)
std::map< std::string, parType > fMap
BPHWriteSpecificDecay::~BPHWriteSpecificDecay ( )
override

Definition at line 148 of file BPHWriteSpecificDecay.cc.

148  {
149 }

Member Function Documentation

void BPHWriteSpecificDecay::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 195 of file BPHWriteSpecificDecay.cc.

195  {
196  return;
197 }
void BPHWriteSpecificDecay::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 711 of file BPHWriteSpecificDecay.cc.

711  {
712  return;
713 }
void BPHWriteSpecificDecay::fill ( edm::Event ev,
const edm::EventSetup es 
)
virtual

Definition at line 213 of file BPHWriteSpecificDecay.cc.

References PVValHelper::add(), reco::Candidate::begin(), BPHBdToJPsiKxBuilder::build(), BPHBsToJPsiPhiBuilder::build(), BPHKx0ToKPiBuilder::build(), BPHPhiToKKBuilder::build(), BPHBuToJPsiKBuilder::build(), BPHOniaToMuMuBuilder::build(), TwoTrackMinimumDistance::calculate(), edm::HandleBase::clear(), BPHPlusMinusCandidate::composite(), BPHRecoBuilder::createCollection(), reco::CompositeCandidate::daughter(), BPHDecayMomentum::daughters(), MillePedeFileConverter_cfg::e, ALCARECOTkAlBeamHalo_cff::etaMax, edm::EventSetup::get(), BPHKx0ToKPiBuilder::getConstrMass(), BPHPhiToKKBuilder::getConstrMass(), BPHOniaToMuMuBuilder::getConstrMass(), BPHKx0ToKPiBuilder::getConstrSigma(), BPHPhiToKKBuilder::getConstrSigma(), BPHOniaToMuMuBuilder::getConstrSigma(), BPHDecayMomentum::getDaug(), BPHOniaToMuMuBuilder::getList(), mps_fire::i, funct::m, seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, bVertexFilter_cfi::massMax, histoParameters_cff::minDz, gen::n, DetIdAssociatorESProducer_cff::nPhi, nullptr, reco::CompositeCandidate::numberOfDaughters(), BPHDecayMomentum::originalReco(), BPHOniaToMuMuBuilder::Phi, TwoTrackMinimumDistance::points(), reco::Vertex::position(), funct::pow(), BPHOniaToMuMuBuilder::Psi1, BPHOniaToMuMuBuilder::Psi2, ptMin, MetAnalyzer::pv(), BPHRecoBuilder::sameTrack(), edm::second(), BPHKx0ToKPiBuilder::setConstr(), BPHPhiToKKBuilder::setConstr(), BPHBdToJPsiKxBuilder::setConstr(), BPHBsToJPsiPhiBuilder::setConstr(), BPHBuToJPsiKBuilder::setConstr(), BPHOniaToMuMuBuilder::setConstr(), BPHPhiToKKBuilder::setEtaMax(), BPHKx0ToKPiBuilder::setEtaMax(), BPHOniaToMuMuBuilder::setEtaMax(), BPHBsToJPsiPhiBuilder::setJPsiMassMax(), BPHBdToJPsiKxBuilder::setJPsiMassMax(), BPHBuToJPsiKBuilder::setJPsiMassMax(), BPHBdToJPsiKxBuilder::setJPsiMassMin(), BPHBsToJPsiPhiBuilder::setJPsiMassMin(), BPHBuToJPsiKBuilder::setJPsiMassMin(), BPHBuToJPsiKBuilder::setKEtaMax(), BPHBuToJPsiKBuilder::setKPtMin(), BPHBdToJPsiKxBuilder::setKxMassMax(), BPHBdToJPsiKxBuilder::setKxMassMin(), BPHBdToJPsiKxBuilder::setMassFitMax(), BPHBsToJPsiPhiBuilder::setMassFitMax(), BPHBuToJPsiKBuilder::setMassFitMax(), BPHBsToJPsiPhiBuilder::setMassFitMin(), BPHBdToJPsiKxBuilder::setMassFitMin(), BPHBuToJPsiKBuilder::setMassFitMin(), BPHKx0ToKPiBuilder::setMassMax(), BPHPhiToKKBuilder::setMassMax(), BPHBdToJPsiKxBuilder::setMassMax(), BPHBsToJPsiPhiBuilder::setMassMax(), BPHBuToJPsiKBuilder::setMassMax(), BPHOniaToMuMuBuilder::setMassMax(), BPHPhiToKKBuilder::setMassMin(), BPHKx0ToKPiBuilder::setMassMin(), BPHBsToJPsiPhiBuilder::setMassMin(), BPHBdToJPsiKxBuilder::setMassMin(), BPHBuToJPsiKBuilder::setMassMin(), BPHOniaToMuMuBuilder::setMassMin(), BPHBsToJPsiPhiBuilder::setPhiMassMax(), BPHBsToJPsiPhiBuilder::setPhiMassMin(), BPHKx0ToKPiBuilder::setProbMin(), BPHPhiToKKBuilder::setProbMin(), BPHBsToJPsiPhiBuilder::setProbMin(), BPHBdToJPsiKxBuilder::setProbMin(), BPHBuToJPsiKBuilder::setProbMin(), BPHOniaToMuMuBuilder::setProbMin(), BPHPhiToKKBuilder::setPtMin(), BPHKx0ToKPiBuilder::setPtMin(), BPHOniaToMuMuBuilder::setPtMin(), BPHOniaToMuMuBuilder::Ups, BPHOniaToMuMuBuilder::Ups1, BPHOniaToMuMuBuilder::Ups2, BPHOniaToMuMuBuilder::Ups3, pat::PATObject< ObjectType >::userData(), and BPHDecayVertex::vertex().

214  {
215 
216  lFull.clear();
217  lJPsi.clear();
218  lSd.clear();
219  lSs.clear();
220  lBu.clear();
221  lBd.clear();
222  lBs.clear();
223  jPsiOMap.clear();
224  pvRefMap.clear();
225  ccRefMap.clear();
226 
227  // get magnetic field
229  es.get<IdealMagneticFieldRecord>().get( magneticField );
230 
231  // get object collections
232  // collections are got through "BPHTokenWrapper" interface to allow
233  // uniform access in different CMSSW versions
234 
236  pVertexToken.get( ev, pVertices );
237  int npv = pVertices->size();
238 
239  int nrc = 0;
240 
241  // get reco::PFCandidate collection (in full AOD )
243  if ( usePF ) {
244  pfCandsToken.get( ev, pfCands );
245  nrc = pfCands->size();
246  }
247 
248  // get pat::PackedCandidate collection (in MiniAOD)
249  // pat::PackedCandidate is not defined in CMSSW_5XY, so a
250  // typedef (BPHTrackReference::candidate) is used, actually referring
251  // to pat::PackedCandidate only for CMSSW versions where it's defined
253  if ( usePC ) {
254  pcCandsToken.get( ev, pcCands );
255  nrc = pcCands->size();
256  }
257 
258  // get pat::GenericParticle collection (in skimmed data)
260  if ( useGP ) {
261  gpCandsToken.get( ev, gpCands );
262  nrc = gpCands->size();
263  }
264 
265  // get pat::Muon collection (in full AOD and MiniAOD)
267  if ( usePM ) {
268  patMuonToken.get( ev, patMuon );
269  }
270 
271  // get muons from pat::CompositeCandidate objects describing onia;
272  // muons from all composite objects are copied to an unique std::vector
273  vector<const reco::Candidate*> muDaugs;
274  set<const pat::Muon*> muonSet;
275  typedef multimap<const reco::Candidate*,
276  const pat::CompositeCandidate*> mu_cc_map;
277  mu_cc_map muCCMap;
278  if ( useCC ) {
280  ccCandsToken.get( ev, ccCands );
281  int n = ccCands->size();
282  muDaugs.clear();
283  muDaugs.reserve( n );
284  muonSet.clear();
285  set<const pat::Muon*>::const_iterator iter;
286  set<const pat::Muon*>::const_iterator iend;
287  int i;
288  for ( i = 0; i < n; ++i ) {
289  const pat::CompositeCandidate& cc = ccCands->at( i );
290  int j;
291  int m = cc.numberOfDaughters();
292  for ( j = 0; j < m; ++j ) {
293  const reco::Candidate* dp = cc.daughter( j );
294  const pat::Muon* mp = dynamic_cast<const pat::Muon*>( dp );
295  iter = muonSet.begin();
296  iend = muonSet.end();
297  bool add = ( mp != nullptr ) && ( muonSet.find( mp ) == iend );
298  while ( add && ( iter != iend ) ) {
299  if ( BPHRecoBuilder::sameTrack( mp, *iter++, 1.0e-5 ) ) add = false;
300  }
301  if ( add ) muonSet.insert( mp );
302  // associate muon to the CompositeCandidate containing it
303  muCCMap.insert( pair<const reco::Candidate*,
304  const pat::CompositeCandidate*>( dp, &cc ) );
305  }
306  }
307  iter = muonSet.begin();
308  iend = muonSet.end();
309  while ( iter != iend ) muDaugs.push_back( *iter++ );
310  }
311 
312  map< recoType, map<parType,double> >::const_iterator rIter = parMap.begin();
313  map< recoType, map<parType,double> >::const_iterator rIend = parMap.end();
314 
315  // reconstruct quarkonia
316 
317  BPHOniaToMuMuBuilder* onia = nullptr;
318  if ( recoOnia ) {
319  if ( usePM ) onia = new BPHOniaToMuMuBuilder( es,
320  BPHRecoBuilder::createCollection( patMuon, "cfmig" ),
321  BPHRecoBuilder::createCollection( patMuon, "cfmig" ) );
322  else
323  if ( useCC ) onia = new BPHOniaToMuMuBuilder( es,
324  BPHRecoBuilder::createCollection( muDaugs, "cfmig" ),
325  BPHRecoBuilder::createCollection( muDaugs, "cfmig" ) );
326  }
327 
328  if ( onia != nullptr ) {
329  while ( rIter != rIend ) {
330  const map< recoType, map<parType,double> >::value_type& rEntry = *rIter++;
331  recoType rType = rEntry.first;
332  const map<parType,double>& pMap = rEntry.second;
334  switch( rType ) {
335  case Pmm : type = BPHOniaToMuMuBuilder::Phi ; break;
336  case Psi1: type = BPHOniaToMuMuBuilder::Psi1; break;
337  case Psi2: type = BPHOniaToMuMuBuilder::Psi2; break;
338  case Ups : type = BPHOniaToMuMuBuilder::Ups ; break;
339  case Ups1: type = BPHOniaToMuMuBuilder::Ups1; break;
340  case Ups2: type = BPHOniaToMuMuBuilder::Ups2; break;
341  case Ups3: type = BPHOniaToMuMuBuilder::Ups3; break;
342  default: continue;
343  }
344  map<parType,double>::const_iterator pIter = pMap.begin();
345  map<parType,double>::const_iterator pIend = pMap.end();
346  while ( pIter != pIend ) {
347  const map<parType,double>::value_type& pEntry = *pIter++;
348  parType id = pEntry.first;
349  double pv = pEntry.second;
350  switch( id ) {
351  case ptMin : onia->setPtMin ( type, pv ); break;
352  case etaMax : onia->setEtaMax ( type, pv ); break;
353  case massMin : onia->setMassMin( type, pv ); break;
354  case massMax : onia->setMassMax( type, pv ); break;
355  case probMin : onia->setProbMin( type, pv ); break;
356  case constrMass : onia->setConstr ( type, pv,
357  onia->getConstrSigma( type )
358  ); break;
359  case constrSigma: onia->setConstr ( type, onia->getConstrMass ( type ),
360  pv ); break;
361  default: break;
362  }
363  }
364  }
365  lFull = onia->build();
366  }
367 
368  // associate onia to primary vertex
369 
370  int iFull;
371  int nFull = lFull.size();
372  map<const BPHRecoCandidate*,const reco::Vertex*> oniaVtxMap;
373 
374  typedef mu_cc_map::const_iterator mu_cc_iter;
375  for ( iFull = 0; iFull < nFull; ++iFull ) {
376 
377  const reco::Vertex* pVtx = nullptr;
378  int pvId = 0;
379  const BPHPlusMinusCandidate* ptr = lFull[iFull].get();
380  const std::vector<const reco::Candidate*>& daugs = ptr->daughters();
381 
382  // try to recover primary vertex association in skim data:
383  // get the CompositeCandidate containing both muons
384  pair<mu_cc_iter,mu_cc_iter> cc0 = muCCMap.equal_range(
385  ptr->originalReco( daugs[0] ) );
386  pair<mu_cc_iter,mu_cc_iter> cc1 = muCCMap.equal_range(
387  ptr->originalReco( daugs[1] ) );
388  mu_cc_iter iter0 = cc0.first;
389  mu_cc_iter iend0 = cc0.second;
390  mu_cc_iter iter1 = cc1.first;
391  mu_cc_iter iend1 = cc1.second;
392  while ( ( iter0 != iend0 ) && ( pVtx == nullptr ) ) {
393  const pat::CompositeCandidate* ccp = iter0++->second;
394  while ( iter1 != iend1 ) {
395  if ( ccp != iter1++->second ) continue;
396  pVtx = ccp->userData<reco::Vertex>( "PVwithmuons" );
397  const reco::Vertex* sVtx = nullptr;
398  const reco::Vertex::Point& pPos = pVtx->position();
399  float dMin = 999999.;
400  int ipv;
401  for ( ipv = 0; ipv < npv; ++ipv ) {
402  const reco::Vertex* tVtx = &pVertices->at( ipv );
403  const reco::Vertex::Point& tPos = tVtx->position();
404  float dist = pow( pPos.x() - tPos.x(), 2 ) +
405  pow( pPos.y() - tPos.y(), 2 ) +
406  pow( pPos.z() - tPos.z(), 2 );
407  if ( dist < dMin ) {
408  dMin = dist;
409  sVtx = tVtx;
410  pvId = ipv;
411  }
412  }
413  pVtx = sVtx;
414  break;
415  }
416  }
417 
418  // if not found, as ofr other type of inut data,
419  // try to get the nearest primary vertex in z direction
420  if ( pVtx == nullptr ) {
421  const reco::Vertex::Point& sVtp = ptr->vertex().position();
422  GlobalPoint cPos( sVtp.x(), sVtp.y(), sVtp.z() );
423  const pat::CompositeCandidate& sCC = ptr->composite();
424  GlobalVector cDir( sCC.px(), sCC.py(), sCC.pz() );
425  GlobalPoint bPos( 0.0, 0.0, 0.0 );
426  GlobalVector bDir( 0.0, 0.0, 1.0 );
428  bool state = ttmd.calculate( GlobalTrajectoryParameters( cPos, cDir,
429  TrackCharge( 0 ), &( *magneticField ) ),
430  GlobalTrajectoryParameters( bPos, bDir,
431  TrackCharge( 0 ), &( *magneticField ) ) );
432  float minDz = 999999.;
433  float extrapZ = ( state ? ttmd.points().first.z() : -9e20 );
434  int ipv;
435  for ( ipv = 0; ipv < npv; ++ipv ) {
436  const reco::Vertex& tVtx = pVertices->at( ipv );
437  float deltaZ = fabs( extrapZ - tVtx.position().z() ) ;
438  if ( deltaZ < minDz ) {
439  minDz = deltaZ;
440  pVtx = &tVtx;
441  pvId = ipv;
442  }
443  }
444  }
445 
446  oniaVtxMap[ptr] = pVtx;
447  pvRefMap[ptr] = vertex_ref( pVertices, pvId );
448 
449  }
450  pVertexToken.get( ev, pVertices );
451 
452  // get JPsi subsample and associate JPsi candidate to original
453  // generic onia candidate
454  if ( nFull ) lJPsi = onia->getList( BPHOniaToMuMuBuilder::Psi1 );
455 
456  int nJPsi = lJPsi.size();
457  delete onia;
458 
459  if ( !nJPsi ) return;
460  if ( !nrc ) return;
461 
462  int ij;
463  int io;
464  int nj = lJPsi.size();
465  int no = lFull.size();
466  for ( ij = 0; ij < nj; ++ij ) {
467  const BPHRecoCandidate* jp = lJPsi[ij].get();
468  for ( io = 0; io < no; ++io ) {
469  const BPHRecoCandidate* oc = lFull[io].get();
470  if ( ( jp->originalReco( jp->getDaug( "MuPos" ) ) ==
471  oc->originalReco( oc->getDaug( "MuPos" ) ) ) &&
472  ( jp->originalReco( jp->getDaug( "MuNeg" ) ) ==
473  oc->originalReco( oc->getDaug( "MuNeg" ) ) ) ) {
474  jPsiOMap[jp] = oc;
475  break;
476  }
477  }
478  }
479 
480  // build and dump Bu
481 
482  BPHBuToJPsiKBuilder* bu = nullptr;
483  if ( recoBu ) {
484  if ( usePF ) bu = new BPHBuToJPsiKBuilder( es, lJPsi,
486  else
487  if ( usePC ) bu = new BPHBuToJPsiKBuilder( es, lJPsi,
489  else
490  if ( useGP ) bu = new BPHBuToJPsiKBuilder( es, lJPsi,
492  }
493 
494  if ( bu != nullptr ) {
495  rIter = parMap.find( Bu );
496  if ( rIter != rIend ) {
497  const map<parType,double>& pMap = rIter->second;
498  map<parType,double>::const_iterator pIter = pMap.begin();
499  map<parType,double>::const_iterator pIend = pMap.end();
500  while ( pIter != pIend ) {
501  const map<parType,double>::value_type& pEntry = *pIter++;
502  parType id = pEntry.first;
503  double pv = pEntry.second;
504  switch( id ) {
505  case ptMin : bu->setKPtMin ( pv ); break;
506  case etaMax : bu->setKEtaMax ( pv ); break;
507  case mPsiMin : bu->setJPsiMassMin( pv ); break;
508  case mPsiMax : bu->setJPsiMassMax( pv ); break;
509  case massMin : bu->setMassMin ( pv ); break;
510  case massMax : bu->setMassMax ( pv ); break;
511  case probMin : bu->setProbMin ( pv ); break;
512  case mFitMin : bu->setMassFitMin ( pv ); break;
513  case mFitMax : bu->setMassFitMax ( pv ); break;
514  case constrMJPsi: bu->setConstr ( pv > 0 ); break;
515  case writeCandidate: writeBu = ( pv > 0 ); break;
516  default: break;
517  }
518  }
519  }
520  lBu = bu->build();
521  delete bu;
522  }
523 
524  // build and dump Kx0
525 
526  vector<BPHPlusMinusConstCandPtr> lKx0;
527  BPHKx0ToKPiBuilder* kx0 = nullptr;
528  if ( recoKx0 ) {
529  if ( usePF ) kx0 = new BPHKx0ToKPiBuilder( es,
532  else
533  if ( usePC ) kx0 = new BPHKx0ToKPiBuilder( es,
536  else
537  if ( useGP ) kx0 = new BPHKx0ToKPiBuilder( es,
540  }
541 
542  if ( kx0 != nullptr ) {
543  rIter = parMap.find( Kx0 );
544  if ( rIter != rIend ) {
545  const map<parType,double>& pMap = rIter->second;
546  map<parType,double>::const_iterator pIter = pMap.begin();
547  map<parType,double>::const_iterator pIend = pMap.end();
548  while ( pIter != pIend ) {
549  const map<parType,double>::value_type& pEntry = *pIter++;
550  parType id = pEntry.first;
551  double pv = pEntry.second;
552  switch( id ) {
553  case ptMin : kx0->setPtMin ( pv ); break;
554  case etaMax : kx0->setEtaMax ( pv ); break;
555  case massMin : kx0->setMassMin( pv ); break;
556  case massMax : kx0->setMassMax( pv ); break;
557  case probMin : kx0->setProbMin( pv ); break;
558  case constrMass : kx0->setConstr ( pv, kx0->getConstrSigma() ); break;
559  case constrSigma: kx0->setConstr ( kx0->getConstrMass() , pv ); break;
560  case writeCandidate: writeKx0 = ( pv > 0 ); break;
561  default: break;
562  }
563  }
564  }
565  lKx0 = kx0->build();
566  delete kx0;
567  }
568 
569  int nKx0 = lKx0.size();
570 
571  // build and dump Bd
572 
573  if ( recoBd && nKx0 ) {
574 
575  BPHBdToJPsiKxBuilder* bd = new BPHBdToJPsiKxBuilder( es, lJPsi, lKx0 );
576  rIter = parMap.find( Bd );
577  if ( rIter != rIend ) {
578  const map<parType,double>& pMap = rIter->second;
579  map<parType,double>::const_iterator pIter = pMap.begin();
580  map<parType,double>::const_iterator pIend = pMap.end();
581  while ( pIter != pIend ) {
582  const map<parType,double>::value_type& pEntry = *pIter++;
583  parType id = pEntry.first;
584  double pv = pEntry.second;
585  switch( id ) {
586  case mPsiMin : bd->setJPsiMassMin( pv ); break;
587  case mPsiMax : bd->setJPsiMassMax( pv ); break;
588  case mKx0Min : bd->setKxMassMin ( pv ); break;
589  case mKx0Max : bd->setKxMassMax ( pv ); break;
590  case massMin : bd->setMassMin ( pv ); break;
591  case massMax : bd->setMassMax ( pv ); break;
592  case probMin : bd->setProbMin ( pv ); break;
593  case mFitMin : bd->setMassFitMin ( pv ); break;
594  case mFitMax : bd->setMassFitMax ( pv ); break;
595  case constrMJPsi: bd->setConstr ( pv > 0 ); break;
596  case writeCandidate: writeBd = ( pv > 0 ); break;
597  default: break;
598  }
599  }
600  }
601 
602  lBd = bd->build();
603  delete bd;
604 
605  set<BPHRecoConstCandPtr> sKx0;
606  int iBd;
607  int nBd = lBd.size();
608  for ( iBd = 0; iBd < nBd; ++iBd ) sKx0.insert( lBd[iBd]->getComp( "Kx0" ) );
609  set<BPHRecoConstCandPtr>::const_iterator iter = sKx0.begin();
610  set<BPHRecoConstCandPtr>::const_iterator iend = sKx0.end();
611  while ( iter != iend ) lSd.push_back( *iter++ );
612 
613  }
614 
615  // build and dump Phi
616 
617  vector<BPHPlusMinusConstCandPtr> lPhi;
618  BPHPhiToKKBuilder* phi = nullptr;
619  if ( recoPkk ) {
620  if ( usePF ) phi = new BPHPhiToKKBuilder( es,
623  else
624  if ( usePC ) phi = new BPHPhiToKKBuilder( es,
627  else
628  if ( useGP ) phi = new BPHPhiToKKBuilder( es,
631  }
632 
633  if ( phi != nullptr ) {
634  rIter = parMap.find( Pkk );
635  if ( rIter != rIend ) {
636  const map<parType,double>& pMap = rIter->second;
637  map<parType,double>::const_iterator pIter = pMap.begin();
638  map<parType,double>::const_iterator pIend = pMap.end();
639  while ( pIter != pIend ) {
640  const map<parType,double>::value_type& pEntry = *pIter++;
641  parType id = pEntry.first;
642  double pv = pEntry.second;
643  switch( id ) {
644  case ptMin : phi->setPtMin ( pv ); break;
645  case etaMax : phi->setEtaMax ( pv ); break;
646  case massMin : phi->setMassMin( pv ); break;
647  case massMax : phi->setMassMax( pv ); break;
648  case probMin : phi->setProbMin( pv ); break;
649  case constrMass : phi->setConstr ( pv, phi->getConstrSigma() ); break;
650  case constrSigma: phi->setConstr ( phi->getConstrMass() , pv ); break;
651  case writeCandidate: writePkk = ( pv > 0 ); break;
652  default: break;
653  }
654  }
655  }
656  lPhi = phi->build();
657  delete phi;
658  }
659 
660  int nPhi = lPhi.size();
661 
662  // build and dump Bs
663 
664  if ( recoBs && nPhi ) {
665 
666  BPHBsToJPsiPhiBuilder* bs = new BPHBsToJPsiPhiBuilder( es, lJPsi, lPhi );
667  rIter = parMap.find( Bs );
668  if ( rIter != rIend ) {
669  const map<parType,double>& pMap = rIter->second;
670  map<parType,double>::const_iterator pIter = pMap.begin();
671  map<parType,double>::const_iterator pIend = pMap.end();
672  while ( pIter != pIend ) {
673  const map<parType,double>::value_type& pEntry = *pIter++;
674  parType id = pEntry.first;
675  double pv = pEntry.second;
676  switch( id ) {
677  case mPsiMin : bs->setJPsiMassMin( pv ); break;
678  case mPsiMax : bs->setJPsiMassMax( pv ); break;
679  case mPhiMin : bs->setPhiMassMin ( pv ); break;
680  case mPhiMax : bs->setPhiMassMax ( pv ); break;
681  case massMin : bs->setMassMin ( pv ); break;
682  case massMax : bs->setMassMax ( pv ); break;
683  case probMin : bs->setProbMin ( pv ); break;
684  case mFitMin : bs->setMassFitMin ( pv ); break;
685  case mFitMax : bs->setMassFitMax ( pv ); break;
686  case constrMJPsi: bs->setConstr ( pv > 0 ); break;
687  case writeCandidate: writeBs = ( pv > 0 ); break;
688  default: break;
689  }
690  }
691  }
692 
693  lBs = bs->build();
694  delete bs;
695 
696  set<BPHRecoConstCandPtr> sPhi;
697  int iBs;
698  int nBs = lBs.size();
699  for ( iBs = 0; iBs < nBs; ++iBs ) sPhi.insert( lBs[iBs]->getComp( "Phi" ) );
700  set<BPHRecoConstCandPtr>::const_iterator iter = sPhi.begin();
701  set<BPHRecoConstCandPtr>::const_iterator iend = sPhi.end();
702  while ( iter != iend ) lSs.push_back( *iter++ );
703 
704  }
705 
706  return;
707 
708 }
Analysis-level particle class.
type
Definition: HCALResponse.h:21
void setEtaMax(double eta)
double getConstrSigma() const
static bool sameTrack(const reco::Candidate *lCand, const reco::Candidate *rCand, double minPDifference)
std::vector< BPHRecoConstCandPtr > build()
build Bu candidates
std::vector< BPHPlusMinusConstCandPtr > lJPsi
BPHTokenWrapper< std::vector< reco::PFCandidate > > pfCandsToken
std::pair< GlobalPoint, GlobalPoint > points() const override
void setJPsiMassMin(double m)
set cuts
void setMassMax(oniaType type, double m)
std::vector< BPHPlusMinusConstCandPtr > lFull
double getConstrMass(oniaType type) const
void setPtMin(double pt)
set cuts
void setJPsiMassMin(double m)
set cuts
void setKPtMin(double pt)
set cuts
std::vector< BPHRecoConstCandPtr > lBs
bool get(const edm::Event &ev, edm::Handle< Obj > &obj)
void setMassFitMax(double m)
void setKEtaMax(double eta)
void setMassMin(double m)
std::map< const BPHRecoCandidate *, compcc_ref > ccRefMap
void setProbMin(double p)
void setPtMin(double pt)
set cuts
double getConstrMass() const
BPHTokenWrapper< std::vector< pat::CompositeCandidate > > ccCandsToken
#define nullptr
const Point & position() const
position
Definition: Vertex.h:109
virtual const std::vector< const reco::Candidate * > & daughters() const
void setProbMin(oniaType type, double p)
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
std::map< std::string, parType > pMap
static BPHGenericCollection * createCollection(const edm::Handle< T > &collection, const std::string &list="cfhpmig")
std::vector< BPHPlusMinusConstCandPtr > build()
build Phi candidates
std::vector< BPHRecoConstCandPtr > lSs
U second(std::pair< T, U > const &p)
const pat::CompositeCandidate & composite() const override
get a composite by the simple sum of simple particles
int TrackCharge
Definition: TrackCharge.h:4
BPHTokenWrapper< pat::MuonCollection > patMuonToken
double getConstrSigma(oniaType type) const
BPHTokenWrapper< std::vector< reco::Vertex > > pVertexToken
void setEtaMax(double eta)
def pv(vc)
Definition: MetAnalyzer.py:6
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
const T * userData(const std::string &key) const
Returns user-defined data. Returns NULL if the data is not present, or not of type T...
Definition: PATObject.h:280
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
BPHTokenWrapper< std::vector< pat::GenericParticle > > gpCandsToken
void setProbMin(double p)
edm::Ref< std::vector< reco::Vertex > > vertex_ref
void setMassFitMin(double m)
std::vector< BPHRecoConstCandPtr > lSd
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
void setMassMin(double m)
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
void setMassMax(double m)
std::map< recoType, std::map< parType, double > > parMap
double getConstrSigma() const
void setJPsiMassMin(double m)
set cuts
std::vector< BPHRecoConstCandPtr > lBu
BPHTokenWrapper< std::vector< BPHTrackReference::candidate > > pcCandsToken
std::vector< BPHPlusMinusConstCandPtr > build()
build resonance candidates
void setConstr(double mass, double sigma)
void setConstr(oniaType type, double mass, double sigma)
void setEtaMax(oniaType type, double eta)
T get() const
Definition: EventSetup.h:63
std::vector< BPHPlusMinusConstCandPtr > getList(oniaType type, BPHRecoSelect *dSel=0, BPHMomentumSelect *mSel=0, BPHVertexSelect *vSel=0, BPHFitSelect *kSel=0)
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:144
std::map< const BPHRecoCandidate *, vertex_ref > pvRefMap
size_type numberOfDaughters() const override
number of daughters
std::vector< BPHRecoConstCandPtr > build()
build Bs candidates
void setMassMax(double m)
virtual const reco::Candidate * getDaug(const std::string &name) const
void setMassMin(oniaType type, double m)
std::vector< BPHRecoConstCandPtr > lBd
Analysis-level muon class.
Definition: Muon.h:50
std::map< const BPHRecoCandidate *, const BPHRecoCandidate * > jPsiOMap
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setPtMin(oniaType type, double pt)
set cuts
std::vector< BPHRecoConstCandPtr > build()
build Bs candidates
void setConstr(double mass, double sigma)
void setJPsiMassMax(double m)
double getConstrMass() const
virtual const reco::Vertex & vertex() const
get reconstructed vertex
std::vector< BPHPlusMinusConstCandPtr > build()
build Phi candidates
void BPHWriteSpecificDecay::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 152 of file BPHWriteSpecificDecay.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), and funct::true.

153  {
155  desc.add<string>( "pVertexLabel", "" );
156  desc.add<string>( "patMuonLabel", "" );
157  desc.add<string>( "ccCandsLabel", "" );
158  desc.add<string>( "pfCandsLabel", "" );
159  desc.add<string>( "pcCandsLabel", "" );
160  desc.add<string>( "gpCandsLabel", "" );
161  desc.add<string>( "oniaName", "oniaCand" );
162  desc.add<string>( "sdName", "kx0Cand" );
163  desc.add<string>( "ssName", "phiCand" );
164  desc.add<string>( "buName", "buFitted" );
165  desc.add<string>( "bdName", "bdFitted" );
166  desc.add<string>( "bsName", "bsFitted" );
167  desc.add<bool>( "writeVertex" , true );
168  desc.add<bool>( "writeMomentum", true );
170  dpar.add<string>( "name" );
171  dpar.add<double>( "ptMin", -2.0e35 );
172  dpar.add<double>( "etaMax", -2.0e35 );
173  dpar.add<double>( "mJPsiMin", -2.0e35 );
174  dpar.add<double>( "mJPsiMax", -2.0e35 );
175  dpar.add<double>( "mKx0Min", -2.0e35 );
176  dpar.add<double>( "mKx0Max", -2.0e35 );
177  dpar.add<double>( "mPhiMin", -2.0e35 );
178  dpar.add<double>( "mPhiMax", -2.0e35 );
179  dpar.add<double>( "massMin", -2.0e35 );
180  dpar.add<double>( "massMax", -2.0e35 );
181  dpar.add<double>( "probMin", -2.0e35 );
182  dpar.add<double>( "massFitMin", -2.0e35 );
183  dpar.add<double>( "massFitMax", -2.0e35 );
184  dpar.add<double>( "constrMass", -2.0e35 );
185  dpar.add<double>( "constrSigma", -2.0e35 );
186  dpar.add<bool>( "constrMJPsi", true );
187  dpar.add<bool>( "writeCandidate", true );
188  vector<edm::ParameterSet> rpar;
189  desc.addVPSet( "recoSelect", dpar, rpar );
190  descriptions.add( "bphWriteSpecificDecay", desc );
191  return;
192 }
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void BPHWriteSpecificDecay::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 200 of file BPHWriteSpecificDecay.cc.

References lumiContext::fill, and TriggerAnalyzer::write().

201  {
202  fill( ev, es );
203  if ( writeOnia ) write( ev, lFull, oniaName );
204  if ( writeKx0 ) write( ev, lSd , sdName );
205  if ( writePkk ) write( ev, lSs , ssName );
206  if ( writeBu ) write( ev, lBu , buName );
207  if ( writeBd ) write( ev, lBd , bdName );
208  if ( writeBs ) write( ev, lBs , bsName );
209  return;
210 }
std::vector< BPHPlusMinusConstCandPtr > lFull
std::vector< BPHRecoConstCandPtr > lBs
virtual void fill(edm::Event &ev, const edm::EventSetup &es)
std::vector< BPHRecoConstCandPtr > lSs
std::vector< BPHRecoConstCandPtr > lSd
edm::OrphanHandle< pat::CompositeCandidateCollection > write(edm::Event &ev, const std::vector< T > &list, const std::string &name)
std::vector< BPHRecoConstCandPtr > lBu
std::vector< BPHRecoConstCandPtr > lBd
void BPHWriteSpecificDecay::setRecoParameters ( const edm::ParameterSet ps)
private

Definition at line 716 of file BPHWriteSpecificDecay.cc.

References DEFINE_FWK_MODULE, mps_splice::entry, edm::ParameterSet::getParameter(), triggerObjects_cff::id, dataset::name, and MetAnalyzer::pv().

716  {
717 
718  const string& name = ps.getParameter<string>( "name" );
719  bool writeCandidate = ps.getParameter<bool>( "writeCandidate" );
720  switch( rMap[name] ) {
721  case Onia: recoOnia = true; writeOnia = writeCandidate; break;
722  case Pmm:
723  case Psi1:
724  case Psi2:
725  case Ups:
726  case Ups1:
727  case Ups2:
728  case Ups3: recoOnia = true; break;
729  case Kx0 : recoKx0 = true; writeKx0 = writeCandidate; break;
730  case Pkk : recoPkk = true; writePkk = writeCandidate; break;
731  case Bu : recoBu = true; writeBu = writeCandidate; break;
732  case Bd : recoBd = true; writeBd = writeCandidate; break;
733  case Bs : recoBs = true; writeBs = writeCandidate; break;
734  }
735 
736  map<string,parType>::const_iterator pIter = pMap.begin();
737  map<string,parType>::const_iterator pIend = pMap.end();
738  while ( pIter != pIend ) {
739  const map<string,parType>::value_type& entry = *pIter++;
740  const string& pn = entry.first;
741  parType id = entry.second;
742  double pv = ps.getParameter<double>( pn );
743  if ( pv > -1.0e35 ) edm::LogVerbatim( "Configuration" )
744  << "BPHWriteSpecificDecay::setRecoParameters: set " << pn
745  << " for " << name << " : "
746  << ( parMap[rMap[name]][id] = pv );
747  }
748 
749  map<string,parType>::const_iterator fIter = fMap.begin();
750  map<string,parType>::const_iterator fIend = fMap.end();
751  while ( fIter != fIend ) {
752  const map<string,parType>::value_type& entry = *fIter++;
753  const string& fn = entry.first;
754  parType id = entry.second;
755  edm::LogVerbatim( "Configuration" )
756  << "BPHWriteSpecificDecay::setRecoParameters: set " << fn
757  << " for " << name << " : "
758  << ( parMap[rMap[name]][id] =
759  ( ps.getParameter<bool>( fn ) ? 1 : -1 ) );
760  }
761 
762 }
T getParameter(std::string const &) const
std::map< std::string, recoType > rMap
std::map< std::string, parType > pMap
def pv(vc)
Definition: MetAnalyzer.py:6
std::map< recoType, std::map< parType, double > > parMap
std::map< std::string, parType > fMap
template<class T >
edm::OrphanHandle<pat::CompositeCandidateCollection> BPHWriteSpecificDecay::write ( edm::Event ev,
const std::vector< T > &  list,
const std::string &  name 
)
inlineprivate

Definition at line 124 of file BPHWriteSpecificDecay.h.

References pat::PATObject< ObjectType >::addUserData(), pat::PATObject< ObjectType >::addUserFloat(), mps_fire::i, BPHPlusMinusCandidate::isCowboy(), edm::Ref< C, T, F >::isNonnull(), KinematicState::kinematicParameters(), funct::m, genParticles_cff::map, KinematicState::mass(), KinematicParameters::momentum(), gen::n, edm::Event::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

125  {
128  int i;
129  int n = list.size();
130  std::map<const BPHRecoCandidate*,
131  const BPHRecoCandidate*>::const_iterator jpoIter;
132  std::map<const BPHRecoCandidate*,
133  const BPHRecoCandidate*>::const_iterator jpoIend = jPsiOMap.end();
134  std::map<const BPHRecoCandidate*,vertex_ref>::const_iterator pvrIter;
135  std::map<const BPHRecoCandidate*,vertex_ref>::const_iterator pvrIend =
136  pvRefMap.end();
137  std::map<const BPHRecoCandidate*,compcc_ref>::const_iterator ccrIter;
138  std::map<const BPHRecoCandidate*,compcc_ref>::const_iterator ccrIend =
139  ccRefMap.end();
140  for ( i = 0; i < n; ++i ) {
141  const T& ptr = list[i];
142  ccList->push_back( ptr->composite() );
143  pat::CompositeCandidate& cc = ccList->back();
144  if ( ( pvrIter = pvRefMap.find( ptr.get() ) ) != pvrIend )
145  cc.addUserData ( "primaryVertex", pvrIter->second );
146  const std::vector<std::string>& cNames = ptr->compNames();
147  int j = 0;
148  int m = cNames.size();
149  while ( j < m ) {
150  const std::string& compName = cNames[j++];
151  const BPHRecoCandidate* cptr = ptr->getComp( compName ).get();
152  if ( ( ccrIter = ccRefMap.find( cptr ) ) == ccrIend ) {
153  if ( ( jpoIter = jPsiOMap.find( cptr ) ) != jpoIend )
154  cptr = jpoIter->second;
155  else cptr = nullptr;
156  }
157  if ( ( ccrIter = ccRefMap.find( cptr ) ) != ccrIend ) {
158  compcc_ref cref = ccrIter->second;
159  if ( cref.isNonnull() ) cc.addUserData ( "refTo" + compName, cref );
160  }
161  }
162  const BPHPlusMinusCandidate* pmp =
163  dynamic_cast<const BPHPlusMinusCandidate*>( ptr.get() );
164  if ( pmp != nullptr ) cc.addUserData( "cowboy", pmp->isCowboy() );
165  if ( ptr->isEmpty() ) {
166  if ( writeVertex ) cc.addUserData( "vertex" , ptr->vertex() );
167  continue;
168  }
169  if ( writeVertex ) cc.addUserData( "fitVertex",
170  reco::Vertex( *ptr->currentDecayVertex() ) );
171  if ( ptr->isValidFit() ) {
172  const RefCountedKinematicParticle kinPart = ptr->currentParticle();
173  const KinematicState kinStat = kinPart->currentState();
174  cc.addUserFloat( "fitMass", kinStat.mass() );
175  if ( writeMomentum ) cc.addUserData ( "fitMomentum",
176  kinStat.kinematicParameters().momentum() );
177  }
178 
179  }
180  typedef std::unique_ptr<pat::CompositeCandidateCollection> ccc_pointer;
182  ev.put( ccc_pointer( ccList ), name );
183  for ( i = 0; i < n; ++i ) {
184  const BPHRecoCandidate* ptr = list[i].get();
185  edm::Ref<pat::CompositeCandidateCollection> ccRef( ccHandle, i );
186  ccRefMap[ptr] = ccRef;
187  }
188  return ccHandle;
189  }
Analysis-level particle class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::map< const BPHRecoCandidate *, compcc_ref > ccRefMap
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Definition: PATObject.h:813
ParticleMass mass() const
edm::Ref< pat::CompositeCandidateCollection > compcc_ref
bool isCowboy() const
get cowboy/sailor classification
KinematicParameters const & kinematicParameters() const
std::vector< CompositeCandidate > CompositeCandidateCollection
std::map< const BPHRecoCandidate *, vertex_ref > pvRefMap
long double T
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
Definition: PATObject.h:309
std::map< const BPHRecoCandidate *, const BPHRecoCandidate * > jPsiOMap
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
GlobalVector momentum() const

Member Data Documentation

std::string BPHWriteSpecificDecay::bdName
private

Definition at line 76 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::bsName
private

Definition at line 77 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::buName
private

Definition at line 75 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::ccCandsLabel
private

Definition at line 52 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< std::vector<pat::CompositeCandidate > > BPHWriteSpecificDecay::ccCandsToken
private

Definition at line 60 of file BPHWriteSpecificDecay.h.

std::map<const BPHRecoCandidate*,compcc_ref> BPHWriteSpecificDecay::ccRefMap
private

Definition at line 119 of file BPHWriteSpecificDecay.h.

std::map<std::string, parType> BPHWriteSpecificDecay::fMap
private

Definition at line 87 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::gpCandsLabel
private

Definition at line 55 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< std::vector<pat::GenericParticle > > BPHWriteSpecificDecay::gpCandsToken
private

Definition at line 63 of file BPHWriteSpecificDecay.h.

std::map<const BPHRecoCandidate*,const BPHRecoCandidate*> BPHWriteSpecificDecay::jPsiOMap
private

Definition at line 115 of file BPHWriteSpecificDecay.h.

std::vector<BPHRecoConstCandPtr> BPHWriteSpecificDecay::lBd
private

Definition at line 112 of file BPHWriteSpecificDecay.h.

std::vector<BPHRecoConstCandPtr> BPHWriteSpecificDecay::lBs
private

Definition at line 113 of file BPHWriteSpecificDecay.h.

std::vector<BPHRecoConstCandPtr> BPHWriteSpecificDecay::lBu
private

Definition at line 111 of file BPHWriteSpecificDecay.h.

std::vector<BPHPlusMinusConstCandPtr> BPHWriteSpecificDecay::lFull
private

Definition at line 107 of file BPHWriteSpecificDecay.h.

std::vector<BPHPlusMinusConstCandPtr> BPHWriteSpecificDecay::lJPsi
private

Definition at line 108 of file BPHWriteSpecificDecay.h.

std::vector<BPHRecoConstCandPtr> BPHWriteSpecificDecay::lSd
private

Definition at line 109 of file BPHWriteSpecificDecay.h.

std::vector<BPHRecoConstCandPtr> BPHWriteSpecificDecay::lSs
private

Definition at line 110 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::oniaName
private

Definition at line 72 of file BPHWriteSpecificDecay.h.

std::map< recoType, std::map<parType,double> > BPHWriteSpecificDecay::parMap
private

Definition at line 88 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::patMuonLabel
private

Definition at line 51 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< pat::MuonCollection > BPHWriteSpecificDecay::patMuonToken
private

Definition at line 59 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::pcCandsLabel
private

Definition at line 54 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< std::vector<BPHTrackReference::candidate> > BPHWriteSpecificDecay::pcCandsToken
private

Definition at line 62 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::pfCandsLabel
private

Definition at line 53 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< std::vector<reco::PFCandidate > > BPHWriteSpecificDecay::pfCandsToken
private

Definition at line 61 of file BPHWriteSpecificDecay.h.

std::map<std::string, parType> BPHWriteSpecificDecay::pMap
private

Definition at line 86 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::pVertexLabel
private

Definition at line 50 of file BPHWriteSpecificDecay.h.

BPHTokenWrapper< std::vector<reco::Vertex > > BPHWriteSpecificDecay::pVertexToken
private

Definition at line 58 of file BPHWriteSpecificDecay.h.

std::map<const BPHRecoCandidate*,vertex_ref> BPHWriteSpecificDecay::pvRefMap
private

Definition at line 117 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoBd
private

Definition at line 94 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoBs
private

Definition at line 95 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoBu
private

Definition at line 93 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoKx0
private

Definition at line 91 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoOnia
private

Definition at line 90 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::recoPkk
private

Definition at line 92 of file BPHWriteSpecificDecay.h.

std::map<std::string,recoType> BPHWriteSpecificDecay::rMap
private

Definition at line 85 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::sdName
private

Definition at line 73 of file BPHWriteSpecificDecay.h.

std::string BPHWriteSpecificDecay::ssName
private

Definition at line 74 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::useCC
private

Definition at line 67 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::useGP
private

Definition at line 70 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::usePC
private

Definition at line 69 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::usePF
private

Definition at line 68 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::usePM
private

Definition at line 66 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::usePV
private

Definition at line 65 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeBd
private

Definition at line 101 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeBs
private

Definition at line 102 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeBu
private

Definition at line 100 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeKx0
private

Definition at line 98 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeMomentum
private

Definition at line 105 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeOnia
private

Definition at line 97 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writePkk
private

Definition at line 99 of file BPHWriteSpecificDecay.h.

bool BPHWriteSpecificDecay::writeVertex
private

Definition at line 104 of file BPHWriteSpecificDecay.h.