From: panos Date: Thu, 15 Nov 2007 16:30:36 +0000 (+0000) Subject: Changing the order between the tree and file creation. X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=1f466e02d2c966c1f96f527a7b297f2a8ba0576b;p=u%2Fmrichter%2FAliRoot.git Changing the order between the tree and file creation. --- diff --git a/STEER/AliAODTagCreator.cxx b/STEER/AliAODTagCreator.cxx index 6b3dd8dbf76..5c29711e099 100644 --- a/STEER/AliAODTagCreator.cxx +++ b/STEER/AliAODTagCreator.cxx @@ -193,11 +193,6 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList Int_t nMu1GeV, nMu3GeV, nMu10GeV; Int_t nEl1GeV, nEl3GeV, nEl10GeV; Float_t maxPt = .0, meanPt = .0, totalP = .0; - - 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 TChain *oldTagTree = new TChain("T"); @@ -211,14 +206,6 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList }//directory loop AliInfo(Form("Chained tag files: %d",oldTagTree->GetEntries())); - //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.......")); TFile *file = TFile::Open("AliAOD.root"); @@ -240,12 +227,25 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList char fileName[256]; sprintf(fileName, "Run%d.Event%d_%d.AOD.tag.root", - tag->GetRunId(),fFirstEvent,lastEvent ); + aod->GetRunNumber(),fFirstEvent,lastEvent ); AliInfo(Form("writing tags to file %s", fileName)); AliDebug(1, Form("writing tags to file %s", fileName)); 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(); + // loop over events Int_t nEvents = aodTree->GetEntries(); for (Int_t iEventNumber = 0; iEventNumber < nEvents; iEventNumber++) { diff --git a/STEER/AliESDTagCreator.cxx b/STEER/AliESDTagCreator.cxx index e09db6d3800..363ffca12f7 100644 --- a/STEER/AliESDTagCreator.cxx +++ b/STEER/AliESDTagCreator.cxx @@ -1194,12 +1194,6 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList Int_t fVertexflag; Int_t iRunNumber = 0; TString fVertexName("default"); - - AliRunTag *tag = new AliRunTag(); - AliEventTag *evTag = new AliEventTag(); - TTree ttag("T","A Tree with event tags"); - TBranch * btag = ttag.Branch("AliTAG", &tag); - btag->SetCompressionLevel(9); AliInfo(Form("Creating the ESD tags.......")); @@ -1229,6 +1223,12 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList TFile* ftag = TFile::Open(fileName, "recreate"); + AliRunTag *tag = new AliRunTag(); + AliEventTag *evTag = new AliEventTag(); + TTree ttag("T","A Tree with event tags"); + TBranch * btag = ttag.Branch("AliTAG", &tag); + btag->SetCompressionLevel(9); + if(fLastEvent != -1) iNumberOfEvents = fLastEvent + 1; for (Int_t iEventNumber = fFirstEvent; iEventNumber < iNumberOfEvents; iEventNumber++) { ntrack = 0;