PMD DDL raw data
[u/mrichter/AliRoot.git] / PMD / AliPMDDigits2RawData.C
CommitLineData
28328eeb 1// ----------------------------------------------------//
2// //
3// This macro does digits to Raw Data //
4// //
5// ----------------------------------------------------//
6
7#include <Riostream.h>
8#include "TBranch.h"
9#include "TStopwatch.h"
10
11extern AliRun *gAlice;
12
13Int_t AliPMDDigits2RawData(Int_t nevent = 1)
14{
15 if (gAlice)
16 {
17 delete gAlice->GetRunLoader();
18 delete gAlice;//if everything was OK here it is already NULL
19 gAlice = 0x0;
20 }
21
22 AliRunLoader *fRunLoader = AliRunLoader::Open("galice.root");
23 if (!fRunLoader)
24 {
25 cerr<<"Can't load RunLoader"<<endl;
26 return 1;
27 }
28 fRunLoader->LoadgAlice();
29 gAlice = fRunLoader->GetAliRun();
30
31 AliLoader *pmdloader = fRunLoader->GetLoader("PMDLoader");
32 // Int_t nevent = fRunLoader->GetNumberOfEvents();
33 cout << " ************ nevent = " << nevent << endl;
34
35 if (pmdloader == 0x0)
36 {
37 cerr<<" ===> Can not find PMD or PMDLoader <===\n";
38 delete fRunLoader;
39 return 2;
40 }
41 pmdloader->LoadDigits("READ");
42
43
44 for (Int_t ievt = 0; ievt < nevent; ievt++)
45 {
46
47 fRunLoader->GetEvent(ievt);
48 TTree *treeD = pmdloader->TreeD();
49 if (treeD == 0x0)
50 {
51 cout << " Can not get TreeD" << endl;
52 return 3;
53 }
54
55 AliPMDDDLRawData rawdata;
56 rawdata.WritePMDRawData(treeD, ievt);
57
58
59 }
60
61 return 0;
62}
63