51 if (sim_evt)
delete sim_evt;
52 if (rec_evt)
delete rec_evt;
75 kIPPVector.SetXYZ(0, 0, 0);
100 ResetBit(kIsUpdated);
101 ResetBit(kIsDetectionOn);
103 SetDiffNucleus(
"PROJ");
104 SetRandomOption(
"isotropic");
143 Error(
"SetSystem",
"KVDBSystem pointer is not valid");
177 targ->SetName(
"TARG");
179 ResetBit(kIsUpdated);
196 if (name ==
"TARG") {
201 if (name !=
"PROJ") {
202 Warning(
"SetDiffNucleus",
"%s Le nom en argument doit etre PROJ ou TARG, par defaut on choisit le projectile", name.
Data());
232 return strcmp(kRandomOpt,
"random");
254 if (choix >= 0 && choix <= 2)
269 proj->SetName(
"PROJ");
271 ResetBit(kIsUpdated);
285 if (sname ==
"PROJ")
return proj;
286 else if (sname ==
"TARG")
return targ;
299 if (ii == 1)
return proj;
300 else if (ii == 2)
return targ;
316 if (ktarget)
delete ktarget;
319 ktarget->SetRandomized(IsRandomized);
321 ResetBit(kIsUpdated);
334 SetBit(kIsDetectionOn, On);
335 ResetBit(kIsUpdated);
340 Warning(
"MakeDetection",
"Detection asked but no multiDetArray defined");
390 Info(
"GenereKV2Body",
"On genere le KV2Body");
392 kb2 =
new KV2Body(*proj, *targ);
393 kb2->CalculateKinematics();
400 GetNucleus(
"PROJ")->Copy(*sim_evt->AddParticle());
401 GetNucleus(
"TARG")->Copy(*sim_evt->AddParticle());
415 else sim_evt->Clear();
418 else rec_evt->Clear();
439 if (GetTarget()->GetLayers()->GetEntries() == 0)
return kFALSE;
441 if (layer_name ==
"") {
443 mat = GetTarget()->GetLayerByIndex(kchoix_layer);
446 if (!(mat = GetTarget()->GetLayer(layer_name))) {
447 printf(
"le nom du layer %s ne correspond a aucun present dans le cible\n", layer_name.
Data());
448 printf(
"Attention le layer doit etre appele par son symbol (ie Calcium -> Ca)");
449 ktarget->GetLayers()->Print();
452 kchoix_layer = GetTarget()->GetLayerIndex(layer_name);
519 if (!IsProjNucSet()) {
520 Error(
"ValidateEntrance",
"Il n'y a pas de noyau projectile -> use SetProjNucleus()");
524 if (!IsTargNucSet()) {
525 Info(
"ValidateEntrance",
"Il n'y a pas de noyau cible");
526 if (!IsTargMatSet()) {
527 Error(
"ValidateEntrance",
"Il n'y a pas de noyau cible -> use SetTargNucleus() ou SetTargetMaterial");
531 if (DefineTargetNucleusFromLayer())
532 Info(
"ValidateEntrance",
"Definition du noyau cible via DefineTargetNucleusFromLayer()");
536 if (IsDetectionOn()) {
552 Warning(
"ValidateEntrance",
"Pas de calcul de perte dans la cible ... ");
557 Info(
"ValidateEntrance",
"The elastic scatter events will not be detected/filtered");
561 Info(
"ValidateEntrance",
"Fin de GenereKV2Body");
565 if (!ltree) DefineTrees();
587 Info(
"Process",
"Je Suis dans Process ... Youpee");
590 if (!ValidateEntrance())
return;
594 while (nn < ntimes) {
597 if ((nn % 1000) == 0) {
598 Info(
"Process",
"%d/%d diffusions treated", nn, ntimes);
601 Info(
"Process",
"End of process : %d diffusions performed", kTreatedNevts);
631 sim_evt->GetParameters()->Clear();
633 knuc.GetParameters()->Clear();
634 knuc.RemoveAllGroups();
638 if (IsTargMatSet()) {
639 NewInteractionPointInTargetLayer();
640 PropagateInTargetLayer();
646 if (tmin >= kb2->GetMaxAngleLab(kDiffNuc)) {
647 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
652 if (tmax <= kb2->GetMinAngleLab(kDiffNuc)) {
653 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
657 if (tmin < kb2->GetMinAngleLab(kDiffNuc)) tmin = kb2->GetMinAngleLab(kDiffNuc);
658 if (tmax > kb2->GetMaxAngleLab(kDiffNuc)) tmax = kb2->GetMaxAngleLab(kDiffNuc);
663 kposalea.SetPolarMinMax(tmin, tmax);
664 kposalea.SetAzimuthalMinMax(pmin, pmax);
667 kposalea.GetRandomAngles(th_deg, ph_deg, kRandomOpt);
669 SetAnglesForDiffusion(th_deg, ph_deg);
671 ((
TH2F*)lhisto->FindObject(
"phi_theta"))->Fill(th_deg, ph_deg);
675 if (IsDetectionOn()) {
700 if (kchoix_layer != -1) {
701 TVector3 dir = GetNucleus(
"PROJ")->GetMomentum();
702 ktarget->SetInteractionLayer(kchoix_layer, dir);
705 kIPPVector = ktarget->GetInteractionPoint(GetNucleus(
"PROJ"));
706 ((
TH1F*)lhisto->FindObject(
"target_layer_depth"))->Fill(kIPPVector.Z());
730 Double_t eLostInTarget = GetNucleus(
"PROJ")->GetKE();
731 ktarget->SetIncoming(
kTRUE);
732 ktarget->DetectParticle(GetNucleus(
"PROJ"), 0);
733 eLostInTarget -= GetNucleus(
"PROJ")->GetKE();
736 sim_evt->GetParticleWithName(
"PROJ")->GetParameters()->SetValue(
"TARGET In", eLostInTarget);
740 if (GetNucleus(
"PROJ")->GetKE() == 0) {
741 GetNucleus(
"PROJ")->Print();
742 printf(
"%lf / %lf\n", eLostInTarget, proj->GetKE());
744 kb2->GetNucleus(1)->SetKE(GetNucleus(
"PROJ")->GetKE());
745 kb2->CalculateKinematics();
747 ktarget->SetIncoming(
kFALSE);
777 ktarget->SetOutgoing(
kTRUE);
780 Double_t eLostInTarget = knuc.GetKE();
781 ktarget->DetectParticle(&knuc, 0);
782 eLostInTarget -= knuc.GetKE();
783 knuc.GetParameters()->SetValue(
"TARGET Out", eLostInTarget);
784 knuc.SetMomentum(*knuc.GetPInitial());
787 ktarget->SetOutgoing(
kFALSE);
816 nsol_kin = kb2->GetELab(kDiffNuc, theta, kDiffNuc, ediff1, ediff2);
822 if (kChoixSol == 1) ediff = ediff1;
823 else if (kChoixSol == 2) {
828 if (choix == 2) ediff = ediff2;
832 Bool_t sol2 = (ediff == ediff2);
834 kXruth_evt = kb2->GetXSecRuthLab(theta, kDiffNuc);
841 knuc = sim_evt->GetParticleWithName(
"PROJ");
843 knuc = sim_evt->GetParticleWithName(
"TARG");
852 TVector3 ptot = proj->Vect() + targ->Vect();
853 Double_t etot = proj->E() + targ->E();
855 ptot -= knuc->
Vect();
860 knuc = sim_evt->GetParticleWithName(
"TARG");
862 knuc = sim_evt->GetParticleWithName(
"PROJ");
869 sim_evt->SetNumber(kTreatedNevts);
871 sim_evt->GetParameters()->SetValue(
"XRuth", kXruth_evt);
872 sim_evt->GetParameters()->SetValue(
"ThDiff", theta);
873 sim_evt->GetParameters()->SetValue(
"EkDiff", ediff1);
874 sim_evt->GetParameters()->SetValue(
"IPz", kIPPVector.Z());
877 sim_evt->GetParameters()->SetValue(
"Sol2", 1);
881 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
946 if (rec_evt->GetMult() > 0) {
947 TTree*
tt = (
TTree*)ltree->FindObject(
"ElasticScatter");
1037 printf(
"#####################\n");
1038 printf(
"## KVElasticScatterEvent::Print() ##\n");
1039 printf(
"# Diffusion elastique traitee :\n");
1040 printf(
"# %s+%s@%1.2lf MeV/A\n",
1041 GetNucleus(1)->GetSymbol(),
1042 GetNucleus(2)->GetSymbol(),
1043 GetNucleus(1)->GetKE() / GetNucleus(1)->GetA()
1045 if (IsTargMatSet()) {
1046 printf(
"-------------------------\n");
1047 printf(
"# Propagation dans une cible de:\n");
1048 for (
Int_t nn = 0; nn < GetTarget()->GetLayers()->GetEntries(); nn += 1) {
1050 printf(
"#\ttype:%s epaisseur:%lf (mg/cm**2) / %lf\n",
1051 GetTarget()->GetLayerByIndex(nn + 1)->
GetType(),
1053 GetTarget()->GetLayerByIndex(nn + 1)->GetThickness()
1057 printf(
"-------------------------\n");
1058 if (IsDetectionOn()) {
1061 printf(
"#####################\n");
1080 Info(
"DefineHistos",
"DefineHistos");
1082 lhisto->SetOwner(
kTRUE);
1086 lhisto->
Add(
new TH2F(
"phi_theta",
"phi_theta", 180, 0, 180, 360, 0, 360));
1087 h2 = (
TH2F*)lhisto->Last();
1090 lhisto->Add(
new TH1F(
"costheta",
"costheta", 200, -1, 1));
1091 h1 = (
TH1F*)lhisto->Last();
1093 if (IsTargMatSet()) {
1094 Info(
"DefineHistos",
"Creation de l histo interaction dans la cible");
1095 Float_t thickness = GetTarget()->GetThickness();
1096 lhisto->Add(
new TH1F(
"target_layer_depth",
"target_layer_depth",
TMath::Nint(thickness * 110), 0, thickness * 1.1));
1097 h1 = (
TH1F*)lhisto->Last();
1100 Float_t totalE = GetNucleus(1)->GetKE();
1101 lhisto->Add(
new TH2F(
"ek_theta",
"ek_theta", 180, 0, 180,
TMath::Nint(totalE * 11), 0, totalE * 1.1));
1102 h2 = (
TH2F*)lhisto->Last();
1128 lhisto->Execute(
"Reset",
"");
1139 if (lhisto)
delete lhisto;
1169 Info(
"DefineTrees",
"DefineTrees");
1171 ltree->SetOwner(
kTRUE);
1174 tt =
new TTree(
"ElasticScatter", IsA()->GetName());
1199 if (ltree)
delete ltree;
1214 ltree->Execute(
"Reset",
"");
1215 if (((
TTree*)ltree->FindObject(
"ElasticScatter"))->GetListOfAliases())
1216 ((
TTree*)ltree->FindObject(
"ElasticScatter"))->GetListOfAliases()->Clear();
1234 if (tmin != -1) th_min = tmin;
1235 if (tmax != -1) th_max = tmax;
1236 if (pmin != -1) phi_min = pmin;
1237 if (pmax != -1) phi_max = pmax;
1262 Double_t tmin = -1, tmax = -1, pmin = -1, pmax = -1;
1278 Warning(
"DefineAngularRange(KVASMultiDetArray*)",
"Needs reimplementing");
1297 printf(
"les objects de type %s ne sont pas implemente dans KVElasticScatterEvent::DefineAngularRange\n", obj->IsA()->
GetName());
1301 DefineAngularRange(tmin, tmax, pmin, pmax);
1315 if (opt ==
"min")
return th_min;
1316 else if (opt ==
"max")
return th_max;
1332 if (opt ==
"min")
return phi_min;
1333 else if (opt ==
"max")
return phi_max;
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
KVSimEvent::EventIterator SimEventIterator
double pow(double, double)
R__EXTERN TRandom * gRandom
Relativistic binary kinematics calculator.
KVNucleus * GetNucleus(Int_t i) const
Database class used to store information on different colliding systems studied during an experiment.
KVTarget * GetTarget() const
KV2Body * GetKinematics()
Base class for detector geometry description.
simulate ElasticScatterEvent and answer of a given (multi-)detector : A + B -> A + B
virtual void SetProjNucleus(KVNucleus *nuc)
Define new projectile nucleus.
virtual void SetSystem(KVDBSystem *sys)
virtual TVector3 & GetInteractionPointInTargetLayer()
return the last interaction point in the target
void Print(Option_t *="") const
virtual void ClearTrees()
Efface la liste des arbres et leur contenu et met le pointeur a zero.
virtual void DefineAngularRange(TObject *)
void SetDiffNucleus(KVString name="PROJ")
virtual void SetTargNucleus(KVNucleus *nuc)
Define new target nucleus.
virtual void DefineHistos()
Bool_t IsIsotropic() const
retoune kTRUE si l'option choisi est isotrope
virtual void SetAnglesForDiffusion(Double_t theta, Double_t phi)
void SetRandomOption(Option_t *opt="isotropic")
KVHashList * GetTrees() const
return the list where histo are stored
virtual void TreateEvent()
KVTarget * GetTarget() const
return the current target material
virtual void Process(Int_t ntimes=1, Bool_t reset=kTRUE)
void PropagateInTargetLayer()
virtual void ClearHistos()
Efface la liste des histo et leur contenu et met le pointeur a zero.
virtual void ResetHistos()
Reset histo in the list.
virtual void SetTargetMaterial(KVTarget *targ, Bool_t IsRandomized=kTRUE)
void NewInteractionPointInTargetLayer()
void SetDetectionOn(Bool_t On=kTRUE)
KVHashList * GetHistos() const
return the list where histo are stored
virtual ~KVElasticScatterEvent()
Destructor.
virtual void Reset()
Set contents/entries to zero for predifined histograms, trees.
virtual Bool_t ValidateEntrance()
virtual void DefineTrees()
virtual void MakeDiffusion()
KVNucleus * GetNucleus(const Char_t *name) const
return the current projectile ("PROJ") or the target ("TARG") nucleus
void ChooseKinSol(Int_t choix=1)
Bool_t DefineTargetNucleusFromLayer(KVString layer_name="")
Double_t GetPhi(KVString opt) const
Double_t GetTheta(KVString opt) const
virtual void ResetTrees()
static void MakeEventBranch(TTree *tree, const TString &branchname, T &event, Int_t bufsize=10000000)
Extended version of ROOT THashList.
Description of physical materials used to construct detectors & targets; interface to range tables.
virtual void DetectEvent(KVEvent *event, KVReconstructedEvent *rec_event, const Char_t *detection_frame="")
void SetFilterType(Int_t t)
virtual void SetSimMode(Bool_t on=kTRUE)
virtual void SetTarget(KVTarget *target)
Description of properties and kinematics of atomic nuclei.
virtual void Copy(TObject &) const
Copy this KVNucleus into the KVNucleus object referenced by "obj".
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
void SetZAandE(Int_t z, Int_t a, Double_t ekin)
Set atomic number, mass number, and kinetic energy in MeV.
void SetTheta(Double_t theta)
void SetPhi(Double_t phi)
Double_t GetTheta() const
void SetKE(Double_t ecin)
void Set4Mom(const TLorentzVector &p)
Base class used for handling geometry in a multidetector array.
Double_t GetPhiMax() const
Double_t GetPhiMin() const
Double_t GetThetaMin() const
Double_t GetThetaMax() const
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Container class for simulated nuclei, KVSimNucleus.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Calculation/correction of energy losses of particles through an experimental target.
Associates two detectors placed one behind the other.
virtual Bool_t Add(const TH1 *h, const TH1 *h2, Double_t c1=1, Double_t c2=1)
virtual void SetXTitle(const char *title)
virtual void SetYTitle(const char *title)
virtual const char * GetName() const
virtual const char * GetName() const
virtual Bool_t InheritsFrom(const char *classname) const
virtual Double_t Uniform(Double_t x1, Double_t x2)
const char * Data() const
RVec< T > Filter(const RVec< T > &v, F &&f)
Type GetType(const std::string &Name)
constexpr Double_t DegToRad()