Changeset 341014c in git for modules/PhotonConversions.cc
- Timestamp:
- Feb 12, 2019, 9:29:17 PM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, llp, master
- Children:
- 6455202
- Parents:
- 45e58be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PhotonConversions.cc
r45e58be r341014c 17 17 */ 18 18 19 20 19 /** \class PhotonConversions 21 20 * … … 30 29 31 30 #include "classes/DelphesClasses.h" 31 #include "classes/DelphesCylindricalFormula.h" 32 32 #include "classes/DelphesFactory.h" 33 #include "classes/DelphesCylindricalFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TF1.h" 40 #include "TFormula.h" 41 #include "TLorentzVector.h" 39 42 #include "TMath.h" 40 #include "TF1.h" 43 #include "TObjArray.h" 44 #include "TRandom3.h" 41 45 #include "TString.h" 42 #include "TFormula.h"43 #include "TRandom3.h"44 #include "TObjArray.h"45 #include "TDatabasePDG.h"46 #include "TLorentzVector.h"47 46 #include "TVector3.h" 48 47 49 48 #include <algorithm> 50 #include <stdexcept>51 49 #include <iostream> 52 50 #include <sstream> 51 #include <stdexcept> 53 52 54 53 using namespace std; … … 59 58 fItInputArray(0), fConversionMap(0), fDecayXsec(0) 60 59 { 61 fDecayXsec = new TF1("decayXsec", "1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0);60 fDecayXsec = new TF1("decayXsec", "1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0); 62 61 fConversionMap = new DelphesCylindricalFormula; 63 62 } … … 74 73 { 75 74 fRadius = GetDouble("Radius", 1.0); 76 fRadius2 = fRadius *fRadius;75 fRadius2 = fRadius * fRadius; 77 76 78 77 fHalfLength = GetDouble("HalfLength", 3.0); … … 122 121 123 122 fItInputArray->Reset(); 124 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))123 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 125 124 { 126 125 … … 133 132 candidatePosition = candidate->Position; 134 133 candidateMomentum = candidate->Momentum; 135 x = candidatePosition.X() *1.0E-3;136 y = candidatePosition.Y() *1.0E-3;137 z = candidatePosition.Z() *1.0E-3;134 x = candidatePosition.X() * 1.0E-3; 135 y = candidatePosition.Y() * 1.0E-3; 136 z = candidatePosition.Z() * 1.0E-3; 138 137 139 138 // check that particle position is inside the cylinder … … 152 151 153 152 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 154 tmp = px *y - py*x;155 discr2 = pt2 *fRadius2 - tmp*tmp;153 tmp = px * y - py * x; 154 discr2 = pt2 * fRadius2 - tmp * tmp; 156 155 157 156 if(discr2 < 0.0) … … 161 160 } 162 161 163 tmp = px *x + py*y;162 tmp = px * x + py * y; 164 163 discr = TMath::Sqrt(discr2); 165 t1 = (-tmp + discr) /pt2;166 t2 = (-tmp - discr) /pt2;164 t1 = (-tmp + discr) / pt2; 165 t2 = (-tmp - discr) / pt2; 167 166 t = (t1 < 0.0) ? t2 : t1; 168 167 169 z_t = z + pz *t;168 z_t = z + pz * t; 170 169 if(TMath::Abs(z_t) > fHalfLength) 171 170 { … … 176 175 177 176 // final position 178 x_t = x + px*t; 179 y_t = y + py*t; 180 z_t = z + pz*t; 181 182 r_t = TMath::Sqrt(x_t*x_t + y_t*y_t + z_t*z_t); 183 177 x_t = x + px * t; 178 y_t = y + py * t; 179 z_t = z + pz * t; 180 181 r_t = TMath::Sqrt(x_t * x_t + y_t * y_t + z_t * z_t); 184 182 185 183 // here starts conversion code 186 nsteps = Int_t(r_t /fStep);184 nsteps = Int_t(r_t / fStep); 187 185 188 186 x_i = x; … … 190 188 z_i = z; 191 189 192 dt = t /nsteps;190 dt = t / nsteps; 193 191 194 192 converted = false; … … 196 194 for(i = 0; i < nsteps; ++i) 197 195 { 198 x_i += px *dt;199 y_i += py *dt;200 z_i += pz *dt;201 pos_i.SetXYZ(x_i, y_i,z_i);196 x_i += px * dt; 197 y_i += py * dt; 198 z_i += pz * dt; 199 pos_i.SetXYZ(x_i, y_i, z_i); 202 200 203 201 // convert photon position into cylindrical coordinates, cylindrical r,phi,z !! 204 202 205 r_i = TMath::Sqrt(x_i *x_i + y_i*y_i);203 r_i = TMath::Sqrt(x_i * x_i + y_i * y_i); 206 204 phi_i = pos_i.Phi(); 207 205 … … 210 208 211 209 // convert into conversion probability 212 p_conv = 1 - TMath::Exp(-7.0 /9.0*fStep*rate);210 p_conv = 1 - TMath::Exp(-7.0 / 9.0 * fStep * rate); 213 211 214 212 // case conversion occurs … … 221 219 x2 = 1 - x1; 222 220 223 ep = static_cast<Candidate *>(candidate->Clone());224 em = static_cast<Candidate *>(candidate->Clone());225 226 ep->Position.SetXYZT(x_i *1.0E3, y_i*1.0E3, z_i*1.0E3, candidatePosition.T() + nsteps*dt*e*1.0E3);227 em->Position.SetXYZT(x_i *1.0E3, y_i*1.0E3, z_i*1.0E3, candidatePosition.T() + nsteps*dt*e*1.0E3);228 229 ep->Momentum.SetPtEtaPhiE(x1 *pt, eta, phi, x1*e);230 em->Momentum.SetPtEtaPhiE(x2 *pt, eta, phi, x2*e);221 ep = static_cast<Candidate *>(candidate->Clone()); 222 em = static_cast<Candidate *>(candidate->Clone()); 223 224 ep->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e * 1.0E3); 225 em->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e * 1.0E3); 226 227 ep->Momentum.SetPtEtaPhiE(x1 * pt, eta, phi, x1 * e); 228 em->Momentum.SetPtEtaPhiE(x2 * pt, eta, phi, x2 * e); 231 229 232 230 ep->PID = -11; … … 251 249 252 250 //------------------------------------------------------------------------------ 253
Note:
See TracChangeset
for help on using the changeset viewer.