47 new TH3F (
"gen",
"Generated events", 30, 0, 1500, 20, -1, 1, 20, 0, 360);
49 new TH3F (
"eff_elec",
"Efficiency matrix electrons", 30, 0, 1500, 20, -1, 1, 20, 0, 360);
51 new TH3F (
"eff_protons",
"Efficiency matrix protons", 30, 0, 1500, 20, -1, 1, 20, 0, 360);
55 for (
int i=0; i<
nev; i++) {
60 gen->Fill(mom, costheta, phi);
62 Double_t theta = acos(costheta)*180/TMath::Pi();
65 if ((theta > 18) && (theta < 95)) {
67 if ((mom > 100) && (rnd < 0.8))
69 else if ((mom > 50) && (rnd < 0.5))
74 Double_t x = tan(acos(costheta)) * 2 * cos(phi*TMath::Pi()/180);
75 Double_t y = tan(acos(costheta)) * 2 * sin(phi*TMath::Pi()/180);
77 if ((fabs(x) < 1.5) && (fabs(y) < 1.5)) {
89 TFile *
f =
new TFile(
"pluto_demo_filter.root",
"RECREATE");
95 p->AddCommand(
"echo ********************************************************************************");
96 p->AddCommand(
"echo Usage: This filter works in 2 modi:");
97 p->AddCommand(
"echo Usage: 1.) inclusive:");
98 p->AddCommand(
"echo Usage: default");
99 p->AddCommand(
"echo Usage: 2.) exclusive measurement:");
100 p->AddCommand(
"echo Usage: Add in your macro after filter attachment:");
101 p->AddCommand(
"echo Usage: makeDistributionManager()->Startup(\"_filter_exclusive=1\");");
102 p->AddCommand(
"echo ********************************************************************************");
103 p->AddCommand(
"echo Usage: Momentum smearing is applied, you can change:");
104 p->AddCommand(
"echo Usage: makeDistributionManager()->Startup(\"_filter_smear_factor=....\");");
105 p->AddCommand(
"echo ********************************************************************************");
106 p->AddCommand(
"echo Debug mode: makeDistributionManager()->Startup(\"_filter_debug=1\");");
107 p->AddCommand(
"echo ********************************************************************************");
109 p->AddCommand(
"_filter_debug=0");
110 p->AddCommand(
"_filter_exclusive=0");
111 p->AddCommand(
"_filter_smear_factor=1.");
119 "echo ********************************************************************************");
121 s->AddCommand(
"echo This event loop uses the demo filter ");
122 s->AddCommand(
"echo ********************************************************************************");
131 l->AddCommand(
"if (_filter_debug); echo **** New event called");
132 l->AddCommand(
"_start: removed=0");
133 l->AddCommand(
"_x = [e+]->P() * 1000.; ");
134 l->AddCommand(
"_y = [e+]->CosTheta(); ");
135 l->AddCommand(
"_z = (([e+]->Phi()) *180/TMath::Pi()); if (_z<0); _z = _z + 360");
136 l->AddCommand(
eff_elec,
"eff_ep = Eval(); rnd = sampleFlat(); if (rnd>eff_ep); [e+]->SetInActive(); removed=1");
137 l->AddCommand(
"mom = [e+]->P(); newmom = sampleGaus(mom,0.01*mom*_filter_smear_factor);[e+]->SetMom(newmom)");
138 l->AddCommand(
"if (_filter_debug && removed); echo e+: $_x, $_y, $_z eff: $eff_ep <removed>");
139 l->AddCommand(
"if (_filter_debug && !removed); echo e+: $_x, $_y, $_z eff: $eff_ep");
141 l->AddCommand(
"formore e+; goto _start");
143 l->AddCommand(
"_start2: removed=0");
144 l->AddCommand(
"_x = [e-]->P() * 1000.;");
145 l->AddCommand(
"_y = [e-]->CosTheta(); ");
146 l->AddCommand(
"_z = (([e-]->Phi()) *180/TMath::Pi()); if (_z<0); _z = _z + 360;");
147 l->AddCommand(
eff_elec,
"eff_em = Eval(); rnd = sampleFlat(); if (rnd>eff_em); [e-]->SetInActive(); removed=1");
148 l->AddCommand(
"mom = [e-]->P(); newmom = sampleGaus(mom,0.01*mom*_filter_smear_factor);[e-]->SetMom(newmom)");
149 l->AddCommand(
"if (_filter_debug && removed); echo e-: $_x, $_y, $_z eff: $eff_em <removed>");
150 l->AddCommand(
"if (_filter_debug && !removed); echo e-: $_x, $_y, $_z eff: $eff_em");
152 l->AddCommand(
"formore e-; goto _start2");
154 l->AddCommand(
"if (!_filter_exclusive); goto _end;");
156 l->AddCommand(
"_start_proton_loop: removed=0");
158 l->AddCommand(
"_x = [p]->P() * 1000.; ");
159 l->AddCommand(
"_y = [p]->CosTheta(); ");
160 l->AddCommand(
"_z = (([p]->Phi()) *180/TMath::Pi()); if (_z<0); _z = _z + 360;");
162 l->AddCommand(
eff_protons,
"eff_p = Eval(); rnd = sampleFlat(); if (rnd>eff_p); [p]->SetInActive(); removed=1");
163 l->AddCommand(
"mom = [p]->P(); newmom = sampleGaus(mom,0.01*mom*_filter_smear_factor);[p]->SetMom(newmom)");
166 l->AddCommand(
"if (_filter_debug && removed); echo p: $_x, $_y, $_z eff: $eff_p <removed>");
167 l->AddCommand(
"if (_filter_debug && !removed); echo p: $_x, $_y, $_z eff: $eff_p");
169 l->AddCommand(
"formore p; goto _start_proton_loop");
171 l->AddCommand(
"_end:");
static Double_t sampleFlat()