Pluto v6.3.0
Loading...
Searching...
No Matches
PChannel.h
Go to the documentation of this file.
1// Author: M.A. Kagarlis
2// Written: 21.01.99
3// Revised: 05.12.05 by R. Holzmann
4// Revised: 29.08.06 by R. Holzmann
5// PChannel Class Header
6
7#ifndef _PCHANNEL_H_
8#define _PCHANNEL_H_
9
10#include "TArrayI.h"
11#include "TF1.h"
12#include "TF2.h"
13//#include "PSaid.h"
14#include "PParticle.h"
15#include "PDistribution.h"
16#include "PStdData.h"
17#include "PBulkInterface.h"
18#include "PProjector.h"
19//#include "PPlutoBulkDecay.h"
20
21#define MAX_DISTRIBUTIONS 10
22#define MAX_NUM_NOT_FINALIZED 5
23#define MAX_BULKDECAY 5
24
25#define STATUS_OK 0
26#define STATUS_EMPTY_EVENT 80
27#define STATUS_PSEUDO_EMPTY_EVENT 81
28#define STATUS_REDO_CHAIN 82
29#define STATUS_NOT_DECAYED 99
30
31
32
33class PChannel : public TObject {
34
35 public:
36
37 PChannel(PParticle **, int nt=2, int mf=0, int af=0, int bf=0);
38 // Channel constructor by particle array
39
40 PChannel(int idx, PParticle **particles=NULL, int mf=0, int af=0, int bf=0);
41 // Channel constructor by decay-mode index
42
43 PChannel(int idx, PParticle &parent, int mf=0, int af=0, int bf=0);
44 // Channel constructor by decay-mode index and parent reference
45
47 // Channel destructor
48 if (ipid.GetArray())
49 ipid.~TArrayI();
50 // necessary, because of constr 2+3, for constr 1 also better
51 if (ptcls && ptcls_extern>=0) {
52 for(int i=ptcls_extern; i<=n; i++)
53 if (ptcls[i]) delete ptcls[i];
54 if (ptcls) delete [] ptcls;
55 }
56 }
57
58 Bool_t Init();
59 // sets on the first call all parent, siblings etc IDs. This
60 // has to be done only once per PReaction
61
62 Bool_t Reset();
63 // cleans the channel, so an init will be done in the next decay()
64
65 Bool_t SetDaughters();
66
67 void SetSourceId(Int_t mysourceid) {
68 sourceid = mysourceid;
69 }
70
71 int Decay();
72 // N-body phase-space decay function based on the CERNLIB routine
73 // GENBOD. Resonance and dilepton masses (for Dalitz decays)
74 // are sampled in PData. Scattering angles are sampled here, for
75 // selected channels (see idChannel).
76
77 int decay() {
78 //kept for comp.
79 return Decay();
80 };
81
83 // address of array of pointers to the channel particles
84 return ptcls;
85 }
86
87 int *GetPids() {
88 // address of array of channel-particle ids
89 return ipid.GetArray();
90 }
91
92 int GetNumPar() {
93 // number of decay products
94 return n;
95 }
96
97 //******for distribution handling:
99 // return -1 if distribution does not match the channel
100 int CheckSiblings(PParticle *p, PDistribution *dist, int flag); //check for siblings
101
102 double GetBT() {
103 PParticle *beam = ptcls[0]->GetScattering(0);
104 PParticle *target = ptcls[0]->GetScattering(1);
105
106 if (beam) {
107 return (beam->KE() > target->KE()? beam->KE(): target->KE());
108 }
109 else return ptcls[0]->Rapidity();
110 }
111
112 //******for quasi-elastic handling:
114 return quasi_pchannel;
115 };
116 void ClearQuasi(void) {
117 quasi_pchannel = NULL;
118 };
119
121 // 1 or 2 for elementary or quasi particles respectively
122 return 1 + (ipid[0]>=1000);
123 }
124
125 static void SetGlobalWeight(double w) {
126 globalWeight = w;
127 }
128 static double GetGlobalWeight() {
129 return globalWeight;
130 }
131
133 //returns the decay mode index of this channel
134 return DMIndex;
135 }
136
138 // status message
139
140 void Print(const Option_t *delme="") const;
141 void PrintReaction(Int_t check_key = 1) const;
142 void PrintNew();
143
144 void PrintReport() const; //Print a final report after sampling
145 void CheckDecayKey() const;
146
147 char const *GetName(void) const ;
148
149// double ds_dt(double);
150 // ...> moved to PParticle (IF)
151 // ds/dt(cos_th_cm) in the cm for N+N->N+Delta. With the mass of Delta
152 // sampled independently in PData, the simulated events are distributed
153 // as ds/dOmega (normalized). Ref: NPA459 (1986) 503
154
155 void SetPrintTentative(bool t){
156 // Print the tentative messages on the 1st call
157 print_tentative = t;
158 };
159
161 cout << "DisableHelicityAngle() is obsolete -> use DistributionManager" << endl;
162 };
163
164 //this is for envelope distributions:
166 return num_not_finalized;
167 };
169 return distribution_not_finalized[i];
170 };
171
172 Bool_t AddBulk(PBulkInterface *mybulk);
173 Bool_t AddPrologueBulk(PBulkInterface *mybulk); //Bulk IO before any decay
174
175 Bool_t Do(const char *command) {
176 return GetCurrentProjector()->AddCommand(command);
177 }
178 Bool_t Do(TH1F *f, const char *command, Int_t flag=1) {
179 return GetCurrentProjector()->AddHistogram(f,command,flag);
180 }
181 Bool_t Do(TH2F *f, const char *command, Int_t flag=1) {
182 return GetCurrentProjector()->AddHistogram(f,command,flag);
183 }
184 Bool_t Do(TH3F *f, const char *command, Int_t flag=1) {
185 return GetCurrentProjector()->AddHistogram(f,command,flag);
186 }
187
188 private:
189
190 int n, status, DMIndex;
191 // number of products, error status
192 // decay-mode index matching PData modes
193
194 int thSrc, tcSrc, dlSrc, sourceid;
195
196 Double_t weight_sum; //Sum of all weights for debugging
197
198 int decay_key;
199 TString decay_string;
200 TString decay_string2;
201
202 // For generic distributions
204 Double_t dist_weight[MAX_DISTRIBUTIONS];
205 Double_t dist_weight_sum[MAX_DISTRIBUTIONS];
206 Double_t dist_counter[MAX_DISTRIBUTIONS];
207
208 Int_t distribution_position;
209 bool init_done, thermal_disable_didx;
210 bool print_tentative;
211 Long_t fEnablePattern;
212
213 int bid,tid;
214 PParticle *spectator, *participant, *quasi_composite;
215 PChannel *quasi_pchannel;
216 // general quasifree particle production on the deuteron (V. Hejny 13/10/00)
217
218 TArrayI ipid;
219 // particle id array
220
221 static double globalWeight;
222 // global weight for the event (see PDecayManager, BUGBUG: never used)
223
224 double *event_impact_param , *event_plane; //from batch system
225 double *weight_version; //from batch system
226 double *events; //from batch system
227
228 PParticle ** ptcls, *parent, *orig_parent, *grandparent, *grandgrandparent;
229 // array of channel particles
230
231 int ptcls_extern;
232 // flag whether ptcls are coming from external source (do not delete those!)
233
234 double ecm, w, emin; // invariant mass, weight of decay, energy threshold
235 double e_cm; // used to save parameters between calls of ds_dt()
236
237
238 void IsReaction();
239 // if a reaction channel identify beam, target, and decay mode
240
241 void IdChannel();
242 // identify reaction channel of known angular distribution
243 // these are: p+p->p+p (elastic), N+N->N+Delta, pi+N->N+w, pi+ + P -> pi+ + P + w
244
245 void ThermalSampling();
246 // parent is midrapidity thermal source
247
248 Int_t ReadFileInput();
249 // parent is file input interface
250
251 void MakeDilepton();
252 // parent is a sampled dilepton
253
254
255 int Genbod(int);
256 // N-body phase-space decay of a particle in its rest frame.
257 // This follows the CERNLIB routine GENBOD, in C++
258
259 //this is for envelope distributions:
260 int num_not_finalized;
261 PDistribution *distribution_not_finalized[MAX_NUM_NOT_FINALIZED];
262
263 int bulkdecay_pos, pro_bulkdecay_pos;
264
266 PBulkInterface *pro_bulk[MAX_BULKDECAY];
267 PProjector *current_projector;
268
269 PProjector *GetCurrentProjector(void) {
270 if (!bulkdecay_pos) {
271 current_projector = new PProjector();
272 AddBulk(current_projector);
273 } else {
274 if ((strcmp("PProjector",bulk[bulkdecay_pos-1] -> GetName())==0)) {
275 if ((bulk[bulkdecay_pos-1] -> GetPriority() > FILTER_PRIORITY) ||
276 ((PProjector *)bulk[bulkdecay_pos-1])->IsFileOpen()) {
277 current_projector = (PProjector *)bulk[bulkdecay_pos-1];
278 } else {
279 current_projector = new PProjector();
280 AddBulk(current_projector);
281 }
282 } else {
283 current_projector = new PProjector();
284 AddBulk(current_projector);
285 }
286 }
287 return current_projector;
288 }
289
290 ClassDef(PChannel,0) //Pluto Channel Class
291
292};
293
294#endif // _PCHANNEL_H_
PParticle ** ptcls
Definition NiNi_2AGeV.C:96
#define FILTER_PRIORITY
#define MAX_BULKDECAY
Definition PChannel.h:23
#define MAX_DISTRIBUTIONS
Definition PChannel.h:21
#define MAX_NUM_NOT_FINALIZED
Definition PChannel.h:22
TFile * f
Definition analyze_g12C.C:8
PParticle ** GetParticles()
Definition PChannel.h:82
void ClearQuasi(void)
Definition PChannel.h:116
Bool_t AddBulk(PBulkInterface *mybulk)
static double GetGlobalWeight()
Definition PChannel.h:128
int * GetPids()
Definition PChannel.h:87
int Decay()
void PrintReport() const
double GetBT()
Definition PChannel.h:102
void SetSourceId(Int_t mysourceid)
Definition PChannel.h:67
int GetNumPar()
Definition PChannel.h:92
Bool_t Do(TH3F *f, const char *command, Int_t flag=1)
Definition PChannel.h:184
int GetParentSize()
Definition PChannel.h:120
void SetPrintTentative(bool t)
Definition PChannel.h:155
Bool_t Do(TH1F *f, const char *command, Int_t flag=1)
Definition PChannel.h:178
void PrintReaction(Int_t check_key=1) const
PDistribution * GetDistributionNotFinalized(int i)
Definition PChannel.h:168
PChannel(int idx, PParticle &parent, int mf=0, int af=0, int bf=0)
int GetDMIndex()
Definition PChannel.h:132
void GetMessage()
Bool_t AddPrologueBulk(PBulkInterface *mybulk)
Bool_t Init()
char const * GetName(void) const
PChannel * GetQuasi(void)
Definition PChannel.h:113
Bool_t SetDaughters()
~PChannel()
Definition PChannel.h:46
Bool_t Do(TH2F *f, const char *command, Int_t flag=1)
Definition PChannel.h:181
int decay()
Definition PChannel.h:77
int SetDistribution(PDistribution *distribution)
void Print(const Option_t *delme="") const
PChannel(int idx, PParticle **particles=NULL, int mf=0, int af=0, int bf=0)
void DisableHelicityAngle()
Definition PChannel.h:160
Bool_t Do(const char *command)
Definition PChannel.h:175
PChannel(PParticle **, int nt=2, int mf=0, int af=0, int bf=0)
int CheckSiblings(PParticle *p, PDistribution *dist, int flag)
void PrintNew()
int GetNumNotFinalized()
Definition PChannel.h:165
static void SetGlobalWeight(double w)
Definition PChannel.h:125
Bool_t Reset()
void CheckDecayKey() const
TH1F * distribution
PParticle * p
Definition dp_mult.C:24
Int_t n
Definition etap+omeg.C:21
PParticle * target
Definition fermi_dd.C:9
PParticle * beam
PParticle * w