- //Defining tag objects
- AliRunTag *tag = new AliRunTag;
- AliEventTag *evTag = new AliEventTag;
- fChain->SetBranchAddress("AliTAG",&tag);
-
- TTreeFormula *fRunFormula = new TTreeFormula("fRun",fRunCut,fChain);
- TTreeFormula *fLHCFormula = new TTreeFormula("fLHC",fLHCCut,fChain);
- TTreeFormula *fDetectorFormula = new TTreeFormula("fDetector",fDetectorCut,fChain);
- TTreeFormula *fEventFormula = new TTreeFormula("fEvent",fEventCut,fChain);
-
- Int_t current = -1;
- for(Int_t iTagFiles = 0; iTagFiles < fChain->GetEntries(); iTagFiles++) {
- //Event list
- TEntryList *fList = new TEntryList();
- fChain->GetEntry(iTagFiles);
- if (current != fChain->GetTreeNumber()) {
- fRunFormula->UpdateFormulaLeaves();
- fLHCFormula->UpdateFormulaLeaves();
- fDetectorFormula->UpdateFormulaLeaves();
- fEventFormula->UpdateFormulaLeaves();
- current = fChain->GetTreeNumber();
- }
- if(fRunFormula->EvalInstance(iTagFiles) == 1) {
- if(fLHCFormula->EvalInstance(iTagFiles) == 1) {
- if(fDetectorFormula->EvalInstance(iTagFiles) == 1) {
- Int_t iEvents = fEventFormula->GetNdata();
- const TClonesArray *tagList = tag->GetEventTags();
- for(Int_t i = 0; i < iEvents; i++) {
- evTag = (AliEventTag *) tagList->At(i);
- guid = evTag->GetGUID();
- turl = evTag->GetTURL();
- lfn = turl(8,turl.Length());
- if(fEventFormula->EvalInstance(i) == 1) fList->Enter(i);
- }//event loop
- collection->WriteBody(iTagFiles+1,guid,lfn,turl,fList);
- }//detector tag cuts
- }//lhc tag cuts
- }//run tag cuts
- }//tag file loop
- collection->Export();
-
- return kTRUE;
-}
-
-//___________________________________________________________________________
-Bool_t AliTagAnalysis::CreateAsciiCollection(const char* name,
- AliRunTagCuts *runTagCuts,
- AliLHCTagCuts *lhcTagCuts,
- AliDetectorTagCuts *detTagCuts,
- AliEventTagCuts *evTagCuts) {
- //Queries the tag chain using the defined
- //event tag cuts from the AliEventTagCuts object
- //and returns a XML collection
- AliInfo(Form("Creating the collection........"));
-
- ofstream fout;
- fout.open(name);
-
- TString guid = 0x0;
- TString turl = 0x0;
- TString lfn = 0x0;
-
- TString line0 = 0;
-
- //Defining tag objects
- AliRunTag *tag = new AliRunTag;
- AliEventTag *evTag = new AliEventTag;
- fChain->SetBranchAddress("AliTAG",&tag);
-
- for(Int_t iTagFiles = 0; iTagFiles < fChain->GetEntries(); iTagFiles++) {
- //Event list
- TEntryList *fList = new TEntryList();
- fChain->GetEntry(iTagFiles);
- if(runTagCuts->IsAccepted(tag)) {
- if(lhcTagCuts->IsAccepted(tag->GetLHCTag())) {
- if(detTagCuts->IsAccepted(tag->GetDetectorTags())) {
- Int_t iEvents = tag->GetNEvents();
- const TClonesArray *tagList = tag->GetEventTags();
- for(Int_t i = 0; i < iEvents; i++) {
- evTag = (AliEventTag *) tagList->At(i);
- guid = evTag->GetGUID();
- turl = evTag->GetTURL();
- lfn = turl(8,turl.Length());
- if(evTagCuts->IsAccepted(evTag)) fList->Enter(i);
- }//event loop
- line0 = guid; line0 += " "; line0 += turl; line0 += " ";
- for(Int_t i = 0; i < fList->GetN(); i++) {
- line0 += fList->GetEntry(i);
- line0 += " ";
- }
- fout<<line0<<"\n";
- }//detector tag cuts
- }//lhc tag cuts
- }//run tag cuts
- tag->Clear();
- }//tag file loop
-
- fout.close();
-
- return kTRUE;
-}