Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-27 00:17:00

0001 #ifndef VertexFitterResult_H
0002 #define VertexFitterResult_H
0003 
0004 #include <string>
0005 // #include "Vertex/VertexRecoAnalysis/interface/NumberOfSharedTracks.h"
0006 // #include "CommonReco/PatternTools/interface/RefittedRecTrack.h"
0007 #include "DataFormats/VertexReco/interface/Vertex.h"
0008 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
0009 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0010 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0011 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
0012 #include "MagneticField/Engine/interface/MagneticField.h"
0013 #include "SimDataFormats/Associations/interface/TrackAssociation.h"
0014 
0015 #include <vector>
0016 
0017 /**
0018  * Very basic class containing only the positions of the simulated and reconstructed 
0019  * vertices, total chi**2, chi**2 probability and 
0020  * number of degrees of freedom.
0021  * The only thing to be done is to call the method fill for each vertex.
0022  */
0023 
0024 class VertexFitterResult {
0025 public:
0026   //   typedef std::vector<const TkSimTrack*>   SimTrackCont;
0027   typedef std::vector<reco::TransientTrack> TTrackCont;
0028 
0029   VertexFitterResult(const int maxTracks = 100, const MagneticField* = nullptr);
0030   ~VertexFitterResult();
0031 
0032   void fill(const TransientVertex& recv,
0033             const TrackingVertex* simv = nullptr,
0034             reco::RecoToSimCollection* recSimColl = nullptr,
0035             const float& time = 0);
0036 
0037   void fill(const TransientVertex& recVertex,
0038             const TTrackCont& recTrackV,
0039             const TrackingVertex* simv = nullptr,
0040             reco::RecoToSimCollection* recSimColl = nullptr,
0041             const float& time = 0);
0042 
0043   const float* simVertexPos() const { return simPos; }
0044   const float* recVertexPos() const { return recPos; }
0045   const float* recVertexErr() const { return recErr; }
0046   const int* trackInformation() const { return tracks; }
0047   const float* chi2Information() const { return chi; }
0048   const int* vertexPresent() const { return &vertex; }
0049   const float* time() const { return &fitTime; }
0050   void reset();
0051   const int* numberSimTracks() { return &numberOfSimTracks; }
0052   const int* numberRecTracks() { return &numberOfRecTracks; }
0053   // This array contains, for each SimTrack, the index of the associated RecTrack
0054   const int* simTrack_recIndex() { return recIndex; }
0055   // This array contains, for each RecTrack, the index of the associated simTrack
0056   const int* recTrack_simIndex() { return simIndex; }
0057   const float* recTrackWeight() { return trackWeight; }
0058   const float* recParameters(const int i) const {
0059     if (i < 0 || i >= 5)
0060       return nullptr;
0061     return recPars[i];
0062   }
0063   const float* refParameters(const int i) const {
0064     if (i < 0 || i >= 5)
0065       return nullptr;
0066     return refPars[i];
0067   }
0068   const float* simParameters(const int i) const {
0069     if (i < 0 || i >= 5)
0070       return nullptr;
0071     return simPars[i];
0072   }
0073   const float* recErrors(const int i) const {
0074     if (i < 0 || i >= 5)
0075       return nullptr;
0076     return recErrs[i];
0077   }
0078   const float* refErrors(const int i) const {
0079     if (i < 0 || i >= 5)
0080       return nullptr;
0081     return refErrs[i];
0082   }
0083 
0084 private:
0085   //   typedef std::vector<const TkSimTrack*> SimTrkCont;
0086   //
0087   void fillParameters(const reco::TrackBase::ParameterVector& perigee, float* params[5], int trackNumber);
0088   //   void fillErrors (const reco::TrackBase::CovarianceMatrix& perigeeCov, float* errors[5],
0089   //            int trackNumber);
0090   void fillParameters(const PerigeeTrajectoryParameters& ptp, float* params[5], int trackNumber);
0091   void fillErrors(const PerigeeTrajectoryError& pte, float* errors[5], int trackNumber);
0092 
0093 private:
0094   //   class RecTrackMatch{
0095   //     public:
0096   //       RecTrackMatch(const RecTrack & aRecTrack):theRecTrack(aRecTrack){}
0097   //       ~RecTrackMatch(){}
0098   //       bool operator() (const RecTrack & theRefTrack) {
0099   //         const RefittedRecTrack* refTa = dynamic_cast <const RefittedRecTrack*>(theRefTrack.tTrack());
0100   //    return ((refTa!=0) && theRecTrack.sameAddress(refTa->originalTrack()));
0101   // //       return theRecTrack.sameAddress(theRefTrack);
0102   // //   TrackAssociator * recTa = const_cast < TrackAssociator *> (vtxAssocFact.trackAssociator());
0103   // //        return theRecTrack.sameAddress(theRefTrack.originalTrack());
0104   //       }
0105   //     private:
0106   //       const RecTrack & theRecTrack;
0107   //   };
0108 
0109   // NumberOfSharedTracks numberOfSharedTracks;
0110 
0111   const MagneticField* theMagField;
0112 
0113   float simPos[3];
0114   float recPos[3];
0115   float recErr[3];
0116   float chi[3];
0117   int tracks[3];
0118   int vertex;  // 0x1 is Sim, 0x10 is Rec
0119   float fitTime;
0120 
0121   int theMaxTracks;
0122   float* simPars[5];
0123   float* recPars[5];
0124   float* refPars[5];
0125   float* recErrs[5];
0126   float* refErrs[5];
0127   int numberOfRecTracks, numberOfSimTracks;
0128   float* trackWeight;
0129   int *simIndex, *recIndex;
0130 };
0131 #endif