]>
Commit | Line | Data |
---|---|---|
0709b99f | 1 | // ----------------------------------------------------// |
2 | // // | |
3 | // This is a macro to read PMD.SDigits.root // | |
4 | // // | |
5 | // ----------------------------------------------------// | |
6 | #include <Riostream.h> | |
62248fff | 7 | |
0709b99f | 8 | void AliPMDSDigitsRead(Int_t nevt = 1) |
9 | { | |
10 | TStopwatch timer; | |
11 | timer.Start(); | |
12 | ||
62248fff | 13 | //FILE *fpw = fopen("sdigits.dat","w"); |
0709b99f | 14 | |
15 | TH2F *h2 = new TH2F("h2","Y vs. X",200,-100.,100.,200,-100.,100.); | |
62248fff | 16 | |
0709b99f | 17 | AliRunLoader *fRunLoader = AliRunLoader::Open("galice.root"); |
62248fff | 18 | |
0709b99f | 19 | if (!fRunLoader) |
20 | { | |
21 | Error("Open","Can not open session for file %s.",file); | |
22 | } | |
23 | ||
62248fff | 24 | |
25 | Int_t nEvent = fRunLoader->GetNumberOfEvents(); | |
26 | ||
0709b99f | 27 | fPMDLoader = fRunLoader->GetLoader("PMDLoader"); |
62248fff | 28 | |
0709b99f | 29 | if (fPMDLoader == 0x0) |
30 | { | |
31 | cerr<<"OpengAlice : Can not find PMD or PMDLoader\n"; | |
32 | } | |
33 | ||
34 | fPMDLoader->LoadSDigits("READ"); | |
62248fff | 35 | TClonesArray *fSDigits = 0x0; |
0709b99f | 36 | |
37 | // -------------------------------------------------------------- // | |
38 | ||
39 | Int_t det = 0,smn = 0; | |
40 | Int_t xpos, ypos; | |
41 | Int_t xpad, ypad; | |
42 | Float_t edep; | |
43 | Float_t xx,yy; | |
44 | ||
45 | AliPMDUtility cc; | |
62248fff | 46 | |
47 | ||
48 | AliPMDsdigit *pmdsdigit = 0x0; | |
49 | TBranch *branch; | |
50 | ||
51 | if (nevt > nEvent) | |
52 | { | |
53 | nevt = nEvent; | |
54 | printf("Input number is more than the number of events, set to number of events = %d\n",nevt); | |
55 | } | |
0709b99f | 56 | |
57 | for (Int_t ievt = 0; ievt <nevt; ievt++) | |
58 | { | |
59 | fRunLoader->GetEvent(ievt); | |
60 | fTreeS = fPMDLoader->TreeS(); | |
61 | if (fTreeS == 0x0) | |
62 | { | |
63 | cout << " Can not get TreeD" << endl; | |
64 | } | |
62248fff | 65 | |
66 | branch = fTreeS->GetBranch("PMDSDigit"); | |
0709b99f | 67 | branch->SetAddress(&fSDigits); |
68 | ||
69 | Int_t nmodules = (Int_t) fTreeS->GetEntries(); | |
70 | ||
71 | for (Int_t imodule = 0; imodule < nmodules; imodule++) | |
72 | { | |
73 | fTreeS->GetEntry(imodule); | |
74 | Int_t nentries = fSDigits->GetLast(); | |
75 | for (Int_t ient = 0; ient < nentries+1; ient++) | |
76 | { | |
77 | pmdsdigit = (AliPMDsdigit*)fSDigits->UncheckedAt(ient); | |
78 | ||
79 | det = pmdsdigit->GetDetector(); | |
80 | smn = pmdsdigit->GetSMNumber(); | |
81 | xpos = pmdsdigit->GetRow(); | |
82 | ypos = pmdsdigit->GetColumn(); | |
83 | edep = pmdsdigit->GetCellEdep(); | |
84 | Int_t trno = pmdsdigit->GetTrackNumber(); | |
62248fff | 85 | |
86 | //if (ievt == 0) fprintf(fpw,"Track # = %d\n",trno); | |
0709b99f | 87 | |
88 | if(smn <12) | |
89 | { | |
90 | xpad = ypos; | |
91 | ypad = xpos; | |
92 | } | |
93 | else if(smn >=12 && smn < 24) | |
94 | { | |
95 | xpad = xpos; | |
96 | ypad = ypos; | |
97 | } | |
98 | ||
99 | if(det == 1) | |
100 | { | |
101 | cc.RectGeomCellPos(smn,xpad,ypad,xx,yy); | |
102 | h2->Fill(xx,yy); | |
103 | } | |
104 | } | |
105 | } // modules | |
106 | ||
107 | } | |
108 | h2->Draw(); | |
109 | ||
110 | timer.Stop(); | |
111 | timer.Print(); | |
112 | } | |
113 |