CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
PFBlockAlgo Class Reference

Particle Flow Algorithm. More...

#include <PFBlockAlgo.h>

Public Types

typedef
reco::PFBlockCollection::const_iterator 
IBC
 
typedef std::list
< reco::PFBlockElement * >
::iterator 
IE
 define these in *Fwd files in DataFormats/ParticleFlowReco? More...
 
typedef std::list
< reco::PFBlockElement * >
::const_iterator 
IEC
 
typedef std::vector< bool > Mask
 

Public Member Functions

const std::auto_ptr
< reco::PFBlockCollection > & 
blocks () const
 
void findBlocks ()
 build blocks More...
 
 PFBlockAlgo ()
 
void setDebug (bool debug)
 sets debug printout flag More...
 
template<template< typename > class T>
void setInput (const T< reco::PFRecTrackCollection > &trackh, const T< reco::GsfPFRecTrackCollection > &gsftrackh, const T< reco::GsfPFRecTrackCollection > &convbremgsftrackh, const T< reco::MuonCollection > &muonh, const T< reco::PFDisplacedTrackerVertexCollection > &nuclearh, const T< reco::PFRecTrackCollection > &nucleartrackh, const T< reco::PFConversionCollection > &conv, const T< reco::PFV0Collection > &v0, const T< reco::PFClusterCollection > &ecalh, const T< reco::PFClusterCollection > &hcalh, const T< reco::PFClusterCollection > &hfemh, const T< reco::PFClusterCollection > &hfhadh, const T< reco::PFClusterCollection > &psh, const T< reco::PhotonCollection > &egphh, const Mask &trackMask=dummyMask_, const Mask &gsftrackMask=dummyMask_, const Mask &ecalMask=dummyMask_, const Mask &hcalMask=dummyMask_, const Mask &hfemMask=dummyMask_, const Mask &hfhadMask=dummyMask_, const Mask &psMask=dummyMask_, const Mask &phMask=dummyMask_)
 set input collections of tracks and clusters More...
 
template<template< typename > class T>
void setInput (const T< reco::PFRecTrackCollection > &trackh, const T< reco::MuonCollection > &muonh, const T< reco::PFClusterCollection > &ecalh, const T< reco::PFClusterCollection > &hcalh, const T< reco::PFClusterCollection > &hfemh, const T< reco::PFClusterCollection > &hfhadh, const T< reco::PFClusterCollection > &psh, const Mask &trackMask=dummyMask_, const Mask &ecalMask=dummyMask_, const Mask &hcalMask=dummyMask_, const Mask &psMask=dummyMask_)
 COLIN: I think this is for particle flow at HLT... More...
 
template<template< typename > class T>
void setInput (const T< reco::PFRecTrackCollection > &trackh, const T< reco::GsfPFRecTrackCollection > &gsftrackh, const T< reco::PFClusterCollection > &ecalh, const T< reco::PFClusterCollection > &hcalh, const T< reco::PFClusterCollection > &psh, const Mask &trackMask=dummyMask_, const Mask &gsftrackMask=dummyMask_, const Mask &ecalMask=dummyMask_, const Mask &hcalMask=dummyMask_, const Mask &psMask=dummyMask_)
 COLIN: what is this setinput function for? can it be removed? More...
 
void setParameters (std::vector< double > &DPtovPtCut, std::vector< unsigned > &NHitCut, bool useConvBremPFRecTracks, bool useIterTracking, int nuclearInteractionsPurity, bool useEGPhotons, std::vector< double > &photonSelectionCuts)
 
std::auto_ptr
< reco::PFBlockCollection
transferBlocks ()
 
 ~PFBlockAlgo ()
 

Private Member Functions

IE associate (IE next, IE last, std::vector< PFBlockLink > &links)
 
void buildGraph ()
 
void checkDisplacedVertexLinks (reco::PFBlock &block) const
 remove extra links between primary track and clusters More...
 
void checkMaskSize (const reco::PFRecTrackCollection &tracks, const reco::GsfPFRecTrackCollection &gsftracks, const reco::PFClusterCollection &ecals, const reco::PFClusterCollection &hcals, const reco::PFClusterCollection &hfems, const reco::PFClusterCollection &hfhads, const reco::PFClusterCollection &pss, const reco::PhotonCollection &egphh, const Mask &trackMask, const Mask &gsftrackMask, const Mask &ecalMask, const Mask &hcalMask, const Mask &hfemMask, const Mask &hfhadMask, const Mask &psMask, const Mask &phMask) const
 
void fillFromPhoton (const reco::Photon &photon, reco::PFBlockElementSuperCluster *pfbe)
 
bool goodPtResolution (const reco::TrackRef &trackref)
 open a resolution map More...
 
void link (const reco::PFBlockElement *el1, const reco::PFBlockElement *el2, PFBlockLink::Type &linktype, reco::PFBlock::LinkTest &linktest, double &dist) const
 check whether 2 elements are linked. Returns distance and linktype More...
 
int muAssocToTrack (const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
 
int muAssocToTrack (const reco::TrackRef &trackref, const edm::OrphanHandle< reco::MuonCollection > &muonh) const
 
void packLinks (reco::PFBlock &block, const std::vector< PFBlockLink > &links) const
 
double testECALAndHCAL (const reco::PFCluster &ecal, const reco::PFCluster &hcal) const
 
double testLinkBySuperCluster (const reco::PFClusterRef &elt1, const reco::PFClusterRef &elt2) const
 test association by Supercluster between two ECAL More...
 
double testLinkByVertex (const reco::PFBlockElement *elt1, const reco::PFBlockElement *elt2) const
 
double testPS1AndPS2 (const reco::PFCluster &ps1, const reco::PFCluster &ps2) const
 
double testSuperClusterPFCluster (const reco::SuperClusterRef &sct1, const reco::PFClusterRef &elt2) const
 test association between SuperClusters and ECAL More...
 
double testTrackAndPS (const reco::PFRecTrack &track, const reco::PFCluster &ps) const
 

Private Attributes

std::auto_ptr
< reco::PFBlockCollection
blocks_
 
bool debug_
 if true, debug printouts activated More...
 
std::vector< double > DPtovPtCut_
 DPt/Pt cut for creating atrack element. More...
 
std::list< reco::PFBlockElement * > elements_
 actually, particles will be created by a separate producer More...
 
std::vector< unsigned > NHitCut_
 Number of layers crossed cut for creating atrack element. More...
 
int nuclearInteractionsPurity_
 
std::vector< int > pfcSCVec_
 SC corresponding to the PF cluster. More...
 
const PhotonSelectorAlgophotonSelector_
 PhotonSelector. More...
 
std::vector< std::vector
< reco::PFClusterRef > > 
scpfcRefs_
 PF clusters corresponding to a given SC. More...
 
std::vector
< reco::SuperClusterRef
superClusters_
 list of superclusters More...
 
bool useConvBremPFRecTracks_
 switch on/off Conversions Brem Recovery with KF Tracks More...
 
bool useEGPhotons_
 Flag to turn off the import of EG Photons. More...
 
bool useIterTracking_
 Flag to turn off quality cuts which require iterative tracking (for heavy-ions) More...
 

Static Private Attributes

static const Mask dummyMask_
 

Friends

std::ostream & operator<< (std::ostream &, const PFBlockAlgo &)
 

Detailed Description

Particle Flow Algorithm.

Author
Colin Bernet
Date
January 2006

Definition at line 64 of file PFBlockAlgo.h.

Member Typedef Documentation

typedef reco::PFBlockCollection::const_iterator PFBlockAlgo::IBC

Definition at line 177 of file PFBlockAlgo.h.

define these in *Fwd files in DataFormats/ParticleFlowReco?

Definition at line 175 of file PFBlockAlgo.h.

typedef std::list< reco::PFBlockElement* >::const_iterator PFBlockAlgo::IEC

Definition at line 176 of file PFBlockAlgo.h.

typedef std::vector<bool> PFBlockAlgo::Mask

Definition at line 82 of file PFBlockAlgo.h.

Constructor & Destructor Documentation

PFBlockAlgo::PFBlockAlgo ( )

Definition at line 21 of file PFBlockAlgo.cc.

21  :
23  DPtovPtCut_(std::vector<double>(4,static_cast<double>(999.))),
24  NHitCut_(std::vector<unsigned int>(4,static_cast<unsigned>(0))),
25  useIterTracking_(true),
26  photonSelector_(0),
27  debug_(false) {}
bool useIterTracking_
Flag to turn off quality cuts which require iterative tracking (for heavy-ions)
Definition: PFBlockAlgo.h:285
std::auto_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:268
std::vector< double > DPtovPtCut_
DPt/Pt cut for creating atrack element.
Definition: PFBlockAlgo.h:279
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
const PhotonSelectorAlgo * photonSelector_
PhotonSelector.
Definition: PFBlockAlgo.h:303
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
std::vector< unsigned > NHitCut_
Number of layers crossed cut for creating atrack element.
Definition: PFBlockAlgo.h:282
PFBlockAlgo::~PFBlockAlgo ( )

Definition at line 54 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, elements_, and photonSelector_.

54  {
55 
56 #ifdef PFLOW_DEBUG
57  if(debug_)
58  cout<<"~PFBlockAlgo - number of remaining elements: "
59  <<elements_.size()<<endl;
60 #endif
61 
63 }
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
Definition: PFBlockAlgo.h:274
const PhotonSelectorAlgo * photonSelector_
PhotonSelector.
Definition: PFBlockAlgo.h:303
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314

Member Function Documentation

PFBlockAlgo::IE PFBlockAlgo::associate ( IE  next,
IE  last,
std::vector< PFBlockLink > &  links 
)
private

recursive procedure which adds elements from elements_ to the current block, ie blocks_->back(). the resulting links between elements are stored in links, not in the block. afterwards, packLinks( reco::PFBlock& block, const vector<PFBlockLink>& links) has to be called in order to pack the link information in the block.

Definition at line 103 of file PFBlockAlgo.cc.

References blocks_, gather_cfg::cout, debug_, elements_, link(), and PFBlockLink::NONE.

Referenced by findBlocks().

105  {
106 
107 
108 #ifdef PFLOW_DEBUG
109  if(debug_ ) cout<<"PFBlockAlgo::associate start ----"<<endl;
110 #endif
111 
112  if( last!= elements_.end() ) {
114  double dist = -1;
115  PFBlock::LinkTest linktest = PFBlock::LINKTEST_RECHIT;
116  link( *last, *next, linktype, linktest, dist );
117 
118 
119  if(dist<-0.5) {
120 #ifdef PFLOW_DEBUG
121  if(debug_ ) cout<<"link failed"<<endl;
122 #endif
123  return ++next; // association failed
124  }
125  else {
126  // add next element to the current pflowblock
127  blocks_->back().addElement( *next );
128 
129  // (*next)->setIndex( blocks_->back()->indexToLastElement() );
130 
131  // this is not necessary?
132  // next->setPFBlock(this);
133 
134  // create a link between next and last
135  links.push_back( PFBlockLink(linktype,
136  linktest,
137  dist,
138  (*last)->index(),
139  (*next)->index() ) );
140  // not necessary ?
141  // next->connect( links_.size()-1 );
142  // last->connect( links_.size()-1 );
143  }
144  }
145  else {
146  // add next element to this eflowblock
147 #ifdef PFLOW_DEBUG
148  if(debug_ ) cout<<"adding to block element "<<(**next)<<endl;
149 #endif
150  blocks_->back().addElement( *next );
151  // (*next)->setIndex( blocks_->back()->indexToLastElement() );
152  // next->setPFBlock(this);
153  }
154 
155  // recursive call: associate next and other unused elements
156 
157  // IE afterNext = next;
158  // ++afterNext;
159  // cout<<"last "<<**last<<" next "<<**next<<endl;
160 
161  for(IE ie = elements_.begin();
162  ie != elements_.end();) {
163 
164  if( ie == last || ie == next ) {
165  ++ie;
166  continue;
167  }
168 
169  // *ie already included to a block
170  if( (*ie)->locked() ) {
171 #ifdef PFLOW_DEBUG
172  if(debug_ ) cout<<"element "<<(**ie)<<"already used"<<endl;
173 #endif
174  ++ie;
175  continue;
176  }
177 
178 
179 #ifdef PFLOW_DEBUG
180  if(debug_ ) cout<<"calling associate "<<(**next)<<" & "<<(**ie)<<endl;
181 #endif
182  ie = associate(next, ie, links);
183  }
184 
185 #ifdef PFLOW_DEBUG
186  if(debug_ ) {
187  cout<<"**** deleting element "<<endl;
188  cout<<**next<<endl;
189  }
190 #endif
191  delete *next;
192 
193 #ifdef PFLOW_DEBUG
194  if(debug_ ) {
195  cout<<"**** removing element "<<endl;
196  }
197 #endif
198 
199  IE iteratorToNextFreeElement = elements_.erase( next );
200 
201 #ifdef PFLOW_DEBUG
202  if(debug_ ) cout<<"PFBlockAlgo::associate stop ----"<<endl;
203 #endif
204 
205  return iteratorToNextFreeElement;
206 }
std::auto_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:268
void link(const reco::PFBlockElement *el1, const reco::PFBlockElement *el2, PFBlockLink::Type &linktype, reco::PFBlock::LinkTest &linktest, double &dist) const
check whether 2 elements are linked. Returns distance and linktype
Definition: PFBlockAlgo.cc:291
std::list< reco::PFBlockElement * >::iterator IE
define these in *Fwd files in DataFormats/ParticleFlowReco?
Definition: PFBlockAlgo.h:175
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
Definition: PFBlockAlgo.h:274
IE associate(IE next, IE last, std::vector< PFBlockLink > &links)
Definition: PFBlockAlgo.cc:103
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
const std::auto_ptr< reco::PFBlockCollection >& PFBlockAlgo::blocks ( ) const
inline
Returns
collection of blocks

Definition at line 168 of file PFBlockAlgo.h.

References blocks_.

Referenced by operator<<().

169  {return blocks_;}
std::auto_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:268
void PFBlockAlgo::buildGraph ( )
private

COLIN: not used. Could be removed. Could also be implemented, to produce a graph of a block, Showing the connections between the elements

Definition at line 284 of file PFBlockAlgo.cc.

284  {
285  // loop on all blocks and create a big graph
286 }
void PFBlockAlgo::checkDisplacedVertexLinks ( reco::PFBlock block) const
private

remove extra links between primary track and clusters

Definition at line 1156 of file PFBlockAlgo.cc.

References reco::PFBlock::associatedElements(), reco::PFBlock::elements(), asciidump::els, reco::PFBlock::linkData(), reco::PFBlock::LINKTEST_ALL, reco::PFBlock::setLink(), edm::OwnVector< T, P >::size(), and reco::PFBlockElement::TRACK.

1156  {
1157  // method which removes link between primary tracks and the clusters
1158 
1159  typedef std::multimap<double, unsigned>::iterator IE;
1160 
1162  // loop on all elements != TRACK
1163  for( unsigned i1=0; i1 != els.size(); ++i1 ) {
1164  if( els[i1].type() == PFBlockElement::TRACK ) continue;
1165  std::multimap<double, unsigned> assocTracks;
1166  // get associated tracks
1167  block.associatedElements( i1, block.linkData(),
1168  assocTracks,
1171  for( IE ie = assocTracks.begin(); ie != assocTracks.end(); ++ie) {
1172  //double distprim = ie->first;
1173  unsigned iprim = ie->second;
1174  // if this track a primary track (T_TO_DISP)
1175  // the new strategy gouzevitch: remove all the links from primary track
1176  if( els[iprim].isPrimary()) {
1177 
1178  block.setLink( i1, iprim, -1, block.linkData(),
1179  PFBlock::LINKTEST_RECHIT );
1180  }
1181  } // loop on all associated tracks
1182  } // loop on all elements
1183 
1184 }
type
Definition: HCALResponse.h:22
size_type size() const
Definition: OwnVector.h:262
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
const LinkData & linkData() const
Definition: PFBlock.h:112
tuple els
Definition: asciidump.py:420
void setLink(unsigned i1, unsigned i2, double dist, LinkData &linkData, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:26
std::list< reco::PFBlockElement * >::iterator IE
define these in *Fwd files in DataFormats/ParticleFlowReco?
Definition: PFBlockAlgo.h:175
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:75
void PFBlockAlgo::checkMaskSize ( const reco::PFRecTrackCollection tracks,
const reco::GsfPFRecTrackCollection gsftracks,
const reco::PFClusterCollection ecals,
const reco::PFClusterCollection hcals,
const reco::PFClusterCollection hfems,
const reco::PFClusterCollection hfhads,
const reco::PFClusterCollection pss,
const reco::PhotonCollection egphh,
const Mask trackMask,
const Mask gsftrackMask,
const Mask ecalMask,
const Mask hcalMask,
const Mask hfemMask,
const Mask hfhadMask,
const Mask psMask,
const Mask phMask 
) const
private

checks size of the masks with respect to the vectors they refer to. throws std::length_error if one of the masks has the wrong size

Definition at line 928 of file PFBlockAlgo.cc.

Referenced by setInput().

943  {
944 
945  if( !trackMask.empty() &&
946  trackMask.size() != tracks.size() ) {
947  string err = "PFBlockAlgo::setInput: ";
948  err += "The size of the track mask is different ";
949  err += "from the size of the track vector.";
950  throw std::length_error( err.c_str() );
951  }
952 
953  if( !gsftrackMask.empty() &&
954  gsftrackMask.size() != gsftracks.size() ) {
955  string err = "PFBlockAlgo::setInput: ";
956  err += "The size of the gsf track mask is different ";
957  err += "from the size of the gsftrack vector.";
958  throw std::length_error( err.c_str() );
959  }
960 
961  if( !ecalMask.empty() &&
962  ecalMask.size() != ecals.size() ) {
963  string err = "PFBlockAlgo::setInput: ";
964  err += "The size of the ecal mask is different ";
965  err += "from the size of the ecal clusters vector.";
966  throw std::length_error( err.c_str() );
967  }
968 
969  if( !hcalMask.empty() &&
970  hcalMask.size() != hcals.size() ) {
971  string err = "PFBlockAlgo::setInput: ";
972  err += "The size of the hcal mask is different ";
973  err += "from the size of the hcal clusters vector.";
974  throw std::length_error( err.c_str() );
975  }
976 
977  if( !hfemMask.empty() &&
978  hfemMask.size() != hfems.size() ) {
979  string err = "PFBlockAlgo::setInput: ";
980  err += "The size of the hfem mask is different ";
981  err += "from the size of the hfem clusters vector.";
982  throw std::length_error( err.c_str() );
983  }
984 
985  if( !hfhadMask.empty() &&
986  hfhadMask.size() != hfhads.size() ) {
987  string err = "PFBlockAlgo::setInput: ";
988  err += "The size of the hfhad mask is different ";
989  err += "from the size of the hfhad clusters vector.";
990  throw std::length_error( err.c_str() );
991  }
992 
993  if( !psMask.empty() &&
994  psMask.size() != pss.size() ) {
995  string err = "PFBlockAlgo::setInput: ";
996  err += "The size of the ps mask is different ";
997  err += "from the size of the ps clusters vector.";
998  throw std::length_error( err.c_str() );
999  }
1000 
1001  if( !phMask.empty() &&
1002  phMask.size() != egphh.size() ) {
1003  string err = "PFBlockAlgo::setInput: ";
1004  err += "The size of the photon mask is different ";
1005  err += "from the size of the photon vector.";
1006  throw std::length_error( err.c_str() );
1007  }
1008 
1009 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
tuple tracks
Definition: testEve_cfg.py:39
void PFBlockAlgo::fillFromPhoton ( const reco::Photon photon,
reco::PFBlockElementSuperCluster pfbe 
)
private

Definition at line 1186 of file PFBlockAlgo.cc.

References reco::Photon::ecalRecHitSumEtConeDR04(), reco::Photon::hadronicOverEm(), reco::Photon::hcalTowerSumEtConeDR04(), reco::PFBlockElementSuperCluster::setEcalIso(), reco::PFBlockElementSuperCluster::setFromPhoton(), reco::PFBlockElementSuperCluster::setHcalIso(), reco::PFBlockElementSuperCluster::setHoE(), reco::PFBlockElementSuperCluster::setTrackIso(), and reco::Photon::trkSumPtHollowConeDR04().

Referenced by setInput().

1186  {
1187  pfbe->setTrackIso(photon.trkSumPtHollowConeDR04());
1188  pfbe->setEcalIso(photon.ecalRecHitSumEtConeDR04());
1189  pfbe->setHcalIso(photon.hcalTowerSumEtConeDR04());
1190  pfbe->setHoE(photon.hadronicOverEm());
1191  pfbe->setFromPhoton(true);
1192 }
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:246
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:244
void setFromPhoton(bool val)
set provenance
void setHcalIso(float val)
set the had Iso
void setTrackIso(float val)
set the track Iso
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:155
float trkSumPtHollowConeDR04() const
Definition: Photon.h:254
void setEcalIso(float val)
set the ecal Iso
void PFBlockAlgo::findBlocks ( )

build blocks

Definition at line 66 of file PFBlockAlgo.cc.

References associate(), blocks_, gather_cfg::cout, debug_, elements_, and packLinks().

Referenced by PFRootEventManager::particleFlow().

66  {
67 
68  // cout<<"findBlocks : "<<blocks_.get()<<endl;
69 
70  // the blocks have not been passed to the event, and need to be cleared
71  if(blocks_.get() )blocks_->clear();
72  else
73  blocks_.reset( new reco::PFBlockCollection );
74 
75  blocks_->reserve(elements_.size());
76  for(IE ie = elements_.begin();
77  ie != elements_.end();) {
78 
79 #ifdef PFLOW_DEBUG
80  if(debug_) {
81  cout<<" PFBlockAlgo::findBlocks() ----------------------"<<endl;
82  cout<<" element "<<**ie<<endl;
83  cout<<" creating new block"<<endl;
84  }
85 #endif
86 
87  blocks_->push_back( PFBlock() );
88 
89  vector< PFBlockLink > links;
90 
91  // list< IE > used;
92  ie = associate( elements_.end() , ie, links );
93 
94  // build remaining links in current block
95  packLinks( blocks_->back(), links );
96  }
97 }
std::auto_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:268
std::list< reco::PFBlockElement * >::iterator IE
define these in *Fwd files in DataFormats/ParticleFlowReco?
Definition: PFBlockAlgo.h:175
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
Definition: PFBlockAlgo.h:274
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
void packLinks(reco::PFBlock &block, const std::vector< PFBlockLink > &links) const
Definition: PFBlockAlgo.cc:211
IE associate(IE next, IE last, std::vector< PFBlockLink > &links)
Definition: PFBlockAlgo.cc:103
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
Block of elements.
Definition: PFBlock.h:30
bool PFBlockAlgo::goodPtResolution ( const reco::TrackRef trackref)
private

open a resolution map

check the Pt resolution

Definition at line 1048 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, DPtovPtCut_, NHitCut_, P, reco::tau::disc::Pt(), mathSSE::sqrt(), and useIterTracking_.

Referenced by setInput().

1048  {
1049 
1050  double P = trackref->p();
1051  double Pt = trackref->pt();
1052  double DPt = trackref->ptError();
1053  unsigned int NHit = trackref->hitPattern().trackerLayersWithMeasurement();
1054  unsigned int NLostHit = trackref->hitPattern().trackerLayersWithoutMeasurement();
1055  unsigned int LostHits = trackref->numberOfLostHits();
1056  double sigmaHad = sqrt(1.20*1.20/P+0.06*0.06) / (1.+LostHits);
1057 
1058  // iteration 1,2,3,4,5 correspond to algo = 1/4,5,6,7,8,9
1059  unsigned int Algo = 0;
1060  switch (trackref->algo()) {
1061  case TrackBase::ctf:
1062  case TrackBase::iter0:
1063  case TrackBase::iter1:
1064  Algo = 0;
1065  break;
1066  case TrackBase::iter2:
1067  Algo = 1;
1068  break;
1069  case TrackBase::iter3:
1070  Algo = 2;
1071  break;
1072  case TrackBase::iter4:
1073  Algo = 3;
1074  break;
1075  case TrackBase::iter5:
1076  Algo = 4;
1077  break;
1078  default:
1079  Algo = useIterTracking_ ? 5 : 0;
1080  break;
1081  }
1082 
1083  // Protection against 0 momentum tracks
1084  if ( P < 0.05 ) return false;
1085 
1086  // Temporary : Reject all tracking iteration beyond 5th step.
1087  if ( Algo > 4 ) return false;
1088 
1089  if (debug_) cout << " PFBlockAlgo: PFrecTrack->Track Pt= "
1090  << Pt << " DPt = " << DPt << endl;
1091  if ( ( DPtovPtCut_[Algo] > 0. &&
1092  DPt/Pt > DPtovPtCut_[Algo]*sigmaHad ) ||
1093  NHit < NHitCut_[Algo] ) {
1094  // (Algo >= 3 && LostHits != 0) ) {
1095  if (debug_) cout << " PFBlockAlgo: skip badly measured track"
1096  << ", P = " << P
1097  << ", Pt = " << Pt
1098  << " DPt = " << DPt
1099  << ", N(hits) = " << NHit << " (Lost : " << LostHits << "/" << NLostHit << ")"
1100  << ", Algo = " << Algo
1101  << endl;
1102  if (debug_) cout << " cut is DPt/Pt < " << DPtovPtCut_[Algo] * sigmaHad << endl;
1103  if (debug_) cout << " cut is NHit >= " << NHitCut_[Algo] << endl;
1104  /*
1105  std::cout << "Track REJECTED : ";
1106  std::cout << ", P = " << P
1107  << ", Pt = " << Pt
1108  << " DPt = " << DPt
1109  << ", N(hits) = " << NHit << " (Lost : " << LostHits << "/" << NLostHit << ")"
1110  << ", Algo = " << Algo
1111  << std::endl;
1112  */
1113  return false;
1114  }
1115 
1116  /*
1117  std::cout << "Track Accepted : ";
1118  std::cout << ", P = " << P
1119  << ", Pt = " << Pt
1120  << " DPt = " << DPt
1121  << ", N(hits) = " << NHit << " (Lost : " << LostHits << "/" << NLostHit << ")"
1122  << ", Algo = " << Algo
1123  << std::endl;
1124  */
1125  return true;
1126 }
bool useIterTracking_
Flag to turn off quality cuts which require iterative tracking (for heavy-ions)
Definition: PFBlockAlgo.h:285
#define P
std::vector< double > DPtovPtCut_
DPt/Pt cut for creating atrack element.
Definition: PFBlockAlgo.h:279
T sqrt(T t)
Definition: SSEVec.h:28
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
Definition: fakeMenu.h:4
std::vector< unsigned > NHitCut_
Number of layers crossed cut for creating atrack element.
Definition: PFBlockAlgo.h:282
void PFBlockAlgo::link ( const reco::PFBlockElement el1,
const reco::PFBlockElement el2,
PFBlockLink::Type linktype,
reco::PFBlock::LinkTest linktest,
double &  dist 
) const
private

check whether 2 elements are linked. Returns distance and linktype

Definition at line 291 of file PFBlockAlgo.cc.

References reco::PFBlockElement::clusterRef(), gather_cfg::cout, debug_, ECAL, PFBlockLink::ECALandBREM, PFBlockLink::ECALandECAL, PFBlockLink::ECALandGSF, PFBlockLink::ECALandHCAL, PFBlockLink::GSFandBREM, PFBlockLink::GSFandGSF, reco::PFBlockElementBrem::GsftrackRefPF(), reco::PFBlockElementGsfTrack::GsftrackRefPF(), PFBlockLink::HCALandBREM, PFBlockLink::HCALandGSF, PFBlockLink::HFEMandHFHAD, reco::PFBlockElement::isLinkedToDisplacedVertex(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), PFBlockLink::PS1andBREM, PFBlockLink::PS1andECAL, PFBlockLink::PS1andGSF, PFBlockLink::PS1andPS2, PFBlockLink::PS2andBREM, PFBlockLink::PS2andECAL, PFBlockLink::PS2andGSF, PFBlockLink::SCandECAL, reco::PFBlockElement::T_FROM_GAMMACONV, LinkByRecHit::testECALAndPSByRecHit(), LinkByRecHit::testHFEMAndHFHADByRecHit(), testLinkBySuperCluster(), testLinkByVertex(), testSuperClusterPFCluster(), LinkByRecHit::testTrackAndClusterByRecHit(), testTrackAndPS(), PFBlockLink::TRACKandECAL, PFBlockLink::TRACKandGSF, PFBlockLink::TRACKandHCAL, PFBlockLink::TRACKandPS1, PFBlockLink::TRACKandPS2, PFBlockLink::TRACKandTRACK, reco::PFBlockElement::trackRefPF(), reco::PFBlockElementGsfTrack::trackType(), reco::PFBlockElement::trackType(), reco::PFBlockElement::type(), and useConvBremPFRecTracks_.

Referenced by associate(), and packLinks().

295  {
296 
297 
298 
299  dist=-1.;
300  linktest = PFBlock::LINKTEST_RECHIT; //rechit by default
301 
302  PFBlockElement::Type type1 = el1->type();
303  PFBlockElement::Type type2 = el2->type();
304 
305  if( type1==type2 ) {
306  // cannot link 2 elements of the same type.
307  // except if the elements are 2 tracks or 2 ECAL
308  if( type1!=PFBlockElement::TRACK && type1!=PFBlockElement::GSF &&
309  type1!=PFBlockElement::ECAL) {
310  return;
311  }
312 
313  // cannot link two primary tracks (except if they come from a V0)
314  if( type1 ==PFBlockElement::TRACK) {
315  if ( !el1->isLinkedToDisplacedVertex() || !el2->isLinkedToDisplacedVertex())
316  return;
317  }
318  }
319 
320  linktype = static_cast<PFBlockLink::Type>
321  ((1<< (type1-1) ) | (1<< (type2-1) ));
322 
323  if(debug_ ) std::cout << " PFBlockAlgo links type1 " << type1 << " type2 " << type2 << std::endl;
324 
325  PFBlockElement::Type lowType = type1;
326  PFBlockElement::Type highType = type2;
327  const PFBlockElement* lowEl = el1;
328  const PFBlockElement* highEl = el2;
329 
330  if(type1>type2) {
331  lowType = type2;
332  highType = type1;
333  lowEl = el2;
334  highEl = el1;
335  }
336 
337  switch(linktype) {
340  {
341  // cout<<"TRACKandPS"<<endl;
342  PFRecTrackRef trackref = lowEl->trackRefPF();
343  PFClusterRef clusterref = highEl->clusterRef();
344  assert( !trackref.isNull() );
345  assert( !clusterref.isNull() );
346  // PJ - 14-May-09 : A link by rechit is needed here !
347  dist = testTrackAndPS( *trackref, *clusterref );
348  linktest = PFBlock::LINKTEST_RECHIT;
349  break;
350  }
351 
353  {
354  if(debug_ ) cout<<"TRACKandECAL"<<endl;
355  PFRecTrackRef trackref = lowEl->trackRefPF();
356 
357  if(debug_ ) std::cout << " Track pt " << trackref->trackRef()->pt() << std::endl;
358 
359  PFClusterRef clusterref = highEl->clusterRef();
360  assert( !trackref.isNull() );
361  assert( !clusterref.isNull() );
362  dist = LinkByRecHit::testTrackAndClusterByRecHit( *trackref, *clusterref, false, debug_ );
363  linktest = PFBlock::LINKTEST_RECHIT;
364 
365  if ( debug_ ) {
366  if( dist > 0. ) {
367  std::cout << " Here a link has been established"
368  << " between a track an Ecal with dist "
369  << dist << std::endl;
370  } else {
371  std::cout << " No link found " << std::endl;
372  }
373  }
374 
375  break;
376  }
378  {
379  // cout<<"TRACKandHCAL"<<endl;
380  PFRecTrackRef trackref = lowEl->trackRefPF();
381  PFClusterRef clusterref = highEl->clusterRef();
382  assert( !trackref.isNull() );
383  assert( !clusterref.isNull() );
384  dist = LinkByRecHit::testTrackAndClusterByRecHit( *trackref, *clusterref, false, debug_ );
385  linktest = PFBlock::LINKTEST_RECHIT;
386  break;
387  }
389  {
390  // cout<<"ECALandHCAL"<<endl;
391  PFClusterRef ecalref = lowEl->clusterRef();
392  PFClusterRef hcalref = highEl->clusterRef();
393  assert( !ecalref.isNull() );
394  assert( !hcalref.isNull() );
395  // PJ - 14-May-09 : A link by rechit is needed here !
396  // dist = testECALAndHCAL( *ecalref, *hcalref );
397  dist = -1.;
398  linktest = PFBlock::LINKTEST_RECHIT;
399  break;
400  }
403  {
404  // cout<<"PSandECAL"<<endl;
405  PFClusterRef psref = lowEl->clusterRef();
406  PFClusterRef ecalref = highEl->clusterRef();
407  assert( !psref.isNull() );
408  assert( !ecalref.isNull() );
409  dist = LinkByRecHit::testECALAndPSByRecHit( *ecalref, *psref ,debug_);
410  linktest = PFBlock::LINKTEST_RECHIT;
411  break;
412  }
414  {
415  PFClusterRef ps1ref = lowEl->clusterRef();
416  PFClusterRef ps2ref = highEl->clusterRef();
417  assert( !ps1ref.isNull() );
418  assert( !ps2ref.isNull() );
419  // PJ - 14-May-09 : A link by rechit is needed here !
420  // dist = testPS1AndPS2( *ps1ref, *ps2ref );
421  dist = -1.;
422  linktest = PFBlock::LINKTEST_RECHIT;
423  break;
424  }
426  {
427  if(debug_ )
428  cout<<"TRACKandTRACK"<<endl;
429  dist = testLinkByVertex(lowEl, highEl);
430  if(debug_ )
431  std::cout << " PFBlockLink::TRACKandTRACK dist " << dist << std::endl;
432  linktest = PFBlock::LINKTEST_RECHIT;
433  break;
434  }
435 
437  {
438 
439  PFClusterRef ecal1ref = lowEl->clusterRef();
440  PFClusterRef ecal2ref = highEl->clusterRef();
441  assert( !ecal1ref.isNull() );
442  assert( !ecal2ref.isNull() );
443  if(debug_)
444  cout << " PFBlockLink::ECALandECAL" << endl;
445  dist = testLinkBySuperCluster(ecal1ref,ecal2ref);
446  break;
447  }
448 
450  {
451  PFClusterRef clusterref = lowEl->clusterRef();
452  assert( !clusterref.isNull() );
453  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(highEl);
454  const PFRecTrack * myTrack = &(GsfEl->GsftrackPF());
455  dist = LinkByRecHit::testTrackAndClusterByRecHit( *myTrack, *clusterref, false, debug_ );
456  linktest = PFBlock::LINKTEST_RECHIT;
457 
458  if ( debug_ ) {
459  if ( dist > 0. ) {
460  std::cout << " Here a link has been established"
461  << " between a GSF track an Ecal with dist "
462  << dist << std::endl;
463  } else {
464  if(debug_ ) std::cout << " No link found " << std::endl;
465  }
466  }
467  break;
468  }
470  {
471  PFRecTrackRef trackref = lowEl->trackRefPF();
472  assert( !trackref.isNull() );
473  const reco::PFBlockElementGsfTrack * GsfEl =
474  dynamic_cast<const reco::PFBlockElementGsfTrack*>(highEl);
475  GsfPFRecTrackRef gsfref = GsfEl->GsftrackRefPF();
476  reco::TrackRef kftrackref= (*trackref).trackRef();
477  assert( !gsfref.isNull() );
478  PFRecTrackRef refkf = (*gsfref).kfPFRecTrackRef();
479  if(refkf.isNonnull()) {
480  reco::TrackRef gsftrackref = (*refkf).trackRef();
481  if (gsftrackref.isNonnull()&&kftrackref.isNonnull()) {
482  if (kftrackref == gsftrackref) {
483  dist = 0.001;
484  } else {
485  dist = -1.;
486  }
487  } else {
488  dist = -1.;
489  }
490  } else {
491  dist = -1.;
492  }
493 
494 
496  if(lowEl->isLinkedToDisplacedVertex()){
497  vector<PFRecTrackRef> pfrectrack_vec = GsfEl->GsftrackRefPF()->convBremPFRecTrackRef();
498  if(pfrectrack_vec.size() > 0){
499  for(unsigned int iconv = 0; iconv < pfrectrack_vec.size(); iconv++) {
501  // use track ref
502  if(kftrackref == (*pfrectrack_vec[iconv]).trackRef()) {
503  dist = 0.001;
504  }
505  }
506  else{
507  // use the track base ref
508  reco::TrackBaseRef newTrackBaseRef((*pfrectrack_vec[iconv]).trackRef());
509  reco::TrackBaseRef elemTrackBaseRef(kftrackref);
510  if(newTrackBaseRef == elemTrackBaseRef){
511  dist = 0.001;
512  }
513  }
514  }
515  }
516  }
517  }
518 
519 
520  break;
521  }
522 
524  {
525  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(lowEl);
526  const reco::PFBlockElementBrem * BremEl = dynamic_cast<const reco::PFBlockElementBrem*>(highEl);
527  GsfPFRecTrackRef gsfref = GsfEl->GsftrackRefPF();
528  GsfPFRecTrackRef bremref = BremEl->GsftrackRefPF();
529  assert( !gsfref.isNull() );
530  assert( !bremref.isNull() );
531  if (gsfref == bremref) {
532  dist = 0.001;
533  } else {
534  dist = -1.;
535  }
536  break;
537  }
539  {
540  const reco::PFBlockElementGsfTrack * lowGsfEl =
541  dynamic_cast<const reco::PFBlockElementGsfTrack*>(lowEl);
542  const reco::PFBlockElementGsfTrack * highGsfEl =
543  dynamic_cast<const reco::PFBlockElementGsfTrack*>(highEl);
544 
545  GsfPFRecTrackRef lowgsfref = lowGsfEl->GsftrackRefPF();
546  GsfPFRecTrackRef highgsfref = highGsfEl->GsftrackRefPF();
547  assert( !lowgsfref.isNull() );
548  assert( !highgsfref.isNull() );
549 
550  if( (lowGsfEl->trackType(reco::PFBlockElement::T_FROM_GAMMACONV) == false &&
552  (highGsfEl->trackType(reco::PFBlockElement::T_FROM_GAMMACONV) == false &&
554  if(lowgsfref->trackId() == highgsfref->trackId()) {
555  dist = 0.001;
556  }
557  else {
558  dist = -1.;
559  }
560  }
561  break;
562  }
564  {
565  PFClusterRef clusterref = lowEl->clusterRef();
566  assert( !clusterref.isNull() );
567  const reco::PFBlockElementBrem * BremEl =
568  dynamic_cast<const reco::PFBlockElementBrem*>(highEl);
569  const PFRecTrack * myTrack = &(BremEl->trackPF());
570  /*
571  double DP = (BremEl->DeltaP())*(-1.);
572  double SigmaDP = BremEl->SigmaDeltaP();
573  double SignBremDp = DP/SigmaDP;
574  */
575  bool isBrem = true;
576  dist = LinkByRecHit::testTrackAndClusterByRecHit( *myTrack, *clusterref, isBrem, debug_);
577  if( debug_ && dist > 0. )
578  std::cout << "ECALandBREM: dist testTrackAndClusterByRecHit "
579  << dist << std::endl;
580  linktest = PFBlock::LINKTEST_RECHIT;
581  break;
582  }
585  {
586  PFClusterRef psref = lowEl->clusterRef();
587  assert( !psref.isNull() );
588  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(highEl);
589  const PFRecTrack * myTrack = &(GsfEl->GsftrackPF());
590  // PJ - 14-May-09 : A link by rechit is needed here !
591  dist = testTrackAndPS( *myTrack, *psref );
592  linktest = PFBlock::LINKTEST_RECHIT;
593  break;
594  }
597  {
598  PFClusterRef psref = lowEl->clusterRef();
599  assert( !psref.isNull() );
600  const reco::PFBlockElementBrem * BremEl = dynamic_cast<const reco::PFBlockElementBrem*>(highEl);
601  const PFRecTrack * myTrack = &(BremEl->trackPF());
602  // PJ - 14-May-09 : A link by rechit is needed here !
603  dist = testTrackAndPS( *myTrack, *psref );
604  linktest = PFBlock::LINKTEST_RECHIT;
605  break;
606  }
608  {
609  PFClusterRef clusterref = lowEl->clusterRef();
610  assert( !clusterref.isNull() );
611  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(highEl);
612  const PFRecTrack * myTrack = &(GsfEl->GsftrackPF());
613  dist = LinkByRecHit::testTrackAndClusterByRecHit( *myTrack, *clusterref, false, debug_ );
614  linktest = PFBlock::LINKTEST_RECHIT;
615  break;
616  }
618  {
619  PFClusterRef clusterref = lowEl->clusterRef();
620  assert( !clusterref.isNull() );
621  const reco::PFBlockElementBrem * BremEl = dynamic_cast<const reco::PFBlockElementBrem*>(highEl);
622  const PFRecTrack * myTrack = &(BremEl->trackPF());
623  bool isBrem = true;
624  dist = LinkByRecHit::testTrackAndClusterByRecHit( *myTrack, *clusterref, isBrem, debug_);
625  break;
626  }
628  {
629  // cout<<"HFEMandHFHAD"<<endl;
630  PFClusterRef eref = lowEl->clusterRef();
631  PFClusterRef href = highEl->clusterRef();
632  assert( !eref.isNull() );
633  assert( !href.isNull() );
634  dist = LinkByRecHit::testHFEMAndHFHADByRecHit( *eref, *href, debug_ );
635  linktest = PFBlock::LINKTEST_RECHIT;
636  break;
637 
638  }
640  {
641  PFClusterRef clusterref = lowEl->clusterRef();
642 
643  assert( !clusterref.isNull() );
644 
645  const reco::PFBlockElementSuperCluster * scEl =
646  dynamic_cast<const reco::PFBlockElementSuperCluster*>(highEl);
647  assert (!scEl->superClusterRef().isNull());
648  dist = testSuperClusterPFCluster(scEl->superClusterRef(),
649  clusterref);
650  break;
651  }
652  default:
653  dist = -1.;
654  linktest = PFBlock::LINKTEST_RECHIT;
655  // cerr<<"link type not implemented yet: 0x"<<hex<<linktype<<dec<<endl;
656  // assert(0);
657  return;
658  }
659 }
Abstract base class for a PFBlock element (track, cluster...)
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
GsfPFRecTrackRef GsftrackRefPF() const
double testSuperClusterPFCluster(const reco::SuperClusterRef &sct1, const reco::PFClusterRef &elt2) const
test association between SuperClusters and ECAL
Definition: PFBlockAlgo.cc:795
static double testECALAndPSByRecHit(const reco::PFCluster &clusterECAL, const reco::PFCluster &clusterPS, bool debug=false)
Type type() const
double testTrackAndPS(const reco::PFRecTrack &track, const reco::PFCluster &ps) const
Definition: PFBlockAlgo.cc:662
double testLinkBySuperCluster(const reco::PFClusterRef &elt1, const reco::PFClusterRef &elt2) const
test association by Supercluster between two ECAL
Definition: PFBlockAlgo.cc:754
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
bool isNull() const
Checks for null.
Definition: Ref.h:246
bool useConvBremPFRecTracks_
switch on/off Conversions Brem Recovery with KF Tracks
Definition: PFBlockAlgo.h:300
virtual PFClusterRef clusterRef() const
virtual PFRecTrackRef trackRefPF() const
virtual bool trackType(TrackType trType) const
double testLinkByVertex(const reco::PFBlockElement *elt1, const reco::PFBlockElement *elt2) const
Definition: PFBlockAlgo.cc:869
static double testHFEMAndHFHADByRecHit(const reco::PFCluster &clusterHFEM, const reco::PFCluster &clusterHFHAD, bool debug=false)
test association between HFEM and HFHAD, by rechit
virtual bool trackType(TrackType trType) const
GsfPFRecTrackRef GsftrackRefPF() const
tuple cout
Definition: gather_cfg.py:41
virtual bool isLinkedToDisplacedVertex() const
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:10
int PFBlockAlgo::muAssocToTrack ( const reco::TrackRef trackref,
const edm::Handle< reco::MuonCollection > &  muonh 
) const
private

Definition at line 1129 of file PFBlockAlgo.cc.

References edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), and j.

Referenced by setInput().

1130  {
1131  if(muonh.isValid() ) {
1132  for(unsigned j=0;j<muonh->size(); j++) {
1133  reco::MuonRef muonref( muonh, j );
1134  if (muonref->track().isNonnull())
1135  if( muonref->track() == trackref ) return j;
1136  }
1137  }
1138  return -1; // not found
1139 }
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
int PFBlockAlgo::muAssocToTrack ( const reco::TrackRef trackref,
const edm::OrphanHandle< reco::MuonCollection > &  muonh 
) const
private

Definition at line 1142 of file PFBlockAlgo.cc.

References edm::Ref< C, T, F >::isNonnull(), edm::OrphanHandleBase::isValid(), and j.

1143  {
1144  if(muonh.isValid() ) {
1145  for(unsigned j=0;j<muonh->size(); j++) {
1146  reco::MuonRef muonref( muonh, j );
1147  if (muonref->track().isNonnull())
1148  if( muonref->track() == trackref ) return j;
1149  }
1150  }
1151  return -1; // not found
1152 }
int j
Definition: DBlmapReader.cc:9
void PFBlockAlgo::packLinks ( reco::PFBlock block,
const std::vector< PFBlockLink > &  links 
) const
private

compute missing links in the blocks (the recursive procedure does not build all links)

Definition at line 211 of file PFBlockAlgo.cc.

References reco::PFBlock::bookLinkData(), gather_cfg::cout, debug_, reco::PFBlock::elements(), asciidump::els, link(), reco::PFBlock::linkData(), PFBlockLink::NONE, reco::PFBlock::setLink(), and edm::OwnVector< T, P >::size().

Referenced by findBlocks().

212  {
213 
214 
216 
217  block.bookLinkData();
218 
219  //First Loop: update all link data
220  for( unsigned i1=0; i1<els.size(); i1++ ) {
221  for( unsigned i2=0; i2<els.size(); i2++ ) {
222 
223  // no reflexive link
224  if( i1==i2 ) continue;
225 
226  double dist = -1;
227 
228  bool linked = false;
229  PFBlock::LinkTest linktest
230  = PFBlock::LINKTEST_RECHIT;
231 
232  // are these elements already linked ?
233  // this can be optimized
234 
235  for( unsigned il=0; il<links.size(); il++ ) {
236  if( (links[il].element1() == i1 &&
237  links[il].element2() == i2) ||
238  (links[il].element1() == i2 &&
239  links[il].element2() == i1) ) { // yes
240 
241  dist = links[il].dist();
242  linked = true;
243 
244  //modif-beg
245  //retrieve type of test used to get distance
246  linktest = links[il].test();
247 #ifdef PFLOW_DEBUG
248  if( debug_ )
249  cout << "Reading link vector: linktest used="
250  << linktest
251  << " distance = " << dist
252  << endl;
253 #endif
254  //modif-end
255 
256  break;
257  }
258  }
259 
260  if(!linked) {
262  link( & els[i1], & els[i2], linktype, linktest, dist);
263  }
264 
265  //loading link data according to link test used: RECHIT
266  //block.setLink( i1, i2, chi2, block.linkData() );
267 #ifdef PFLOW_DEBUG
268  if( debug_ )
269  cout << "Setting link between elements " << i1 << " and " << i2
270  << " of dist =" << dist << " computed from link test "
271  << linktest << endl;
272 #endif
273  block.setLink( i1, i2, dist, block.linkData(), linktest );
274  }
275  }
276 
277  // Do not cut the link between the primary track and the clusters. It would be analysed in the PFCandConnector.cc
278  // checkDisplacedVertexLinks( block );
279 }
size_type size() const
Definition: OwnVector.h:262
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
const LinkData & linkData() const
Definition: PFBlock.h:112
tuple els
Definition: asciidump.py:420
void setLink(unsigned i1, unsigned i2, double dist, LinkData &linkData, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:26
void link(const reco::PFBlockElement *el1, const reco::PFBlockElement *el2, PFBlockLink::Type &linktype, reco::PFBlock::LinkTest &linktest, double &dist) const
check whether 2 elements are linked. Returns distance and linktype
Definition: PFBlockAlgo.cc:291
void bookLinkData()
Definition: PFBlock.cc:20
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
void PFBlockAlgo::setDebug ( bool  debug)
inline

sets debug printout flag

Definition at line 160 of file PFBlockAlgo.h.

References debug, and debug_.

Referenced by PFRootEventManager::readOptions().

160 {debug_ = debug;}
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
#define debug
Definition: MEtoEDMFormat.h:34
template<template< typename > class T>
void PFBlockAlgo::setInput ( const T< reco::PFRecTrackCollection > &  trackh,
const T< reco::GsfPFRecTrackCollection > &  gsftrackh,
const T< reco::GsfPFRecTrackCollection > &  convbremgsftrackh,
const T< reco::MuonCollection > &  muonh,
const T< reco::PFDisplacedTrackerVertexCollection > &  nuclearh,
const T< reco::PFRecTrackCollection > &  nucleartrackh,
const T< reco::PFConversionCollection > &  conv,
const T< reco::PFV0Collection > &  v0,
const T< reco::PFClusterCollection > &  ecalh,
const T< reco::PFClusterCollection > &  hcalh,
const T< reco::PFClusterCollection > &  hfemh,
const T< reco::PFClusterCollection > &  hfhadh,
const T< reco::PFClusterCollection > &  psh,
const T< reco::PhotonCollection > &  egphh,
const Mask trackMask = dummyMask_,
const Mask gsftrackMask = dummyMask_,
const Mask ecalMask = dummyMask_,
const Mask hcalMask = dummyMask_,
const Mask hfemMask = dummyMask_,
const Mask hfhadMask = dummyMask_,
const Mask psMask = dummyMask_,
const Mask phMask = dummyMask_ 
)

set input collections of tracks and clusters

–———— GSF Primary tracks and brems ———————

get tracks from converted brems

Loop over the photons

–———— conversions ———————

The tracks from conversions are filled into the elements collection

–———— V0 ———————

The tracks from V0 are filled into the elements collection

One need to cross check if those tracks was not already filled from the conversion collection

This is a new track not yet included into the elements collection

–———— Displaced Vertices ———————

The tracks from Displaced Vertices are filled into the elements collection

One need to cross check if those tracks was not already filled from the conversion or V0 collections

This is a new track not yet included into the elements collection

Fill the displaced vertex ref

--------—— Tracks ---------------——

Mask the tracks in trackh collection already included from Conversions V0 and Displaced Vertices. Take care that all those collections come from the same "generalTracks" collection.

Definition at line 328 of file PFBlockAlgo.h.

References checkMaskSize(), ClusterClusterMapping::checkOverlap(), gather_cfg::cout, debug_, reco::PFBlockElement::DEFAULT, reco::PFBlockElement::ECAL, elements_, fillFromPhoton(), spr::find(), goodPtResolution(), reco::PFBlockElement::HCAL, reco::PFBlockElement::HFEM, reco::PFBlockElement::HFHAD, i, edm::Ref< C, T, F >::isAvailable(), PFMuonAlgo::isLooseMuon(), PFMuonAlgo::isMuon(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), muAssocToTrack(), reco::PFBlockElement::NONE, nuclearInteractionsPurity_, PhotonSelectorAlgo::passPhotonSelection(), pfcSCVec_, photonSelector_, PFLayer::PS1, reco::PFBlockElement::PS1, PFLayer::PS2, reco::PFBlockElement::PS2, scpfcRefs_, reco::PFBlockElement::setConversionRef(), reco::PFBlockElement::setDisplacedVertexRef(), reco::PFBlockElementSuperCluster::setFromGsfElectron(), reco::PFBlockElementSuperCluster::setFromPhoton(), reco::PFBlockElement::setMuonRef(), reco::PFBlockElement::setTrackType(), reco::PFBlockElement::setV0Ref(), findQualityFiles::size, superClusters_, reco::PFBlockElement::T_FROM_DISP, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElement::T_FROM_V0, reco::PFBlockElement::T_TO_DISP, useConvBremPFRecTracks_, useEGPhotons_, and relativeConstraints::value.

Referenced by PFRootEventManager::particleFlow().

349  {
350 
351 
352  checkMaskSize( *trackh,
353  *gsftrackh,
354  *ecalh,
355  *hcalh,
356  *hfemh,
357  *hfhadh,
358  *psh,
359  *egphh,
360  trackMask,
361  gsftrackMask,
362  ecalMask,
363  hcalMask,
364  hfemMask,
365  hfhadMask,
366  psMask,
367  phMask);
368 
369  /*
370  if (nucleartrackh.isValid()){
371  for(unsigned i=0;i<nucleartrackh->size(); i++) {
372  reco::PFRecTrackRef trackRef(nucleartrackh,i);
373  std::cout << *trackRef << std::endl;
374  }
375  }
376  */
377 
379  std::vector<reco::PFRecTrackRef> convBremPFRecTracks;
380  convBremPFRecTracks.clear();
381  // Super cluster mapping
382  superClusters_.clear();
383  scpfcRefs_.clear();
384  pfcSCVec_.clear();
385 
386  if(gsftrackh.isValid() ) {
387  const reco::GsfPFRecTrackCollection PFGsfProd = *(gsftrackh.product());
388  for(unsigned i=0;i<gsftrackh->size(); i++) {
389  if( !gsftrackMask.empty() &&
390  !gsftrackMask[i] ) continue;
391  reco::GsfPFRecTrackRef refgsf(gsftrackh,i );
392 
393  if((refgsf).isNull()) continue;
394  reco::GsfTrackRef gsf=refgsf->gsfTrackRef();
395 
396  // retrieve and save the SC if ECAL-driven - Florian
397  if(gsf->extra().isAvailable() && gsf->extra()->seedRef().isAvailable()) {
398  reco::ElectronSeedRef seedRef= gsf->extra()->seedRef().castTo<reco::ElectronSeedRef>();
399  // check that the seed is valid
400  if(seedRef.isAvailable() && seedRef->isEcalDriven()) {
401  reco::SuperClusterRef scRef = seedRef->caloCluster().castTo<reco::SuperClusterRef>();
402  if(scRef.isNonnull()) {
403  std::vector<reco::SuperClusterRef>::iterator itcheck=find(superClusters_.begin(),superClusters_.end(),scRef);
404  // not present, add it
405  if(itcheck==superClusters_.end())
406  {
407  superClusters_.push_back(scRef);
410  sce->setFromGsfElectron(true);
411  elements_.push_back(sce);
412  }
413  else // it is already present, update the PFBE
414  {
415  PFBlockElementSCEqual myEqual(scRef);
416  std::list<reco::PFBlockElement*>::iterator itcheck=find_if(elements_.begin(),elements_.end(),myEqual);
417  if(itcheck!=elements_.end())
418  {
419  reco::PFBlockElementSuperCluster* thePFBE=dynamic_cast<reco::PFBlockElementSuperCluster*>(*itcheck);
420  thePFBE->setFromGsfElectron(true);
421  // std::cout << " Updating element to add electron information" << std::endl;
422  }
423 // else
424 // {
425 // std::cout << " Missing element " << std::endl;
426 // }
427  }
428  }
429  }
430  }
431 
432  reco::PFBlockElement* gsfEl;
433 
434  const std::vector<reco::PFTrajectoryPoint>
435  PfGsfPoint = PFGsfProd[i].trajectoryPoints();
436 
437  unsigned int c_gsf=0;
438  bool PassTracker = false;
439  bool GetPout = false;
440  unsigned int IndexPout = 0;
441 
442  typedef std::vector<reco::PFTrajectoryPoint>::const_iterator IP;
443  for(IP itPfGsfPoint = PfGsfPoint.begin();
444  itPfGsfPoint!= PfGsfPoint.end();itPfGsfPoint++) {
445 
446  if (itPfGsfPoint->isValid()){
447  int layGsfP = itPfGsfPoint->layer();
448  if (layGsfP == -1) PassTracker = true;
449  if (PassTracker && layGsfP > 0 && GetPout == false) {
450  IndexPout = c_gsf-1;
451  GetPout = true;
452  }
453  //const math::XYZTLorentzVector GsfMoment = itPfGsfPoint->momentum();
454  c_gsf++;
455  }
456  }
457  math::XYZTLorentzVector pin = PfGsfPoint[0].momentum();
458  math::XYZTLorentzVector pout = PfGsfPoint[IndexPout].momentum();
459 
462  const std::vector<reco::PFRecTrackRef>& temp_convBremPFRecTracks(refgsf->convBremPFRecTrackRef());
463  if(temp_convBremPFRecTracks.size() > 0) {
464  for(unsigned int iconv = 0; iconv <temp_convBremPFRecTracks.size(); iconv++) {
465  convBremPFRecTracks.push_back(temp_convBremPFRecTracks[iconv]);
466  }
467  }
468  }
469 
470  gsfEl = new reco::PFBlockElementGsfTrack(refgsf, pin, pout);
471 
472  elements_.push_back( gsfEl);
473 
474  std::vector<reco::PFBrem> pfbrem = refgsf->PFRecBrem();
475 
476  for (unsigned i2=0;i2<pfbrem.size(); i2++) {
477  const double DP = pfbrem[i2].DeltaP();
478  const double SigmaDP = pfbrem[i2].SigmaDeltaP();
479  const unsigned int TrajP = pfbrem[i2].indTrajPoint();
480  if(TrajP == 99) continue;
481 
482  reco::PFBlockElement* bremEl;
483  bremEl = new reco::PFBlockElementBrem(refgsf,DP,SigmaDP,TrajP);
484  elements_.push_back(bremEl);
485 
486  }
487  }
488 
489  }
490 
492  if(useEGPhotons_ && egphh.isValid()) {
493  unsigned size=egphh->size();
494  for(unsigned isc=0; isc<size; ++isc) {
495  if(!phMask.empty() && !(phMask)[isc] ) continue;
496  if(!photonSelector_->passPhotonSelection((*egphh)[isc])) continue;
497  // std::cout << " Selected a supercluster" << std::endl;
498  // Add only the super clusters not already included
499  reco::SuperClusterRef scRef((*egphh)[isc].superCluster());
500  std::vector<reco::SuperClusterRef>::iterator itcheck=find(superClusters_.begin(),superClusters_.end(),(*egphh)[isc].superCluster());
501  if(itcheck==superClusters_.end())
502  {
503  superClusters_.push_back(scRef);
505  new reco::PFBlockElementSuperCluster((*egphh)[isc].superCluster());
506  fillFromPhoton((*egphh)[isc],sce);
507  elements_.push_back(sce);
508  }
509  else
510  {
511  PFBlockElementSCEqual myEqual(scRef);
512  std::list<reco::PFBlockElement*>::iterator itcheck=find_if(elements_.begin(),elements_.end(),myEqual);
513  if(itcheck!=elements_.end())
514  {
515  reco::PFBlockElementSuperCluster* thePFBE=dynamic_cast<reco::PFBlockElementSuperCluster*>(*itcheck);
516  fillFromPhoton((*egphh)[isc],thePFBE);
517  thePFBE->setFromPhoton(true);
518  // std::cout << " Updating element to add Photon information " << photonSelector_->passPhotonSelection((*egphh)[isc]) << std::endl;
519 
520  }
521 // else
522 // {
523 // std::cout << " Missing element " << std::endl;
524 // }
525  }
526  }
527  }
528 
529  // set the vector to the right size so to allow random access
530  scpfcRefs_.resize(superClusters_.size());
531 
533 
535 
536  if(convh.isValid() ) {
537  reco::PFBlockElement* trkFromConversionElement;
538  for(unsigned i=0;i<convh->size(); i++) {
539  reco::PFConversionRef convRef(convh,i);
540 
541  unsigned int trackSize=(convRef->pfTracks()).size();
542  if ( convRef->pfTracks().size() < 2) continue;
543  for(unsigned iTk=0;iTk<trackSize; iTk++) {
544 
545  reco::PFRecTrackRef compPFTkRef = convRef->pfTracks()[iTk];
546  trkFromConversionElement = new reco::PFBlockElementTrack(convRef->pfTracks()[iTk]);
547  trkFromConversionElement->setConversionRef( convRef->originalConversion(), reco::PFBlockElement::T_FROM_GAMMACONV);
548 
549  elements_.push_back( trkFromConversionElement );
550 
551 
552  if (debug_){
553  std::cout << "PF Block Element from Conversion electron " <<
554  (*trkFromConversionElement).trackRef().key() << std::endl;
555  std::cout << *trkFromConversionElement << std::endl;
556  }
557 
558  }
559  }
560  }
561 
562 
564 
566 
567  if(v0.isValid() ) {
568  reco::PFBlockElement* trkFromV0Element = 0;
569  for(unsigned i=0;i<v0->size(); i++) {
570  reco::PFV0Ref v0Ref( v0, i );
571  unsigned int trackSize=(v0Ref->pfTracks()).size();
572  for(unsigned iTk=0;iTk<trackSize; iTk++) {
573 
574  reco::PFRecTrackRef newPFRecTrackRef = (v0Ref->pfTracks())[iTk];
575  reco::TrackBaseRef newTrackBaseRef(newPFRecTrackRef->trackRef());
576  bool bNew = true;
577 
580  for(IE iel = elements_.begin(); iel != elements_.end(); iel++){
581  reco::TrackBaseRef elemTrackBaseRef((*iel)->trackRef());
582  if (newTrackBaseRef == elemTrackBaseRef){
583  trkFromV0Element = *iel;
584  bNew = false;
585  continue;
586  }
587  }
588 
590  if (bNew) {
591  trkFromV0Element = new reco::PFBlockElementTrack(v0Ref->pfTracks()[iTk]);
592  elements_.push_back( trkFromV0Element );
593  }
594 
595  trkFromV0Element->setV0Ref( v0Ref->originalV0(),
597 
598  if (debug_){
599  std::cout << "PF Block Element from V0 track New = " << bNew
600  << (*trkFromV0Element).trackRef().key() << std::endl;
601  std::cout << *trkFromV0Element << std::endl;
602  }
603 
604 
605  }
606  }
607  }
608 
610 
612 
613  if(nuclearh.isValid()) {
614  reco::PFBlockElement* trkFromDisplacedVertexElement = 0;
615  for(unsigned i=0;i<nuclearh->size(); i++) {
616 
617  const reco::PFDisplacedTrackerVertexRef dispacedVertexRef( nuclearh, i );
618 
619  // std::cout << "Nuclear Interactions Purity " << nuclearInteractionsPurity_ << std::endl;
620  // dispacedVertexRef->displacedVertexRef()->Dump();
621  //bool bIncludeVertices = true;
622 
623 
624  bool bIncludeVertices = false;
625  bool bNucl = dispacedVertexRef->displacedVertexRef()->isNucl();
626  bool bNucl_Loose = dispacedVertexRef->displacedVertexRef()->isNucl_Loose();
627  bool bNucl_Kink = dispacedVertexRef->displacedVertexRef()->isNucl_Kink();
628 
629  if (nuclearInteractionsPurity_ >= 1) bIncludeVertices = bNucl;
630  if (nuclearInteractionsPurity_ >= 2) bIncludeVertices = bIncludeVertices || bNucl_Loose;
631  if (nuclearInteractionsPurity_ >= 3) bIncludeVertices = bIncludeVertices || bNucl_Kink;
632 
633  if (bIncludeVertices){
634 
635  unsigned int trackSize= dispacedVertexRef->pfRecTracks().size();
636  if (debug_){
637  std::cout << "" << std::endl;
638  std::cout << "Displaced Vertex " << i << std::endl;
639  dispacedVertexRef->displacedVertexRef()->Dump();
640  }
641  for(unsigned iTk=0;iTk < trackSize; iTk++) {
642 
643 
644  // This peace of code looks weired at first but it seems to be necessary to let
645  // PFRooTEvent work properly. Since the track position called REPPoint is transient
646  // it has to be calculated and the PFRecTrack collection associted to Displaced Vertex is not
647  // anymore the original collection. So here we match both collections if possible
648  reco::PFRecTrackRef newPFRecTrackRef = dispacedVertexRef->pfRecTracks()[iTk];
649  reco::TrackBaseRef constTrackBaseRef(newPFRecTrackRef->trackRef());
650 
651 
652  if (nucleartrackh.isValid()){
653  for(unsigned i=0;i<nucleartrackh->size(); i++) {
654  reco::PFRecTrackRef transientPFRecTrackRef(nucleartrackh,i);
655  reco::TrackBaseRef transientTrackBaseRef(transientPFRecTrackRef->trackRef());
656  if (constTrackBaseRef==transientTrackBaseRef){
657  newPFRecTrackRef = transientPFRecTrackRef;
658  break;
659  }
660  }
661  }
662  reco::TrackBaseRef newTrackBaseRef(newPFRecTrackRef->trackRef());
663 
664 
665 
666  bool bNew = true;
668 
671  for(IE iel = elements_.begin(); iel != elements_.end(); iel++){
672  reco::TrackBaseRef elemTrackBaseRef((*iel)->trackRef());
673  if (newTrackBaseRef == elemTrackBaseRef){
674  trkFromDisplacedVertexElement = *iel;
675  bNew = false;
676  continue;
677  }
678  }
679 
680 
682  if (bNew) {
683 
684 
685 
686  trkFromDisplacedVertexElement = new reco::PFBlockElementTrack(newPFRecTrackRef);
687  elements_.push_back( trkFromDisplacedVertexElement );
688  }
689 
690  if (dispacedVertexRef->isIncomingTrack(newPFRecTrackRef))
692  else if (dispacedVertexRef->isOutgoingTrack(newPFRecTrackRef))
694  else
695  blockType = reco::PFBlockElement::DEFAULT;
696 
698  trkFromDisplacedVertexElement->setDisplacedVertexRef( dispacedVertexRef, blockType );
699 
700 
701  if (debug_){
702  std::cout << "PF Block Element from DisplacedTrackingVertex track New = " << bNew
703  << (*trkFromDisplacedVertexElement).trackRef().key() << std::endl;
704  std::cout << *trkFromDisplacedVertexElement << std::endl;
705  }
706 
707 
708  }
709  }
710  }
711 
712  if (debug_) std::cout << "" << std::endl;
713 
714  }
715 
717 
721 
722  if(trackh.isValid() ) {
723 
724  if (debug_) std::cout << "Tracks already in from Displaced Vertices " << std::endl;
725 
726  Mask trackMaskVertex;
727 
728  for(unsigned i=0;i<trackh->size(); i++) {
729  reco::PFRecTrackRef pfRefTrack( trackh,i );
730  reco::TrackRef trackRef = pfRefTrack->trackRef();
731 
732  bool bMask = true;
733  for(IE iel = elements_.begin(); iel != elements_.end(); iel++){
734  reco::TrackRef elemTrackRef = (*iel)->trackRef();
735  if( trackRef == elemTrackRef ) {
736  if (debug_) std::cout << " " << trackRef.key();
737  bMask = false; continue;
738  }
739  }
740 
741  trackMaskVertex.push_back(bMask);
742  }
743 
744  if (debug_) std::cout << "" << std::endl;
745 
746  if (debug_) std::cout << "Additionnal tracks from main collection " << std::endl;
747 
748  for(unsigned i=0;i<trackh->size(); i++) {
749 
750 
751  // this track has been disabled
752  if( !trackMask.empty() && !trackMask[i] ) continue;
753 
754  reco::PFRecTrackRef ref( trackh,i );
755 
756  if (debug_) std::cout << " " << ref->trackRef().key();
757 
758  // Get the eventual muon associated to this track
759  int muId_ = muAssocToTrack( ref->trackRef(), muonh );
760  bool thisIsAPotentialMuon = false;
761  if( muId_ != -1 ) {
762  reco::MuonRef muonref( muonh, muId_ );
763  thisIsAPotentialMuon =
764  PFMuonAlgo::isLooseMuon(muonref) ||
765  PFMuonAlgo::isMuon(muonref);
766  }
767  // Reject bad tracks (except if identified as muon
768  if( !thisIsAPotentialMuon && !goodPtResolution( ref->trackRef() ) ) continue;
769 
770  if (thisIsAPotentialMuon && debug_) std::cout << "Potential Muon P " << ref->trackRef()->p()
771  << " pt " << ref->trackRef()->p() << std::endl;
772 
773 
774 
775  reco::PFBlockElement* primaryElement = new reco::PFBlockElementTrack( ref );
776 
777  if( muId_ != -1 ) {
778  // if a muon has been found
779  reco::MuonRef muonref( muonh, muId_ );
780 
781  // If this track was already added to the collection, we just need to find the associated element and
782  // attach to it the reference
783  if (!trackMaskVertex.empty() && !trackMaskVertex[i]){
784  reco::TrackRef primaryTrackRef = ref->trackRef();
785  for(IE iel = elements_.begin(); iel != elements_.end(); iel++){
786  reco::TrackRef elemTrackRef = (*iel)->trackRef();
787  if( primaryTrackRef == elemTrackRef ) {
788  (*iel)->setMuonRef( muonref );
789  if (debug_) std::cout << "One of the tracks identified in displaced vertices collections was spotted as muon" <<std:: endl;
790  }
791  }
792  } else primaryElement->setMuonRef( muonref );
793 
794  }
795 
796  if (!trackMaskVertex.empty() && !trackMaskVertex[i]) continue;
797 
798 
799  // set track type T_FROM_GAMMA for pfrectracks associated to conv brems
801  if(convBremPFRecTracks.size() > 0.) {
802  for(unsigned int iconv = 0; iconv < convBremPFRecTracks.size(); iconv++) {
803  if((*ref).trackRef() == (*convBremPFRecTracks[iconv]).trackRef()) {
804  bool value = true;
806  }
807  }
808  }
809  }
810  elements_.push_back( primaryElement );
811 
812  }
813 
814  if (debug_) std::cout << " " << std::endl;
815 
816  }
817 
818 
819  // -------------- GSF tracks and brems for Conversion Recovery ----------
820 
821  if(convbremgsftrackh.isValid() ) {
822 
823 
824  const reco::GsfPFRecTrackCollection ConvPFGsfProd = *(convbremgsftrackh.product());
825  for(unsigned i=0;i<convbremgsftrackh->size(); i++) {
826 
827  reco::GsfPFRecTrackRef refgsf(convbremgsftrackh,i );
828 
829  if((refgsf).isNull()) continue;
830 
831  reco::PFBlockElement* gsfEl;
832 
833  const std::vector<reco::PFTrajectoryPoint>
834  PfGsfPoint = ConvPFGsfProd[i].trajectoryPoints();
835 
836  unsigned int c_gsf=0;
837  bool PassTracker = false;
838  bool GetPout = false;
839  unsigned int IndexPout = -1;
840 
841  typedef std::vector<reco::PFTrajectoryPoint>::const_iterator IP;
842  for(IP itPfGsfPoint = PfGsfPoint.begin();
843  itPfGsfPoint!= PfGsfPoint.end();itPfGsfPoint++) {
844 
845  if (itPfGsfPoint->isValid()){
846  int layGsfP = itPfGsfPoint->layer();
847  if (layGsfP == -1) PassTracker = true;
848  if (PassTracker && layGsfP > 0 && GetPout == false) {
849  IndexPout = c_gsf-1;
850  GetPout = true;
851  }
852  //const math::XYZTLorentzVector GsfMoment = itPfGsfPoint->momentum();
853  c_gsf++;
854  }
855  }
856  math::XYZTLorentzVector pin = PfGsfPoint[0].momentum();
857  math::XYZTLorentzVector pout = PfGsfPoint[IndexPout].momentum();
858 
859 
860 
861  gsfEl = new reco::PFBlockElementGsfTrack(refgsf, pin, pout);
862 
863  bool valuegsf = true;
864  // IMPORTANT SET T_FROM_GAMMACONV trackType() FOR CONVERSIONS
866 
867 
868 
869  elements_.push_back( gsfEl);
870  std::vector<reco::PFBrem> pfbrem = refgsf->PFRecBrem();
871 
872  for (unsigned i2=0;i2<pfbrem.size(); i2++) {
873  const double DP = pfbrem[i2].DeltaP();
874  const double SigmaDP = pfbrem[i2].SigmaDeltaP();
875  const unsigned int TrajP = pfbrem[i2].indTrajPoint();
876  if(TrajP == 99) continue;
877 
878  reco::PFBlockElement* bremEl;
879  bremEl = new reco::PFBlockElementBrem(refgsf,DP,SigmaDP,TrajP);
880  elements_.push_back(bremEl);
881 
882  }
883  }
884  }
885 
886 
887  // -------------- ECAL clusters ---------------------
888 
889 
890  if(ecalh.isValid() ) {
891  pfcSCVec_.resize(ecalh->size(),-1);
892  for(unsigned i=0;i<ecalh->size(); i++) {
893 
894  // this ecal cluster has been disabled
895  if( !ecalMask.empty() &&
896  !ecalMask[i] ) continue;
897 
898  reco::PFClusterRef ref( ecalh,i );
900  = new reco::PFBlockElementCluster( ref,
902  elements_.push_back( te );
903  // Now mapping with Superclusters
905 
906  if(scindex>=0) {
907  pfcSCVec_[ref.key()]=scindex;
908  scpfcRefs_[scindex].push_back(ref);
909  }
910  }
911  }
912 
913  // -------------- HCAL clusters ---------------------
914 
915  if(hcalh.isValid() ) {
916 
917  for(unsigned i=0;i<hcalh->size(); i++) {
918 
919  // this hcal cluster has been disabled
920  if( !hcalMask.empty() &&
921  !hcalMask[i] ) continue;
922 
923  reco::PFClusterRef ref( hcalh,i );
925  = new reco::PFBlockElementCluster( ref,
927  elements_.push_back( th );
928  }
929  }
930 
931 
932  // -------------- HFEM clusters ---------------------
933 
934  if(hfemh.isValid() ) {
935 
936  for(unsigned i=0;i<hfemh->size(); i++) {
937 
938  // this hfem cluster has been disabled
939  if( !hfemMask.empty() &&
940  !hfemMask[i] ) continue;
941 
942  reco::PFClusterRef ref( hfemh,i );
944  = new reco::PFBlockElementCluster( ref,
946  elements_.push_back( th );
947  }
948  }
949 
950 
951  // -------------- HFHAD clusters ---------------------
952 
953  if(hfhadh.isValid() ) {
954 
955  for(unsigned i=0;i<hfhadh->size(); i++) {
956 
957  // this hfhad cluster has been disabled
958  if( !hfhadMask.empty() &&
959  !hfhadMask[i] ) continue;
960 
961  reco::PFClusterRef ref( hfhadh,i );
963  = new reco::PFBlockElementCluster( ref,
965  elements_.push_back( th );
966  }
967  }
968 
969 
970 
971 
972  // -------------- PS clusters ---------------------
973 
974  if(psh.isValid() ) {
975  for(unsigned i=0;i<psh->size(); i++) {
976 
977  // this ps cluster has been disabled
978  if( !psMask.empty() &&
979  !psMask[i] ) continue;
981  reco::PFClusterRef ref( psh,i );
982  // two types of elements: PS1 (V) and PS2 (H)
983  // depending on layer: PS1 or PS2
984  switch(ref->layer()){
985  case PFLayer::PS1:
987  break;
988  case PFLayer::PS2:
990  break;
991  default:
992  break;
993  }
995  = new reco::PFBlockElementCluster( ref,
996  type );
997  elements_.push_back( tp );
998 
999  }
1000  }
1001 }
type
Definition: HCALResponse.h:22
void checkMaskSize(const reco::PFRecTrackCollection &tracks, const reco::GsfPFRecTrackCollection &gsftracks, const reco::PFClusterCollection &ecals, const reco::PFClusterCollection &hcals, const reco::PFClusterCollection &hfems, const reco::PFClusterCollection &hfhads, const reco::PFClusterCollection &pss, const reco::PhotonCollection &egphh, const Mask &trackMask, const Mask &gsftrackMask, const Mask &ecalMask, const Mask &hcalMask, const Mask &hfemMask, const Mask &hfhadMask, const Mask &psMask, const Mask &phMask) const
Definition: PFBlockAlgo.cc:928
Abstract base class for a PFBlock element (track, cluster...)
int i
Definition: DBlmapReader.cc:9
std::vector< reco::SuperClusterRef > superClusters_
list of superclusters
Definition: PFBlockAlgo.h:305
bool passPhotonSelection(const reco::Photon &) const
static bool isMuon(const reco::PFBlockElement &elt)
Check if a block element is a muon.
Definition: PFMuonAlgo.cc:11
int nuclearInteractionsPurity_
Definition: PFBlockAlgo.h:297
void setFromGsfElectron(bool val)
set provenance
bool isAvailable() const
Definition: Ref.h:275
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static int checkOverlap(const reco::PFCluster &pfc, std::vector< const reco::SuperCluster * > sc, float minfrac=0.01, bool debug=false)
virtual void setTrackType(TrackType trType, bool value)
the trackType
void setFromPhoton(bool val)
set provenance
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
bool useConvBremPFRecTracks_
switch on/off Conversions Brem Recovery with KF Tracks
Definition: PFBlockAlgo.h:300
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef &niref, TrackType trType)
virtual void setV0Ref(const VertexCompositeCandidateRef &v0ref, TrackType trType)
std::list< reco::PFBlockElement * >::iterator IE
define these in *Fwd files in DataFormats/ParticleFlowReco?
Definition: PFBlockAlgo.h:175
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
Definition: PFBlockAlgo.h:274
std::vector< std::vector< reco::PFClusterRef > > scpfcRefs_
PF clusters corresponding to a given SC.
Definition: PFBlockAlgo.h:312
bool goodPtResolution(const reco::TrackRef &trackref)
open a resolution map
void fillFromPhoton(const reco::Photon &photon, reco::PFBlockElementSuperCluster *pfbe)
const PhotonSelectorAlgo * photonSelector_
PhotonSelector.
Definition: PFBlockAlgo.h:303
virtual void setConversionRef(const ConversionRef &convRef, TrackType trType)
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:24
key_type key() const
Accessor for product key.
Definition: Ref.h:265
std::vector< int > pfcSCVec_
SC corresponding to the PF cluster.
Definition: PFBlockAlgo.h:309
virtual void setMuonRef(const MuonRef &muref)
tuple cout
Definition: gather_cfg.py:41
std::vector< bool > Mask
Definition: PFBlockAlgo.h:82
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
tuple size
Write out results.
bool useEGPhotons_
Flag to turn off the import of EG Photons.
Definition: PFBlockAlgo.h:288
template<template< typename > class T>
void PFBlockAlgo::setInput ( const T< reco::PFRecTrackCollection > &  trackh,
const T< reco::MuonCollection > &  muonh,
const T< reco::PFClusterCollection > &  ecalh,
const T< reco::PFClusterCollection > &  hcalh,
const T< reco::PFClusterCollection > &  hfemh,
const T< reco::PFClusterCollection > &  hfhadh,
const T< reco::PFClusterCollection > &  psh,
const Mask trackMask = dummyMask_,
const Mask ecalMask = dummyMask_,
const Mask hcalMask = dummyMask_,
const Mask psMask = dummyMask_ 
)
inline

COLIN: I think this is for particle flow at HLT...

Definition at line 111 of file PFBlockAlgo.h.

121  {
123  T<reco::GsfPFRecTrackCollection> convbremgsftrackh;
124  //T<reco::MuonCollection> muonh;
126  T<reco::PFRecTrackCollection> nucleartrackh;
130  setInput<T>( trackh, gsftrackh, convbremgsftrackh, muonh, nuclearh, nucleartrackh, convh, v0,
131  ecalh, hcalh, hfemh, hfhadh, psh, phh,
132  trackMask, ecalMask, hcalMask, psMask);
133  }
long double T
template<template< typename > class T>
void PFBlockAlgo::setInput ( const T< reco::PFRecTrackCollection > &  trackh,
const T< reco::GsfPFRecTrackCollection > &  gsftrackh,
const T< reco::PFClusterCollection > &  ecalh,
const T< reco::PFClusterCollection > &  hcalh,
const T< reco::PFClusterCollection > &  psh,
const Mask trackMask = dummyMask_,
const Mask gsftrackMask = dummyMask_,
const Mask ecalMask = dummyMask_,
const Mask hcalMask = dummyMask_,
const Mask psMask = dummyMask_ 
)
inline

COLIN: what is this setinput function for? can it be removed?

Definition at line 137 of file PFBlockAlgo.h.

146  {
147  T<reco::GsfPFRecTrackCollection> convbremgsftrackh;
150  T<reco::PFRecTrackCollection> nucleartrackh;
154  setInput<T>( trackh, gsftrackh, convbremgsftrackh, muonh, nuclearh, nucleartrackh, convh, v0, ecalh, hcalh, psh, egphh,
155  trackMask, gsftrackMask,ecalMask, hcalMask, psMask);
156  }
long double T
void PFBlockAlgo::setParameters ( std::vector< double > &  DPtovPtCut,
std::vector< unsigned > &  NHitCut,
bool  useConvBremPFRecTracks,
bool  useIterTracking,
int  nuclearInteractionsPurity,
bool  useEGPhotons,
std::vector< double > &  photonSelectionCuts 
)

Definition at line 31 of file PFBlockAlgo.cc.

References DPtovPtCut_, NHitCut_, nuclearInteractionsPurity_, photonSelector_, useConvBremPFRecTracks_, useEGPhotons_, and useIterTracking_.

Referenced by PFRootEventManager::readOptions().

37  {
38 
39  DPtovPtCut_ = DPtovPtCut;
40  NHitCut_ = NHitCut;
41  useIterTracking_ = useIterTracking;
42  useConvBremPFRecTracks_ = useConvBremPFRecTracks;
43  nuclearInteractionsPurity_ = nuclearInteractionsPurity;
44  useEGPhotons_ = useEGPhotons;
45  // Pt cut; Track iso (constant + slope), Ecal iso (constant + slope), HCAL iso (constant+slope), H/E
46  if(useEGPhotons_)
47  photonSelector_ = new PhotonSelectorAlgo(photonSelectionCuts[0],
48  photonSelectionCuts[1], photonSelectionCuts[2],
49  photonSelectionCuts[3], photonSelectionCuts[4],
50  photonSelectionCuts[5], photonSelectionCuts[6],
51  photonSelectionCuts[7]);
52 }
bool useIterTracking_
Flag to turn off quality cuts which require iterative tracking (for heavy-ions)
Definition: PFBlockAlgo.h:285
int nuclearInteractionsPurity_
Definition: PFBlockAlgo.h:297
std::vector< double > DPtovPtCut_
DPt/Pt cut for creating atrack element.
Definition: PFBlockAlgo.h:279
bool useConvBremPFRecTracks_
switch on/off Conversions Brem Recovery with KF Tracks
Definition: PFBlockAlgo.h:300
const PhotonSelectorAlgo * photonSelector_
PhotonSelector.
Definition: PFBlockAlgo.h:303
bool useEGPhotons_
Flag to turn off the import of EG Photons.
Definition: PFBlockAlgo.h:288
std::vector< unsigned > NHitCut_
Number of layers crossed cut for creating atrack element.
Definition: PFBlockAlgo.h:282
double PFBlockAlgo::testECALAndHCAL ( const reco::PFCluster ecal,
const reco::PFCluster hcal 
) const
private

tests association between an ECAL and an HCAL cluster

Returns
distance

Definition at line 726 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, and reco::PFCluster::positionREP().

727  {
728 
729  // cout<<"entering testECALAndHCAL"<<endl;
730 
731  /*
732  double dist =
733  computeDist( ecal.positionREP().Eta(),
734  ecal.positionREP().Phi(),
735  hcal.positionREP().Eta(),
736  hcal.positionREP().Phi() );
737  */
738 
739 #ifdef PFLOW_DEBUG
740  if(debug_) cout<<"testECALAndHCAL "<< dist <<" "<<endl;
741  if(debug_){
742  cout<<" ecaleta " << ecal.positionREP().Eta()
743  <<" ecalphi " << ecal.positionREP().Phi()
744  <<" hcaleta " << hcal.positionREP().Eta()
745  <<" hcalphi " << hcal.positionREP().Phi()
746  }
747 #endif
748 
749  // Need to implement a link by RecHit
750  return -1.;
751 }
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:76
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
double PFBlockAlgo::testLinkBySuperCluster ( const reco::PFClusterRef elt1,
const reco::PFClusterRef elt2 
) const
private

test association by Supercluster between two ECAL

Definition at line 754 of file PFBlockAlgo.cc.

References LinkByRecHit::computeDist(), i, edm::Ref< C, T, F >::key(), pfcSCVec_, and scpfcRefs_.

Referenced by link().

755  {
756 
757  // cout<<"entering testECALAndECAL "<< pfcRefSCMap_.size() << endl;
758 
759  double dist = -1;
760 
761  // the first one is not in any super cluster
762  int testindex=pfcSCVec_[ecal1.key()];
763  if(testindex == -1.) return dist;
764  // if(itcheck==pfcRefSCMap_.end()) return dist;
765  // now retrieve the of PFclusters in this super cluster
766 
767  const std::vector<reco::PFClusterRef> & thePFClusters(scpfcRefs_[testindex]);
768 
769  unsigned npf=thePFClusters.size();
770  for(unsigned i=0;i<npf;++i)
771  {
772  if(thePFClusters[i]==ecal2) // yes they are in the same SC
773  {
774  dist=LinkByRecHit::computeDist( ecal1->positionREP().Eta(),
775  ecal1->positionREP().Phi(),
776  ecal2->positionREP().Eta(),
777  ecal2->positionREP().Phi() );
778 // std::cout << " DETA " << fabs(ecal1->positionREP().Eta()-ecal2->positionREP().Eta()) << std::endl;
779 // if(fabs(ecal1->positionREP().Eta()-ecal2->positionREP().Eta())>0.2)
780 // {
781 // std::cout << " Super Cluster " << *(superClusters_[testindex]) << std::endl;
782 // std::cout << " Cluster1 " << *ecal1 << std::endl;
783 // std::cout << " Cluster2 " << *ecal2 << std::endl;
784 // ClusterClusterMapping::checkOverlap(*ecal1,superClusters_,0.01,true);
785 // ClusterClusterMapping::checkOverlap(*ecal2,superClusters_,0.01,true);
786 // }
787  return dist;
788  }
789  }
790  return dist;
791 }
int i
Definition: DBlmapReader.cc:9
static double computeDist(double eta1, double phi1, double eta2, double phi2)
computes a chisquare
std::vector< std::vector< reco::PFClusterRef > > scpfcRefs_
PF clusters corresponding to a given SC.
Definition: PFBlockAlgo.h:312
std::vector< int > pfcSCVec_
SC corresponding to the PF cluster.
Definition: PFBlockAlgo.h:309
double PFBlockAlgo::testLinkByVertex ( const reco::PFBlockElement elt1,
const reco::PFBlockElement elt2 
) const
private

Definition at line 869 of file PFBlockAlgo.cc.

References reco::PFBlockElement::convRef(), gather_cfg::cout, debug_, reco::PFBlockElement::displacedVertexRef(), edm::Ref< C, T, F >::isNonnull(), query::result, reco::PFBlockElement::T_FROM_DISP, reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElement::T_FROM_V0, reco::PFBlockElement::T_TO_DISP, reco::PFBlockElement::trackType(), and reco::PFBlockElement::V0Ref().

Referenced by link().

870  {
871 
872  // cout << "Test link by vertex between" << endl << *elt1 << endl << " and " << endl << *elt2 << endl;
873 
874  double result=-1.;
875 
878  PFDisplacedTrackerVertexRef ni1_TO_DISP = elt1->displacedVertexRef(T_TO_DISP);
879  PFDisplacedTrackerVertexRef ni2_TO_DISP = elt2->displacedVertexRef(T_TO_DISP);
880  PFDisplacedTrackerVertexRef ni1_FROM_DISP = elt1->displacedVertexRef(T_FROM_DISP);
881  PFDisplacedTrackerVertexRef ni2_FROM_DISP = elt2->displacedVertexRef(T_FROM_DISP);
882 
883  if( ni1_TO_DISP.isNonnull() && ni2_FROM_DISP.isNonnull())
884  if( ni1_TO_DISP == ni2_FROM_DISP ) { result = 1.0; return result; }
885 
886  if( ni1_FROM_DISP.isNonnull() && ni2_TO_DISP.isNonnull())
887  if( ni1_FROM_DISP == ni2_TO_DISP ) { result = 1.0; return result; }
888 
889  if( ni1_FROM_DISP.isNonnull() && ni2_FROM_DISP.isNonnull())
890  if( ni1_FROM_DISP == ni2_FROM_DISP ) { result = 1.0; return result; }
891 
892 
895 
896  if(debug_ ) std::cout << " testLinkByVertex On Conversions " << std::endl;
897 
898  if ( elt1->convRef().isNonnull() && elt2->convRef().isNonnull() ) {
899  if(debug_ ) std::cout << " PFBlockAlgo.cc testLinkByVertex Cconversion Refs are non null " << std::endl;
900  if ( elt1->convRef() == elt2->convRef() ) {
901  result=1.0;
902  if(debug_ ) std::cout << " testLinkByVertex Cconversion Refs are equal " << std::endl;
903  return result;
904  }
905  }
906 
907  }
908 
911  if(debug_ ) std::cout << " testLinkByVertex On V0 " << std::endl;
912  if ( elt1->V0Ref().isNonnull() && elt2->V0Ref().isNonnull() ) {
913  if(debug_ ) std::cout << " PFBlockAlgo.cc testLinkByVertex V0 Refs are non null " << std::endl;
914  if ( elt1->V0Ref() == elt2->V0Ref() ) {
915  result=1.0;
916  if(debug_ ) std::cout << " testLinkByVertex V0 Refs are equal " << std::endl;
917  return result;
918  }
919  }
920  }
921 
922  return result;
923 }
virtual PFDisplacedTrackerVertexRef displacedVertexRef(TrackType trType) const
virtual VertexCompositeCandidateRef V0Ref() const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
tuple result
Definition: query.py:137
virtual bool trackType(TrackType trType) const
virtual ConversionRef convRef() const
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
double PFBlockAlgo::testPS1AndPS2 ( const reco::PFCluster ps1,
const reco::PFCluster ps2 
) const
private

tests association between a PS1 v cluster and a PS2 h cluster returns distance

Definition at line 817 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, reco::CaloCluster::position(), and mathSSE::sqrt().

818  {
819 
820 #ifdef PFLOW_DEBUG
821  // cout<<"entering testPS1AndPS2"<<endl;
822 
823  // compute chi2 in y, z using swimming formulae
824  // y2 = y1 * z2/z1 and x2 = x1 *z2/z1
825 
826  // ps position1 x, y, z
827  double x1 = ps1.position().X();
828  double y1 = ps1.position().Y();
829  double z1 = ps1.position().Z();
830  double x2 = ps2.position().X();
831  double y2 = ps2.position().Y();
832  double z2 = ps2.position().Z();
833  // MDN Bug correction Jan 09: check that z1 and z2 have the same sign!
834  if (z1*z2<0.) -1.;
835  // swim to PS2
836  double scale = z2/z1;
837  double x1atPS2 = x1*scale;
838  double y1atPS2 = y1*scale;
839  // resolution of PS cluster dxdx and dydy from strip pitch and length
840  // vertical strips in PS1, measure x with pitch precision
841  double dx1dx1 = resPSpitch_*resPSpitch_*scale*scale;
842  double dy1dy1 = resPSlength_*resPSlength_*scale*scale;
843  // horizontal strips in PS2 , measure y with pitch precision
844  double dy2dy2 = resPSpitch_*resPSpitch_;
845  double dx2dx2 = resPSlength_*resPSlength_;
846 
847  // double chi2 = (x2-x1atPS2)*(x2-x1atPS2)/(dx1dx1 + dx2dx2)
848  // + (y2-y1atPS2)*(y2-y1atPS2)/(dy1dy1 + dy2dy2);
849 
850  double dist = std::sqrt( (x2-x1atPS2)*(x2-x1atPS2)
851  + (y2-y1atPS2)*(y2-y1atPS2));
852 
853  if(debug_) cout<<"testPS1AndPS2 "<<dist<<" "<<endl;
854  if(debug_){
855  cout<<" x1atPS2 "<< x1atPS2 << " dx1 "<<resPSpitch_*scale
856  <<" y1atPS2 "<< y1atPS2 << " dy1 "<<resPSlength_*scale<< endl
857  <<" x2 " <<x2 << " dx2 "<<resPSlength_
858  <<" y2 " << y2 << " dy2 "<<resPSpitch_<< endl;
859  }
860 #endif
861 
862  // Need a link by rechit here
863  return -1.;
864 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
T sqrt(T t)
Definition: SSEVec.h:28
tuple cout
Definition: gather_cfg.py:41
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
double PFBlockAlgo::testSuperClusterPFCluster ( const reco::SuperClusterRef sct1,
const reco::PFClusterRef elt2 
) const
private

test association between SuperClusters and ECAL

Definition at line 795 of file PFBlockAlgo.cc.

References LinkByRecHit::computeDist(), ClusterClusterMapping::overlap(), and muon::overlap().

Referenced by link().

796  {
797 
798  // cout<<"entering testECALAndECAL "<< pfcRefSCMap_.size() << endl;
799 
800  double dist = -1;
801 
802  bool overlap=ClusterClusterMapping::overlap(*ecal1,*ecal2);
803 
804  if(overlap) {
805  dist=LinkByRecHit::computeDist( ecal1->position().eta(),
806  ecal1->position().phi(),
807  ecal2->positionREP().Eta(),
808  ecal2->positionREP().Phi() );
809  return dist;
810  }
811  return dist;
812 }
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
static double computeDist(double eta1, double phi1, double eta2, double phi2)
computes a chisquare
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
double PFBlockAlgo::testTrackAndPS ( const reco::PFRecTrack track,
const reco::PFCluster ps 
) const
private

tests association between a track and a PS cluster returns distance

Definition at line 662 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, reco::PFTrack::extrapolatedPoint(), reco::PFTrajectoryPoint::isValid(), reco::PFCluster::layer(), reco::PFTrajectoryPoint::position(), reco::CaloCluster::position(), PFLayer::PS1, reco::PFTrajectoryPoint::PS1, PFLayer::PS2, reco::PFTrajectoryPoint::PS2, and mathSSE::sqrt().

Referenced by link().

663  {
664 
665 #ifdef PFLOW_DEBUG
666  // cout<<"entering testTrackAndPS"<<endl;
667  // resolution of PS cluster dxdx and dydy from strip pitch and length
668  double dx=0.;
669  double dy=0.;
670 
671  unsigned layerid =0;
672  // PS1: vertical strips PS2: horizontal strips
673  switch (ps.layer()) {
674  case PFLayer::PS1:
676 
677  // vertical strips in PS1, measure x with pitch precision
678  dx = resPSpitch_;
679  dy = resPSlength_;
680  break;
681  case PFLayer::PS2:
683  // horizontal strips in PS2, measure y with pitch precision
684  dy = resPSpitch_;
685  dx = resPSlength_;
686  break;
687  default:
688  break;
689  }
690  const reco::PFTrajectoryPoint& atPS
691  = track.extrapolatedPoint( layerid );
692  // did not reach PS, cannot be associated with a cluster.
693  if( ! atPS.isValid() ) return -1.;
694 
695  double trackx = atPS.position().X();
696  double tracky = atPS.position().Y();
697  double trackz = atPS.position().Z(); // MDN jan 09
698 
699  // ps position x, y
700  double psx = ps.position().X();
701  double psy = ps.position().Y();
702  // MDN Jan 09: check that trackz and psz have the same sign
703  double psz = ps.position().Z();
704  if( trackz*psz < 0.) return -1.;
705 
706  // double chi2 = (psx-trackx)*(psx-trackx)/(dx*dx + trackresolx*trackresolx)
707  // + (psy-tracky)*(psy-tracky)/(dy*dy + trackresoly*trackresoly);
708 
709  double dist = std::sqrt( (psx-trackx)*(psx-trackx)
710  + (psy-tracky)*(psy-tracky));
711  if(debug_) cout<<"testTrackAndPS "<< dist <<" "<<endl;
712  if(debug_){
713  cout<<" trackx " << trackx
714  <<" tracky " << tracky
715  <<" psx " << psx
716  <<" psy " << psy
717  << endl;
718  }
719 #endif
720 
721  // Return -1. as long as no link by rechit is available
722  return -1.;
723 }
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:81
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
const math::XYZPoint & position() const
cartesian position (x, y, z)
T sqrt(T t)
Definition: SSEVec.h:28
const reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
Definition: PFTrack.cc:76
bool isValid() const
is this point valid ?
tuple cout
Definition: gather_cfg.py:41
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:314
std::auto_ptr< reco::PFBlockCollection > PFBlockAlgo::transferBlocks ( )
inline
Returns
auto_ptr to collection of blocks

Definition at line 172 of file PFBlockAlgo.h.

References blocks_.

Referenced by PFRootEventManager::particleFlow().

172 {return blocks_;}
std::auto_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:268

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const PFBlockAlgo a 
)
friend

Definition at line 1012 of file PFBlockAlgo.cc.

1012  {
1013  if(! out) return out;
1014 
1015  out<<"====== Particle Flow Block Algorithm ======= ";
1016  out<<endl;
1017  out<<"number of unassociated elements : "<<a.elements_.size()<<endl;
1018  out<<endl;
1019 
1020  for(PFBlockAlgo::IEC ie = a.elements_.begin();
1021  ie != a.elements_.end(); ie++) {
1022  out<<"\t"<<**ie <<endl;
1023  }
1024 
1025 
1026  // const PFBlockCollection& blocks = a.blocks();
1027 
1028  const std::auto_ptr< reco::PFBlockCollection >& blocks
1029  = a.blocks();
1030 
1031  if(!blocks.get() ) {
1032  out<<"blocks already transfered"<<endl;
1033  }
1034  else {
1035  out<<"number of blocks : "<<blocks->size()<<endl;
1036  out<<endl;
1037 
1038  for(PFBlockAlgo::IBC ib=blocks->begin();
1039  ib != blocks->end(); ib++) {
1040  out<<(*ib)<<endl;
1041  }
1042  }
1043 
1044  return out;
1045 }
const std::auto_ptr< reco::PFBlockCollection > & blocks() const
Definition: PFBlockAlgo.h:168
std::list< reco::PFBlockElement * >::const_iterator IEC
Definition: PFBlockAlgo.h:176
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
Definition: PFBlockAlgo.h:274
tuple out
Definition: dbtoconf.py:99
reco::PFBlockCollection::const_iterator IBC
Definition: PFBlockAlgo.h:177

Member Data Documentation

std::auto_ptr< reco::PFBlockCollection > PFBlockAlgo::blocks_
private

Definition at line 268 of file PFBlockAlgo.h.

Referenced by associate(), blocks(), findBlocks(), and transferBlocks().

bool PFBlockAlgo::debug_
private
std::vector<double> PFBlockAlgo::DPtovPtCut_
private

DPt/Pt cut for creating atrack element.

Definition at line 279 of file PFBlockAlgo.h.

Referenced by goodPtResolution(), and setParameters().

const PFBlockAlgo::Mask PFBlockAlgo::dummyMask_
staticprivate

Definition at line 276 of file PFBlockAlgo.h.

std::list< reco::PFBlockElement* > PFBlockAlgo::elements_
private

actually, particles will be created by a separate producer

Definition at line 274 of file PFBlockAlgo.h.

Referenced by associate(), findBlocks(), operator<<(), setInput(), and ~PFBlockAlgo().

std::vector<unsigned> PFBlockAlgo::NHitCut_
private

Number of layers crossed cut for creating atrack element.

Definition at line 282 of file PFBlockAlgo.h.

Referenced by goodPtResolution(), and setParameters().

int PFBlockAlgo::nuclearInteractionsPurity_
private

Definition at line 297 of file PFBlockAlgo.h.

Referenced by setInput(), and setParameters().

std::vector<int> PFBlockAlgo::pfcSCVec_
private

SC corresponding to the PF cluster.

Definition at line 309 of file PFBlockAlgo.h.

Referenced by setInput(), and testLinkBySuperCluster().

const PhotonSelectorAlgo* PFBlockAlgo::photonSelector_
private

PhotonSelector.

Definition at line 303 of file PFBlockAlgo.h.

Referenced by setInput(), setParameters(), and ~PFBlockAlgo().

std::vector<std::vector<reco::PFClusterRef> > PFBlockAlgo::scpfcRefs_
private

PF clusters corresponding to a given SC.

Definition at line 312 of file PFBlockAlgo.h.

Referenced by setInput(), and testLinkBySuperCluster().

std::vector<reco::SuperClusterRef > PFBlockAlgo::superClusters_
private

list of superclusters

Definition at line 305 of file PFBlockAlgo.h.

Referenced by setInput().

bool PFBlockAlgo::useConvBremPFRecTracks_
private

switch on/off Conversions Brem Recovery with KF Tracks

Definition at line 300 of file PFBlockAlgo.h.

Referenced by link(), setInput(), and setParameters().

bool PFBlockAlgo::useEGPhotons_
private

Flag to turn off the import of EG Photons.

Definition at line 288 of file PFBlockAlgo.h.

Referenced by setInput(), and setParameters().

bool PFBlockAlgo::useIterTracking_
private

Flag to turn off quality cuts which require iterative tracking (for heavy-ions)

Definition at line 285 of file PFBlockAlgo.h.

Referenced by goodPtResolution(), and setParameters().