1 // ----------------------------------------------------//
3 // This macro reads the PMD clusters which //
4 // are stored in the file "PMD.RecPoints.root" //
6 // ----------------------------------------------------//
10 #include "TStopwatch.h"
12 extern AliRun *gAlice;
14 Int_t AliPMDRecpointRead(Int_t nevent = 1)
18 delete AliRunLoader::Instance();
19 delete gAlice;//if everything was OK here it is already NULL
22 AliRunLoader *fRunLoader = AliRunLoader::Open("galice.root","Event","update");
25 cerr<<"Can't load RunLoader"<<endl;
28 AliLoader *pmdloader = fRunLoader->GetLoader("PMDLoader");
29 Int_t nevent = fRunLoader->GetNumberOfEvents();
30 cout << " * *********** nevent = " << nevent << endl;
34 cerr<<" ===> Can not find PMD or PMDLoader <===\n";
39 pmdloader->LoadRecPoints("READ");
40 TClonesArray *fRecpoints;
41 AliPMDUtility *cc = new AliPMDUtility();
42 TH2F *h2 = new TH2F("h2"," ",100,-100.,100.,100,-100.,100.);
44 FILE *fpw = fopen("junk_rec.dat","w");
46 for (Int_t ievt = 0; ievt < nevent; ievt++)
48 fRunLoader->GetEvent(ievt);
49 TTree *treeR = pmdloader->TreeR();
52 cout << " Can not get TreeR" << endl;
56 AliPMDrecpoint1 *pmdrecpoint;
57 TBranch *branch1 = treeR->GetBranch("PMDRecpoint");
58 branch1->SetAddress(&fRecpoints);
59 /**********************************************************************
60 * det : Detector, 0: PRE & 1:CPV *
61 * smn : Serial Module Number from 0 to 23 for both detector *
62 * xpos : x-position of the cluster *
63 * ypos : y-position of the cluster *
64 * THESE xpos & ypos are not the true xpos and ypos *
65 * for some of the unit modules. They are rotated. *
66 * adc : ADC contained in the cluster *
67 * ncell : Number of cells contained in the cluster *
68 * rad : radius of the cluster (1d fit) *
69 * xpad : TRUE x-position of the cluster *
70 * ypad : TRUE y-position of the cluster *
71 **********************************************************************/
74 Float_t xpos,ypos, xpad, ypad;
75 Float_t adc, ncell, sigx, sigy;
77 Int_t nmodules = branch1->GetEntries();
78 cout << " nmodules = " << nmodules << endl;
79 for (Int_t imodule = 0; imodule < nmodules; imodule++)
81 branch1->GetEntry(imodule);
82 Int_t nentries = fRecpoints->GetLast();
83 for(Int_t ient = 0; ient < nentries+1; ient++)
85 pmdrecpoint = (AliPMDrecpoint1*)fRecpoints->UncheckedAt(ient);
86 det = (Int_t) pmdrecpoint->GetDetector();
87 smn = (Int_t) pmdrecpoint->GetSMNumber();
88 xpos = pmdrecpoint->GetClusX();
89 ypos = pmdrecpoint->GetClusY();
90 adc = pmdrecpoint->GetClusADC();
91 ncell = pmdrecpoint->GetClusCells();
92 sigx = pmdrecpoint->GetClusSigmaX();
93 sigy = pmdrecpoint->GetClusSigmaY();
96 // User has to plug in his analysis code here
99 fprintf(fpw,"%d %d %d %d\n",
102 // Plot the cluster centroid to see the PMD geometry
103 // using the PMD Utility class
107 // Draw only for PRE plane
108 //cc->RectGeomCellPos(ism,xpad,ypad,xx,yy);
109 cc->RectGeomCellPos(smn,xpos,ypos,xx,yy);
114 // End of the User code