001
002
003
004
005
006
007
008
009
010
011
012
013
014 #include "AtlfastAlgs/PhotonReconstructor.h"
015 #include "AtlfastAlgs/CorrectionFactorPhoton.h"
016
017 #include <cmath>
018
019 #include "CLHEP/Vector/LorentzVector.h"
020
021 #include "CLHEP/Random/JamesRandom.h"
022 #include "CLHEP/Random/RandGauss.h"
023 #include "CLHEP/Units/SystemOfUnits.h"
024
025 namespace Atlfast {
026 using std::abs;
027
028 ReconstructedParticle PhotonReconstructor::reconstruct( const ReconstructedParticle& particle )const{
029
030 double rpilup = 0.0;
031 double aa, bb, sigph1, sigph, sigpu;
032 double vEta = fabs(particle.eta());
033
034
035 double pt = particle.pt()/GeV;
036 double ene = particle.e()/GeV;
037 double sqrtene = sqrt(ene);
038
039
040 HepLorentzVector return_vec(0.,0.,0.,0.);
041 if (!sqrtene || !ene || !pt) {
042 ReconstructedParticle return_particle(particle);
043 return_particle.set_momentum(return_vec);
044 return return_particle;
045 }
046 if (m_smearParamSchema==1){
047
048
049
050
051
052
053
054
055 HepLorentzVector bvec(particle.momentum());
056
057
058 double sigph2 = 0.0;
059 while (1) {
060 aa=m_randGauss->fire();
061 if (vEta < 0.8) sigph2 = aa*m_smearParams[0]/sqrtene;
062
063 if (vEta >= 0.8 && vEta < 1.4) sigph2 = aa*m_smearParams[1]/sqrtene;
064
065 if (vEta >= 1.4 && vEta < 2.5) sigph2 = aa*m_smearParams[2]/sqrtene;
066
067 if (vEta >= 2.5) sigph2 = 0;
068 if (fabs(bvec.theta()) + sigph2 <= M_PI) break;
069 }
070
071
072 bvec.setPz(bvec.e()*cos(bvec.theta()+sigph2));
073
074 vEta = fabs(bvec.pseudoRapidity());
075
076
077
078
079 while (1) {
080 while (1){
081 aa=m_randGauss->fire();
082 sigph1 = aa*m_smearParams[3]/sqrtene;
083
084 if (1.0 + sigph1 > 0.0) break;
085 }
086 sigph = sigph1;
087 if (vEta < 1.4) {
088 while (1) {
089 aa=m_randGauss->fire();
090 bb=m_randGauss->fire();
091 sigph1 = aa*m_smearParams[4]/pt + bb*m_smearParams[5];
092
093 if (1.0+sigph1 > 0) break;
094 }
095 } else {
096 while (1) {
097 aa=m_randGauss->fire();
098 bb=m_randGauss->fire();
099 sigph1 = aa*m_smearParams[6]*((m_smearParams[7]-vEta)+m_smearParams[8])/ene + bb*m_smearParams[9];
100
101 if (1.0+sigph1 > 0) break;
102 }
103 }
104 sigph += sigph1;
105 if (m_lumi == 2) {
106 if (vEta < 0.6) rpilup = 0.32;
107 if (vEta > 0.6 && vEta < 1.4) rpilup = 0.295;
108 if (vEta > 1.4) rpilup = 0.27;
109 while (1) {
110 aa=m_randGauss->fire();
111 sigpu = aa*rpilup/pt;
112 if (1+sigpu > 0) break;
113 }
114 sigph += sigpu;
115 }
116
117 if (1.0 + sigph > 0) break;
118 }
119
120
121
122
123
124
125
126
127
128
129 HepLorentzVector cvec;
130 cvec.setPx(particle.px()*(1.0+sigph));
131 cvec.setPy(particle.py()*(1.0+sigph));
132 cvec.setPz(bvec.pz()*(1.0+sigph));
133
134
135 cvec.setE( particle.e() *(1.0+sigph));
136
137
138
139
140
141
142
143
144 double ETA = cvec.pseudoRapidity();
145 double PT = sqrt(cvec.px()*cvec.px()+cvec.py()*cvec.py());
146 double PHI = cvec.phi();
147
148 double x = PT*cos(PHI);
149 double y = PT*sin(PHI);
150 double z = PT*sinh(ETA);
151 double t = PT*cosh(ETA);
152
153 return_vec.setPx(x);
154 return_vec.setPy(y);
155 return_vec.setPz(z);
156 return_vec.setE(t);
157
158 } else if (m_smearParamSchema==2){
159
160 double vE = particle.e();
161
162 double vLimEta=EtaPhoton[NbEtaPhoton-1]+(EtaPhoton[NbEtaPhoton-1]-EtaPhoton[NbEtaPhoton-2])*0.5;
163
164 if( vEta>vLimEta )
165 {
166 m_log<<MSG::DEBUG<<"No calibration : "<<vEta<<endreq;
167 return particle;
168 }
169
170 int iEnergy=0;
171 m_log<<MSG::DEBUG<<vE<<" > "<<vEnergiesPhoton[iEnergy]<<" ";
172 while(iEnergy<NbEnergiesPhoton&&vE>vEnergiesPhoton[iEnergy]*1000)
173 {
174 m_log<<MSG::DEBUG<<vEnergiesPhoton[iEnergy]<<" ";
175 iEnergy++;
176 }
177 m_log<<MSG::DEBUG<<endreq;
178 if(iEnergy==0)iEnergy++;
179 double ratioEnergy=(vE*0.001-vEnergiesPhoton[iEnergy-1])/(vEnergiesPhoton[iEnergy]-vEnergiesPhoton[iEnergy-1]);
180
181 int iEta=0;
182 m_log<<MSG::DEBUG<<vEta<<" > "<<EtaPhoton[iEta]<<" ";
183 while(iEta<NbEtaPhoton&&vEta>EtaPhoton[iEta])
184 {
185 m_log<<MSG::DEBUG<<EtaPhoton[iEta]<<" ";
186 iEta++;
187 }
188 m_log<<MSG::DEBUG<<endreq;
189
190 if(iEta==0)iEta++;
191 double ratioEta=(vEta-EtaPhoton[iEta-1])/(EtaPhoton[iEta]-EtaPhoton[iEta-1]);
192
193 int iPos;
194 double sigma,sigma1,sigma2;
195
196 iPos=iEnergy-1;
197 sigma1=CorrFactorPhotonSigma[iPos][iEta-1]+ratioEta*(CorrFactorPhotonSigma[iPos][iEta]-CorrFactorPhotonSigma[iPos][iEta-1]);
198 iPos=iEnergy;
199 sigma2=CorrFactorPhotonSigma[iPos][iEta-1]+ratioEta*(CorrFactorPhotonSigma[iPos][iEta]-CorrFactorPhotonSigma[iPos][iEta-1]);
200
201 sigma=sigma1+ratioEnergy*(sigma2-sigma1);
202
203 m_log<<MSG::DEBUG<<" -> interpolation sigma "<<sigma1<<" "<<sigma2<<" "<<sigma<<endreq;
204
205 double alpha=1.0;
206 double vrandom=alpha;
207
208 int iCmpt=int(m_randFlat->fire()*20);
209 for(int i=0; i<iCmpt; i++)
210 vrandom=m_randGauss->fire(1.0,sigma);
211
212
213
214 m_log<<MSG::DEBUG<<" -> Energie : "<<vEnergiesPhoton[iEnergy]<<" Eta : "<<vEnergiesPhoton[iEnergy-1]<<" < "<<vE<<" < "<<vEnergiesPhoton[iEnergy]<<endreq;
215 m_log<<MSG::DEBUG<<" -> Energie : "<<vEnergiesPhoton[iEnergy]<<" Eta : "<<EtaPhoton[iEta-1]<<" < "<<vEta<<" < "<<EtaPhoton[iEta]<<endreq;
216 m_log<<MSG::DEBUG<<" calib mean-sigma "<<alpha<<" "<<sigma<<" -> "<<vrandom<<endreq;
217
218 return_vec.set(particle.px()*vrandom, particle.py()*vrandom, particle.pz()*vrandom, vE*vrandom);
219
220 m_log<<MSG::DEBUG<<"-> HepLorentzVector calibration "<<vEta<<" "<<particle<<" -> "<<return_vec<<endreq;
221
222 }
223
224 ReconstructedParticle return_particle(particle);
225 return_particle.set_momentum(return_vec);
226 return return_particle;
227
228 }
229
230 int PhotonReconstructor::setSmearParameters (const std::vector<double>& smearValues){
231 m_smearParams=smearValues;
232 return 0;
233 }
234
235
236 int PhotonReconstructor::setSmearParamSchema ( const int smearSchema) {
237 m_smearParamSchema=smearSchema;
238 return 0;
239 }
240
241 }
242
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|