From 88c938899a2f06ed3f022377a7bbd7a5ebf9a016 Mon Sep 17 00:00:00 2001 From: barbera Date: Sun, 12 Nov 2000 22:43:30 +0000 Subject: [PATCH] Macro to run/test the SPD Bari model --- ITS/AliITSFindClustersBari.C | 106 +++++++++++++++++++++++ ITS/AliITSHits2DigitsBari.C | 114 ++++++++++++++++++++++++ ITS/AliITStestBari.C | 32 +++++++ ITS/ITSDigitsToClustersBari.C | 159 ++++++++++++++++++++++++++++++++++ ITS/ITSHitsToDigitsBari.C | 156 +++++++++++++++++++++++++++++++++ ITS/ITSdigitBari.C | 109 +++++++++++++++++++++++ ITS/ITSrecpointsBari.C | 84 ++++++++++++++++++ ITS/debug.C | 156 +++++++++++++++++++++++++++++++++ 8 files changed, 916 insertions(+) create mode 100644 ITS/AliITSFindClustersBari.C create mode 100644 ITS/AliITSHits2DigitsBari.C create mode 100644 ITS/AliITStestBari.C create mode 100644 ITS/ITSDigitsToClustersBari.C create mode 100644 ITS/ITSHitsToDigitsBari.C create mode 100644 ITS/ITSdigitBari.C create mode 100644 ITS/ITSrecpointsBari.C create mode 100644 ITS/debug.C diff --git a/ITS/AliITSFindClustersBari.C b/ITS/AliITSFindClustersBari.C new file mode 100644 index 00000000000..76d56707084 --- /dev/null +++ b/ITS/AliITSFindClustersBari.C @@ -0,0 +1,106 @@ +Int_t AliITSFindClustersBari() { + + printf("FindClusters\n"); + + TFile *in=TFile::Open("galice.root","UPDATE"); + if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;} + + in->ls(); + + if (!(gAlice=(AliRun*)in->Get("gAlice"))) { + cerr<<"gAlice have not been found on galice.root !\n"; + return 2; + } + + + gAlice->GetEvent(0); + + AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); + if (!ITS) { + cerr<<"ITSFindClusters.C : AliITS object not found on file\n"; + return 3; + } + Int_t ver = ITS->IsVersion(); + cerr<<"ITS version "<GetITSgeom(); + + // SPD + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + TClonesArray *dig0 = ITS->DigitsAddress(0); + TClonesArray *recp0 = ITS->ClustersAddress(0); + AliITSClusterFinderSPDbari *rec0=new AliITSClusterFinderSPDbari(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 + Float_t baseline = 10.; + Float_t noise = 1.67; + Float_t thres = baseline+3.*noise; + + AliITSDetType *iDetType=ITS->DetType(1); + AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); + if (!seg1) seg1 = new AliITSsegmentationSDD(geom); + AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); + if (!res1) res1=new AliITSresponseSDD(); + res1->SetMagicValue(900.); + Float_t magic = res1->MagicValue(); + Float_t top = res1->MaxAdc(); + thres *= top/magic; + res1->SetNoiseParam(noise,baseline); + TClonesArray *dig1 = ITS->DigitsAddress(1); + TClonesArray *recp1 = ITS->ClustersAddress(1); + AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); + rec1->SetMinNCells(6); + rec1->SetTimeCorr(70.); + rec1->SetCutAmplitude((int)thres); + 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->Dz()); + printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx()); + + + + + TStopwatch timer; + + switch (ver) { + case 5: + cerr<<"Looking for clusters...\n"; + { + timer.Start(); + ITS->DigitsToRecPoints(0,1,"All"); + } + break; + default: + cerr<<"Invalid ITS version !\n"; + return 5; + } + + timer.Stop(); timer.Print(); + + delete rec0; + delete rec1; + delete rec2; + + + delete gAlice; gAlice=0; + + in->Close(); + + return 0; +} diff --git a/ITS/AliITSHits2DigitsBari.C b/ITS/AliITSHits2DigitsBari.C new file mode 100644 index 00000000000..68cc01bc158 --- /dev/null +++ b/ITS/AliITSHits2DigitsBari.C @@ -0,0 +1,114 @@ +Int_t AliITSHits2DigitsBari() +{ + + // Connect the Root Galice file containing Geometry, Kine and Hits + + const char * inFile = "galice.root"; + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile); + if (file) {file->Close(); delete file;} + printf("Hits2Digits\n"); + file = new TFile(inFile,"UPDATE"); + if (!file->IsOpen()) { + cerr<<"Can't open "<ls(); + + // Get AliRun object from file or return if not on file + if (gAlice) delete gAlice; + gAlice = (AliRun*)file->Get("gAlice"); + if (!gAlice) { + cerr<<"ITSHits2Digits.C : AliRun object not found on file\n"; + return 2; + } + + gAlice->GetEvent(0); + AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); + if (!ITS) { + cerr<<"ITSHits2Digits.C : AliITS object not found on file\n"; + return 3; + } + +// Set the simulation models for the three detector types + AliITSgeom *geom = ITS->GetITSgeom(); + + // SPD + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + AliITSresponseSPDbari *res0 = (AliITSresponseSPDbari*)iDetType->GetResponseModel(); + AliITSsimulationSPDbari *sim0=new AliITSsimulationSPDbari(seg0,res0); + ITS->SetSimulationModel(0,sim0); + // test + printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); + printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); + printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); + // end test + + // SDD + //Set response functions + Float_t baseline = 10.; + Float_t noise = 1.75; + + // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance + AliITSDetType *iDetType=ITS->DetType(1); + AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); + if (!res1) { + res1=new AliITSresponseSDD(); + ITS->SetResponseModel(1,res1); + } + res1->SetMagicValue(900.); + + Float_t maxadc = res1->MaxAdc(); + Float_t topValue = res1->MagicValue(); + Float_t norm = maxadc/topValue; + + Float_t fCutAmp = baseline + 2.*noise; + fCutAmp *= norm; + Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D + + //res1->SetZeroSupp("2D"); + res1->SetZeroSupp("1D"); + res1->SetNoiseParam(noise,baseline); + res1->SetDo10to8(kTRUE); + res1->SetCompressParam(cp); + res1->SetMinVal(4); + res1->SetDiffCoeff(3.6,40.); + //res1->SetMagicValue(96.95); + + AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); + if (!seg1) { + seg1 = new AliITSsegmentationSDD(geom,res1); + ITS->SetSegmentationModel(1,seg1); + } + AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); + sim1->SetDoFFT(1); + sim1->SetCheckNoise(kFALSE); + ITS->SetSimulationModel(1,sim1); + + // SSD + AliITSDetType *iDetType=ITS->DetType(2); + AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); + AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); + res2->SetSigmaSpread(3.,2.); + AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); + ITS->SetSimulationModel(2,sim2); + + + cerr<<"Digitizing ITS...\n"; + + TStopwatch timer; + timer.Start(); + ITS->HitsToDigits(0,0,-1," ","All"," "); + timer.Stop(); timer.Print(); + + delete sim0; + delete sim1; + delete sim2; + + + delete gAlice; gAlice=0; + file->Close(); + delete file; + return 0; +}; + diff --git a/ITS/AliITStestBari.C b/ITS/AliITStestBari.C new file mode 100644 index 00000000000..6d4490d30b2 --- /dev/null +++ b/ITS/AliITStestBari.C @@ -0,0 +1,32 @@ +Int_t AliITStestBari() { + Int_t rc=0; + +//Test ITS simulation + gROOT->LoadMacro("$(ALICE_ROOT)/macros/grun.C"); + grun(); + + Int_t ver=gAlice->GetDetector("ITS")->IsVersion(); + delete gAlice; gAlice=0; + + if (ver!=5) { + cerr<<"Invalid ITS version: "<LoadMacro("$(ALICE_ROOT)/ITS/AliITSHits2DigitsBari.C"); + if (rc=AliITSHits2Digits()) return rc; + + } + + printf("start reconstruction\n"); + +//Test ITS reconstruction + gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersBari.C"); + if (rc=AliITSFindClusters()) return rc; + + //gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSgraphycs.C"); + //if (rc=AliITSgraphycs()) return rc; + + return rc; +} diff --git a/ITS/ITSDigitsToClustersBari.C b/ITS/ITSDigitsToClustersBari.C new file mode 100644 index 00000000000..fb2285845b9 --- /dev/null +++ b/ITS/ITSDigitsToClustersBari.C @@ -0,0 +1,159 @@ +#include "iostream.h" + +void ITSDigitsToClustersBari (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(); + } else { + delete gAlice; + gAlice=0; + } + + +// 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; + + AliITSgeom *geom = ITS->GetITSgeom(); + + + // NOTE: if you foresee to have (in segmentation or response) parameter + // values other than the default ones, and these values are used not only in + // simulation but in cluster finder as well, please set them via your + // local Config.C - the streamer will take care of writing the correct + // info and you'll no longer be obliged to set them again for your cluster + // finder as it's done in this macro (ugly and impractical, no? ) + + + + // Set the models for cluster finding + + // SPD + + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + TClonesArray *dig0 = ITS->DigitsAddress(0); + TClonesArray *recp0 = ITS->ClustersAddress(0); + AliITSClusterFinderSPDbari *rec0=new AliITSClusterFinderSPDbari(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 + + Float_t baseline = 10.; + Float_t noise = 1.67; + Float_t thres = baseline+3*noise; + printf("thresh %d\n",thres); + + 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(); + res1->SetMagicValue(900.); + Float_t magic = res1->MagicValue(); + Float_t top = res1->MaxAdc(); + thres *= top/magic; + res1->SetNoiseParam(noise,baseline); + Float_t n,b; + res1->GetNoiseParam(n,b); + printf("SDD: noise baseline %f %f zs option %s data type %s\n",n,b,res1->ZeroSuppOption(),res1->DataType()); + printf("SDD: DriftSpeed %f TopValue %f\n",res1->DriftSpeed(),res1->MagicValue()); + Float_t dif0,dif1; + res1->DiffCoeff(dif0,dif1); + printf("SDD: dif0 %f dif1 %f\n",dif0,dif1); + TClonesArray *dig1 = ITS->DigitsAddress(1); + TClonesArray *recp1 = ITS->ClustersAddress(1); + AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); + rec1->SetMinNCells(6); + rec1->SetTimeCorr(70.); + rec1->SetCutAmplitude((int)thres); + 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->Dz()); + //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx()); + + + +// +// Event Loop +// + + 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(); + //Int_t last_entry=nent-(nmodules+1); + Int_t last_entry=1; + ITS->DigitsToRecPoints(nev,last_entry,"All"); + } // event loop + + delete rec0; + delete rec1; + delete rec2; + + file->Close(); +} + + + + + + + + + + + + + + diff --git a/ITS/ITSHitsToDigitsBari.C b/ITS/ITSHitsToDigitsBari.C new file mode 100644 index 00000000000..85558150269 --- /dev/null +++ b/ITS/ITSHitsToDigitsBari.C @@ -0,0 +1,156 @@ +#include "iostream.h" + +void ITSHitsToDigitsBari (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(); + } else { + delete gAlice; + gAlice=0; + } + + +// 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(); + if (!file) 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; + + + // Set the simulation models + + AliITSgeom *geom = ITS->GetITSgeom(); + + // SDD + // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance + Float_t baseline = 10.; + Float_t noise = 1.75; + + + AliITSDetType *iDetType=ITS->DetType(1); + AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); + if (!res1) { + res1=new AliITSresponseSDD(); + ITS->SetResponseModel(1,res1); + } + res1->SetMagicValue(900.); + + Float_t maxadc = res1->MaxAdc(); + Float_t topValue = res1->MagicValue(); + Float_t norm = maxadc/topValue; + + Float_t fCutAmp = baseline + 2.*noise; + fCutAmp *= norm; + Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D + + //res1->SetZeroSupp("2D"); + res1->SetZeroSupp("1D"); + res1->SetNoiseParam(noise,baseline); + res1->SetDo10to8(kTRUE); + res1->SetMinVal(4); + res1->SetCompressParam(cp); + res1->SetDiffCoeff(3.6,40.); + + AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); + if (!seg1) { + seg1 = new AliITSsegmentationSDD(geom,res1); + ITS->SetSegmentationModel(1,seg1); + } + + AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); + sim1->SetDoFFT(1); + sim1->SetCheckNoise(kFALSE); + + ITS->SetSimulationModel(1,sim1); + + + + // SPD + + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + AliITSresponseSPDbari *res0 = (AliITSresponseSPDbari*)iDetType->GetResponseModel(); + AliITSsimulationSPDbari *sim0=new AliITSsimulationSPDbari(seg0,res0); + ITS->SetSimulationModel(0,sim0); + // test + //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); + //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); + //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); + // end test + + + // SSD + + AliITSDetType *iDetType=ITS->DetType(2); + AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); + AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); + res2->SetSigmaSpread(3.,2.); + AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); + ITS->SetSimulationModel(2,sim2); + + +// +// Event Loop +// + + Int_t nbgr_ev=0; + + for (Int_t nev=evNumber1; nev<= evNumber2; nev++) { + cout << "nev " <GetEvent(nev); + cout << "nparticles " <HitsToDigits(nev,nbgr_ev,size," ","All"," "); + } // event loop + + delete sim0; + delete sim1; + delete sim2; + + + file->Close(); +} + + + + + + + + + + + + + + diff --git a/ITS/ITSdigitBari.C b/ITS/ITSdigitBari.C new file mode 100644 index 00000000000..9726b6d15c8 --- /dev/null +++ b/ITS/ITSdigitBari.C @@ -0,0 +1,109 @@ +#include "iostream.h" + +void ITSdigitBari (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. +// +// Macro to run the Bari model on the SPDs +// +///////////////////////////////////////////////////////////////////////// + +// 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; + + AliITSgeom *geom = ITS->GetITSgeom(); + +// +// Event Loop +// + + + // SPD + printf ("Beginning of SPD processing \n\n"); + + AliITSDetType *iDetType=ITS->DetType(0); + AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); + // AliITSresponseSPDbari *res0=(AliITSresponseSPDbari*)iDetType->GetResponseModel(); + AliITSresponseSPDbari *res0= new AliITSresponseSPDbari(); + +// to change or monitor the parameters + +//--occhio + res0->SetThresholds(7.2e-6, 1.e-6); + Float_t thresh, sigma; + res0->Thresholds(thresh, sigma); + printf("SPDbari: threshold %e sigma %e\n",thresh, sigma); + +//--occhio + res0->SetNoiseParam(0., 0.); +// res0->SetNoiseParam(0.04, 0.08); + Float_t col, row; + res0->GetNoiseParam(col, row); + printf("SPDbari: Couplcol %e Couplrow %e\n",col, row); + + ITS->SetResponseModel(0,res0); + + + AliITSsimulationSPDbari *sim0=new AliITSsimulationSPDbari(seg0,res0); + ITS->SetSimulationModel(0,sim0); + + // test + printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); + printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); + printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); + // end test + + printf("End SPD processing \n\n"); + + + + + + Int_t nbgr_ev=0; + + for (int nev=evNumber1; nev<= evNumber2; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); + cout << "nev " <HitsToDigits(nev,nbgr_ev,evNumber2,size," ","All"," "); + ITS->HitsToDigits(nev,nbgr_ev,size," ","SPD"," "); + } // event loop + + file->Close(); +} + diff --git a/ITS/ITSrecpointsBari.C b/ITS/ITSrecpointsBari.C new file mode 100644 index 00000000000..05a415dd233 --- /dev/null +++ b/ITS/ITSrecpointsBari.C @@ -0,0 +1,84 @@ +#include "iostream.h" + +void ITSrecpointsBari (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. +// +// version to execute the Bari model +// +///////////////////////////////////////////////////////////////////////// + +// 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); + AliITSClusterFinderSPDbari *rec0=new AliITSClusterFinderSPDbari(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()); + + + + 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(); + Int_t last_entry=1; +// ITS->DigitsToRecPoints(nev,last_entry,"All"); + ITS->DigitsToRecPoints(nev,last_entry,"SPD"); + } // event loop + + file->Close(); +} + diff --git a/ITS/debug.C b/ITS/debug.C new file mode 100644 index 00000000000..8f47d451447 --- /dev/null +++ b/ITS/debug.C @@ -0,0 +1,156 @@ +void debug(){ + // + // macro fro trigger analysis (F. Meddi suggestion) + // + Int_t evNumber=0; + char *filename="galice.root"; + char *fileout="analyse.root"; + + // 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(filename); + if (!file) file = new TFile(filename); + + // 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 + for (int nev=0; nev<= evNumber; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); + cout << "nev " <TreeH(); + Int_t ntracks = TH->GetEntries(); + cout << "ntracks " <GetModule("ITS"); + TClonesArray *Particles = gAlice->Particles(); + if(!ITS) return; + + // fill modules with sorted by module hits + Int_t nmodules; + ITS->InitModules(-1,nmodules); + ITS->FillModules(nev,-1,nmodules," "," "); + + // get pointer to modules array + TObjArray *mods = ITS->GetModules(); + AliITShit *itsHit; + + + //get the Tree for clusters + ITS->GetTreeC(nev); + TTree *TC=ITS->TreeC(); + //TC->Print(); + Int_t nent=TC->GetEntries(); + printf("Found %d entries in the tree of clusters)\n",nent); + TClonesArray *ITSclusters = ITS->ClustersAddress(0); + printf("ITSclusters %p\n",ITSclusters); + + //get the Tree for digits + TTree *TD = gAlice->TreeD(); + //TD->Print(); + Int_t nentd=TD->GetEntries(); + printf("Found %d entries in the tree of digits)\n",nentd); + TObjArray *fBranches=TD->GetListOfBranches(); + TBranch *branch = (TBranch*)fBranches->UncheckedAt(0); + printf ("branch %p entries %d \n",branch,branch->GetEntries()); + TClonesArray *ITSdigits = ITS->DigitsAddress(0); + printf ("ITSdigits %p \n",ITSdigits); + + //get the Tree for rec points + TTree *TR = gAlice->TreeR(); + //TR->Print(); + Int_t nentr=TR->GetEntries(); + printf("Found %d entries in the tree of rec points)\n",nentr); + TClonesArray *ITSrec = ITS->RecPoints(); + printf ("ITSrec %p \n",ITSrec); + AliITSRecPoint *recp; + + AliITSgeom *g = ((AliITS *)ITS)->GetITSgeom(); + Int_t lay, lad, det; + printf("Starts loop on SPD detectors\n"); + + + //loop over the pixel detectors index=0-79 (1-20)*4 layer 1 + // index=80-239 (1-40)*4 layer 2 +// for (Int_t index=g->GetStartSPD();index<=g->GetLastSPD();index++) + for (Int_t index=0;index<2;index++) //debug +// Int_t index=5; + { + + g->GetModuleId(index,lay,lad,det); + printf("detector %d (lay=%d lad=%d det=%d)\n",index+1,lay,lad,det); + + AliITSmodule *itsModule = (AliITSmodule*) mods->At(index); + Int_t numofhits = itsModule->GetNhits(); + printf("number of hits %d\n",numofhits); + if(!numofhits) continue; + + //---------- starts test on digits + ITS->ResetDigits(); + TD->GetEvent(index+1); + Int_t ndigits = ITSdigits->GetEntriesFast(); + if (ndigits) printf("Found %d digits for module %d \n",ndigits,index+1); + if (!ndigits) printf("no digits found \n"); + + + //loop on digits + for (Int_t digit=0;digitUncheckedAt(digit); + printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0]); + } + cout<<"END test for digits "<ResetClusters(); + TC->GetEvent(index); + Int_t nclust = ITSclusters->GetEntries(); + printf("number of clusters %d\n",nclust); + + + //loop on clusters + for (Int_t clu=0;cluUncheckedAt(clu); + printf("cluster %d nZ=%f nX=%f Z=%f X=%f\n",clu+1,itsclu->NclZ(), + itsclu->NclX(),itsclu->Z(),itsclu->X()); + } + cout<<"END test for clusters "<ResetRecPoints(); + TR->GetEvent(index+1); + Int_t nrecpoints = ITSrec->GetEntries(); + printf("Found %d recpoints for module %d \n",nrecpoints,index+1); + + //loop on rec points + for (Int_t irec=0;irecUncheckedAt(irec); + printf("%d %f %f %f %f %d %d %d\n",irec+1,recp->GetX(),recp->GetZ(), + recp->fSigmaX2,recp->fSigmaZ2, + recp->fTracks[0],recp->fTracks[1],recp->fTracks[2]); + } + + printf("Detector No. %d (%d total hits) (%d digits) (%d clusters)\n", + index+1,numofhits,ndigits,nclust); + + + } //end loop on the SPD detectors + +} // end loop over events + +} -- 2.43.0