Fork me on GitHub

source: git/modules/ClusterCounting.cc@ 61dccd3

Last change on this file since 61dccd3 was 6216fb2, checked in by michele <michele.selvaggi@…>, 3 years ago

removed electron protection in cluster counting

  • Property mode set to 100644
File size: 3.8 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 ClusterCounting
20 *
21 * Counts ionisation clusters of energy loss in drift chambers
22 *
23 * \authors F. Bedeschi - INFN Pisa
24* P. Demin - UCLouvain, Louvain-la-Neuve
25 * M. Selvaggi - CERN
26 *
27 *
28 */
29
30#include "modules/ClusterCounting.h"
31#include "classes/DelphesClasses.h"
32#include "TrackCovariance/TrkUtil.h"
33
34#include "TLorentzVector.h"
35#include "TVectorD.h"
36#include "TMath.h"
37#include "TObjArray.h"
38
39#include <iostream>
40#include <sstream>
41
42using namespace std;
43
44//------------------------------------------------------------------------------
45
46ClusterCounting::ClusterCounting() :
47 fTrackUtil(0)
48{
49 fTrackUtil = new TrkUtil();
50}
51
52//------------------------------------------------------------------------------
53
54ClusterCounting::~ClusterCounting()
55{
56 if(fTrackUtil) delete fTrackUtil;
57}
58
59//------------------------------------------------------------------------------
60
61void ClusterCounting::Init()
62{
63
64 // geometric acceptance
65 fRmin = GetDouble("Rmin", 0.);
66 fRmax = GetDouble("Rmax", 0.);
67 fZmin = GetDouble("Zmin", 0.);
68 fZmax = GetDouble("Zmax", 0.);
69
70 // magnetic field
71 fBz = GetDouble("Bz", 0.);
72
73 // gas mix option: 0
74 // 0: Helium 90 - Isobutane 10
75 // 1: Helium 100
76 // 2: Argon 50 - Ethane 50
77 // 3: Argon 100
78 fGasOption = GetInt("GasOption", 0);
79
80 // initialize drift chamber geometry and gas mix
81 fTrackUtil->SetBfield(fBz);
82 fTrackUtil->SetDchBoundaries(fRmin, fRmax, fZmin, fZmax);
83 fTrackUtil->SetGasMix(fGasOption);
84
85 // import input array
86 fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks"));
87 fItInputArray = fInputArray->MakeIterator();
88
89 // create output array
90 fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
91}
92
93//------------------------------------------------------------------------------
94
95void ClusterCounting::Finish()
96{
97 if(fItInputArray) delete fItInputArray;
98}
99
100//------------------------------------------------------------------------------
101
102void ClusterCounting::Process()
103{
104 Candidate *candidate, *mother, *particle;
105 Double_t mass, trackLength, Ncl;
106
107 fItInputArray->Reset();
108 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
109 {
110
111 // converting to meters
112 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
113
114 // converting to meters
115 const TLorentzVector &candidatePosition = particle->Position*1e-03;
116 const TLorentzVector &candidateMomentum = particle->Momentum;
117
118 TVectorD Par = TrkUtil::XPtoPar(candidatePosition.Vect(), candidateMomentum.Vect(), candidate->Charge, fBz);
119 mass = candidateMomentum.M();
120
121 trackLength = fTrackUtil->TrkLen(Par);
122
123 mother = candidate;
124 candidate = static_cast<Candidate*>(candidate->Clone());
125
126 Ncl = 0.;
127 if (fTrackUtil->IonClusters(Ncl, mass, Par))
128 {
129 candidate->Nclusters = Ncl;
130 candidate->dNdx = (trackLength > 0.) ? Ncl/trackLength : -1;
131 }
132
133 candidate->AddCandidate(mother);
134
135 fOutputArray->Add(candidate);
136 }
137}
138
139//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.