Ticket #74: MYANALYSIS.cc
File MYANALYSIS.cc, 2.7 KB (added by , 14 years ago) |
---|
Line | |
---|---|
1 | #include "Rivet/Analysis.hh" |
2 | #include "Rivet/Projections/FinalState.hh" |
3 | #include "Rivet/Projections/IdentifiedFinalState.hh" |
4 | #include "Rivet/AnalysisLoader.hh" |
5 | |
6 | namespace Rivet { |
7 | |
8 | |
9 | class MYANALYSIS : public Analysis { |
10 | public: |
11 | |
12 | MYANALYSIS() : Analysis("MYANALYSIS") {} |
13 | |
14 | void init() { |
15 | IdentifiedFinalState piplus; |
16 | piplus.acceptId(PIPLUS); |
17 | addProjection(piplus, "piplus"); |
18 | |
19 | IdentifiedFinalState piminus; |
20 | piminus.acceptId(PIMINUS); |
21 | addProjection(piminus, "piminus"); |
22 | |
23 | IdentifiedFinalState neutrinos; |
24 | neutrinos.acceptNeutrinos(); |
25 | addProjection(neutrinos, "neutrinos"); |
26 | } |
27 | |
28 | void analyze(const Event& event) { |
29 | ParticleVector piplusv = applyProjection<FinalState>(event, "piplus").particles(); |
30 | ParticleVector piminusv = applyProjection<FinalState>(event, "piminus").particles(); |
31 | ParticleVector neutrinosv = applyProjection<FinalState>(event, "neutrinos").particles(); |
32 | |
33 | if (piplusv.size()!=1) { |
34 | std::cout<<"No piplus"<<std::endl; |
35 | vetoEvent; |
36 | } |
37 | if (piminusv.size()!=1) { |
38 | std::cout<<"No piminus"<<std::endl; |
39 | vetoEvent; |
40 | } |
41 | if (neutrinosv.size()!=2) { |
42 | std::cout<<"No neutrinos"<<std::endl; |
43 | vetoEvent; |
44 | } |
45 | |
46 | FourMomentum restframe(piplusv[0].momentum()+piminusv[0].momentum()+neutrinosv[0].momentum()+neutrinosv[1].momentum()); |
47 | |
48 | LorentzTransform cms_boost(-restframe.boostVector()); |
49 | FourMomentum piplus(cms_boost.transform(piplusv[0].momentum())); |
50 | FourMomentum piminus(cms_boost.transform(piminusv[0].momentum())); |
51 | |
52 | double zplus = 2.0*piplus.E()/120.0; |
53 | double zminus = 2.0*piminus.E()/120.0; |
54 | |
55 | if (zplus>0.5 && zminus>0.5) { |
56 | _sigma1+=event.weight(); |
57 | } |
58 | else if (zplus<0.5 && zminus<0.5) { |
59 | _sigma2+=event.weight(); |
60 | } |
61 | else if (zplus>0.5 && zminus<0.5) { |
62 | _sigma3+=event.weight(); |
63 | } |
64 | else if (zplus<0.5 && zminus>0.5) { |
65 | _sigma4+=event.weight(); |
66 | } |
67 | } |
68 | |
69 | void finalize() { |
70 | // No histos, so nothing to do! |
71 | std::cout<<"_sigma1="<<_sigma1*crossSectionPerEvent()<<std::endl; |
72 | std::cout<<"_sigma2="<<_sigma2*crossSectionPerEvent()<<std::endl; |
73 | std::cout<<"_sigma3="<<_sigma3*crossSectionPerEvent()<<std::endl; |
74 | std::cout<<"_sigma4="<<_sigma4*crossSectionPerEvent()<<std::endl; |
75 | |
76 | std::cout<<"A_fastslow="<<(_sigma1+_sigma2-_sigma3-_sigma4)/(_sigma1+_sigma2+_sigma3+_sigma4)<<std::endl; |
77 | } |
78 | |
79 | private: |
80 | |
81 | double _sigma1, _sigma2, _sigma3, _sigma4; |
82 | }; |
83 | |
84 | |
85 | |
86 | // This global object acts as a hook for the plugin system |
87 | AnalysisBuilder<MYANALYSIS> plugin_MYANALYSIS; |
88 | |
89 | } |