Skip to content

Commit

Permalink
Merge pull request #27358 from cms-sw/code-format-analysis-reconstruc…
Browse files Browse the repository at this point in the history
…tion-b6ffeb

Running code-format for analysis-reconstruction
  • Loading branch information
cmsbuild committed Jun 28, 2019
2 parents 5e43005 + 0b91a9a commit a41ba6c
Show file tree
Hide file tree
Showing 93 changed files with 13,201 additions and 12,936 deletions.
244 changes: 122 additions & 122 deletions DataFormats/PatCandidates/interface/CandKinResolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "DataFormats/Common/interface/ValueMap.h"

namespace pat {
class CandKinResolution {
/**
class CandKinResolution {
/**
<h2>Parametrizations</h2>
(lowercase means values, uppercase means fixed parameters)<br />
<b>Cart</b> = (px, py, pz, m) KinFitter uses (px, py, pz, m/M0) with M0 = mass of the starting p4 <br />
Expand All @@ -28,130 +28,130 @@ namespace pat {
<b>EScaledMomDev</b> = (p/P0, dp_theta, dp_phi,E/P=E0/P0) with the P defined as for MomDev, fixed E/p to E0/P0 <br />
<br />
*/
public:
typedef math::XYZTLorentzVector LorentzVector;
typedef float Scalar;

enum Parametrization { Invalid=0,
// 4D = 0xN4
Cart = 0x04,
ECart = 0x14,
Spher = 0x24,
ESpher = 0x34,
MomDev = 0x44,
EMomDev = 0x54,
// 3D =0xN3
MCCart = 0x03,
MCSpher = 0x13,
MCPInvSpher = 0x23,
EtEtaPhi = 0x33,
EtThetaPhi = 0x43,
MCMomDev = 0x53,
EScaledMomDev = 0x63
};
CandKinResolution() ;

/// Create a resolution object given a parametrization code,
/// a covariance matrix (streamed as a vector) and a vector of constraints.
///
/// In the vector you can put either the full triangular block or just the diagonal terms
///
/// The triangular block should be written in a way that the constructor
/// <code>AlgebraicSymMatrixNN(covariance.begin(), covariance.end())</code>
/// works (N = 3 or 4)
CandKinResolution(Parametrization parametrization, const std::vector<Scalar> &covariances,
const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;

/// Fill in a cresolution object given a parametrization code, a covariance matrix and a vector of constraints.
CandKinResolution(Parametrization parametrization, const AlgebraicSymMatrix44 &covariance,
const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;
~CandKinResolution() ;

/// Return the code of the parametrization used in this object
Parametrization parametrization() const { return parametrization_; }

/// Returns the number of free parameters in this parametrization
uint32_t dimension() const {
return dimensionFrom(parametrization_);
}

/// Returns the full covariance matrix
const AlgebraicSymMatrix44 & covariance() const {
return covmatrix_;
}

/// The constraints associated with this parametrization
const std::vector<Scalar> & constraints() const { return constraints_; }

/// Resolution on eta, given the 4-momentum of the associated Candidate
double resolEta(const LorentzVector &p4) const ;

/// Resolution on theta, given the 4-momentum of the associated Candidate
double resolTheta(const LorentzVector &p4) const ;

/// Resolution on phi, given the 4-momentum of the associated Candidate
double resolPhi(const LorentzVector &p4) const ;

/// Resolution on energy, given the 4-momentum of the associated Candidate
double resolE(const LorentzVector &p4) const ;

/// Resolution on et, given the 4-momentum of the associated Candidate
double resolEt(const LorentzVector &p4) const ;

/// Resolution on the invariant mass, given the 4-momentum of the associated Candidate
/// Warning: returns 0 for mass-constrained parametrizations.
double resolM(const LorentzVector &p4) const ;

/// Resolution on p, given the 4-momentum of the associated Candidate
double resolP(const LorentzVector &p4) const ;

/// Resolution on pt, given the 4-momentum of the associated Candidate
double resolPt(const LorentzVector &p4) const ;

/// Resolution on 1/p, given the 4-momentum of the associated Candidate
double resolPInv(const LorentzVector &p4) const ;

/// Resolution on px, given the 4-momentum of the associated Candidate
double resolPx(const LorentzVector &p4) const ;

/// Resolution on py, given the 4-momentum of the associated Candidate
double resolPy(const LorentzVector &p4) const ;

/// Resolution on pz, given the 4-momentum of the associated Candidate
double resolPz(const LorentzVector &p4) const ;

static int dimensionFrom(Parametrization parametrization) {
return (static_cast<uint32_t>(parametrization) & 0x0F);
}

static void fillMatrixFrom( Parametrization parametrization, const std::vector<Scalar>& covariances,
AlgebraicSymMatrix44& covmatrix);

private:
// persistent
/// Parametrization code
Parametrization parametrization_;
/// Matrix, streamed as a vector
std::vector<Scalar> covariances_;
/// Constraints
std::vector<Scalar> constraints_;

// transient

/// Transient copy of the full 4x4 covariance matrix
AlgebraicSymMatrix44 covmatrix_;

//methods
public:
typedef math::XYZTLorentzVector LorentzVector;
typedef float Scalar;

enum Parametrization {
Invalid = 0,
// 4D = 0xN4
Cart = 0x04,
ECart = 0x14,
Spher = 0x24,
ESpher = 0x34,
MomDev = 0x44,
EMomDev = 0x54,
// 3D =0xN3
MCCart = 0x03,
MCSpher = 0x13,
MCPInvSpher = 0x23,
EtEtaPhi = 0x33,
EtThetaPhi = 0x43,
MCMomDev = 0x53,
EScaledMomDev = 0x63
};
CandKinResolution();

/// Create a resolution object given a parametrization code,
/// a covariance matrix (streamed as a vector) and a vector of constraints.
///
/// In the vector you can put either the full triangular block or just the diagonal terms
///
/// The triangular block should be written in a way that the constructor
/// <code>AlgebraicSymMatrixNN(covariance.begin(), covariance.end())</code>
/// works (N = 3 or 4)
CandKinResolution(Parametrization parametrization,
const std::vector<Scalar> &covariances,
const std::vector<Scalar> &constraints = std::vector<Scalar>());

/// Fill in a cresolution object given a parametrization code, a covariance matrix and a vector of constraints.
CandKinResolution(Parametrization parametrization,
const AlgebraicSymMatrix44 &covariance,
const std::vector<Scalar> &constraints = std::vector<Scalar>());
~CandKinResolution();

/// Return the code of the parametrization used in this object
Parametrization parametrization() const { return parametrization_; }

/// Returns the number of free parameters in this parametrization
uint32_t dimension() const { return dimensionFrom(parametrization_); }

/// Returns the full covariance matrix
const AlgebraicSymMatrix44 &covariance() const { return covmatrix_; }

/// The constraints associated with this parametrization
const std::vector<Scalar> &constraints() const { return constraints_; }

/// Resolution on eta, given the 4-momentum of the associated Candidate
double resolEta(const LorentzVector &p4) const;

/// Resolution on theta, given the 4-momentum of the associated Candidate
double resolTheta(const LorentzVector &p4) const;

/// Resolution on phi, given the 4-momentum of the associated Candidate
double resolPhi(const LorentzVector &p4) const;

/// Resolution on energy, given the 4-momentum of the associated Candidate
double resolE(const LorentzVector &p4) const;

/// Resolution on et, given the 4-momentum of the associated Candidate
double resolEt(const LorentzVector &p4) const;

/// Resolution on the invariant mass, given the 4-momentum of the associated Candidate
/// Warning: returns 0 for mass-constrained parametrizations.
double resolM(const LorentzVector &p4) const;

/// Resolution on p, given the 4-momentum of the associated Candidate
double resolP(const LorentzVector &p4) const;

/// Resolution on pt, given the 4-momentum of the associated Candidate
double resolPt(const LorentzVector &p4) const;

/// Resolution on 1/p, given the 4-momentum of the associated Candidate
double resolPInv(const LorentzVector &p4) const;

/// Resolution on px, given the 4-momentum of the associated Candidate
double resolPx(const LorentzVector &p4) const;

/// Resolution on py, given the 4-momentum of the associated Candidate
double resolPy(const LorentzVector &p4) const;

/// Resolution on pz, given the 4-momentum of the associated Candidate
double resolPz(const LorentzVector &p4) const;

static int dimensionFrom(Parametrization parametrization) {
return (static_cast<uint32_t>(parametrization) & 0x0F);
}

static void fillMatrixFrom(Parametrization parametrization,
const std::vector<Scalar> &covariances,
AlgebraicSymMatrix44 &covmatrix);

private:
// persistent
/// Parametrization code
Parametrization parametrization_;
/// Matrix, streamed as a vector
std::vector<Scalar> covariances_;
/// Constraints
std::vector<Scalar> constraints_;

// transient

/// Transient copy of the full 4x4 covariance matrix
AlgebraicSymMatrix44 covmatrix_;

//methods

/// Fill matrix from vector
void fillMatrix() ;
/// Fill matrix from vector
void fillMatrix();

/// Fill vectoor from matrix
void fillVector() ;
/// Fill vectoor from matrix
void fillVector();
};

typedef std::vector<CandKinResolution> CandKinResolutionCollection;
typedef std::vector<CandKinResolution> CandKinResolutionCollection;
typedef edm::ValueMap<CandKinResolution> CandKinResolutionValueMap;
}
} // namespace pat

#endif
37 changes: 15 additions & 22 deletions DataFormats/PatCandidates/interface/CompositeCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,30 @@
#include "DataFormats/Candidate/interface/CompositeCandidate.h"
#include "DataFormats/PatCandidates/interface/PATObject.h"


// Define typedefs for convenience
namespace pat {
class CompositeCandidate;
typedef std::vector<CompositeCandidate> CompositeCandidateCollection;
typedef edm::Ref<CompositeCandidateCollection> CompositeCandidateRef;
typedef edm::RefVector<CompositeCandidateCollection> CompositeCandidateRefVector;
}

typedef std::vector<CompositeCandidate> CompositeCandidateCollection;
typedef edm::Ref<CompositeCandidateCollection> CompositeCandidateRef;
typedef edm::RefVector<CompositeCandidateCollection> CompositeCandidateRefVector;
} // namespace pat

// Class definition
namespace pat {


class CompositeCandidate : public PATObject<reco::CompositeCandidate> {

public:

/// default constructor
CompositeCandidate();
/// constructor from a composite candidate
CompositeCandidate(const reco::CompositeCandidate & aCompositeCandidate);
/// destructor
~CompositeCandidate() override;

/// required reimplementation of the Candidate's clone method
CompositeCandidate * clone() const override { return new CompositeCandidate(*this); }

public:
/// default constructor
CompositeCandidate();
/// constructor from a composite candidate
CompositeCandidate(const reco::CompositeCandidate& aCompositeCandidate);
/// destructor
~CompositeCandidate() override;

/// required reimplementation of the Candidate's clone method
CompositeCandidate* clone() const override { return new CompositeCandidate(*this); }
};


}
} // namespace pat

#endif
26 changes: 12 additions & 14 deletions DataFormats/PatCandidates/interface/Conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@
// Define typedefs for convenience
namespace pat {
class Conversion;
typedef std::vector<Conversion> ConversionCollection;
typedef edm::Ref<ConversionCollection> ConversionRef;
typedef std::vector<Conversion> ConversionCollection;
typedef edm::Ref<ConversionCollection> ConversionRef;
typedef edm::RefVector<ConversionCollection> ConversionRefVector;
}

} // namespace pat

//we use index to match with electron. However, can we do this with gsfTrack instead of index?
namespace pat {
class Conversion {
public:
Conversion () {}
Conversion ( int index );
Conversion() {}
Conversion(int index);
virtual ~Conversion() {}

const double vtxProb() const {return vtxProb_;}
const double vtxProb() const { return vtxProb_; }
void setVtxProb(double vtxProb);
const double lxy() const {return lxy_;}
void setLxy( double lxy );
const int nHitsMax() const {return nHitsMax_;}
void setNHitsMax( int nHitsMax );
const int index() const {return index_; }
const double lxy() const { return lxy_; }
void setLxy(double lxy);
const int nHitsMax() const { return nHitsMax_; }
void setNHitsMax(int nHitsMax);
const int index() const { return index_; }

private:
double vtxProb_;
Expand All @@ -40,8 +39,7 @@ namespace pat {

//electron index matched with conversion
int index_;

};
}
} // namespace pat

#endif

0 comments on commit a41ba6c

Please sign in to comment.