+++ /dev/null
-void tag() {\r
- const char* turl = gSystem->Getenv("ALIEN_JDL_OUTPUTDIR");\r
- TString fESDFileName = "alien://";\r
- fESDFileName += turl;\r
- fESDFileName += "/AliESDs.root"; \r
-\r
- TString fGUID = 0;\r
- GetGUID(fGUID);\r
-\r
- TString fAliroot, fRoot, fGeant;\r
- GetVersions(fAliroot,fRoot,fGeant);\r
-\r
- UpdateTag(fAliroot,fRoot,fGeant,fESDFileName,fGUID);\r
-}\r
- \r
-//_____________________________________//\r
-GetVersions(TString &fAliroot, TString &froot, TString &fgeant) {\r
- const char* fver = gSystem->Getenv("ALIEN_JDL_PACKAGES");\r
- TString fS = fver;\r
- Int_t fFirst = fS.First("#");\r
-\r
- while(fFirst != -1) {\r
- Int_t fTotalLength = fS.Length();\r
- TString tmp = fS;\r
- TString fS1 = fS(0,fFirst);\r
- tmp = fS(fFirst+2,fTotalLength);\r
- fS = tmp;\r
-\r
- if(fS1.Contains("Root")) fAliroot = fS1;\r
- if(fS1.Contains("ROOT")) froot = fS1;\r
- if(fS1.Contains("GEANT")) fgeant = fS1;\r
-\r
- if(tmp.Contains("Root")) fAliroot = tmp;\r
- if(tmp.Contains("ROOT")) froot = tmp;\r
- if(tmp.Contains("GEANT")) fgeant = tmp;\r
- \r
- fFirst = tmp.First("#");\r
- }\r
-}\r
-\r
-//_____________________________________//\r
-GetGUID(TString &guid) {\r
- ofstream myfile ("guid.txt");\r
- if (myfile.is_open()) {\r
- TFile *f = TFile::Open("AliESDs.root","read");\r
- if(f->IsOpen()) {\r
- guid = f->GetUUID().AsString();\r
- myfile << "AliESDs.root \t"<<f->GetUUID().AsString();\r
- cout<<guid.Data()<<endl;\r
- myfile.close();\r
- }\r
- else cout<<"Input file not found"<<endl;\r
- }\r
- else cout<<"Output file can't be created..."<<endl;\r
-}\r
-\r
-\r
-//_____________________________________//\r
-Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant, TString turl, TString guid) {\r
- cout<<"Updating tags....."<<endl;\r
-\r
- const char * tagPattern = "tag.root";\r
- // Open the working directory\r
- void * dirp = gSystem->OpenDirectory(gSystem->pwd());\r
- const char * name = 0x0;\r
- // Add all files matching *pattern* to the chain\r
- while((name = gSystem->GetDirEntry(dirp))) {\r
- if (strstr(name,tagPattern)) {\r
- TFile *f = TFile::Open(name,"read") ;\r
- \r
- AliRunTag *tag = new AliRunTag;\r
- AliEventTag *evTag = new AliEventTag;\r
- TTree *fTree = (TTree *)f->Get("T");\r
- fTree->SetBranchAddress("AliTAG",&tag);\r
- \r
- //Defining new tag objects\r
- AliRunTag *newTag = new AliRunTag();\r
- TTree ttag("T","A Tree with event tags");\r
- TBranch * btag = ttag.Branch("AliTAG", &newTag);\r
- btag->SetCompressionLevel(9);\r
- for(Int_t iTagFiles = 0; iTagFiles < fTree->GetEntries(); iTagFiles++) {\r
- fTree->GetEntry(iTagFiles);\r
- newTag->SetRunId(tag->GetRunId());\r
- newTag->SetAlirootVersion(faliroot);\r
- newTag->SetRootVersion(froot);\r
- newTag->SetGeant3Version(fgeant);\r
- const TClonesArray *tagList = tag->GetEventTags();\r
- for(Int_t j = 0; j < tagList->GetEntries(); j++) {\r
- evTag = (AliEventTag *) tagList->At(j);\r
- evTag->SetTURL(turl);\r
- evTag->SetGUID(guid);\r
- newTag->AddEventTag(*evTag);\r
- }\r
- ttag.Fill();\r
- newTag->Clear();\r
- }//tag file loop \r
- \r
- TFile* ftag = TFile::Open(name, "recreate");\r
- ftag->cd();\r
- ttag.Write();\r
- ftag->Close();\r
- \r
- delete tag;\r
- delete newTag;\r
- }//pattern check\r
- }//directory loop\r
- return kTRUE;\r
-}\r
-\r