modified some base classes

This commit is contained in:
Ryan Tang 2024-02-15 16:36:45 -05:00
parent 3a0dba08da
commit 6fad708ee2
5 changed files with 297 additions and 259 deletions

View File

@ -15,6 +15,8 @@
struct Array{ struct Array{
bool enable;
double detPerpDist; /// distance from axis double detPerpDist; /// distance from axis
double detWidth; /// width double detWidth; /// width
double detLength; /// length double detLength; /// length
@ -85,11 +87,7 @@ public:
double elumPos1, elumPos2; /// imaginary elum, only sensitive to light recoil double elumPos1, elumPos2; /// imaginary elum, only sensitive to light recoil
//===================1st array //===================1st array
Array array1; Array array[2];
//==================2nd array
bool use2ndArray;
Array array2;
double zMin, zMax; /// range of detectors double zMin, zMax; /// range of detectors
bool isCoincidentWithRecoil; bool isCoincidentWithRecoil;
@ -129,9 +127,7 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
TList * haha = macro->GetListOfLines(); TList * haha = macro->GetListOfLines();
int numLine = (haha)->GetSize(); int numLine = (haha)->GetSize();
array1.pos.clear(); for( int i = 0; i < 2 ; i++) array[i].pos.clear();
array2.pos.clear();
use2ndArray = false;
int detFlag = 0; int detFlag = 0;
int detLine = 0; int detLine = 0;
@ -170,45 +166,35 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
if ( detLine == 10 ) elumPos2 = atof(str[0].c_str()); if ( detLine == 10 ) elumPos2 = atof(str[0].c_str());
} }
if( detFlag == 1){ if( detFlag > 0){
if ( detLine == 0 ) array1.detPerpDist = atof(str[0].c_str()); unsigned short ID = detFlag - 1;
if ( detLine == 1 ) array1.detWidth = atof(str[0].c_str()); if ( detLine == 0 ) array[ID].enable = str[0] == "true" ? true : false;
if ( detLine == 2 ) array1.detLength = atof(str[0].c_str()); if ( detLine == 1 ) array[ID].detPerpDist = atof(str[0].c_str());
if ( detLine == 3 ) array1.blocker = atof(str[0].c_str()); if ( detLine == 2 ) array[ID].detWidth = atof(str[0].c_str());
if ( detLine == 4 ) array1.firstPos = atof(str[0].c_str()); if ( detLine == 3 ) array[ID].detLength = atof(str[0].c_str());
if ( detLine == 5 ) array1.eSigma = atof(str[0].c_str()); if ( detLine == 4 ) array[ID].blocker = atof(str[0].c_str());
if ( detLine == 6 ) array1.zSigma = atof(str[0].c_str()); if ( detLine == 5 ) array[ID].firstPos = atof(str[0].c_str());
if ( detLine == 7 ) array1.detFaceOut = str[0] == "Out" ? true : false; if ( detLine == 6 ) array[ID].eSigma = atof(str[0].c_str());
if ( detLine == 8 ) array1.mDet = atoi(str[0].c_str()); if ( detLine == 7 ) array[ID].zSigma = atof(str[0].c_str());
if ( detLine >= 9 ) array1.pos.push_back(atof(str[0].c_str())); if ( detLine == 8 ) array[ID].detFaceOut = str[0] == "Out" ? true : false;
} if ( detLine == 9 ) array[ID].mDet = atoi(str[0].c_str());
if ( detLine >= 10 ) array[ID].pos.push_back(atof(str[0].c_str()));
if( detFlag == 2){
if ( detLine == 0 ) use2ndArray = str[0] == "true" ? true : false;
if ( detLine == 1 ) array2.detPerpDist = atof(str[0].c_str());
if ( detLine == 2 ) array2.detWidth = atof(str[0].c_str());
if ( detLine == 3 ) array2.detLength = atof(str[0].c_str());
if ( detLine == 4 ) array2.blocker = atof(str[0].c_str());
if ( detLine == 5 ) array2.firstPos = atof(str[0].c_str());
if ( detLine == 6 ) array2.eSigma = atof(str[0].c_str());
if ( detLine == 7 ) array2.zSigma = atof(str[0].c_str());
if ( detLine == 8 ) array2.detFaceOut = str[0] == "Out" ? true : false;
if ( detLine == 9 ) array2.mDet = atoi(str[0].c_str());
if ( detLine >= 10 ) array2.pos.push_back(atof(str[0].c_str()));
} }
detLine ++; detLine ++;
} }
array1.DeduceAbsolutePos(); zMin = 99999;
array2.DeduceAbsolutePos(); zMax = -99999;
zMin = array1.zMin; for( int i = 0; i < 2; i ++ ){
zMax = array1.zMax; array[i].DeduceAbsolutePos();
if (array[i].enable ) {
if( use2ndArray) { double zmax = TMath::Max(array[i].zMin, array[i].zMax);
zMax = TMath::Min(array1.zMax, array2.zMax); double zmin = TMath::Min(array[i].zMin, array[i].zMax);
zMin = TMath::Min(array1.zMin, array2.zMin); if( zmax > zMax ) zMax = zmax;
if( zmin < zMin ) zMin = zmin;
}
} }
if( verbose ) Print(false); if( verbose ) Print(false);
@ -226,12 +212,13 @@ inline void DetGeo::Print(bool printAll) const{
} }
printf(" Recoil detector pos: %8.2f mm, radius: %6.2f - %6.2f mm \n", recoilPos, recoilInnerRadius, recoilOuterRadius); printf(" Recoil detector pos: %8.2f mm, radius: %6.2f - %6.2f mm \n", recoilPos, recoilInnerRadius, recoilOuterRadius);
printf("------------------------------------- Detector Position \n"); for( int i = 0; i < 2 ; i++){
array1.PrintArray();
if( printAll || array[i].enable ) {
printf("-----------------------------------%d-th Detector Position \n", i);
array[i].PrintArray();
}
if( printAll || use2ndArray){
printf("--------------------------------- 2nd Detector Position \n");
array2.PrintArray();
} }
if( elumPos1 != 0 || elumPos2 != 0 || recoilPos1 != 0 || recoilPos2 != 0){ if( elumPos1 != 0 || elumPos2 != 0 || recoilPos1 != 0 || recoilPos2 != 0){

View File

@ -63,14 +63,14 @@ public:
float targetThickness; ///targetThickness_in_cm float targetThickness; ///targetThickness_in_cm
std::string beamStoppingPowerFile; ///stopping_power_for_beam std::string beamStoppingPowerFile; ///stopping_power_for_beam
Recoil recoil1, recoil2; Recoil recoil[2];
int numEvents; ///number_of_Event_being_generated int numEvents; ///number_of_Event_being_generated
bool isRedo; ///isReDo bool isRedo; ///isReDo
void SetReactionSimple(int beamA, int beamZ, void SetReactionSimple(int beamA, int beamZ,
int targetA, int targetZ, int targetA, int targetZ,
int recoilA, int recoilZ, float beamEnergy_AMeV); int recoilA, int recoilZ, float beamEnergy_AMeV, unsigned short ID);
bool LoadReactionConfig(TString fileName); bool LoadReactionConfig(TString fileName);
bool LoadReactionConfig(TMacro * macro); bool LoadReactionConfig(TMacro * macro);
@ -83,17 +83,17 @@ private:
inline void ReactionConfig::SetReactionSimple(int beamA, int beamZ, inline void ReactionConfig::SetReactionSimple(int beamA, int beamZ,
int targetA, int targetZ, int targetA, int targetZ,
int recoilA, int recoilZ, float beamEnergy_AMeV){ int recoilA, int recoilZ, float beamEnergy_AMeV, unsigned short ID){
this->beamA = beamA; this->beamA = beamA;
this->beamZ = beamZ; this->beamZ = beamZ;
this->targetA = targetA; this->targetA = targetA;
this->targetZ = targetZ; this->targetZ = targetZ;
this->recoil1.lightA = recoilA; this->recoil[ID].lightA = recoilA;
this->recoil1.lightZ = recoilZ; this->recoil[ID].lightZ = recoilZ;
recoil1.heavyA = this->beamA + this->targetA - recoil1.lightA; recoil[ID].heavyA = this->beamA + this->targetA - recoil[ID].lightA;
recoil1.heavyZ = this->beamZ + this->targetZ - recoil1.lightZ; recoil[ID].heavyZ = this->beamZ + this->targetZ - recoil[ID].lightZ;
beamEnergy = beamEnergy_AMeV; beamEnergy = beamEnergy_AMeV;
beamEnergySigma = 0; beamEnergySigma = 0;
@ -168,27 +168,16 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
if( recoilLine == 16 ) isRedo = str[0].compare("true" ) == 0 ? true : false; if( recoilLine == 16 ) isRedo = str[0].compare("true" ) == 0 ? true : false;
} }
if( recoilFlag == 1 ){ if( recoilFlag > 0 ){
if( recoilLine == 0 ) recoil1.lightA = atoi(str[0].c_str()); unsigned ID = recoilFlag - 1;
if( recoilLine == 1 ) recoil1.lightZ = atoi(str[0].c_str()); if( recoilLine == 0 ) recoil[ID].lightA = atoi(str[0].c_str());
if( recoilLine == 2 ) recoil1.lightStoppingPowerFile = str[0]; if( recoilLine == 1 ) recoil[ID].lightZ = atoi(str[0].c_str());
if( recoilLine == 3 ) recoil1.heavyStoppingPowerFile = str[0]; if( recoilLine == 2 ) recoil[ID].lightStoppingPowerFile = str[0];
if( recoilLine == 4 ) recoil1.isDecay = str[0].compare("true") == 0 ? true : false; if( recoilLine == 3 ) recoil[ID].heavyStoppingPowerFile = str[0];
if( recoilLine == 5 ) recoil1.decayA = atoi(str[0].c_str()); if( recoilLine == 4 ) recoil[ID].isDecay = str[0].compare("true") == 0 ? true : false;
if( recoilLine == 6 ) recoil1.decayZ = atoi(str[0].c_str()); if( recoilLine == 5 ) recoil[ID].decayA = atoi(str[0].c_str());
if( recoilLine == 6 ) recoil[ID].decayZ = atoi(str[0].c_str());
}
if( recoilFlag == 2 ){
if( recoilLine == 0 ) recoil2.lightA = atoi(str[0].c_str());
if( recoilLine == 1 ) recoil2.lightZ = atoi(str[0].c_str());
if( recoilLine == 2 ) recoil2.lightStoppingPowerFile = str[0];
if( recoilLine == 3 ) recoil2.heavyStoppingPowerFile = str[0];
if( recoilLine == 4 ) recoil2.isDecay = str[0].compare("true") == 0 ? true : false;
if( recoilLine == 5 ) recoil2.decayA = atoi(str[0].c_str());
if( recoilLine == 6 ) recoil2.decayZ = atoi(str[0].c_str());
} }
@ -196,12 +185,10 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
} }
recoil1.heavyA = beamA + targetA - recoil1.lightA; for( int i = 0; i < 2; i++){
recoil1.heavyZ = beamZ + targetZ - recoil1.lightZ; recoil[i].heavyA = beamA + targetA - recoil[i].lightA;
recoil[i].heavyZ = beamZ + targetZ - recoil[i].lightZ;
recoil2.heavyA = beamA + targetA - recoil2.lightA; }
recoil2.heavyZ = beamZ + targetZ - recoil2.lightZ;
return true; return true;
} }
@ -227,9 +214,9 @@ inline void ReactionConfig::Print() const{
printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str()); printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str());
} }
printf("------------------------------ Recoil-1\n"); recoil1.Print(); for( int i = 0; i < 2; i ++ ){
printf("------------------------------ Recoil-%d\n", i); recoil[i].Print();
printf("------------------------------ Recoil-2\n"); recoil2.Print(); }
printf("=====================================================\n"); printf("=====================================================\n");

View File

@ -54,8 +54,24 @@ struct trajectory{
printf(" detID : %d \n", detID); printf(" detID : %d \n", detID);
} }
};
void Clear(){
theta = TMath::QuietNaN();
phi = TMath::QuietNaN();
vt = TMath::QuietNaN();
vp = TMath::QuietNaN();
rho = TMath::QuietNaN();
z0 = TMath::QuietNaN();
t0 = TMath::QuietNaN();
x = TMath::QuietNaN();
y = TMath::QuietNaN();
z = TMath::QuietNaN();
effLoop = TMath::QuietNaN();
detID = -1;
detRowID = -1;
loop = -1;
}
};
class HELIOS{ class HELIOS{
public: public:
@ -65,37 +81,23 @@ public:
void SetCoincidentWithRecoil(bool TorF){ this->isCoincidentWithRecoil = TorF;} void SetCoincidentWithRecoil(bool TorF){ this->isCoincidentWithRecoil = TorF;}
bool GetCoincidentWithRecoil(){return this->isCoincidentWithRecoil;} bool GetCoincidentWithRecoil(){return this->isCoincidentWithRecoil;}
bool SetDetectorGeometry(std::string filename); bool SetDetectorGeometry(std::string filename, unsigned short ID);
void SetBeamPosition(double x, double y) { xOff = x; yOff = y;} void SetBeamPosition(double x, double y) { xOff = x; yOff = y;}
void OverrideMagneticField(double BField){ this->detGeo.Bfield = BField; this->detGeo.BfieldSign = BField > 0 ? 1: -1;} void OverrideMagneticField(double BField);
void OverrideMagneticFieldDirection(double BfieldThetaInDeg){ this->detGeo.BfieldTheta = BfieldThetaInDeg;} void OverrideMagneticFieldDirection(double BfieldThetaInDeg);
void OverrideFirstPos(double firstPos){ void OverrideFirstPos(double firstPos);
overrideFirstPos = true; void OverrideDetectorDistance(double perpDist);
printf("------ Overriding FirstPosition to : %8.2f mm \n", firstPos); void OverrideDetectorFacing(bool isOutside);
this->array.firstPos = firstPos;
}
void OverrideDetectorDistance(double perpDist){
overrideDetDistance = true;
printf("------ Overriding Detector Distance to : %8.2f mm \n", perpDist);
this->array.detPerpDist = perpDist;
}
void SetDetectorOutside(bool isOutside){ int CheckDetAcceptance();
this->array.detFaceOut = isOutside; int CalArrayHit(TLorentzVector Pb, bool debug = false);
printf(" Detectors are facing %s\n", array.detFaceOut ? "outside": "inside" ); int CalRecoilHit(TLorentzVector PB);
} void CalTrajectoryPara(TLorentzVector P, bool isLightRecoil);
int DetAcceptance();
int CalArrayHit(TLorentzVector Pb, int Zb, bool debug = false);
int CalRecoilHit(TLorentzVector PB, int ZB);
//int CalHit(TLorentzVector Pb, int Zb, TLorentzVector PB, int ZB, double xOff = 0, double yOff = 0 ); // return 0 for no hit, 1 for hit
void CalTrajectoryPara(TLorentzVector P, int Z, bool isLightRecoil);
int GetNumberOfDetectorsInSamePos(){return array.mDet;} int GetNumberOfDetectorsInSamePos(){return array.mDet;}
double GetEnergy(){return e;} double GetEnergy()const {return e;}
double GetDetX(){return detX;} // position in each detector, range from -1, 1 double GetDetX() const {return detX;} // position in each detector, range from -1, 1
/// clockwise rotation for B-field along the z-axis, sign = 1. /// clockwise rotation for B-field along the z-axis, sign = 1.
double XPos(double Zpos, double theta, double phi, double rho, int sign){ double XPos(double Zpos, double theta, double phi, double rho, int sign){
@ -122,36 +124,21 @@ public:
double GetRecoilYPos(double ZPos){ return TMath::IsNaN(ZPos) ? TMath::QuietNaN() : YPos( ZPos, orbitB.theta, orbitB.phi, orbitB.rho, detGeo.BfieldSign); } double GetRecoilYPos(double ZPos){ return TMath::IsNaN(ZPos) ? TMath::QuietNaN() : YPos( ZPos, orbitB.theta, orbitB.phi, orbitB.rho, detGeo.BfieldSign); }
double GetRecoilR(double ZPos) { return TMath::IsNaN(ZPos) ? TMath::QuietNaN() : RPos( ZPos, orbitB.theta, orbitB.phi, orbitB.rho, detGeo.BfieldSign); } double GetRecoilR(double ZPos) { return TMath::IsNaN(ZPos) ? TMath::QuietNaN() : RPos( ZPos, orbitB.theta, orbitB.phi, orbitB.rho, detGeo.BfieldSign); }
double GetBField() {return detGeo.Bfield;} void PrintGeometry() const;
double GetDetRadius() {return array.detPerpDist;}
trajectory GetTrajectory_b() {return orbitb;} double GetBField() const {return detGeo.Bfield;}
trajectory GetTrajectory_B() {return orbitB;} double GetDetRadius() const {return array.detPerpDist;}
DetGeo GetDetectorGeometry() {return detGeo;} trajectory GetTrajectory_b() const {return orbitb;}
trajectory GetTrajectory_B() const {return orbitB;}
DetGeo GetDetectorGeometry() const {return detGeo;}
TString GetHitMessage() const {return hitMessage;} TString GetHitMessage() const {return hitMessage;}
TString GetAcceptanceMessage() const {return accMessage;} TString GetAcceptanceMessage() const {return accMessage;}
private: private:
void ClearTrajectory(trajectory t){
t.theta = TMath::QuietNaN();
t.phi = TMath::QuietNaN();
t.vt = TMath::QuietNaN();
t.vp = TMath::QuietNaN();
t.rho = TMath::QuietNaN();
t.z0 = TMath::QuietNaN();
t.t0 = TMath::QuietNaN();
t.x = TMath::QuietNaN();
t.y = TMath::QuietNaN();
t.z = TMath::QuietNaN();
t.effLoop = TMath::QuietNaN();
t.detID = -1;
t.detRowID = -1;
t.loop = -1;
}
DetGeo detGeo; DetGeo detGeo;
Array array; Array array;
@ -178,8 +165,8 @@ private:
HELIOS::HELIOS(){ HELIOS::HELIOS(){
ClearTrajectory(orbitb); orbitb.Clear();
ClearTrajectory(orbitB); orbitB.Clear();
e = TMath::QuietNaN(); e = TMath::QuietNaN();
eB = TMath::QuietNaN(); eB = TMath::QuietNaN();
@ -204,19 +191,40 @@ HELIOS::~HELIOS(){
} }
bool HELIOS::SetDetectorGeometry(std::string filename){ void HELIOS::OverrideMagneticField(double BField){
this->detGeo.Bfield = BField;
if( detGeo.LoadDetectorGeo(filename)) { this->detGeo.BfieldSign = BField > 0 ? 1: -1;
if( detGeo.use2ndArray ){
array = detGeo.array2;
}else{
array = detGeo.array1;
} }
isCoincidentWithRecoil = detGeo.isCoincidentWithRecoil; void HELIOS::OverrideMagneticFieldDirection(double BfieldThetaInDeg){
this->detGeo.BfieldTheta = BfieldThetaInDeg;
}
void HELIOS::OverrideFirstPos(double firstPos){
overrideFirstPos = true;
printf("------ Overriding FirstPosition to : %8.2f mm \n", firstPos);
this->array.firstPos = firstPos;
}
void HELIOS::OverrideDetectorDistance(double perpDist){
overrideDetDistance = true;
printf("------ Overriding Detector Distance to : %8.2f mm \n", perpDist);
this->array.detPerpDist = perpDist;
}
void HELIOS::OverrideDetectorFacing(bool isOutside){
this->array.detFaceOut = isOutside;
printf(" Detectors are facing %s\n", array.detFaceOut ? "outside": "inside" );
}
bool HELIOS::SetDetectorGeometry(std::string filename, unsigned short ID){
if( detGeo.LoadDetectorGeo(filename, false)) {
array = detGeo.array[ID];
isCoincidentWithRecoil = detGeo.isCoincidentWithRecoil;
isDetReady = true; isDetReady = true;
}else{ }else{
printf("cannot read file %s.\n", filename.c_str()); printf("cannot read file %s.\n", filename.c_str());
isDetReady = false; isDetReady = false;
@ -225,7 +233,31 @@ bool HELIOS::SetDetectorGeometry(std::string filename){
return isDetReady; return isDetReady;
} }
int HELIOS::DetAcceptance(){ void HELIOS::PrintGeometry() const{
printf("=====================================================\n");
printf(" B-field: %8.2f T, Theta : %6.2f deg \n", detGeo.Bfield, detGeo.BfieldTheta);
if( detGeo.BfieldTheta != 0.0 ) {
printf(" +---- field angle != 0 is not supported!!! \n");
}
printf(" Recoil detector pos: %8.2f mm, radius: %6.2f - %6.2f mm \n", detGeo.recoilPos, detGeo.recoilInnerRadius, detGeo.recoilOuterRadius);
printf("----------------------------------- Detector Position \n");
array.PrintArray();
if( detGeo.elumPos1 != 0 || detGeo.elumPos2 != 0 || detGeo.recoilPos1 != 0 || detGeo.recoilPos2 != 0){
printf("=================================== Auxillary/Imaginary Detectors\n");
}
if( detGeo.elumPos1 != 0 ) printf(" Elum 1 pos.: %f mm \n", detGeo.elumPos1);
if( detGeo.elumPos2 != 0 ) printf(" Elum 2 pos.: %f mm \n", detGeo.elumPos2);
if( detGeo.recoilPos1 != 0 ) printf(" Recoil 1 pos.: %f mm \n", detGeo.recoilPos1);
if( detGeo.recoilPos2 != 0 ) printf(" Recoil 2 pos.: %f mm \n", detGeo.recoilPos2);
printf("=====================================================\n");
}
int HELIOS::CheckDetAcceptance(){
//CalArrayHit and CalRecoilHit must be done before. //CalArrayHit and CalRecoilHit must be done before.
@ -329,12 +361,12 @@ int HELIOS::DetAcceptance(){
return -20; // for unknown reason return -20; // for unknown reason
} }
void HELIOS::CalTrajectoryPara(TLorentzVector P, int Z, bool isLightRecoil){ void HELIOS::CalTrajectoryPara(TLorentzVector P, bool isLightRecoil){
if( isLightRecoil ){ if( isLightRecoil ){
orbitb.theta = P.Theta(); orbitb.theta = P.Theta();
orbitb.phi = P.Phi(); orbitb.phi = P.Phi();
orbitb.rho = P.Pt() / abs(detGeo.Bfield) / Z / c * 1000; //mm orbitb.rho = P.Pt() / abs(detGeo.Bfield) / P.GetUniqueID() / c * 1000; //mm
orbitb.vt = P.Beta() * TMath::Sin(P.Theta()) * c ; // mm / nano-second orbitb.vt = P.Beta() * TMath::Sin(P.Theta()) * c ; // mm / nano-second
orbitb.vp = P.Beta() * TMath::Cos(P.Theta()) * c ; // mm / nano-second orbitb.vp = P.Beta() * TMath::Cos(P.Theta()) * c ; // mm / nano-second
orbitb.t0 = TMath::TwoPi() * orbitb.rho / orbitb.vt; // nano-second orbitb.t0 = TMath::TwoPi() * orbitb.rho / orbitb.vt; // nano-second
@ -346,7 +378,7 @@ void HELIOS::CalTrajectoryPara(TLorentzVector P, int Z, bool isLightRecoil){
}else{ }else{
orbitB.theta = P.Theta(); orbitB.theta = P.Theta();
orbitB.phi = P.Phi(); orbitB.phi = P.Phi();
orbitB.rho = P.Pt() / abs(detGeo.Bfield) / Z / c * 1000; //mm orbitB.rho = P.Pt() / abs(detGeo.Bfield) / P.GetUniqueID() / c * 1000; //mm
orbitB.vt = P.Beta() * TMath::Sin(P.Theta()) * c ; // mm / nano-second orbitB.vt = P.Beta() * TMath::Sin(P.Theta()) * c ; // mm / nano-second
orbitB.vp = P.Beta() * TMath::Cos(P.Theta()) * c ; // mm / nano-second orbitB.vp = P.Beta() * TMath::Cos(P.Theta()) * c ; // mm / nano-second
orbitB.t0 = TMath::TwoPi() * orbitB.rho / orbitB.vt; // nano-second orbitB.t0 = TMath::TwoPi() * orbitB.rho / orbitB.vt; // nano-second
@ -357,13 +389,13 @@ void HELIOS::CalTrajectoryPara(TLorentzVector P, int Z, bool isLightRecoil){
} }
} }
int HELIOS::CalArrayHit(TLorentzVector Pb, int Zb, bool debug){ int HELIOS::CalArrayHit(TLorentzVector Pb, bool debug){
e = Pb.E() - Pb.M(); e = Pb.E() - Pb.M();
detX = TMath::QuietNaN(); detX = TMath::QuietNaN();
rhoHit = TMath::QuietNaN(); rhoHit = TMath::QuietNaN();
CalTrajectoryPara(Pb, Zb, true); CalTrajectoryPara(Pb, true);
int targetLoop = 1; int targetLoop = 1;
int inOut = array.detFaceOut == true ? 1: 0; //1 = from Outside, 0 = from inside int inOut = array.detFaceOut == true ? 1: 0; //1 = from Outside, 0 = from inside
@ -470,9 +502,9 @@ int HELIOS::CalArrayHit(TLorentzVector Pb, int Zb, bool debug){
return 1; // return 1 when OK return 1; // return 1 when OK
} }
int HELIOS::CalRecoilHit(TLorentzVector PB, int ZB){ int HELIOS::CalRecoilHit(TLorentzVector PB){
CalTrajectoryPara(PB, ZB, false); CalTrajectoryPara(PB, false);
orbitB.z = detGeo.recoilPos; orbitB.z = detGeo.recoilPos;
orbitB.x = GetRecoilXPos(detGeo.recoilPos) ; orbitB.x = GetRecoilXPos(detGeo.recoilPos) ;

View File

@ -30,9 +30,9 @@ public:
targetA, targetZ, targetA, targetZ,
recoilA, recoilZ, beamEnergy_AMeV); recoilA, recoilZ, beamEnergy_AMeV);
} }
TransferReaction(string configFile){ TransferReaction(string configFile, unsigned short ID = 0){
Inititization(); Inititization();
SetReactionFromFile(configFile); SetReactionFromFile(configFile, ID);
} }
~TransferReaction(); ~TransferReaction();
@ -49,7 +49,7 @@ public:
void SetExA(double Ex); void SetExA(double Ex);
void SetExB(double Ex); void SetExB(double Ex);
void SetReactionFromFile(string configFile); void SetReactionFromFile(string configFile, unsigned short ID = 0);
TString GetReactionName(); TString GetReactionName();
TString GetReactionName_Latex(); TString GetReactionName_Latex();
@ -70,7 +70,8 @@ public:
TLorentzVector GetPb(){return Pb;} TLorentzVector GetPb(){return Pb;}
TLorentzVector GetPB(){return PB;} TLorentzVector GetPB(){return PB;}
void PrintFourVectors(); void PrintFourVectors() const;
void PrintReaction() const;
void CalReactionConstant(); void CalReactionConstant();
@ -85,6 +86,7 @@ public:
private: private:
Recoil recoil;
ReactionConfig config; ReactionConfig config;
string nameA, namea, nameb, nameB; string nameA, namea, nameb, nameB;
@ -161,8 +163,8 @@ void TransferReaction::Seta(int A, int Z){
void TransferReaction::Setb(int A, int Z){ void TransferReaction::Setb(int A, int Z){
Isotope temp (A, Z); Isotope temp (A, Z);
mb = temp.Mass; mb = temp.Mass;
config.recoil1.lightA = A; recoil.lightA = A;
config.recoil1.lightZ = Z; recoil.lightZ = Z;
nameb = temp.Name; nameb = temp.Name;
isReady = false; isReady = false;
isBSet = false; isBSet = false;
@ -170,8 +172,8 @@ void TransferReaction::Setb(int A, int Z){
void TransferReaction::SetB(int A, int Z){ void TransferReaction::SetB(int A, int Z){
Isotope temp (A, Z); Isotope temp (A, Z);
mB = temp.Mass; mB = temp.Mass;
config.recoil1.heavyA = A; recoil.heavyA = A;
config.recoil1.heavyZ = Z; recoil.heavyZ = Z;
nameB = temp.Name; nameB = temp.Name;
isReady = false; isReady = false;
isBSet = true; isBSet = true;
@ -191,12 +193,14 @@ void TransferReaction::SetReactionSimple(int beamA, int beamZ,
config.SetReactionSimple(beamA, beamZ, config.SetReactionSimple(beamA, beamZ,
targetA, targetZ, targetA, targetZ,
recoilA, recoilZ, beamEnergy_AMeV); recoilA, recoilZ, beamEnergy_AMeV, 0);
recoil = config.recoil[0];
SetA(config.beamA, config.beamZ); SetA(config.beamA, config.beamZ);
Seta(config.targetA, config.targetZ); Seta(config.targetA, config.targetZ);
Setb(config.recoil1.lightA, config.recoil1.lightZ); Setb(recoil.lightA, recoil.lightZ);
SetB(config.recoil1.heavyA, config.recoil1.heavyZ); SetB(recoil.heavyA, recoil.heavyZ);
SetIncidentEnergyAngle(config.beamEnergy, 0, 0); SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
CalReactionConstant(); CalReactionConstant();
@ -213,14 +217,17 @@ void TransferReaction::SetExB(double Ex){
isReady = false; isReady = false;
} }
void TransferReaction::SetReactionFromFile(string configFile){ void TransferReaction::SetReactionFromFile(string configFile, unsigned short ID){
if( config.LoadReactionConfig(configFile) ){ if( config.LoadReactionConfig(configFile) ){
SetA(config.beamA, config.beamZ); SetA(config.beamA, config.beamZ);
Seta(config.targetA, config.targetZ); Seta(config.targetA, config.targetZ);
Setb(config.recoil1.lightA, config.recoil1.lightZ);
SetB(config.recoil1.heavyA, config.recoil1.heavyZ); recoil = config.recoil[ID];
Setb(recoil.lightA, recoil.lightZ);
SetB(recoil.heavyA, recoil.heavyZ);
SetIncidentEnergyAngle(config.beamEnergy, 0, 0); SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
CalReactionConstant(); CalReactionConstant();
@ -260,9 +267,9 @@ TString TransferReaction::GetReactionName_Latex(){
void TransferReaction::CalReactionConstant(){ void TransferReaction::CalReactionConstant(){
if( !isBSet){ if( !isBSet){
config.recoil1.heavyA = config.beamA + config.targetA - config.recoil1.lightA; recoil.heavyA = config.beamA + config.targetA - recoil.lightA;
config.recoil1.heavyZ = config.beamZ + config.targetZ - config.recoil1.lightZ; recoil.heavyZ = config.beamZ + config.targetZ - recoil.lightZ;
Isotope temp (config.recoil1.heavyA, config.recoil1.heavyZ); Isotope temp (recoil.heavyA, recoil.heavyZ);
mB = temp.Mass; mB = temp.Mass;
isBSet = true; isBSet = true;
} }
@ -279,10 +286,15 @@ void TransferReaction::CalReactionConstant(){
Pa.SetXYZM(0,0,0,ma); Pa.SetXYZM(0,0,0,ma);
PA.SetUniqueID(config.beamZ);
Pa.SetUniqueID(config.targetZ);
Pb.SetUniqueID(recoil.lightZ);
PB.SetUniqueID(recoil.heavyZ);
isReady = true; isReady = true;
} }
void TransferReaction::PrintFourVectors(){ void TransferReaction::PrintFourVectors() const {
printf("A : %10.2f %10.2f %10.2f %10.2f\n", PA.E(), PA.Px(), PA.Py(), PA.Pz()); printf("A : %10.2f %10.2f %10.2f %10.2f\n", PA.E(), PA.Px(), PA.Py(), PA.Pz());
printf("a : %10.2f %10.2f %10.2f %10.2f\n", Pa.E(), Pa.Px(), Pa.Py(), Pa.Pz()); printf("a : %10.2f %10.2f %10.2f %10.2f\n", Pa.E(), Pa.Px(), Pa.Py(), Pa.Pz());
@ -297,6 +309,25 @@ void TransferReaction::PrintFourVectors(){
} }
void TransferReaction::PrintReaction() const {
printf("=====================================================\n");
printf("------------------------------ Beam\n");
printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", config.beamA, config.beamZ, config.beamEx);
printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", config.beamEnergy, config.beamEnergySigma, config.beamEnergySigma/config.beamEnergy);
printf(" Angle : %.2f +- %.2f mrad\n", config.beamAngle, config.beamAngleSigma);
printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", config.beamX, config.beamY);
printf("------------------------------ Target\n");
printf(" target : A = %3d, Z = %2d \n", config.targetA, config.targetZ);
printf("------------------------------ Recoil\n");
printf(" light : A = %3d, Z = %2d \n", recoil.lightA, recoil.lightZ);
printf(" heavy : A = %3d, Z = %2d \n", recoil.heavyA, recoil.heavyZ);
printf("=====================================================\n");
}
void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){ void TransferReaction::Event(double thetaCM_rad, double phiCM_rad){
if( isReady == false ){ if( isReady == false ){
@ -355,7 +386,7 @@ std::pair<double, double> TransferReaction::CalExThetaCM(double e, double z, dou
double mass = mb; double mass = mb;
double massB = mB; double massB = mB;
double y = e + mass; double y = e + mass;
double slope = 299.792458 * config.recoil1.lightZ * abs(Bfield) / TMath::TwoPi() * beta / 1000.; // MeV/mm; double slope = 299.792458 * recoil.lightZ * abs(Bfield) / TMath::TwoPi() * beta / 1000.; // MeV/mm;
double alpha = slope/beta; double alpha = slope/beta;
double G = alpha * gamma * beta * perpDist ; double G = alpha * gamma * beta * perpDist ;
double Z = alpha * gamma * beta * z; double Z = alpha * gamma * beta * z;

View File

@ -13,6 +13,7 @@ false //is_coincident_with_recoil
0.00 //Elum_2_position_[mm]_when_Elum=0_disable_tree_branch 0.00 //Elum_2_position_[mm]_when_Elum=0_disable_tree_branch
#===============1st_Array #===============1st_Array
true ////is_this_array_exist_or_use_for_Simulation
11.5 //distance_from_axis_[mm] 11.5 //distance_from_axis_[mm]
10.0 //width_of_detector_[mm] 10.0 //width_of_detector_[mm]
50 //length_of_detector_[mm] 50 //length_of_detector_[mm]
@ -30,12 +31,12 @@ Out //detector_facing_Out_or_In
294.0 294.0
#===============2nd_Array #===============2nd_Array
false //is_2nd_array_exist_is_use_for_Simulation true //is_this_array_exist_or_use_for_Simulation
11.5 //distance_from_axis_[mm] 11.5 //distance_from_axis_[mm]
10.0 //width_of_detector_[mm] 10.0 //width_of_detector_[mm]
50 //length_of_detector_[mm] 50 //length_of_detector_[mm]
0 //blocker_length_[mm] 0 //blocker_length_[mm]
121 //first_position_-_for_upstream_[mm] 500 //first_position_-_for_upstream_[mm]
0.03 //energy_resolution_of_PSD_array_[MeV] 0.03 //energy_resolution_of_PSD_array_[MeV]
1.00 //position_resolution_of_PSD_array_[mm] 1.00 //position_resolution_of_PSD_array_[mm]
Out //detector_facing_Out_or_In Out //detector_facing_Out_or_In