const char *EType[4] = {
"PReaction: ok",
"PReaction: invalid option (must be 0 or 1)",
"PReaction: invalid channel address",
"PReaction: too many events failed (> _system_max_failed_events)"
};
const char *RMessage[2] = {
"PReaction: control external - user functions disabled",
"PReaction: calculating widths in PData..."
};
const char *OType[2] = {
"tracked particles on file",
"all particles on file"
};
const char *percent="\%";
#include "PData.h"
#include "PReaction.h"
#include "PUtils.h"
#include "TStopwatch.h"
#include "PFilter.h"
#ifdef USE_PYTHIA6
#include "TPythia6.h"
#endif
Int_t passEvent(float eb, float bp, float ph, int n,
int *id, int *src, int *par, int *parindex, float *px, float *py, float *pz,
float *vx, float *vy, float *vz, float *vt, float *w);
Int_t CalledSelection(PParticle *p);
Int_t CalledAnalysis(PParticle **p, Int_t n);
TMethodCall *gMethodCall1;
TMethodCall *gMethodCall2;
FILE *PReaction::asciif = NULL;
Int_t PReaction::globalEventCounter = 0;
TClonesArray *PReaction::evt[MAX_NUM_BRANCHES+1];
Int_t PReaction::activeCnt = 0;
ClassImp(PReaction)
const unsigned int PReaction::ff0=1;
const unsigned int PReaction::ff1=1<<1;
const unsigned int PReaction::ff2=1<<2;
const unsigned int PReaction::ff3=1<<3;
const unsigned int PReaction::ff4=1<<4;
PReaction::PReaction(PChannel **pchannel, const char *file_name, int n,
int f0, int f1, int f2, int f3, TTree *ttree) {
makeStdData()->fillDataBase();
makeDistributionManager()->DisableAddWarning();
makeDistributionManager()->ExecAll("init");
if (!pchannel)
n = 0;
sub_reaction = NULL;
status = 0;
tree = ttree;
int check_options = (f0!=0&&f0!=1) + (f1!=0&&f1!=1)
+ (f2!=0&&f2!=1) + (f3!=0&&f3!=1&&f3!=2);
if (check_options) {
status = 1;
printf("%s\n", EType[status]);
return;
} else {
allPARTICLES = f0;
resetCHANNELS = 1-f1;
getVERTEX = f2;
asciiOUTPUT = f3;
extTREE = tree!=NULL;
ropt = 0 | ff0*allPARTICLES | ff1*resetCHANNELS | ff2*getVERTEX
| ff3*(asciiOUTPUT>0) | ff4*extTREE;
}
nchan = n;
SetUp(pchannel);
SetName(file_name);
}
PReaction::PReaction() {
makeStdData()->fillDataBase();
makeDistributionManager()->DisableAddWarning();
makeDistributionManager()->ExecAll("init");
sub_reaction = NULL;
status = 0;
tree = NULL;
allPARTICLES = 1;
resetCHANNELS = 0;
getVERTEX = 1;
asciiOUTPUT = 0;
extTREE = 0;
ropt = 0;
nchan = 0;
SetUp(NULL);
SetName(NULL);
}
PReaction:: PReaction(const char *filename) {
makeStdData()->fillDataBase();
makeDistributionManager()->DisableAddWarning();
makeDistributionManager()->ExecAll("init");
sub_reaction = NULL;
status = 0;
tree = NULL;
allPARTICLES = 1;
resetCHANNELS = 0;
getVERTEX = 1;
asciiOUTPUT = 0;
extTREE = 0;
ropt = 0;
nchan = 0;
SetUp(NULL);
SetName(filename);
}
PReaction::PReaction(PChannel **pchannel, int n, unsigned int ff,
TTree *ttree, const char *file_name) {
makeStdData()->fillDataBase();
sub_reaction = NULL;
status = 0;
tree = ttree;
allPARTICLES = ((ff&ff0)==ff0);
resetCHANNELS = 1-((ff&ff1)==ff1);
getVERTEX = ((ff&ff2)==ff2);
asciiOUTPUT = ((ff&ff3)==ff3);
extTREE = (tree!=NULL);
ropt = ff&(ff4*extTREE);
nchan = n;
SetUp(pchannel);
SetName(file_name);
}
PReaction::PReaction(Double_t momentum,
const char *beam, const char *target,
const char *reaction, const char *file_name,
Int_t f0, Int_t f1, Int_t f2, Int_t f3, TTree *ttree) {
char dummy[100];
sprintf(dummy, "_P1=%lf", momentum);
parse_script(dummy,
beam, target,
reaction, file_name,
f0, f1,f2, f3, ttree);
}
PReaction::PReaction(const char *e,
const char *beam, const char *target,
const char *reaction, const char *file_name,
Int_t f0, Int_t f1, Int_t f2, Int_t f3, TTree *ttree) {
parse_script(e,
beam, target,
reaction, file_name,
f0, f1,f2, f3, ttree);
}
Bool_t PReaction::parse_script(const char *command,
const char *beam, const char *target,
const char *reaction, const char *file_name,
Int_t f0, Int_t f1, Int_t f2, Int_t f3, TTree *ttree) {
r_beam = beam, r_target = target;
reaction_string = reaction;
makeDistributionManager()->DisableAddWarning();
makeDistributionManager()->ExecAll("init");
sub_reaction = NULL;
char *newcommand = PUtils::NewString(command);
PUtils::remove_spaces(&newcommand);
if (strlen(newcommand)>0 && isdigit(newcommand[0])) {
char *newe = new char[strlen(newcommand)+5];
sprintf(newe, "_T1=%s", (char *)newcommand);
newcommand = newe;
}
makeGlobalBatch()->SetVarList((char *)
"_T1;_T2;_P1;_P2;_theta1;_theta2;_phi;");
makeGlobalBatch()->Execute(newcommand);
makeGlobalBatch()->SetVarList(NULL);
Double_t beam_energy1 = 0.;
if (makeStaticData()->GetBatchValue("_T1",0)) {
beam_energy1 = *(makeStaticData()->GetBatchValue("_T1",0));
}
Double_t beam_energy2 = -0.;
if (makeStaticData()->GetBatchValue("_T2",0)) {
beam_energy2 = *(makeStaticData()->GetBatchValue("_T2",0));
}
Double_t beam_momentum1 = -1.;
if (makeStaticData()->GetBatchValue("_P1",0)) {
beam_momentum1 = *(makeStaticData()->GetBatchValue("_P1",0));
}
Double_t beam_momentum2 = -1.;
if (makeStaticData()->GetBatchValue("_P2",0)) {
beam_momentum2 = *(makeStaticData()->GetBatchValue("_P2",0));
}
Double_t beam_theta1 = 0.;
if (makeStaticData()->GetBatchValue("_theta1",0)) {
beam_theta1 = *(makeStaticData()->GetBatchValue("_theta1",0));
}
Double_t beam_theta2 = 0.;
if (makeStaticData()->GetBatchValue("_theta2",0)) {
beam_theta2 = *(makeStaticData()->GetBatchValue("_theta2",0));
}
Double_t beam_phi1 = 0.;
if (makeStaticData()->GetBatchValue("_phi",0)) {
beam_phi1 = *(makeStaticData()->GetBatchValue("_phi",0));
}
char *array[200];
Int_t array_s = 200;
PUtils::Tokenize(reaction, ";", array, &array_s);
Int_t total_channels = 0;
TList plutoList;
for (int i=0; i<array_s; i++) {
PParticle pb,pt;
Int_t n = 0;
if (beam_momentum1 > 0) {
pb = PParticle(beam, 0, 0, beam_momentum1);
} else {
pb = PParticle(beam, beam_energy1);
}
if (beam_momentum2 > 0) {
pt = PParticle(target, 0, 0, -beam_momentum2);
} else {
pt = PParticle(target, 0, 0, -sqrt(beam_energy2*beam_energy2+2*beam_energy2*
makeStaticData()->GetParticleMass(target)));
}
pb.RotateY(beam_theta1);
pb.RotateZ(beam_phi1);
pt.RotateY(-beam_theta2);
pt.RotateZ(beam_phi1);
cout << "<Beam>" << endl;
pb.Print();
cout << "<Target>" << endl;
pt.Print();
PParticle *q = new PParticle(pb+pt);
plutoList.AddLast(q);
ParseChannel(q,array[i], plutoList, n);
total_channels += n;
}
PChannel **pchannel = new PChannel*[total_channels];
TIter next(&plutoList);
Int_t pos = 0;
while (TObject *t = next()) {
if (t->IsA() == PChannel::Class()) {
pchannel[pos++] = (PChannel*) t;
}
}
status = 0;
tree = ttree;
int check_options = (f0!=0&&f0!=1) + (f1!=0&&f1!=1)
+ (f2!=0&&f2!=1) + (f3!=0&&f3!=1&&f3!=2);
if (check_options) {
status = 1;
printf("%s\n", EType[status]);
return kFALSE;
} else {
allPARTICLES = f0;
resetCHANNELS = 1-f1;
getVERTEX = f2;
asciiOUTPUT = f3;
extTREE = tree!=NULL;
ropt = 0 | ff0*allPARTICLES | ff1*resetCHANNELS | ff2*getVERTEX
| ff3*(asciiOUTPUT>0) | ff4*extTREE;
}
nchan = total_channels;
SetUp(pchannel);
SetName(file_name);
return kTRUE;
}
PReaction::PReaction(PParticle *q,
const char *reaction, const char *file_name,
Int_t f0, Int_t f1, Int_t f2, Int_t f3, TTree *ttree) {
reaction_string = reaction;
makeDistributionManager()->DisableAddWarning();
makeDistributionManager()->ExecAll("init");
sub_reaction = NULL;
char *array[200];
Int_t array_s = 200;
PUtils::Tokenize(reaction, ";", array, &array_s);
Int_t total_channels = 0;
TList plutoList;
for (int i=0; i<array_s; i++) {
Int_t n = 0;
plutoList.AddLast(q);
ParseChannel(q, array[i], plutoList, n);
total_channels += n;
}
PChannel **pchannel = new PChannel*[total_channels];
TIter next(&plutoList);
Int_t pos = 0;
while (TObject *t = next()) {
if (t->IsA() == PChannel::Class()) {
pchannel[pos++] = (PChannel*) t;
}
}
status = 0;
tree = ttree;
int check_options = (f0!=0&&f0!=1) + (f1!=0&&f1!=1)
+ (f2!=0&&f2!=1) + (f3!=0&&f3!=1&&f3!=2);
if (check_options) {
status = 1;
printf("%s\n", EType[status]);
return;
} else {
allPARTICLES = f0;
resetCHANNELS = 1-f1;
getVERTEX = f2;
asciiOUTPUT = f3;
extTREE = tree!=NULL;
ropt = 0 | ff0*allPARTICLES | ff1*resetCHANNELS | ff2*getVERTEX
| ff3*(asciiOUTPUT>0) | ff4*extTREE;
}
nchan = total_channels;
SetUp(pchannel);
SetName(file_name);
}
void PReaction::AddReaction(const char *reaction) {
if (sub_reaction) {
sub_reaction->AddReaction(reaction);
} else {
if (original_filename == "")
ConvertFilename();
if (strlen(filename) > 0)
sub_reaction = new PReaction((char*)"", r_beam, r_target,
reaction,(char*)original_filename.Data(),
allPARTICLES, 1-resetCHANNELS,
getVERTEX, asciiOUTPUT);
else
sub_reaction = new PReaction((char*)"", r_beam, r_target,
reaction, NULL,
allPARTICLES, 1-resetCHANNELS,
getVERTEX, asciiOUTPUT);
sub_reaction->ConvertFilename();
}
}
void PReaction::ConvertFilename(void) {
if (strlen(filename) == 0) return;
TString original_filename2 = filename;
filename.Append("_to_");
filename.Append(reaction_string);
filename.ReplaceAll(" [ ",".");
filename.ReplaceAll(" ] ","");
filename.ReplaceAll(" [",".");
filename.ReplaceAll(" ]","");
filename.ReplaceAll("[ ",".");
filename.ReplaceAll("] ","");
filename.ReplaceAll("[",".");
filename.ReplaceAll("]","");
filename.ReplaceAll(" ","_");
filename.ReplaceAll("(","_");
filename.ReplaceAll(")","");
SetName((char*)filename.Data());
original_filename=original_filename2;
cout << "New name: " << filename << endl;
}
PReaction::~PReaction() {
cindex.~TArrayI();
if (particle_stack)
delete [] particle_stack;
if (evt[0]) {
delete evt[0];
evt[0] = NULL;
}
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
if (evt[i+1]) {
delete evt[i+1];
evt[i+1] = NULL;
}
}
if (dindex.GetArray()) dindex.~TArrayI();
if (ftrack.GetArray()) ftrack.~TArrayI();
if (!extTREE&&tree) delete tree;
if (rootfile && !extTREE && (strlen(filename) > 0)) {
rootfile=tree->GetCurrentFile();
rootfile->Write();
rootfile->Close();
delete rootfile;
}
if (gMethodCall1) delete gMethodCall1;
if (gMethodCall2) delete gMethodCall2;
}
PParticle *PReaction::MakeParticle(char *name) {
int is_spec = -1;
int len = strlen(name)-1;
if ((name[0]=='(') && (name[len]==')')) {
is_spec = 1;
PUtils::remove_brackets(&name, '(', ')');
}
if (name[0]=='(') {
is_spec = 2;
name++;
}
if (name[len]==')') {
is_spec = 3;
name[len]='\0';
}
PParticle *dummy = new PParticle(name);
dummy->SetSpectator(is_spec);
return dummy;
};
Int_t PReaction::ParseChannel(PParticle *parent, const char *channel,
TList &plutoList, Int_t &numChannels) {
TList plist;
Int_t num_parts = 0;
PParticle *current = NULL;
Int_t i = 0;
Int_t start = i;
while(1) {
switch (channel[i]) {
case '[':
if (!current) {
while(1) {
if (channel[i]==']') { i++; break; }
else if (channel[i]==0) break;
else i++;
}
break;
}
i++;
i += ParseChannel(current, &channel[i], plutoList, numChannels);
if (channel[i]) i++;
start = i;
break;
case 0:
case ']': {
if (start!=i) {
TString name(&channel[start], i-start);
current = MakeParticle( (char*) name.Data());
plist.AddLast(current);
plutoList.AddLast(current);
num_parts++;
}
if (!num_parts) return i;
PParticle **ppl = new PParticle*[num_parts+1];
ppl[0] = parent;
Int_t pos = 1;
TIter next(&plist);
while (PParticle *p = (PParticle*) next()) {
ppl[pos++] = p;
}
PChannel *ch = new PChannel(ppl,num_parts);
plutoList.AddFirst(ch);
numChannels++;
return i;
break;
}
case ' ': {
if (start==i) { start = ++i; break; }
TString name(&channel[start], i-start);
current = MakeParticle( (char*) name.Data());
plist.AddLast(current);
plutoList.AddLast(current);
num_parts++;
i++;
start = i;
break;
}
default:
i++;
}
}
}
Bool_t PReaction::AddBulk(PBulkInterface *mybulk) {
if (bulkdecay_pos == MAX_BULKDECAY ) {
Error("AddBulk", "MAX_BULKDECAY reached");
return kFALSE;
}
if (bulkdecay_pos && (bulk[bulkdecay_pos-1]->GetPriority() > mybulk->GetPriority())) {
bulk[bulkdecay_pos] = bulk[bulkdecay_pos-1];
bulk[bulkdecay_pos-1] = mybulk;
bulkdecay_pos++;
} else
bulk[bulkdecay_pos++] = mybulk;
if (sub_reaction) sub_reaction->AddBulk(mybulk);
mybulk->SetSizeBranches(&size_branches);
mybulk->SetKeysBranches(key_branches);
return kTRUE;
}
Bool_t PReaction::AddPrologueBulk(PBulkInterface *mybulk) {
if (pro_bulkdecay_pos == MAX_BULKDECAY ) {
Error("AddPrologueBulk", "MAX_BULKDECAY reached");
return kFALSE;
}
if (pro_bulkdecay_pos && (pro_bulk[pro_bulkdecay_pos-1]->GetPriority() > mybulk->GetPriority())) {
pro_bulk[pro_bulkdecay_pos] = pro_bulk[pro_bulkdecay_pos-1];
pro_bulk[pro_bulkdecay_pos-1] = mybulk;
pro_bulkdecay_pos++;
} else
pro_bulk[pro_bulkdecay_pos++] = mybulk;
if (sub_reaction) sub_reaction->AddPrologueBulk(mybulk);
mybulk->SetSizeBranches(&size_branches);
mybulk->SetKeysBranches(key_branches);
return kTRUE;
}
void PReaction::SetReactionId() {
PChannel *pch0 = channel[0];
Int_t n = pch0->GetNumPar();
Int_t *ids = pch0->GetPids();
if (ids[0]/100 != 5) {
Int_t fac = 1;
reactionId = 0;
if(n>5) n = 5;
for (Int_t i=n; i>0; i--) {
reactionId += ids[i]*fac;
fac *= 100;
}
(pch0->GetParticles())[0]->SetSourceId(reactionId);
} else reactionId = ids[0];
}
void PReaction::SetUp(PChannel **pchannel) {
int j, i, cnew, l=-1, m=-1, k, pcount;
num_filters = 0;
reset_count = 0;
HGeant = 0;
rootfile = NULL;
userSelection = NULL;
gMethodCall1 = NULL;
userAnalysis = NULL;
gMethodCall2 = NULL;
decayALL = 0;
fPythia = NULL;
nMaxBytes = 0;
nTrigCond = 0;
writeINDEX = 1;
fileoutput_pos = 0;
bulkdecay_pos = 0;
pro_bulkdecay_pos = 0;
makeDistributionManager()->LinkDB();
weight_reset = 1;
pre_heating = 0;
current_projector = NULL;
is_inline = 0;
doonce = 0;
size_branches = 0;
evt[0] = NULL;
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
key_branches[i] = -1;
evt[i+1] = NULL;
}
makeGlobalBulk()->SetSizeBranches(&size_branches);
makeGlobalBulk()->SetKeysBranches(key_branches);
if (!makeStaticData()->GetBatchValue("_system_inactivate_decayed_particles",0))
inactivate_decayed_particles = 0;
else
inactivate_decayed_particles = (Int_t)(*(makeStaticData()->GetBatchValue("_system_inactivate_decayed_particles")));
if (makeDistributionManager()->GetLoopFilter()) {
AddBulk(makeDistributionManager()->GetLoopFilter());
}
event_impact_param = (makeStaticData()->GetBatchValue("_event_impact_param"));
event_plane = (makeStaticData()->GetBatchValue("_event_plane"));
vertex_x = makeStaticData()->GetBatchValue("_event_vertex_x");
vertex_y = makeStaticData()->GetBatchValue("_event_vertex_y");
vertex_z = makeStaticData()->GetBatchValue("_event_vertex_z");
weight_version = makeStaticData()->GetBatchValue("_system_weight_version");
if (!makeStaticData()->GetBatchValue("_system_particle_stacksize",0))
stacksize = MIN_PARTICLE_STACKSIZE;
else
stacksize = (Int_t)(*(makeStaticData()->GetBatchValue("_system_particle_stacksize")));
PParticle **pnew=NULL, **poth=NULL;
particle_stack = new PParticle*[stacksize];
ndpar = 0;
channel = NULL;
if (pchannel) {
if (pchannel[0]->GetQuasi()) {
channel = new PChannel*[nchan+1];
for (int j=0; j<nchan; ++j) {
channel[j+1] = pchannel[j];
}
channel[0] = pchannel[0]->GetQuasi();
pchannel[0]->ClearQuasi();
nchan++;
} else {
channel = pchannel;
}
}
dindex.Set(nchan-1);
for (j=0; j<nchan; ++j) {
if (!channel[j]) {
status = 2;
printf("%s\n", EType[status]);
return;
}
ndpar += channel[j]->GetNumPar();
}
Int_t is_fireball = 0;
if (nchan && (channel[0]->GetParticles()[0]->IsFireball())) {
nclones = ndpar;
is_fireball = 1;
} else
nclones = ndpar + 1;
for (j=0; j<nchan; ++j) {
if (makeDistributionManager()->from_pdecaymanager == 0) {
makeDistributionManager()->Attach(channel[j]);
}
}
for (j=0; j<nchan; ++j) {
cnew = channel[j]->GetNumPar();
pnew = channel[j]->GetParticles();
pcount = 0;
if (j == 0) {
particle = new PParticle*[nclones];
cindex.Set(nclones);
ftrack.Set(nclones);
if (!is_fireball) {
m = 0;
particle[0] = pnew[0];
}
cindex[0] = 1;
ftrack[0] = 0;
}
for (i=1; i<=cnew; ++i) {
++m;
particle[m] = pnew[i];
particle[m]->SetParent(pnew[0]);
cindex[m] = j+1;
int dcount = 0;
if (j != nchan-1) {
for (k=j+1; k<nchan; ++k) {
poth=channel[k]->GetParticles();
if (pnew[i] == poth[0]) {
if (pnew[i]->Is("dilepton")) ++pcount;
++dcount;
dindex[k-1] = m;
}
}
}
if (!dcount) {
ftrack[m] = 1;
} else {
ftrack[m] = 0;
}
}
}
ntpar = l+1;
if (nchan > 0) SetReactionId();
else nclones = 0;
for (j=0; j<nclones; j++) {
particle[j]->SetIndex(j);
particle[j]->SetParentIndex(-1);
particle[j]->SetDaughterIndex(-1);
particle[j]->SetSiblingIndex(-1);
particle[j]->SetSibling(NULL);
}
for (j=0; j<nchan; ++j) {
channel[j]->SetDaughters();
}
for (j=0; j<nchan; ++j) {
channel[j]->SetPrintTentative(0);
channel[j]->Init();
channel[j]->SetPrintTentative(1);
}
}
void PReaction::InitChannels() {
for (int j=0; j<nchan; ++j) {
channel[j]->SetDaughters();
}
for (int j=0; j<nchan; ++j) {
channel[j]->SetPrintTentative(0);
channel[j]->Init();
channel[j]->SetPrintTentative(1);
}
}
void PReaction::SetName(const char *name) {
if (extTREE&&reset_count) {
printf("%s\n", RMessage[0]);
return;
}
if (name) {
filename = name;
file2 = name;
if (extTREE)
file2 = tree->GetCurrentFile()->GetName();
else file2 += ".root";
} else {
filename = "";
file2 = "";
}
if (rootfile) {
rootfile->Close();
delete rootfile;
}
if (asciiOUTPUT && (strlen(filename) > 0) ) {
file1 = filename+".evt";
}
loop_count = 0;
original_filename = "";
}
void PReaction::InitLoop() {
int size = ntpar;
static int count = 0;
if (!evt[0])
evt[0] = new TClonesArray("PParticle", size);
else return;
reset_count = ++count;
if (!extTREE && !HGeant && (strlen(filename) > 0)) {
rootfile = new TFile(file2, "RECREATE", file2);
rootfile->cd();
}
if (!extTREE && (strlen(filename) > 0))
tree = new TTree("data", "event branch");
if (allPARTICLES) size = nclones;
if (tree) {
if (extTREE && tree->GetBranch("Particles")) {
tree->SetBranchAddress("Npart", &activeCnt);
tree->SetBranchAddress("Impact", event_impact_param);
tree->SetBranchAddress("Phi", event_plane);
tree->SetBranchAddress("Particles", &(evt[0]));
if (size_branches) {
Error("InitLoop", "Multiple branches not supported when using an external tree");
}
} else {
tree->Branch("Npart", &activeCnt, "Npart/I");
tree->Branch("Impact", event_impact_param, "Impact/D");
tree->Branch("Phi", event_plane, "Phi/D");
tree->Branch("Particles", &(evt[0]),32000,99);
for (int br=0; br<size_branches; br++) {
if (key_branches[br] != -1) {
if (!evt[br+1]) evt[br+1] = new TClonesArray("PParticle", size);
tree->Branch(makeDataBase()->GetName(key_branches[br]), &(evt[br+1]), 32000, 99);
makeDataBase()->SetParamInt(key_branches[br], "branch_idx", new Int_t(br));
}
}
}
}
if (asciiOUTPUT == 1)
asciif = fopen(file1, "w");
if (nMaxBytes>0 && tree) tree->SetMaxTreeSize(nMaxBytes);
Int_t listkey = -1;
num_filters = 0;
Int_t primary_key = makeDataBase()->GetEntry("batch_objects");
if (primary_key >- 1)
while (makeDataBase()->MakeListIterator(primary_key, NBATCH_NAME, LBATCH_NAME,
&listkey)) {
if ((*makeDataBase()->GetName(listkey) == '#') &&
PUtils::ValidVariableName(makeDataBase()->GetName(listkey))) {
cout << "Found filter variable " << makeDataBase()->GetName(listkey) << endl;
if (num_filters < MAX_REACTION_FILTERS) {
filter_keys[num_filters] = listkey;
filter_counter[num_filters] = 0;
if (!makeDataBase()->GetParamDouble(listkey, "batch_value", &filter_values[num_filters]))
Warning("InitLoop", "Filter content variable not found");
num_filters++;
} else {
Warning("InitLoop", "Too many filters (MAX_REACTION_FILTERS reached)");
}
}
}
}
int PReaction::Loop(int nevents, int wf, int verbose) {
if (weight_reset) PChannel::SetGlobalWeight(1./nevents);
double t0 = -1;
if (extTREE && reset_count&&verbose) printf("%s\n", RMessage[0]);
if (!is_inline && !extTREE && reset_count>0) {
Error("Loop", "Called a second time -> abort");
return 0;
}
int i, j, k, error_count=0, error_count_failed=0, empty_count=0, good_event=0,
size, current_size_branches[MAX_NUM_BRANCHES],
size_tracked;
int percentevents = (nevents/100) * (*makeStaticData()->GetBatchValue("_system_printout_percent")),
cpc=1, ipc=cpc*percentevents;
if (verbose) (*makeStaticData()->GetBatchValue("_system_total_events_to_sample")) = nevents;
int system_printout_percent = int(*makeStaticData()->GetBatchValue("_system_printout_percent"));
int error_count_array[100];
for (int i=0; i<100; i++) error_count_array[i] = 0;
double *events = makeStaticData()->GetBatchValue("_system_total_event_number");
PParticle *p_array[stacksize];
PParticle *stable_particle[stacksize];
PParticle *p_array_branches[MAX_NUM_BRANCHES*stacksize];
Double_t max_failed_events = 10000.;
if (makeStaticData()->GetBatchValue("_system_max_failed_events", 0)) {
max_failed_events = *(makeStaticData()->GetBatchValue("_system_max_failed_events",0));
}
if (!doonce) {
doonce = 1;
for (k=0;k<stacksize;k++) {
p_array[k] = new PParticle("dummy");
particle_stack[k] = p_array[k];
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
p_array_branches[i*stacksize + k] = new PParticle("dummy");
}
}
}
++loop_count;
InitLoop();
TClonesArray *pclone = (evt[0]);
TStopwatch timer;
timer.Start();
Int_t print_welcome = 1;
Int_t last_nonempty = -1;
for (int bu =0; bu<pro_bulkdecay_pos; bu++) {
pro_bulk[bu]->SetTree(tree);
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
pro_bulk[bu]->SetBranchArray(i, &(p_array_branches[i*stacksize]));
pro_bulk[bu]->SetBranchNum(i, &(current_size_branches[i]));
}
}
for (int bu =0; bu<bulkdecay_pos; bu++) {
bulk[bu]->SetTree(tree);
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
bulk[bu]->SetBranchArray(i, &(p_array_branches[i*stacksize]));
bulk[bu]->SetBranchNum(i, &(current_size_branches[i]));
}
}
for (int i=0; i<MAX_NUM_BRANCHES; i++) {
makeGlobalBulk()->SetBranchArray(i, &(p_array_branches[i*stacksize]));
makeGlobalBulk()->SetBranchNum(i, &(current_size_branches[i]));
}
if (verbose) printf("%s\n", RMessage[1]);
makeDistributionManager()->Startup();
for (i=0;(i<nevents) || (nevents<0);++i) {
for (k=0; k<stacksize; k++) {
decay_done[k] = 0;
}
for (k=0; k<nclones; k++) {
particle_stack[k] = particle[k];
}
size = nclones;
if (nevents > 0) {
if (print_welcome) {
if (good_event == 1) {
t0=timer.RealTime();
if (verbose) printf("...widths calculated in %f sec\n", t0);
if (verbose) printf("New loop: %i events\n", nevents);
timer.Continue();
}
if (verbose && i==1000) {
Double_t elaps = timer.RealTime()-t0;
printf("Expected execution time = %.3f sec\n", nevents*0.001*elaps);
timer.Continue();
}
print_welcome = 0;
}
#if 0
if (i == ipc) {
if (verbose) printf(" %i%s done in %f sec\n", cpc*20, percent, timer.RealTime()-t0);
++cpc;
ipc = cpc*twentypercent;
timer.Continue();
}
#endif
}
if (channel) {
for (j=0; j<nchan; j++) {
(channel[j]->GetParticles())[0]->SetVertex(*vertex_x,
*vertex_y,
*vertex_z,0.);
(channel[j]->GetParticles())[0]->clearDebugString();
}
}
*event_impact_param = 0.0;
*event_plane = 0.0;
repeat_empty:
for (int ij=0; ij<MAX_NUM_BRANCHES; ij++) {
current_size_branches[ij] = 0;
}
Bool_t statusOfModify = kTRUE;
for (int bu=0; bu<pro_bulkdecay_pos; bu++) {
int old_size = size;
pro_bulk[bu]->SetTree(tree);
if(!(statusOfModify = pro_bulk[bu]->Modify(particle_stack,
decay_done, &size, stacksize))) {
break;
}
for (int ii=old_size; ii<size; ii++) {
particle_stack[ii]->SetIndex(ii);
}
for (int ii=0; ii<size; ii++) {
if (!allPARTICLES && decay_done[ii])
particle_stack[ii]->SetInActive();
}
}
if(statusOfModify == kFALSE) {
if (nevents > 0)
Warning("Loop()",
"Bulk return kFALSE. Not full number of events calculated! nEvents = %i !", i);
break;
}
for (int ii=0; ii<size; ii++) {
if (*weight_version) {
particle_stack[ii]->SetW( particle_stack[ii]->GetMultiplicity());
}
particle_stack[ii]->SetStatus(STATUS_NOT_DECAYED);
particle_stack[ii]->SetActive();
}
for (j=0; j<nchan; ++j) {
PParticle *parent = (channel[j]->GetParticles())[0];
if (*weight_version)
parent->SetW(PChannel::GetGlobalWeight() * parent->GetMultiplicity());
parent->SetGenW(1.);
parent->SetInvGenW(1.);
}
Int_t ret = 0;
Int_t start = 0;
repeat:
if (error_count_failed > max_failed_events-0.5) {
status = 3;
Error("Loop", "Stalled in one single event (_system_max_failed_events reached). Giving up....");
Info("Loop", "Last error code was: %i", ret);
break;
}
repeat2:
for (j=start; j<nchan; ++j) {
if ( (ret=channel[j]->decay()) ) {
error_count++;
error_count_failed++;
error_count_array[ret]++;
if (ret != 8) {
last_nonempty = i;
goto repeat;
}
}
(channel[j]->GetParticles())[0]->SetStatus(ret);
}
error_count_failed = 0;
for (j=0; j<nchan; ++j) {
if (channel[j]->GetNumNotFinalized()) {
for (int k=0; k<channel[j]->GetNumNotFinalized(); k++) {
if (!channel[j]->GetDistributionNotFinalized(k)->EndOfChain()) {
start = 0;
++error_count;
error_count_array[STATUS_REDO_CHAIN]++;
goto repeat2;
}
}
}
}
if (pre_heating) {
pre_heating--;
if (pre_heating == 1) Info("Loop()","Preheating done");
goto repeat2;
}
if (ret == 8) break;
Double_t my_global_weight = 1.;
if (*weight_version) {
#if 1
for (k=0; k<size; k++) {
particle_stack[k]->weight_divisor = 1.;
}
for (k=size-1; k>=0; k--) {
if (particle_stack[k]->GetParent() && (particle_stack[k]->W()>0.)) {
particle_stack[k]->GetParent()->weight_divisor =
particle_stack[k]->GetParent()->W() /
particle_stack[k]->W();
}
}
for (k=size-1; k>=0; k--) {
if (particle_stack[k]->GetParent())
particle_stack[k]->GetParent()->weight_divisor *=
particle_stack[k]->weight_divisor;
}
for (k=size-1; k>=0; k--) {
particle_stack[k]->SetW(
particle_stack[k]->W() / (particle_stack[k]->weight_divisor));
}
for (k=size-1; k>=0; k--) {
if (particle_stack[k]->GetParent()) {
particle_stack[k]->SetW(particle_stack[k]->GetParent()->W());
} else
my_global_weight *= particle_stack[k]->W();
}
for (k=size-1; k>=0; k--)
particle_stack[k]->SetW(my_global_weight);
#endif
}
(*events)++;
if ((*events) == ipc) {
printf(" %i%c done in %f sec\n", cpc*system_printout_percent,
'%', timer.RealTime()-t0);
cpc++;
ipc = cpc*percentevents;
timer.Continue();
}
for (k=0; k<size; k++) {
if ((particle_stack[k]->GetStatus()) == STATUS_OK)
decay_done[k] = 1;
else
decay_done[k] = 0;
}
for (k=size; k<stacksize; k++) {
decay_done[k] = 0;
}
statusOfModify = kTRUE;
if (inactivate_decayed_particles) {
for (int ii=0; ii<size; ii++) {
if (!allPARTICLES && decay_done[ii]) {
particle_stack[ii]->SetInActive();
}
}
}
for (int bu = 0; bu<bulkdecay_pos; bu++) {
int old_size = size;
bulk[bu]->SetWeight(my_global_weight);
if(!(statusOfModify = bulk[bu]->Modify(particle_stack,
decay_done, &size, stacksize))) { break; }
my_global_weight = bulk[bu]->GetWeight();
if (*weight_version) {
for (k=size-1; k>=0; k--)
particle_stack[k]->SetW(my_global_weight);
}
for (int ii=old_size; ii<size; ii++) {
particle_stack[ii]->SetIndex(ii);
}
for (int ii=0; ii<size; ii++) {
if (!allPARTICLES && decay_done[ii]) {
particle_stack[ii]->SetInActive();
}
}
}
#if 0
cout << "after EPI " << size << endl;
for (k=0;k<size;++k) {
if (particle_stack[k]->IsActive())
particle_stack[k]->Print();
else
cout << "particle " << k << " inactive" << endl;
}
#endif
if(statusOfModify == kFALSE) {
if (nevents > 0)
Warning("Loop()",
"Bulk return kFALSE. Not full number of events calculated! nEvents = %i !",i);
break;
}
Int_t cnt0 = 0;
for (k=0; k<size; ++k) {
if (particle_stack[k]->IsActive()==kTRUE) cnt0++;
}
if (cnt0==0 && nchan != 0) {
empty_count++;
error_count++;
if (last_nonempty < i) {
error_count_array[STATUS_EMPTY_EVENT]++;
} else {
error_count_array[STATUS_PSEUDO_EMPTY_EVENT]++;
}
goto repeat_empty;
} else {
last_nonempty = i;
}
if (userSelection) {
Int_t nTrig = 0;
Int_t ret = 0;
for (k=0;k<size;k++) {
if (particle_stack[k]->IsActive()) {
if ( (ret=userSelection(particle_stack[k])) > 0) nTrig+=ret;
else particle_stack[k]->SetInActive();
}
}
if (nTrig < nTrigCond) continue;
}
Int_t retVal=1;
if (userAnalysis) retVal = userAnalysis(particle_stack,size);
if (!retVal) continue;
Int_t filters_sum = 0;
for (k=0; k<num_filters; k++) {
if (*(filter_values[k]) < PUtils::sampleFlat()) {
filter_counter[k]++;
filters_sum++;
}
}
if (filters_sum) continue;
good_event++;
PReaction::globalEventCounter++;
size_tracked = 0;
for (k=0; k<size; k++) {
if (!decay_done[k]) {
stable_particle[size_tracked] = particle_stack[k];
size_tracked++;
}
}
Int_t cnt = 0;
if (HGeant) {
int id_tmp[1000], src_tmp[1000], par_tmp[1000], ind_tmp[1000];
float px_tmp[1000], py_tmp[1000], pz_tmp[1000], w_tmp[1000];
float vx_tmp[1000], vy_tmp[1000], vz_tmp[1000], vt_tmp[1000];
cnt = 0;
for(k=0; k<size_tracked; ++k) {
PParticle *pt = stable_particle[k];
if (pt->IsActive()==kFALSE) continue;
id_tmp[cnt] = pt->ID();
px_tmp[cnt] = pt->Px();
py_tmp[cnt] = pt->Py();
pz_tmp[cnt] = pt->Pz();
if (getVERTEX) {
vx_tmp[cnt] = pt->X();
vy_tmp[cnt] = pt->Y();
vz_tmp[cnt] = pt->Z();
vt_tmp[cnt] = pt->T()/300.;
}
else vx_tmp[cnt] = vy_tmp[cnt] = vz_tmp[cnt] = vt_tmp[cnt] = 0.;
w_tmp[cnt] = pt->W();
src_tmp[cnt] = pt->GetSourceId();
par_tmp[cnt] = pt->GetParentId();
ind_tmp[cnt] = pt->GetParentIndex();
cnt++;
if(cnt == 1000) break;
}
float Ebeam = channel[0]->GetBT();
float bpar = *event_impact_param;
float phiEv = 57.29578 * (*event_plane);
passEvent(Ebeam, bpar, phiEv, cnt, id_tmp, src_tmp, par_tmp, ind_tmp,
px_tmp, py_tmp, pz_tmp, vx_tmp, vy_tmp, vz_tmp, vt_tmp, w_tmp);
gROOT->ProcessLine("doGeant(\"trigger 1\");");
}
if (asciiOUTPUT) {
if (!getVERTEX) {
cnt = 0;
for(k=0; k<size_tracked; ++k)
if (stable_particle[k]->IsActive()==kTRUE) cnt++;
if (writeINDEX == 0) {
fprintf(asciif," %i %i %f %f 2\n",
PReaction::globalEventCounter,cnt,
channel[0]->GetBT(),*event_impact_param);
} else {
if (channel) fprintf(asciif," %i %i %f %f -2\n",
PReaction::globalEventCounter, cnt,
channel[0]->GetBT(), *event_impact_param);
else fprintf(asciif," %i %i %f %f -2\n",
PReaction::globalEventCounter, cnt,
0., *event_impact_param);
}
for (k=0; k<size_tracked; ++k) {
PParticle *pt = stable_particle[k];
if (pt->IsActive() == kFALSE) continue;
if(writeINDEX == 0) {
fprintf(asciif," %e %e %e %e %i %i %i %e\n",
pt->E(), pt->Px(), pt->Py(), pt->Pz(),
pt->ID(), pt->GetSourceId(), pt->GetParentId(), pt->W());
} else {
fprintf(asciif," %e %e %e %e %i %i %i %i %e\n",
pt->E(), pt->Px(), pt->Py(), pt->Pz(),
pt->ID(), pt->GetSourceId(), pt->GetParentId(), pt->GetParentIndex(), pt->W());
}
}
} else {
cnt = 0;
for(k=0; k<size_tracked; ++k)
if (stable_particle[k]->IsActive()==kTRUE) cnt++;
if (writeINDEX==0) {
fprintf(asciif, " %i %i %f %f 4\n",
PReaction::globalEventCounter, cnt,
channel[0]->GetBT(), *event_impact_param);
} else {
if(channel) {
fprintf(asciif, " %i %i %f %f -4\n",
PReaction::globalEventCounter,cnt,
channel[0]->GetBT(), *event_impact_param);
} else {
fprintf(asciif, " %i %i %f %f -4\n",
PReaction::globalEventCounter, cnt, 0., *event_impact_param);
}
}
for (k=0; k<size_tracked; ++k) {
PParticle *pt = stable_particle[k];
if (pt->IsActive() == kFALSE) continue;
if (writeINDEX == 0) {
fprintf(asciif, " %e %e %e %e %e %e %e %e %i %i %i %e\n",
pt->E(), pt->Px(), pt->Py(), pt->Pz(),
pt->T()/300., pt->X(), pt->Y(), pt->Z(),
pt->ID(), pt->GetSourceId(), pt->GetParentId(), pt->W());
} else {
fprintf(asciif, " %e %e %e %e %e %e %e %e %i %i %i %i %e\n",
pt->E(), pt->Px(), pt->Py(), pt->Pz(),
pt->T()/300., pt->X(), pt->Y(), pt->Z(),
pt->ID(), pt->GetSourceId(), pt->GetParentId(),
pt->GetParentIndex(), pt->W());
}
}
}
}
if (!HGeant) {
cnt = 0;
pclone = evt[0];
pclone->Delete();
for (k=0; k<size; ++k) {
if (particle_stack[k]->IsActive() == kFALSE)
continue;
if (!allPARTICLES && decay_done[k])
continue;
particle_stack[k]->SetT(particle_stack[k]->T()/300.);
int save_sclone = particle_stack[k]->GetScatterClone();
particle_stack[k]->SetScatterClone(0);
(*pclone)[cnt] = new((*pclone)[cnt]) PParticle(*particle_stack[k]);
particle_stack[k]->SetScatterClone(save_sclone);
cnt++;
}
activeCnt = cnt;
for (int i=0; i<size_branches; i++) {
pclone = evt[i+1];
pclone->Delete();
for (k=0; k<(current_size_branches[i]); k++) {
(*pclone)[k] = new((*pclone)[k]) PParticle(*(p_array_branches[i*stacksize + k]));
cnt++;
}
}
for (int z=0; z<fileoutput_pos; z++) {
files[z]->SetHeader(cnt, allPARTICLES, getVERTEX, asciiOUTPUT, writeINDEX , channel, nchan);
files[z]->WriteEventHeader();
files[z]->SetBranchHeader(activeCnt, 0, "Particles");
files[z]->WriteBranchHeader();
files[z]->Modify(particle_stack,
decay_done, &size,
stacksize);
for (k=0; k<size; ++k) {
if (particle_stack[k]->IsActive() == kFALSE)
continue;
if (!allPARTICLES && decay_done[k])
continue;
files[z]->WriteParticle(particle_stack[k]);
}
for (int i=0; i<size_branches; i++) {
files[z]->SetBranchHeader(current_size_branches[i], i+1, makeDataBase()->GetName(key_branches[i]));
files[z]->WriteBranchHeader();
for (k=0; k<(current_size_branches[i]); k++) {
files[z]->WriteParticle(p_array_branches[i*stacksize + k]);
}
}
files[z]->WriteEvent();
}
if ((tree) && ((strlen(filename)>0) || extTREE))
tree->Fill();
}
}
#if 0
if (bulkdecay_pos) {
for (k=0;k<stacksize;k++) delete p_array[k];
}
#endif
timer.Stop();
if (verbose) printf(" Event loop finished after %f sec\n CPU time %f sec\n",
timer.RealTime()-t0,timer.CpuTime());
if (wf && verbose) printf("\n Total of %i events processed (incl. repeated empty evts.)\n\n", PReaction::globalEventCounter+empty_count);
if (error_count && verbose) {
printf(" %i aborted events were repeated, error codes:\n ",error_count);
for (int i=0; i<100; i++)
if (error_count_array[i])
printf("%i=%i ",i,error_count_array[i]);
printf("\n");
}
for (i=0; i<num_filters; i++)
if (filter_counter[i]) printf(" %i events failed filter %s\n",filter_counter[i],
makeDataBase()->GetName(filter_keys[i]));
if (asciiOUTPUT==1) fclose(asciif);
if (tree) {
if (!extTREE && (strlen(filename) > 0)) {
rootfile = tree->GetCurrentFile();
rootfile->Write();
rootfile->Close();
rootfile=NULL;
tree=NULL;
}
}
if (sub_reaction) {
if (evt[0]) evt[0]=NULL;
good_event+=sub_reaction->Loop(nevents, wf, verbose);
}
return good_event;
}
void PReaction::SetFilter(int, PFilter *) {
Error("SetFilter", "The PFilter class has been removed. Use PProjector instead");
}
void PReaction::Close() {
if (!extTREE && (strlen(filename) > 0))
rootfile->Close();
else printf("%s\n", RMessage[0]);
}
void PReaction::PrintReport() const {
printf(" Reaction Channels:\n");
for (int j=0; j<nchan; ++j) {
printf(" %i. ",j+1);
channel[j]->PrintReport();
}
}
void PReaction::Print(const Option_t *delme) const {
int ii=0, esize=nclones-ndpar, j=esize, iid;
printf("\n Reaction of %i Particles interacting via %i Channels\n",nclones,nchan);
printf(" Reaction Particles:\n");
if (esize == 2) {
printf(" 0. %s (beam)\n",particle[0]->Name());
printf(" 1. %s (target)\n",particle[1]->Name());
} else if (esize == 1) {
printf(" 0.");
iid=particle[0]->ID();
if (iid < 1000) {
if (particle[0]->IsFireball() )
printf(" Fireball (%s) \n",makeStaticData()->GetParticleName(particle[0]->ID()-500));
else if (particle[0]->IsFileInput() )
printf(" File Input (%s) \n",particle[0]->Name());
else if (particle[0]->IsDilepton() )
printf(" Source of %ss \n",makeStaticData()->GetParticleName(particle[0]->ID()-500));
else
printf(" %s (decay)\n",particle[0]->Name());
} else {
printf(" quasi-particle (%s beam and %s target)\n",
makeStaticData()->GetParticleName(iid%1000),makeStaticData()->GetParticleName(iid/1000));
}
}
for (;j<nclones; ++j) {
printf(" %i. %s",j,makeStaticData()->GetParticleName(particle[j]->ID()));
if ((!allPARTICLES||asciiOUTPUT)*ftrack[j]) {
printf(" (tracked particle %i)\n",ii);
++ii;
} else { printf("\n"); }
}
printf(" Reaction Channels:\n");
for (j=0; j<nchan; ++j) {
printf(" %i. ",j+1);
channel[j]->Print(delme);
}
if (bulkdecay_pos || pro_bulkdecay_pos) {
printf(" Bulk Classes:\n");
if (pro_bulkdecay_pos) {
printf(" Prologue: ");
for (j=0; j<pro_bulkdecay_pos; j++)
cout << "<" << pro_bulk[j]->ClassName() << "> ";
cout << endl;
}
if (bulkdecay_pos) {
printf(" Epilogue: ");
for (j=0; j<bulkdecay_pos; j++)
cout << "<" << bulk[j]->ClassName() << "> ";
cout << endl;
}
}
if (fileoutput_pos || strlen(filename)>0) {
printf(" Output File(s):\n");
if (strlen(filename) > 0) {
printf(" Root : '%s', %s", (const char*)file2, OType[allPARTICLES]);
if (getVERTEX)
printf(" including vertices.\n");
else
printf(".\n");
if (asciiOUTPUT)
printf(" ASCII: '%s', %s\n", (const char*)file1, OType[0]);
}
for (int i=0; i<fileoutput_pos; i++) {
printf(" User-file: '%s', %s\n", files[i]->GetFilename(), OType[allPARTICLES]);
}
if (size_branches) {
printf(" Output Branches(s):\n");
printf(" 'Particles'\n");
for (int i=0; i<size_branches; i++) {
printf(" '%s'\n", makeDataBase()->GetName(key_branches[i]));
}
}
}
else
printf(" *NO* output File\n");
if (sub_reaction) {
printf("++++++++++++++++++++");
sub_reaction->Print();
}
}
void PReaction::SetUserSelection(void *) {
Error("SetUserSelection", "Does not work in ROOT6");
#if 0
userSelection = NULL;
if (!f) return ;
Int_t type = G__isinterpretedp2f(f);
if (type==0 || type==3) {
userSelection = (int (*)(PParticle*))f;
printf("\n>>> User selection ");
} else {
char *funcname = G__p2f2funcname(f);
TMethodCall *fMethodCall = NULL;
if (funcname) {
fMethodCall = new TMethodCall();
fMethodCall->InitWithPrototype(funcname, "PParticle*");
} else {
printf("Function: %s cannot be compiled\n", funcname);
return;
}
gMethodCall1 = fMethodCall;
userSelection = CalledSelection;
printf("\n>>> User selection %s() ",funcname);
}
(*userSelection)((PParticle*)-1);
#endif
}
Int_t CalledSelection(PParticle*) {
Error("CalledSelection", "Does not work in ROOT6");
#if 0
Long_t args[1];
args[0] = (Long_t)p;
gMethodCall1->SetParamPtrs(args);
Long_t result;
gMethodCall1->Execute(result);
return (Int_t)result;
#endif
return -1;
}
void PReaction::SetUserAnalysis(void *) {
Error("SetUserAnalysis", "Does not work in ROOT6");
#if 0
userAnalysis = NULL;
if (!f) return ;
Int_t type = G__isinterpretedp2f(f);
if (type==0 || type==3) {
userAnalysis = (int (*)(PParticle**,int))f;
printf("\n>>> User analysis ");
} else {
char *funcname = G__p2f2funcname(f);
TMethodCall *fMethodCall=NULL;
if (funcname) {
fMethodCall = new TMethodCall();
fMethodCall->InitWithPrototype(funcname, "PParticle**,Int_t");
} else {
printf("Function: %s cannot be compiled\n", funcname);
return;
}
gMethodCall2 = fMethodCall;
userAnalysis = CalledAnalysis;
printf("\n>>> User analysis %s() ",funcname);
}
(*userAnalysis)((PParticle**)-1,0);
#endif
}
Int_t CalledAnalysis(PParticle **, Int_t) {
Error("CalledAnalysis", "Does not work in ROOT6");
#if 0
Long_t args[2];
args[0] = (Long_t)p;
args[1] = (Long_t)n;
gMethodCall2->SetParamPtrs(args);
Long_t result;
gMethodCall2->Execute(result);
return (Int_t)result;
#endif
return -1;
}