3 void ITSDigitsToClusters (Int_t evNumber1=0,Int_t evNumber2=0)
5 /////////////////////////////////////////////////////////////////////////
6 // This macro is a small example of a ROOT macro
7 // illustrating how to read the output of GALICE
8 // and do some analysis.
10 /////////////////////////////////////////////////////////////////////////
12 // Dynamically link some shared libs
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
23 // Connect the Root Galice file containing Geometry, Kine and Hits
25 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
26 printf("file %p\n",file);
27 if (file) file->Close();
28 file = new TFile("galice.root","UPDATE");
31 printf ("I'm after Map \n");
33 // Get AliRun object from file or create it if not on file
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
40 printf ("I'm after gAlice \n");
42 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
45 AliITSgeom *geom = ITS->GetITSgeom();
48 // Set the models for cluster finding
52 AliITSDetType *iDetType=ITS->DetType(0);
53 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
54 TClonesArray *dig0 = ITS->DigitsAddress(0);
55 TClonesArray *recp0 = ITS->ClustersAddress(0);
56 AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0);
57 ITS->SetReconstructionModel(0,rec0);
59 //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
60 //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
65 Float_t baseline = 10.;
67 Int_t thres = (Int_t)(baseline+3*noise);
68 printf("thresh %d\n",thres);
70 AliITSDetType *iDetType=ITS->DetType(1);
71 AliITSgeom *geom = ITS->GetITSgeom();
73 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
74 if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
75 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
76 if (!res1) res1=new AliITSresponseSDD();
78 //res1->SetNoiseParam(noise,baseline);
80 res1->SetNoiseParam(noise,baseline);
81 Float_t magic = res1->MagicValue();
82 Float_t top = res1->MaxAdc();
86 res1->GetNoiseParam(n,b);
87 printf("SDD: noise baseline %f %f zs option %s data type %s\n",n,b,res1->ZeroSuppOption(),res1->DataType());
88 printf("SDD: DriftSpeed %f TopValue %f\n",res1->DriftSpeed(),res1->MagicValue());
90 res1->DiffCoeff(dif0,dif1);
91 printf("SDD: dif0 %f dif1 %f\n",dif0,dif1);
92 TClonesArray *dig1 = ITS->DigitsAddress(1);
93 TClonesArray *recp1 = ITS->ClustersAddress(1);
94 AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
95 rec1->SetMinNCells(6);
96 rec1->SetTimeCorr(70.);
97 rec1->SetCutAmplitude(thres);
98 ITS->SetReconstructionModel(1,rec1);
102 AliITSDetType *iDetType=ITS->DetType(2);
103 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
104 TClonesArray *dig2 = ITS->DigitsAddress(2);
105 TClonesArray *recp2 = ITS->ClustersAddress(2);
106 AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2);
107 ITS->SetReconstructionModel(2,rec2);
109 //printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
110 //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
118 for (int nev=evNumber1; nev<= evNumber2; nev++) {
119 Int_t nparticles = gAlice->GetEvent(nev);
120 cout << "nev " <<nev<<endl;
121 cout << "nparticles " <<nparticles<<endl;
122 if (nev < evNumber1) continue;
123 if (nparticles <= 0) return;
125 TTree *TD = gAlice->TreeD();
126 Int_t nent=TD->GetEntries();
127 printf("Found %d entries in the tree (must be one per module per event!)\n",nent);
128 //Int_t nmodules=geom->GetLastSSD();
129 //Int_t last_entry=nent-(nmodules+1);
131 ITS->DigitsToRecPoints(nev,last_entry,"All");