1 |
|
---|
2 | /** \class Hector
|
---|
3 | *
|
---|
4 | * Propagates candidates using Hector library.
|
---|
5 | *
|
---|
6 | * $Date$
|
---|
7 | * $Revision$
|
---|
8 | *
|
---|
9 | *
|
---|
10 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
11 | *
|
---|
12 | */
|
---|
13 |
|
---|
14 | #include "modules/Hector.h"
|
---|
15 |
|
---|
16 | #include "classes/DelphesClasses.h"
|
---|
17 | #include "classes/DelphesFactory.h"
|
---|
18 | #include "classes/DelphesFormula.h"
|
---|
19 |
|
---|
20 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
21 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
22 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
23 |
|
---|
24 | #include "TMath.h"
|
---|
25 | #include "TString.h"
|
---|
26 | #include "TFormula.h"
|
---|
27 | #include "TRandom3.h"
|
---|
28 | #include "TObjArray.h"
|
---|
29 | #include "TDatabasePDG.h"
|
---|
30 | #include "TLorentzVector.h"
|
---|
31 |
|
---|
32 | #include <algorithm>
|
---|
33 | #include <stdexcept>
|
---|
34 | #include <iostream>
|
---|
35 | #include <sstream>
|
---|
36 |
|
---|
37 | #include "Hector/H_BeamLine.h"
|
---|
38 | #include "Hector/H_RecRPObject.h"
|
---|
39 | #include "Hector/H_BeamParticle.h"
|
---|
40 |
|
---|
41 | using namespace std;
|
---|
42 |
|
---|
43 | //------------------------------------------------------------------------------
|
---|
44 |
|
---|
45 | Hector::Hector() :
|
---|
46 | fBeamLine(0), fItInputArray(0)
|
---|
47 | {
|
---|
48 | }
|
---|
49 |
|
---|
50 | //------------------------------------------------------------------------------
|
---|
51 |
|
---|
52 | Hector::~Hector()
|
---|
53 | {
|
---|
54 | }
|
---|
55 |
|
---|
56 | //------------------------------------------------------------------------------
|
---|
57 |
|
---|
58 | void Hector::Init()
|
---|
59 | {
|
---|
60 | // read Hector parameters
|
---|
61 |
|
---|
62 | fDirection = GetInt("Direction", 1);
|
---|
63 | fBeamLineLength = GetDouble("BeamLineLength", 430.0);
|
---|
64 | fDistance = GetDouble("Distance", 420.0);
|
---|
65 | fOffsetX = GetDouble("OffsetX", 0.0);
|
---|
66 | fOffsetS = GetDouble("OffsetS", 120.0);
|
---|
67 | fSigmaE = GetDouble("SigmaE", 0.0);
|
---|
68 | fSigmaX = GetDouble("SigmaX", 0.0);
|
---|
69 | fSigmaY = GetDouble("SigmaY", 0.0);
|
---|
70 | fSigmaT = GetDouble("SigmaT", 0.0);
|
---|
71 | fEtaMin = GetDouble("EtaMin", 5.0);
|
---|
72 |
|
---|
73 | fBeamLine = new H_BeamLine(fDirection, fBeamLineLength + 0.1);
|
---|
74 | fBeamLine->fill(GetString("BeamLineFile", "examples/LHCB1IR5_5TeV.tfs"), fDirection, GetString("IPName", "IP5"));
|
---|
75 | fBeamLine->offsetElements(120, -0.097*fDirection);
|
---|
76 | fBeamLine->offsetElements(fOffsetS, fOffsetX);
|
---|
77 | fBeamLine->calcMatrix();
|
---|
78 |
|
---|
79 | // import input array
|
---|
80 |
|
---|
81 | fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles"));
|
---|
82 | fItInputArray = fInputArray->MakeIterator();
|
---|
83 |
|
---|
84 | // create output array
|
---|
85 |
|
---|
86 | fOutputArray = ExportArray(GetString("OutputArray", "hits"));
|
---|
87 | }
|
---|
88 |
|
---|
89 | //------------------------------------------------------------------------------
|
---|
90 |
|
---|
91 | void Hector::Finish()
|
---|
92 | {
|
---|
93 | if(fItInputArray) delete fItInputArray;
|
---|
94 | if(fBeamLine) delete fBeamLine;
|
---|
95 | }
|
---|
96 |
|
---|
97 | //------------------------------------------------------------------------------
|
---|
98 |
|
---|
99 | void Hector::Process()
|
---|
100 | {
|
---|
101 | Candidate *candidate, *mother;
|
---|
102 | Double_t pz;
|
---|
103 | Double_t x, y, z, tx, ty, theta;
|
---|
104 | Double_t distance, time;
|
---|
105 |
|
---|
106 | const Double_t c_light = 2.99792458E8;
|
---|
107 |
|
---|
108 | fItInputArray->Reset();
|
---|
109 | while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
|
---|
110 | {
|
---|
111 | const TLorentzVector &candidatePosition = candidate->Position;
|
---|
112 | const TLorentzVector &candidateMomentum = candidate->Momentum;
|
---|
113 | pz = candidateMomentum.Pz();
|
---|
114 |
|
---|
115 | if(candidateMomentum.Eta() <= fEtaMin || fDirection*pz <= 0.0) continue;
|
---|
116 |
|
---|
117 | x = 1.0E3 * candidatePosition.X();
|
---|
118 | y = 1.0E3 * candidatePosition.Y();
|
---|
119 | z = 1.0E-2 * candidatePosition.Z();
|
---|
120 |
|
---|
121 | // tx = 1.0E6 * TMath::ATan(candidateMomentum.Px()/pz);
|
---|
122 | // ty = 1.0E6 * TMath::ATan(candidateMomentum.Py()/pz);
|
---|
123 |
|
---|
124 | tx = 0.0;
|
---|
125 | ty = 0.0;
|
---|
126 |
|
---|
127 | theta = TMath::Hypot(TMath::ATan(candidateMomentum.Px()/pz), TMath::ATan(candidateMomentum.Py()/pz));
|
---|
128 | distance = (fDistance - 1.0E-3 * candidatePosition.Z())/TMath::Cos(theta);
|
---|
129 | time = gRandom->Gaus((distance + 1.0E-3 * candidatePosition.T())/c_light, fSigmaT);
|
---|
130 |
|
---|
131 | H_BeamParticle particle(candidate->Mass, candidate->Charge);
|
---|
132 | particle.set4Momentum(candidateMomentum);
|
---|
133 | particle.setPosition(x, y, tx, ty, z);
|
---|
134 |
|
---|
135 | particle.smearAng(fSigmaX, fSigmaY, gRandom);
|
---|
136 | particle.smearE(fSigmaE, gRandom);
|
---|
137 |
|
---|
138 | particle.computePath(fBeamLine);
|
---|
139 |
|
---|
140 | if(particle.stopped(fBeamLine)) continue;
|
---|
141 |
|
---|
142 | particle.propagate(fDistance);
|
---|
143 |
|
---|
144 | mother = candidate;
|
---|
145 | candidate = static_cast<Candidate*>(candidate->Clone());
|
---|
146 | candidate->Position.SetXYZT(particle.getX(), particle.getY(), particle.getS(), time);
|
---|
147 | candidate->Momentum.SetPxPyPzE(particle.getTX(), particle.getTY(), 0.0, particle.getE());
|
---|
148 | candidate->AddCandidate(mother);
|
---|
149 |
|
---|
150 | fOutputArray->Add(candidate);
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | //------------------------------------------------------------------------------
|
---|