Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:09

0001 #ifndef SimpleVertexTree_H
0002 #define SimpleVertexTree_H
0003 
0004 #include <string>
0005 
0006 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
0007 #include "RecoVertex/KalmanVertexFit/interface/VertexFitterResult.h"
0008 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
0009 #include "MagneticField/Engine/interface/MagneticField.h"
0010 
0011 #include "TString.h"
0012 
0013 /**
0014  * Basic class to do vertex fitting and smothing studies.<br>
0015  * For vertex resolution studies, it produces a TTree and a few basic histograms.<br>
0016  * The TTree contains only the positions of the simulated and reconstructed 
0017  * vertices, total chi**2, chi**2 probability and number of degrees of freedom.
0018  * The histograms present the residuals and pulls along the three axis, the
0019  * nomalized chi**2 and the chi**2 probability.
0020  * The only thing to be done is to call the method fill for each vertex.<br>
0021  *
0022  * WARNING: there is no track info in the tree yet! so what follows is not yet true! <br>
0023  * For smoothing studies (track refit with vertex constraint after the vertex
0024  * fit per se), the TTree is expanded with the track paramater info. 
0025  * For each vertex, for each matched track, the simulated, reconstructed (before
0026  * smoothing), and refitted (after smoothing) parameters and errors are included
0027  * in the TTree.
0028  * This information is provided only if the tracks have been smoothed by the
0029  * vertex fitter, and if the SimpleConfigurable <i>SimpleVertexTree:trackTest</i>
0030  * is set to true.
0031  * No statistics will be printed for the track parameters at the end of the job.
0032  *
0033  * A simpe root analysis is given in the test directory (simpleVertexAnalysis)
0034  * to produce vertex and track parameter resolution and error plots.
0035  * It is described in more details in the userguide.
0036  */
0037 
0038 class TFile;
0039 class TTree;
0040 
0041 class SimpleVertexTree {
0042 public:
0043   /**
0044    * The constructor<br>
0045    * \param fitterName The name of the TTree, and of the associated histograms. 
0046    */
0047 
0048   SimpleVertexTree(const char* fitterName = "VertexFitter", const MagneticField* magField = nullptr);
0049   virtual ~SimpleVertexTree();
0050 
0051   /**
0052    * Entry for a RecVertex. If the vertex was not associated to a TkSimVertex,
0053    * an empty pointer can be given (would be identical to the next method).
0054    * Timing information for the fit can also be provided.
0055    */
0056 
0057   void fill(const TransientVertex& recv,
0058             const TrackingVertex* simv = nullptr,
0059             reco::RecoToSimCollection* recSimColl = nullptr,
0060             const float& time = 0.);
0061 
0062   void fill(const TransientVertex& recv, const TrackingVertex* simv = nullptr, const float& time = 0.);
0063 
0064   /**
0065    * Entry for a RecVertex, without associated vertex.
0066    * Timing information for the fit can also be provided.
0067    */
0068 
0069   void fill(const TransientVertex& recv, const float& time = 0.);
0070 
0071   /**
0072    * Entry for a TkSimVertex, without RecVertex.
0073    */
0074 
0075   void fill(const TrackingVertex* simv);
0076 
0077   //   void fill(const TransientVertex & recVertex, const std::vector < RecTrack > & recTrackV,
0078   //            const SimVertex * simv, const float &time);
0079   //
0080   //   void fill(const std::vector < RecTrack > & recTrackV, const TkSimVertex * simv = 0,
0081   //            const float &time = 0.);
0082 
0083   /**
0084    * To be used if one wants to record "Failed Fits", e.g. to synchronise two Trees
0085    */
0086   void fill();
0087 
0088 private:
0089   void defineTrackBranch(const TString& prefix,
0090                          const TString& type,
0091                          const float* (VertexFitterResult::*pfunc)(const int) const,
0092                          const TString& index);
0093 
0094   float simPos[3];
0095   float recPos[3];
0096   float recErr[3];
0097   float chiTot, ndf, chiProb;
0098   int numberOfVertices;
0099   TTree* vertexTree;
0100   VertexFitterResult* result;
0101   TString theFitterName;
0102 
0103   bool trackTest;
0104   int maxTrack;
0105   TString* parameterNames[5];
0106 };
0107 #endif