1 #include "St_spaceChargeCorC.h"
2 #include "St_trigDetSumsC.h"
5 Double_t St_spaceChargeCorC::getSpaceChargeCoulombs(Double_t scaleFactor)
8 if (! scalers )
return 0;
9 Double_t zf = zeroField(0);
10 if (zf>0 && zf<1) scalers->setValidityMargin(zf);
11 Double_t coulombs = 0;
13 int idate = StMaker::GetChain()->GetDate();
16 bool use_powers = idate > 20090101;
19 for (
int row=0;row< (int) getNumRows();row++) {
21 switch ((
int) getSpaceChargeDetector(row)) {
22 case (0) : mult = scalers->getMult();
break;
23 case (1) : mult = scalers->getBBCX();
break;
24 case (2) : mult = scalers->getZDCX();
break;
25 case (3) : mult = scalers->getZDCEast()+scalers->getZDCWest();
break;
26 case (4) : mult = scalers->getBBCEast()+scalers->getBBCWest();
break;
27 case (5) : mult = scalers->getZDCEast();
break;
28 case (6) : mult = scalers->getZDCWest();
break;
29 case (7) : mult = scalers->getBBCEast();
break;
30 case (8) : mult = scalers->getBBCWest();
break;
31 case (9) : mult = scalers->getBBCYellowBkg();
break;
32 case (10): mult = scalers->getBBCBlueBkg();
break;
33 case (11): mult = scalers->getPVPDEast();
break;
34 case (12): mult = scalers->getPVPDWest();
break;
35 case (13) : mult = scalers->getCTBOrTOFp();
break;
36 case (14) : mult = scalers->getCTBEast();
break;
37 case (15) : mult = scalers->getCTBWest();
break;
38 case (16) : mult = scalers->getEPDX();
break;
46 Double_t saturation = getSpaceChargeSatRate(row);
47 Double_t correction = getSpaceChargeCorrection(scaleFactor,row);
48 Double_t factor = getSpaceChargeFactor(row);
49 Double_t offset = getSpaceChargeOffset(row);
50 Double_t intens = (mult < saturation) ? mult : saturation;
51 if (use_powers) coulombs += ::pow(intens-offset,factor) * correction ;
52 else coulombs += factor * (intens-offset) * correction ;
56 TString St_spaceChargeCorC::getSpaceChargeString(Double_t scaleFactor)
59 int idate = StMaker::GetChain()->GetDate();
60 bool use_powers = idate > 20090101;
61 for (
int row=0;row< (int) getNumRows();row++) {
62 switch ((
int) getSpaceChargeDetector(row)) {
63 case (0) : mult =
"vpdx";
break;
64 case (1) : mult =
"bbcx";
break;
65 case (2) : mult =
"zdcx";
break;
66 case (3) : mult =
"(zdce+zdcw)";
break;
67 case (4) : mult =
"(bbce+bbcw)";
break;
68 case (5) : mult =
"zdce";
break;
69 case (6) : mult =
"zdcw";
break;
70 case (7) : mult =
"bbce";
break;
71 case (8) : mult =
"bbcw";
break;
72 case (9) : mult =
"bbcyb";
break;
73 case (10): mult =
"bbcbb";
break;
74 case (11): mult =
"vpde";
break;
75 case (12): mult =
"vpdw";
break;
76 case (13): mult =
"zdcxnk";
break;
77 case (14): mult =
"zdcenk";
break;
78 case (15): mult =
"zdcwnk";
break;
81 Double_t correction = getSpaceChargeCorrection(scaleFactor,row);
82 Double_t factor = getSpaceChargeFactor(row);
83 Double_t offset = getSpaceChargeOffset(row);
84 if (factor==0 || correction==0 || mult.Length()==0)
continue;
85 if (str.Length()) str +=
"+";
86 str += Form(
"(%g)*(",correction);
87 Bool_t factorIsInt = (TMath::Abs(factor - ((
double) TMath::Nint(factor))) < 1e-6);
88 if (factorIsInt && factor>0.5 && factor<1.5) str += mult;
91 if (factorIsInt && factor>1.5) {
93 while (factor>1.5) { (str += mult) +=
"*"; factor--; }
95 }
else str += Form(
"pow(%s,%f)",mult.Data(),factor);
96 }
else (str += Form(
"%g)*(",factor)) += mult;
98 if (offset!=0) str += Form(
"-(%g)",offset);