]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
update also DEV
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 10 Feb 2013 16:32:25 +0000 (16:32 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 10 Feb 2013 16:32:25 +0000 (16:32 +0000)
JETAN/DEV/AliAnalysisTaskFastEmbedding.cxx

index 60fa3206a995613ee901062351060c665c053f6c..8b0a7ce3dcf913bd7b9608b3b9f9de1e5715ad1e 100644 (file)
@@ -35,6 +35,7 @@
 #include <TH2F.h>
 #include <TProfile.h>
 #include <TKey.h>
 #include <TH2F.h>
 #include <TProfile.h>
 #include <TKey.h>
+#include <TGrid.h>
 
 
 #include "AliAnalysisTaskFastEmbedding.h"
 
 
 #include "AliAnalysisTaskFastEmbedding.h"
@@ -665,7 +666,7 @@ void AliAnalysisTaskFastEmbedding::UserExec(Option_t *)
 
 
       Bool_t useEntry = kFALSE;
 
 
       Bool_t useEntry = kFALSE;
-      while(!useEntry){  // protection need, if no event fulfills requierment
+      while(!useEntry){  // protection need, if no event fulfills requirement
 
          fAODEntry++; // go to next event 
          fCountEvents++;
 
          fAODEntry++; // go to next event 
          fCountEvents++;
@@ -1005,13 +1006,13 @@ Int_t AliAnalysisTaskFastEmbedding::SelectAODfile()
    Int_t pendingEvents = fInputEntries-Entry();
    //Printf("input entries %d, entry %d, pending events %d", fInputEntries, (Int_t)Entry(), pendingEvents);
    if(fAODEntriesArray){
    Int_t pendingEvents = fInputEntries-Entry();
    //Printf("input entries %d, entry %d, pending events %d", fInputEntries, (Int_t)Entry(), pendingEvents);
    if(fAODEntriesArray){
-   while(rndm->Rndm()>tmpProp){
-      n = rndm->Integer(nFiles);
-      fAODEntries = fAODEntriesArray->At(n);
-      Int_t tmpEntries = fAODEntries<pendingEvents ? pendingEvents : fAODEntries;
-      tmpProp = fAODEntriesMax ? (Float_t)tmpEntries/fAODEntriesMax : 1.;
-   }
-   fAODEntry = (Int_t)(rndm->Uniform(fAODEntries));
+     while(rndm->Rndm()>tmpProp){
+       n = rndm->Integer(nFiles);
+       fAODEntries = fAODEntriesArray->At(n);
+       Int_t tmpEntries = fAODEntries<pendingEvents ? pendingEvents : fAODEntries;
+       tmpProp = fAODEntriesMax ? (Float_t)tmpEntries/fAODEntriesMax : 1.;
+     }
+     fAODEntry = (Int_t)(rndm->Uniform(fAODEntries));
    } else {
       AliWarning("Number of entries in extra AODs not set!");
       n = rndm->Integer(nFiles);
    } else {
       AliWarning("Number of entries in extra AODs not set!");
       n = rndm->Integer(nFiles);
@@ -1037,6 +1038,11 @@ Int_t AliAnalysisTaskFastEmbedding::OpenAODfile(Int_t trial)
    if(fAODPathArray) fFileId = SelectAODfile();
    if(fFileId<0) return -1;
 
    if(fAODPathArray) fFileId = SelectAODfile();
    if(fFileId<0) return -1;
 
+   if (!gGrid) {
+     AliInfo("Trying to connect to AliEn ...");
+     TGrid::Connect("alien://");
+   }
+
    TDirectory *owd = gDirectory;
    if (fAODfile && fAODfile->IsOpen()) fAODfile->Close();
    fAODfile = TFile::Open(fAODPath.Data(),"TIMEOUT=180");
    TDirectory *owd = gDirectory;
    if (fAODfile && fAODfile->IsOpen()) fAODfile->Close();
    fAODfile = TFile::Open(fAODPath.Data(),"TIMEOUT=180");
@@ -1156,9 +1162,11 @@ Bool_t AliAnalysisTaskFastEmbedding::PythiaInfoFromFile(const char* currFile,Flo
    fTrials = 1;
 
    if(file.Contains("root_archive.zip#")){
    fTrials = 1;
 
    if(file.Contains("root_archive.zip#")){
-      Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact);
-      Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
-      file.Replace(pos+1,20,"");
+     Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
+     Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
+     Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
+      file.Replace(pos+1,pos2-pos1,"");
+      //      file.Replace(pos+1,20,"");
    }
    else {
       // not an archive take the basename....
    }
    else {
       // not an archive take the basename....