]>
Commit | Line | Data |
---|---|---|
9a065522 | 1 | //_____________________________________________________// |
2 | // // | |
3 | // This macro reads AD DDL Raw Data and // | |
4 | // converts it into Digits // | |
5 | // // | |
6 | //____________________________________________________ // | |
7 | ||
8 | ||
9 | void ADRaw2Digits(Int_t nEvent = 5) | |
10 | { | |
11 | for(int iEvent=0; iEvent<nEvent; iEvent++) { | |
12 | printf("=========== EVENT %d ===========\n",iEvent); | |
13 | TString FileName = "raw.root"; | |
14 | RawStreamEvent(FileName.Data(),iEvent); } | |
15 | } | |
16 | ||
17 | ||
18 | Bool_t RawStreamEvent(TString fileName = "./",Int_t iEvent = 0) | |
19 | { | |
20 | // Reads DDL data from fileName | |
21 | ||
22 | TStopwatch timer; | |
23 | timer.Start(); | |
24 | ||
25 | // Creates a TreeD to dump Digits | |
26 | ||
27 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); | |
28 | ||
29 | AliADLoader* loader = (AliADLoader*) rl->GetLoader("ADLoader"); | |
30 | ||
31 | if(!loader) { | |
32 | AliError("no AD loader found"); | |
33 | return kFALSE; } | |
34 | ||
35 | TTree* treeD = loader->TreeD(); | |
36 | if(!treeD) { | |
37 | loader->MakeTree("D"); | |
38 | treeD = loader->TreeD(); } | |
39 | ||
40 | AliADdigit digit; | |
41 | AliADdigit* pdigit = &digit; | |
42 | const Int_t kBufferSize = 4000; | |
43 | ||
44 | treeD->Branch("AD", "AliADdigit", &pdigit, kBufferSize); | |
45 | ||
46 | AliRawReader* rawReader = 0x0; | |
47 | rawReader = new AliRawReaderRoot(fileName); // DDL files | |
48 | ||
49 | AliADRawStream* rawStream = new AliADRawStream(rawReader); | |
50 | ||
51 | rawReader->GotoEvent(iEvent); | |
52 | ||
53 | rawStream->Next(); | |
54 | ||
55 | printf("Data size is %d\n",rawReader->GetDataSize()); | |
56 | ||
57 | for(Int_t i=0; i<16; i++) { | |
58 | ||
59 | Short_t chargeADC[21]; | |
60 | for(Int_t iClock=0; iClock < 21; ++iClock) { | |
61 | chargeADC[iClock] = rawStream->GetPedestal(i,iClock); | |
62 | } | |
63 | ||
64 | new(pdigit) AliADdigit(i, (Int_t)rawStream->GetTime(i), (Int_t)rawStream->GetWidth(i), rawStream->GetIntegratorFlag(i, 10),chargeADC); | |
65 | treeD->Fill(); | |
66 | } | |
67 | ||
68 | // Checks if everything is OK by printing results | |
69 | ||
70 | for(int i=0;i<16;i++) { | |
71 | printf("Channel %d : %d %d \n",i,rawStream->GetADC(i),rawStream->GetTime(i)); } | |
72 | //treeD->Print(); printf(" \n"); | |
73 | ||
74 | loader->WriteDigits("OVERWRITE"); | |
75 | loader->UnloadDigits(); | |
76 | ||
77 | ||
78 | ||
79 | delete rawReader; | |
80 | delete rawStream; | |
81 | ||
82 | timer.Stop(); | |
83 | timer.Print(); | |
84 | } | |
85 | ||
86 |