CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/EgammaCandidates/interface/Conversion.h

Go to the documentation of this file.
00001 #ifndef EgammaCandidates_Conversion_h
00002 #define EgammaCandidates_Conversion_h
00003 
00013 #include <bitset>
00014 #include "DataFormats/TrackReco/interface/TrackFwd.h" 
00015 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00016 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00017 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1DFloat.h"
00018 #include "DataFormats/VertexReco/interface/Vertex.h"
00019 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
00020 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00021 
00022 
00023 namespace reco {
00024     class Conversion  {
00025   public:
00026 
00027       enum ConversionAlgorithm {undefined=0, 
00028                                 ecalSeeded=1, 
00029                                 trackerOnly=2, 
00030                                 mixed=3, 
00031                                 pflow=4,
00032                                 algoSize=5}; 
00033 
00034       enum ConversionQuality {generalTracksOnly=0, 
00035                               arbitratedEcalSeeded=1, 
00036                               arbitratedMerged=2,
00037                               arbitratedMergedEcalGeneral=3,
00038                               highPurity=8, 
00039                               highEfficiency=9,
00040                               ecalMatched1Track=10,
00041                               ecalMatched2Track=11};
00042 
00043       static const std::string algoNames[];      
00044 
00045       // Default constructor
00046       Conversion();
00047       
00048       Conversion( const reco::CaloClusterPtrVector clu, 
00049                   const std::vector<edm::RefToBase<reco::Track> > tr,
00050                   const std::vector<math::XYZPoint> trackPositionAtEcal , 
00051                   const reco::Vertex  &  convVtx,
00052                   const std::vector<reco::CaloClusterPtr> & matchingBC,
00053                   const float DCA,        
00054                   const std::vector<math::XYZPoint> & innPoint,
00055                   const std::vector<math::XYZVector> & trackPin ,
00056                   const std::vector<math::XYZVector> & trackPout,
00057                   const std::vector<uint8_t> nHitsBeforeVtx,
00058                   const std::vector<Measurement1DFloat> & dlClosestHitToVtx,
00059                   uint8_t nSharedHits,
00060                   const float mva,
00061                   ConversionAlgorithm=undefined);
00062 
00063 
00064       Conversion( const reco::CaloClusterPtrVector clu, 
00065                   const std::vector<reco::TrackRef> tr,
00066                   const std::vector<math::XYZPoint> trackPositionAtEcal , 
00067                   const reco::Vertex  &  convVtx,
00068                   const std::vector<reco::CaloClusterPtr> & matchingBC,
00069                   const float DCA,        
00070                   const std::vector<math::XYZPoint> & innPoint,
00071                   const std::vector<math::XYZVector> & trackPin ,
00072                   const std::vector<math::XYZVector> & trackPout,
00073                   const float mva,
00074                   ConversionAlgorithm=undefined);
00075       
00076 
00077 
00078       
00079       Conversion( const reco::CaloClusterPtrVector clu, 
00080                   const std::vector<reco::TrackRef> tr,
00081                   const reco::Vertex  &  convVtx,
00082                   ConversionAlgorithm=undefined);
00083       
00084       Conversion( const reco::CaloClusterPtrVector clu, 
00085                   const std::vector<edm::RefToBase<reco::Track> > tr,
00086                   const reco::Vertex  &  convVtx,
00087                   ConversionAlgorithm=undefined);
00088       
00089            
00090       
00092       virtual ~Conversion();
00094       Conversion * clone() const;
00096       reco::CaloClusterPtrVector caloCluster() const {return caloCluster_ ;}
00098       std::vector<edm::RefToBase<reco::Track> > tracks() const ; 
00100       const reco::Vertex & conversionVertex() const  { return theConversionVertex_ ; }
00102       bool isConverted() const;
00104       unsigned int nTracks() const {return  tracks().size(); }
00106       void setMVAout(const float& mva) { theMVAout_=mva;}
00108       double MVAout() const { return theMVAout_;}
00110       double pairInvariantMass() const;
00112       double pairCotThetaSeparation() const;
00114       math::XYZVector  pairMomentum() const;
00116       math::XYZTLorentzVectorD   refittedPair4Momentum() const;
00118       math::XYZVector  refittedPairMomentum() const;
00122       double EoverP() const;
00126       double EoverPrefittedTracks() const;
00128       double zOfPrimaryVertexFromTracks() const;
00129       // Dist of minimum approach between tracks
00130       double distOfMinimumApproach() const {return  theMinDistOfApproach_;}
00131       // deltaPhi tracks at innermost point
00132       double dPhiTracksAtVtx() const;
00133       // deltaPhi tracks at ECAl
00134       double dPhiTracksAtEcal() const;
00135       // deltaEta tracks at ECAl
00136       double dEtaTracksAtEcal() const;
00137       
00140       const std::vector<math::XYZPoint> & ecalImpactPosition() const  {return thePositionAtEcal_;}
00141       //  pair of BC matching a posteriori the tracks
00142       const std::vector<reco::CaloClusterPtr>&  bcMatchingWithTracks() const { return theMatchingBCs_;}
00144       std::vector<double> tracksSigned_d0() const ;
00146       const std::vector<math::XYZPoint>& tracksInnerPosition() const {return theTrackInnerPosition_;}
00148       const std::vector<math::XYZVector>& tracksPout() const {return theTrackPout_;}
00150       const std::vector<math::XYZVector>& tracksPin() const  {return theTrackPin_;}
00152       const std::vector<uint8_t> &nHitsBeforeVtx() const { return nHitsBeforeVtx_; }
00154       const std::vector<Measurement1DFloat> &dlClosestHitToVtx() const { return dlClosestHitToVtx_; }
00156       uint8_t nSharedHits() const { return nSharedHits_; }
00157 
00158       // Set the ptr to the Super cluster if not set in the constructor 
00159       void setMatchingSuperCluster ( const  reco::CaloClusterPtrVector& sc) { caloCluster_= sc;}
00160       
00162       void setConversionAlgorithm(const ConversionAlgorithm a, bool set=true) { if (set) algorithm_=a; else algorithm_=undefined;}
00163       ConversionAlgorithm algo() const ;
00164       std::string algoName() const;
00165       static std::string algoName(ConversionAlgorithm );
00166       static ConversionAlgorithm  algoByName(const std::string &name);      
00167 
00168       bool quality(ConversionQuality q) const { return  (qualityMask_ & (1<<q))>>q; }
00169       void setQuality(ConversionQuality q, bool b);
00170 
00171 
00172       
00173     private:
00174       
00176       reco::CaloClusterPtrVector caloCluster_;
00178       std::vector<reco::TrackRef>  tracks_;
00180       mutable std::vector<edm::RefToBase<reco::Track> >  trackToBaseRefs_;
00182       std::vector<math::XYZPoint>  thePositionAtEcal_;
00184       reco::Vertex theConversionVertex_;
00186       std::vector<reco::CaloClusterPtr> theMatchingBCs_;
00188       float theMinDistOfApproach_;
00190       std::vector<math::XYZPoint> theTrackInnerPosition_;    
00192       std::vector<math::XYZVector> theTrackPin_;    
00194       std::vector<math::XYZVector> theTrackPout_;    
00196       std::vector<uint8_t> nHitsBeforeVtx_;
00198       std::vector<Measurement1DFloat> dlClosestHitToVtx_;
00200       uint8_t nSharedHits_;
00202       float theMVAout_;
00204       uint8_t algorithm_;
00205       uint16_t qualityMask_;
00206 
00207 
00208   };
00209 
00210     inline Conversion::ConversionAlgorithm Conversion::algo() const {
00211       return (ConversionAlgorithm) algorithm_;
00212     }
00213     
00214     
00215     inline std::string Conversion::algoName() const{
00216             
00217       switch(algorithm_)
00218         {
00219         case undefined: return "undefined";
00220         case ecalSeeded: return "ecalSeeded";
00221         case trackerOnly: return "trackerOnly";
00222         case mixed: return "mixed";
00223 
00224         }
00225       return "undefined";
00226     }
00227 
00228     inline std::string Conversion::algoName(ConversionAlgorithm a){
00229       if(int(a) < int(algoSize) && int(a)>0) return algoNames[int(a)];
00230       return "undefined";
00231     }
00232 
00233     inline void Conversion::setQuality(ConversionQuality q, bool b){
00234       if (b)//regular OR if setting value to true
00235         qualityMask_ |= (1<<q) ;
00236       else // doing "half-XOR" if unsetting value
00237         qualityMask_ &= (~(1<<q));
00238 
00239     }
00240   
00241 }
00242 
00243 #endif