1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
23 #include "AliAnalysisTaskTagCreator.h"
24 #include "AliAnalysisManager.h"
25 #include "AliESDEvent.h"
26 #include "AliAODEvent.h"
27 #include "AliESDInputHandler.h"
28 #include "AliAODHandler.h"
29 #include "AliRunTag.h"
30 #include "AliEventTag.h"
31 #include "AliAODTagCreator.h"
34 ClassImp(AliAnalysisTaskTagCreator)
36 ////////////////////////////////////////////////////////////////////////
38 AliAnalysisTaskTagCreator::AliAnalysisTaskTagCreator():
46 // Default constructor
49 AliAnalysisTaskTagCreator::AliAnalysisTaskTagCreator(const char* name):
50 AliAnalysisTaskSE(name),
58 DefineOutput(1, TTree::Class());
61 void AliAnalysisTaskTagCreator::UserCreateOutputObjects()
63 // Create the output container
65 fTreeT = new TTree("T", "AOD Tags");
66 fRunTag = new AliRunTag();
67 TBranch * btag = fTreeT->Branch("AliTAG", "AliRunTag", &fRunTag);
68 btag->SetCompressionLevel(9);
69 fTagCreator = new AliAODTagCreator();
72 void AliAnalysisTaskTagCreator::Init()
75 if (fDebug > 1) AliInfo("Init() \n");
76 // Call configuration file
80 void AliAnalysisTaskTagCreator::UserExec(Option_t */*option*/)
82 // Create Tags for the current event
83 AliEventTag* evtTag = new AliEventTag();
84 fTagCreator->FillEventTag(AODEvent(), evtTag);
85 // Reference to the input file
86 TString fturl, fturltemp, fguid;
88 TString opt(fInputHandler->GetAnalysisType());
91 TFile *file = OutputTree()->GetCurrentFile();
92 const TUrl *url = file->GetEndpointUrl();
93 fguid = file->GetUUID().AsString();
94 if (opt.Contains("grid")) {
95 fturltemp = "alien://"; fturltemp += url->GetFile();
96 fturl = fturltemp(0,fturltemp.Index(".root",5,0,TString::kExact)+5);
98 fturl = url->GetFile();
100 evtTag->SetEventId(fInputHandler->GetReadEntry() + 1);
101 evtTag->SetGUID(fguid);
102 if(opt.Contains("grid")) {
104 evtTag->SetTURL(fturl);
107 else evtTag->SetPath(fturl);
110 fRunTag->AddEventTag(*evtTag);
115 void AliAnalysisTaskTagCreator::FinishTaskOutput()
117 // Terminate analysis
119 if (fInputHandler->GetRunTag()) fRunTag->CopyStandardContent(fInputHandler->GetRunTag());
123 Bool_t AliAnalysisTaskTagCreator::Notify()
125 // Notify file change
127 if (fInputHandler->GetRunTag()) fRunTag->CopyStandardContent(fInputHandler->GetRunTag());
137 void AliAnalysisTaskTagCreator::Terminate(Option_t */*option*/)
139 // Terminate analysis
141 if (fDebug > 1) printf("AnalysisTagCreator: Terminate() \n");