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():
45 // Default constructor
48 AliAnalysisTaskTagCreator::AliAnalysisTaskTagCreator(const char* name):
49 AliAnalysisTaskSE(name),
56 DefineOutput(1, TTree::Class());
59 void AliAnalysisTaskTagCreator::UserCreateOutputObjects()
61 // Create the output container
63 fTreeT = new TTree("T", "AOD Tags");
64 fRunTag = new AliRunTag();
65 TBranch * btag = fTreeT->Branch("AliTAG", "AliRunTag", &fRunTag);
66 btag->SetCompressionLevel(9);
67 fTagCreator = new AliAODTagCreator();
70 void AliAnalysisTaskTagCreator::Init()
73 if (fDebug > 1) AliInfo("Init() \n");
74 // Call configuration file
78 void AliAnalysisTaskTagCreator::UserExec(Option_t */*option*/)
80 // Create Tags for the current event
81 AliEventTag* evtTag = new AliEventTag();
82 fTagCreator->FillEventTag(AODEvent(), evtTag);
83 // Reference to the input file
84 TString fturl, fturltemp, fguid;
86 TString opt(fInputHandler->GetAnalysisType());
89 TFile *file = OutputTree()->GetCurrentFile();
90 const TUrl *url = file->GetEndpointUrl();
91 fguid = file->GetUUID().AsString();
92 if (opt.Contains("grid")) {
93 fturltemp = "alien://"; fturltemp += url->GetFile();
94 fturl = fturltemp(0,fturltemp.Index(".root",5,0,TString::kExact)+5);
96 fturl = url->GetFile();
98 evtTag->SetEventId(fInputHandler->GetReadEntry() + 1);
99 evtTag->SetGUID(fguid);
100 if(opt.Contains("grid")) {
102 evtTag->SetTURL(fturl);
105 else evtTag->SetPath(fturl);
108 fRunTag->AddEventTag(*evtTag);
113 void AliAnalysisTaskTagCreator::FinishTaskOutput()
115 // Terminate analysis
117 if (fInputHandler->GetRunTag()) fRunTag->CopyStandardContent(fInputHandler->GetRunTag());
121 Bool_t AliAnalysisTaskTagCreator::Notify()
123 // Notify file change
125 if (fInputHandler->GetRunTag()) fRunTag->CopyStandardContent(fInputHandler->GetRunTag());
134 void AliAnalysisTaskTagCreator::Terminate(Option_t */*option*/)
136 // Terminate analysis
138 if (fDebug > 1) printf("AnalysisTagCreator: Terminate() \n");