]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muondep/AccEffTemplates/CheckAOD.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / muondep / AccEffTemplates / CheckAOD.C
1 Bool_t CheckAOD(const char* aodFileName = "AliAOD.Muons.root")
2 {
3   //nb (commented)
4   //AliCDBManager *cdb = AliCDBManager::Instance();
5   //cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
6   
7   // open the ESD file
8   TFile* aodFile = TFile::Open(aodFileName);
9   if (!aodFile || !aodFile->IsOpen()) {
10     Error("CheckAOD", "opening AOD file %s failed", aodFileName);
11     return kFALSE;
12   }
13   AliAODEvent *aod = new AliAODEvent();
14   TTree* tree = (TTree*) aodFile->Get("aodTree");
15   if (!tree) {
16     Error("CheckAOD", "no AOD tree found");
17     return kFALSE;
18   }
19   aod->ReadFromTree(tree);
20   
21   // loop over events
22   for (Int_t iEvent = 0; iEvent < tree->GetEntries(); iEvent++) {
23     
24     // get the event data
25     if (tree->GetEvent(iEvent) <= 0) {
26       Error("CheckAOD", "no AOD object found for event %d", iEvent);
27       return kFALSE;
28     }
29     
30   }
31   
32   delete aod;
33   aodFile->Close();
34   delete aodFile;
35   
36   // result of check
37   Info("CheckAOD", "check of AOD was successfull");
38   return kTRUE;
39   
40 }
41