From 65a39007691b0a71c9024d2b4a85902994b20238 Mon Sep 17 00:00:00 2001 From: fca Date: Wed, 3 May 2000 06:53:21 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r1018, which included commits to RCS files with non-trunk default branches. --- ALIFAST/ALIFASTLinkDef.h | 26 + ALIFAST/AliFBigBang.cxx | 80 +++ ALIFAST/AliFBigBang.h | 45 ++ ALIFAST/AliFBrowsable.cxx | 68 ++ ALIFAST/AliFBrowsable.h | 46 ++ ALIFAST/AliFDet.cxx | 320 ++++++++++ ALIFAST/AliFDet.h | 91 +++ ALIFAST/AliFDisplay.cxx | 537 ++++++++++++++++ ALIFAST/AliFDisplay.h | 96 +++ ALIFAST/AliFFruit.cxx | 93 +++ ALIFAST/AliFFruit.h | 34 + ALIFAST/AliFHistBrowser.cxx | 36 ++ ALIFAST/AliFHistBrowser.h | 27 + ALIFAST/AliFMaker.cxx | 216 +++++++ ALIFAST/AliFMaker.h | 69 +++ ALIFAST/AliFParticle.cxx | 291 +++++++++ ALIFAST/AliFParticle.h | 48 ++ ALIFAST/AliFTrack.cxx | 45 ++ ALIFAST/AliFTrack.h | 57 ++ ALIFAST/AliFTrackMaker.cxx | 1062 ++++++++++++++++++++++++++++++++ ALIFAST/AliFTrackMaker.h | 124 ++++ ALIFAST/AliFVirtualDisplay.cxx | 35 ++ ALIFAST/AliFVirtualDisplay.h | 47 ++ ALIFAST/AliFast.cxx | 563 +++++++++++++++++ ALIFAST/AliFast.h | 147 +++++ ALIFAST/Makefile | 82 +++ ALIFAST/alifast.C | 18 + ALIFAST/alifasttest.C | 19 + ALIFAST/user.C | 9 + 29 files changed, 4331 insertions(+) create mode 100644 ALIFAST/ALIFASTLinkDef.h create mode 100644 ALIFAST/AliFBigBang.cxx create mode 100644 ALIFAST/AliFBigBang.h create mode 100644 ALIFAST/AliFBrowsable.cxx create mode 100644 ALIFAST/AliFBrowsable.h create mode 100644 ALIFAST/AliFDet.cxx create mode 100644 ALIFAST/AliFDet.h create mode 100644 ALIFAST/AliFDisplay.cxx create mode 100644 ALIFAST/AliFDisplay.h create mode 100644 ALIFAST/AliFFruit.cxx create mode 100644 ALIFAST/AliFFruit.h create mode 100644 ALIFAST/AliFHistBrowser.cxx create mode 100644 ALIFAST/AliFHistBrowser.h create mode 100644 ALIFAST/AliFMaker.cxx create mode 100644 ALIFAST/AliFMaker.h create mode 100644 ALIFAST/AliFParticle.cxx create mode 100644 ALIFAST/AliFParticle.h create mode 100644 ALIFAST/AliFTrack.cxx create mode 100644 ALIFAST/AliFTrack.h create mode 100644 ALIFAST/AliFTrackMaker.cxx create mode 100644 ALIFAST/AliFTrackMaker.h create mode 100644 ALIFAST/AliFVirtualDisplay.cxx create mode 100644 ALIFAST/AliFVirtualDisplay.h create mode 100644 ALIFAST/AliFast.cxx create mode 100644 ALIFAST/AliFast.h create mode 100644 ALIFAST/Makefile create mode 100644 ALIFAST/alifast.C create mode 100644 ALIFAST/alifasttest.C create mode 100644 ALIFAST/user.C diff --git a/ALIFAST/ALIFASTLinkDef.h b/ALIFAST/ALIFASTLinkDef.h new file mode 100644 index 00000000000..f9d41718fa9 --- /dev/null +++ b/ALIFAST/ALIFASTLinkDef.h @@ -0,0 +1,26 @@ +#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 diff --git a/ALIFAST/AliFBigBang.cxx b/ALIFAST/AliFBigBang.cxx new file mode 100644 index 00000000000..628246f380d --- /dev/null +++ b/ALIFAST/AliFBigBang.cxx @@ -0,0 +1,80 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFBigBang // +// // +// helper class to browse generated particles. // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#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;iUncheckedAt(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; +} + + + + + + + diff --git a/ALIFAST/AliFBigBang.h b/ALIFAST/AliFBigBang.h new file mode 100644 index 00000000000..33a1a6eac5c --- /dev/null +++ b/ALIFAST/AliFBigBang.h @@ -0,0 +1,45 @@ +#ifndef AliFBigBang_H +#define AliFBigBang_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFBigBang // +// // +// helper class to browse generated particles. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#endif +#ifndef ROOT_TObjArray +#include +#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 + + + + + + + + + diff --git a/ALIFAST/AliFBrowsable.cxx b/ALIFAST/AliFBrowsable.cxx new file mode 100644 index 00000000000..b29f04382d4 --- /dev/null +++ b/ALIFAST/AliFBrowsable.cxx @@ -0,0 +1,68 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFBrowsable // +// // +// helper class to browse generated particles. // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#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;iUncheckedAt(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); + } + */ +} + + + + + + + + + + + + + + + diff --git a/ALIFAST/AliFBrowsable.h b/ALIFAST/AliFBrowsable.h new file mode 100644 index 00000000000..ccf4204db1e --- /dev/null +++ b/ALIFAST/AliFBrowsable.h @@ -0,0 +1,46 @@ +#ifndef AliFBrowsable_H +#define AliFBrowsable_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFBrowsable // +// // +// helper class to browse generated particles. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#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 + + + + + + + + + + + diff --git a/ALIFAST/AliFDet.cxx b/ALIFAST/AliFDet.cxx new file mode 100644 index 00000000000..02ca256ef62 --- /dev/null +++ b/ALIFAST/AliFDet.cxx @@ -0,0 +1,320 @@ +//////////////////////////////////////////////////////////////////////////// +// // +// 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 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 +//#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 + + + + + + + + + + diff --git a/ALIFAST/AliFDisplay.cxx b/ALIFAST/AliFDisplay.cxx new file mode 100644 index 00000000000..acb0dfc6b6f --- /dev/null +++ b/ALIFAST/AliFDisplay.cxx @@ -0,0 +1,537 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFDisplay // +// // +// Utility class to display ALICE outline, tracks, clusters, jets,.. // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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(); +} + + + + + + + + + + diff --git a/ALIFAST/AliFDisplay.h b/ALIFAST/AliFDisplay.h new file mode 100644 index 00000000000..8ecb17b98c2 --- /dev/null +++ b/ALIFAST/AliFDisplay.h @@ -0,0 +1,96 @@ +#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 + + + + + + + diff --git a/ALIFAST/AliFFruit.cxx b/ALIFAST/AliFFruit.cxx new file mode 100644 index 00000000000..7335bd6a424 --- /dev/null +++ b/ALIFAST/AliFFruit.cxx @@ -0,0 +1,93 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFFruit // +// // +// Utility class to draw Electrons, photons, Jets, Clusters,etc // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include + +#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); +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALIFAST/AliFFruit.h b/ALIFAST/AliFFruit.h new file mode 100644 index 00000000000..6903354e090 --- /dev/null +++ b/ALIFAST/AliFFruit.h @@ -0,0 +1,34 @@ +#ifndef AliFFruit_H +#define AliFFruit_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFFruit // +// // +// Utility class to draw Electrons, photons, Jets, Clusters,etc // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TPolyLine3D +#include +#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 diff --git a/ALIFAST/AliFHistBrowser.cxx b/ALIFAST/AliFHistBrowser.cxx new file mode 100644 index 00000000000..e1477b59987 --- /dev/null +++ b/ALIFAST/AliFHistBrowser.cxx @@ -0,0 +1,36 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFHistBrowser // +// // +// helper class to browse AliFast Makers histograms. // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#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()); + } + +} diff --git a/ALIFAST/AliFHistBrowser.h b/ALIFAST/AliFHistBrowser.h new file mode 100644 index 00000000000..77c83da3798 --- /dev/null +++ b/ALIFAST/AliFHistBrowser.h @@ -0,0 +1,27 @@ +#ifndef AliFHistBrowser_H +#define AliFHistBrowser_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFHistBrowser // +// // +// helper class to browse AliFast Makers histograms. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#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 diff --git a/ALIFAST/AliFMaker.cxx b/ALIFAST/AliFMaker.cxx new file mode 100644 index 00000000000..cc711f090f3 --- /dev/null +++ b/ALIFAST/AliFMaker.cxx @@ -0,0 +1,216 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFast virtual base class for Makers // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#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;iAt(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;iAt(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; + } +} + + + + + + + + + + + + + + diff --git a/ALIFAST/AliFMaker.h b/ALIFAST/AliFMaker.h new file mode 100644 index 00000000000..65fd1110519 --- /dev/null +++ b/ALIFAST/AliFMaker.h @@ -0,0 +1,69 @@ +#ifndef AliFMaker_H +#define AliFMaker_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFast virtual base class for Makers // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#endif +#ifndef ROOT_TClonesArray +#include +#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 + + + + + + + + + + + + + diff --git a/ALIFAST/AliFParticle.cxx b/ALIFAST/AliFParticle.cxx new file mode 100644 index 00000000000..dacac0bbcf4 --- /dev/null +++ b/ALIFAST/AliFParticle.cxx @@ -0,0 +1,291 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// AliFParticle // +// // +// Graphics interface to event generators particle // +////////////////////////////////////////////////////////////////////////// + +#include +#include "TMCParticle.h" +#include "TClonesArray.h" +#include "TPolyLine3D.h" +#include "TCanvas.h" +#include +#include + +#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 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;iUncheckedAt(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(); + } +} + + + + + + + + diff --git a/ALIFAST/AliFParticle.h b/ALIFAST/AliFParticle.h new file mode 100644 index 00000000000..48d2fe30dee --- /dev/null +++ b/ALIFAST/AliFParticle.h @@ -0,0 +1,48 @@ +#ifndef AliFParticle_H +#define AliFParticle_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFParticle // +// // +// Graphics interface to event generators particle // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#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 diff --git a/ALIFAST/AliFTrack.cxx b/ALIFAST/AliFTrack.cxx new file mode 100644 index 00000000000..20cdcf127dc --- /dev/null +++ b/ALIFAST/AliFTrack.cxx @@ -0,0 +1,45 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// 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 *) +{ + +} + diff --git a/ALIFAST/AliFTrack.h b/ALIFAST/AliFTrack.h new file mode 100644 index 00000000000..645bac3f48d --- /dev/null +++ b/ALIFAST/AliFTrack.h @@ -0,0 +1,57 @@ +#ifndef AliFTrack_H +#define AliFTrack_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFast track class // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TObject +#include +#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 diff --git a/ALIFAST/AliFTrackMaker.cxx b/ALIFAST/AliFTrackMaker.cxx new file mode 100644 index 00000000000..17bd12f467c --- /dev/null +++ b/ALIFAST/AliFTrackMaker.cxx @@ -0,0 +1,1062 @@ +////////////////////////////////////////////////////////////////////////// +// // +// 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#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;indUncheckedAt(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; icylIFlagDet(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; icylDetector(); + 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; idetRDet(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; imRDetSQ(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= 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 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; istFill(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]); + } + } +} +//_____________________________________________________________________________ diff --git a/ALIFAST/AliFTrackMaker.h b/ALIFAST/AliFTrackMaker.h new file mode 100644 index 00000000000..72149612afa --- /dev/null +++ b/ALIFAST/AliFTrackMaker.h @@ -0,0 +1,124 @@ +#ifndef AliFTrackMaker_H +#define AliFTrackMaker_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFast TrackMaker class. // +// // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef AliFMaker_H +#include "AliFMaker.h" +#endif +#ifndef ROOT_TMatrix +#include +#endif +#ifndef ROOT_TH1 +#include +#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 + + + + + + + + diff --git a/ALIFAST/AliFVirtualDisplay.cxx b/ALIFAST/AliFVirtualDisplay.cxx new file mode 100644 index 00000000000..13a44ab0986 --- /dev/null +++ b/ALIFAST/AliFVirtualDisplay.cxx @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////// +// // +// 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 +{ + +} diff --git a/ALIFAST/AliFVirtualDisplay.h b/ALIFAST/AliFVirtualDisplay.h new file mode 100644 index 00000000000..173d3b0990f --- /dev/null +++ b/ALIFAST/AliFVirtualDisplay.h @@ -0,0 +1,47 @@ +#ifndef AliFVirtualDisplay_H +#define AliFVirtualDisplay_H + +////////////////////////////////////////////////////////////////////////// +// // +// AliFVirtualDisplay // +// // +// Virtual base class for AliFast event display // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TObject +#include +#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 diff --git a/ALIFAST/AliFast.cxx b/ALIFAST/AliFast.cxx new file mode 100644 index 00000000000..2e75a4ba5b1 --- /dev/null +++ b/ALIFAST/AliFast.cxx @@ -0,0 +1,563 @@ + +////////////////////////////////////////////////////////////////////////// +// // +// 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; iGetNtracks()); +//// 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 +#include +#include +#include +#include +#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 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;iGetListOfBrowsables()->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 + } +} + + + + + diff --git a/ALIFAST/AliFast.h b/ALIFAST/AliFast.h new file mode 100644 index 00000000000..585cc2b3f4b --- /dev/null +++ b/ALIFAST/AliFast.h @@ -0,0 +1,147 @@ +#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 +//#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 + + + + + + + + + + + + + + + + + diff --git a/ALIFAST/Makefile b/ALIFAST/Makefile new file mode 100644 index 00000000000..a55414e0b23 --- /dev/null +++ b/ALIFAST/Makefile @@ -0,0 +1,82 @@ +############################### 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) + + diff --git a/ALIFAST/alifast.C b/ALIFAST/alifast.C new file mode 100644 index 00000000000..8f07437ffcf --- /dev/null +++ b/ALIFAST/alifast.C @@ -0,0 +1,18 @@ +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(); +} diff --git a/ALIFAST/alifasttest.C b/ALIFAST/alifasttest.C new file mode 100644 index 00000000000..ec974c852ee --- /dev/null +++ b/ALIFAST/alifasttest.C @@ -0,0 +1,19 @@ +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(); +} diff --git a/ALIFAST/user.C b/ALIFAST/user.C new file mode 100644 index 00000000000..7c39a7a7bbd --- /dev/null +++ b/ALIFAST/user.C @@ -0,0 +1,9 @@ +{ + // 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 +} + -- 2.43.0