1 // ----------------------------------------------------//
3 // This is a macro to read PMD.Digits.root //
5 // ----------------------------------------------------//
14 #include "TClonesArray.h"
15 #include "TStopwatch.h"
18 void AliPMDDigitsRead(Int_t nevt = 1)
23 // FILE *fp = fopen("junk.dat","w");
25 AliRunLoader *fRunLoader = AliRunLoader::Open("galice.root");
29 Error("Open","Can not open session for file %s.",file);
32 fRunLoader->LoadgAlice();
33 fRunLoader->LoadHeader();
34 gAlice = fRunLoader->GetAliRun();
38 printf("AliRun object found on file.\n");
42 printf("Could not find AliRun object.\n");
44 fPMD = (AliPMD*)gAlice->GetDetector("PMD");
45 fPMDLoader = fRunLoader->GetLoader("PMDLoader");
46 if (fPMDLoader == 0x0)
48 cerr<<"OpengAlice : Can not find PMD or PMDLoader\n";
51 fPMDLoader->LoadDigits("READ");
52 TClonesArray *fDigits;
54 // -------------------------------------------------------------- //
56 Int_t det = 0,smn = 0;
63 for (Int_t ievt = 2; ievt <nevt; ievt++)
65 fRunLoader->GetEvent(ievt);
67 fTreeD = fPMDLoader->TreeD();
70 cout << " Can not get TreeD" << endl;
72 AliPMDdigit *pmddigit;
73 TBranch *branch = fTreeD->GetBranch("PMDDigit");
74 branch->SetAddress(&fDigits);
76 Int_t nmodules = (Int_t) fTreeD->GetEntries();
78 cout << " Total number of modules in an event = " << nmodules << endl;
80 for (Int_t imodule = 0; imodule < nmodules; imodule++)
82 fTreeD->GetEntry(imodule);
83 Int_t nentries = fDigits->GetLast();
84 cout << "nentries = " << nentries << endl;
85 for (Int_t ient = 0; ient < nentries+1; ient++)
87 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
89 det = pmddigit->GetDetector();
90 smn = pmddigit->GetSMNumber();
91 xpos = pmddigit->GetRow();
92 ypos = pmddigit->GetColumn();
93 adc = pmddigit->GetADC();
94 Int_t trno = pmddigit->GetTrackNumber();
96 //fprintf(fp,"%d %d %d %d %f \n ",ievt,smn,xpos,ypos,adc);