1 #ifndef RecoParticleFlow_PFProducer_PFBlockAlgo_h
2 #define RecoParticleFlow_PFProducer_PFBlockAlgo_h
81 std::vector<unsigned>& NHitCut,
82 bool useConvBremPFRecTracks,
84 int nuclearInteractionsPurity,
86 std::vector<double> & photonSelectionCuts
93 typedef std::vector<bool>
Mask;
96 template<
template<
typename>
class T>
123 template<
template<
typename>
class T >
145 setInput<T>( trackh, gsftrackh, convbremgsftrackh, muonh, nuclearh, nucleartrackh, convh, v0,
146 ecalh, hcalh, hoh, hfemh, hfhadh, psh, phh,
147 trackMask, ecalMask, hcalMask, hoMask, psMask);
151 template<
template<
typename>
class T >
171 setInput<T>( trackh, gsftrackh, convbremgsftrackh, muonh, nuclearh, nucleartrackh, convh, v0, ecalh, hcalh, hoh, psh, egphh,
172 trackMask, gsftrackMask,ecalMask, hcalMask, hoMask, psMask);
185 const std::auto_ptr< reco::PFBlockCollection >&
blocks()
const
192 typedef std::list< reco::PFBlockElement* >::iterator
IE;
193 typedef std::list< reco::PFBlockElement* >::const_iterator
IEC;
194 typedef reco::PFBlockCollection::const_iterator
IBC;
211 const std::vector<PFBlockLink>& links)
const;
272 const Mask& trackMask,
273 const Mask& gsftrackMask,
274 const Mask& ecalMask,
275 const Mask& hcalMask,
277 const Mask& hfemMask,
278 const Mask& hfhadMask,
280 const Mask& phMask)
const;
296 template<
template<
typename>
class T>
299 std::auto_ptr< reco::PFBlockCollection >
blocks_;
370 template<
template<
typename>
class T >
387 const Mask& trackMask,
388 const Mask& gsftrackMask,
389 const Mask& ecalMask,
390 const Mask& hcalMask,
392 const Mask& hfemMask,
393 const Mask& hfhadMask,
395 const Mask& phMask) {
427 std::vector<reco::PFRecTrackRef> convBremPFRecTracks;
428 convBremPFRecTracks.clear();
434 if(gsftrackh.isValid() ) {
436 for(
unsigned i=0;
i<gsftrackh->size(); ++
i) {
437 if( !gsftrackMask.empty() &&
438 !gsftrackMask[
i] )
continue;
441 if((refgsf).isNull())
continue;
448 if(seedRef.
isAvailable() && seedRef->isEcalDriven()) {
464 std::list<reco::PFBlockElement*>::iterator itcheck=find_if(
elements_.begin(),
elements_.end(),myEqual);
482 const std::vector<reco::PFTrajectoryPoint>
483 PfGsfPoint = PFGsfProd[
i].trajectoryPoints();
485 unsigned int c_gsf=0;
486 bool PassTracker =
false;
487 bool GetPout =
false;
488 unsigned int IndexPout = 0;
490 typedef std::vector<reco::PFTrajectoryPoint>::const_iterator IP;
491 for(IP itPfGsfPoint = PfGsfPoint.begin();
492 itPfGsfPoint!= PfGsfPoint.end();++itPfGsfPoint) {
494 if (itPfGsfPoint->isValid()){
495 int layGsfP = itPfGsfPoint->layer();
496 if (layGsfP == -1) PassTracker =
true;
497 if (PassTracker && layGsfP > 0 && GetPout ==
false) {
510 const std::vector<reco::PFRecTrackRef>& temp_convBremPFRecTracks(refgsf->convBremPFRecTrackRef());
511 if(temp_convBremPFRecTracks.size() > 0) {
512 for(
unsigned int iconv = 0; iconv <temp_convBremPFRecTracks.size(); ++iconv) {
513 convBremPFRecTracks.push_back(temp_convBremPFRecTracks[iconv]);
522 std::vector<reco::PFBrem> pfbrem = refgsf->PFRecBrem();
524 for (
unsigned i2=0;i2<pfbrem.size(); ++i2) {
525 const double DP = pfbrem[i2].DeltaP();
526 const double SigmaDP = pfbrem[i2].SigmaDeltaP();
527 const unsigned int TrajP = pfbrem[i2].indTrajPoint();
528 if(TrajP == 99)
continue;
541 unsigned size=egphh->size();
542 for(
unsigned isc=0; isc<
size; ++isc) {
543 if(!phMask.empty() && !(phMask)[isc] )
continue;
560 std::list<reco::PFBlockElement*>::iterator itcheck=find_if(
elements_.begin(),
elements_.end(),myEqual);
584 if(convh.isValid() ) {
586 for(
unsigned i=0;
i<convh->size(); ++
i) {
589 unsigned int trackSize=(convRef->pfTracks()).
size();
590 if ( convRef->pfTracks().size() < 2)
continue;
591 for(
unsigned iTk=0;iTk<trackSize; ++iTk) {
597 elements_.push_back( trkFromConversionElement );
601 std::cout <<
"PF Block Element from Conversion electron " <<
602 (*trkFromConversionElement).trackRef().key() << std::endl;
603 std::cout << *trkFromConversionElement << std::endl;
617 for(
unsigned i=0;
i<v0->size(); ++
i) {
619 unsigned int trackSize=(v0Ref->pfTracks()).
size();
620 for(
unsigned iTk=0;iTk<trackSize; ++iTk) {
630 if (newTrackBaseRef == elemTrackBaseRef){
631 trkFromV0Element = *iel;
643 trkFromV0Element->
setV0Ref( v0Ref->originalV0(),
647 std::cout <<
"PF Block Element from V0 track New = " << bNew
648 << (*trkFromV0Element).trackRef().key() << std::endl;
649 std::cout << *trkFromV0Element << std::endl;
661 if(nuclearh.isValid()) {
663 for(
unsigned i=0;
i<nuclearh->size(); ++
i) {
673 bool bIncludeVertices =
false;
674 bool bNucl = dispacedVertexRef->displacedVertexRef()->isNucl()
675 && dispacedVertexRef->displacedVertexRef()->position().rho()> 2.7;
676 bool bNucl_Loose = dispacedVertexRef->displacedVertexRef()->isNucl_Loose();
677 bool bNucl_Kink = dispacedVertexRef->displacedVertexRef()->isNucl_Kink();
683 if (bIncludeVertices){
685 unsigned int trackSize= dispacedVertexRef->pfRecTracks().size();
688 std::cout <<
"Displaced Vertex " <<
i << std::endl;
689 dispacedVertexRef->displacedVertexRef()->Dump();
691 for(
unsigned iTk=0;iTk < trackSize; ++iTk) {
702 if (nucleartrackh.isValid()){
703 for(
unsigned i=0;
i<nucleartrackh->size(); ++
i) {
706 if (constTrackBaseRef==transientTrackBaseRef){
707 newPFRecTrackRef = transientPFRecTrackRef;
723 if (newTrackBaseRef == elemTrackBaseRef){
724 trkFromDisplacedVertexElement = *iel;
737 elements_.push_back( trkFromDisplacedVertexElement );
740 if (dispacedVertexRef->isIncomingTrack(newPFRecTrackRef))
742 else if (dispacedVertexRef->isOutgoingTrack(newPFRecTrackRef))
752 std::cout <<
"PF Block Element from DisplacedTrackingVertex track New = " << bNew
753 << (*trkFromDisplacedVertexElement).trackRef().key() << std::endl;
754 std::cout << *trkFromDisplacedVertexElement << std::endl;
772 if(trackh.isValid() ) {
774 if (
debug_)
std::cout <<
"Tracks already in from Displaced Vertices " << std::endl;
776 Mask trackMaskVertex;
778 for(
unsigned i=0;
i<trackh->size(); ++
i) {
785 if( trackRef == elemTrackRef ) {
787 bMask =
false;
continue;
791 trackMaskVertex.push_back(bMask);
796 if (
debug_)
std::cout <<
"Additionnal tracks from main collection " << std::endl;
798 for(
unsigned i=0;
i<trackh->size(); ++
i) {
802 if( !trackMask.empty() && !trackMask[
i] )
continue;
810 bool thisIsAPotentialMuon =
false;
813 thisIsAPotentialMuon =
818 if( !thisIsAPotentialMuon && !
goodPtResolution( ref->trackRef() ) )
continue;
820 if (thisIsAPotentialMuon &&
debug_)
std::cout <<
"Potential Muon P " << ref->trackRef()->p()
821 <<
" pt " << ref->trackRef()->p() << std::endl;
833 if (!trackMaskVertex.empty() && !trackMaskVertex[
i]){
837 if( primaryTrackRef == elemTrackRef ) {
838 (*iel)->setMuonRef( muonref );
839 if (
debug_)
std::cout <<
"One of the tracks identified in displaced vertices collections was spotted as muon" <<std:: endl;
846 if (!trackMaskVertex.empty() && !trackMaskVertex[
i])
continue;
851 if(convBremPFRecTracks.size() > 0.) {
852 for(
unsigned int iconv = 0; iconv < convBremPFRecTracks.size(); ++iconv) {
853 if((*ref).trackRef() == (*convBremPFRecTracks[iconv]).trackRef()) {
870 if(convbremgsftrackh.isValid() ) {
874 for(
unsigned i=0;
i<convbremgsftrackh->size(); ++
i) {
878 if((refgsf).isNull())
continue;
882 const std::vector<reco::PFTrajectoryPoint>
883 PfGsfPoint = ConvPFGsfProd[
i].trajectoryPoints();
885 unsigned int c_gsf=0;
886 bool PassTracker =
false;
887 bool GetPout =
false;
888 unsigned int IndexPout = -1;
890 typedef std::vector<reco::PFTrajectoryPoint>::const_iterator IP;
891 for(IP itPfGsfPoint = PfGsfPoint.begin();
892 itPfGsfPoint!= PfGsfPoint.end();++itPfGsfPoint) {
894 if (itPfGsfPoint->isValid()){
895 int layGsfP = itPfGsfPoint->layer();
896 if (layGsfP == -1) PassTracker =
true;
897 if (PassTracker && layGsfP > 0 && GetPout ==
false) {
912 bool valuegsf =
true;
919 std::vector<reco::PFBrem> pfbrem = refgsf->PFRecBrem();
921 for (
unsigned i2=0;i2<pfbrem.size(); ++i2) {
922 const double DP = pfbrem[i2].DeltaP();
923 const double SigmaDP = pfbrem[i2].SigmaDeltaP();
924 const unsigned int TrajP = pfbrem[i2].indTrajPoint();
925 if(TrajP == 99)
continue;
939 if(ecalh.isValid() ) {
946 for(
unsigned i=0;
i<ecalh->size(); ++
i) {
949 if( !ecalMask.empty() &&
950 !ecalMask[
i] )
continue;
977 if(hcalh.isValid() ) {
979 for(
unsigned i=0;
i<hcalh->size(); ++
i) {
982 if( !hcalMask.empty() &&
983 !hcalMask[
i] )
continue;
995 if(
useHO_ && hoh.isValid() ) {
997 for(
unsigned i=0;
i<hoh->size(); ++
i) {
1000 if( !hoMask.empty() &&
1001 !hoMask[
i] )
continue;
1013 if(hfemh.isValid() ) {
1015 for(
unsigned i=0;
i<hfemh->size(); ++
i) {
1018 if( !hfemMask.empty() &&
1019 !hfemMask[
i] )
continue;
1032 if(hfhadh.isValid() ) {
1034 for(
unsigned i=0;
i<hfhadh->size(); ++
i) {
1037 if( !hfhadMask.empty() &&
1038 !hfhadMask[
i] )
continue;
1053 if(psh.isValid() ) {
1054 for(
unsigned i=0;
i<psh->size(); ++
i) {
1057 if( !psMask.empty() &&
1058 !psMask[
i] )
continue;
1063 switch(ref->layer()){
1086 for (std::list< reco::PFBlockElement* >::iterator it =
elements_.begin();
1088 switch ((*it)->type()){
1132 template<
template<
typename>
class T>
1135 pfbe->
setTrackIso(photonRef->trkSumPtHollowConeDR04());
1136 pfbe->
setEcalIso(photonRef->ecalRecHitSumEtConeDR04());
1137 pfbe->
setHcalIso(photonRef->hcalTowerSumEtConeDR04());
1138 pfbe->
setHoE(photonRef->hadronicOverEm());
const std::auto_ptr< reco::PFBlockCollection > & blocks() const
void insertFieldClusterElt(reco::PFBlockElement *hcalCluster)
Abstract base class for a PFBlock element (track, cluster...)
reconstructed track used as an input to particle flow
std::vector< reco::SuperClusterRef > superClusters_
list of superclusters
bool passPhotonSelection(const reco::Photon &) const
std::pair< ALIstring, ALIstring > pss
double testECALAndHCAL(const reco::PFCluster &ecal, const reco::PFCluster &hcal) const
bool useIterTracking_
Flag to turn off quality cuts which require iterative tracking (for heavy-ions)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
static bool isMuon(const reco::PFBlockElement &elt)
Check if a block element is a muon.
static HepMC::IO_HEPEVT conv
double testSuperClusterPFCluster(const reco::SuperClusterRef &sct1, const reco::PFClusterRef &elt2) const
test association between SuperClusters and ECAL
KDTreeLinkerTrackEcal TELinker_
double testHCALAndHO(const reco::PFCluster &hcal, const reco::PFCluster &ho) const
KDTreeLinkerPSEcal PSELinker_
friend std::ostream & operator<<(std::ostream &, const PFBlockAlgo &)
int nuclearInteractionsPurity_
void checkMaskSize(const reco::PFRecTrackCollection &tracks, const reco::GsfPFRecTrackCollection &gsftracks, const reco::PFClusterCollection &ecals, const reco::PFClusterCollection &hcals, const reco::PFClusterCollection &hos, 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 &hoMask, const Mask &hfemMask, const Mask &hfhadMask, const Mask &psMask, const Mask &phMask) const
void checkDisplacedVertexLinks(reco::PFBlock &block) const
remove extra links between primary track and clusters
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 > &hoh, const T< reco::PFClusterCollection > &psh, const Mask &trackMask=dummyMask_, const Mask &gsftrackMask=dummyMask_, const Mask &ecalMask=dummyMask_, const Mask &hcalMask=dummyMask_, const Mask &hoMask=dummyMask_, const Mask &psMask=dummyMask_)
COLIN: what is this setinput function for? can it be removed?
void setFromGsfElectron(bool val)
set provenance
std::auto_ptr< reco::PFBlockCollection > blocks_
std::vector< double > DPtovPtCut_
DPt/Pt cut for creating atrack element.
void insertFieldClusterElt(reco::PFBlockElement *ecalCluster)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
double testTrackAndPS(const reco::PFRecTrack &track, const reco::PFCluster &ps) const
std::list< reco::PFBlockElement * >::const_iterator IEC
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 fillFromPhoton(const T< reco::PhotonCollection > &, unsigned isc, reco::PFBlockElementSuperCluster *pfbe)
void setFromPhoton(bool val)
set provenance
void setHcalIso(float val)
set the had Iso
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double testLinkBySuperCluster(const reco::PFClusterRef &elt1, const reco::PFClusterRef &elt2) const
test association by Supercluster between two ECAL
bool isNonnull() const
Checks for non-null.
KDTreeLinkerTrackHcal THLinker_
double testPS1AndPS2(const reco::PFCluster &ps1, const reco::PFCluster &ps2) const
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 > &hoh, 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 &hoMask=dummyMask_, const Mask &psMask=dummyMask_)
COLIN: I think this is for particle flow at HLT...
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
void setTrackIso(float val)
set the track Iso
bool useConvBremPFRecTracks_
switch on/off Conversions Brem Recovery with KF Tracks
void setPhotonRef(const PhotonRef &ref)
set photonRef
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
void setDebug(bool debug)
sets debug printout flag
virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef &niref, TrackType trType)
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
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 > &hoh, 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 &hoMask=dummyMask_, const Mask &hfemMask=dummyMask_, const Mask &hfhadMask=dummyMask_, const Mask &psMask=dummyMask_, const Mask &phMask=dummyMask_)
set input collections of tracks and clusters
virtual void setV0Ref(const VertexCompositeCandidateRef &v0ref, TrackType trType)
void insertFieldClusterElt(reco::PFBlockElement *ecalCluster)
std::list< reco::PFBlockElement * >::iterator IE
define these in *Fwd files in DataFormats/ParticleFlowReco?
std::list< reco::PFBlockElement * > elements_
actually, particles will be created by a separate producer
void setHoE(float val)
set H/E
void insertTargetElt(reco::PFBlockElement *track)
std::vector< std::vector< reco::PFClusterRef > > scpfcRefs_
PF clusters corresponding to a given SC.
bool goodPtResolution(const reco::TrackRef &trackref)
open a resolution map
void packLinks(reco::PFBlock &block, const std::vector< PFBlockLink > &links) const
static const Mask dummyMask_
reco::PFBlockCollection::const_iterator IBC
IE associate(IE next, IE last, std::vector< PFBlockLink > &links)
const PhotonSelectorAlgo * photonSelector_
PhotonSelector.
virtual void setConversionRef(const ConversionRef &convRef, TrackType trType)
double testLinkByVertex(const reco::PFBlockElement *elt1, const reco::PFBlockElement *elt2) const
static bool isLooseMuon(const reco::PFBlockElement &elt)
std::auto_ptr< reco::PFBlockCollection > transferBlocks()
void insertTargetElt(reco::PFBlockElement *track)
key_type key() const
Accessor for product key.
bool linkPrefilter(const reco::PFBlockElement *last, const reco::PFBlockElement *next) const
Avoid to check links when not useful.
std::vector< Photon > PhotonCollection
collectin of Photon objects
void findBlocks()
build blocks
std::vector< int > pfcSCVec_
SC corresponding to the PF cluster.
Type
possible types. WARNING: have a look at PFBlockElement
void setParameters(std::vector< double > &DPtovPtCut, std::vector< unsigned > &NHitCut, bool useConvBremPFRecTracks, bool useIterTracking, int nuclearInteractionsPurity, bool useEGPhotons, std::vector< double > &photonSelectionCuts)
void insertTargetElt(reco::PFBlockElement *psCluster)
virtual void setMuonRef(const MuonRef &muref)
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
void setUseOptimization(bool useKDTreeTrackEcalLinker)
bool debug_
if true, debug printouts activated
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
tuple size
Write out results.
bool useEGPhotons_
Flag to turn off the import of EG Photons.
bool useKDTreeTrackEcalLinker_
void setEcalIso(float val)
set the ecal Iso
std::vector< unsigned > NHitCut_
Number of layers crossed cut for creating atrack element.