fix SplitPole analyzer

This commit is contained in:
carina@hades 2023-12-14 16:55:33 -05:00
parent dc93fba711
commit 491a5be496
2 changed files with 58 additions and 20 deletions

View File

@ -167,7 +167,7 @@ inline void SplitPole::SetUpCanvas(){
connect(leTarget, &QLineEdit::returnPressed, this, [=](){ connect(leTarget, &QLineEdit::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value() );
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -175,7 +175,7 @@ inline void SplitPole::SetUpCanvas(){
connect(leBeam, &QLineEdit::returnPressed, this, [=](){ connect(leBeam, &QLineEdit::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value());
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -183,7 +183,7 @@ inline void SplitPole::SetUpCanvas(){
connect(leRecoil, &QLineEdit::returnPressed, this, [=](){ connect(leRecoil, &QLineEdit::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value());
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -191,7 +191,7 @@ inline void SplitPole::SetUpCanvas(){
connect(sbBfield, &RSpinBox::returnPressed, this, [=](){ connect(sbBfield, &RSpinBox::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value());
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -199,7 +199,7 @@ inline void SplitPole::SetUpCanvas(){
connect(sbAngle, &RSpinBox::returnPressed, this, [=](){ connect(sbAngle, &RSpinBox::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value());
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -207,7 +207,7 @@ inline void SplitPole::SetUpCanvas(){
connect(sbEnergy, &RSpinBox::returnPressed, this, [=](){ connect(sbEnergy, &RSpinBox::returnPressed, this, [=](){
hit.CalConstants(leTarget->text().toStdString(), hit.CalConstants(leTarget->text().toStdString(),
leBeam->text().toStdString(), leBeam->text().toStdString(),
leRecoil->text().toStdString(), sbAngle->value(), sbEnergy->value()); leRecoil->text().toStdString(), sbEnergy->value(), sbAngle->value());
hit.CalZoffset(sbBfield->value()); hit.CalZoffset(sbBfield->value());
FillConstants(); FillConstants();
}); });
@ -276,6 +276,25 @@ inline void SplitPole::SetUpCanvas(){
sbRhoScale->setMaximum(1.5); sbRhoScale->setMaximum(1.5);
sbRhoScale->setValue(1.0); sbRhoScale->setValue(1.0);
boxLayout->addWidget(sbRhoScale, 10, 3); boxLayout->addWidget(sbRhoScale, 10, 3);
QFrame *separator2 = new QFrame(box);
separator2->setFrameShape(QFrame::HLine);
separator2->setFrameShadow(QFrame::Sunken);
boxLayout->addWidget(separator2, 11, 0, 1, 4);
QString chMapStr = "ScinR = " + QString::number(SPS::ChMap::ScinR);
chMapStr += ", ScinL = " + QString::number(SPS::ChMap::ScinL);
chMapStr += ", dFR = " + QString::number(SPS::ChMap::dFR);
chMapStr += ", dFL = " + QString::number(SPS::ChMap::dFL);
chMapStr += ", dBR = " + QString::number(SPS::ChMap::dBR);
chMapStr += ", dBL = " + QString::number(SPS::ChMap::dBL);
chMapStr += ", Cathode = " + QString::number(SPS::ChMap::Cathode);
chMapStr += ", AnodeF = " + QString::number(SPS::ChMap::AnodeF);
chMapStr += ", AnodeB = " + QString::number(SPS::ChMap::AnodeB);
QLabel * chMapLabel = new QLabel(chMapStr, box);
boxLayout->addWidget(chMapLabel, 12, 0, 1, 4);
} }
//============ histograms //============ histograms
@ -289,7 +308,7 @@ inline void SplitPole::SetUpCanvas(){
h1 = new Histogram1D("Spectrum", "x", 300, 30, 70, this); h1 = new Histogram1D("Spectrum", "x", 300, 30, 70, this);
h1->SetColor(Qt::darkGreen); h1->SetColor(Qt::darkGreen);
h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10 //h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10
layout->addWidget(h1, 1, 1); layout->addWidget(h1, 1, 1);
h1g = new Histogram1D("Spectrum (PID gated)", "Ex", 300, -2, 10, this); h1g = new Histogram1D("Spectrum (PID gated)", "Ex", 300, -2, 10, this);
@ -347,20 +366,28 @@ inline void SplitPole::UpdateHistograms(){
hit.CalData(); hit.CalData();
hPID->Fill(hit.eSL, hit.eSR); // x, y double pidX = hit.eSL;
unsigned long long tPidX = hit.tSL;
double pidY = hit.eAF;
hPID->Fill(pidX, pidY); // x, y
h1->Fill(hit.xAvg);
//h1->Fill(hit.eSR, 1);
h1->Fill(hit.eSL);
h1->Fill(hit.eSR, 1);
//check events inside any Graphical cut and extract the rate, using tSR only //check events inside any Graphical cut and extract the rate, using tSR only
for(int p = 0; p < cutList.count(); p++ ){ for(int p = 0; p < cutList.count(); p++ ){
if( cutList[p].isEmpty() ) continue; if( cutList[p].isEmpty() ) continue;
if( cutList[p].containsPoint(QPointF(hit.eSL, hit.eSR), Qt::OddEvenFill) ){ if( cutList[p].containsPoint(QPointF(pidX, pidY), Qt::OddEvenFill) ){
if( hit.tSR < tMin[p] ) tMin[p] = hit.tSR; if( tPidX < tMin[p] ) tMin[p] = tPidX;
if( hit.tSR > tMax[p] ) tMax[p] = hit.tSR; if( tPidX > tMax[p] ) tMax[p] = tPidX;
count[p] ++; count[p] ++;
//printf(".... %d \n", count[p]); //printf(".... %d \n", count[p]);
if( p == 0 ) h1g->Fill(hit.eSR); if( p == 0 ) {
double xAvg = hit.xAvg * 10;
double xAvgC = xAvg * sbRhoScale->value() + sbRhoOffset->value();
h1g->Fill(hit.Rho2Ex(xAvgC/1000.));
}
} }
} }
} }

View File

@ -106,18 +106,29 @@ public:
isConstantCal = true; isConstantCal = true;
printf("============================================\n");
printf(" Beam Mass : %20.4f MeV/c2\n", beam.Mass);
printf(" beam KE : %20.4f MeV\n", beamKE);
printf("Target Mass : %20.4f MeV/c2\n", target.Mass);
printf("Recoil Mass : %20.4f MeV/c2\n", recoil.Mass);
printf("H. Rec Mass : %20.4f MeV/c2\n", heavyRecoil.Mass);
printf(" angle : %20.4f deg\n", angleDegree);
printf(" k1 : %20.4f MeV/c\n", k1);
printf(" Ei : %20.4f MeV\n", Ei);
} }
double CalRecoilMomentum(double Ex){ double CalRecoilMomentum(double Ex){
if( !isConstantCal ) return 0; if( !isConstantCal ) return 0;
float p = Ei*Ei - k1*k1; double p = Ei*Ei - k1*k1;
float q = ma*ma - (mb + Ex)*(mb + Ex); double q = ma*ma - (mb + Ex)*(mb + Ex);
float x = k1* ( p + q) * cs; double x = k1* ( p + q) * cs;
float y = pow( p, 2) + pow(q, 2)- 2 * Ei * Ei * (ma* ma + (mb + Ex)*(mb + Ex)) + 2 * k1 * k1 * (ma*ma * cos(2* angleDegree * SPS::deg2rad) + (mb + Ex)*(mb + Ex)); double y = pow( p, 2) + pow(q, 2)- 2 * Ei * Ei * (ma* ma + (mb + Ex)*(mb + Ex)) + 2 * k1 * k1 * (ma*ma * cos(2* angleDegree * SPS::deg2rad) + (mb + Ex)*(mb + Ex));
float z = 2 * ( Ei*Ei - k1*k1 * cs * cs) ; double z = 2 * ( Ei*Ei - k1*k1 * cs * cs) ;
return (x + Ei * sqrt(y))/z; return (x + Ei * sqrt(y))/z;