]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODTagCreator.cxx
Loading OCDB (in fact prefetching) entries and reco-params only for active and reques...
[u/mrichter/AliRoot.git] / STEER / AliAODTagCreator.cxx
index 6b3dd8dbf76aa7fc4f13013cd447c5d4a4bf40de..6b06955cefc7c585b824ad1a6544816cf2918950 100644 (file)
@@ -173,7 +173,7 @@ Bool_t AliAODTagCreator::ReadCAFCollection(const char *filename) {
 }
 
 //__________________________________________________________________________
-void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList *grpList) {
+void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList */*grpList*/) {
   //creates tag files for AODs
   
   Float_t fLowPtCut = 1.0;
@@ -193,11 +193,6 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
   Int_t nMu1GeV, nMu3GeV, nMu10GeV;
   Int_t nEl1GeV, nEl3GeV, nEl10GeV;
   Float_t maxPt = .0, meanPt = .0, totalP = .0;
-
-  AliRunTag *tag = new AliRunTag();
-  TTree ttag("T","A Tree with event tags");
-  TBranch * btag = ttag.Branch("AliTAG", &tag);
-  btag->SetCompressionLevel(9);
   
   //reading the esd tag file
   TChain *oldTagTree = new TChain("T");
@@ -211,14 +206,6 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
   }//directory loop
   AliInfo(Form("Chained tag files: %d",oldTagTree->GetEntries()));
 
-  //reading the esd tag file
-  AliRunTag *oldtag = new AliRunTag();
-  TString tagFilename;
-  oldTagTree->SetBranchAddress("AliTAG",&oldtag);
-  oldTagTree->GetEntry(0);
-  tag->CopyStandardContent(oldtag);
-  const TClonesArray *evTagList = oldtag->GetEventTags();
-
   AliInfo(Form("Creating the AOD tags......."));       
 
   TFile *file = TFile::Open("AliAOD.root");
@@ -240,12 +227,25 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
 
   char fileName[256];
   sprintf(fileName, "Run%d.Event%d_%d.AOD.tag.root", 
-         tag->GetRunId(),fFirstEvent,lastEvent );
+         aod->GetRunNumber(),fFirstEvent,lastEvent );
   AliInfo(Form("writing tags to file %s", fileName));
   AliDebug(1, Form("writing tags to file %s", fileName));
  
   TFile* ftag = TFile::Open(fileName, "recreate");
 
+  AliRunTag *tag = new AliRunTag();
+  TTree ttag("T","A Tree with event tags");
+  TBranch * btag = ttag.Branch("AliTAG", &tag);
+  btag->SetCompressionLevel(9);
+
+  //reading the esd tag file
+  AliRunTag *oldtag = new AliRunTag();
+  TString tagFilename;
+  oldTagTree->SetBranchAddress("AliTAG",&oldtag);
+  oldTagTree->GetEntry(0);
+  tag->CopyStandardContent(oldtag);
+  const TClonesArray *evTagList = oldtag->GetEventTags();
+
   // loop over events
   Int_t nEvents = aodTree->GetEntries();
   for (Int_t iEventNumber = 0; iEventNumber < nEvents; iEventNumber++) {
@@ -268,7 +268,7 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
     
     Int_t nTracks = aod->GetNTracks();
     // loop over vertices
-    Int_t nVtxs = aod->GetNVertices();
+    Int_t nVtxs = aod->GetNumberOfVertices();
     for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
       // print track info
       AliAODVertex *vertex = aod->GetVertex(nVtx);
@@ -380,7 +380,7 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
 }
 
 //_____________________________________________________________________________
-void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
+void AliAODTagCreator::CreateTag(TChain* chain, const char *type) {
   //private method that creates tag files
   TString fSession = type;
   TString fguid, fmd5, fturl;
@@ -423,15 +423,15 @@ void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
   }
   TTree *aodTree = (TTree*)file->Get("aodTree");*/
   AliAODEvent *aod = new AliAODEvent();
-  aod->ReadFromTree(fChain);
-  fChain->GetEntry(0);
-  TFile *f = fChain->GetFile();
+  aod->ReadFromTree(chain);
+  chain->GetEntry(0);
+  TFile *f = chain->GetFile();
   fTempGuid = f->GetUUID().AsString();
   Int_t firstEvent = 0, lastEvent = 0;
   //lastEvent = (Int_t)aodTree->GetEntries();
 
   TString localFileName = "Run"; localFileName += aod->GetRunNumber(); 
-  localFileName += ".Event"; localFileName += firstEvent; localFileName += "_"; localFileName += fChain->GetEntries(); //localFileName += "."; localFileName += Counter;
+  localFileName += ".Event"; localFileName += firstEvent; localFileName += "_"; localFileName += chain->GetEntries(); //localFileName += "."; localFileName += Counter;
   localFileName += ".AOD.tag.root";
 
   TString fileName;
@@ -470,7 +470,7 @@ void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
   AliInfo(Form("Creating the AOD tags......."));
 
   // loop over events 
-  Int_t nEvents = fChain->GetEntries();
+  Int_t nEvents = chain->GetEntries();
   for (Int_t iEventNumber = 0; iEventNumber < nEvents; iEventNumber++) {
     AliEventTag *evTag = (AliEventTag *)evTagList->At(iEventNumber);
     ntrack = 0;
@@ -484,10 +484,10 @@ void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
     maxPt = .0; meanPt = .0; totalP = .0;
 
     // read events
-    fChain->GetEntry(iEventNumber);
-    TFile *f = fChain->GetFile();
-    const TUrl *url = f->GetEndpointUrl();
-    fguid = f->GetUUID().AsString();
+    chain->GetEntry(iEventNumber);
+    TFile *file = chain->GetFile();
+    const TUrl *url = file->GetEndpointUrl();
+    fguid = file->GetUUID().AsString();
     if(fSession == "grid") {
       TString fturltemp = "alien://"; fturltemp += url->GetFile();
       fturl = fturltemp(0,fturltemp.Index(".root",5,0,TString::kExact)+5);
@@ -499,7 +499,7 @@ void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
 
     Int_t nTracks = aod->GetNTracks();
     // loop over vertices 
-    Int_t nVtxs = aod->GetNVertices();
+    Int_t nVtxs = aod->GetNumberOfVertices();
     for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
       AliAODVertex *vertex = aod->GetVertex(nVtx);
       if(vertex->GetType() == 1) nKinks += 1;
@@ -610,13 +610,13 @@ void AliAODTagCreator::CreateTag(TChain* fChain, const char *type) {
       tag->Clear("");
     }
     tag->AddEventTag(*evTag);
-    if(iEventNumber+1 == fChain->GetEntries()) {
+    if(iEventNumber+1 == chain->GetEntries()) {
       //AliInfo(Form("File: %s",fturl.Data()));
       ttag.Fill();
       tag->Clear("");
     }      
   }//event loop
-  lastEvent = fChain->GetEntries();
+  lastEvent = chain->GetEntries();
     
   ftag->cd();
   //ttag.Fill();
@@ -710,7 +710,7 @@ void AliAODTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
 
     Int_t nTracks = aod->GetNTracks();
     // loop over vertices 
-    Int_t nVtxs = aod->GetNVertices();
+    Int_t nVtxs = aod->GetNumberOfVertices();
     for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
       AliAODVertex *vertex = aod->GetVertex(nVtx);
       if(vertex->GetType() == 1) nKinks += 1;
@@ -927,7 +927,7 @@ void AliAODTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
     
     Int_t nTracks = aod->GetNTracks();
     // loop over vertices
-    Int_t nVtxs = aod->GetNVertices();
+    Int_t nVtxs = aod->GetNumberOfVertices();
     for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
       // print track info
       AliAODVertex *vertex = aod->GetVertex(nVtx);