CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/BTauReco/interface/TaggingVariable.h

Go to the documentation of this file.
00001 #ifndef DataFormats_BTauReco_TaggingVariable_h
00002 #define DataFormats_BTauReco_TaggingVariable_h
00003 
00004 #include <utility>
00005 #include <vector>
00006 #include <string>
00007 
00008 #include <boost/static_assert.hpp>
00009 #include <boost/pointee.hpp>
00010 #include <boost/type_traits/is_convertible.hpp>
00011 
00012 #include "DataFormats/BTauReco/interface/RefMacros.h"
00013 
00014 namespace reco {
00015 
00016   namespace btau {
00017 
00018     // define the enum in a namespace to avoid polluting reco with all the enum values
00019     enum TaggingVariableName {
00020       jetEnergy = 0,                            // jet energy
00021       jetPt,                                    // jet transverse momentum
00022       jetEta,                                   // jet pseudorapidity
00023       jetPhi,                                   // jet polar angle
00024       jetNTracks,                               // tracks associated to jet
00025 
00026       trackMomentum,                            // track momentum
00027       trackEta,                                 // track pseudorapidity
00028       trackPhi,                                 // track polar angle
00029 
00030       trackPtRel,                               // track transverse momentum, relative to the jet axis
00031       trackPPar,                                // track parallel momentum, along the jet axis
00032       trackEtaRel,                              // track pseudorapidity, relative to the jet axis
00033       trackDeltaR,                              // track pseudoangular distance from the jet axis
00034       trackPtRatio,                             // track transverse momentum, relative to the jet axis, normalized to its energy
00035       trackPParRatio,                           // track parallel momentum, along the jet axis, normalized to its energy
00036 
00037       trackIp2dSig,                             // track 2D impact parameter signifncance
00038       trackSip2dVal,                            // track 2D signed impact parameter
00039       trackSip2dSig,                            // track 2D signed impact parameter significance
00040       trackSip3dVal,                            // track 3D signed impact parameter
00041       trackSip3dSig,                            // track 3D signed impact parameter significance
00042       trackDecayLenVal,                         // track decay length
00043       trackDecayLenSig,                         // track decay length significance
00044       trackJetDistVal,                          // minimum track approach distance to jet axis
00045       trackJetDistSig,                          // minimum track approach distance to jet axis significance
00046       trackGhostTrackDistVal,                   // minimum approach distance to ghost track
00047       trackGhostTrackDistSig,                   // minimum approach distance to ghost track significance
00048       trackGhostTrackWeight,                    // weight of track participation in ghost track fit
00049 
00050       trackSumJetEtRatio,                       // ratio of track sum transverse energy over jet energy
00051       trackSumJetDeltaR,                        // pseudoangular distance between jet axis and track fourvector sum
00052 
00053       vertexCategory,                           // category of secondary vertex (Reco, Pseudo, No)
00054 
00055       jetNSecondaryVertices,                    // number of reconstructed possible secondary vertices in jet
00056       jetNSingleTrackVertices,                  // number of single-track ghost-track vertices
00057 
00058       vertexMass,                               // mass of track sum at secondary vertex
00059       vertexNTracks,                            // number of tracks at secondary vertex
00060       vertexFitProb,                            // vertex fit probability
00061 
00062       vertexEnergyRatio,                        // ratio of energy at secondary vertex over total energy
00063       vertexJetDeltaR,                          // pseudoangular distance between jet axis and secondary vertex direction
00064 
00065       flightDistance2dVal,                      // transverse distance between primary and secondary vertex
00066       flightDistance2dSig,                      // transverse distance significance between primary and secondary vertex
00067       flightDistance3dVal,                      // distance between primary and secondary vertex
00068       flightDistance3dSig,                      // distance significance between primary and secondary vertex
00069 
00070       trackSip2dValAboveCharm,                  // track 2D signed impact parameter of first track lifting mass above charm
00071       trackSip2dSigAboveCharm,                  // track 2D signed impact parameter significance of first track lifting mass above charm
00072       trackSip3dValAboveCharm,                  // track 3D signed impact parameter of first track lifting mass above charm
00073       trackSip3dSigAboveCharm,                  // track 3D signed impact parameter significance of first track lifting mass above charm
00074 
00075       neutralEnergy,                            // neutral ECAL clus. energy sum
00076       neutralEnergyOverCombinedEnergy,          // neutral ECAL clus. energy sum/(neutral ECAL clus. energy sum + pion tracks energy)
00077       neutralIsolEnergy,                        // neutral ECAL clus. energy sum in isolation band
00078       neutralIsolEnergyOverCombinedEnergy,      // neutral ECAL clus. energy sum in isolation band/(neutral ECAL clus. energy sum + pion tracks energy)
00079       neutralEnergyRatio,                       // ratio of neutral ECAL clus. energy sum in isolation band over neutral ECAL clus. energy sum
00080       neutralclusterNumber,                     // number of neutral ECAL clus.
00081       neutralclusterRadius,                     // mean DR between neutral ECAL clus. and lead.track
00082 
00083       leptonQuality,                            // lepton identification quality
00084       leptonQuality2,                           // lepton identification quality 2
00085       trackP0Par,                               // track momentum along the jet axis, in the jet rest frame
00086       trackP0ParRatio,                          // track momentum along the jet axis, in the jet rest frame, normalized to its energy"
00087       trackChi2,                                // track fit chi2
00088       trackNTotalHits,                          // number of valid total hits
00089       trackNPixelHits,                          // number of valid pixel hits
00090 
00091       algoDiscriminator,                        // discriminator output of an algorithm
00092 
00093       lastTaggingVariable
00094     };
00095   }
00096 
00097   // import only TaggingVariableName type into reco namespace
00098   using btau::TaggingVariableName;
00099 
00100   extern const char* TaggingVariableDescription[];
00101   extern const char* TaggingVariableTokens[];
00102 
00103   TaggingVariableName getTaggingVariableName ( const std::string & name );
00104 
00105   typedef float TaggingValue;
00106   
00107   // cannot use a const member since the STL containers relie on the default assignment operator
00108   // typedef std::pair< const TaggingVariableName, TaggingValue > TaggingVariable;
00109   typedef std::pair< TaggingVariableName, TaggingValue > TaggingVariable;
00110 
00111   struct TaggingVariableCompare {
00112     bool operator() (const TaggingVariable& i, const TaggingVariable& j) {
00113       return i.first < j.first;
00114     }
00115 
00116     bool operator() (const TaggingVariable& i, TaggingVariableName tag) {
00117       return i.first < tag;
00118     }
00119 
00120     bool operator() (TaggingVariableName tag, const TaggingVariable& i) {
00121       return tag < i.first;
00122     }
00123 
00124   };
00125 
00126   // implementation via std::vector where
00127   //  - m_list is kept sorted via stable_sort after each insertion
00128   //  - extraction is done via binary search
00129   class TaggingVariableList {
00130   public:
00131     TaggingVariableList() : m_list() { }
00132     TaggingVariableList( const TaggingVariableList& list ) : m_list( list.m_list ) { }
00133 
00134     // [begin, end) must identify a valid range of iterators to TaggingVariableList
00135     template <typename InputIterator>
00136     TaggingVariableList( const InputIterator begin, const InputIterator end ) : m_list() {
00137       BOOST_STATIC_ASSERT(( boost::is_convertible< const TaggingVariableList, typename boost::pointee<InputIterator>::type >::value ));
00138       for (const InputIterator i = begin; i != end; i++)
00139         insert(*i);
00140     }
00141 
00145     typedef std::vector < TaggingVariable >::const_iterator const_iterator;
00146     typedef std::pair < const_iterator, const_iterator > range;
00147     size_t size() const { return m_list.size(); }
00148     const_iterator begin() const { return m_list.begin(); }
00149     const_iterator end() const { return m_list.end(); }
00150     void push_back ( const TaggingVariable & t ) { m_list.push_back ( t ); }
00151 
00152     ~TaggingVariableList() { }
00153 
00154 
00155   private:
00156     std::vector< TaggingVariable > m_list;
00157       
00158   public:
00159     bool checkTag( TaggingVariableName tag ) const;
00160     
00161     void insert( const TaggingVariable & variable, bool delayed = false );
00162     void insert( const TaggingVariableList & list );
00163     void insert( TaggingVariableName tag, TaggingValue value, bool delayed = false );
00164     void insert( TaggingVariableName tag, const std::vector<TaggingValue> & values, bool delayed = false );
00165 
00166     void finalize( void );
00167     
00168     TaggingValue get( TaggingVariableName tag ) const;
00169     TaggingValue get( TaggingVariableName tag, TaggingValue defaultValue ) const;
00170     std::vector<TaggingValue> getList( TaggingVariableName tag, bool throwOnEmptyList = true ) const;
00171 
00172     range getRange( TaggingVariableName tag ) const;
00173 
00174     TaggingValue operator[]( TaggingVariableName tag ) const {
00175       return get( tag );
00176     }
00177   };
00178 
00179   DECLARE_EDM_REFS( TaggingVariableList )
00180 
00181 }
00182 
00183 #endif // DataFormats_BTauReco_TaggingVariable_h