Fork me on GitHub

Changeset 341014c in git for modules/PhotonConversions.cc


Ignore:
Timestamp:
Feb 12, 2019, 9:29:17 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, llp, master
Children:
6455202
Parents:
45e58be
Message:

apply .clang-format to all .h, .cc and .cpp files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PhotonConversions.cc

    r45e58be r341014c  
    1717 */
    1818
    19 
    2019/** \class PhotonConversions
    2120 *
     
    3029
    3130#include "classes/DelphesClasses.h"
     31#include "classes/DelphesCylindricalFormula.h"
    3232#include "classes/DelphesFactory.h"
    33 #include "classes/DelphesCylindricalFormula.h"
    34 
     33
     34#include "ExRootAnalysis/ExRootClassifier.h"
     35#include "ExRootAnalysis/ExRootFilter.h"
    3536#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"
    3942#include "TMath.h"
    40 #include "TF1.h"
     43#include "TObjArray.h"
     44#include "TRandom3.h"
    4145#include "TString.h"
    42 #include "TFormula.h"
    43 #include "TRandom3.h"
    44 #include "TObjArray.h"
    45 #include "TDatabasePDG.h"
    46 #include "TLorentzVector.h"
    4746#include "TVector3.h"
    4847
    4948#include <algorithm>
    50 #include <stdexcept>
    5149#include <iostream>
    5250#include <sstream>
     51#include <stdexcept>
    5352
    5453using namespace std;
     
    5958  fItInputArray(0), fConversionMap(0), fDecayXsec(0)
    6059{
    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);
    6261  fConversionMap = new DelphesCylindricalFormula;
    6362}
     
    7473{
    7574  fRadius = GetDouble("Radius", 1.0);
    76   fRadius2 = fRadius*fRadius;
     75  fRadius2 = fRadius * fRadius;
    7776
    7877  fHalfLength = GetDouble("HalfLength", 3.0);
     
    122121
    123122  fItInputArray->Reset();
    124   while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     123  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
    125124  {
    126125
     
    133132      candidatePosition = candidate->Position;
    134133      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;
    138137
    139138      // check that particle position is inside the cylinder
     
    152151
    153152      // 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;
    156155
    157156      if(discr2 < 0.0)
     
    161160      }
    162161
    163       tmp = px*x + py*y;
     162      tmp = px * x + py * y;
    164163      discr = TMath::Sqrt(discr2);
    165       t1 = (-tmp + discr)/pt2;
    166       t2 = (-tmp - discr)/pt2;
     164      t1 = (-tmp + discr) / pt2;
     165      t2 = (-tmp - discr) / pt2;
    167166      t = (t1 < 0.0) ? t2 : t1;
    168167
    169       z_t = z + pz*t;
     168      z_t = z + pz * t;
    170169      if(TMath::Abs(z_t) > fHalfLength)
    171170      {
     
    176175
    177176      // 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);
    184182
    185183      // here starts conversion code
    186       nsteps = Int_t(r_t/fStep);
     184      nsteps = Int_t(r_t / fStep);
    187185
    188186      x_i = x;
     
    190188      z_i = z;
    191189
    192       dt = t/nsteps;
     190      dt = t / nsteps;
    193191
    194192      converted = false;
     
    196194      for(i = 0; i < nsteps; ++i)
    197195      {
    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);
    202200
    203201        // convert photon position into cylindrical coordinates, cylindrical r,phi,z !!
    204202
    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);
    206204        phi_i = pos_i.Phi();
    207205
     
    210208
    211209        // 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);
    213211
    214212        // case conversion occurs
     
    221219          x2 = 1 - x1;
    222220
    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);
    231229
    232230          ep->PID = -11;
     
    251249
    252250//------------------------------------------------------------------------------
    253 
Note: See TracChangeset for help on using the changeset viewer.