CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PFTauTransverseImpactParameters Class Reference
Inheritance diagram for PFTauTransverseImpactParameters:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  Alg { useInputPV =0, useFont }
 
enum  CMSSWPerigee {
  aCurv =0, aTheta, aPhi, aTip,
  aLip
}
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 PFTauTransverseImpactParameters (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PFTauTransverseImpactParameters ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
 
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_
 
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
 
bool useFullCalculation_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 57 of file PFTauTransverseImpactParameters.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

PFTauTransverseImpactParameters::PFTauTransverseImpactParameters ( const edm::ParameterSet iConfig)
explicit

Definition at line 71 of file PFTauTransverseImpactParameters.cc.

71  :
72  PFTauToken_(consumes<std::vector<reco::PFTau> >(iConfig.getParameter<edm::InputTag>("PFTauTag"))),
73  PFTauPVAToken_(consumes<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef> > >(iConfig.getParameter<edm::InputTag>("PFTauPVATag"))),
74  PFTauSVAToken_(consumes<edm::AssociationVector<PFTauRefProd,std::vector<std::vector<reco::VertexRef> > > >(iConfig.getParameter<edm::InputTag>("PFTauSVATag"))),
75  useFullCalculation_(iConfig.getParameter<bool>("useFullCalculation"))
76 {
77  produces<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTauTransverseImpactParameterRef> > >();
78  produces<PFTauTransverseImpactParameterCollection>("PFTauTIP");
79 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
PFTauTransverseImpactParameters::~PFTauTransverseImpactParameters ( )

Definition at line 81 of file PFTauTransverseImpactParameters.cc.

81  {
82 
83 }

Member Function Documentation

void PFTauTransverseImpactParameters::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Definition at line 85 of file PFTauTransverseImpactParameters.cc.

References TransientTrackBuilder::build(), RecoVertex::convertPos(), DEFINE_FWK_MODULE, reco::Vertex::dimension, particleFlowDisplacedVertexCandidate_cfi::dxy, reco::TransientTrack::field(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), i, reco::TransientTrack::impactPointState(), edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), j, edm::Ref< C, T, F >::key(), eostools::move(), PFTauPVAToken_, PFTauSVAToken_, PFTauToken_, edm::Event::put(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), useFullCalculation_, and findQualityFiles::v.

85  {
86  // Obtain Collections
87  edm::ESHandle<TransientTrackBuilder> transTrackBuilder;
88  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",transTrackBuilder);
89 
91  iEvent.getByToken(PFTauToken_,Tau);
92 
94  iEvent.getByToken(PFTauPVAToken_,PFTauPVA);
95 
97  iEvent.getByToken(PFTauSVAToken_,PFTauSVA);
98 
99  // Set Association Map
100  auto AVPFTauTIP = std::make_unique< edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTauTransverseImpactParameterRef>>>(PFTauRefProd(Tau));
101  auto TIPCollection_out = std::make_unique<PFTauTransverseImpactParameterCollection>();
103 
104 
105  // For each Tau Run Algorithim
106  if(Tau.isValid()) {
107  for(reco::PFTauCollection::size_type iPFTau = 0; iPFTau < Tau->size(); iPFTau++) {
108  reco::PFTauRef RefPFTau(Tau, iPFTau);
109  const reco::VertexRef PV=PFTauPVA->value(RefPFTau.key());
110  const std::vector<reco::VertexRef> SV=PFTauSVA->value(RefPFTau.key());
111  double dxy(-999), dxy_err(-999);
112  reco::Vertex::Point poca(0,0,0);
113  double ip3d(-999), ip3d_err(-999);
114  reco::Vertex::Point ip3d_poca(0,0,0);
115  if(RefPFTau->leadPFChargedHadrCand().isNonnull()){
116  if(RefPFTau->leadPFChargedHadrCand()->trackRef().isNonnull()){
118  reco::TransientTrack transTrk=transTrackBuilder->build(RefPFTau->leadPFChargedHadrCand()->trackRef());
119  GlobalVector direction(RefPFTau->p4().px(), RefPFTau->p4().py(), RefPFTau->p4().pz()); //To compute sign of IP
120  std::pair<bool,Measurement1D> signed_IP2D = IPTools::signedTransverseImpactParameter(transTrk, direction, (*PV));
121  dxy=signed_IP2D.second.value();
122  dxy_err=signed_IP2D.second.error();
123  std::pair<bool,Measurement1D> signed_IP3D = IPTools::signedImpactParameter3D(transTrk, direction, (*PV));
124  ip3d=signed_IP3D.second.value();
125  ip3d_err=signed_IP3D.second.error();
126  TransverseImpactPointExtrapolator extrapolator(transTrk.field());
127  GlobalPoint pos = extrapolator.extrapolate(transTrk.impactPointState(), RecoVertex::convertPos(PV->position())).globalPosition();
128  poca=reco::Vertex::Point(pos.x(),pos.y(),pos.z());
129  AnalyticalImpactPointExtrapolator extrapolator3D(transTrk.field());
130  GlobalPoint pos3d = extrapolator3D.extrapolate(transTrk.impactPointState(),RecoVertex::convertPos(PV->position())).globalPosition();
131  ip3d_poca=reco::Vertex::Point(pos3d.x(),pos3d.y(),pos3d.z());
132  }
133  else{
134  dxy_err=RefPFTau->leadPFChargedHadrCand()->trackRef()->d0Error();
135  dxy=RefPFTau->leadPFChargedHadrCand()->trackRef()->dxy(PV->position());
136  ip3d_err=RefPFTau->leadPFChargedHadrCand()->trackRef()->dzError(); //store dz, ip3d not available
137  ip3d=RefPFTau->leadPFChargedHadrCand()->trackRef()->dz(PV->position()); //store dz, ip3d not available
138  }
139  }
140  }
141  if(SV.size()>0){
143  reco::Vertex::Point v(SV.at(0)->x()-PV->x(),SV.at(0)->y()-PV->y(),SV.at(0)->z()-PV->z());
144  for(int i=0;i<reco::Vertex::dimension;i++){
145  for(int j=0;j<reco::Vertex::dimension;j++){
146  cov(i,j)=SV.at(0)->covariance(i,j)+PV->covariance(i,j);
147  }
148  }
149  GlobalVector direction(RefPFTau->px(),RefPFTau->py(),RefPFTau->pz());
150  double vSig = SecondaryVertex::computeDist3d(*PV,*SV.at(0),direction,true).significance();
151  reco::PFTauTransverseImpactParameter TIPV(poca,dxy,dxy_err,ip3d_poca,ip3d,ip3d_err,PV,v,vSig,SV.at(0));
152  reco::PFTauTransverseImpactParameterRef TIPVRef=reco::PFTauTransverseImpactParameterRef(TIPRefProd_out,TIPCollection_out->size());
153  TIPCollection_out->push_back(TIPV);
154  AVPFTauTIP->setValue(iPFTau,TIPVRef);
155  }
156  else{
157  reco::PFTauTransverseImpactParameter TIPV(poca,dxy,dxy_err,ip3d_poca,ip3d,ip3d_err,PV);
158  reco::PFTauTransverseImpactParameterRef TIPVRef=reco::PFTauTransverseImpactParameterRef(TIPRefProd_out,TIPCollection_out->size());
159  TIPCollection_out->push_back(TIPV);
160  AVPFTauTIP->setValue(iPFTau,TIPVRef);
161  }
162  }
163  }
164  iEvent.put(std::move(TIPCollection_out),"PFTauTIP");
165  iEvent.put(std::move(AVPFTauTIP));
166 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
reco::TransientTrack build(const reco::Track *p) const
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
const MagneticField * field() const
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
Definition: PFTauFwd.h:15
uint16_t size_type
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Vertex.h:45
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
bool isValid() const
Definition: HandleBase.h:75
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
const T & get() const
Definition: EventSetup.h:56
edm::Ref< PFTauTransverseImpactParameterCollection > PFTauTransverseImpactParameterRef
presistent reference to a PFTauTransverseImpactParameter
TrajectoryStateOnSurface impactPointState() const
std::vector< reco::PFTauTransverseImpactParameter > PFTauTransverseImpactParameterCollection
collection of PFTauTransverseImpactParameter objects
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef> > > PFTauTransverseImpactParameters::PFTauPVAToken_
private

Definition at line 66 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

edm::EDGetTokenT<edm::AssociationVector<PFTauRefProd,std::vector<std::vector<reco::VertexRef> > > > PFTauTransverseImpactParameters::PFTauSVAToken_
private

Definition at line 67 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

edm::EDGetTokenT<std::vector<reco::PFTau> > PFTauTransverseImpactParameters::PFTauToken_
private

Definition at line 65 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

bool PFTauTransverseImpactParameters::useFullCalculation_
private

Definition at line 68 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().