2 const char* collectionfileAODfriend,
Int_t nfiles=-1,
3 Bool_t stdoutCheck=kFALSE) {
10 TAlienCollection *collectionAOD = TAlienCollection::Open(collectionfileAOD);
11 TGridResult *tagResultAOD = collectionAOD->GetGridResult(
"",0,0);
15 if(collectionfileAODfriend!=
"none"){
16 TAlienCollection *collectionAODfriend = TAlienCollection::Open(collectionfileAODfriend);
17 TGridResult *tagResultAODFriend = collectionAODfriend->GetGridResult(
"",0,0);
23 Int_t lastAOD[1000],lastAODFriend[1000];
27 for(
Int_t j=0;j<1000;j++) {
30 arrAOD[j][0]->Reset(0);
32 arrAOD[j][1]->Reset(-1);
34 arrAODFriend[j]=
new TArrayI*[2];
35 arrAODFriend[j][0]=
new TArrayI(100);
36 arrAODFriend[j][0]->Reset(0);
37 arrAODFriend[j][1]=
new TArrayI(100);
38 arrAODFriend[j][1]->Reset(-1);
44 nmaxentr=tagResultAOD->GetEntries();
45 if(nfiles>0&&nmaxentr>nfiles)nmaxentr=nfiles;
47 for(
Int_t j=0;j<tagResultAOD->GetEntries();j++) {
48 mappa=(TMap*)tagResultAOD->At(j);
49 filename=(TObjString*)mappa->GetValue(
"turl");
50 str=filename->GetString();
51 pos=str.find_last_of(
"/");
52 str.string::replace(pos,50,
"");
53 pos=str.find_last_of(
"/");
54 str.string::replace(pos,1,
" ");
55 sscanf(str.data(),
"%*s %d",&event);
56 pos=str.find_last_of(
"/");
57 str.string::replace(pos,1,
" ");
58 sscanf(str.data(),
"%*s %d",&dir);
59 arrAOD[event][0]->AddAt(dir,lastAOD[event]);
60 arrAOD[event][1]->AddAt(j,lastAOD[event]);
65 for(
Int_t j=0;j<tagResultAODFriend->GetEntries();j++) {
66 mappa=(TMap*)tagResultAODFriend->At(j);
67 filename=(TObjString*)mappa->GetValue(
"turl");
68 str=filename->GetString();
69 pos=str.find_last_of(
"/");
70 str.string::replace(pos,50,
"");
71 pos=str.find_last_of(
"/");
72 str.string::replace(pos,1,
" ");
73 sscanf(str.data(),
"%*s %d",&event);
74 pos=str.find_last_of(
"/");
75 str.string::replace(pos,1,
" ");
76 sscanf(str.data(),
"%*s %d",&dir);
77 arrAODFriend[event][0]->AddAt(dir,lastAODFriend[event]);
78 arrAODFriend[event][1]->AddAt(j,lastAODFriend[event]);
80 lastAODFriend[event]++;
84 for(
Int_t ev=0;ev<1000;ev++) {
85 for(
Int_t j=0;j<lastAOD[ev];j++) {
86 dir= arrAOD[ev][0]->At(j);
87 for(
Int_t k=0;k<lastAODFriend[ev];k++) {
88 if(arrAODFriend[ev][0]->At(k)==dir){
89 chainAOD->Add((((TObjString*)((TMap*)tagResultAOD->At(arrAOD[ev][1]->At(j)))->GetValue(
"turl"))->GetString()).
Data());
90 chainAODfriend->Add((((TObjString*)((TMap*)tagResultAODFriend->At(arrAODFriend[ev][1]->At(k)))->GetValue(
"turl"))->GetString()).
Data());
91 printf(
"Events: %d, adding AOD at position %d,dir:%d posarray:%d \n and Friend at %d, dir:%d , posarray: %d \n \n",ev,arrAOD[ev][1]->At(j),arrAOD[ev][0]->At(j),j,arrAODFriend[ev][1]->At(k),arrAODFriend[ev][0]->At(k),k);
98 nmaxentr=tagResultAOD->GetEntries();
99 if(nfiles>0&&nmaxentr>nfiles)nmaxentr=nfiles;
101 for(
Int_t ifile=0; ifile<nmaxentr; ifile++) {
102 aodlfn=tagResultAOD->GetKey(ifile,
"lfn");
104 vertexlfn.ReplaceAll(
"AliAOD.root",
"");
105 TGridResult *r=gGrid->Query(vertexlfn.Data(),
"AliAOD.VertexingHF.root");
106 if(r->GetEntries()!=1)
continue;
111 printf(
"Adding file : %s \n",tagResultAOD->GetKey(ifile,
"turl"));
112 chainAOD->Add(tagResultAOD->GetKey(ifile,
"turl"));
113 printf(
"Adding friend file : %s \n \n",r->GetKey(0,
"turl"));
114 chainAODfriend->Add(r->GetKey(0,
"turl"));
118 chainAOD->AddFriend(chainAODfriend);
138 TGridResult* resultAOD=gGrid->Query(pathname,
"AliAOD.root",
"",
"");
139 Int_t nfiles=resultAOD->GetEntries();
141 if(lastdir>nfiles)lastdir=nfiles;
142 for(
Int_t ifile=0; ifile<nfiles; ifile++) {
143 aodlfn=resultAOD->GetKey(ifile,
"lfn");
145 vertexlfn.ReplaceAll(
"AliAOD.root",
"");
146 TGridResult *r=gGrid->Query(vertexlfn.Data(),
"AliAOD.VertexingHF.root");
147 if(r->GetEntries()!=1)
continue;
148 chainAOD->Add(resultAOD->GetKey(ifile,
"turl"));
149 chainAODfriend->Add(r->GetKey(0,
"turl"));
154 chainAOD->Add(
"AliAOD.root");
155 chainAODfriend->Add(
"AliAOD.VertexingHF.root");
159 for(
Int_t idir=firstdir; idir<=lastdir; idir++) {
164 aodname.Append(
"/AliAOD.root");
165 aodHFname.Append(
"/AliAOD.VertexingHF.root");
166 chainAOD->Add(aodname.Data());
167 chainAODfriend->Add(aodHFname.Data());
172 chainAOD->AddFriend(chainAODfriend);
179 Bool_t stdoutCheck=kFALSE) {
188 TAlienCollection *collectionAOD = TAlienCollection::Open(collectionfileAOD);
189 TGridResult *tagResultAOD = collectionAOD->GetGridResult(
"",0,0);
192 TFileCollection *proofColl=
new TFileCollection(
"proofColl",
"proofColl");
194 nmaxentr=tagResultAOD->GetEntries();
195 printf(
"Number of files %d\n",nmaxentr);
196 if(nfiles>0&&nmaxentr>nfiles)nmaxentr=nfiles;
198 for(
Int_t ifile=0; ifile<nmaxentr; ifile++) {
199 printf(
"file %d\n",ifile);
200 aodlfn=tagResultAOD->GetKey(ifile,
"lfn");
202 aodlfn.ReplaceAll(
"AliAOD.root",
"");
203 aodlfn.ReplaceAll(
"AliAODs.root",
"");
204 TGridResult *r=gGrid->Query(aodlfn.Data(),
"AliAOD.VertexingHF.root");
205 if(r->GetEntries()!=1)
continue;
206 r=gGrid->Query(aodlfn.Data(),
"aod_archive.zip");
207 if(r->GetEntries()!=1)
continue;
211 FILE *fout=fopen(
"errors.txt",
"a");
212 aodlfncopy.ReplaceAll(
"AliAOD.root",
"AliAOD.VertexingHF.root");
213 fprintf(fout,
"%s\n",aodlfncopy.Data());
218 aodlfn.Append(
"aod_archive.zip");
219 printf(
"Adding file %s\n",aodlfn.Data());
220 proofColl->Add(r->GetKey(0,
"turl"));
226 TString datasetname=
"AODVertexingHF_LHC08x_10files",
235 TGrid::Connect(
"alien://");
240 proofColl->SetAnchor(
"AliAOD.root");
242 gEnv->SetValue(
"XSec.GSI.DelegProxy",
"2");
243 TProof::Open(
"dainesea:PWG3@alicecaf");
244 gProof->RegisterDataSet(datasetname.Data(),proofColl);
245 gProof->ShowDataSets();
253 stderrlfn.ReplaceAll(
"AliAOD.root",
"stdout");
254 TString aliencp=
".! alien_cp -t 10 alien://";
255 aliencp.Append(stderrlfn.Data());
256 aliencp.Append(
" file:stdoutput");
257 gROOT->ProcessLine(aliencp.Data());
258 gROOT->ProcessLine(
".! grep \"no debugging symbols found\" stdoutput > result");
259 FILE *fileres=fopen(
"result",
"r");
260 if(!fileres)
return kFALSE;
262 Int_t ncol = fscanf(fileres,
"%s %s %s %s",&text,&text,&text,&text);
265 gROOT->ProcessLine(
".! rm stdoutput result");
266 if(ncol>=0)
return kFALSE;
return jsonbuilder str().c_str()
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)