+ TString localFileName = "Run"; localFileName += aod->GetRunNumber();
+ localFileName += ".Event"; localFileName += firstEvent; localFileName += "_"; localFileName += fChain->GetEntries(); //localFileName += "."; localFileName += Counter;
+ localFileName += ".AOD.tag.root";
+
+ TString fileName;
+
+ if(fStorage == 0) {
+ fileName = localFileName.Data();
+ AliInfo(Form("Writing tags to local file: %s",fileName.Data()));
+ }
+ else if(fStorage == 1) {
+ TString alienLocation = "/alien";
+ alienLocation += gGrid->Pwd();
+ alienLocation += fgridpath.Data();
+ alienLocation += "/";
+ alienLocation += localFileName;
+ alienLocation += "?se=";
+ alienLocation += fSE.Data();
+ fileName = alienLocation.Data();
+ AliInfo(Form("Writing tags to grid file: %s",fileName.Data()));
+ }
+
+ TFile* ftag = TFile::Open(fileName, "recreate");
+
+ AliRunTag *tag = new AliRunTag();
+ TTree ttag("T","A Tree with event tags");
+ TBranch * btag = ttag.Branch("AliTAG", &tag);
+ btag->SetCompressionLevel(9);
+
+ //reading the esd tag file
+ AliRunTag *oldtag = new AliRunTag();
+ TString tagFilename;
+ oldTagTree->SetBranchAddress("AliTAG",&oldtag);
+ oldTagTree->GetEntry(0);
+ tag->CopyStandardContent(oldtag);
+ const TClonesArray *evTagList = oldtag->GetEventTags();
+
+ AliInfo(Form("Creating the AOD tags......."));
+