Pluto v6.3.0
Loading...
Searching...
No Matches
PHadesAcc.C
Go to the documentation of this file.
1//TITLE <UserClass> Very small acceptance filter (setting variables for batch) including opening angle.
2
3
4class PHadesAcc : public PBulkInterface {
5
6private:
7 Double_t *hadacc, *opang;
8
9 public:
10
11 PHadesAcc();
12
13 Bool_t Modify(PParticle ** stack, int *decay_done, int *num, int stacksize); //bulk interface
14
15 ClassDef(PHadesAcc, 0)
16};
17
19 hadacc = makeStaticData()->GetBatchValue("_hadacc");
20 opang = makeStaticData()->GetBatchValue("_opang");
21};
22
23bool PHadesAcc::Modify(PParticle **stack, int *decay_done, int *num, int stacksize) {
24
25 *hadacc = 1.;
26
27 for (int i=0; i<*num; i++) {
28 PParticle *cur = stack[i];
29// cur->Print();
30
31 if (cur->Is("pi+") || cur->Is("pi-")|| cur->Is("p")
32 || cur->LeptonN()) {
33
34#if 0
35 double momentum_resolution = 0.05;
36 double angular_resolution = 0.1*TMath::Pi()/180.;
37// double angular_resolution = 0;
38
39 double mom = cur->P();
40
41 double theta = cur->Theta();
42 double phi = cur->Phi();
43
44 double mom_measured = PUtils::sampleGaus(mom, mom*momentum_resolution);
45 double theta_measured = PUtils::sampleGaus(theta, angular_resolution);
46 double phi_measured = PUtils::sampleGaus(phi, angular_resolution);
47
48 cur->SetRho(mom_measured);
49 cur->SetTheta(theta_measured);
50 cur->SetPhi(phi_measured);
51
52 cur->ResetE();
53#endif
54
55
56 if (cur->Theta() < ((18./180)*TMath::Pi())){
57 *hadacc=0.;
58 //cur->Print();
59 }
60 if (cur->Theta() > ((88./180)*TMath::Pi())){
61 *hadacc=0.;
62
63 }
64 if (cur->P() < 0.1) {
65 *hadacc=0.;
66
67 }
68 }
69 }
70
71 *opang = 1.;
72
73 //the opang:
74 for (int i=0; i<*num; i++) {
75 PParticle *ep = stack[i];
76 if (ep->Is("e+")) {
77 for (int i=0; i<*num; i++) {
78 PParticle *em = stack[i];
79 if (em->Is("e-")) {
80 Double_t oa = ep->Vect().Angle(em->Vect());
81 if (oa < ((4./180)*TMath::Pi())){
82 *opang = 0.;
83 }
84 }
85 }
86 }
87 }
88
89 return kTRUE;
90};
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PStaticData * makeStaticData()
PParticle * ep
PParticle * em
Bool_t Modify(PParticle **stack, int *decay_done, int *num, int stacksize)
Definition PHadesAcc.C:23
Int_t LeptonN() const
Definition PParticle.h:122
void ResetE()
Definition PParticle.h:107
Int_t Is(const char *id)
Definition PParticle.h:61
Double_t * GetBatchValue(const char *name, Int_t make_val=1)
static Double_t sampleGaus(Double_t c, Double_t s)
Definition PUtils.h:126