CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/Candidate/interface/NamedCompositeCandidate.h

Go to the documentation of this file.
00001 #ifndef Candidate_NamedCompositeCandidate_H
00002 #define Candidate_NamedCompositeCandidate_H
00003 #include "DataFormats/Candidate/interface/CompositeCandidate.h"
00004 #include <memory>
00016 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00017 #include "DataFormats/Candidate/interface/NamedCompositeCandidateFwd.h"
00018 #include <string>
00019 #include <map>
00020 
00021 namespace reco {
00022 
00023   class NamedCompositeCandidate : public CompositeCandidate {
00024   public:
00025     typedef std::vector<std::string>                   role_collection;
00026 
00028     NamedCompositeCandidate(std::string name="") : CompositeCandidate(), name_(name) { }
00029     NamedCompositeCandidate(std::string name,
00030                             const role_collection & roles  ) : 
00031       CompositeCandidate(), name_(name), roles_(roles) { }
00033     NamedCompositeCandidate( std::string name, 
00034                              const role_collection & roles,
00035                              Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
00036                              int pdgId = 0, int status = 0, bool integerCharge = true ) :
00037       CompositeCandidate( q, p4, vtx, pdgId, status, integerCharge ), 
00038       name_ (name), roles_(roles) { }
00040     NamedCompositeCandidate( std::string name, 
00041                              const role_collection & roles, 
00042                              const Candidate & p );
00043  
00045     virtual ~NamedCompositeCandidate();
00047     virtual NamedCompositeCandidate * clone() const;
00048     // get name
00049     std::string             name() const { return name_; }
00050     // set name
00051     void                    setName( std::string n ) { name_ = n; }
00052     // get roles
00053     const NamedCompositeCandidate::role_collection & roles() const { return roles_;}
00054     // set roles
00055     void                    setRoles( const NamedCompositeCandidate::role_collection & roles ) { roles_.clear(); roles_ = roles; }
00056     // Get candidate based on role
00057     virtual Candidate *       daughter(const std::string& s );
00058     virtual const Candidate * daughter(const std::string& s ) const;
00059     // Get candidate based on index
00060     virtual Candidate *       daughter( size_type i ) { return CompositeCandidate::daughter(i); }
00061     virtual const Candidate * daughter( size_type i ) const  { return CompositeCandidate::daughter(i); }
00062     // Add daughters
00063     void                    addDaughter( const Candidate &, const std::string&s );
00064     void                    addDaughter( std::auto_ptr<Candidate>, const std::string& s );
00065     // Clear daughters and roles
00066     void                    clearDaughters() { CompositeCandidate::clearDaughters(); }
00067     void                    clearRoles() { roles_.clear(); }
00068     // Apply the roles to the objects
00069     void                    applyRoles();
00070   private:
00071     std::string      name_;
00072     role_collection  roles_;
00073   };
00074 
00075 }
00076 
00077 #endif