V0 Analysis wiki

From T2B Wiki
Jump to: navigation, search

Running the V0Tree production code with CMSSW 3_6_2

Note: the example of the code with all the neccessary config files is at /user_mnt/user/threus/CMSSW_3_6_2/src/

0) copy the /user_mnt/user/vanlaer/kinefit362/src/RecoVertex/V0Tree directory to your respective /src/RecoVertex/ dir.

  - it contains all neccessary links between various config files, such that step 2)a and 3) is done already.

1) Patching track-to-track covariance

   - cvs the patched code:
     cvs co -r V01-01-08 RecoVertex/KalmanVertexFit
     cvs co -r V01-01-04 RecoVertex/VertexPrimitives
     
     cvs co -r V00-01-09 RecoVertex/LinearizationPointFinders
     cvs co -r V01-01-06 RecoVertex/VertexTools
     cvs co -r V01-00-18 RecoVertex/V0Producer
  - update /RecoVertex/VertexPrimitives/src/TransientVertex.cc, method TransientVertex::tkToTkCovariance(const TransientTrack& t1, const TransientTrack& t2):
     comment piece of code starting at line 158:
       if (t1<t2) {
       tr1 = &t1;
       tr2 = &t2;
       } else {
       tr1 = &t2;
       tr2 = &t1;
       }
    and instead insert 
    tr1 = &t1;
    tr2 = &t2;
    (i.e. disable unwanted track swapping).

2) Track Refit, which consists of two steps:

 a) refitting of the reconstructed tracks with the pion mass hypothesis (w.r.t. default muon mass hypothesis)

    - load the refitter module and tell the refitter to use pion hypothesis:
      in your mainconfig.py file (that you use when running cmsRun mainconfig.py) add:
      process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
      process.RungeKuttaTrackerPropagator.Mass = 0.139
      process.RungeKuttaTrackerPropagatorOpposite.Mass = 0.139
    - add refitter module into your path (in mainconfig.py) before the V0Tree module (process.demo):
      process.p = cms.Path(... *... *process.TrackRefitter *...) 
 b) rerunning the V0 producer on the refitted tracks
    - tell the V0 producer to use refitted tracks: in ./RecoVertex/V0Producer/python/generalV0Candidates_cfi.py, 
      change trackRecoAlgorithm = cms.InputTag('generalTracks') to trackRecoAlgorithm = cms.InputTag('TrackRefitter')
      you may also modify the main config file with the following line:
      process.generalV0Candidates.trackRecoAlgorithm = 'TrackRefitter'
      it has the same effect but it does not require recompiling of the RecoVertex/V0Producer/python config. 
    - add the V0 produced module into your path (in mainconfig.py) before the V0Tree module (process.demo) and after the refitter module (process.TrackRefitter):
      process.p = cms.Path(... *... *process.TrackRefitter *process.generalV0Candidates *process.demo) 

For the completed mainconfig.py file have a look at /user_mnt/user/threus/CMSSW_3_6_2/src/RecoVertex/V0Tree/test/runV0Tree_MC_simtracks_7TeV_refitpions_cfg.py

ISSUE: DATA sample throws an error, so for the moment track refitting works only for MC.

3) Matching reconstructed tracks with simulated tracks (TrackingParticles)

   - add the corresponding modules into your mainconfig.py:
     process.load("SimTracker.TrackAssociation.TrackAssociatorByHits_cfi")
     process.load("SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi")
     process.TrackAssociatorByHits.SimToRecoDenominator = cms.string('reco')
   - copy /user_mnt/user/threus/CMSSW_3_6_2/src/RecoVertex/V0Tree/python/v0tree_cfi.py to your respective directory
     note how the parameters are defined and if you use the TrackRefitter (see above), set the label to 

     label = cms.VInputTag(cms.InputTag("TrackRefitter")), to use refitted reconstructed tracks for the reco-sim matching.
     if you don't use TrackRefitter, set the label to label = cms.VInputTag(cms.InputTag("generalTracks"))
   - set the parameters inside mainconfig.py:
     process.demo.associators = ['TrackAssociatorByHits']
     process.demo.label = ['cutsRecoTracks']
     process.demo.UseAssociators = cms.bool(True)
   - define track selection cuts for the matching algorithm for both, simulated and reconstructed tracks:
     copy these files from  /user_mnt/user/threus/CMSSW_3_6_2/src/RecoVertex/V0Tree/python/ to your respective directory:
     TrackingParticleSelectionForEfficiency_cfi.py
  
     cutsRecoTracks_cfi.py
     cutsTPEffic_cfi.py
     cutsTPFake_cfi.py
     cuts_cff.py
   - include the track selection cuts into your path, before the main V0Tree module (process.demo):
     process.p = cms.Path(... *... *process.cutsRecoTracks *process.demo)


compile all from your /src/RecoVertex directory.

ROOT scripts with the kinematic fits are in directory /user_mnt/user/threus/CMSSW_3_6_2/src/kinefitv0:

minim_pt_7.C /.h mass fit

minim_ptpo_v3.C /.h mass + pointing + vertexing fit

HistogramContainer.h which contain the class definitions

Kinematic Fit Variables in V0Tree

The kinematic fit code is implemented directly inside the V0Tree.cc code. You can find it in /user_mnt/user/threus/CMSSW_3_6_2/src/RecoVertex/V0Tree/plugins/V0Tree.cc.fit ; copy it, rename to V0Tree.cc and compile.

Saved variables contain information on the chi2 probability of the kinematic fit result and fitted daughter four-vectors, separately for three mass hypotheses: K0s, Lambda and Antilambda. In case of Lambda (Antilambda) hypothesis, proton (antiproton) is assumed to be the track with the positive (negative) charge. The returned flag from the kinematic fit method is saved as well, to know if the fit converged and if not, why. Both, the kinematic fit with the mass constraint alone and the full kinematic fit with the mass, vertex and pointing constraints are performed on the V0 candidate.

1) New saved variables related to kinematic fit with mass constrain are:

  double chi2prob_k0_massfit[100]; //chi2 prob. for K0s hyp.
  double chi2prob_la_massfit[100]; //chi2 prob. for Lambda hyp.
  double chi2prob_al_massfit[100]; //chi2 prob. for Antilambda hyp.
  int flag_k0_massfit[100]; //flag returned by the kinematic fit for K0s hyp. (see below for details)
  int flag_la_massfit[100]; // Lambda hyp.
  int flag_al_massfit[100]; // Antilambda hyp.

  - Meaning of the flag_xx values: 
             
    >= 0  : fit OK, returned is the number of iterations needed for convergence
             
    == -1 : error, fit not converged within the nmber of allowed iterations
    <= -90: error, one of the matrices not inverted; for the exact matrix see code

2) New saved variables related to kinematic fit with mass, vertex and pointing constraints are:

  double chi2prob_k0_fullfit[100];
  double chi2prob_la_fullfit[100];
  double chi2prob_al_fullfit[100];
  int flag_k0_fullfit[100];
  int flag_la_fullfit[100];
  int flag_al_fullfit[100];
  double V0_d1_k0_fullfit_pt[100]; // daughter 1 four-vector for the K0s hypothesis
  double V0_d1_k0_fullfit_eta[100];
  double V0_d1_k0_fullfit_phi[100];
  double V0_d1_k0_fullfit_e[100];
  double V0_d2_k0_fullfit_pt[100]; // daughter 2 four-vector for the K0s hypothesis
  ...

  double V0_d1_la_fullfit_pt[100]; // daughter 1 four-vector for the Lambda hypothesis

  ...
  double V0_d2_la_fullfit_pt[100];  // daughter 2 four-vector for the Lambda hypothesis
  ...
  double V0_d1_al_fullfit_pt[100]; // daughter 1 four-vector for the Antilambda hypothesis
  ... 
  double V0_d2_al_fullfit_pt[100]; // daughter 2 four-vector for the Antilambda hypothesis
  ...

3) Additional variable (not related to kinematic fits) which carries the information on the V0 particle type as given by the CMSSW finder is saved:

  int V0_type[100]; //type of V0: 0=K0s, 1=Lambda, as returned by the CMSSW finder

4) DATA / MC samples with this information (except the daughter four-vectors) are here:

  DATA: /user_mnt/user/threus/trees/data/Commissioning10-GOODCOLL-Jun14thSkim_v1/CMSSW_3_6_2/loose
  MC:   /user_mnt/user/threus/trees/mc/MinBias_TuneD6T_7TeV-pythia6_Summer10-START36_V10_SP10-v1/CMSSW_3_6_2/loose


Template:TracNotice

Personal tools
Namespaces

Variants
Actions
Navigation
Tools