Fork me on GitHub

source: git/modules/TrackCovariance.cc@ 7d790c1

ImprovedOutputFile
Last change on this file since 7d790c1 was 7d790c1, checked in by Michele Selvaggi <michele.selvaggi@…>, 5 years ago

added IDEA version of with TrackCovariance

  • Property mode set to 100644
File size: 3.2 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//FIXME add reference to Bedeschi-code
28//FIXME add smearing of impact parameter as well
29
30
31#include "modules/TrackCovariance.h"
32
33#include "classes/DelphesClasses.h"
34
35#include "TrackCovariance/SolGeom.h"
36#include "TrackCovariance/SolGridCov.h"
37#include "TrackCovariance/ObsTrk.h"
38
39#include "TLorentzVector.h"
40#include "TMath.h"
41#include "TObjArray.h"
42
43//------------------------------------------------------------------------------
44
45TrackCovariance::TrackCovariance() :
46 fGeometry(0), fCovariance(0), fItInputArray(0)
47{
48 fGeometry = new SolGeom();
49 fCovariance = new SolGridCov();
50}
51
52//------------------------------------------------------------------------------
53
54TrackCovariance::~TrackCovariance()
55{
56 if(fGeometry) delete fGeometry;
57 if(fCovariance) delete fCovariance;
58}
59
60//------------------------------------------------------------------------------
61
62void TrackCovariance::Init()
63{
64 fBz = GetDouble("Bz", 0.0);
65 fGeometry->Read(GetString("DetectorGeometry", ""));
66
67 fCovariance->Calc(fGeometry);
68
69 // import input array
70
71 fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
72 fItInputArray = fInputArray->MakeIterator();
73
74 // create output array
75
76 fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
77}
78
79//------------------------------------------------------------------------------
80
81void TrackCovariance::Finish()
82{
83 if(fItInputArray) delete fItInputArray;
84}
85
86//------------------------------------------------------------------------------
87
88void TrackCovariance::Process()
89{
90 Candidate *candidate, *mother;
91 Double_t energy;
92
93 fItInputArray->Reset();
94 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
95 {
96 const TLorentzVector &candidatePosition = candidate->Position;
97 const TLorentzVector &candidateMomentum = candidate->Momentum;
98
99 energy = candidateMomentum.E();
100
101 ObsTrk track(candidatePosition.Vect(), candidateMomentum.Vect(), candidate->Charge, fBz, fCovariance);
102
103 mother = candidate;
104 candidate = static_cast<Candidate *>(candidate->Clone());
105 candidate->Momentum.SetVect(track.GetObsP());
106 candidate->Momentum.SetE(energy);
107
108 candidate->AddCandidate(mother);
109
110 fOutputArray->Add(candidate);
111 }
112}
113
114//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.