--- /dev/null
+#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 <<endl;
+ cout << "nparticles " << nparticles <<endl;
+ if (nev < evNumber1) continue;
+ if (nparticles <= 0) return;
+
+ TTree *TH = gAlice->TreeH();
+ Int_t ntracks = TH->GetEntries();
+ cout<<"ntracks "<<ntracks<<endl;
+
+ Int_t nbytes = 0;
+
+ AliITSdigitSSD *ITSdigit;
+
+// Get pointers to Alice detectors and Digits containers
+ AliITS *ITS = (AliITS*)gAlice->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; mod<nent; mod++) {
+ //Int_t nmodules=2269;
+ //for (Int_t mod=nent-nmodules; mod<nent; mod++) {
+ ITS->ResetDigits();
+ 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;digit<ndigits;digit++) {
+ ITSdigit = (AliITSdigitSPD*)ITSdigits->UncheckedAt(digit);
+ printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fTracks[0],ITSdigit->fTracks[1]);
+ */
+ /*
+ for (Int_t digit=0;digit<ndigits;digit++) {
+ ITSdigit = (AliITSdigitSDD*)ITSdigits->UncheckedAt(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;digit<ndigits;digit++) {
+ ITSdigit = (AliITSdigitSSD*)ITSdigits->UncheckedAt(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 "<<endl;
+
+ file->Close();
+}
+
+
+
--- /dev/null
+#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 " <<ev<<endl;
+ cout << "nparticles " <<nparticles<<endl;
+ if (ev < evNumber1) continue;
+ if (nparticles <= 0) return;
+
+ Int_t bgr_ev=Int_t(ev/nsignal);
+ //printf("bgr_ev %d\n",bgr_ev);
+ ITS->HitsToFastRecPoints(ev,bgr_ev,evNumber2,size," ","All"," ");
+ //ITS->HitsToDigits(ev,bgr_ev,evNumber2,size," ","SSD"," ");
+ } // event loop
+
+ file->Close();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+#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 " <<nev<<endl;
+ cout << "nparticles " <<nparticles<<endl;
+ if (nev < evNumber1) continue;
+ if (nparticles <= 0) return;
+
+ TTree *TD = gAlice->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();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+