Fork me on GitHub

source: git/modules/TrackCovariance.cc@ ccea85b

ImprovedOutputFile
Last change on this file since ccea85b was ff9fb2d9, checked in by Pavel Demin <pavel.demin@…>, 5 years ago

add TrackCovariance

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2020 Universite catholique de Louvain (UCLouvain), Belgium
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/** \class TrackCovariance
20 *
21 * Smears track parameters according to appropriate covariance matrix.
22 *
23 * \author P. Demin - UCLouvain, Louvain-la-Neuve
24 *
25 */
26
27#include "modules/TrackCovariance.h"
28
29#include "classes/DelphesClasses.h"
30
31#include "TrackCovariance/SolGeom.h"
32#include "TrackCovariance/SolGridCov.h"
33#include "TrackCovariance/ObsTrk.h"
34
35#include "TLorentzVector.h"
36#include "TMath.h"
37#include "TObjArray.h"
38
39//------------------------------------------------------------------------------
40
41TrackCovariance::TrackCovariance() :
42 fGeometry(0), fCovariance(0), fItInputArray(0)
43{
44 fGeometry = new SolGeom();
45 fCovariance = new SolGridCov();
46}
47
48//------------------------------------------------------------------------------
49
50TrackCovariance::~TrackCovariance()
51{
52 if(fGeometry) delete fGeometry;
53 if(fCovariance) delete fCovariance;
54}
55
56//------------------------------------------------------------------------------
57
58void TrackCovariance::Init()
59{
60 fBz = GetDouble("Bz", 0.0);
61 fGeometry->Read(GetString("DetectorGeometry", ""));
62
63 fCovariance->Calc(fGeometry);
64
65 // import input array
66
67 fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
68 fItInputArray = fInputArray->MakeIterator();
69
70 // create output array
71
72 fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
73}
74
75//------------------------------------------------------------------------------
76
77void TrackCovariance::Finish()
78{
79 if(fItInputArray) delete fItInputArray;
80}
81
82//------------------------------------------------------------------------------
83
84void TrackCovariance::Process()
85{
86 Candidate *candidate, *mother;
87 Double_t energy;
88
89 fItInputArray->Reset();
90 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
91 {
92 const TLorentzVector &candidatePosition = candidate->Position;
93 const TLorentzVector &candidateMomentum = candidate->Momentum;
94
95 energy = candidateMomentum.E();
96
97 ObsTrk track(candidatePosition.Vect(), candidateMomentum.Vect(), candidate->Charge, fBz, fCovariance);
98
99 mother = candidate;
100 candidate = static_cast<Candidate *>(candidate->Clone());
101 candidate->Momentum.SetVect(track.GetObsP());
102 candidate->Momentum.SetE(energy);
103
104 candidate->AddCandidate(mother);
105
106 fOutputArray->Add(candidate);
107 }
108}
109
110//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.