]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/Raw2ESD.C
Added possibility to reconstruct directly from raw data (rather than
[u/mrichter/AliRoot.git] / FMD / scripts / Raw2ESD.C
CommitLineData
e0afd551 1void
2Raw2ESD(const char* file="")
3{
4 AliCDBManager::Instance()->SetRun(0);
5 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
6 AliGeomManager::LoadGeometry("geometry.root");
7
8 AliRawReader* reader = 0;
9 TString rawFile(file);
10 if (rawFile.IsNull() && rawFile.EndsWith(".root"))
11 reader = new AliRawReaderRoot(rawFile.Data());
12 else if (!rawFile.IsNull() && rawFile.EndsWith(".raw"))
13 reader = new AliRawReaderDate(rawFile.Data());
14 else
15 reader = new AliRawReaderFile(-1);
16
17 AliFMDReconstructor* reco = new AliFMDReconstructor();
18 reco->Init();
19
20 Int_t event = 0;
21 TFile* digitFile = TFile::Open("reco_digits.rot", "RECREATE");
22 TTree* digitTree = new TTree("digit", "FMD digits");
23
24 TFile* clusterFile = TFile::Open("FMD.RecPoints.root", "RECREATE");
25 TTree* clusterTree = new TTree("cluster", "FMD digits");
26
27 TFile* esdFile = TFile::Open("AliESDs.root", "RECREATE");
28 TTree* esdTree = new TTree("esdTree", "ESD Treee");
29 AliESDEvent* esd = new AliESDEvent();
30 esd->CreateStdContent();
31 esd->WriteToTree(esdTree);
32 while ((reader && reader->NextEvent())) {
33 reco->ConvertDigits(reader, digitTree);
34 reco->Reconstruct(digitTree, clusterTree);
35
36 esd->SetRunNumber(0);
37 esd->SetEventNumberInFile(event);
38 reco->FillESD((TTree*)0, (TTree*)0, esd);
39 esdTree->Fill();
40 esd->Reset();
41
42 event++;
43 }
44 esdFile->Write();
45}
46
47