AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Raw2ESD.C
Go to the documentation of this file.
1 
14 const char* df = "/data/alice/data/pp/LHC10c/raw/118561/physics_118561.root";
15 
27 void
28 Raw2ESD(const char* file=df, Int_t nEv=10, Int_t skip=300, Int_t debug=0)
29 {
30  // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
31  AliCDBManager::Instance()->SetRun(118561);
32  AliCDBManager::Instance()->SetDefaultStorageFromRun(118561);
33  AliGeomManager::LoadGeometry("geometry.root");
34 
35  AliRawReader* reader = AliRawReader::Create(file);
37  reco->SetDiagnose(debug > 5);
38  reco->Init();
39 
40  AliLog::SetModuleDebugLevel("FMD", debug);
41 
42  Int_t event = 0;
43  TFile* digitFile = TFile::Open("reco_digits.rot", "RECREATE");
44 
45  TFile* clusterFile = TFile::Open("FMD.RecPoints.root", "RECREATE");
46  TTree* clusterTree = new TTree("cluster", "FMD digits");
47 
48  TFile* esdFile = TFile::Open("AliESDs.root", "RECREATE");
49  TTree* esdTree = new TTree("esdTree", "ESD Treee");
50  AliESDEvent* esd = new AliESDEvent();
51 
52  esd->CreateStdContent();
53  esd->WriteToTree(esdTree);
54  while ((reader && reader->NextEvent())) {
55  event++;
56  // Check for skip events
57  if (skip > 0 && (event - skip) < 0) continue;
58  // Check if we got enough events
59  if (nEv > 0 && (event-skip) > nEv) continue;
60 
61  digitFile->cd();
62  TTree* digitTree = new TTree("digit", "FMD digits");
63 
64  // Convert to digits first
65  reco->ConvertDigits(reader, digitTree);
66 
67  // Reconstruct to RecPoints
68  reco->Reconstruct(digitTree, clusterTree);
69 
70  // Set stuff on the ESD
71  esd->SetRunNumber(AliCDBManager::Instance()->GetRun());
72  esd->SetEventNumberInFile(event-1);
73 
74  // Fill the ESD objet and write to file
75  reco->FillESD((TTree*)0, (TTree*)0, esd);
76  esdTree->Fill();
77  esd->Reset();
78 
79  digitFile->Write();
80  delete digitTree;
81  }
82  esdFile->Write();
83 }
84 
85 
TFile * Open(const char *filename, Long64_t &nevents)
virtual void Reconstruct(TTree *digitsTree, TTree *clusterTree) const
const char * df
Definition: Raw2ESD.C:14
void SetDiagnose(Bool_t use=kTRUE)
virtual void FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const
virtual void ConvertDigits(AliRawReader *reader, TTree *digitsTree) const
This is a class that reconstructs AliFMDRecPoint objects from of Digits.
void Raw2ESD(const char *file=df, Int_t nEv=10, Int_t skip=300, Int_t debug=0)
Definition: Raw2ESD.C:28
Int_t debug