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());
414 if (!sim_evt) sim_evt =
new KVEvent();
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);
633 while ((knuc = sim_evt->GetNextParticle())) {
639 if (IsTargMatSet()) {
640 NewInteractionPointInTargetLayer();
641 PropagateInTargetLayer();
647 if (tmin >= kb2->GetMaxAngleLab(kDiffNuc)) {
648 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
653 if (tmax <= kb2->GetMinAngleLab(kDiffNuc)) {
654 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
658 if (tmin < kb2->GetMinAngleLab(kDiffNuc)) tmin = kb2->GetMinAngleLab(kDiffNuc);
659 if (tmax > kb2->GetMaxAngleLab(kDiffNuc)) tmax = kb2->GetMaxAngleLab(kDiffNuc);
664 kposalea.SetPolarMinMax(tmin, tmax);
665 kposalea.SetAzimuthalMinMax(pmin, pmax);
668 kposalea.GetRandomAngles(th_deg, ph_deg, kRandomOpt);
670 SetAnglesForDiffusion(th_deg, ph_deg);
672 ((
TH2F*)lhisto->FindObject(
"phi_theta"))->Fill(th_deg, ph_deg);
676 if (IsDetectionOn()) {
701 if (kchoix_layer != -1) {
702 TVector3 dir = GetNucleus(
"PROJ")->GetMomentum();
703 ktarget->SetInteractionLayer(kchoix_layer, dir);
706 kIPPVector = ktarget->GetInteractionPoint(GetNucleus(
"PROJ"));
707 ((
TH1F*)lhisto->FindObject(
"target_layer_depth"))->Fill(kIPPVector.Z());
731 Double_t eLostInTarget = GetNucleus(
"PROJ")->GetKE();
732 ktarget->SetIncoming(
kTRUE);
733 ktarget->DetectParticle(GetNucleus(
"PROJ"), 0);
734 eLostInTarget -= GetNucleus(
"PROJ")->GetKE();
737 sim_evt->GetParticleWithName(
"PROJ")->GetParameters()->SetValue(
"TARGET In", eLostInTarget);
741 if (GetNucleus(
"PROJ")->GetKE() == 0) {
742 GetNucleus(
"PROJ")->Print();
743 printf(
"%lf / %lf\n", eLostInTarget, proj->GetKE());
745 kb2->GetNucleus(1)->SetKE(GetNucleus(
"PROJ")->GetKE());
746 kb2->CalculateKinematics();
748 ktarget->SetIncoming(
kFALSE);
778 ktarget->SetOutgoing(
kTRUE);
780 while ((knuc = sim_evt->GetNextParticle())) {
783 ktarget->DetectParticle(knuc, 0);
784 eLostInTarget -= knuc->
GetKE();
789 ktarget->SetOutgoing(
kFALSE);
818 nsol_kin = kb2->GetELab(kDiffNuc, theta, kDiffNuc, ediff1, ediff2);
824 if (kChoixSol == 1) ediff = ediff1;
825 else if (kChoixSol == 2) {
830 if (choix == 2) ediff = ediff2;
834 Bool_t sol2 = (ediff == ediff2);
836 kXruth_evt = kb2->GetXSecRuthLab(theta, kDiffNuc);
843 knuc = sim_evt->GetParticleWithName(
"PROJ");
845 knuc = sim_evt->GetParticleWithName(
"TARG");
854 TVector3 ptot = proj->Vect() + targ->Vect();
855 Double_t etot = proj->E() + targ->E();
857 ptot -= knuc->
Vect();
862 knuc = sim_evt->GetParticleWithName(
"TARG");
864 knuc = sim_evt->GetParticleWithName(
"PROJ");
871 sim_evt->SetNumber(kTreatedNevts);
873 sim_evt->GetParameters()->SetValue(
"XRuth", kXruth_evt);
874 sim_evt->GetParameters()->SetValue(
"ThDiff", theta);
875 sim_evt->GetParameters()->SetValue(
"EkDiff", ediff1);
876 sim_evt->GetParameters()->SetValue(
"IPz", kIPPVector.Z());
879 sim_evt->GetParameters()->SetValue(
"Sol2", 1);
883 GetNucleus(
"PROJ")->SetMomentum(*GetNucleus(
"PROJ")->GetPInitial());
948 if (rec_evt->GetMult() > 0) {
949 TTree*
tt = (
TTree*)ltree->FindObject(
"ElasticScatter");
1039 printf(
"#####################\n");
1040 printf(
"## KVElasticScatterEvent::Print() ##\n");
1041 printf(
"# Diffusion elastique traitee :\n");
1042 printf(
"# %s+%s@%1.2lf MeV/A\n",
1043 GetNucleus(1)->GetSymbol(),
1044 GetNucleus(2)->GetSymbol(),
1045 GetNucleus(1)->GetKE() / GetNucleus(1)->GetA()
1047 if (IsTargMatSet()) {
1048 printf(
"-------------------------\n");
1049 printf(
"# Propagation dans une cible de:\n");
1050 for (
Int_t nn = 0; nn < GetTarget()->GetLayers()->GetEntries(); nn += 1) {
1052 printf(
"#\ttype:%s epaisseur:%lf (mg/cm**2) / %lf\n",
1053 GetTarget()->GetLayerByIndex(nn + 1)->
GetType(),
1055 GetTarget()->GetLayerByIndex(nn + 1)->GetThickness()
1059 printf(
"-------------------------\n");
1060 if (IsDetectionOn()) {
1063 printf(
"#####################\n");
1082 Info(
"DefineHistos",
"DefineHistos");
1084 lhisto->SetOwner(
kTRUE);
1088 lhisto->
Add(
new TH2F(
"phi_theta",
"phi_theta", 180, 0, 180, 360, 0, 360));
1089 h2 = (
TH2F*)lhisto->Last();
1092 lhisto->Add(
new TH1F(
"costheta",
"costheta", 200, -1, 1));
1093 h1 = (
TH1F*)lhisto->Last();
1095 if (IsTargMatSet()) {
1096 Info(
"DefineHistos",
"Creation de l histo interaction dans la cible");
1097 Float_t thickness = GetTarget()->GetThickness();
1098 lhisto->Add(
new TH1F(
"target_layer_depth",
"target_layer_depth",
TMath::Nint(thickness * 110), 0, thickness * 1.1));
1099 h1 = (
TH1F*)lhisto->Last();
1102 Float_t totalE = GetNucleus(1)->GetKE();
1103 lhisto->Add(
new TH2F(
"ek_theta",
"ek_theta", 180, 0, 180,
TMath::Nint(totalE * 11), 0, totalE * 1.1));
1104 h2 = (
TH2F*)lhisto->Last();
1130 lhisto->Execute(
"Reset",
"");
1141 if (lhisto)
delete lhisto;
1171 Info(
"DefineTrees",
"DefineTrees");
1173 ltree->SetOwner(
kTRUE);
1176 tt =
new TTree(
"ElasticScatter", IsA()->GetName());
1201 if (ltree)
delete ltree;
1216 ltree->Execute(
"Reset",
"");
1217 if (((
TTree*)ltree->FindObject(
"ElasticScatter"))->GetListOfAliases())
1218 ((
TTree*)ltree->FindObject(
"ElasticScatter"))->GetListOfAliases()->Clear();
1236 if (tmin != -1) th_min = tmin;
1237 if (tmax != -1) th_max = tmax;
1238 if (pmin != -1) phi_min = pmin;
1239 if (pmax != -1) phi_max = pmax;
1264 Double_t tmin = -1, tmax = -1, pmin = -1, pmax = -1;
1280 Warning(
"DefineAngularRange(KVASMultiDetArray*)",
"Needs reimplementing");
1299 printf(
"les objects de type %s ne sont pas implemente dans KVElasticScatterEvent::DefineAngularRange\n", obj->IsA()->
GetName());
1303 DefineAngularRange(tmin, tmax, pmin, pmax);
1317 if (opt ==
"min")
return th_min;
1318 else if (opt ==
"max")
return th_max;
1334 if (opt ==
"min")
return phi_min;
1335 else if (opt ==
"max")
return phi_max;
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
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, interface to energy-loss calculations.
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()
Base class container for multi-particle events.
static void MakeEventBranch(TTree *tree, const TString &branchname, const TString &classname, T &event, Int_t bufsize=10000000)
Extended version of ROOT THashList.
Description of physical materials used to construct detectors; interface to range tables.
Double_t GetZ() const
Returns atomic number of material.
Double_t GetMass() const
Returns atomic mass of material. Will be isotopic mass if set.
virtual void DetectEvent(KVEvent *event, KVReconstructedEvent *rec_event, const Char_t *detection_frame="")
void SetFilterType(Int_t t)
void SetTarget(const Char_t *material, const Float_t thickness)
virtual void SetSimMode(Bool_t on=kTRUE)
void SetValue(const Char_t *name, value_type value)
virtual void Clear(Option_t *opt="")
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)
TVector3 * GetPInitial() const
void SetPhi(Double_t phi)
KVNameValueList * GetParameters() const
Double_t GetTheta() const
void SetMomentum(const TVector3 &v)
void SetKE(Double_t ecin)
void Set4Mom(const TLorentzVector &p)
void SetE0(TVector3 *e=0)
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
Physical event reconstructed from data measured with a detector array using implemented identificatio...
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()