HI Danilo,
The code is in c++ with many classes, each having function of analysing data of different parts of the detectors. The update was in the part where we apply particle identification using Graphical cuts (saved as .root file). Those graphical cuts were made long time ago and it was being used in one of the classes. Later the code developed and there were more than one class which would require this .root files of the cuts. And therefore the last update was made to create a special class which simply holds the cuts and one can call them by extern function into other classes. To show you a bit, I will paste part of some code below:
Below the code defines the function of cut which reads the root file, this can be called to any class which requires it.
......
Int_t Init_TGPID(Char_t *fInFileCutsP, Char_t *fInFileCutsD)
{
fprintf(stderr, "PID 3 entering");
if(Meth_3) return 1; // already initiated
else Meth_3 = kTRUE;
//gDirectory->pwd();
TDirectory *curdir = new TDirectory;
curdir = gDirectory->CurrentDirectory();
fcutsD=TFile::Open(fInFileCutsD,"read");
for (int e =0; e<5; e++){
for (int de=0;de<12;de++){
char cutName[50];
sprintf(cutName,"d_%d_%d",e,de);
fprintf(stderr, cutName);
dCut[e][de]=(TCutG *)fcutsD->Get(cutName)->Clone();
}
}
for (int e =5; e<10; e++){
for (int de=12;de<24;de++){
char cutName[50];
sprintf(cutName,"d_%d_%d",e,de);
fprintf(stderr, cutName);
dCut[e][de]=(TCutG *)fcutsD->Get(cutName)->Clone();
}
}
fcutsD->Close();
fcutsP=TFile::Open(fInFileCutsP,"read");
for (int e =0; e<5; e++){
for (int de=0;de<12;de++){
char cutName[50];
sprintf(cutName,"p_%d_%d",e,de);
//fprintf(stderr, cutName);
pCut[e][de]=(TCutG *)fcutsP->Get(cutName)->Clone();
}
}
for (int e =5; e<10; e++){
for (int de=12;de<24;de++){
char cutName[50];
sprintf(cutName,"p_%d_%d",e,de);
//fprintf(stderr, cutName);
pCut[e][de]=(TCutG *)fcutsP->Get(cutName)->Clone();
}
}
fcutsP->Close();
curdir->cd();
return 1;
}
......
......
INTU2 PID3(float che, int chde, int e, int de)
{
// Function should be used to fill Event.P1Type..
// 0 <--- Unidentified
// 1 <--- Proton
// 2 <--- Deuteron
if(!Meth_3) // not initiated ???
{
fprintf(stderr, "PID method 3 requested but not initiated\n");
exit(0);
}
int partType=0;
if ((e<5 && de>11) || (e>4 && de<12)) return 0;
if(dCut[e][de]->IsInside(che,chde))partType=2;
if(pCut[e][de]->IsInside(che,chde))partType=1;
//fprintf(stderr, "\t bla bla %i,%i,%i",partType, e,de);
return partType;
}
Below the line shows how the function is called inside other classs:
.....
extern Int_t Init_TGPID(Char_t *InFileCutsP, Char_t *InFileCutsD);
.....
Gunn