/*
$Log$
+Revision 1.14 1999/10/22 08:16:49 fca
+Correct destructors, thanks to I.Hrivnacova
+
Revision 1.13 1999/10/06 10:15:19 fca
Correct bug in allocation of layer name and add destructor
FILE *file = fopen(filtmp,"r");
if(file) {
fclose(file);
-// gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
- gAlice->ReadEuclidMedia(filtmp,this);
+// ReadEuclidMedia(fEuclidMaterial.Data());
+ ReadEuclidMedia(filtmp);
} else {
Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
// fEuclidMaterial.Data());
if(file) {
fclose(file);
printf("Ready to read Euclid geometry file\n");
- gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
+ ReadEuclid(fEuclidGeometry.Data(),topvol);
printf("Read in euclid geometries\n");
} else {
Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
/*
$Log$
+Revision 1.9 1999/12/03 10:54:01 fca
+Fix lego summary
+
Revision 1.8 1999/10/01 09:54:33 fca
Correct logics for Lego StepManager
#include "AliLego.h"
#include "AliRun.h"
#include "AliConst.h"
+#include "AliVMC.h"
ClassImp(AliLego)
}
//___________________________________________
-AliLego::AliLego(const char *name, const char *title)
- : TNamed(name,title)
+AliLego::AliLego(const char *title, Int_t ntheta, Float_t themin, Float_t themax,
+ Int_t nphi, Float_t phimin, Float_t phimax,
+ Float_t rmin, Float_t rmax, Float_t zmax)
+ : TNamed("Lego Generator",title)
{
- fHistRadl = 0;
- fHistAbso = 0;
- fHistGcm2 = 0;
- fHistReta = 0;
+// specify the angular limits and the size of the rectangular box
+
+ fGener = new AliLegoGenerator(ntheta, themin, themax,
+ nphi, phimin, phimax, rmin, rmax, zmax);
+
+ gAlice->SetGenerator(fGener);
+
+ Float_t etamin = -TMath::Log(TMath::Tan(TMath::Min((Double_t)themax*kDegrad/2,TMath::Pi()/2-1.e-10)));
+ Float_t etamax = -TMath::Log(TMath::Tan(TMath::Max((Double_t)themin*kDegrad/2, 1.e-10)));
+
+ fHistRadl = new TH2F("hradl","Radiation length map",
+ nphi,phimin,phimax,ntheta,themin,themax);
+ fHistAbso = new TH2F("habso","Interaction length map",
+ nphi,phimin,phimax,ntheta,themin,themax);
+ fHistGcm2 = new TH2F("hgcm2","g/cm2 length map",
+ nphi,phimin,phimax,ntheta,themin,themax);
+ fHistReta = new TH2F("hetar","Radiation length vs. eta",
+ nphi,phimin,phimax,ntheta,etamin,etamax);
+
}
//___________________________________________
delete fHistReta;
}
+
+//___________________________________________
+void AliLego::Run()
+{
+ // loop on phi,theta bins
+ gMC->InitLego();
+ Float_t thed, phid, eta;
+ for (Int_t i=0; i<=fGener->Nphi()*fGener->Ntheta(); ++i) {
+// --- Set to 0 radiation length, absorption length and g/cm2 ---
+ fTotRadl = 0;
+ fTotAbso = 0;
+ fTotGcm2 = 0;
+
+ gVMC->ProcessEvent();
+
+ thed = fGener->CurTheta()*kRaddeg;
+ phid = fGener->CurPhi()*kRaddeg;
+ eta = -TMath::Log(TMath::Tan(TMath::Max(
+ TMath::Min((Double_t)(fGener->CurTheta())/2,
+ TMath::Pi()/2-1.e-10),1.e-10)));
+
+ fHistRadl->Fill(phid,thed,fTotRadl);
+ fHistAbso->Fill(phid,thed,fTotAbso);
+ fHistGcm2->Fill(phid,thed,fTotGcm2);
+ fHistReta->Fill(phid,eta,fTotRadl);
+ gAlice->FinishEvent();
+ }
+ // store histograms in current Root file
+ fHistRadl->Write();
+ fHistAbso->Write();
+ fHistGcm2->Write();
+ fHistReta->Write();
+}
+
+//___________________________________________
+void AliLego::StepManager()
+{
+// called from AliRun::Stepmanager from gustep.
+// Accumulate the 3 parameters step by step
+
+ static Float_t t;
+ Float_t a,z,dens,radl,absl;
+ Int_t i;
+
+ Float_t step = gMC->TrackStep();
+
+ Float_t vect[3], dir[3];
+ TLorentzVector pos, mom;
+
+ gMC->TrackPosition(pos);
+ gMC->TrackMomentum(mom);
+ gMC->CurrentMaterial(a,z,dens,radl,absl);
+
+ if (z < 1) return;
+
+// --- See if we have to stop now
+ if (TMath::Abs(pos[2]) > fGener->ZMax() ||
+ pos[0]*pos[0] +pos[1]*pos[1] > fGener->RadMax()*fGener->RadMax()) {
+ if (gMC->TrackLength()) {
+ // Not the first step, add past contribution
+ fTotAbso += t/absl;
+ fTotRadl += t/radl;
+ fTotGcm2 += t*dens;
+ }
+ gMC->StopTrack();
+ return;
+ }
+
+// --- See how long we have to go
+ for(i=0;i<3;++i) {
+ vect[i]=pos[i];
+ dir[i]=mom[i];
+ }
+
+ t = fGener->PropagateCylinder(vect,dir,fGener->RadMax(),fGener->ZMax());
+
+ if(step) {
+ fTotAbso += step/absl;
+ fTotRadl += step/radl;
+ fTotGcm2 += step*dens;
+ }
+}
+
+ClassImp(AliLegoGenerator)
+
+//___________________________________________
+AliLegoGenerator::AliLegoGenerator(Int_t ntheta, Float_t themin,
+ Float_t themax, Int_t nphi,
+ Float_t phimin, Float_t phimax,
+ Float_t rmin, Float_t rmax, Float_t zmax) :
+ AliGenerator(0), fRadMin(rmin), fRadMax(rmax), fZMax(zmax), fNtheta(ntheta),
+ fNphi(nphi), fThetaBin(ntheta), fPhiBin(-1), fCurTheta(0), fCurPhi(0)
+
+{
+ SetPhiRange(phimin,phimax);
+ SetThetaRange(themin,themax);
+ SetName("Lego");
+}
+
+
//___________________________________________
-void AliLego::GenerateKinematics()
+void AliLegoGenerator::Generate()
{
// Create a geantino with kinematics corresponding to the current
// bins in theta and phi.
Float_t orig[3], pmom[3];
Float_t t, cost, sint, cosp, sinp;
-// --- Set to 0 radiation length, absorption length and g/cm2 ---
- fTotRadl = 0;
- fTotAbso = 0;
- fTotGcm2 = 0;
+ // Prepare for next step
+ if(fThetaBin>=fNtheta-1)
+ if(fPhiBin>=fNphi-1) {
+ Warning("Generate","End of Lego Generation");
+ return;
+ } else {
+ fPhiBin++;
+ printf("Generating rays in phi bin:%d\n",fPhiBin);
+ fThetaBin=0;
+ } else fThetaBin++;
- fCurTheta = (fThetaMin+(fThetaBin-0.5)*(fThetaMax-fThetaMin)/fNtheta)*kDegrad;
- fCurPhi = (fPhiMin+(fPhiBin-0.5)*(fPhiMax-fPhiMin)/fNphi)*kDegrad;
+ fCurTheta = (fThetaMin+(fThetaBin+0.5)*(fThetaMax-fThetaMin)/fNtheta);
+ fCurPhi = (fPhiMin+(fPhiBin+0.5)*(fPhiMax-fPhiMin)/fNphi);
cost = TMath::Cos(fCurTheta);
sint = TMath::Sin(fCurTheta);
cosp = TMath::Cos(fCurPhi);
sinp = TMath::Sin(fCurPhi);
-
+
pmom[0] = cosp*sint;
pmom[1] = sinp*sint;
pmom[2] = cost;
-
-// --- Where to start
+
+ // --- Where to start
orig[0] = orig[1] = orig[2] = 0;
Float_t dalicz = 3000;
if (fRadMin > 0) {
- t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
- orig[0] = pmom[0]*t;
- orig[1] = pmom[1]*t;
- orig[2] = pmom[2]*t;
- if (TMath::Abs(orig[2]) > fZMax) return;
+ t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
+ orig[0] = pmom[0]*t;
+ orig[1] = pmom[1]*t;
+ orig[2] = pmom[2]*t;
+ if (TMath::Abs(orig[2]) > fZMax) return;
}
-
-// --- We do start here
+
Float_t polar[3]={0.,0.,0.};
Int_t ntr;
gAlice->SetTrack(1, 0, mpart, pmom, orig, polar, 0, "LEGO ray", ntr);
-}
-
-//___________________________________________
-void AliLego::Init(Int_t ntheta,Float_t themin,Float_t themax,
- Int_t nphi,Float_t phimin,Float_t phimax,Float_t rmin,Float_t rmax,
- Float_t zmax)
-{
-// specify the angular limits and the size of the rectangular box
- fNtheta = ntheta;
- fThetaMin = themin;
- fThetaMax = themax;
- fNphi = nphi;
- fPhiMin = phimin;
- fPhiMax = phimax;
- fRadMin = rmin;
- fRadMax = rmax;
- fZMax = zmax;
- Float_t etamin = -TMath::Log(TMath::Tan(TMath::Min((Double_t)fThetaMax*kDegrad/2,TMath::Pi()/2-1.e-10)));
- Float_t etamax = -TMath::Log(TMath::Tan(TMath::Max((Double_t)fThetaMin*kDegrad/2, 1.e-10)));
-
- fHistRadl = new TH2F("hradl","Radiation length map", nphi,phimin,phimax,ntheta,themin,themax);
- fHistAbso = new TH2F("habso","Interaction length map", nphi,phimin,phimax,ntheta,themin,themax);
- fHistGcm2 = new TH2F("hgcm2","g/cm2 length map", nphi,phimin,phimax,ntheta,themin,themax);
- fHistReta = new TH2F("hetar","Radiation length vs. eta",nphi,phimin,phimax,ntheta,etamin,etamax);
}
//___________________________________________
-Float_t AliLego::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z)
+Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z)
{
// Propagate to cylinder from inside
return t;
}
-//___________________________________________
-void AliLego::Run()
-{
- // loop on phi,theta bins
- gMC->InitLego();
- Float_t thed, phid, eta;
- for (fPhiBin=1; fPhiBin<=fNphi; fPhiBin++) {
- printf("AliLego Generating rays in phi bin:%d\n",fPhiBin);
- for (fThetaBin=1; fThetaBin<=fNtheta; fThetaBin++) {
- gMC->Gtrigi();
- gMC->Gtrigc();
- GenerateKinematics();
- gMC->Gtreve_root();
-
- thed = fCurTheta*kRaddeg;
- phid = fCurPhi*kRaddeg;
- eta = -TMath::Log(TMath::Tan(TMath::Max(
- TMath::Min((Double_t)fCurTheta/2,TMath::Pi()/2-1.e-10),1.e-10)));
- fHistRadl->Fill(phid,thed,fTotRadl);
- fHistAbso->Fill(phid,thed,fTotAbso);
- fHistGcm2->Fill(phid,thed,fTotGcm2);
- fHistReta->Fill(phid,eta,fTotRadl);
- gAlice->FinishEvent();
- }
- }
- // store histograms in current Root file
- fHistRadl->Write();
- fHistAbso->Write();
- fHistGcm2->Write();
- fHistReta->Write();
-}
-
-//___________________________________________
-void AliLego::StepManager()
-{
-// called from AliRun::Stepmanager from gustep.
-// Accumulate the 3 parameters step by step
-
- static Float_t t;
- Float_t a,z,dens,radl,absl;
- Int_t i;
-
- Float_t step = gMC->TrackStep();
-
- Float_t vect[3], dir[3];
- TLorentzVector pos, mom;
-
- gMC->TrackPosition(pos);
- gMC->TrackMomentum(mom);
- gMC->CurrentMaterial(a,z,dens,radl,absl);
-
- if (z < 1) return;
-
-// --- See if we have to stop now
- if (TMath::Abs(pos[2]) > fZMax ||
- pos[0]*pos[0] +pos[1]*pos[1] > fRadMax*fRadMax) {
- if (gMC->TrackLength()) {
- // Not the first step, add past contribution
- fTotAbso += t/absl;
- fTotRadl += t/radl;
- fTotGcm2 += t*dens;
- }
- gMC->StopTrack();
- return;
- }
-
-// --- See how long we have to go
- for(i=0;i<3;++i) {
- vect[i]=pos[i];
- dir[i]=mom[i];
- }
-
- t = PropagateCylinder(vect,dir,fRadMax,fZMax);
-
- fTotAbso += step/absl;
- fTotRadl += step/radl;
- fTotGcm2 += step*dens;
-}
-
#include <TH2.h>
+#include "AliGenerator.h"
+
+class AliLegoGenerator;
+
class AliLego : public TNamed {
private:
- Float_t fThetaMin; //Minimum generation theta
- Float_t fThetaMax; //Maximum generation theta
- Float_t fPhiMin; //Minimum generation phi
- Float_t fPhiMax; //Maximum generation phi
- Float_t fRadMin; //Generation radius
- Float_t fRadMax; //Maximum tracking radius
- Float_t fZMax; //Maximum tracking Z
- Int_t fNtheta; //Number of bins in Theta
- Int_t fNphi; //Number of bins in Phi
- Int_t fThetaBin; //Current theta bin
- Int_t fPhiBin; //Current phi bin
- Float_t fCurTheta; //Current theta of track
- Float_t fCurPhi; //Current phi of track
+ AliLegoGenerator *fGener; //Lego generator
Float_t fTotRadl; //Total Radiation length
Float_t fTotAbso; //Total absorption length
Float_t fTotGcm2; //Total G/CM2 traversed
public:
AliLego();
- AliLego(const char *name, const char *title);
+ AliLego(const char *title, Int_t ntheta,Float_t themin,
+ Float_t themax, Int_t nphi, Float_t phimin,
+ Float_t phimax,Float_t rmin,Float_t rmax,Float_t zmax);
virtual ~AliLego();
- virtual void GenerateKinematics();
- virtual void Init(Int_t ntheta,Float_t themin,Float_t themax, Int_t nphi, Float_t phimin,
- Float_t phimax,Float_t rmin,Float_t rmax,Float_t zmax);
- Float_t PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z);
virtual void Run();
virtual void StepManager();
};
+class AliLegoGenerator : public AliGenerator
+{
+public:
+ AliLegoGenerator() {}
+ AliLegoGenerator(Int_t ntheta, Float_t themin, Float_t themax,
+ Int_t nphi, Float_t phimin, Float_t phimax,
+ Float_t rmin, Float_t rmax, Float_t zmax);
+ void Generate();
+ Float_t CurTheta() const {return fCurTheta;}
+ Int_t ThetaBin() const {return fThetaBin;}
+ Float_t CurPhi() const {return fCurPhi;}
+ Float_t ZMax() const {return fZMax;}
+ Float_t RadMax() const {return fRadMax;}
+ Int_t PhiBin() const {return fPhiBin;}
+ Int_t Nphi() const {return fNphi;}
+ Int_t Ntheta() const {return fNtheta;}
+ Float_t PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z);
+private:
+ Float_t fRadMin; //Generation radius
+ Float_t fRadMax; //Maximum tracking radius
+ Float_t fZMax; //Maximum tracking Z
+ Int_t fNtheta; //Number of bins in Theta
+ Int_t fNphi; //Number of bins in Phi
+ Int_t fThetaBin; //Current theta bin
+ Int_t fPhiBin; //Current phi bin
+ Float_t fCurTheta; //Current theta of track
+ Float_t fCurPhi; //Current phi of track
+
+ ClassDef(AliLegoGenerator,1) //Lego generator
+};
+
#endif
//Generic access functions
static inline AliMC* GetMC() {return fgMC;}
//
+ virtual void FinishGeometry() = 0;
virtual Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const =0;
virtual Int_t CurrentVolID(Int_t&) const =0;
virtual Int_t CurrentVolOffID(Int_t, Int_t& ) const =0;
virtual void Gdhead(Int_t, const char*, Float_t=0)=0;
virtual void Gdman(Float_t, Float_t, const char*)=0;
virtual void Gsord(const char *name, Int_t iax)=0;
- virtual void Ggclos()=0;
virtual void SetColors()=0;
- virtual void Gphysi()=0;
- virtual void Gtrigi()=0;
virtual void Gtreve()=0;
virtual void Gtreve_root()=0;
- virtual void Gtrigc()=0;
- virtual void Gtrig()=0;
virtual void Gckmat(Int_t, char*)=0;
virtual void InitLego()=0;
virtual void Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&)=0;
/*
$Log$
+Revision 1.7 1999/09/29 09:24:29 fca
+Introduction of the Copyright and cvs Log
+
*/
///////////////////////////////////////////////////////////////////////////////
//
// Store the parameters of a tracking medium
//
- // numed the medium number is stored into (*fIdtmed)[numed-1]
+ // numed the medium number is stored into (*fIdtmed)[numed]
// name medium name
// nmat the material number is stored into (*fIdmate)[nmat]
// isvol sensitive volume if isvol!=0
}
}
+//_____________________________________________________________________________
+void AliModule::ReadEuclid(const char* filnam, char* topvol)
+{
+ //
+ // read in the geometry of the detector in euclid file format
+ //
+ // id_det : the detector identification (2=its,...)
+ // topvol : return parameter describing the name of the top
+ // volume of geometry.
+ //
+ // author : m. maire
+ //
+ // 28.07.98
+ // several changes have been made by miroslav helbich
+ // subroutine is rewrited to follow the new established way of memory
+ // booking for tracking medias and rotation matrices.
+ // all used tracking media have to be defined first, for this you can use
+ // subroutine greutmed.
+ // top volume is searched as only volume not positioned into another
+ //
+
+ Int_t i, nvol, iret, itmed, irot, numed, npar, ndiv, iaxe;
+ Int_t ndvmx, nr, flag;
+ char key[5], card[77], natmed[21];
+ char name[5], mother[5], shape[5], konly[5], volst[7000][5];
+ char *filtmp;
+ Float_t par[50];
+ Float_t teta1, phi1, teta2, phi2, teta3, phi3, orig, step;
+ Float_t xo, yo, zo;
+ const Int_t maxrot=5000;
+ Int_t idrot[maxrot],istop[7000];
+ FILE *lun;
+ //
+ // *** The input filnam name will be with extension '.euc'
+ filtmp=gSystem->ExpandPathName(filnam);
+ lun=fopen(filtmp,"r");
+ delete [] filtmp;
+ if(!lun) {
+ Error("ReadEuclid","Could not open file %s\n",filnam);
+ return;
+ }
+ //* --- definition of rotation matrix 0 ---
+ TArrayI &idtmed = *fIdtmed;
+ for(i=1; i<maxrot; ++i) idrot[i]=-99;
+ idrot[0]=0;
+ nvol=0;
+ L10:
+ for(i=0;i<77;i++) card[i]=0;
+ iret=fscanf(lun,"%77[^\n]",card);
+ if(iret<=0) goto L20;
+ fscanf(lun,"%*c");
+ //*
+ strncpy(key,card,4);
+ key[4]='\0';
+ if (!strcmp(key,"TMED")) {
+ sscanf(&card[5],"%d '%[^']'",&itmed,natmed);
+ if( itmed<0 || itmed>=100 ) {
+ Error("ReadEuclid","TMED illegal medium number %d for %s\n",itmed,natmed);
+ exit(1);
+ }
+ //Pad the string with blanks
+ i=-1;
+ while(natmed[++i]);
+ while(i<20) natmed[i++]=' ';
+ natmed[i]='\0';
+ //
+ if( idtmed[itmed]<=0 ) {
+ Error("ReadEuclid","TMED undefined medium number %d for %s\n",itmed,natmed);
+ exit(1);
+ }
+ gMC->Gckmat(idtmed[itmed],natmed);
+ //*
+ } else if (!strcmp(key,"ROTM")) {
+ sscanf(&card[4],"%d %f %f %f %f %f %f",&irot,&teta1,&phi1,&teta2,&phi2,&teta3,&phi3);
+ if( irot<=0 || irot>=maxrot ) {
+ Error("ReadEuclid","ROTM rotation matrix number %d illegal\n",irot);
+ exit(1);
+ }
+ AliMatrix(idrot[irot],teta1,phi1,teta2,phi2,teta3,phi3);
+ //*
+ } else if (!strcmp(key,"VOLU")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, shape, &numed, &npar);
+ if (npar>0) {
+ for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
+ fscanf(lun,"%*c");
+ }
+ gMC->Gsvolu( name, shape, idtmed[numed], par, npar);
+ //* save the defined volumes
+ strcpy(volst[++nvol],name);
+ istop[nvol]=1;
+ //*
+ } else if (!strcmp(key,"DIVN")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, mother, &ndiv, &iaxe);
+ gMC->Gsdvn ( name, mother, ndiv, iaxe );
+ //*
+ } else if (!strcmp(key,"DVN2")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d %f %d",name, mother, &ndiv, &iaxe, &orig, &numed);
+ gMC->Gsdvn2( name, mother, ndiv, iaxe, orig,idtmed[numed]);
+ //*
+ } else if (!strcmp(key,"DIVT")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %f %d %d %d", name, mother, &step, &iaxe, &numed, &ndvmx);
+ gMC->Gsdvt ( name, mother, step, iaxe, idtmed[numed], ndvmx);
+ //*
+ } else if (!strcmp(key,"DVT2")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %f %d %f %d %d", name, mother, &step, &iaxe, &orig, &numed, &ndvmx);
+ gMC->Gsdvt2 ( name, mother, step, iaxe, orig, idtmed[numed], ndvmx );
+ //*
+ } else if (!strcmp(key,"POSI")) {
+ sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']'", name, &nr, mother, &xo, &yo, &zo, &irot, konly);
+ if( irot<0 || irot>=maxrot ) {
+ Error("ReadEuclid","POSI %s#%d rotation matrix number %d illegal\n",name,nr,irot);
+ exit(1);
+ }
+ if( idrot[irot] == -99) {
+ Error("ReadEuclid","POSI %s#%d undefined matrix number %d\n",name,nr,irot);
+ exit(1);
+ }
+ //*** volume name cannot be the top volume
+ for(i=1;i<=nvol;i++) {
+ if (!strcmp(volst[i],name)) istop[i]=0;
+ }
+ //*
+ gMC->Gspos ( name, nr, mother, xo, yo, zo, idrot[irot], konly );
+ //*
+ } else if (!strcmp(key,"POSP")) {
+ sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']' %d", name, &nr, mother, &xo, &yo, &zo, &irot, konly, &npar);
+ if( irot<0 || irot>=maxrot ) {
+ Error("ReadEuclid","POSP %s#%d rotation matrix number %d illegal\n",name,nr,irot);
+ exit(1);
+ }
+ if( idrot[irot] == -99) {
+ Error("ReadEuclid","POSP %s#%d undefined matrix number %d\n",name,nr,irot);
+ exit(1);
+ }
+ if (npar > 0) {
+ for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
+ fscanf(lun,"%*c");
+ }
+ //*** volume name cannot be the top volume
+ for(i=1;i<=nvol;i++) {
+ if (!strcmp(volst[i],name)) istop[i]=0;
+ }
+ //*
+ gMC->Gsposp ( name, nr, mother, xo,yo,zo, idrot[irot], konly, par, npar);
+ }
+ //*
+ if (strcmp(key,"END")) goto L10;
+ //* find top volume in the geometry
+ flag=0;
+ for(i=1;i<=nvol;i++) {
+ if (istop[i] && flag) {
+ Warning("ReadEuclid"," %s is another possible top volume\n",volst[i]);
+ }
+ if (istop[i] && !flag) {
+ strcpy(topvol,volst[i]);
+ printf(" *** GREUCL *** volume %s taken as a top volume\n",topvol);
+ flag=1;
+ }
+ }
+ if (!flag) {
+ Warning("ReadEuclid","top volume not found\n");
+ }
+ fclose (lun);
+ //*
+ //* commented out only for the not cernlib version
+ printf(" *** GREUCL *** file: %s is now read in\n",filnam);
+ //
+ return;
+ //*
+ L20:
+ Error("ReadEuclid","reading error or premature end of file\n");
+}
+
+//_____________________________________________________________________________
+void AliModule::ReadEuclidMedia(const char* filnam)
+{
+ //
+ // read in the materials and tracking media for the detector
+ // in euclid file format
+ //
+ // filnam: name of the input file
+ // id_det: id_det is the detector identification (2=its,...)
+ //
+ // author : miroslav helbich
+ //
+ Float_t sxmgmx = gAlice->Field()->Max();
+ Int_t isxfld = gAlice->Field()->Integ();
+ Int_t end, i, iret, itmed;
+ char key[5], card[130], natmed[21], namate[21];
+ Float_t ubuf[50];
+ char* filtmp;
+ FILE *lun;
+ Int_t imate;
+ Int_t nwbuf, isvol, ifield, nmat;
+ Float_t a, z, dens, radl, absl, fieldm, tmaxfd, stemax, deemax, epsil, stmin;
+ //
+ end=strlen(filnam);
+ for(i=0;i<end;i++) if(filnam[i]=='.') {
+ end=i;
+ break;
+ }
+ //
+ // *** The input filnam name will be with extension '.euc'
+ printf("The file name is %s\n",filnam); //Debug
+ filtmp=gSystem->ExpandPathName(filnam);
+ lun=fopen(filtmp,"r");
+ delete [] filtmp;
+ if(!lun) {
+ Warning("ReadEuclidMedia","Could not open file %s\n",filnam);
+ return;
+ }
+ //
+ // Retrieve Mag Field parameters
+ Int_t ISXFLD=gAlice->Field()->Integ();
+ Float_t SXMGMX=gAlice->Field()->Max();
+ // TArrayI &idtmed = *fIdtmed;
+ //
+ L10:
+ for(i=0;i<130;i++) card[i]=0;
+ iret=fscanf(lun,"%4s %[^\n]",key,card);
+ if(iret<=0) goto L20;
+ fscanf(lun,"%*c");
+ //*
+ //* read material
+ if (!strcmp(key,"MATE")) {
+ sscanf(card,"%d '%[^']' %f %f %f %f %f %d",&imate,namate,&a,&z,&dens,&radl,&absl,&nwbuf);
+ if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]);
+ //Pad the string with blanks
+ i=-1;
+ while(namate[++i]);
+ while(i<20) namate[i++]=' ';
+ namate[i]='\0';
+ //
+ AliMaterial(imate,namate,a,z,dens,radl,absl,ubuf,nwbuf);
+ //* read tracking medium
+ } else if (!strcmp(key,"TMED")) {
+ sscanf(card,"%d '%[^']' %d %d %d %f %f %f %f %f %f %d",
+ &itmed,natmed,&nmat,&isvol,&ifield,&fieldm,&tmaxfd,
+ &stemax,&deemax,&epsil,&stmin,&nwbuf);
+ if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]);
+ if (ifield<0) ifield=isxfld;
+ if (fieldm<0) fieldm=sxmgmx;
+ //Pad the string with blanks
+ i=-1;
+ while(natmed[++i]);
+ while(i<20) natmed[i++]=' ';
+ natmed[i]='\0';
+ //
+ AliMedium(itmed,natmed,nmat,isvol,ISXFLD,SXMGMX,tmaxfd,
+ stemax,deemax,epsil,stmin,ubuf,nwbuf);
+ // (*fImedia)[idtmed[itmed]-1]=id_det;
+ //*
+ }
+ //*
+ if (strcmp(key,"END")) goto L10;
+ fclose (lun);
+ //*
+ //* commented out only for the not cernlib version
+ Warning("ReadEuclidMedia","file: %s is now read in\n",filnam);
+ //*
+ return;
+ //*
+ L20:
+ Warning("ReadEuclidMedia","reading error or premature end of file\n");
+}
+
//_____________________________________________________________________________
void AliModule::Streamer(TBuffer &R__b)
{
/* $Id$ */
#include <TNamed.h>
+#include <TSystem.h>
#include <TClonesArray.h>
#include <TBrowser.h>
#include <TAttLine.h>
//virtual AliHit* NextHit() {return 0;}
virtual void SetBufferSize(Int_t) {}
virtual void SetEuclidFile(char*,char*geometry=0);
+ virtual void ReadEuclid(const char*, char*);
+ virtual void ReadEuclidMedia(const char*);
ClassDef(AliModule,1) //Base class for ALICE Modules
};
/*
$Log$
+Revision 1.24 2000/01/19 17:17:20 fca
+Introducing a list of lists of hits -- more hits allowed for detector now
+
Revision 1.23 1999/12/03 11:14:31 fca
Fixing previous wrong checking
#include "TParticle.h"
#include "AliRun.h"
#include "AliDisplay.h"
+#include "AliVMC.h"
-#include "AliCallf77.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static AliHeader *header;
-#ifndef WIN32
-
-# define rxgtrak rxgtrak_
-# define rxstrak rxstrak_
-# define rxkeep rxkeep_
-# define rxouth rxouth_
-#else
-
-# define rxgtrak RXGTRAK
-# define rxstrak RXSTRAK
-# define rxkeep RXKEEP
-# define rxouth RXOUTH
-#endif
-
static TArrayF sEventEnergy;
static TArrayF sSummEnergy;
static TArrayF sSum2Energy;
// Close output file
File->Write();
- File->Close();
}
//_____________________________________________________________________________
}
//
// Reset the TArray's
- sEventEnergy.Set(0);
- sSummEnergy.Set(0);
- sSum2Energy.Set(0);
+ // sEventEnergy.Set(0);
+ // sSummEnergy.Set(0);
+ // sSum2Energy.Set(0);
}
//_____________________________________________________________________________
MediaTable(); //Build the special IMEDIA table
- //Close the geometry structure
- gMC->Ggclos();
+ //Terminate building of geometry
+ printf("%p\n",gVMC);
+ gVMC->FinishGeometry();
//Initialise geometry deposition table
sEventEnergy.Set(gMC->NofVolumes()+1);
sSummEnergy.Set(gMC->NofVolumes()+1);
sSum2Energy.Set(gMC->NofVolumes()+1);
- //Create the color table
- gMC->SetColors();
-
//Compute cross-sections
- gMC->Gphysi();
+ gVMC->BuildPhysics();
//Write Geometry object to current file.
fGeometry->Write();
//
// Load the event generator
//
- if(!fGenerator) fGenerator = generator;
+ if(fGenerator)
+ Warning("SetGenerator","Replacing generator %s with %s\n",
+ fGenerator->GetName(),generator->GetName());
+ fGenerator = generator;
}
//____________________________________________________________________________
// Loop on all detectors to create the Root branch (if any)
//
+ char hname[30];
//
// Analyse options
char *K = strstr(option,"K");
char *D = strstr(option,"D");
char *R = strstr(option,"R");
//
- if (K && !fTreeK) fTreeK = new TTree("TreeK0","Kinematics");
- if (H && !fTreeH) fTreeH = new TTree("TreeH0","Hits");
- if (D && !fTreeD) fTreeD = new TTree("TreeD0","Digits");
- if (E && !fTreeE) fTreeE = new TTree("TE","Header");
- if (R && !fTreeR) fTreeR = new TTree("TreeR0","Reconstruction");
- if (fTreeH) fTreeH->SetAutoSave(1000000000); //no autosave
+ if (K && !fTreeK) {
+ sprintf(hname,"TreeK%d",fEvent);
+ fTreeK = new TTree(hname,"Kinematics");
+ // Create a branch for particles
+ fTreeK->Branch("Particles",&fParticles,4000);
+ }
+ if (H && !fTreeH) {
+ sprintf(hname,"TreeH%d",fEvent);
+ fTreeH = new TTree(hname,"Hits");
+ fTreeH->SetAutoSave(1000000000); //no autosave
+ }
+ if (D && !fTreeD) {
+ sprintf(hname,"TreeD%d",fEvent);
+ fTreeD = new TTree(hname,"Digits");
+ }
+ if (R && !fTreeR) {
+ sprintf(hname,"TreeR%d",fEvent);
+ fTreeR = new TTree(hname,"Reconstruction");
+ }
+ if (E && !fTreeE) {
+ fTreeE = new TTree("TE","Header");
+ // Create a branch for Header
+ fTreeE->Branch("Header","AliHeader",&header,4000);
+ }
//
// Create a branch for hits/digits for each detector
// Each branch is a TClonesArray. Each data member of the Hits classes
while((detector = (AliModule*)next())) {
if (H || D || R) detector->MakeBranch(option);
}
- // Create a branch for particles
- if (fTreeK && K) fTreeK->Branch("Particles",&fParticles,4000);
-
- // Create a branch for Header
- if (fTreeE && E) fTreeE->Branch("Header","AliHeader",&header,4000);
}
//_____________________________________________________________________________
TClonesArray &particles = *fParticles;
int nkeep=fHgwmk+1, parent, i;
TParticle *part, *partnew, *father;
- AliHit *OneHit;
int *map = new int[particles.GetEntries()];
// Save in Header total number of tracks before compression
#ifdef old
// Now loop on all detectors and reset the hits
+ AliHit *OneHit;
TIter next(fModules);
AliModule *detector;
while((detector = (AliModule*)next())) {
if (!fInitDone) Init(setup);
// Create the Root Tree with one branch per detector
- if(!fEvent) {
- gAlice->MakeTree("KHDER");
- }
+ gAlice->MakeTree("KHDER");
todo = TMath::Abs(nevent);
for (i=0; i<todo; i++) {
// Process one run (one run = one event)
gAlice->Reset(fRun, fEvent);
- gMC->Gtrigi();
- gMC->Gtrigc();
- gMC->Gtrig();
+ gVMC->ProcessEvent();
gAlice->FinishEvent();
fEvent++;
}
// check if initialisation has been done
if (!fInitDone) Init(setup);
-
- fLego = new AliLego("lego","lego");
- fLego->Init(ntheta,themin,themax,nphi,phimin,phimax,rmin,rmax,zmax);
+
+ //Create Lego object
+ fLego = new AliLego("lego",ntheta,themin,themax,nphi,phimin,phimax,rmin,rmax,zmax);
+
+ //Run Lego Object
fLego->Run();
// Create only the Root event Tree
// Called at every step during transport
//
- Int_t copy;
//
// --- If lego option, do it and leave
- if (fLego) {
+ if (fLego)
fLego->StepManager();
- return;
- }
- //Update energy deposition tables
- sEventEnergy[gMC->CurrentVolID(copy)]+=gMC->Edep();
+ else {
+ Int_t copy;
+ //Update energy deposition tables
+ sEventEnergy[gMC->CurrentVolID(copy)]+=gMC->Edep();
- //Call the appropriate stepping routine;
- AliModule *det = (AliModule*)fModules->At(id);
- if(det) det->StepManager();
-}
-
-//_____________________________________________________________________________
-void AliRun::ReadEuclid(const char* filnam, const AliModule *det, char* topvol)
-{
- //
- // read in the geometry of the detector in euclid file format
- //
- // id_det : the detector identification (2=its,...)
- // topvol : return parameter describing the name of the top
- // volume of geometry.
- //
- // author : m. maire
- //
- // 28.07.98
- // several changes have been made by miroslav helbich
- // subroutine is rewrited to follow the new established way of memory
- // booking for tracking medias and rotation matrices.
- // all used tracking media have to be defined first, for this you can use
- // subroutine greutmed.
- // top volume is searched as only volume not positioned into another
- //
-
- Int_t i, nvol, iret, itmed, irot, numed, npar, ndiv, iaxe;
- Int_t ndvmx, nr, flag;
- char key[5], card[77], natmed[21];
- char name[5], mother[5], shape[5], konly[5], volst[7000][5];
- char *filtmp;
- Float_t par[50];
- Float_t teta1, phi1, teta2, phi2, teta3, phi3, orig, step;
- Float_t xo, yo, zo;
- const Int_t maxrot=5000;
- Int_t idrot[maxrot],istop[7000];
- FILE *lun;
- //
- // *** The input filnam name will be with extension '.euc'
- filtmp=gSystem->ExpandPathName(filnam);
- lun=fopen(filtmp,"r");
- delete [] filtmp;
- if(!lun) {
- Error("ReadEuclid","Could not open file %s\n",filnam);
- return;
- }
- //* --- definition of rotation matrix 0 ---
- TArrayI &idtmed = *(det->GetIdtmed());
- for(i=1; i<maxrot; ++i) idrot[i]=-99;
- idrot[0]=0;
- nvol=0;
- L10:
- for(i=0;i<77;i++) card[i]=0;
- iret=fscanf(lun,"%77[^\n]",card);
- if(iret<=0) goto L20;
- fscanf(lun,"%*c");
- //*
- strncpy(key,card,4);
- key[4]='\0';
- if (!strcmp(key,"TMED")) {
- sscanf(&card[5],"%d '%[^']'",&itmed,natmed);
- if( itmed<0 || itmed>=100 ) {
- Error("ReadEuclid","TMED illegal medium number %d for %s\n",itmed,natmed);
- exit(1);
- }
- //Pad the string with blanks
- i=-1;
- while(natmed[++i]);
- while(i<20) natmed[i++]=' ';
- natmed[i]='\0';
- //
- if( idtmed[itmed]<=0 ) {
- Error("ReadEuclid","TMED undefined medium number %d for %s\n",itmed,natmed);
- exit(1);
- }
- gMC->Gckmat(idtmed[itmed],natmed);
- //*
- } else if (!strcmp(key,"ROTM")) {
- sscanf(&card[4],"%d %f %f %f %f %f %f",&irot,&teta1,&phi1,&teta2,&phi2,&teta3,&phi3);
- if( irot<=0 || irot>=maxrot ) {
- Error("ReadEuclid","ROTM rotation matrix number %d illegal\n",irot);
- exit(1);
- }
- det->AliMatrix(idrot[irot],teta1,phi1,teta2,phi2,teta3,phi3);
- //*
- } else if (!strcmp(key,"VOLU")) {
- sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, shape, &numed, &npar);
- if (npar>0) {
- for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
- fscanf(lun,"%*c");
- }
- gMC->Gsvolu( name, shape, idtmed[numed], par, npar);
- //* save the defined volumes
- strcpy(volst[++nvol],name);
- istop[nvol]=1;
- //*
- } else if (!strcmp(key,"DIVN")) {
- sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, mother, &ndiv, &iaxe);
- gMC->Gsdvn ( name, mother, ndiv, iaxe );
- //*
- } else if (!strcmp(key,"DVN2")) {
- sscanf(&card[5],"'%[^']' '%[^']' %d %d %f %d",name, mother, &ndiv, &iaxe, &orig, &numed);
- gMC->Gsdvn2( name, mother, ndiv, iaxe, orig,idtmed[numed]);
- //*
- } else if (!strcmp(key,"DIVT")) {
- sscanf(&card[5],"'%[^']' '%[^']' %f %d %d %d", name, mother, &step, &iaxe, &numed, &ndvmx);
- gMC->Gsdvt ( name, mother, step, iaxe, idtmed[numed], ndvmx);
- //*
- } else if (!strcmp(key,"DVT2")) {
- sscanf(&card[5],"'%[^']' '%[^']' %f %d %f %d %d", name, mother, &step, &iaxe, &orig, &numed, &ndvmx);
- gMC->Gsdvt2 ( name, mother, step, iaxe, orig, idtmed[numed], ndvmx );
- //*
- } else if (!strcmp(key,"POSI")) {
- sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']'", name, &nr, mother, &xo, &yo, &zo, &irot, konly);
- if( irot<0 || irot>=maxrot ) {
- Error("ReadEuclid","POSI %s#%d rotation matrix number %d illegal\n",name,nr,irot);
- exit(1);
- }
- if( idrot[irot] == -99) {
- Error("ReadEuclid","POSI %s#%d undefined matrix number %d\n",name,nr,irot);
- exit(1);
- }
- //*** volume name cannot be the top volume
- for(i=1;i<=nvol;i++) {
- if (!strcmp(volst[i],name)) istop[i]=0;
- }
- //*
- gMC->Gspos ( name, nr, mother, xo, yo, zo, idrot[irot], konly );
- //*
- } else if (!strcmp(key,"POSP")) {
- sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']' %d", name, &nr, mother, &xo, &yo, &zo, &irot, konly, &npar);
- if( irot<0 || irot>=maxrot ) {
- Error("ReadEuclid","POSP %s#%d rotation matrix number %d illegal\n",name,nr,irot);
- exit(1);
- }
- if( idrot[irot] == -99) {
- Error("ReadEuclid","POSP %s#%d undefined matrix number %d\n",name,nr,irot);
- exit(1);
- }
- if (npar > 0) {
- for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
- fscanf(lun,"%*c");
- }
- //*** volume name cannot be the top volume
- for(i=1;i<=nvol;i++) {
- if (!strcmp(volst[i],name)) istop[i]=0;
- }
- //*
- gMC->Gsposp ( name, nr, mother, xo,yo,zo, idrot[irot], konly, par, npar);
- }
- //*
- if (strcmp(key,"END")) goto L10;
- //* find top volume in the geometry
- flag=0;
- for(i=1;i<=nvol;i++) {
- if (istop[i] && flag) {
- Warning("ReadEuclid"," %s is another possible top volume\n",volst[i]);
- }
- if (istop[i] && !flag) {
- strcpy(topvol,volst[i]);
- printf(" *** GREUCL *** volume %s taken as a top volume\n",topvol);
- flag=1;
- }
+ //Call the appropriate stepping routine;
+ AliModule *det = (AliModule*)fModules->At(id);
+ if(det) det->StepManager();
}
- if (!flag) {
- Warning("ReadEuclid","top volume not found\n");
- }
- fclose (lun);
- //*
- //* commented out only for the not cernlib version
- printf(" *** GREUCL *** file: %s is now read in\n",filnam);
- //
- return;
- //*
- L20:
- Error("ReadEuclid","reading error or premature end of file\n");
}
-//_____________________________________________________________________________
-void AliRun::ReadEuclidMedia(const char* filnam, const AliModule *det)
-{
- //
- // read in the materials and tracking media for the detector
- // in euclid file format
- //
- // filnam: name of the input file
- // id_det: id_det is the detector identification (2=its,...)
- //
- // author : miroslav helbich
- //
- Float_t sxmgmx = gAlice->Field()->Max();
- Int_t isxfld = gAlice->Field()->Integ();
- Int_t end, i, iret, itmed;
- char key[5], card[130], natmed[21], namate[21];
- Float_t ubuf[50];
- char* filtmp;
- FILE *lun;
- Int_t imate;
- Int_t nwbuf, isvol, ifield, nmat;
- Float_t a, z, dens, radl, absl, fieldm, tmaxfd, stemax, deemax, epsil, stmin;
- //
- end=strlen(filnam);
- for(i=0;i<end;i++) if(filnam[i]=='.') {
- end=i;
- break;
- }
- //
- // *** The input filnam name will be with extension '.euc'
- printf("The file name is %s\n",filnam); //Debug
- filtmp=gSystem->ExpandPathName(filnam);
- lun=fopen(filtmp,"r");
- delete [] filtmp;
- if(!lun) {
- Warning("ReadEuclidMedia","Could not open file %s\n",filnam);
- return;
- }
- //
- // Retrieve Mag Field parameters
- Int_t ISXFLD=gAlice->Field()->Integ();
- Float_t SXMGMX=gAlice->Field()->Max();
- // TArrayI &idtmed = *(det->GetIdtmed());
- //
- L10:
- for(i=0;i<130;i++) card[i]=0;
- iret=fscanf(lun,"%4s %[^\n]",key,card);
- if(iret<=0) goto L20;
- fscanf(lun,"%*c");
- //*
- //* read material
- if (!strcmp(key,"MATE")) {
- sscanf(card,"%d '%[^']' %f %f %f %f %f %d",&imate,namate,&a,&z,&dens,&radl,&absl,&nwbuf);
- if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]);
- //Pad the string with blanks
- i=-1;
- while(namate[++i]);
- while(i<20) namate[i++]=' ';
- namate[i]='\0';
- //
- det->AliMaterial(imate,namate,a,z,dens,radl,absl,ubuf,nwbuf);
- //* read tracking medium
- } else if (!strcmp(key,"TMED")) {
- sscanf(card,"%d '%[^']' %d %d %d %f %f %f %f %f %f %d",
- &itmed,natmed,&nmat,&isvol,&ifield,&fieldm,&tmaxfd,
- &stemax,&deemax,&epsil,&stmin,&nwbuf);
- if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]);
- if (ifield<0) ifield=isxfld;
- if (fieldm<0) fieldm=sxmgmx;
- //Pad the string with blanks
- i=-1;
- while(natmed[++i]);
- while(i<20) natmed[i++]=' ';
- natmed[i]='\0';
- //
- det->AliMedium(itmed,natmed,nmat,isvol,ISXFLD,SXMGMX,tmaxfd,
- stemax,deemax,epsil,stmin,ubuf,nwbuf);
- // (*fImedia)[idtmed[itmed]-1]=id_det;
- //*
- }
- //*
- if (strcmp(key,"END")) goto L10;
- fclose (lun);
- //*
- //* commented out only for the not cernlib version
- Warning("ReadEuclidMedia","file: %s is now read in\n",filnam);
- //*
- return;
- //*
- L20:
- Warning("ReadEuclidMedia","reading error or premature end of file\n");
-}
-
//_____________________________________________________________________________
void AliRun::Streamer(TBuffer &R__b)
{
R__b << fPDGDB; //Particle factory object!
}
}
-
-
-//_____________________________________________________________________________
-//
-// Interfaces to Fortran
-//
-//_____________________________________________________________________________
-
-extern "C" void type_of_call rxgtrak (Int_t &mtrack, Int_t &ipart, Float_t *pmom,
- Float_t &e, Float_t *vpos, Float_t *polar,
- Float_t &tof)
-{
- //
- // Fetches next track from the ROOT stack for transport. Called by the
- // modified version of GTREVE.
- //
- // Track number in the ROOT stack. If MTRACK=0 no
- // mtrack more tracks are left in the stack to be
- // transported.
- // ipart Particle code in the GEANT conventions.
- // pmom[3] Particle momentum in GeV/c
- // e Particle energy in GeV
- // vpos[3] Particle position
- // tof Particle time of flight in seconds
- //
- Int_t pdg;
- gAlice->GetNextTrack(mtrack, pdg, pmom, e, vpos, polar, tof);
- ipart = gMC->IdFromPDG(pdg);
- mtrack++;
-}
-
-//_____________________________________________________________________________
-extern "C" void type_of_call
-#ifndef WIN32
-rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom,
- Float_t *vpos, Float_t &tof, const char* cmech, Int_t &ntr, const int cmlen)
-#else
-rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom,
- Float_t *vpos, Float_t &tof, const char* cmech, const int cmlen,
- Int_t &ntr)
-#endif
-{
- //
- // Fetches next track from the ROOT stack for transport. Called by GUKINE
- // and GUSTEP.
- //
- // Status of the track. If keep=0 the track is put
- // keep on the ROOT stack but it is not fetched for
- // transport.
- // parent Parent track. If parent=0 the track is a primary.
- // In GUSTEP the routine is normally called to store
- // secondaries generated by the current track whose
- // ROOT stack number is MTRACK (common SCKINE.
- // ipart Particle code in the GEANT conventions.
- // pmom[3] Particle momentum in GeV/c
- // vpos[3] Particle position
- // tof Particle time of flight in seconds
- //
- // cmech (CHARACTER*10) Particle origin. This field is user
- // defined and it is not used inside the GALICE code.
- // ntr Number assigned to the particle in the ROOT stack.
- //
- char mecha[11];
- Float_t polar[3]={0.,0.,0.};
- for(int i=0; i<10 && i<cmlen; i++) mecha[i]=cmech[i];
- mecha[10]=0;
- Int_t pdg=gMC->PDGFromId(ipart);
- gAlice->SetTrack(keep, parent-1, pdg, pmom, vpos, polar, tof, mecha, ntr);
- ntr++;
-}
-
-//_____________________________________________________________________________
-extern "C" void type_of_call rxkeep(const Int_t &n)
-{
- if( NULL==gAlice ) exit(1);
-
- if( n<=0 || n>gAlice->Particles()->GetEntries() )
- {
- printf(" Bad index n=%d must be 0<n<=%d\n",
- n,gAlice->Particles()->GetEntries());
- exit(1);
- }
-
- ((TParticle*)(gAlice->Particles()->UncheckedAt(n-1)))->SetBit(Keep_Bit);
-}
-
-//_____________________________________________________________________________
-extern "C" void type_of_call rxouth ()
-{
- //
- // Called by Gtreve at the end of each primary track
- //
- gAlice->FinishPrimary();
-}
-
virtual void EnergySummary();
virtual const TDatabasePDG* PDGDB() const {return fPDGDB;}
- // Functions from GEOCAD
- //_______________________________________________________________________
-
- virtual void ReadEuclid(const char*, const AliModule*, char*);
- virtual void ReadEuclidMedia(const char*, const AliModule*);
-
TTree *TreeD() {return fTreeD;}
TTree *TreeE() {return fTreeE;}
TTree *TreeH() {return fTreeH;}
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+#include "AliVMC.h"
+
+ClassImp(AliVMC)
+
+AliVMC* AliVMC::fgVMC=0;
+
+AliVMC* gVMC;
+
+AliVMC::AliVMC()
+{
+}
+
+AliVMC::AliVMC(const char *name, const char *title) : TNamed(name,title)
+{
+ if(fgVMC) {
+ printf("Cannot initialise twice Alice MonteCarlo class\n");
+ } else {
+ fgVMC=this;
+ gVMC=this;
+ }
+}
+
--- /dev/null
+#ifndef ALIVMC_H
+#define ALIVMC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Generic interface to MC for AliRoot //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TNamed.h>
+
+class AliVMC : public TNamed
+{
+
+private:
+ static AliVMC* fgVMC;
+
+public:
+ AliVMC(const char *name, const char *title);
+ AliVMC();
+ virtual ~AliVMC() {}
+ //Generic access functions
+ static inline AliVMC* GetVMC() {return fgVMC;}
+ //Generic Alice MonteCarlo Functions
+ virtual void FinishGeometry() = 0;
+ virtual void BuildPhysics() = 0;
+ virtual void ProcessEvent() = 0;
+
+ //
+ ClassDef(AliVMC,1) //Generic MonteCarlo Class
+
+};
+
+R__EXTERN AliVMC *gVMC;
+
+#endif
+
AliDigit.cxx AliHit.cxx AliPoints.cxx \
AliDisplay.cxx AliMC.cxx AliRun.cxx AliGenerator.cxx \
AliLego.cxx AliModule.cxx AliDigitNew.cxx \
- AliGeometry.cxx AliRecPoint.cxx
+ AliGeometry.cxx AliRecPoint.cxx AliVMC.cxx
# C++ Headers
#pragma link C++ class AliMagFC;
#pragma link C++ class AliMagFCM;
#pragma link C++ class AliMC;
+#pragma link C++ class AliVMC;
#pragma link C++ class AliLego;
+#pragma link C++ class AliLegoGenerator;
#pragma link C++ class AliDigitNew;
#pragma link C++ class AliGeometry;
#pragma link C++ class AliRecPoint-;
/*
$Log$
+Revision 1.11 1999/11/01 20:42:42 fca
+FRAME version 1 is now the symmetric one.
+
Revision 1.10 1999/10/06 20:56:55 fca
Introducing new frame 1099
if(file) {
fclose(file);
printf(" Reading FRAME geometry\n");
- gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
+ ReadEuclid(fEuclidGeometry.Data(),topvol);
} else {
Warning("CreateGeometry","The Euclid file %s does not exist!\n",
fEuclidGeometry.Data());
delete [] filetmp;
if(file) {
fclose(file);
- gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
+ ReadEuclidMedia(fEuclidMaterial.Data());
} else {
Warning("CreateMaterials","The material file %s does not exist!\n",
fEuclidMaterial.Data());
/*
$Log$
+Revision 1.7 1999/11/01 20:42:42 fca
+FRAME version 1 is now the symmetric one.
+
Revision 1.6 1999/09/29 09:24:30 fca
Introduction of the Copyright and cvs Log
if(file) {
fclose(file);
printf(" Reading FRAME geometry\n");
- gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
+ ReadEuclid(fEuclidGeometry.Data(),topvol);
} else {
Warning("CreateGeometry","The Euclid file %s does not exist!\n",
fEuclidGeometry.Data());
delete [] filetmp;
if(file) {
fclose(file);
- gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
+ ReadEuclidMedia(fEuclidMaterial.Data());
} else {
Warning("CreateMaterials","The material file %s does not exist!\n",
fEuclidMaterial.Data());
/*
$Log$
+Revision 1.6 1999/09/29 09:24:30 fca
+Introduction of the Copyright and cvs Log
+
*/
////////////////////////////////////////////////
if(file) {
fclose(file);
printf(" Reading PIPE \n");
- gAlice->ReadEuclid(pipename,this,topvol);
+ ReadEuclid(pipename,topvol);
} else {
printf(" THE GEOM FILE %s DOES NOT EXIST !\n",pipename);
exit(1);
if(file) {
fclose(file);
printf(" Reading PUMP \n");
- gAlice->ReadEuclid(pumpname,this,topvol);
+ ReadEuclid(pumpname,topvol);
} else {
printf(" THE GEOM FILE %s DOES NOT EXIST !\n",pumpname);
exit(1);
delete [] filtmp;
if(file) {
fclose(file);
- gAlice->ReadEuclidMedia(name,this);
+ ReadEuclidMedia(name);
} else {
printf(" THE MEDIA FILE %s DOES NOT EXIST !\n",name);
exit(1);
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+#include <TParticle.h>
+
+#include "AliGeant3.h"
+#include "AliRun.h"
+#include "TGeant3.h"
+#include "AliCallf77.h"
+
+#ifndef WIN32
+
+# define rxgtrak rxgtrak_
+# define rxstrak rxstrak_
+# define rxkeep rxkeep_
+# define rxouth rxouth_
+#else
+
+# define rxgtrak RXGTRAK
+# define rxstrak RXSTRAK
+# define rxkeep RXKEEP
+# define rxouth RXOUTH
+#endif
+
+ClassImp(AliGeant3)
+
+AliGeant3::AliGeant3()
+{
+ new TGeant3();
+}
+
+AliGeant3::AliGeant3(const char *title) :
+ AliVMC("ALICE Virtual MC for Geant3",title)
+{
+ new TGeant3(title);
+}
+
+void AliGeant3::FinishGeometry()
+{
+ gMC->FinishGeometry();
+ //Create the color table
+ gMC->SetColors();
+}
+
+void AliGeant3::BuildPhysics()
+{
+ ((TGeant3*)gMC)->Gphysi();
+}
+
+void AliGeant3::ProcessEvent()
+{
+ ((TGeant3*)gMC)->Gtrigi();
+ ((TGeant3*)gMC)->Gtrigc();
+ ((TGeant3*)gMC)->Gtrig();
+}
+
+//_____________________________________________________________________________
+//
+// Interfaces to Fortran
+//
+//_____________________________________________________________________________
+
+extern "C" void type_of_call rxgtrak (Int_t &mtrack, Int_t &ipart, Float_t *pmom,
+ Float_t &e, Float_t *vpos, Float_t *polar,
+ Float_t &tof)
+{
+ //
+ // Fetches next track from the ROOT stack for transport. Called by the
+ // modified version of GTREVE.
+ //
+ // Track number in the ROOT stack. If MTRACK=0 no
+ // mtrack more tracks are left in the stack to be
+ // transported.
+ // ipart Particle code in the GEANT conventions.
+ // pmom[3] Particle momentum in GeV/c
+ // e Particle energy in GeV
+ // vpos[3] Particle position
+ // tof Particle time of flight in seconds
+ //
+ Int_t pdg;
+ gAlice->GetNextTrack(mtrack, pdg, pmom, e, vpos, polar, tof);
+ ipart = gMC->IdFromPDG(pdg);
+ mtrack++;
+}
+
+//_____________________________________________________________________________
+extern "C" void type_of_call
+#ifndef WIN32
+rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom,
+ Float_t *vpos, Float_t &tof, const char* cmech, Int_t &ntr, const int cmlen)
+#else
+rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom,
+ Float_t *vpos, Float_t &tof, const char* cmech, const int cmlen,
+ Int_t &ntr)
+#endif
+{
+ //
+ // Fetches next track from the ROOT stack for transport. Called by GUKINE
+ // and GUSTEP.
+ //
+ // Status of the track. If keep=0 the track is put
+ // keep on the ROOT stack but it is not fetched for
+ // transport.
+ // parent Parent track. If parent=0 the track is a primary.
+ // In GUSTEP the routine is normally called to store
+ // secondaries generated by the current track whose
+ // ROOT stack number is MTRACK (common SCKINE.
+ // ipart Particle code in the GEANT conventions.
+ // pmom[3] Particle momentum in GeV/c
+ // vpos[3] Particle position
+ // tof Particle time of flight in seconds
+ //
+ // cmech (CHARACTER*10) Particle origin. This field is user
+ // defined and it is not used inside the GALICE code.
+ // ntr Number assigned to the particle in the ROOT stack.
+ //
+ char mecha[11];
+ Float_t polar[3]={0.,0.,0.};
+ for(int i=0; i<10 && i<cmlen; i++) mecha[i]=cmech[i];
+ mecha[10]=0;
+ Int_t pdg=gMC->PDGFromId(ipart);
+ gAlice->SetTrack(keep, parent-1, pdg, pmom, vpos, polar, tof, mecha, ntr);
+ ntr++;
+}
+
+//_____________________________________________________________________________
+extern "C" void type_of_call rxkeep(const Int_t &n)
+{
+ if( NULL==gAlice ) exit(1);
+
+ if( n<=0 || n>gAlice->Particles()->GetEntries() )
+ {
+ printf(" Bad index n=%d must be 0<n<=%d\n",
+ n,gAlice->Particles()->GetEntries());
+ exit(1);
+ }
+
+ ((TParticle*)(gAlice->Particles()->UncheckedAt(n-1)))->SetBit(Keep_Bit);
+}
+
+//_____________________________________________________________________________
+extern "C" void type_of_call rxouth ()
+{
+ //
+ // Called by Gtreve at the end of each primary track
+ //
+ gAlice->FinishPrimary();
+}
+
--- /dev/null
+#ifndef ALIGEANT3_H
+#define ALIGEANT3_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Generic interface to MC for AliRoot //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <AliVMC.h>
+
+class AliGeant3 : public AliVMC
+{
+
+private:
+
+public:
+ AliGeant3(const char *title);
+ AliGeant3();
+ virtual ~AliGeant3() {}
+ //
+ //
+ void FinishGeometry();
+ void BuildPhysics();
+ void ProcessEvent();
+ ClassDef(AliGeant3,1) //Generic MonteCarlo Class
+
+};
+
+#endif
+
# C++ sources
GSRCS = TGeant3.cxx TPaveTree.cxx THIGZ.cxx gucode.cxx \
- TGeant3GUI.cxx
+ TGeant3GUI.cxx AliGeant3.cxx
# C++ Headers
/*
$Log$
+Revision 1.22 2000/01/18 15:40:13 morsch
+Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
+Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
+
Revision 1.21 2000/01/17 19:41:17 fca
Add SetERAN function
fNextVol=fGcvolu->nlevel;
}
+//____________________________________________________________________________
+void TGeant3::FinishGeometry()
+{
+ //Close the geometry structure
+ Ggclos();
+}
+
//____________________________________________________________________________
Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
{
// //
///////////////////////////////////////////////////////////////////////
+ void FinishGeometry();
void GeomIter();
Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const;
Int_t NextVolUp(Text_t *name, Int_t ©);
/*
$Log$
+Revision 1.16 2000/01/18 16:27:18 morsch
+Dummy definition of Gftmat, Gbrelm and Gprelm added.
+
Revision 1.15 2000/01/17 19:41:17 fca
Add SetERAN function
//=======================functions from GBASE
//___________________________________________
+void TGeant3::FinishGeometry() {}
void TGeant3::Gfile(const char*, const char*) {}
void TGeant3::GeomIter() {}
Int_t TGeant3::CurrentMaterial(Float_t &, Float_t &, Float_t &, Float_t &, Float_t &) const {return 0;}
#pragma link off all classes;
#pragma link off all functions;
+#pragma link C++ class AliGeant3;
#pragma link C++ class TGeant3-;
#pragma link C++ class THIGZ;
#pragma link C++ class TPaveTree;
void Config()
{
-new TGeant3("C++ Interface to Geant3");
+new AliGeant3("C++ Interface to Geant3");
//=======================================================================
// Create the output file
//=================== PHOS parameters ===========================
if(iPHOS) {
-AliPHOS *PHOS = new AliPHOSv0("PHOS","normal PHOS");
+ AliPHOS *PHOS = new AliPHOSv0("PHOS","normal PHOS");
+ AliPHOSGeometry *geom = new AliPHOSGeometry("default");
+ geom->Init();
}