From 077403c2ae70995946606dd90f0b64b24879ada9 Mon Sep 17 00:00:00 2001 From: nilsen Date: Mon, 12 Jun 2000 23:41:34 +0000 Subject: [PATCH] New ITS macro for use with the new ITS code structure and simulations. --- ITS/ITSdigitsTest.C | 108 ++++++++++++++++++++++++++++++++++++ ITS/ITSfastrecpoints.C | 76 +++++++++++++++++++++++++ ITS/ITSrecpoints.C | 123 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 307 insertions(+) create mode 100644 ITS/ITSdigitsTest.C create mode 100644 ITS/ITSfastrecpoints.C create mode 100644 ITS/ITSrecpoints.C diff --git a/ITS/ITSdigitsTest.C b/ITS/ITSdigitsTest.C new file mode 100644 index 00000000000..4072b686abb --- /dev/null +++ b/ITS/ITSdigitsTest.C @@ -0,0 +1,108 @@ +#include "iostream.h" + +void ITSdigitsTest (Int_t evNumber1=0,Int_t evNumber2=0) +{ +///////////////////////////////////////////////////////////////////////// +// This macro is a small example of a ROOT macro +// illustrating how to read the output of GALICE +// and do some analysis. +// +///////////////////////////////////////////////////////////////////////// + +// Dynamically link some shared libs + + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } + +// Connect the Root Galice file containing Geometry, Kine and Hits + + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + if (!file) file = new TFile("galice.root"); + file->ls(); + +// Get AliRun object from file or create it if not on file + + if (!gAlice) { + gAlice = (AliRun*)file->Get("gAlice"); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); + } + +// +// Loop over events +// + Int_t Nh=0; + Int_t Nh1=0; + for (int nev=0; nev<= evNumber2; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); + cout << "nev " << nev <TreeH(); + Int_t ntracks = TH->GetEntries(); + cout<<"ntracks "<GetModule("ITS"); + TClonesArray *Particles = gAlice->Particles(); + TTree *TD = gAlice->TreeD(); + TD->Print(); + Int_t nent=TD->GetEntries(); + printf("Found %d entries in the tree (must be one per module per event!)\n",nent); + if (ITS) { + TObjArray *fBranches=TD->GetListOfBranches(); + + for (Int_t ich=0;ich<3;ich++) { + TBranch *branch = (TBranch*)fBranches->UncheckedAt(ich); + printf ("branch %p \n",branch); + printf ("branch %p entries %d \n",branch,branch->GetEntries()); + TClonesArray *ITSdigits = ITS->DigitsAddress(ich); + printf ("ITSdigits %p \n",ITSdigits); + + if (ich != 2) continue; + for (Int_t mod=1; modResetDigits(); + nbytes += TD->GetEvent(mod); + //nbytes += branch->GetEvent(mod); this works as well + Int_t ndigits = ITSdigits->GetEntries(); + if (ndigits) printf("Found %d digits for module %d in det type %d \n",ndigits,mod,ich+1); + + if (!ndigits) continue; + /* + for (Int_t digit=0;digitUncheckedAt(digit); + printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fTracks[0],ITSdigit->fTracks[1]); + */ + /* + for (Int_t digit=0;digitUncheckedAt(digit); + printf("%d %d %d %d %f %f\n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0],ITSdigit->fTcharges[0],ITSdigit->fPhysics); + */ + for (Int_t digit=0;digitUncheckedAt(digit); + printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0]); + + } + } + } + } // end if ITS + + } // event loop + + cout<<"END test for digits "<Close(); +} + + + diff --git a/ITS/ITSfastrecpoints.C b/ITS/ITSfastrecpoints.C new file mode 100644 index 00000000000..4a64f1fa2b7 --- /dev/null +++ b/ITS/ITSfastrecpoints.C @@ -0,0 +1,76 @@ +#include "iostream.h" + +void ITSfastrecpoints (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal =25, Int_t size=-1) +{ +///////////////////////////////////////////////////////////////////////// +// This macro is a small example of a ROOT macro +// illustrating how to read the output of GALICE +// and do some analysis. +// +///////////////////////////////////////////////////////////////////////// + +// Dynamically link some shared libs + + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } + + +// Connect the Root Galice file containing Geometry, Kine and Hits + + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + printf("file %p\n",file); + if (file) file->Close(); + file = new TFile("galice.root","UPDATE"); + file->ls(); + + printf ("I'm after Map \n"); + +// Get AliRun object from file or create it if not on file + + if (!gAlice) { + gAlice = (AliRun*)file->Get("gAlice"); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); + } + printf ("I'm after gAlice \n"); + + AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); + if (!ITS) return; + +// +// Event Loop +// + + Int_t nbgr_ev=0; + + for (int ev=evNumber1; ev<= evNumber2; ev++) { + Int_t nparticles = gAlice->GetEvent(ev); + cout << "event " <HitsToFastRecPoints(ev,bgr_ev,evNumber2,size," ","All"," "); + //ITS->HitsToDigits(ev,bgr_ev,evNumber2,size," ","SSD"," "); + } // event loop + + file->Close(); +} + + + + + + + + + + + + + + diff --git a/ITS/ITSrecpoints.C b/ITS/ITSrecpoints.C new file mode 100644 index 00000000000..8060b064750 --- /dev/null +++ b/ITS/ITSrecpoints.C @@ -0,0 +1,123 @@ +#include "iostream.h" + +void ITSrecpoints (Int_t evNumber1=0,Int_t evNumber2=0) +{ +///////////////////////////////////////////////////////////////////////// +// This macro is a small example of a ROOT macro +// illustrating how to read the output of GALICE +// and do some analysis. +// +///////////////////////////////////////////////////////////////////////// + +// Dynamically link some shared libs + + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } + + +// Connect the Root Galice file containing Geometry, Kine and Hits + + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + printf("file %p\n",file); + if (file) file->Close(); + file = new TFile("galice.root","UPDATE"); + file->ls(); + + printf ("I'm after Map \n"); + +// Get AliRun object from file or create it if not on file + + if (!gAlice) { + gAlice = (AliRun*)file->Get("gAlice"); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); + } + printf ("I'm after gAlice \n"); + + AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); + if (!ITS) return; + +// +// Event Loop +// + + + AliITSgeom *geom = ITS->GetITSgeom(); + + // SPD + + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + TClonesArray *dig0 = ITS->DigitsAddress(0); + TClonesArray *recp0 = ITS->ClustersAddress(0); + AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0); + ITS->SetReconstructionModel(0,rec0); + // test + printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); + printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); + + + // SDD + + AliITSDetType *iDetType=ITS->DetType(1); + AliITSgeom *geom = ITS->GetITSgeom(); + + AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); + if (!seg1) seg1 = new AliITSsegmentationSDD(geom); + AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); + if (!res1) res1=new AliITSresponseSDD(); + TClonesArray *dig1 = ITS->DigitsAddress(1); + TClonesArray *recp1 = ITS->ClustersAddress(1); + AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); + ITS->SetReconstructionModel(1,rec1); + + + + // SSD + + AliITSDetType *iDetType=ITS->DetType(2); + AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); + TClonesArray *dig2 = ITS->DigitsAddress(2); + TClonesArray *recp2 = ITS->ClustersAddress(2); + AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2); + ITS->SetReconstructionModel(2,rec2); + // test + printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dy()); + printf("SSD nstrips %d \n",seg2->Npz(),seg2->Npx()); + + + for (int nev=evNumber1; nev<= evNumber2; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); + cout << "nev " <TreeD(); + Int_t nent=TD->GetEntries(); + printf("Found %d entries in the tree (must be one per module per event!)\n",nent); + Int_t nmodules=geom->GetLastSSD(); + //printf("nmodules %d\n",nmodules); + //Int_t last_entry=nent-(nmodules+1); + Int_t last_entry=1; + ITS->DigitsToRecPoints(nev,last_entry,"All"); + } // event loop + + file->Close(); +} + + + + + + + + + + + + + + -- 2.31.1