Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:37

0001 /**
0002  \file
0003  Imolementation of various Smear namespace functions.
0004  
0005  \author    Michael Savastio
0006  \date      2011-08-19
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #include "eicsmear/smear/Smear.h"
0011 
0012 #include <iostream>
0013 
0014 #include <TString.h>
0015 
0016 namespace Smear {
0017 
0018 int ParseInputFunction(TString &s, KinType &kin1, KinType &kin2) {
0019   int d = 0;
0020   if (s.Contains("E")) {
0021     s.ReplaceAll("E", "x");
0022     d++;
0023     kin1 = kE;
0024   }  // if
0025   if (s.Contains("P")) {
0026     d++;
0027     if (d == 2) {
0028       s.ReplaceAll("P", "y");
0029       kin2 = kP;
0030     } else {
0031       s.ReplaceAll("P", "x");
0032       kin1 = kP;
0033     }  // if
0034   }  // if
0035   if (s.Contains("theta") || s.Contains("Theta")) {
0036     d++;
0037     if (d == 2) {
0038       s.ReplaceAll("theta", "y"); s.ReplaceAll("Theta", "y");
0039       kin2 = kTheta;
0040     } else {
0041       s.ReplaceAll("theta", "x"); s.ReplaceAll("Theta", "x");
0042       kin1 = kTheta;
0043     }  // if
0044   }  // if
0045   if (s.Contains("phi")) {
0046     d++;
0047     if (d == 2) {
0048       s.ReplaceAll("phi", "y");
0049       kin2 = kPhi;
0050     } else {
0051       s.ReplaceAll("phi", "x");
0052       kin1 = kPhi;
0053     }  // if
0054   }  // if
0055   if (s.Contains("pT")) {
0056     d++;
0057     if (d == 2) {
0058       s.ReplaceAll("pT", "y");
0059       kin2 = kPt;
0060     } else {
0061       s.ReplaceAll("pT", "x");
0062       kin1 = kPt;
0063     }  // if
0064   }  // if
0065   if (s.Contains("pZ")) {
0066     d++;
0067     if (d == 2) {
0068       s.ReplaceAll("pZ", "y");
0069       kin2 = kPz;
0070     } else {
0071       s.ReplaceAll("pZ", "x");
0072       kin1 = kPz;
0073     }  // if
0074   }  // if
0075   if (d > 2 || d < 0) {
0076     std::cout << "!WARNING! Not enough, or too many parameters "
0077     << "detected in parametrization (d=";
0078     std::cout << d << ").\n";
0079   }  // if
0080   if (d == 0) {
0081     d++;
0082   }  // if
0083   return d;
0084 }
0085 
0086 }  // namespace Smear