fMergeExcludes(),
fIncludePath(),
fCloseSE(),
+ fFriendChainName(),
fInputFiles(0),
fPackages(0)
{
fMergeExcludes(),
fIncludePath(),
fCloseSE(),
+ fFriendChainName(),
fInputFiles(0),
fPackages(0)
{
fMergeExcludes(other.fMergeExcludes),
fIncludePath(other.fIncludePath),
fCloseSE(other.fCloseSE),
+ fFriendChainName(other.fFriendChainName),
fInputFiles(0),
fPackages(0)
{
fMergeExcludes = other.fMergeExcludes;
fIncludePath = other.fIncludePath;
fCloseSE = other.fCloseSE;
+ fFriendChainName = other.fFriendChainName;
if (other.fInputFiles) {
fInputFiles = new TObjArray();
TIter next(other.fInputFiles);
fGridWorkingDir = "";
fGridDataDir = ""; // Can be like: /alice/sim/PDC_08a/LHC08c9/
fDataPattern = "*AliESDs.root"; // Can be like: *AliESDs.root, */pass1/*AliESDs.root, ...
+ fFriendChainName = "";
fGridOutputDir = "output";
fOutputArchive = "log_archive.zip:stdout,stderr root_archive.zip:*.root";
fOutputFiles = ""; // Like "AliAODs.root histos.root"
// Submit AliEn job
CdWork();
TGridResult *res = gGrid->Command(Form("submit %s", fJDLName.Data()));
+ printf("*************************** %s\n",Form("submit %s", fJDLName.Data()));
TString jobID = "";
if (res) {
const char *cjobId = res->GetKey(0,"jobId");
type = "AOD";
comment += "AOD";
}
+ if (type!="AOD" && fFriendChainName!="") {
+ Error("WriteAnalysisMacro", "Friend chain can be attached only to AOD");
+ return;
+ }
if (TObject::TestBit(AliAnalysisGrid::kUseMC)) comment += "/MC";
else comment += " data";
out << "const char *anatype = \"" << type.Data() << "\";" << endl << endl;
out << " gROOT->LoadMacro(\"ConfigureCuts.C\");" << endl;
out << " ConfigureCuts(runCuts, lhcCuts, detCuts, evCuts);" << endl;
out << " }" << endl;
- out << " TChain *chain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evCuts);" << endl;
+ if (fFriendChainName=="") {
+ out << " TChain *chain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evCuts);" << endl;
+ } else {
+ out << " TString tmpColl=\"tmpCollection.xml\";" << endl;
+ out << " tagAna->CreateXMLCollection(tmpColl.Data(),runCuts, lhcCuts, detCuts, evCuts);" << endl;
+ out << " TChain *chain = CreateChain(tmpColl.Data(),type);" << endl;
+ }
out << " if (!chain || !chain->GetNtrees()) return NULL;" << endl;
out << " chain->ls();" << endl;
out << " return chain;" << endl;
msg += " AliEventTagCuts *evCuts)";
Info("WriteAnalysisMacro", msg.Data());
}
- } else {
+ }
+ if (!IsUsingTags() || fFriendChainName!="") {
out <<"//________________________________________________________________________________" << endl;
out << "TChain* CreateChain(const char *xmlfile, const char *type=\"ESD\")" << endl;
out << "{" << endl;
out << " return NULL;" << endl;
out << " }" << endl;
out << " TChain *chain = new TChain(treename);" << endl;
+ if(fFriendChainName!="") {
+ out << " TChain *chainFriend = new TChain(treename);" << endl;
+ }
out << " coll->Reset();" << endl;
- out << " while (coll->Next()) chain->Add(coll->GetTURL(\"\"));" << endl;
+ out << " while (coll->Next()) {" << endl;
+ out << " chain->Add(coll->GetTURL(\"\"));" << endl;
+ if(fFriendChainName!="") {
+ out << " TString fileFriend=coll->GetTURL(\"\");" << endl;
+ out << " fileFriend.ReplaceAll(\"AliAOD.root\",\""<<fFriendChainName.Data()<<"\");" << endl;
+ out << " fileFriend.ReplaceAll(\"AliAODs.root\",\""<<fFriendChainName.Data()<<"\");" << endl;
+ out << " chainFriend->Add(fileFriend.Data());" << endl;
+ }
+ out << " }" << endl;
out << " if (!chain->GetNtrees()) {" << endl;
out << " ::Error(\"CreateChain\", \"No tree found from collection %s\", xmlfile);" << endl;
out << " return NULL;" << endl;
out << " }" << endl;
+ if(fFriendChainName!="") {
+ out << " chain->AddFriend(chainFriend);" << endl;
+ }
out << " return chain;" << endl;
out << "}" << endl << endl;
}
virtual void SetGridWorkingDir(const char *name="workdir") {fGridWorkingDir = name;}
virtual void SetGridDataDir(const char *name) {fGridDataDir = name;}
virtual void SetDataPattern(const char *pattern="*AliESDs.root") {fDataPattern = pattern;}
+ virtual void SetFriendChainName(const char *name="") {fFriendChainName = name;}
virtual void SetDefaultOutputs(Bool_t flag);
virtual void SetGridOutputDir(const char *name="output") {fGridOutputDir = name;}
virtual void SetOutputArchive(const char *list="log_archive.zip:stdout,stderr root_archive.zip:*.root") {fOutputArchive = list;}
TString fMergeExcludes; // List of output files excluded from merging
TString fIncludePath; // Include path
TString fCloseSE; // Preffered storage element. Taken from alien_CLOSE_SE environment.
+ TString fFriendChainName; // File name to construct friend chain (for AOD)
TObjArray *fInputFiles; // List of input files to be processed by the job
TObjArray *fPackages; // List of packages to be used
- ClassDef(AliAnalysisAlien, 2) // Class providing some AliEn utilities
+ ClassDef(AliAnalysisAlien, 3) // Class providing some AliEn utilities
};
#endif