which included commits to RCS files with non-trunk default branches.
--- /dev/null
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ global gAliFast;
+
+#pragma link C++ class AliFast-;
+#pragma link C++ class AliFMaker-;
+
+#pragma link C++ class AliFTrackMaker;
+#pragma link C++ class AliFTrack;
+#pragma link C++ class AliFHistBrowser;
+#pragma link C++ class AliFBigBang;
+#pragma link C++ class AliFBrowsable;
+#pragma link C++ class AliFVirtualDisplay;
+#pragma link C++ class AliFDet;
+
+//
+// #pragma link C++ class AliFDisplay;
+// #pragma link C++ class AliFParticle;
+// #pragma link C++ class AliFFruit;
+
+
+#endif
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFBigBang //
+// //
+// helper class to browse generated particles. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TBrowser.h>
+#include <TParticle.h>
+#include <TClonesArray.h>
+#include "AliFast.h"
+#include "AliFBigBang.h"
+
+#include "AliFBrowsable.h"
+
+ClassImp(AliFBigBang)
+
+
+
+//_____________________________________________________________________________
+AliFBigBang::AliFBigBang()
+ : TNamed("Histograms","Generated particles browser")
+{
+ fBrowsables = 0;
+}
+
+//_____________________________________________________________________________
+AliFBigBang::~AliFBigBang()
+{
+ if (fBrowsables) {
+ fBrowsables->Delete();
+ delete fBrowsables;
+ fBrowsables = 0;
+ }
+}
+
+//_____________________________________________________________________________
+void AliFBigBang::Browse(TBrowser *b)
+{
+ /*
+
+ TClonesArray *particles = mcarlo->Fruits();
+ Int_t nparticles = particles->GetEntriesFast();
+ TParticle *part;
+ AliFBrowsable *brow;
+ char name[64];
+ if (!fBrowsables) fBrowsables = new TObjArray(2*nparticles);
+ if (fBrowsables->GetSize() < nparticles) fBrowsables->Expand(nparticles);
+ for (Int_t i=0;i<nparticles;i++) {
+ part = (TParticle*)particles->UncheckedAt(i);
+ if (part->GetMother(i)) continue;
+ brow = GetBrowsable(i);
+ sprintf(name,"%s_%d",part->GetName(),i);
+ brow->SetName(name);
+ brow->SetRefObject(part);
+ b->Add(brow,name);
+ }
+ */
+}
+
+//_____________________________________________________________________________
+AliFBrowsable *AliFBigBang::GetBrowsable(Int_t i)
+{
+ AliFBrowsable *brow = (AliFBrowsable*)fBrowsables->At(i);
+ if (!brow) {
+ brow = new AliFBrowsable();
+ fBrowsables->AddAt(brow, i);
+ brow->SetBigBang(this);
+ }
+ return brow;
+}
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFBigBang_H
+#define AliFBigBang_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFBigBang //
+// //
+// helper class to browse generated particles. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+#endif
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
+#endif
+
+class AliFBrowsable;
+
+class AliFBigBang : public TNamed {
+
+private:
+ TObjArray *fBrowsables; //List of browsable particles
+
+public:
+ AliFBigBang();
+ virtual ~AliFBigBang();
+ virtual void Browse(TBrowser *b);
+ AliFBrowsable *GetBrowsable(Int_t i);
+ Bool_t IsFolder() {return kTRUE;}
+
+ ClassDef(AliFBigBang, 0) //helper class to browse generated particles.
+};
+
+#endif
+
+
+
+
+
+
+
+
+
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFBrowsable //
+// //
+// helper class to browse generated particles. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TBrowser.h>
+#include <TParticle.h>
+#include <TClonesArray.h>
+#include "AliFast.h"
+#include "AliFBrowsable.h"
+#include "AliFBigBang.h"
+//#include "AliFMCMaker.h"
+
+ClassImp(AliFBrowsable)
+
+
+
+//_____________________________________________________________________________
+AliFBrowsable::AliFBrowsable()
+{
+
+}
+
+//_____________________________________________________________________________
+void AliFBrowsable::Browse(TBrowser *b)
+{
+ /*
+ AliFMCMaker *mcarlo = gAliFast->MCMaker();
+ TClonesArray *particles = mcarlo->Fruits();
+ Int_t nparticles = particles->GetEntriesFast();
+ TParticle *refpart = (TParticle*)fRefObject;
+ TParticle *part;
+ AliFBrowsable *brow;
+ char name[64];
+ Int_t iparent;
+
+ for (Int_t i=0;i<nparticles;i++) {
+ part = (TParticle*)particles->UncheckedAt(i);
+ iparent = part->GetMother(0);
+ if (!iparent) continue;
+ if (particles->UncheckedAt(iparent-1) != refpart) continue;
+ brow = fBigBang->GetBrowsable(i);
+ sprintf(name,"%s_%d",part->GetName(),i);
+ brow->SetName(name);
+ brow->SetRefObject(part);
+ b->Add(brow,name);
+ }
+ */
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFBrowsable_H
+#define AliFBrowsable_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFBrowsable //
+// //
+// helper class to browse generated particles. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+#endif
+
+class AliFBigBang;
+
+class AliFBrowsable : public TNamed {
+
+private:
+ TObject *fRefObject; //Referenced object
+ AliFBigBang *fBigBang; //Pointer to control bigbang object
+
+public:
+ AliFBrowsable();
+ virtual ~AliFBrowsable() {;}
+ virtual void Browse(TBrowser *b);
+ Bool_t IsFolder() {return kTRUE;}
+ virtual void SetBigBang(AliFBigBang *bigbang) {fBigBang = bigbang;}
+ virtual void SetRefObject(TObject *obj) {fRefObject = obj;}
+
+ ClassDef(AliFBrowsable, 0) //helper class to browse generated particles.
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+////////////////////////////////////////////////////////////////////////////
+// //
+// AliFast Detector Class //
+// //
+// to provide information of effective material (X/Xo) of the detector //
+// needed for the multiple scattering formula used in AliFTrackMaker. //
+// //
+// the number and dimensions of cylindrical layers of material are //
+// initialised here for the TP status and are to be updated accordingly. //
+// //
+// //
+// origin: "init_geometry" routine in "res.f" fortran by Karel Safarik //
+// which was used to calculate the track resolution for TP. //
+// //
+// //
+// AliFast: E. Richter-Was and Y. Foka //
+// following general structure of Makers in ATLFast //
+// by R. Brun and E. R. Was //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliFDet.h"
+#include "TMath.h"
+
+ClassImp(AliFDet)
+
+
+//_____________________________________________________________________________
+AliFDet::AliFDet(const char *name, const char *title) : TNamed(name,title)
+{
+ for(Int_t idDet=0; idDet<kNMaxDet; idDet++){
+ fRDet[idDet] = 0;
+ fRDetSQ[idDet] = 0;
+ fThickDet[idDet] = 0;
+ fErrorRPhi[idDet] = 0;
+ fErrorZ[idDet] = 0;
+ fErrorR[idDet] = 0;
+ fIFlagDet[idDet] = 0;
+ fIFlagGas[idDet] = 0;
+ }
+ fBMag = 0;
+ fConstMag = 0;
+ fNDetActive = 0;
+ fNDet = 0;
+}
+
+//_____________________________________________________________________________
+void AliFDet::InitDetParam()
+{
+ //initialisation of the detector material to the TP status.
+ //needed for multiple scattering formula used in AliFTrackMaker
+ //for track resolution calculation
+ //
+ //errorRPhi, errorZ:
+ //the errors in bending and r direction are due to detector precision and alignement
+ //the error in radial direction r is due to alignement only
+ //the errors are momentum dependent; for iFlagDet=2 as for TPC are calculated properly
+ //
+ //fErrorVertexX,fErrorVertexY, fErrorVertexZ
+ //errors of vertex
+ //the vertex precision depends on particle multiplicity mult_density
+ //optimistic errors for/high multiplicity
+
+ Double_t rDet[kNMaxDet]; // radius of detector material in cm
+ Double_t thickDet[kNMaxDet]; // thickness divided by X
+ Double_t errorRPhi[kNMaxDet]; // error in bending direction
+ Double_t errorZ[kNMaxDet]; // error in z direction
+ Double_t errorR[kNMaxDet]; // error in r direction,from alignement only
+ Int_t iFlagDet[kNMaxDet]; // 1: sensitive detector
+ // 2: errors will be calculated
+ Int_t iFlagGas[kNMaxDet]; // for gas detectors
+
+ Int_t nDet;
+
+ //dummy
+ nDet = 0;
+ rDet[nDet] = 0;
+ thickDet[nDet] = 0;
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 0;
+ //vacum pipe
+ nDet = 1;
+ rDet[nDet] = 3.0;
+ thickDet[nDet] = 0.06/35.3; // berylium
+ iFlagDet[nDet] = 0; // no detection
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 2;
+ rDet[nDet] = 3.5;
+ thickDet[nDet] = 1.0000/30420.0; // air
+ iFlagDet[nDet] = 0; // no detection
+ iFlagGas[nDet] = 1;
+ //
+ nDet = 3;
+ rDet[nDet] = 4.0;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.0015 + 0.0005;
+ errorZ[nDet] = 0.009 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 4;
+ rDet[nDet] = 5.75;
+ thickDet[nDet] = 3.5/30420.0; // silicon
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ //
+ nDet = 5;
+ rDet[nDet] = 7.5;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.0015 + 0.0005;
+ errorZ[nDet] = 0.009 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 6;
+ rDet[nDet] = 10.75;
+ thickDet[nDet] = 6.5/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // first silicon drift
+ nDet = 7;
+ rDet[nDet] = 14.0;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.0025 + 0.0005;
+ errorZ[nDet] = 0.0025 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 8;
+ rDet[nDet] = 19.0;
+ thickDet[nDet] = 10.0/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // second silicon drift
+ nDet = 9;
+ rDet[nDet] = 24.0;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.0025 + 0.0005;
+ errorZ[nDet] = 0.0025 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 10;
+ rDet[nDet] = 32.0;
+ thickDet[nDet] = 16.0/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // first silicon strips
+ nDet = 11;
+ rDet[nDet] = 40.0;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.003 + 0.0005;
+ errorZ[nDet] = 0.100 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 12;
+ rDet[nDet] = 42.5;
+ thickDet[nDet] = 5.0/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // second silicon strips
+ nDet = 13;
+ rDet[nDet] = 45.0;
+ thickDet[nDet] = 0.06/9.36; // silicon
+ errorRPhi[nDet] = 0.003 + 0.0005;
+ errorZ[nDet] = 0.100 + 0.0005;
+ errorR[nDet] = 0.001;
+ iFlagDet[nDet] = 1;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 14;
+ rDet[nDet] = 47.5;
+ thickDet[nDet] = 5.0/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ //
+ nDet = 15;
+ rDet[nDet] = 50.0;
+ thickDet[nDet] = 0.01; // 1% of something ITS
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 16;
+ rDet[nDet] = 51.0;
+ thickDet[nDet] = 2.0/30420.0; // air
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // TPC HV degrager
+ nDet = 17;
+ rDet[nDet] = 52.0;
+ thickDet[nDet] = 0.0018; // 0.18 % of something TPC
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 18;
+ rDet[nDet] = 68.75;
+ thickDet[nDet] = 12.5/18310.0; // CO2
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ //
+ nDet = 19;
+ rDet[nDet] = 71.25;
+ thickDet[nDet] = 12.5/18310.0; // CO2
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // TPC inner field cage
+ nDet = 20;
+ rDet[nDet] = 78.0;
+ thickDet[nDet] = 0.0041; // 0.41 % of something
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 0;
+ //
+ nDet = 21;
+ rDet[nDet] = 83.5;
+ thickDet[nDet] = 11.0/32155.6; // neon
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ //
+ nDet = 22;
+ rDet[nDet] = 94.5;
+ thickDet[nDet] = 11.0/32155.6; // neon
+ iFlagDet[nDet] = 0;
+ iFlagGas[nDet] = 1;
+ // TPC
+ Int_t nPadRow = 75;
+ Double_t rCurrent = 99.0;
+ Double_t deltaR = 2.0;
+ for(Int_t ipad=1; ipad<nPadRow+1; ipad++){
+ nDet=nDet+1;
+ rCurrent = rCurrent + deltaR;
+ rDet[nDet] = rCurrent;
+ thickDet[nDet] = 2.0/32155.6; // neon
+ errorRPhi[nDet] = 0.0; //errors are momentum dependent
+ errorZ[nDet] = 0.0; //to be calculated latter
+ errorR[nDet] = 0.0075;
+ iFlagDet[nDet] = 2; //means error defined latter
+ iFlagGas[nDet] = 1;
+ }
+
+ // vertex precision
+ Double_t multDensity = 3906.25;
+
+ fErrorVertexX = 0.010/TMath::Sqrt(multDensity) + 0.00060;
+ fErrorVertexY = fErrorVertexX;
+ fErrorVertexZ = 0.025/TMath::Sqrt(multDensity) + 0.00075;
+
+
+ // magnetic field
+ fBMag = 2.0;
+ fConstMag = 1.0/(fBMag*0.297792458e-3);
+
+
+ // prepare more suitables variables
+
+ Int_t nDetActive = 0;
+
+ for(Int_t idDet=0; idDet<nDet+1; idDet++){
+ fRDet[idDet] = rDet[idDet];
+ fRDetSQ[idDet] = rDet[idDet]*rDet[idDet];
+ fThickDet[idDet] = 0.0136* TMath::Sqrt(thickDet[idDet]);
+ fIFlagDet[idDet] = iFlagDet[idDet];
+ fIFlagGas[idDet] = iFlagGas[idDet];
+ if(iFlagDet[idDet] > 0){
+ nDetActive = nDetActive+1;
+ fErrorR[idDet] = errorR[idDet]*errorR[idDet];
+ if(iFlagDet[idDet] == 1){
+ fErrorRPhi[idDet] = errorRPhi[idDet]*errorRPhi[idDet];
+ fErrorZ[idDet] = errorZ[idDet]*errorZ[idDet];
+ }
+ }
+ }
+
+ fErrorVertexX = fErrorVertexX*fErrorVertexX;
+ fErrorVertexY = fErrorVertexY*fErrorVertexY;
+ fErrorVertexZ = fErrorVertexZ*fErrorVertexZ;
+
+ fNDetActive = nDetActive;
+ fNDet = nDet;
+
+
+}
+
+//_____________________________________________________________________________
+void AliFDet::PrintDetInfo()
+{
+ //to print information for the initialisation of the detector
+ printf("**************************************************************\n");
+ printf("* *\n");
+ printf("* ALICE detector *\n");
+ printf("* *\n");
+ printf("**************************************************************\n");
+
+ for(Int_t idDet=0; idDet<fNDet+1; idDet++){
+ if(fIFlagDet[idDet] == 0){
+ printf("%5s %3d %8.1f %2s %10.5f %20s\n",
+ "det=",idDet,fRDet[idDet],"cm",
+ TMath::Power(fThickDet[idDet]/0.0136,2),
+ "of X0 <---- pasive material");
+ } else{
+ printf("%5s %3d %8.1f %2s %10.5f %6s %6.4f %6.4f \n",
+ "det=",idDet,fRDet[idDet],"cm",
+ TMath::Power(fThickDet[idDet]/0.0136,2),"of X0, errors",
+ TMath::Sqrt(fErrorRPhi[idDet]),TMath::Sqrt(fErrorZ[idDet]));
+ }
+ }
+ printf("%20s %10.4f %10.4f %10.4f\n","vertex precision(x,y,z)",
+ TMath::Sqrt(fErrorVertexX),
+ TMath::Sqrt(fErrorVertexY),
+ TMath::Sqrt(fErrorVertexZ));
+ printf("%20s %10.4f %10s %8.1f %5s\n","magnetic field (kGauss)",fBMag,
+ "(constant",fConstMag,")");
+
+}
--- /dev/null
+#ifndef AliFDet_H
+#define AliFDet_H
+////////////////////////////////////////////////////////////////////////////
+// //
+// AliFast Detector Class //
+// //
+// to provide information of effective material (X/Xo) of the detector //
+// needed for the multiple scattering formula used in AliFTrackMaker. //
+// //
+// the number and dimensions of cylindrical layers of material are //
+// initialised here for the TP status and are to be updated accordingly. //
+// //
+// this class is replacing the "init_geometry" routine of program "res.f //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+//#ifndef ROOT_TObject
+#include <TNamed.h>
+//#endif
+
+enum { kNMaxDet = 100 };
+enum { kNMaxDet2 = 200 };
+
+
+class AliFDet : public TNamed {
+
+private:
+ //geometry parameters
+ Double_t fRDet[kNMaxDet]; // radius of detector material in cm
+ Double_t fRDetSQ[kNMaxDet]; // and the sq root of it
+ Double_t fThickDet[kNMaxDet]; // thickness divided by Xo
+ //errors due to detector precision plus alignement given by groups.
+ //they are momentum dependent; for TPC are calculated properly.
+ Double_t fErrorRPhi[kNMaxDet]; // error in bending direction
+ Double_t fErrorZ[kNMaxDet]; // error in z direction
+ Double_t fErrorR[kNMaxDet]; // error in r direction,from alignement only
+ Int_t fIFlagDet[kNMaxDet]; // 1: sensitive detector
+ // 2: errors will be calculated
+ Int_t fIFlagGas[kNMaxDet]; // for gas detectors
+ //vertex precision calculated for particle multiplicity mult_density
+ //high multiplicity results in optimistic errors for vertex
+ Double_t fErrorVertexX; // vertex precision in x
+ Double_t fErrorVertexY; // vertex precision in y
+ Double_t fErrorVertexZ; // vertex precision in z
+ Double_t fBMag; // magnetic field in KGauss
+ Double_t fConstMag; //
+ Int_t fNDetActive; // n. of active detector layers
+ Int_t fNDet; // n. of detectors layers
+
+public:
+ AliFDet() {}
+ AliFDet(const char *name, const char *title);
+ virtual ~AliFDet() {}
+
+ // Initialise parameters for detector geometry
+ void InitDetParam();
+ void PrintDetInfo();
+
+
+ // Getters
+ Double_t RDet(Int_t idDet) {return fRDet[idDet];}
+ Double_t RDetSQ(Int_t idDet) {return fRDetSQ[idDet];}
+ Double_t ThickDet(Int_t idDet) {return fThickDet[idDet];}
+ Double_t ErrorRPhi(Int_t idDet) {return fErrorRPhi[idDet];}
+ Double_t ErrorZ(Int_t idDet) {return fErrorZ[idDet];}
+ Double_t ErrorR(Int_t idDet) {return fErrorR[idDet];}
+ Int_t IFlagDet(Int_t idDet) {return fIFlagDet[idDet];}
+ Int_t IFlagGas(Int_t idDet) {return fIFlagGas[idDet];}
+ Double_t ErrorVertexX() {return fErrorVertexX;}
+ Double_t ErrorVertexY() {return fErrorVertexY;}
+ Double_t ErrorVertexZ() {return fErrorVertexZ;}
+ Double_t BMag() {return fBMag;}
+ Double_t ConstMag() {return fConstMag;}
+ Int_t NDetActive() {return fNDetActive;}
+ Int_t NDet() {return fNDet;}
+
+
+ ClassDef(AliFDet,1) //AliFast Detector intialisation for AliFTrackMaker
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFDisplay //
+// //
+// Utility class to display ALICE outline, tracks, clusters, jets,.. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TButton.h>
+#include <TCanvas.h>
+#include <TView.h>
+#include <TArc.h>
+#include <TText.h>
+#include <TPaveLabel.h>
+#include <TPaveText.h>
+#include <TList.h>
+#include <TDiamond.h>
+#include <TNode.h>
+#include <TTUBE.h>
+#include <TMath.h>
+#include <X3DBuffer.h>
+
+#include "AliFDisplay.h"
+#include "AliFFruit.h"
+#include "AliFParticle.h"
+#include "AliFast.h"
+#include "AliFMCMaker.h"
+
+
+ClassImp(AliFDisplay)
+
+
+//_____________________________________________________________________________
+AliFDisplay::AliFDisplay() : AliFVirtualDisplay()
+{
+ fParticle = 0;
+ fFruits = 0;
+}
+
+//_____________________________________________________________________________
+AliFDisplay::AliFDisplay(const char *title) : AliFVirtualDisplay()
+{
+
+ gAliFast->SetDisplay(this);
+
+ // Initialize display default parameters
+ SetPTcut();
+ SetPTcutEGMUNU();
+ SetGeometry();
+
+ // Set front view by default
+ fTheta = 0;
+ fPhi = -90;
+ fDrawAllViews = kFALSE;
+ fDrawParticles = kTRUE;
+
+ // Create display canvas
+ fCanvas = new TCanvas("Canvas", (char*)title,14,47,740,650);
+ fCanvas->SetEditable(kIsNotEditable);
+
+ // Create main display pad
+ fPad = new TPad("viewpad", "AliFast display",0.15,0,1,1);
+ fPad->Draw();
+ fPad->Modified();
+ fPad->SetFillColor(1);
+ fPad->SetBorderSize(2);
+
+ // Create user interface control pad
+ DisplayButtons();
+ fCanvas->cd();
+
+ // Create trigger view pad
+ Float_t dxtr = 0.15;
+ Float_t dytr = 0.45;
+ Float_t xt = 0.3*dxtr;
+ Float_t yt = 0.8*dytr;
+ Float_t dyt = 0.07*dytr;
+ Float_t xarc = 0.7*dxtr;
+ Float_t rarc = 0.3*dyt;
+ fTrigPad = new TPad("TrigPad", "trigger pad",0,0,dxtr,dytr);
+ fTrigPad->Range(0,0,dxtr,dytr);
+ fTrigPad->Draw();
+ fTrigPad->cd();
+ fTrigPad->SetFillColor(22);
+ fTrigPad->SetBorderSize(2);
+
+ TText *t = new TText();
+ t->SetTextFont(61);
+ t->SetTextSize(0.2);
+ t->SetTextAlign(22);
+ t->DrawText(0.5*dxtr, 0.93*dytr,"Trigger");
+ t->SetTextSize(0.14);
+ t->SetTextAlign(22);
+ t->DrawText(xt,yt, "EM1");
+ t->DrawText(xt,yt-dyt, "PH1");
+ t->DrawText(xt,yt-2*dyt,"EM2");
+ t->DrawText(xt,yt-3*dyt,"MU1");
+ t->DrawText(xt,yt-4*dyt,"MU2");
+ t->DrawText(xt,yt-5*dyt,"EMU");
+ t->DrawText(xt,yt-6*dyt,"JT1");
+ t->DrawText(xt,yt-7*dyt,"JT2");
+ t->DrawText(xt,yt-8*dyt,"JT3");
+ t->DrawText(xt,yt-9*dyt,"ALL");
+ AppendPad(); // append display object as last object to force selection
+
+ fTubin = new TTUBE("tubin","inner tube"," ", fRin, fRin+5, fZin);
+ fNodin = new TNode("nodin","ALIAS outline","tubin",0,0,0," ");
+ fNodin->SetLineColor(7);
+
+
+ // Create list to support list of fruits
+ fFruits = new TList();
+
+ // Create particle manager
+ fParticle = new AliFParticle("particle_manager");
+
+ fCanvas->cd();
+ fCanvas->Update();
+
+}
+
+
+//_____________________________________________________________________________
+AliFDisplay::~AliFDisplay()
+{
+ delete fParticle;
+ if (fFruits) fFruits->Delete();
+ delete fFruits;
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::Clear(Option_t *)
+{
+// Delete graphics temporary objects
+
+ fFruits->Delete();
+
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DisplayButtons()
+{
+// Create the user interface buttons
+
+ fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
+ fButtons->Draw();
+ fButtons->SetFillColor(38);
+ fButtons->SetBorderSize(2);
+ fButtons->cd();
+
+ Int_t butcolor = 33;
+ Float_t dbutton = 0.08;
+ Float_t y = 0.96;
+ Float_t dy = 0.014;
+ Float_t x0 = 0.05;
+ Float_t x1 = 0.95;
+
+ TButton *button;
+ char *but1 = "gAliFast->Display()->ShowNextEvent(1)";
+ button = new TButton("Next",but1,x0,y-dbutton,x1,y);
+ button->SetFillColor(38);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but2 = "gAliFast->Display()->ShowNextEvent(-1)";
+ button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
+ button->SetFillColor(38);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but3 = "gAliFast->Display()->SetView(90,-90)";
+ button = new TButton("Top View",but3,x0,y-dbutton,x1,y);
+ button->SetFillColor(butcolor);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but4 = "gAliFast->Display()->SetView(90,0)";
+ button = new TButton("Side View",but4,x0,y-dbutton,x1,y);
+ button->SetFillColor(butcolor);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but5 = "gAliFast->Display()->SetView(0,-90)";
+ button = new TButton("Front View",but5,x0,y-dbutton,x1,y);
+ button->SetFillColor(butcolor);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but6 = "gAliFast->Display()->DrawAllViews()";
+ button = new TButton("All Views",but6,x0,y-dbutton,x1,y);
+ button->SetFillColor(butcolor);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but7 = "gAliFast->Display()->DrawViewGL()";
+ button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
+ button->SetFillColor(38);
+ button->Draw();
+
+ y -= dbutton +dy;
+ char *but8 = "gAliFast->Display()->DrawViewX3D()";
+ button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
+ button->SetFillColor(38);
+ button->Draw();
+
+ // display logo
+ TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
+ diamond->SetFillColor(50);
+ diamond->SetTextAlign(22);
+ diamond->SetTextColor(5);
+ diamond->SetTextSize(0.11);
+ diamond->Draw();
+ diamond->AddText(".. ");
+ diamond->AddText("ROOT");
+ diamond->AddText("AliFAST");
+ diamond->AddText("... ");
+ diamond->AddText(" ");
+}
+
+//_____________________________________________________________________________
+
+Int_t AliFDisplay::DistancetoPrimitive(Int_t px, Int_t py)
+{
+// Compute distance from point px,py to objects in event
+
+ if (gPad == fTrigPad) {gPad->SetCursor(kCross); return 0;}
+
+ const Int_t big = 9999;
+ Int_t dist = big;
+ Float_t xmin = gPad->GetX1();
+ Float_t xmax = gPad->GetX2();
+ Float_t dx = 0.05*(xmax - xmin);
+ Float_t x = gPad->AbsPixeltoX(px);
+ if (x < xmin+dx || x > xmax-dx) return dist;
+
+ // scan list of particles
+ dist = fParticle->DistancetoPrimitive(px, py);
+ if (dist <= 0) return 0;
+
+ // scan list of fruits
+ TIter nextf(fFruits);
+ AliFFruit *fruit;
+ while((fruit=(AliFFruit*)nextf())) {
+ dist = fruit->DistancetoPrimitive(px, py);
+ if (dist < 5) {
+ gPad->SetSelected(fruit->Fruit());
+ gPad->SetCursor(kCross);
+ return 0;
+ }
+ }
+
+ // scan list of detectors (currently only one tube)
+ dist = fNodin->DistancetoPrimitive(px, py);
+ if (gPad->GetCanvas()->GetSelected() == gPad->GetView()) {
+ gPad->SetSelected(this);
+ }
+ return 0;
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::Draw(Option_t *)
+{
+// Insert current event in graphics pad list
+
+ if (fDrawAllViews) {
+ DrawAllViews();
+ return;
+ }
+
+ fPad->cd();
+
+ DrawView(fTheta, fPhi);
+
+ // Display the event number and title
+ fPad->cd();
+ DrawTitle();
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DrawAllViews()
+{
+// Draw front,top,side and 30 deg views
+
+ fDrawAllViews = kTRUE;
+ fPad->cd();
+ fPad->SetFillColor(15);
+ fPad->Clear();
+ fPad->Divide(2,2);
+
+ // draw 30 deg view
+ fPad->cd(1);
+ DrawView(30, 30);
+ DrawTitle();
+
+ // draw front view
+ fPad->cd(2);
+ DrawView(0, -90);
+ DrawTitle("Front");
+
+ // draw top view
+ fPad->cd(3);
+ DrawView(90, -90);
+ DrawTitle("Top");
+
+ // draw side view
+ fPad->cd(4);
+ DrawView(90, 0);
+ DrawTitle("Side");
+
+ fPad->cd(2);
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DrawTitle(Option_t *option)
+{
+// Draw the event title
+
+ Float_t xmin = gPad->GetX1();
+ Float_t xmax = gPad->GetX2();
+ Float_t ymin = gPad->GetY1();
+ Float_t ymax = gPad->GetY2();
+ Float_t dx = xmax-xmin;
+ Float_t dy = ymax-ymin;
+ if (strlen(option) == 0) {
+ TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
+ title->SetBit(kCanDelete);
+ title->SetFillColor(42);
+ title->Draw();
+ char ptitle[100];
+ sprintf(ptitle,"Pythia event: %d, Run:%d",gAliFast->Event(), gAliFast->Run());
+ title->AddText(ptitle);
+ sprintf(ptitle,"Pythia Mode: %s",gAliFast->MCMaker()->GetTitle());
+ title->AddText(ptitle);
+ } else {
+ TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
+ label->SetBit(kCanDelete);
+ label->SetFillColor(42);
+ label->Draw();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DrawView(Float_t theta, Float_t phi)
+{
+// Draw a view of ALIAS
+
+ gPad->SetFillColor(1);
+ // Display ALIAS outline
+ gPad->Clear();
+
+ Int_t iret;
+ TView *view = new TView(1);
+ view->SetRange(-fRin, -fRin, -fZin, fRin, fRin, fZin);
+
+ fNodin->Draw("same");
+
+ // add itself to the list
+ AppendPad();
+
+ //Loop on all makers to add their products to the pad
+ TIter next(gAliFast->Makers());
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->Draw();
+ }
+ view->SetView(phi, theta, 0, iret);
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DrawViewGL()
+{
+// Draw current view using OPENGL
+
+ TPad *pad = (TPad*)gPad->GetPadSave();
+ pad->cd();
+ TView *view = pad->GetView();
+ if (!view) return;
+ pad->x3d("OPENGL");
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::DrawViewX3D()
+{
+// Draw current view using X3D
+
+ TPad *pad = (TPad*)gPad->GetPadSave();
+ pad->cd();
+ TView *view = pad->GetView();
+ if (!view) return;
+ pad->x3d();
+}
+
+//______________________________________________________________________________
+void AliFDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+//*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
+//*-* =========================================
+
+ if (gPad->GetView()) {
+ gPad->GetView()->ExecuteRotateView(event, px, py);
+ }
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::GetEvent(Int_t event)
+{
+// Read event in memory
+
+ gAliFast->GetTreeEvent(event);
+
+ Draw();
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::Paint(Option_t *)
+{
+// Paint miscellaneous items
+
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t
+pt, Int_t type, Option_t *option)
+{
+// Display fruit from obj
+
+ AliFFruit *fruit = new AliFFruit(obj, eta, phi, pt, type);
+ fFruits->Add(fruit);
+ fruit->Paint(option);
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::PaintParticles(Option_t *option)
+{
+ if (fDrawParticles) fParticle->Paint(option);
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::SetGeometry(Float_t rin)
+{
+// Set ALIAS in/out outline parameters
+
+ fRin = rin;
+ fRout = 1.2*rin;
+ fZin = 600;
+ fZout = 680;
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::SetPTcut(Float_t ptcut)
+{
+ fPTcut = ptcut;
+
+ if (fDrawAllViews) {
+ fPad->cd(1); gPad->Modified();
+ fPad->cd(2); gPad->Modified();
+ fPad->cd(3); gPad->Modified();
+ fPad->cd(4); gPad->Modified();
+ fPad->cd();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::SetPTcutEGMUNU(Float_t ptcut)
+{
+ fPTcutEGMUNU = ptcut;
+
+ if (fDrawAllViews) {
+ fPad->cd(1); gPad->Modified();
+ fPad->cd(2); gPad->Modified();
+ fPad->cd(3); gPad->Modified();
+ fPad->cd(4); gPad->Modified();
+ fPad->cd();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::SetView(Float_t theta, Float_t phi)
+{
+// change viewing angles for current event
+
+ fPad->cd();
+ fDrawAllViews = kFALSE;
+ fPhi = phi;
+ fTheta = theta;
+ Int_t iret;
+
+ TView *view = gPad->GetView();
+ if (view) view->SetView(fPhi, fTheta, 0, iret);
+ else Draw();
+
+ gPad->Modified();
+}
+
+//_____________________________________________________________________________
+void AliFDisplay::ShowNextEvent(Int_t delta)
+{
+// Display (current event_number+delta)
+// delta = 1 shown next event
+// delta = -1 show previous event
+
+ if (delta) {
+ gAliFast->Clear();
+ Int_t current_event = gAliFast->Event();
+ Int_t new_event = current_event + delta;
+ gAliFast->GetTreeEvent(new_event);
+ }
+ fPad->cd();
+ Draw();
+}
+
+//______________________________________________________________________________
+void AliFDisplay::SizeFruit() const
+{
+ const Int_t npoints = 2;
+ gSize3D.numPoints += npoints;
+ gSize3D.numSegs += (npoints-1);
+ gSize3D.numPolys += 0;
+}
+
+//______________________________________________________________________________
+void AliFDisplay::SizeParticles() const
+{
+ if (fDrawParticles) fParticle->SizeParticles();
+}
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFDisplay_H
+#define AliFDisplay_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFDisplay //
+// //
+// Utility class to display ALICE outline, tracks, clusters, jets,.. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFVirtualDisplay_H
+#include "AliFVirtualDisplay.h"
+#endif
+
+class TCanvas;
+class TPad;
+class TArc;
+class TTUBE;
+class TNode;
+class TPolyLine3D;
+class TList;
+class AliFParticle;
+
+class AliFDisplay : public AliFVirtualDisplay {
+
+private:
+ Bool_t fDrawAllViews; //Flag True if AllViews selected
+ Bool_t fDrawParticles; //Flag True if particles to be drawn
+ Float_t fPTcut; //PT cut to display objects
+ Float_t fPTcutEGMUNU; //PT cut for Electrons, Gammas, MUons, Neutrinos
+ Float_t fRin; //Inner ALIAS radius
+ Float_t fRout; //Outer ALIAS radius
+ Float_t fZin; //Inner ALIAS length along Z
+ Float_t fZout; //Outer ALIAS length along Z
+ Float_t fTheta; //Viewing angle theta
+ Float_t fPhi; //Viewing angle phi
+ TCanvas *fCanvas; //Pointer to the display canvas
+ TPad *fTrigPad; //Pointer to the trigger pad
+ TPad *fButtons; //Pointer to the buttons pad
+ TPad *fPad; //Pointer to the event display main pad
+ TTUBE *fTubin; //Inner tube
+ TTUBE *fTubout; //outer tube
+ TNode *fNodin; //Node for detector outline
+ TList *fFruits; //List for fruits
+ AliFParticle *fParticle; //Pointer to Particle graphics manager
+
+public:
+ AliFDisplay();
+ AliFDisplay(const char *title);
+ virtual ~AliFDisplay();
+ virtual Bool_t AllViews() {return fDrawAllViews;}
+ virtual void Clear(Option_t *option="");
+ virtual void DisplayButtons();
+ virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
+ virtual void Draw(Option_t *option="");
+ virtual void DrawAllViews();
+ Bool_t DrawParticles() {return fDrawParticles;}
+ virtual void DrawTitle(Option_t *option="");
+ virtual void DrawView(Float_t theta, Float_t phi);
+ virtual void DrawViewGL();
+ virtual void DrawViewX3D();
+ virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
+ virtual void GetEvent(Int_t event); //*MENU*
+ TNode *Nodin() {return fNodin;}
+ TTUBE *Tubin() {return fTubin;}
+ TPad *Pad() {return fPad;}
+ virtual void Paint(Option_t *option="");
+ virtual void PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type, Option_t *option="");
+ virtual void PaintParticles(Option_t *option="");
+ Float_t PTcut() {return fPTcut;}
+ Float_t PTcutEGMUNU() {return fPTcutEGMUNU;}
+ Float_t Rin() {return fRin;}
+ Float_t Rout() {return fRout;}
+ virtual void SetDrawParticles(Bool_t draw=kTRUE) {fDrawParticles=draw;} // *MENU*
+ virtual void SetPTcut(Float_t ptcut=0.4); // *MENU*
+ virtual void SetPTcutEGMUNU(Float_t ptcut=5); // *MENU*
+ virtual void SetGeometry(Float_t rin=115); // *MENU*
+ virtual void SetView(Float_t theta, Float_t phi);
+ virtual void ShowNextEvent(Int_t delta=1);
+ virtual void SizeFruit() const;
+ virtual void SizeParticles() const;
+ Float_t Zin() {return fZin;}
+ Float_t Zout() {return fZout;}
+
+ ClassDef(AliFDisplay, 0) //Utility class to display ALIAS outline, tracks, clusters, jets,..
+};
+
+#endif
+
+
+
+
+
+
+
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFFruit //
+// //
+// Utility class to draw Electrons, photons, Jets, Clusters,etc //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TMath.h>
+
+#include "AliFDisplay.h"
+#include "AliFFruit.h"
+#include "AliFast.h"
+
+ClassImp(AliFFruit)
+
+
+//_____________________________________________________________________________
+AliFFruit::AliFFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type)
+ : TPolyLine3D(2)
+{
+ // Create a fruit object.
+ // Current implementation uses a 3-d polyline to visualize this fruit
+
+ fFruit = obj;
+ SetBit(kCanDelete);
+
+ const Int_t color[7] = {0,7,3,2,6,4,0};
+ const Int_t width[7] = {8,8,8,8,8,8,8};
+ Int_t lwidth = width[type];
+ AliFDisplay *display = (AliFDisplay*)gAliFast->Display();
+ if (display->AllViews()) lwidth /= 2;
+ const Float_t PTMAX = 100;
+ if (pt <= 0) return;
+ Float_t rin = display->Rin();
+ Float_t rout = display->Rout();
+ Float_t theta = 2*TMath::ATan(TMath::Exp(-eta));
+ Float_t tantet = TMath::Tan(theta);
+ Float_t cosphi = TMath::Cos(phi);
+ Float_t sinphi = TMath::Sin(phi);
+ Float_t zz = pt/PTMAX;
+ if (zz > 3) zz = 3;
+ Float_t rex = rin + 3*zz*(rout - rin);
+ Float_t z1,z2;
+ if (eta != 0) {
+ z1 = rin/tantet;
+ z2 = rex/tantet;
+ } else {
+ z1 = z2 = 0;
+ }
+ SetPoint(0, rin*cosphi,rin*sinphi, z1);
+ SetPoint(1, rex*cosphi,rex*sinphi, z2);
+ SetLineColor(color[type]);
+ SetLineWidth(width[type]);
+}
+
+//_____________________________________________________________________________
+void AliFFruit::Delete(Option_t *)
+{
+// Dummy
+
+}
+
+//______________________________________________________________________________
+char *AliFFruit::GetObjectInfo(Int_t px, Int_t py)
+{
+ return fFruit->GetObjectInfo(px, py);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFFruit_H
+#define AliFFruit_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFFruit //
+// //
+// Utility class to draw Electrons, photons, Jets, Clusters,etc //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TPolyLine3D
+#include <TPolyLine3D.h>
+#endif
+
+class AliFDisplay;
+
+class AliFFruit : public TPolyLine3D {
+
+private:
+ TObject *fFruit; //Pointer to original fruit
+
+public:
+ AliFFruit() {;}
+ AliFFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type);
+ virtual ~AliFFruit() {;}
+ virtual void Delete(Option_t *option="");
+ TObject *Fruit() {return fFruit;}
+ virtual char *GetObjectInfo(Int_t px, Int_t py);
+
+ ClassDef(AliFFruit, 0) //Utility class to draw Electrons, photons, Jets, Clusters,etc
+};
+
+#endif
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFHistBrowser //
+// //
+// helper class to browse AliFast Makers histograms. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TBrowser.h>
+#include "AliFast.h"
+#include "AliFMaker.h"
+#include "AliFHistBrowser.h"
+
+ClassImp(AliFHistBrowser)
+
+
+
+//_____________________________________________________________________________
+AliFHistBrowser::AliFHistBrowser()
+ : TNamed("Histograms","ALIfast Histograms browser")
+{
+
+}
+
+//_____________________________________________________________________________
+void AliFHistBrowser::Browse(TBrowser *b)
+{
+
+ TIter next(gAliFast->Makers());
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ b->Add(maker->Histograms(),maker->GetName());
+ }
+
+}
--- /dev/null
+#ifndef AliFHistBrowser_H
+#define AliFHistBrowser_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFHistBrowser //
+// //
+// helper class to browse AliFast Makers histograms. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+#endif
+
+class AliFHistBrowser : public TNamed {
+
+public:
+ AliFHistBrowser();
+ virtual ~AliFHistBrowser() {;}
+ virtual void Browse(TBrowser *b);
+ Bool_t IsFolder() {return kTRUE;}
+
+ ClassDef(AliFHistBrowser, 0) //helper class to browse AliFast Makers histograms
+};
+
+#endif
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast virtual base class for Makers //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TChain.h>
+#include <TTree.h>
+#include <TList.h>
+#include <TClonesArray.h>
+#include <TBrowser.h>
+
+#include "AliFMaker.h"
+#include "AliFast.h"
+
+ClassImp(AliFMaker)
+
+//_____________________________________________________________________________
+AliFMaker::AliFMaker()
+{
+ fBranchName = "";
+ fSave = 0;
+ fHistograms = 0;
+ fFruits = 0;
+ fClones = 0;
+ fIsClonable = kTRUE;
+}
+
+//_____________________________________________________________________________
+AliFMaker::AliFMaker(const char *name, const char *title)
+ :TNamed(name,title)
+{
+ fBranchName = "";
+ fSave = 0;
+ fHistograms = new TList();
+ fClones = 0;
+ fIsClonable = kTRUE;
+
+ gAliFast->Makers()->Add(this);
+}
+
+//_____________________________________________________________________________
+AliFMaker::~AliFMaker()
+{
+ delete fFruits;
+ delete fClones;
+}
+
+//______________________________________________________________________________
+void AliFMaker::Browse(TBrowser *b)
+{
+// Insert Maker objects in the list of objects to browsed.
+
+ char name[64];
+ if( b == 0 || fFruits == 0) return;
+ TObject *obj;
+
+// If fFruits is a ClonesArray, insert all the objects in the list
+// of browsable objects
+ if (fFruits->InheritsFrom("TClonesArray")) {
+ TClonesArray *clones = (TClonesArray*)fFruits;
+ Int_t nobjects = clones->GetEntries();
+ for (Int_t i=0;i<nobjects;i++) {
+ obj = clones->At(i);
+ sprintf(name,"%s_%d",obj->GetName(),i);
+ if (strstr(name,"AliF")) b->Add(obj, &name[4]);
+ else b->Add(obj, &name[0]);
+ }
+// fFruits points to an object in general. Insert this object in the browser
+ } else {
+ b->Add( fFruits, fFruits->GetName());
+ }
+}
+
+//_____________________________________________________________________________
+void AliFMaker::Clear(Option_t *option)
+{
+ if (fFruits) fFruits->Clear(option);
+ delete fClones;
+ fClones = 0;
+}
+
+//_____________________________________________________________________________
+void AliFMaker::Draw(Option_t *)
+{
+// Insert products of this maker in graphics pad list
+
+ TObject *obj;
+
+// If fFruits is a ClonesArray, insert all the objects in the list
+// of objects to be painted
+ if (fFruits->InheritsFrom("TClonesArray")) {
+ TClonesArray *clones = (TClonesArray*)fFruits;
+ Int_t nobjects = clones->GetEntries();
+ for (Int_t i=0;i<nobjects;i++) {
+ obj = clones->At(i);
+ if (obj) obj->AppendPad();
+ }
+// fFruits points to an object in general. Insert this object in the pad
+ } else {
+ fFruits->AppendPad();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFMaker::FillClone()
+{
+// Copy original fruits in a separate list (clones)
+
+ if (!fIsClonable || fFruits == 0) return;
+ fClones = fFruits->Clone();
+}
+
+//_____________________________________________________________________________
+void AliFMaker::Init()
+{
+ //dummy
+}
+
+//_____________________________________________________________________________
+void AliFMaker::Finish()
+{
+
+ //dummy
+}
+
+//_____________________________________________________________________________
+void AliFMaker::Make()
+{
+
+ Warning("Make","Dummy function called");
+}
+
+//_____________________________________________________________________________
+void AliFMaker::PrintInfo()
+{
+ printf("*************************************************************\n");
+ printf("* *\n");
+ printf("* %25s *\n",GetName());
+ printf("* *\n");
+ printf("*************************************************************\n");
+
+ Dump();
+}
+
+//_____________________________________________________________________________
+void AliFMaker::MakeBranch()
+{
+// Adds the list of physics objects to the AliFast tree as a new branch
+
+ if (fSave == 0) return;
+
+ TTree *tree = gAliFast->Tree();
+ if (tree == 0 || fFruits == 0 || fBranchName.Length() == 0) return;
+
+// Make a branch tree if a branch name has been set
+ Int_t buffersize = 4000;
+ if (fFruits->InheritsFrom("TClonesArray")) {
+ tree->Branch(fBranchName.Data(), &fFruits, buffersize);
+ } else {
+ tree->Branch(fBranchName.Data(),fFruits->ClassName(), &fFruits, buffersize);
+ }
+}
+
+//_____________________________________________________________________________
+void AliFMaker::SetChainAddress(TChain *chain)
+{
+// Set branch address in a chain of files
+
+ if (chain == 0) return;
+
+ chain->SetBranchAddress(fBranchName.Data(), &fFruits);
+}
+
+//______________________________________________________________________________
+void AliFMaker::Streamer(TBuffer &R__b)
+{
+ // Stream an object of class AliFMaker.
+
+ if (R__b.IsReading()) {
+ R__b.ReadVersion(); // Version_t R__v = R__b.ReadVersion();
+ TNamed::Streamer(R__b);
+ R__b >> fSave;
+ R__b >> fFruits;
+ fBranchName.Streamer(R__b);
+ R__b >> fHistograms;
+ //this is an addition to the standard rootcint version of Streamer
+ //branch address for this maker is set automatically
+ TTree *tree = gAliFast->Tree();
+ if (tree == 0 || fFruits == 0 || fBranchName.Length() == 0) return;
+ TBranch *branch = tree->GetBranch(fBranchName.Data());
+ if (branch) branch->SetAddress(&fFruits);
+ } else {
+ R__b.WriteVersion(AliFMaker::IsA());
+ TNamed::Streamer(R__b);
+ R__b << fSave;
+ R__b << fFruits;
+ fBranchName.Streamer(R__b);
+ R__b << fHistograms;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFMaker_H
+#define AliFMaker_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast virtual base class for Makers //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+#endif
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
+
+class TList;
+class TBrowser;
+class TChain;
+
+class AliFMaker : public TNamed {
+
+protected:
+
+ Bool_t fIsClonable; //!True if Maker objects are clonable
+ Int_t fSave; // = 1 if m-Maker to be saved in the Tree
+ TObject *fFruits; //Pointer to maker fruits (result)
+ TObject *fClones; //Pointer to clones of fruits
+ TString fBranchName; //Name of branch (if any)
+ TList *fHistograms; //Pointer to list supporting Maker histograms
+
+public:
+ AliFMaker();
+ AliFMaker(const char *name, const char *title);
+ virtual ~AliFMaker();
+ virtual void Browse(TBrowser *b);
+ virtual void Clear(Option_t *option="");
+ virtual void Draw(Option_t *option="");
+ virtual void Finish();
+ TList *Histograms() {return fHistograms;}
+ virtual void Init();
+ Bool_t IsFolder() {return kTRUE;}
+ TObject *Fruit() {return fFruits;}
+ TClonesArray *Fruits() {return (TClonesArray*)fFruits;}
+ TObject *Clones() {return fClones;}
+ virtual void FillClone();
+ virtual void Make() = 0;
+ virtual void PrintInfo();
+ virtual void MakeBranch();
+ virtual void Save(Int_t save=1) {fSave = save;}
+ virtual void SetChainAddress(TChain *chain);
+
+ ClassDef(AliFMaker, 1) //AliFast virtual base class for Makers
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFParticle //
+// //
+// Graphics interface to event generators particle //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include "TMCParticle.h"
+#include "TClonesArray.h"
+#include "TPolyLine3D.h"
+#include "TCanvas.h"
+#include <TList.h>
+#include <TMath.h>
+
+#include "AliFParticle.h"
+#include "AliFMCMaker.h"
+#include "AliFast.h"
+#include "AliFDisplay.h"
+
+const Int_t kRECONS = BIT(16);
+
+ClassImp(AliFParticle)
+
+
+//_____________________________________________________________________________
+AliFParticle::AliFParticle(const char * name) :TNamed(name,name)
+{
+ // Create list to support list of particles
+ fParticles = new TList();
+ fDisplay = (AliFDisplay*)gAliFast->Display();
+}
+
+//_____________________________________________________________________________
+AliFParticle::~AliFParticle()
+{
+ if (fParticles) fParticles->Delete();
+ delete fParticles;
+}
+
+//_____________________________________________________________________________
+void AliFParticle::Clear(Option_t *)
+{
+// Delete graphics temporary objects
+
+ fParticles->Delete();
+
+}
+
+//_____________________________________________________________________________
+void AliFParticle::Delete(Option_t *)
+{
+// Dummy
+
+}
+
+//_____________________________________________________________________________
+Int_t AliFParticle::DistancetoPrimitive(Int_t px, Int_t py)
+{
+ // scan list of particles
+ TClonesArray *particles = gAliFast->MCMaker()->Fruits();
+ Int_t uid, dist;
+ TIter next(fParticles);
+ TPolyLine3D *line;
+ while((line=(TPolyLine3D*)next())) {
+ dist = line->DistancetoPrimitive(px, py);
+ if (dist < 2) {
+ uid = line->GetUniqueID();
+ fMCParticle = (TMCParticle*)particles->UncheckedAt(uid);
+ if (!fMCParticle) continue;
+ fLine = line;
+ SetName(fMCParticle->GetName());
+ gPad->SetSelected(this);
+ gPad->SetCursor(kCross);
+ return 0;
+ }
+ }
+ return 999;
+}
+
+//______________________________________________________________________________
+void AliFParticle::ExecuteEvent(Int_t event, Int_t , Int_t )
+{
+ switch (event) {
+
+ case kButton1Down:
+ gGXW->SetLineColor(-1);
+ gPad->AbsCoordinates(kTRUE);
+ fLine->SetLineColor(6);
+ fLine->SetLineWidth(6);
+ fLine->Paint();
+ break;
+
+ case kMouseMotion:
+ break;
+
+ case kButton1Motion:
+ break;
+
+ case kButton1Up:
+ gGXW->SetLineColor(-1);
+ fLine->SetLineColor(kYellow);
+ fLine->SetLineWidth(1);
+ fLine->Paint();
+ gPad->AbsCoordinates(kFALSE);
+ }
+}
+
+//______________________________________________________________________________
+char *AliFParticle::GetObjectInfo(Int_t , Int_t )
+{
+ static char info[100];
+ sprintf(info,"px=%f, py=%f, pz=%f, E=%f",
+ fMCParticle->GetPx(),
+ fMCParticle->GetPy(),
+ fMCParticle->GetPz(),
+ fMCParticle->GetEnergy());
+
+
+ return info;
+}
+
+
+//______________________________________________________________________________
+TPolyLine3D *AliFParticle::HelixCurve(Float_t field, Float_t pmom, Float_t *vin)
+{
+// Estimate step size in function of field.
+// Create a 3-D polyline with points computed with this step size
+
+ Float_t step = 10;
+ const Int_t kMAXSTEP = 2000;
+ Float_t sx[kMAXSTEP], sy[kMAXSTEP], sz[kMAXSTEP];
+ if (pmom > 0) step = 10*pmom;
+ if (step > 100) step = 100;
+ if (step < .5) step = .5;
+
+ Float_t vout[6];
+ Int_t i,j;
+ sx[0] = vin[0];
+ sy[0] = vin[1];
+ sz[0] = vin[2];
+ Int_t nsteps = 1;
+ Float_t rin = Display()->Rin();
+ Float_t zout = Display()->Zout();
+ for (i=1;i<kMAXSTEP;i++) {
+ HelixStep(field,step,pmom,vin,vout);
+ if (TMath::Abs(vout[2]) > zout) break;
+ if (vout[0]*vout[0] + vout[1]*vout[1] > 1.1*rin*rin) break;
+ sx[nsteps] = vout[0];
+ sy[nsteps] = vout[1];
+ sz[nsteps] = vout[2];
+ nsteps++;
+ for (j=0;j<6;j++) vin[j] = vout[j];
+ }
+ if (nsteps < 2) return 0;
+ TPolyLine3D *line = new TPolyLine3D(nsteps,sx, sy,sz);
+ line->SetBit(kCanDelete);
+ return line;
+}
+
+//______________________________________________________________________________
+void AliFParticle::HelixStep(Float_t field, Float_t step, Float_t pmom, Float_t *vin, Float_t *vout)
+{
+// extrapolate track with parameters in vector vin in a constant field
+// oriented along Z axis (in tesla/meters).
+// Output in vector vout
+// vin[0-->6] = x,y,z,px,py,pz
+// translated to C++ from GEANT3 routine GHELX3
+
+ Float_t sint, sintt, tsint, cos1t, sin2;
+// units are tesla,centimeters,gev/c
+ const Float_t ec = 2.9979251e-3;
+ Float_t h4 = field*ec;
+ Float_t hp = vin[2];
+ Float_t tet = -h4*step/pmom;
+ if (TMath::Abs(tet) > 0.15) {
+ sint = TMath::Sin(tet);
+ sintt = sint/tet;
+ tsint = (tet-sint)/tet;
+ sin2 = TMath::Sin(0.5*tet);
+ cos1t = 2*sin2*sin2/tet;
+ } else {
+ tsint = tet*tet/6;
+ sintt = 1 - tsint;
+ sint = tet*sintt;
+ cos1t = 0.5*tet;
+ }
+ Float_t f1 = step*sintt;
+ Float_t f2 = step*cos1t;
+ Float_t f3 = step*tsint*hp;
+ Float_t f4 = -tet*cos1t;
+ Float_t f5 = sint;
+ Float_t f6 = tet*cos1t*hp;
+
+ vout[0] = vin[0] + (f1*vin[3] - f2*vin[4]);
+ vout[1] = vin[1] + (f1*vin[4] + f2*vin[3]);
+ vout[2] = vin[2] + (f1*vin[5] + f3);
+
+ vout[3] = vin[3] + (f4*vin[3] - f5*vin[4]);
+ vout[4] = vin[4] + (f4*vin[4] + f5*vin[3]);
+ vout[5] = vin[5] + (f4*vin[5] + f6);
+}
+
+//_____________________________________________________________________________
+void AliFParticle::Paint(Option_t *option)
+{
+// Paint particles generated by AliFMCMaker
+// Only particles above fPTcut are drawn
+// Particle trajectory is computed along an helix in a constant field
+
+
+ // clean list of particles
+ fParticles->Delete();
+
+ TClonesArray *particles = gAliFast->MCMaker()->Fruits();
+ Int_t nparticles = particles->GetEntriesFast();
+ TMCParticle *part;
+ Float_t pmom, vx, vy, vz, pt;
+ Float_t vin[6];
+ Float_t field = 2; // 2 tesla
+ Int_t KF, aKF, charge;
+ for (Int_t i=0;i<nparticles;i++) {
+ part = (TMCParticle*)particles->UncheckedAt(i);
+ if (part->GetKS() != 1) continue;
+ KF = part->GetKF();
+ aKF = TMath::Abs(KF);
+ charge = gAliFast->MCMaker()->Charge(KF);
+ pt = TMath::Sqrt(part->GetPx()*part->GetPx() + part->GetPy()*part->GetPy());
+ if (pt < gAliFast->Display()->PTcut()) continue;
+ if (charge == 0 && pt < gAliFast->Display()->PTcutEGMUNU()) continue;
+ pmom = TMath::Sqrt(part->GetPx()*part->GetPx() + part->GetPy()*part->GetPy() + part->GetPz()*part->GetPz());
+ vx = part->GetVx();
+ vy = part->GetVy();
+ vz = part->GetVz();
+ vin[0] = vx;
+ vin[1] = vy;
+ vin[2] = vz;
+ vin[3] = part->GetPx()/pmom;
+ vin[4] = part->GetPy()/pmom;
+ vin[5] = part->GetPz()/pmom;
+ TPolyLine3D *line = HelixCurve(charge*field/3, pmom, vin);
+ if (line == 0) continue;
+ fParticles->Add(line);
+ if (part->GetLineColor() == 1) {
+ if (charge == 0) part->SetLineStyle(2);
+ part->SetLineColor(kYellow);
+ if (aKF == 11) part->SetLineColor(kRed);
+ if (aKF == 13) part->SetLineColor(kMagenta);
+ if (aKF == 22) part->SetLineColor(kGreen);
+ }
+ line->SetUniqueID(i);
+ if (!part->TestBit(kRECONS)) {
+ part->SetLineColor(7);
+ part->SetLineWidth(1);
+ }
+ line->SetLineColor(part->GetLineColor());
+ line->SetLineStyle(part->GetLineStyle());
+ line->SetLineWidth(part->GetLineWidth());
+ line->Paint(option);
+ }
+}
+
+//______________________________________________________________________________
+void AliFParticle::SetLineAttributes()
+{
+//*-*-*-*-*-*-*-*-*Invoke the DialogCanvas Line attributes*-*-*-*-*-*-*
+//*-* =======================================
+
+ gROOT->SetSelectedPrimitive(fMCParticle);
+ fMCParticle->SetLineAttributes();
+}
+
+
+//______________________________________________________________________________
+void AliFParticle::SizeParticles() const
+{
+ TIter next(fParticles);
+ TPolyLine3D *line;
+ while((line=(TPolyLine3D*)next())) {
+ line->Sizeof3D();
+ }
+}
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef AliFParticle_H
+#define AliFParticle_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFParticle //
+// //
+// Graphics interface to event generators particle //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+#endif
+
+class TMCParticle;
+class TPolyLine3D;
+class TList;
+class AliFDisplay;
+
+class AliFParticle : public TNamed {
+
+private:
+ TList *fParticles; //List for particles
+ AliFDisplay *fDisplay; //pointer to AliFDisplay object
+ TMCParticle *fMCParticle; //pointer to selected particle
+ TPolyLine3D *fLine; //pointer to line3D
+
+public:
+ AliFParticle() {;}
+ AliFParticle(const char *name);
+ virtual ~AliFParticle();
+ virtual void Clear(Option_t *option="");
+ virtual void Delete(Option_t *option="");
+ virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
+ AliFDisplay *Display() {return fDisplay;}
+ virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
+ virtual char *GetObjectInfo(Int_t px, Int_t py);
+ TPolyLine3D *HelixCurve(Float_t field, Float_t pmom, Float_t *vin);
+ virtual void HelixStep(Float_t field, Float_t step, Float_t pmom, Float_t *vin, Float_t *vout);
+ virtual void Paint(Option_t *option="");
+ virtual void SetLineAttributes(); // *MENU*
+ virtual void SizeParticles() const;
+
+ ClassDef(AliFParticle, 0) //Graphics interface to event generators particle
+};
+
+#endif
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast Track class //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliFTrack.h"
+#include "AliFast.h"
+
+ClassImp(AliFTrack)
+
+//_____________________________________________________________________________
+AliFTrack::AliFTrack(Int_t code, Double_t charge,
+ Double_t pT, Double_t eta, Double_t phi,
+ Double_t v11, Double_t v22,Double_t v33,
+ Double_t v12, Double_t v13, Double_t v23, Int_t iFlag)
+{
+ fIdTrack = code;
+ fChTrack = charge;
+ fPT = pT;
+ fEta = eta;
+ fPhi = phi;
+ fV11 = v11;
+ fV22 = v22;
+ fV33 = v33;
+ fV13 = v13;
+ fV12 = v12;
+ fV23 = v23;
+ fIFlag = iFlag;
+}
+
+
+//_____________________________________________________________________________
+void AliFTrack::Draw(Option_t *)
+{
+
+}
+
+//_____________________________________________________________________________
+void AliFTrack::Paint(Option_t *)
+{
+
+}
+
--- /dev/null
+#ifndef AliFTrack_H
+#define AliFTrack_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast track class //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+class AliFTrack : public TObject {
+
+private:
+ Int_t fIdTrack; //Track code
+ Double_t fChTrack; //Track charge
+ Double_t fPT; //Track transverse momenta
+ Double_t fEta; //Track eta
+ Double_t fPhi; //Track phi
+ Double_t fV11; //
+ Double_t fV22; //
+ Double_t fV33; //
+ Double_t fV12; //
+ Double_t fV13; //
+ Double_t fV23; //
+ Int_t fIFlag; //
+
+public:
+ AliFTrack() {;}
+ AliFTrack(Int_t code, Double_t charge, Double_t pT, Double_t eta, Double_t phi,
+ Double_t v11, Double_t v22, Double_t v33,
+ Double_t v12, Double_t v13, Double_t v23, Int_t iFlag);
+ virtual ~AliFTrack() {;}
+ virtual void Draw(Option_t *option="");
+ virtual void Paint(Option_t *option="");
+
+ //getters
+ Int_t IdTrack() {return fIdTrack;}
+ Double_t ChTrack() {return fChTrack;}
+ Double_t PT() {return fPT;}
+ Double_t Eta() {return fEta;}
+ Double_t Phi() {return fPhi;}
+ Double_t V11() {return fV11;}
+ Double_t V22() {return fV22;}
+ Double_t V33() {return fV33;}
+ Double_t V12() {return fV12;}
+ Double_t V13() {return fV13;}
+ Double_t V23() {return fV23;}
+ Int_t IFlag() {return fIFlag;}
+
+
+ ClassDef(AliFTrack, 1) //AliFast track class
+};
+
+#endif
--- /dev/null
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast TrackMaker class. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////////
+// ---------------------------------------------------------------------//
+// //
+// origin: "res.f" fortran by Karel Safarik which was used to //
+// calculate the track resolution for TP. //
+// Different detectors and material can be selected. //
+// The basic routines compute information and error matrices //
+// used for the calculation of momentum resolution. //
+// see references: ASK KAREL?? //
+// //
+// C++ in AliFast framework: Elzbieta Richter-Was and Yiota Foka //
+// following general structure od Makers in //
+// ATLFast by R. Brun. //
+// //
+// purpose: provide a Maker which by using general basic routines of //
+// "res.f" computes the necessary elements of covariance matrix//
+// for the calculation of Track Resolution. //
+// Those elements are the product of the TrackResolMaker and //
+// are hold in TrackResol class. They are expected to be used //
+// together with additional information for the calculation of //
+// the smeared momenta. //
+// Additional information necessary for this calculation //
+// will be provided via classes or functions specific to the //
+// specific study and/or detectors. //
+// One can select the detector and/or material for a specific //
+// study. //
+// //
+// starting point: res.f will be initialy partially contained in //
+// AliFTrackResolMaker and in AliFDet //
+// It will be reorganised further in the framework of //
+// AliFast according to the needs. //
+// Names of variables are kept as in fortran code. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifdef WIN32
+// there is a bug in the Microsoft VisualC++ compiler
+// this class must be compiled with optimization off on Windows
+# pragma optimize( "", off )
+#endif
+
+#include <TParticle.h>
+#include <TFile.h>
+#include <TSystem.h>
+#include <TRandom.h>
+#include <TROOT.h>
+#include <TMath.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TH3.h>
+
+#include "AliFast.h"
+//#include "AliFMCMaker.h"
+#include "AliFTrackMaker.h"
+#include "AliFTrack.h"
+#include "AliFDet.h"
+
+const Double_t kPi = TMath::Pi();
+const Double_t k2Pi = 2*kPi;
+const Double_t kPiHalf = kPi/2.;
+extern AliFast * gAliFast;
+ClassImp(AliFTrackMaker)
+
+//_____________________________________________________________________________
+AliFTrackMaker::AliFTrackMaker()
+{
+ fNTracks = 0;
+}
+
+//_____________________________________________________________________________
+AliFTrackMaker::AliFTrackMaker(const char *name, const char *title)
+ :AliFMaker(name,title)
+{
+// Default Setters for tracks
+
+ fFruits = new TClonesArray("AliFTrack",100, kFALSE);
+ fBranchName = "Tracks";
+ fNTracks = 0;
+// Please, how to do this optionally ??!!!
+ Save();
+}
+
+//_____________________________________________________________________________
+AliFTrackMaker::~AliFTrackMaker()
+{
+ //dummy
+}
+
+//_____________________________________________________________________________
+AliFTrack *AliFTrackMaker::AddTrack(Int_t code, Double_t charge,
+ Double_t pT, Double_t eta,Double_t phi,
+ Double_t v11, Double_t v22, Double_t v33,
+ Double_t v12, Double_t v13, Double_t v23, Int_t iFlag)
+{
+// Add a new track to the list of tracks
+
+ //Note the use of the "new with placement" to create a new track object.
+ //This complex "new" works in the following way:
+ // tracks[i] is the value of the pointer for track number i in the TClonesArray
+ // if it is zero, then a new track must be generated. This typically
+ // will happen only at the first events
+ // If it is not zero, then the already existing object is overwritten
+ // by the new track parameters.
+ // This technique should save a huge amount of time otherwise spent
+ // in the operators new and delete.
+
+ TClonesArray &tracks = *(TClonesArray*)fFruits;
+ return new(tracks[fNTracks++]) AliFTrack(code,charge,pT,eta,phi,
+ v11, v22, v33, v12, v13, v23, iFlag);
+}
+
+//_____________________________________________________________________________
+void AliFTrackMaker::Clear(Option_t *option)
+{
+ //Reset Track Maker
+
+ fNTracks = 0;
+ AliFMaker::Clear(option);
+}
+
+//_____________________________________________________________________________
+void AliFTrackMaker::Draw(Option_t *)
+{
+// Dummy Draw
+
+}
+
+//_____________________________________________________________________________
+void AliFTrackMaker::Init()
+{
+ //Create control histograms
+ if(gAliFast->TestTrack() == 0){
+
+ fResID11 = new TH1D("ResID11","Elec: delta(1/pTotal)*pTotal",1000,-0.5,0.5);
+ fResID12 = new TH1D("ResID12","Elec: delta(lambda)/lambda",1000,-0.01,0.01);
+ fResID13 = new TH1D("ResID13","Elec: delta(phi)/phi",1000,-0.01,0.01);
+
+ fResID21 = new TH1D("ResID21","Pion: delta(1/pTotal)*pTotal",1000,-1.0,1.0);
+ fResID22 = new TH1D("ResID22","Pion: delta(lambda)/lambda",1000,-1.0,1.0);
+ fResID23 = new TH1D("ResID23","Pion: delta(phi)/phi",1000,-1.0,1.0);
+
+ fResID31 = new TH1D("ResID31","Kaon: delta(1/pTotal)*pTotal",1000,-1.0,1.0);
+ fResID32 = new TH1D("ResID32","Kaon: delta(lambda)/lambda",1000,-1.0,1.0);
+ fResID33 = new TH1D("ResID33","Kaon: delta(phi)/phi",1000,-1.0,1.0);
+
+ fResID41 = new TH1D("ResID41","Proton: delta(1/pTotal)*pTotal",1000,-1.0,1.0);
+ fResID42 = new TH1D("ResID42","Proton: delta(lambda)/lambda",1000,-1.0,1.0);
+ fResID43 = new TH1D("ResID43","Proton: delta(phi)/phi",1000,-1.0,1.0);
+
+ }
+ //Create test histograms for TestJob only
+ if(gAliFast->TestTrack() == 1){
+ fResID1Test = new TH1D("ResID1Test","histogram21 from res.f",1000,0.075,10.075);
+ fResID2Test = new TH1D("ResID2Test","histogram21 from res.f",1000,0.075,10.075);
+ fResID3Test = new TH1D("ResID3Test","histogram21 from res.f",1000,0.075,10.075);
+ fResID4Test = new TH1D("ResID4Test","histogram21 from res.f",1000,0.075,10.075);
+ fResID5Test = new TH1D("ResID5Test","histogram21 from res.f",1000,0.075,10.075);
+ }
+
+ //Set particle masses
+ SetPionMass();
+ SetKaonMass();
+ SetElectronMass();
+ SetProtonMass();
+
+ //Switch on/off tracks reconstruction
+ SetRecTrack();
+
+}
+
+//_____________________________________________________________________________
+// Calculate track and its resolution
+//_____________________________________________________________________________
+void AliFTrackMaker::Make()
+{
+ Double_t v11, v22, v33, v12, v13, v23;
+ Int_t iFlag;
+
+ fNTracks = 0;
+
+ // Check if it is a TestJob
+ if(gAliFast->TestTrack() == 1){
+ // Run test job
+ MakeTest(10);
+ }else{
+ // Run production job
+ // Get pointers to Particles arrays and TClonesArray
+
+ TClonesArray *particles = gAliFast->Particles();
+ Int_t idPart, idTrack;
+ Double_t charge, pT, eta, phi;
+ TParticle *part;
+ Int_t nparticles = particles->GetEntriesFast();
+ printf("%10s%10d\n","nparticles",nparticles);
+ for(Int_t ind=0;ind<nparticles;ind++) {
+ part = (TParticle*)particles->UncheckedAt(ind);
+ idPart = part->GetPdgCode();
+ charge = part->GetPDG()->Charge();
+ pT = part->Pt();
+ eta = part->Eta();
+ phi = part->Phi();
+ printf("%10s%10d%20.5e%20.5e%20.5e%20.5e\n","Particle",idPart,charge,pT,eta,phi);
+ // Check convention for tracks reconstruction
+ idTrack = 0;
+ if(TMath::Abs(idPart) == 11) idTrack = 1;
+ if(TMath::Abs(idPart) == 111 || TMath::Abs(idPart) == 211) idTrack = 2;
+ if(TMath::Abs(idPart) == 311 || TMath::Abs(idPart) == 321) idTrack = 3;
+ if(TMath::Abs(idPart) == 2212) idTrack = 4;
+
+ if(idTrack > 0 && fRecTrack > 0){
+ // Check if track should be reconstructed
+ if((fRecTrack == 1 && idTrack == 1) ||
+ (fRecTrack == 2 && idTrack == 2) ||
+ (fRecTrack == 3 && idTrack == 3) ||
+ (fRecTrack == 4 && idTrack == 4) ||
+ fRecTrack == 100 ) {
+ // Tracks are reconstructed
+ ErrorMatrix(idTrack,pT,eta, v11, v22, v33, v12, v13, v23, iFlag);
+
+ // Calculate and smear track parameters
+ Double_t lambda, cosLambda, pTotal,pInverse;
+ Double_t pInverseSmea, lambdaSmea, phiSmea;
+ Double_t a1, a2, a3, b2, b3, c3;
+ Double_t rn1, rn2, rn3;
+
+ lambda = kPiHalf -2.0*TMath::ATan(TMath::Exp(-eta));
+ cosLambda = TMath::Cos(lambda);
+ pTotal = pT/cosLambda;
+ pInverse = 1.0/pTotal;
+
+ a1 = TMath::Sqrt(v11);
+ if(a1 == 0.){
+ a2 = 0;
+ a3 = 0;
+ }else{
+ a2 = v12/a1;
+ a3 = v13/a1;
+ }
+ b2 = TMath::Sqrt(v22-a2*a2);
+ if(b2 == 0.){
+ b3 = 0;
+ }else{
+ b3 = (v23 - a2*a3)/b2;
+ }
+ c3 = TMath::Sqrt(v33 - a3*a3 -b3*b3);
+ rn1 = gRandom->Gaus(0,1);
+ rn2 = gRandom->Gaus(0,1);
+ rn3 = gRandom->Gaus(0,1);
+
+ pInverseSmea = pInverse + a1*rn1;
+ lambdaSmea = lambda + a2*rn1 + b2*rn2;
+ phiSmea = phi + a3*rn1 + b3*rn2 + c3*rn3;
+
+ // Fill control histograms
+ if(idTrack == 1){
+ fResID11->Fill((pInverseSmea-pInverse)/pInverse);
+ fResID12->Fill((lambdaSmea-lambda)/lambda);
+ fResID13->Fill((phiSmea-phi)/phi);
+ }
+ else if(idTrack == 2){
+ fResID21->Fill((pInverseSmea-pInverse)/pInverse);
+ fResID22->Fill((lambdaSmea-lambda)/lambda);
+ fResID23->Fill((phiSmea-phi)/phi);
+ }
+ else if(idTrack == 3){
+ fResID31->Fill((pInverseSmea-pInverse)/pInverse);
+ fResID32->Fill((lambdaSmea-lambda)/lambda);
+ fResID33->Fill((phiSmea-phi)/phi);
+ }
+ else if(idTrack == 4){
+ fResID41->Fill((pInverseSmea-pInverse)/pInverse);
+ fResID42->Fill((lambdaSmea-lambda)/lambda);
+ fResID43->Fill((phiSmea-phi)/phi);
+ }
+ }else{
+ // Tracks are not reconstructed
+ v11=0.;
+ v12=0.;
+ v13=0.;
+ v22=0.;
+ v23=0.;
+ v33=0.;
+ iFlag=0;
+ }
+ // Store resolution variables to AliFTrack ClonesArray
+ AddTrack(idTrack, charge, pT, eta, phi, v11, v22, v33, v12, v13, v23, iFlag);
+ printf("%10s%10d%20.5e%20.5e%20.5e%20.5e%20.5e%20.5e%20.5e%20.5e%20.5e%20.5e%10d\n",
+ "Track",idTrack,charge,pT,eta,phi,v11, v22, v33, v12, v13, v23, iFlag);
+ }
+
+ }
+ }
+}
+
+//_____________________________________________________________________________
+void AliFTrackMaker::Finish()
+{
+ // For TestJob only
+ if(gAliFast->TestTrack() == 1){
+ /*
+ // Draw test histograms
+ TCanvas *c1 = new TCanvas("c1"," ",200,10,600,480);
+ c1->Divide(2,3);
+ c1->cd(1); fResID1Test->Draw();
+ c1->cd(2); fResID2Test->Draw();
+ c1->cd(3); fResID3Test->Draw();
+ c1->cd(4); fResID4Test->Draw();
+ c1->cd(5); fResID5Test->Draw();
+ c1->Update();
+ // Store TestRes.eps file
+ c1->Print("TestRes.eps");
+ */
+ // Store histograms on file
+ TFile f2("TestRes.root","RECREATE","Test Res.f");
+ fResID1Test->Write();
+ fResID2Test->Write();
+ fResID3Test->Write();
+ fResID4Test->Write();
+ fResID5Test->Write();
+ f2.Close();
+ }
+}
+//_____________________________________________________________________________
+void AliFTrackMaker::ErrorMatrix(Int_t idTrack, Double_t pT, Double_t eta,
+ Double_t &v11, Double_t &v22, Double_t &v33, Double_t &v12, Double_t &v13, Double_t &v23,
+ Int_t &iFlag)
+{
+ ///////////////////////////////////////////////
+ //idTrack track type input //
+ //pT transverse mom input //
+ //lambda deep angle input //
+ //v11,v22,v23 error matrix output //
+ //v12,v13,v23 output //
+ //iFlag output //
+ ///////////////////////////////////////////////
+
+ AliFDet *detector = gAliFast->Detector();
+ Int_t nDet = detector->NDet();
+ Int_t nDetActive = detector->NDetActive();
+ Int_t nTwice = nDetActive + nDetActive;
+
+ Double_t rTrack, rTrackInverse, pTotal, pInverse, diffPInverse;
+ Double_t safety;
+ Double_t cosLambda, tanLambda, diffLambda;
+ Double_t rDet;
+
+ Double_t hh0[kNMaxDet2][kNMaxDet2], hhi0[kNMaxDet2][kNMaxDet2];
+ Double_t hh1[kNMaxDet2][kNMaxDet2], hhi1[kNMaxDet2][kNMaxDet2];
+ Double_t dhhiOverPInverse[kNMaxDet2][kNMaxDet2];
+ Double_t dhhiOverLambda[kNMaxDet2][kNMaxDet2];
+ Double_t a1[kNMaxDet2][kNMaxDet2], a2[kNMaxDet2][kNMaxDet2];
+ Double_t a0PInverse[kNMaxDet2];
+ Double_t a0Lambda[kNMaxDet2];
+ Double_t a0Phi[kNMaxDet2];
+
+ Double_t vF11, vF12, vF13, vF22, vF23, vF33, d1, d2, d3, det;
+ Int_t idet, icyl, im, in;
+ Double_t phiHalf;
+ Double_t lambda;
+
+ lambda = kPiHalf -2.0*TMath::ATan(TMath::Exp(-eta));
+ rTrack = detector->ConstMag()*pT;
+ safety = 10.0;
+ if(2.0*rTrack < (detector->RDet(nDet) + safety)){
+ iFlag = 0;
+ v11 = 0;
+ v22 = 0;
+ v33 = 0;
+ v12 = 0;
+ v13 = 0;
+ v23 = 0;
+ return;
+ }
+ iFlag = 1;
+ cosLambda = TMath::Cos(lambda);
+ pTotal = pT/cosLambda;
+ pInverse = 1.0/pTotal;
+ diffPInverse = pInverse*1.0e-5;
+ diffLambda = 1.0e-4;
+
+ // Compute likelihood and derivatives
+
+ LogLikelyhood(idTrack, pInverse, lambda);
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<nTwice+1; im++){
+ hh0[icyl][im] = HH(icyl,im);
+ hhi0[icyl][im] = HHI(icyl,im);
+ }
+ }
+ LogLikelyhood(idTrack, pInverse+diffPInverse,lambda);
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<nTwice+1; im++){
+ hh1[icyl][im] = HH(icyl,im);
+ hhi1[icyl][im] = HHI(icyl,im);
+ }
+ }
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<icyl+1; im++){
+ dhhiOverPInverse[icyl][im] = (hhi1[icyl][im]-hhi0[icyl][im])/diffPInverse;
+ }
+ }
+ LogLikelyhood(idTrack, pInverse, lambda+diffLambda);
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<nTwice+1; im++){
+ hh1[icyl][im] = HH(icyl,im);
+ hhi1[icyl][im] = HHI(icyl,im);
+ }
+ }
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<icyl+1; im++){
+ dhhiOverLambda[icyl][im] = (hhi1[icyl][im]-hhi0[icyl][im])/diffLambda;
+ }
+ }
+
+ // Compute additional derivatives
+ rTrackInverse = 1.0/rTrack;
+ tanLambda = TMath::Tan(lambda);
+ icyl = 0;
+ for(idet=1; idet<nDet+1;idet++){
+ if(detector->IFlagDet(idet) > 0){
+ icyl = icyl + 1;
+ rDet = detector->RDet(idet);
+ phiHalf = TMath::ASin(0.5*rDet*rTrackInverse);
+ Double_t rHelp = rDet /
+ (2.0 * TMath::Sqrt(1.0-(0.5 *rDet*rTrackInverse)*
+ (0.5 *rDet*rTrackInverse)));
+ a0PInverse[icyl] = - rDet* rHelp
+ /(detector->ConstMag()*cosLambda);
+ a0Lambda[icyl] = - rDet* rHelp
+ * tanLambda * rTrackInverse;
+ a0Phi[icyl] = rDet;
+ a0PInverse[nDetActive+icyl] = 2.0 * tanLambda
+ *rTrack*(rHelp-rTrack*phiHalf)
+ /(detector->ConstMag()*cosLambda);
+ a0Lambda[nDetActive+icyl] = 2.0 * ( rHelp*tanLambda*tanLambda
+ + rTrack*phiHalf);
+ a0Phi[nDetActive+icyl] = 0.0 ;
+ }
+ }
+
+ // Compute information matrix
+
+ vF11=0.0;
+ vF12=0.0;
+ vF13=0.0;
+ vF22=0.0;
+ vF23=0.0;
+ vF33=0.0;
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ d1=0.0;
+ d2=0.0;
+ d3=0.0;
+ for(im=1; im < icyl+1; im++){
+ d1 = d1 + hhi0[icyl][im]*a0PInverse[im];
+ d2 = d2 + hhi0[icyl][im]*a0Lambda[im];
+ d3 = d3 + hhi0[icyl][im]*a0Phi[im];
+ }
+ vF11 =vF11 + d1*d1;
+ vF12 =vF12 + d1*d2;
+ vF13 =vF13 + d1*d3;
+ vF22 =vF22 + d2*d2;
+ vF23 =vF23 + d2*d3;
+ vF33 =vF33 + d3*d3;
+ }
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<icyl+1; im++){
+ a1[icyl][im] = 0;
+ a2[icyl][im] = 0;
+ for(in=im; in<icyl+1;in++){
+ a1[icyl][im]=a1[icyl][im]+dhhiOverPInverse[icyl][in]*hh0[im][in];
+ a2[icyl][im]=a2[icyl][im]+dhhiOverLambda[icyl][in]*hh0[im][in];
+ }
+ vF11=vF11+a1[icyl][im]*a1[icyl][im];
+ vF12=vF12+a1[icyl][im]*a2[icyl][im];
+ vF22=vF22+a2[icyl][im]*a2[icyl][im];
+ }
+ vF11=vF11+a1[icyl][icyl]*a1[icyl][icyl];
+ vF12=vF12+a1[icyl][icyl]*a2[icyl][icyl];
+ vF22=vF22+a2[icyl][icyl]*a2[icyl][icyl];
+ }
+
+ // Invert information matrix
+
+ det=( vF11*vF22 - vF12*vF12 ) *vF33 + (vF12*vF23 - vF13*vF22)*vF13
+ + (vF12*vF13 - vF11*vF23)*vF23;
+
+ v11 = (vF22*vF33 - vF23*vF23)/det;
+ v22 = (vF11*vF33 - vF13*vF13)/det;
+ v33 = (vF11*vF22 - vF12*vF12)/det;
+ v12 = (vF13*vF23 - vF12*vF33)/det;
+ v13 = (vF12*vF23 - vF13*vF22)/det;
+ v23 = (vF12*vF13 - vF11*vF23)/det;
+
+ }
+//_____________________________________________________________________________//
+void AliFTrackMaker::LogLikelyhood(Int_t idTrack, Double_t pInverse,Double_t lambda)
+{
+ ///////////////////////////////////////////////
+ //hh ?? output //
+ //hhi ?? output //
+ //idTrack track type input //
+ //pInverse inverse momentum input //
+ //lambda polar angle of track input //
+ ///////////////////////////////////////////////
+
+
+ AliFDet *detector = gAliFast->Detector();
+ Int_t nDet = detector->NDet();
+ Int_t nDetActive = detector->NDetActive();
+ Int_t nTwice = nDetActive + nDetActive;
+
+ Double_t rDet, rDetSQ;
+ Int_t idet, icyl, im, imc;
+ Double_t cosLambda, tanLambda, pTotal, pT, rTrack, rTrackSQ;
+ Double_t beta, overPBeta, rTrackInv, thickCorr, temp1, temp2;
+ Double_t partMassSQ;
+ Double_t aShelp[kNMaxDet2], dShelp[kNMaxDet2];
+ Double_t projXVXT[kNMaxDet2],projYVXT[kNMaxDet2], projZVXT[kNMaxDet2];
+ Double_t proj[kNMaxDet2][kNMaxDet2];
+ Double_t erroScatt[kNMaxDet2], variance[kNMaxDet2][kNMaxDet2];
+ Double_t erroSQ[kNMaxDet2];
+ Double_t hh[kNMaxDet2][kNMaxDet2];
+ Double_t hhi[kNMaxDet2][kNMaxDet2];
+ Double_t errorVX, errorVY, errorVZ;
+
+ cosLambda = TMath::Cos(lambda);
+ tanLambda = TMath::Tan(lambda);
+ pTotal = 1.0/pInverse;
+ pT = pTotal * cosLambda;
+ rTrack = detector->ConstMag() * pTotal * cosLambda;
+ rTrackSQ = rTrack * rTrack;
+ partMassSQ= ParticleMass(idTrack)*ParticleMass(idTrack);
+ beta = pTotal / TMath::Sqrt(partMassSQ+pTotal*pTotal);
+ overPBeta = 1./(pTotal*beta);
+ rTrackInv = 1./rTrack;
+ errorVX = detector->ErrorVertexX();
+ errorVY = detector->ErrorVertexY();
+ errorVZ = detector->ErrorVertexZ();
+
+
+ erroScatt[0]=0.0;
+ erroScatt[1]=0.0;
+ for(idet=1; idet < nDet; idet++){
+ thickCorr = detector->ThickDet(idet)/TMath::Sqrt(cosLambda*
+ TMath::Sqrt(1.0-0.25*(detector->RDetSQ(idet)/rTrackSQ)));
+ if(detector->IFlagGas(idet) == 0){
+ thickCorr = thickCorr * (1.3266 + 0.076 * TMath::Log(thickCorr));}
+ thickCorr = overPBeta * thickCorr;
+ erroScatt[idet+1]=thickCorr*thickCorr;
+ }
+
+
+ icyl = 0;
+ for(idet=1; idet<nDet+1; idet++){
+ rDet = detector->RDet(idet);
+ rDetSQ = rDet*rDet;
+ dShelp[idet] = TMath::Sqrt(4.0*rTrackSQ-rDetSQ);
+ aShelp[idet] = TMath::ASin(rDet/(rTrack+rTrack));
+ if(detector->IFlagDet(idet) > 0) {
+ icyl = icyl + 1;
+ projXVXT[icyl] = rDet * rTrackInv;
+ projXVXT[nDetActive+icyl] = -tanLambda;
+ temp1 = (rTrackSQ + rTrackSQ - rDetSQ)/dShelp[idet];
+ temp2 = rDet/dShelp[idet];
+ projYVXT[icyl] = temp1*rTrackInv;
+ projYVXT[nDetActive+icyl] = tanLambda * temp2;
+ projZVXT[icyl] = 0.0;
+ projZVXT[nDetActive+icyl] = 1.0;
+ proj[icyl][1] = 0.0;
+ proj[nDetActive+icyl][0] = 0.0;
+ proj[nDetActive+icyl][nDet] = 0.0;
+ proj[icyl][nDet] = 0.0;
+ for(im=2; im<idet+1; im++){
+ proj[icyl][im]= (( rDet
+ *(rTrackSQ+rTrackSQ-detector->RDetSQ(im-1))
+ - detector->RDet(im-1)*temp1*dShelp[im-1])
+ /((rTrackSQ + rTrackSQ)*cosLambda));
+ proj[nDetActive+icyl][im]= 0.5 * detector->RDet(im-1)
+ * rTrackInv
+ * tanLambda * (detector->RDet(im-1)
+ - dShelp[im-1]*temp2)/cosLambda;
+ proj[nDetActive+icyl][nDet+im]= (rTrack+rTrack) * (aShelp[idet] - aShelp[im-1])
+ + ( rDet*dShelp[im-1]-detector->RDet(im-1)*dShelp[idet])
+ * dShelp[im-1] * tanLambda * tanLambda
+ / (dShelp[idet] * (rTrack+rTrack));
+ proj[icyl][nDet+im]= tanLambda
+ * (rDet*detector->RDet(im-1)*dShelp[im-1]
+ / (rTrackSQ+rTrackSQ)
+ - (rDetSQ + detector->RDetSQ(im-1)
+ - rDetSQ * detector->RDetSQ(im-1)
+ / (rTrackSQ+rTrackSQ))
+ / dShelp[idet]);
+ }
+ for(im=idet+1; im < nDet+1; im++){
+ proj[icyl][im] = 0.0;
+ proj[nDetActive+icyl][im] = 0.0;
+ proj[nDetActive+icyl][nDet+im] = 0.0;
+ proj[icyl][nDet+im] = 0.0;
+ }
+ if(detector->IFlagDet(idet) == 1){
+ erroSQ[icyl] = detector->ErrorRPhi(idet);
+ erroSQ[nDetActive+icyl] = detector->ErrorZ(idet);
+ }else{
+ TPCResolution(pT, rDet, lambda);
+ erroSQ[icyl] = SigmaRPhiSQ();
+ erroSQ[nDetActive+icyl] = SigmaZSQ();
+ }
+ erroSQ[icyl] = erroSQ[icyl] + detector->ErrorR(idet)*temp2*temp2;
+ erroSQ[nDetActive+icyl] = erroSQ[nDetActive+icyl]
+ + detector->ErrorR(idet)*tanLambda*tanLambda;
+ }
+ }
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<icyl+1; im++){
+ variance[icyl][im]=
+ projXVXT[icyl]*projXVXT[im]*errorVX
+ +projYVXT[icyl]*projYVXT[im]*errorVY
+ +projZVXT[icyl]*projZVXT[im]*errorVZ;
+ for(imc=1; imc<nDet+1; imc++){
+ variance[icyl][im]=variance[icyl][im]
+ +(proj[icyl][imc]*proj[im][imc]
+ + proj[icyl][nDet+imc]*proj[im][nDet+imc])
+ * erroScatt[imc];
+ }
+ }
+ variance[icyl][icyl] = variance[icyl][icyl]+erroSQ[icyl];
+ }
+
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=icyl; im<nTwice+1; im++){
+ hh[icyl][im]=variance[im][icyl];
+ for(imc=1; imc<icyl;imc++){
+ hh[icyl][im]=hh[icyl][im]-hh[imc][icyl]*hh[imc][im];
+ }
+ if(im == icyl){
+ hh[icyl][im] = TMath::Sqrt(hh[icyl][im]);
+ } else {
+ hh[icyl][im] = hh[icyl][im]/hh[icyl][icyl];
+ }
+ }
+ }
+
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ hhi[icyl][icyl] = 1.0 / hh[icyl][icyl];
+ for(im=1; im<icyl; im++){
+ hhi[icyl][im] = 0.0;
+ for(imc=im; imc<icyl; imc++){
+ hhi[icyl][im] = hhi[icyl][im]-hh[imc][icyl]*hhi[imc][im];
+ }
+ hhi[icyl][im] = hhi[icyl][im]*hhi[icyl][icyl];
+ }
+ }
+
+ for(icyl=1; icyl<nTwice+1; icyl++){
+ for(im=1; im<nTwice+1; im++){
+ SetHH(icyl,im,hh[icyl][im]);
+ SetHHI(icyl,im,hhi[icyl][im]);
+ }
+ }
+
+
+}
+//_____________________________________________________________________________
+// translation of routine tpc_resolution of res.f
+//_____________________________________________________________________________
+void AliFTrackMaker::TPCResolution(Double_t pTransv, Double_t radiPad, Double_t lambda)
+{
+ ///////////////////////////////////////////////
+ //sigmaRPhiSQ resolution in r-phi output //
+ //sigmaZSQ resolution in z output //
+ //pTransv transverse momentum input //
+ //radiPad radius of pad row input //
+ //lambda polar angle of track input //
+ //
+ //units: cm, GeV/c, radian //
+ //parametrisation of TPC resolution //
+ //version of 03.07.1995 //
+ //source: Marek Kowalski, Karel Safarik //
+ ///////////////////////////////////////////////
+
+ Double_t aRCoeff=0.41818e-2;
+ Double_t bRCoeff=0.17460e-4;
+ Double_t cRCoeff=0.30993e-8;
+ Double_t dRCoeff=0.41061e-6;
+ Double_t aZCoeff=0.39610e-2;
+ Double_t bZCoeff=0.22443e-4;
+ Double_t cZCoeff=0.51504e-1;
+
+ Double_t sigmaRPhiSQ;
+ Double_t sigmaZSQ;
+
+ sigmaRPhiSQ = aRCoeff - bRCoeff * radiPad * TMath::Tan(lambda)+
+ (cRCoeff * (radiPad/pTransv) + dRCoeff) * radiPad/pTransv;
+
+ sigmaZSQ = aZCoeff - bZCoeff * radiPad * TMath::Tan(lambda)+
+ cZCoeff * TMath::Tan(lambda)*TMath::Tan(lambda);
+
+ if(sigmaRPhiSQ < 1.0e-6 ) sigmaRPhiSQ = 1.0e-6;
+ if(sigmaZSQ < 1.0e-6 ) sigmaZSQ = 1.0e-6;
+
+ sigmaRPhiSQ = (TMath::Sqrt(sigmaRPhiSQ) + 0.005)
+ * (TMath::Sqrt(sigmaRPhiSQ) + 0.005);
+ sigmaZSQ = (TMath::Sqrt(sigmaZSQ) + 0.005)
+ * (TMath::Sqrt(sigmaZSQ) + 0.005);
+
+ SetSigmaRPhiSQ(sigmaRPhiSQ);
+ SetSigmaZSQ(sigmaZSQ);
+
+
+}
+
+//_____________________________________________________________________________
+// returns the mass given particle ID
+//-----------------------------------------------------------------------------
+Double_t AliFTrackMaker::ParticleMass(Int_t idTrack)
+{
+ Double_t mass = 0.0;
+
+ if(idTrack == 2){ mass = fPionMass;}
+ else if(idTrack == 3){ mass = fKaonMass;}
+ else if(idTrack == 1) {mass = fElectronMass;}
+ else if(idTrack == 4) {mass = fProtonMass;}
+
+ return mass;
+
+}
+
+//_____________________________________________________________________________
+// returns the rapidity given particle pT, pz
+//-----------------------------------------------------------------------------
+Double_t AliFTrackMaker::Rapidity(Double_t pt, Double_t pz)
+{
+// Compute rapidity
+
+ Double_t etalog = TMath::Log((TMath::Sqrt(pt*pt + pz*pz) + TMath::Abs(pz))/pt);
+ if (pz < 0 ) return -TMath::Abs(etalog);
+ else return TMath::Abs(etalog);
+}
+
+//_____________________________________________________________________________
+// returns the phi angle given particle px, py
+//-----------------------------------------------------------------------------
+Double_t AliFTrackMaker::Angle(Double_t x, Double_t y)
+{
+// Compute phi angle of particle
+// ... this is a copy of function ULANGL
+// .. sign(a,b) = -abs(a) if b < 0
+// = abs(a) if b >= 0
+
+ Double_t angle = 0;
+ Double_t r = TMath::Sqrt(x*x + y*y);
+ if (r < 1e-20) return angle;
+ if (TMath::Abs(x)/r < 0.8) {
+ angle = TMath::Sign((Double_t)TMath::Abs(TMath::ACos(x/r)), y);
+ } else {
+ angle = TMath::ASin(y/r);
+ if (x < 0 ) {
+ if(angle >= 0) angle = kPi - angle;
+ else angle = -kPi - angle;
+ }
+ }
+ return angle;
+}
+//_____________________________________________________________________________
+Int_t AliFTrackMaker::Charge(Int_t kf)
+{
+//...this is copy of function LUCHGE
+//...Purpose: to give three times the charge for a particle/parton.
+
+ static Int_t kchg[500] = { -1,2,-1,2,-1,2,-1,2,0,0,-3,0,-3,0,-3,0,-3,0,
+ 0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,3,0,-1,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 2,-1,2,-1,2,3,0,0,0,0,0,0,0,0,0,0,0,3,0,3,3,0,3,0,3,0,3,0,0,0,0,0,
+ 0,0,0,0,0,3,0,3,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0,0,0,3,0,3,3,0,3,0,3,
+ 0,3,0,0,0,0,0,0,0,0,0,0,3,0,3,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0,0,0,3,
+ 0,3,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0,0,0,3,0,3,3,0,3,0,3,0,3,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,
+ 0,3,0,0,0,0,0,0,0,0,-3,0,0,0,0,0,0,0,0,3,0,-3,0,3,-3,0,0,0,3,6,0,
+ 3,0,0,0,0,0,-3,0,3,-3,0,-3,0,0,0,0,-3,0,3,6,-3,0,3,-3,0,-3,0,3,6,
+ 0,3,0,0,0,0,0,-3,0,3,-3,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
+
+// extern integer kfcomp_(integer *);
+ Int_t ipower;
+ Int_t ret = 0;
+ Int_t kfa = TMath::Abs(kf);
+ Int_t kc = Compress(kfa);
+
+//...Initial values. Simple case of direct readout.
+ if (kc == 0) {
+ } else if (kfa <= 100 || kc <= 80 || kc > 100) {
+ ret = kchg[kc-1];
+
+// ...Construction from quark content for heavy meson, diquark, baryon.
+ } else if (kfa/1000 % 10 == 0) {
+ ipower = kfa/100 % 10;
+ ret = (kchg[kfa / 100 % 10 - 1] - kchg[kfa/10 % 10 - 1])*Int_t(TMath::Power(-1, ipower));
+ } else if (kfa / 10 % 10 == 0) {
+ ret = kchg[kfa/1000 % 10 - 1] + kchg[kfa/100 % 10 - 1];
+ } else {
+ ret = kchg[kfa/1000 % 10 - 1] + kchg[kfa/100 % 10 - 1] + kchg[kfa/10 % 10 - 1];
+ }
+
+// ...Add on correct sign.
+ if (kf > 0) return ret;
+ else return -ret;
+}
+//_____________________________________________________________________________
+Int_t AliFTrackMaker::Compress(Int_t kf)
+{
+//...this is copy of function LUCOMP
+//...Purpose: to compress the standard KF codes for use in mass and decay
+//...arrays; also to check whether a given code actually is defined.
+// from BLOCK LUDATA
+ static Int_t kchg[500] = { 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,
+ 0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,
+ 1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,
+ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
+ 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,
+ 1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,
+ 0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,0,0,0,0,1,1,
+ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,
+ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
+ static Int_t kftab[25] = { 211,111,221,311,321,130,310,213,113,223,313,
+ 323,2112,2212,210,2110,2210,110,220,330,440,30443,30553,0,0 };
+ static Int_t kctab[25] = { 101,111,112,102,103,221,222,121,131,132,122,
+ 123,332,333,281,282,283,284,285,286,287,231,235,0,0 };
+
+ Int_t ret = 0;
+ Int_t kfla, kflb, kflc, kflr, kfls, kfa, ikf;
+
+ kfa = TMath::Abs(kf);
+//...Simple cases: direct translation or table.
+ if (kfa == 0 || kfa >= 100000) {
+ return ret;
+ } else if (kfa <= 100) {
+ ret = kfa;
+ if (kf < 0 && kchg[kfa - 1] == 0) ret = 0;
+ return ret;
+ } else {
+ for (ikf = 1; ikf <= 23; ++ikf) {
+ if (kfa == kftab[ikf-1]) {
+ ret = kctab[ikf-1];
+ if (kf < 0 && kchg[ret-1] == 0) ret = 0;
+ return ret;
+ }
+ }
+ }
+// ...Subdivide KF code into constituent pieces.
+ kfla = kfa / 1000%10;
+ kflb = kfa / 100%10;
+ kflc = kfa / 10%10;
+ kfls = kfa%10;
+ kflr = kfa / 10000%10;
+// ...Mesons.
+ if (kfa - kflr*10000 < 1000) {
+ if (kflb == 0 || kflb == 9 || kflc == 0 || kflc == 9) {
+ } else if (kflb < kflc) {
+ } else if (kf < 0 && kflb == kflc) {
+ } else if (kflb == kflc) {
+ if (kflr == 0 && kfls == 1) { ret = kflb + 110;
+ } else if (kflr == 0 && kfls == 3) { ret = kflb + 130;
+ } else if (kflr == 1 && kfls == 3) { ret = kflb + 150;
+ } else if (kflr == 1 && kfls == 1) { ret = kflb + 170;
+ } else if (kflr == 2 && kfls == 3) { ret = kflb + 190;
+ } else if (kflr == 0 && kfls == 5) { ret = kflb + 210;
+ }
+ } else if (kflb <= 5) {
+ if (kflr == 0 && kfls == 1) { ret = (kflb-1)*(kflb-2)/2 + 100 + kflc;
+ } else if (kflr == 0 && kfls == 3) { ret = (kflb-1)*(kflb-2)/2 + 120 + kflc;
+ } else if (kflr == 1 && kfls == 3) { ret = (kflb-1)*(kflb-2)/2 + 140 + kflc;
+ } else if (kflr == 1 && kfls == 1) { ret = (kflb-1)*(kflb-2)/2 + 160 + kflc;
+ } else if (kflr == 2 && kfls == 3) { ret = (kflb-1)*(kflb-2)/2 + 180 + kflc;
+ } else if (kflr == 0 && kfls == 5) { ret = (kflb-1)*(kflb-2)/2 + 200 + kflc;
+ }
+ } else if (kfls == 1 && kflr <= 1 || kfls == 3 && kflr <= 2 || kfls == 5 && kflr == 0) {
+ ret = kflb + 80;
+ }
+// ...Diquarks.
+ } else if ((kflr == 0 || kflr == 1) && kflc == 0) {
+ if (kfls != 1 && kfls != 3) {
+ } else if (kfla == 9 || kflb == 0 || kflb == 9) {
+ } else if (kfla < kflb) {
+ } else if (kfls == 1 && kfla == kflb) {
+ } else { ret = 90;
+ }
+// ...Spin 1/2 baryons.
+ } else if (kflr == 0 && kfls == 2) {
+ if (kfla == 9 || kflb == 0 || kflb == 9 || kflc == 9) {
+ } else if (kfla <= kflc || kfla < kflb) {
+ } else if (kfla >= 6 || kflb >= 4 || kflc >= 4) {
+ ret = kfla + 80;
+ } else if (kflb < kflc) {
+ ret = (kfla+1)*kfla*(kfla-1)/6 + 300 + kflc*(kflc-1)/2 + kflb;
+ } else {
+ ret = (kfla+1)*kfla*(kfla-1)/6 + 330 + kflb*(kflb-1)/2 + kflc;
+ }
+// ...Spin 3/2 baryons.
+ } else if (kflr == 0 && kfls == 4) {
+ if (kfla == 9 || kflb == 0 || kflb == 9 || kflc == 9) {
+ } else if (kfla < kflb || kflb < kflc) {
+ } else if (kfla >= 6 || kflb >= 4) {
+ ret = kfla + 80;
+ } else {
+ ret = (kfla+1)*kfla*(kfla-1) / 6 + 360 + kflb*(kflb -1) / 2 + kflc;
+ }
+ }
+ return ret;
+}
+
+//_____________________________________________________________________________
+// TEST JOB: Calculate tracks resolution
+//_____________________________________________________________________________
+void AliFTrackMaker::MakeTest(Int_t n)
+{
+ Double_t v11, v22, v33, v12, v13, v23;
+ Int_t iFlag;
+ Int_t idTrack;
+ Double_t pTStart, pT, eta;
+
+ Double_t sumDPop,sumDDip,sumDPhi;
+ Double_t isum,fm;
+ Double_t pTotal,partMassSQ,beta,lambda;
+ Double_t dPop,dLop,dDip,dPhi,rho12,rho13,rho23;
+ Double_t dPPStrag,dPPTot;
+ // Double_t resol1[1001][11],resol2[10001][11],resol3[1001][11],
+ // resol4[1001][11],resol5[10001][11]
+ Double_t store1[1001],store2[10001],store3[1001],
+ store4[1001],store5[10001];
+
+
+ idTrack = 2;
+ pTStart = 0.07;
+ for(Int_t istep=1; istep<n; istep++){
+ if(istep < 100 && istep > 20) istep = istep -1 + 5;
+ if(istep < 500 && istep > 100) istep = istep -1 + 25;
+ if(istep <1000 && istep > 500) istep = istep -1 + 100;
+ pT = pTStart + 0.01*istep;
+ eta = - 0.044;
+ sumDPop = 0;
+ sumDDip = 0;
+ sumDPhi = 0;
+ isum = 0;
+ for(Int_t in=1; in<11; in++){
+ eta = eta + 0.088;
+ lambda = kPiHalf -2.0*TMath::ATan(TMath::Exp(-eta));
+ pTotal = pT / TMath::Cos(lambda);
+ if(idTrack == 1){
+ dPPStrag = 0.055 /pT;}
+ else{
+ partMassSQ = ParticleMass(idTrack)*ParticleMass(idTrack);
+ beta = pTotal/ TMath::Sqrt(pTotal*pTotal + partMassSQ);
+ dPPStrag = 0.04/(pT*TMath::Power(beta,2.6666666667));
+ }
+ ErrorMatrix(idTrack,pT,eta, v11, v22, v33, v12, v13, v23, iFlag);
+ if(iFlag == 1){
+ dLop = TMath::Sqrt(v11);
+ dDip = TMath::Sqrt(v22);
+ dPhi = TMath::Sqrt(v33);
+ rho12 = v12/(dLop*dDip);
+ rho13 = v13/(dLop*dPhi);
+ rho23 = v23/(dDip*dPhi);
+ dPop = 100. *dLop * pTotal;
+ dDip = 1000. * dDip;
+ dPhi = 1000. * dPhi;
+ dPPTot = TMath::Sqrt(dPop*dPop + dPPStrag*dPPStrag);
+ // resol1[istep][in] = dPop;
+ // resol2[istep][in] = dDip;
+ // resol3[istep][in] = dPhi;
+ // resol4[istep][in] = dPPTot;
+ // resol5[istep][in] = dPPStrag;
+ sumDPop = sumDPop + dPop;
+ sumDDip = sumDDip + dDip;
+ sumDPhi = sumDPhi + dPhi;
+ isum = isum + 1;}
+ else{
+ printf("%20s %10.5f %10.5f %20s\n","pT,eta",pT,eta,"cannot smear");
+ }
+ }
+ if(isum > 0){
+ dPop = sumDPop/isum;
+ dDip = sumDDip/isum;
+ dPhi = sumDPhi/isum;
+ dPPTot = TMath::Sqrt(dPop*dPop + dPPStrag*dPPStrag);}
+ else{
+ dPop = 0;
+ dDip = 0;
+ dPhi = 0;
+ }
+ store1[istep] = dPop;
+ store2[istep] = dDip;
+ store3[istep] = dPhi;
+ store4[istep] = dPPTot;
+ store5[istep] = dPPStrag;
+ if(istep > 20 ){
+ Int_t im = 5;
+ if(istep > 100) {im = 25;}
+ if(istep > 500) {im = 100;}
+ fm = 1./(1.*im);
+ for(Int_t ist=1; ist<im; ist++){
+ // for(Int_t in=1; in < 11; in++){
+ // resol1[istep-im+ist][in] = resol1[istep-im][in]+
+ // ist*fm*(resol1[istep][in]-resol1[istep-im][in]);
+ // resol2[istep-im+ist][in] = resol2[istep-im][in]+
+ // ist*fm*(resol2[istep][in]-resol2[istep-im][in]);
+ // resol3[istep-im+ist][in] = resol3[istep-im][in]+
+ // ist*fm*(resol3[istep][in]-resol3[istep-im][in]);
+ // resol4[istep-im+ist][in] = resol4[istep-im][in]+
+ // ist*fm*(resol4[istep][in]-resol4[istep-im][in]);
+ // resol5[istep-im+ist][in] = resol5[istep-im][in]+
+ // ist*fm*(resol5[istep][in]-resol5[istep-im][in]);
+ // }
+ store1[istep-im+ist]=store1[istep-im]+
+ ist*fm*(store1[istep]-store1[istep-im]);
+ store2[istep-im+ist]=store2[istep-im]+
+ ist*fm*(store2[istep]-store2[istep-im]);
+ store3[istep-im+ist]=store3[istep-im]+
+ ist*fm*(store3[istep]-store3[istep-im]);
+ store4[istep-im+ist]=store4[istep-im]+
+ ist*fm*(store4[istep]-store4[istep-im]);
+ store5[istep-im+ist]=store5[istep-im]+
+ ist*fm*(store5[istep]-store5[istep-im]);
+ // Fill control histograms
+ fResID1Test->Fill(pTStart + 0.01*(istep-im+ist),store1[istep-im+ist]);
+ fResID2Test->Fill(pTStart + 0.01*(istep-im+ist),store2[istep-im+ist]);
+ fResID3Test->Fill(pTStart + 0.01*(istep-im+ist),store3[istep-im+ist]);
+ fResID4Test->Fill(pTStart + 0.01*(istep-im+ist),store4[istep-im+ist]);
+ fResID5Test->Fill(pTStart + 0.01*(istep-im+ist),store5[istep-im+ist]);
+ }
+ printf("%10s %10d %20.15f %20.15f %20.15f %20.15f %20.15f \n",
+ "TestTrack:",istep,store1[istep],store2[istep],store3[istep],
+ store4[istep],store5[istep]);
+ } else {
+ printf("%10s %10d %20.15f %20.15f %20.15f %20.15f %20.15f \n",
+ "TestTrack:",istep,store1[istep],store2[istep],store3[istep],
+ store4[istep],store5[istep]);
+ fResID1Test->Fill(pT,store1[istep]);
+ fResID2Test->Fill(pT,store2[istep]);
+ fResID3Test->Fill(pT,store3[istep]);
+ fResID4Test->Fill(pT,store4[istep]);
+ fResID5Test->Fill(pT,store5[istep]);
+ }
+ }
+}
+//_____________________________________________________________________________
--- /dev/null
+#ifndef AliFTrackMaker_H
+#define AliFTrackMaker_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast TrackMaker class. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef AliFMaker_H
+#include "AliFMaker.h"
+#endif
+#ifndef ROOT_TMatrix
+#include <TMatrix.h>
+#endif
+#ifndef ROOT_TH1
+#include <TH1.h>
+#endif
+
+class AliFTrack;
+#include "AliFDet.h"
+
+
+class AliFTrackMaker : public AliFMaker {
+
+protected:
+ Int_t fNTracks; //Number of tracks
+ Int_t fRecTrack; //Tracks reconstruction on/off
+ //masses
+ Double_t fPionMass;
+ Double_t fKaonMass;
+ Double_t fElectronMass;
+ Double_t fProtonMass;
+ //matrices
+ Double_t fHH[kNMaxDet2][kNMaxDet2];
+ Double_t fHHI[kNMaxDet2][kNMaxDet2];
+ //TPC resolution
+ Double_t fSigmaRPhiSQ;
+ Double_t fSigmaZSQ;
+ // Tracks histograms (control)
+ TH1D *fResID11; //histogram ID11 Elec: delta(1/pTot)/pTot
+ TH1D *fResID12; //histogram ID12 Elec: delta(lambda)/lambda
+ TH1D *fResID13; //histogram ID13 Elec: delta(phi)/phi
+ TH1D *fResID21; //histogram ID21 Pion: delta(1/pTot)/pTot
+ TH1D *fResID22; //histogram ID22 Pion: delta(lambda)/lambda
+ TH1D *fResID23; //histogram ID23 Pion: delta(phi)/phi
+ TH1D *fResID31; //histogram ID31 Kaon: delta(1/pTot)/pTot
+ TH1D *fResID32; //histogram ID32 Kaon: delta(lambda)/lambda
+ TH1D *fResID33; //histogram ID33 Kaon: delta(phi)/phi
+ TH1D *fResID41; //histogram ID41 Proton: delta(1/pTot)/pTot
+ TH1D *fResID42; //histogram ID42 Proton: delta(lambda)/lambda
+ TH1D *fResID43; //histogram ID43 Proton: delta(phi)/phi
+ // Tracks histograms (Test job)
+ TH1D *fResID1Test; //histogram ID1 in res.f
+ TH1D *fResID2Test; //histogram ID2 in res.f
+ TH1D *fResID3Test; //histogram ID3 in res.f
+ TH1D *fResID4Test; //histogram ID4 in res.f
+ TH1D *fResID5Test; //histogram ID5 in res.f
+
+public:
+ AliFTrackMaker();
+ AliFTrackMaker(const char *name, const char *title);
+ virtual ~AliFTrackMaker();
+ virtual void Clear(Option_t *option="");
+ virtual void Draw(Option_t *option="");
+ virtual void Finish();
+ virtual void Init();
+ virtual void Make();
+ virtual void MakeTest(Int_t n);
+ virtual void PrintInfo() {}
+ AliFTrack *AddTrack(Int_t code, Double_t charge, Double_t pT, Double_t eta, Double_t phi,
+ Double_t v11, Double_t v22, Double_t v33,
+ Double_t v12, Double_t v13, Double_t v23, Int_t iFlag);
+ void LogLikelyhood(Int_t idTrack, Double_t pInvers, Double_t lambda);
+ void TPCResolution(Double_t ptransv, Double_t radiPad, Double_t lambda);
+ Double_t ParticleMass(Int_t idTrack);
+ Double_t Rapidity(Double_t pT, Double_t pZ);
+ Double_t Angle(Double_t pX, Double_t pY);
+ Int_t Charge(Int_t kf);
+ Int_t Compress(Int_t kf);
+ void ErrorMatrix(Int_t idTrack, Double_t pT, Double_t eta,
+ Double_t &v11, Double_t &v22, Double_t &v33,
+ Double_t &v12, Double_t &v13, Double_t &v23, Int_t &iFlag);
+
+// Getters
+ Double_t HH(Int_t id1, Int_t id2) {return fHH[id1][id2];}
+ Double_t HHI(Int_t id1, Int_t id2) {return fHHI[id1][id2];}
+ Double_t SigmaRPhiSQ() {return fSigmaRPhiSQ;}
+ Double_t SigmaZSQ() {return fSigmaZSQ;}
+ Int_t NTracks() {return fNTracks;}
+
+
+// Getters Tracks histograms
+
+
+
+// Setters for tracks
+ //masses
+ void SetPionMass(Double_t val=0.1395679e0) {fPionMass=val;}
+ void SetKaonMass(Double_t val=0.493646e0) {fKaonMass=val;}
+ void SetElectronMass(Double_t val=0.51099906e-3) {fElectronMass=val;}
+ void SetProtonMass(Double_t val=0.93827231e0) {fProtonMass=val;}
+ void SetHH(Int_t id1, Int_t id2, Double_t hh) {fHH[id1][id2]=hh;}
+ void SetHHI(Int_t id1, Int_t id2, Double_t hhi) {fHHI[id1][id2]=hhi;}
+ void SetSigmaRPhiSQ(Double_t val){fSigmaRPhiSQ=val;}
+ void SetSigmaZSQ(Double_t val){fSigmaZSQ=val;}
+ void SetRecTrack(Int_t val=100){fRecTrack=val;}
+
+
+
+ //
+ ClassDef(AliFTrackMaker, 1) //AliFast TrackMaker
+};
+
+#endif
+
+
+
+
+
+
+
+
--- /dev/null
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFVirtualDisplay //
+// //
+// Virtual base class for AliFast event display //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliFVirtualDisplay.h"
+
+ClassImp(AliFVirtualDisplay)
+
+
+//_____________________________________________________________________________
+AliFVirtualDisplay::AliFVirtualDisplay() : TObject()
+{
+}
+
+//_____________________________________________________________________________
+AliFVirtualDisplay::~AliFVirtualDisplay()
+{
+
+}
+
+//_____________________________________________________________________________
+void AliFVirtualDisplay::SizeFruit() const
+{
+
+}
+
+//_____________________________________________________________________________
+void AliFVirtualDisplay::SizeParticles() const
+{
+
+}
--- /dev/null
+#ifndef AliFVirtualDisplay_H
+#define AliFVirtualDisplay_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFVirtualDisplay //
+// //
+// Virtual base class for AliFast event display //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+class AliFTrigger;
+
+class AliFVirtualDisplay : public TObject {
+
+public:
+ AliFVirtualDisplay();
+ virtual ~AliFVirtualDisplay();
+ virtual void Clear(Option_t *option="") = 0;
+ virtual void DisplayButtons() = 0;
+ virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) = 0;
+ virtual void Draw(Option_t *option="") = 0;
+ virtual void DrawAllViews() = 0;
+ virtual Bool_t DrawParticles() = 0;
+ virtual void DrawTitle(Option_t *option="") = 0;
+ virtual void DrawView(Float_t theta, Float_t phi) = 0;
+ virtual void DrawViewGL() = 0;
+ virtual void DrawViewX3D() = 0;
+ virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) = 0;
+ virtual void Paint(Option_t *option="") = 0;
+ virtual void PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type, Option_t *option="") = 0;
+ virtual void PaintParticles(Option_t *option="") = 0;
+ virtual Float_t PTcut() = 0;
+ virtual Float_t PTcutEGMUNU() = 0;
+ virtual void SetView(Float_t theta, Float_t phi) = 0;
+ virtual void ShowNextEvent(Int_t delta=1) = 0;
+ virtual void SizeFruit() const;
+ virtual void SizeParticles() const;
+
+ ClassDef(AliFVirtualDisplay, 0) //Virtual base class for AliFast event display
+};
+
+#endif
--- /dev/null
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast //
+// //
+// Main class to control the AliFast program. //
+// //
+// This class is a general framework for programs that needs to: //
+// - Initialise some parameters //
+// - Loop on events //
+// - Print results and save histograms, etc //
+// //
+// The event processor AliFast::Make loops on a list of Makers //
+// where each maker performs some task on the event data and generates //
+// results. //
+// New Makers can be inserted by a user without modifying this class. //
+// Note that the order in which the Makers are called is the order //
+// of insertion in the list of Makers. //
+// Each Maker is responsible for creating its branch of the Tree. //
+// The following table shows the list of makers currently implemented //
+// The default option to Save the Maker info in the Tree is mentioned. //
+// //
+// Maker name Save in Tree //
+// ========== ============ //
+// MCMaker NO //
+// TrackMaker NO //
+// //
+// Makers must derive from the base class AliFMaker. //
+// AliFMaker provides a common interface to all Makers. //
+// Each Maker is responsible for defining its own parameters and //
+// histograms. //
+// Each Maker has its own list of histograms. //
+// Each Maker has an associated companion class corresponding to the //
+// type of physics object reconstructed by the Maker. //
+// For example, AliFClusterMaker creates AliFCluster objects. //
+// AliFTriggerMaker creates one single AliFTrigger object. //
+// The pointer supporting the created object(s) is defined in AliFMaker //
+// fFruits may point to a single object (eg. AliFTrigger) or to a //
+// TClonesArray of objects (eg. AliFCluster). //
+// //
+// The function AliFast::Maketree must be called after the creation //
+// of the AliFast object to create a Root Tree. //
+// //
+// An example of main program/macro to use AliFast is given below: //
+//========================================================================
+//void umain(Int_t nevents=100)
+//{
+// gROOT->Reset();
+// gSystem->Load("libalifast.so"); // dynamically link the compiled shared library
+//
+// // Open the root output file
+// TFile file("alifast.root","recreate","AliFast root file",2);
+//
+// AliFast alifast("alifast"); // create main object to run alifast
+//
+// User user; // create an object of the User class defined in user.C
+//
+// alifast.Init(); // Initialise event (maker histograms,etc)
+// alifast.MakeTree(); // Create the Root tree
+//
+// gROOT->LoadMacro("user.C"); // compile/interpret user file
+//
+// for (Int_t i=0; i<nevents; i++) {
+// if (i%100 == 0) printf("In loop:%d\n",i);
+// alifast.Make(i); // Generate and reconstruct event
+// user.FillHistograms(); // User has possibility to decide if store event here!
+// alifast.FillTree();
+// alifast.Clear(); // Clear all event lists
+// }
+// alifast.Finish();
+//
+// // save objects in Root file
+// alifast.Write(); //save main alifast object (and run parameters)
+//}
+//========================================================================
+// //
+// This example illustrates how to: //
+// - Load a shared library //
+// - Open a Root file //
+// - Initialise AliFast //
+// - Load some user code (interpreted) //
+// This user code may redefine some Maker parameters //
+// - Make a loop on events //
+// - Save histograms and the main AliFast object and its Makers //
+// //
+//========================================================================
+// An example of a User class is given below: //
+//========================================================================
+//
+//#ifndef user_H
+//#define user_H
+//
+//////////////////////////////////////////////////////////////////////////
+// //
+// User //
+// //
+// Example of a user class to perform user specific tasks when running //
+// the ALIfast program. //
+// //
+// This class illustrates: //
+// - How to set run parameters //
+// - How to create and fill histograms //
+// //
+//////////////////////////////////////////////////////////////////////////
+//
+//class TH1F;
+//class AliFast;
+//class AliFClusterMaker;
+//class AliFPhotonMaker;
+//
+//class User {
+//
+//private:
+// TH1F *fhist1; //pointer to histogram
+// TH1F *fhist2; //pointer to histogram
+// TH1F *fhist3; //pointer to histogram
+//public:
+// User();
+// void FillHistograms();
+// void SetRunParameters();
+//
+//#endif
+//};
+//
+//_________________________________________________________________________
+//User::User()
+//{
+// SetRunParameters(); //change default parameters
+//
+// Create a few histograms
+// fhist1 = new TH1F("hist1","Number of tracks per event",100,0,100);
+// fhist2 = new TH1F("hist2","Number of clusters",100,0,100);
+// fhist3 = new TH1F("hist3","Number of isolated muons",20,0,20);
+//}
+//
+//_________________________________________________________________________
+//void User::FillHistograms()
+//{
+//// fhist1.Fill(event->GetNtracks());
+//// fhist2.Fill(event->GetNclusters));
+//// fhist3.Fill(event->GetNIsoMuons());
+//}
+//
+//_________________________________________________________________________
+//void User::SetRunParameters()
+//{
+// // change Alifast default parameters
+//
+// gAliFast->SetSmearMuonOpt(0);
+// gAliFast->ClusterMaker()->SetGranBarrelEta(0.12);
+// gAliFast->PhotonMaker()->SetMinPT(6.);
+// gAliFast->TriggerMaker()->SetMuoEtaCoverage(2.8);
+//
+//}
+//======================end of User class=================================
+//
+//////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TTree.h>
+#include <TBrowser.h>
+#include <TClonesArray.h>
+#include "AliRun.h"
+#include "AliFast.h"
+//#include "AliFMCMaker.h"
+#include "AliFTrackMaker.h"
+#include "AliFHistBrowser.h"
+#include "AliFBigBang.h"
+#include "AliFVirtualDisplay.h"
+
+
+R__EXTERN AliRun * gAlice;
+AliFast *gAliFast;
+
+ClassImp(AliFast)
+
+
+//_____________________________________________________________________________
+ //AliFast::AliFast() : TNamed("alifast","The ALICE fast simulation")
+ AliFast::AliFast() : AliRun("alifast","The ALICE fast simulation")
+{
+
+ fTree = 0;
+ fMakers = 0;
+ fMode = 0;
+ // fMCMaker = 0;
+ fTrackMaker = 0;
+ fDisplay = 0;
+ fDet = new AliFDet("Detector","Make AliFast detector");
+ gAliFast = this;
+ gAlice = (AliRun*)this;
+}
+
+//_____________________________________________________________________________
+//AliFast::AliFast(const char *name, const char *title): TNamed(name,title)
+AliFast::AliFast(const char *name, const char *title): AliRun(name,title)
+{
+
+ gAliFast = this;
+ fVersion = 001; //AliFAST version number and release date
+ fVersionDate = 150399;
+ fTree = 0;
+ fMode = 0;
+ fDisplay = 0;
+
+ SetDefaultParameters();
+
+ gROOT->GetListOfBrowsables()->Add(this,"AliFast");
+
+// create the support list for the various lists of AliFast objects
+ fMakers = new TList();
+
+// create "standard" makers and add them to the list of makers (in AliFMaker constructor
+// Note that the order in which makers are added to the list of makers is important
+// makers will be processed in this order !!
+
+ //fMCMaker = new AliFMCMaker("MCMaker","Make MC events");
+ fTrackMaker = new AliFTrackMaker("TrackMaker","Make AliFast tracks");
+//create detector
+ fDet = new AliFDet("Detector","Make AliFast detector");
+}
+
+//_____________________________________________________________________________
+AliFast::~AliFast()
+{
+// fMakers->Delete();
+// delete fMakers;
+}
+
+
+//______________________________________________________________________________
+void AliFast::Browse(TBrowser *b)
+{
+
+ if( b == 0) return;
+
+ if (fTree) b->Add(fTree,fTree->GetName());
+ // fca
+ b->Add(&fHistBrowser, "Histograms");
+ b->Add(&fBigBang, "BigBang");
+ // fca
+
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ b->Add(maker,maker->GetName());
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::Clear(Option_t *option)
+{
+// Reset lists of event objects
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->Clear(option);
+ }
+ //fca if (fDisplay) fDisplay->Clear();
+}
+
+//_____________________________________________________________________________
+void AliFast::Draw(Option_t *option)
+{
+// Insert current event in graphics pad list
+
+ // Check if the Event Display object has been created
+ if (!fDisplay) {
+ Error("Draw","You must create an AliFDisplay object first");
+ return;
+ }
+
+ //fca fDisplay->Draw(option);
+}
+
+//_____________________________________________________________________________
+void AliFast::GetTreeEvent(Int_t event)
+{
+// Read event from Tree
+ if (fTree) fTree->GetEvent(event);
+ fEvent = event;
+}
+
+//_____________________________________________________________________________
+void AliFast::Init()
+{
+// Initialise detector
+ AliFDet *detector=gAliFast->Detector();
+ detector->InitDetParam();
+
+// Initialise makers
+ TIter next(fMakers);
+ AliFMaker *maker;
+ TObject *objfirst, *objlast;
+ while ((maker = (AliFMaker*)next())) {
+ // save last created histogram in current Root directory
+ objlast = gDirectory->GetList()->Last();
+
+ // Initialise maker
+ maker->Init();
+
+ // Add Maker histograms in Maker list of histograms
+ if (objlast) objfirst = gDirectory->GetList()->After(objlast);
+ else objfirst = gDirectory->GetList()->First();
+ while (objfirst) {
+ maker->Histograms()->Add(objfirst);
+ objfirst = gDirectory->GetList()->After(objfirst);
+ }
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliFast::Paint(Option_t *option)
+{
+// Paint AliFast objects
+
+ //fca fDisplay->Paint(option);
+}
+
+//_____________________________________________________________________________
+void AliFast::PrintInfo()
+{
+// Gives information about versions etc.
+ printf("\n\n");
+ printf("**************************************************************\n");
+ printf("* AliFast version:00%1d last update %6d *\n",
+ fVersion, fVersionDate);
+ printf("**************************************************************\n");
+ printf("* *\n");
+ printf("* Simulates and reconstructs events on particle level *\n");
+ printf("* Package by: Yiota Foka and Elzbieta Richter-Was *\n");
+ printf("* Design based on ATLFast++ *\n");
+ printf("* by R. Brun and E. Richter-Was *\n");
+ printf("**************************************************************\n");
+ printf("\n\n");
+
+// Print info for detector geometry
+ AliFDet *detector=gAliFast->Detector();
+ detector->PrintDetInfo();
+
+// Print info for all defined Makers
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->PrintInfo();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::FillTree()
+{
+// Fill the ROOT tree, looping on all active branches
+
+ // Clean generated particles (depending on option Save)
+ //MCMaker()->CleanParticles();
+
+ // Now ready to fill the Root Tree
+ if(fTree) fTree->Fill();
+}
+
+//_____________________________________________________________________________
+void AliFast::InitChain(TChain *chain)
+{
+// Initialize branch addresses for all makers in a TChain
+
+ if (chain == 0) return;
+
+ fTree = chain;
+
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->SetChainAddress(chain);
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::MakeTree(const char* name, const char*title)
+{
+// Create a ROOT tree
+// Loop on all makers to create the Root branch (if any)
+
+ if (fTree) return;
+
+ fTree = new TTree(name,title);
+
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->MakeBranch();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::SetDefaultParameters()
+{
+
+// Setters for flags and switches
+ SetLuminosity();
+ SetBfield();
+ SetSmearing();
+ SetSUSYcodeLSP();
+ SetTrackFinding();
+}
+
+//_____________________________________________________________________________
+void AliFast::Make(Int_t i)
+{
+ fEvent = i;
+
+// Loop on all makers
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->Make();
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliFast::FillClone()
+{
+ // Fill Makers fruits clones
+
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->FillClone();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::Finish()
+{
+// Terminate a run
+// place to make operations on histograms, normalization,etc.
+
+ TIter next(fMakers);
+ AliFMaker *maker;
+ while ((maker = (AliFMaker*)next())) {
+ maker->Finish();
+ }
+}
+
+//_____________________________________________________________________________
+void AliFast::SortDown(Int_t n1, Float_t *a, Int_t *index, Bool_t down)
+{
+// sort the n1 elements of array a.
+// In output the array index contains the indices of the sorted array.
+// if down is false sort in increasing order (default is decreasing order)
+// This is a translation of the CERNLIB routine sortzv (M101)
+// based on the quicksort algorithm
+
+ Int_t i,i1,n,i2,i3,i33,i222,iswap,n2;
+ Int_t i22 = 0;
+ Float_t ai;
+ n = n1;
+ if (n <= 0) return;
+ if (n == 1) {index[0] = 0; return;}
+ for (i=0;i<n;i++) index[i] = i+1;
+ for (i1=2;i1<=n;i1++) {
+ i3 = i1;
+ i33 = index[i3-1];
+ ai = a[i33-1];
+ while(1) {
+ i2 = i3/2;
+ if (i2 <= 0) break;
+ i22 = index[i2-1];
+ if (ai <= a[i22-1]) break;
+ index[i3-1] = i22;
+ i3 = i2;
+ }
+ index[i3-1] = i33;
+ }
+
+ while(1) {
+ i3 = index[n-1];
+ index[n-1] = index[0];
+ ai = a[i3-1];
+ n--;
+ if(n-1 < 0) {index[0] = i3; break;}
+ i1 = 1;
+ while(2) {
+ i2 = i1+i1;
+ if (i2 <= n) i22 = index[i2-1];
+ if (i2-n > 0) {index[i1-1] = i3; break;}
+ if (i2-n < 0) {
+ i222 = index[i2];
+ if (a[i22-1] - a[i222-1] < 0) {
+ i2++;
+ i22 = i222;
+ }
+ }
+ if (ai - a[i22-1] > 0) {index[i1-1] = i3; break;}
+ index[i1-1] = i22;
+ i1 = i2;
+ }
+ }
+ if (!down) return;
+ n2 = n1/2;
+ for (i=0;i<n1;i++) index[i]--;
+ for (i=0;i<n2;i++) {
+ iswap = index[i];
+ index[i] = index[n1-i-1];
+ index[n1-i-1] = iswap;
+ }
+}
+//______________________________________________________________________________
+void AliFast::Streamer(TBuffer &R__b)
+{
+ // Stream an object of class AliFast.
+
+ if (R__b.IsReading()) {
+ R__b.ReadVersion(); // Version_t R__v = R__b.ReadVersion();
+ TNamed::Streamer(R__b);
+ if (!gAliFast) gAliFast = this;
+ gROOT->GetListOfBrowsables()->Add(this,"AliFast");
+ R__b >> fVersion;
+ R__b >> fVersionDate;
+ R__b >> fRun;
+ R__b >> fEvent;
+ R__b >> fMode;
+ fTree = (TTree*)gDirectory->Get("T");
+ R__b >> fMakers;
+ // R__b >> fMCMaker;
+ R__b >> fTrackMaker;
+ R__b >> fLuminosity;
+ R__b >> fBfield;
+ R__b >> fSmearing;
+ R__b >> fSUSYcodeLSP;
+ R__b >> fTrackFinding;
+ // fca
+ fHistBrowser.Streamer(R__b);
+ // fca
+ } else {
+ R__b.WriteVersion(AliFast::IsA());
+ TNamed::Streamer(R__b);
+ R__b << fVersion;
+ R__b << fVersionDate;
+ R__b << fRun;
+ R__b << fEvent;
+ R__b << fMode;
+ fTree->Write();
+ R__b << fMakers;
+ //R__b << fMCMaker;
+ R__b << fTrackMaker;
+ R__b << fLuminosity;
+ R__b << fBfield;
+ R__b << fSmearing;
+ R__b << fSUSYcodeLSP;
+ R__b << fTrackFinding;
+ // fca
+ fHistBrowser.Streamer(R__b);
+ // fca
+ }
+}
+
+
+
+
+
--- /dev/null
+#ifndef AliFast_H
+#define AliFast_H
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliFast //
+// //
+// Main class to control the AliFast program. //
+// //
+// This class : //
+// - Initialises the run default parameters //
+// - Provides API to Set/Get run parameters //
+// - Creates the support lists (TClonesArrays) for the Event structure//
+// - Creates the physics objects makers //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliRun.h"
+//#ifndef ROOT_TTree
+#include <TTree.h>
+//#endif
+//#ifndef AliFHistBrowser_H
+#include "AliFHistBrowser.h"
+//#endif
+//#ifndef AliFBigBang_H
+#include "AliFBigBang.h"
+//#endif
+//#ifndef AliFMaker_H
+#include "AliFMaker.h"
+//#endif
+//#ifndef AliFDet_H
+//#include "AliFDet.h"
+//#endif
+
+class TBrowser;
+class TChain;
+class AliFMCMaker;
+class AliFTrackMaker;
+class AliFDet;
+class AliFVirtualDisplay;
+
+class AliFast : public AliRun {
+
+private:
+ Int_t fVersion; //AliFast version number
+ Int_t fVersionDate; //AliFast version date
+ Int_t fMode; //Run mode
+ Int_t fTestTrack; //Test mode for TrackMaker
+ TTree *fTree; //Pointer to the Root tree
+ TList *fMakers; //List of Makers
+// pointers to standard Makers
+ AliFMCMaker *fMCMaker; //Pointer to MCMaker
+ AliFTrackMaker *fTrackMaker; //Pointer to TrackMaker
+ AliFDet *fDet; //Pointer to Detector
+// flags and switches
+ Int_t fLuminosity; //Luminosity option (low=1, high=2)
+ Bool_t fBfield; //B-field (on=1,off=0)
+ Bool_t fSmearing; //Smearing on=1, off=0
+ Int_t fSUSYcodeLSP; //Code for SUSY LSP particle
+ Int_t fTrackFinding; //Track/finding on=1,off=0
+ AliFHistBrowser fHistBrowser; //Object to Browse Maker histograms
+ AliFBigBang fBigBang; //!Object to Browse generated particles
+ AliFVirtualDisplay *fDisplay; //!Pointer to Event display object
+
+public:
+ AliFast();
+ AliFast(const char *name, const char *title="The ALIAS fast MonteCarlo");
+ virtual ~AliFast();
+ virtual void Browse(TBrowser *b);
+ virtual void Draw(Option_t *option=""); // *MENU*
+ Int_t GetVersion() {return fVersion;}
+ Int_t GetVersionDate() {return fVersionDate;}
+ virtual void Clear(Option_t *option="");
+ AliFVirtualDisplay *Display() {return fDisplay;}
+ virtual void FillClone();
+ virtual void Finish();
+ virtual void GetTreeEvent(Int_t event); // *MENU*
+ virtual void Init();
+ Bool_t IsFolder() {return kTRUE;}
+ virtual void Make(Int_t i=0);
+ virtual void Paint(Option_t *option="");
+ virtual void PrintInfo();
+ virtual void SetDefaultParameters();
+
+ TList *Makers() {return fMakers;}
+ AliFMaker *Maker(const char *name) {return (AliFMaker*)fMakers->FindObject(name);}
+ AliFMCMaker *MCMaker() {return fMCMaker;}
+ AliFTrackMaker *TrackMaker() {return fTrackMaker;}
+ AliFDet *Detector() {return fDet;}
+ TTree *Tree() {return fTree;}
+
+ Int_t Run() {return fRun;}
+ Int_t Event() {return fEvent;}
+ Int_t Mode() {return fMode;}
+ Int_t TestTrack() {return fTestTrack;}
+
+// Getters for flags and switches
+ Int_t Luminosity() {return fLuminosity;}
+ Bool_t Bfield() {return fBfield;}
+ Bool_t Smearing() {return fSmearing;}
+ Int_t SUSYcodeLSP() {return fSUSYcodeLSP;}
+ Bool_t TrackFinding() {return fTrackFinding;}
+
+
+// Setter for Event Display
+ void SetDisplay(AliFVirtualDisplay *display) {fDisplay=display;}
+// Setters for flags and switches
+ void SetLuminosity(Int_t lumi=1) {fLuminosity=lumi;}
+ void SetBfield(Bool_t field=1) {fBfield=field;}
+ void SetSmearing(Bool_t val=1) {fSmearing=val;}
+ void SetSUSYcodeLSP(Int_t val=66) {fSUSYcodeLSP=val;}
+ void SetTrackFinding(Bool_t val=0) {fTrackFinding=val;}
+
+ virtual void SetRun(Int_t run=1) {fRun=run;}
+ virtual void SetEvent(Int_t event=1) {fEvent=event;}
+ virtual void SetMode(Int_t mode=0) {fMode=mode;}
+ virtual void SetTestTrack(Int_t test=0) {fTestTrack=test;}
+
+ void FillTree();
+ void InitChain(TChain *chain);
+ void MakeTree(const char* name="T", const char*title="AliFast tree");
+
+ void SortDown(Int_t n, Float_t *a, Int_t *index, Bool_t down=kTRUE);
+
+ ClassDef(AliFast, 1) //AliFast control class
+};
+
+R__EXTERN AliFast *gAliFast;
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+############################### ALIFAST Makefile ##################################
+
+# Include machine specific definitions
+
+include $(ALICE_ROOT)/conf/GeneralDef
+include $(ALICE_ROOT)/conf/MachineDef.$(ALICE_TARGET)
+
+PACKAGE = ALIFAST
+
+# C++ sources
+
+SRCS = AliFast.cxx AliFMaker.cxx AliFDet.cxx AliFTrackMaker.cxx \
+ AliFTrack.cxx AliFHistBrowser.cxx AliFBigBang.cxx \
+ AliFBrowsable.cxx AliFVirtualDisplay.cxx
+
+# C++ Headers
+
+HDRS = $(SRCS:.cxx=.h) ALIFASTLinkDef.h
+
+# Library dictionary
+
+DICT = ALIFASTCint.cxx
+DICTH = $(DICT:.cxx=.h)
+DICTO = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(DICT))
+
+# FORTRAN Objectrs
+
+FOBJS = $(FSRCS:.f=.o)
+
+# C Objects
+
+COBJS = $(CSRCS:.c=.o)
+
+# C++ Objects
+
+OBJS = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(SRCS)) $(DICTO)
+
+# C++ compilation flags
+
+CXXFLAGS = $(CXXOPTS) -I$(ROOTSYS)/include -I. -I$(ALICE_ROOT)/include/
+
+# FORTRAN compilation flags
+
+FFLAGS = $(FOPT)
+
+##### TARGETS #####
+
+# Target
+
+SLIBRARY = $(LIBDIR)/libALIFAST.$(SL)
+
+default: $(SLIBRARY)
+
+$(LIBDIR)/libALIFAST.$(SL): $(OBJS)
+
+$(DICT): $(HDRS)
+
+depend: $(SRCS)
+
+TOCLEAN = $(OBJS) *Cint.h *Cint.cxx
+
+############################### General Macros ################################
+
+include $(ALICE_ROOT)/conf/GeneralMacros
+
+############################ Dependencies #####################################
+
+-include tgt_$(ALICE_TARGET)/Make-depend
+
+
+
+
+
+### Target check creates violation reports (.viol), which depend on
+### stripped files (.ii), which in turn depend on preprocessed
+### files (.i). Dependences are in conf/GeneralDef.
+
+CHECKS = $(patsubst %.cxx,check/%.viol,$(SRCS))
+
+check: $(CHECKS)
+
+
--- /dev/null
+void alifast()
+{
+
+ AliFast * fast =new AliFast("blabla","blabla");
+ gAliFast->Init("Config.C");
+
+ TFile file("alifast.root","recreate","ALIFast root file",2);
+ gAliFast.Init();
+ gAliFast.MakeTree();
+ gAliFast->Generator()->Generate();
+
+ gAliFast.Make(0); // Generate and Reconstruct event
+ gAliFast.FillTree();
+ gAliFast.Clear(); // Clear reconstructed event lists
+
+ gAliFast.Finish();
+ gAliFast.Write();
+}
--- /dev/null
+void alifasttest()
+{
+
+ AliFast * fast =new AliFast("blabla","blabla");
+ gAliFast->Init("Config.C");
+
+ TFile file("alifasttest.root","recreate","ALIFast root file",2);
+ gAliFast.Init();
+ gAliFast.SetTestTrack(1);
+ gAliFast.MakeTree();
+ gAliFast->Generator()->Generate();
+
+ gAliFast.Make(); // Generate and Reconstruct event
+ gAliFast.FillTree();
+ gAliFast.Clear(); // Clear reconstructed event lists
+
+ gAliFast.Finish();
+ gAliFast.Write();
+}
--- /dev/null
+{
+ // change AliFast default parameters
+
+ gAliFast->SetSmearing(1);
+ gAliFast->SetTrackFinding(1);
+ gAliFast->MCMaker()->Save(2); //give 2 to save all particles
+ gAliFast->TrackMaker()->Save(1); // give 1 to save tracks
+}
+