]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODTagCreator.cxx
Store the status code of the MC particle in the AOD, used the upper bits of fFlag...
[u/mrichter/AliRoot.git] / STEER / AliAODTagCreator.cxx
index 14aab67167f6019379d22b01461cd6222bd05b35..11e56d579f1793b46a2651a8732e370224a8d3f0 100644 (file)
@@ -27,6 +27,7 @@
 #include <TSystem.h>
 #include <TChain.h>
 #include <TLorentzVector.h>
+#include <TRefArray.h>
 
 //ROOT-AliEn
 #include <TGrid.h>
@@ -100,15 +101,14 @@ Bool_t AliAODTagCreator::ReadGridCollection(TGridResult *fresult) {
 }
 
 //______________________________________________________________________________
-Bool_t AliAODTagCreator::ReadLocalCollection(const char *localpath) {
+Bool_t AliAODTagCreator::ReadLocalCollection(const char *localpath, const char* pattern) {
   // Checks the different subdirs of the given local path and in the
-  // case where it finds an AliAODs.root file it creates the tags
+  // case where it finds an AliAOD.root file it creates the tags
   
   void *dira =  gSystem->OpenDirectory(localpath);
   Char_t fPath[256];
-  const char * dirname = 0x0;
+  const char * dirname  = 0x0;
   const char * filename = 0x0;
-  const char * pattern = "AliAODs.root"; 
 
   fChain = new TChain("aodTree");
 
@@ -187,7 +187,6 @@ void AliAODTagCreator::CreateAODTags(Int_t fFirstEvent, Int_t fLastEvent, TList
     if(fLastEvent == -1) lastEvent = (Int_t)fChain->GetEntries();
     else lastEvent = fLastEvent;
 
-
     char fileName[256];
     sprintf(fileName, "Run%d.Event%d_%d.AOD.tag.root", 
            fAODEvent->GetRunNumber(), fFirstEvent, lastEvent );
@@ -218,8 +217,7 @@ void AliAODTagCreator::CreateTag(TChain* chain, const char *type) {
     // Private method that creates tag files
     //
 
-
-    //reading the esd tag file                                                  
+    //reading the esd tag file 
     fTreeTEsd = new TChain("T");
     const char * tagPattern = "ESD.tag";
     // Open the working directory
@@ -230,8 +228,7 @@ void AliAODTagCreator::CreateTag(TChain* chain, const char *type) {
        if (strstr(name,tagPattern)) fTreeTEsd->Add(name);
     }//directory loop
     AliInfo(Form("Chained tag files: %d", fTreeTEsd->GetEntries()));
-  
-    
+      
     fChain = chain;
     
     TString fSession = type;
@@ -300,7 +297,7 @@ void AliAODTagCreator::CreateTags(const char* type)
     Int_t ntags    = 0;
     Int_t tagentry = 0;
     const TClonesArray *evTagList = 0;
-
+   
     for (Int_t iEventNumber = 0; iEventNumber < nEvents; iEventNumber++) {
        // Copy old tag information
        if (iEventNumber >= ntags) {
@@ -320,7 +317,7 @@ void AliAODTagCreator::CreateTags(const char* type)
        const TUrl *url = file->GetEndpointUrl();
        fguid = file->GetUUID().AsString();
 
-       if (type == "grid") {
+       if (!strcmp(type,"grid")) {
            TString fturltemp = "alien://"; fturltemp += url->GetFile();
            fturl = fturltemp(0,fturltemp.Index(".root",5,0,TString::kExact)+5);
        } else {
@@ -332,10 +329,10 @@ void AliAODTagCreator::CreateTags(const char* type)
        // Fill the event tag from the aod informatiom
        FillEventTag(fAODEvent, evTag);
        // Set the event and input file references
-       evTag->SetEventId(iEventNumber+1);
+       //evTag->SetEventId(iEventNumber+1);
        evTag->SetGUID(fguid);
-       if(type == "grid") {
-           evTag->SetMD5(0);
+       if(!strcmp(type,"grid")) {
+           evTag->SetMD5("");
            evTag->SetTURL(fturl);
            evTag->SetSize(0);
            }
@@ -388,13 +385,25 @@ void AliAODTagCreator::FillEventTag(AliAODEvent* aod, AliEventTag* evTag)
     Int_t   nPos = 0, nNeg = 0, nNeutr =0;
     Int_t   nKinks = 0, nV0s = 0, nCascades = 0;
     Int_t   nK0s = 0, nNeutrons = 0, nPi0s = 0, nGamas = 0;
-    Int_t   nProtons = 0,  nKaons = 0, nPions = 0, nMuons = 0, nElectrons = 0;
+    Int_t   nProtons = 0,  nKaons = 0, nPions = 0, nMuons = 0, nElectrons = 0, nFWMuons = 0;
     Int_t   nCh1GeV = 0, nCh3GeV = 0, nCh10GeV = 0;
     Int_t   nMu1GeV = 0, nMu3GeV = 0, nMu10GeV = 0;
     Int_t   nEl1GeV = 0, nEl3GeV = 0, nEl10GeV = 0;
-    Float_t maxPt =  .0, meanPt = .0, totalP =  .0;
+    Float_t maxPt =  .0, etamaxPt = -999., phimaxPt = -999., meanPt = .0, totalP =  .0;
 
-    Int_t nTracks = fAODEvent->GetNTracks();
+    TRefArray tmp;
+
+
+    // Primary Vertex
+    AliAODVertex *pVertex = fAODEvent->GetPrimaryVertex();
+    if (pVertex) {
+       evTag->SetVertexX(pVertex->GetX());
+       evTag->SetVertexY(pVertex->GetY());
+       evTag->SetVertexZ(pVertex->GetZ());
+       Double_t covmatrix[6];
+       pVertex->GetCovarianceMatrix(covmatrix);
+       evTag->SetVertexZError(sqrt(covmatrix[5]));
+    }
     // loop over vertices 
     Int_t nVtxs = fAODEvent->GetNumberOfVertices();
     for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
@@ -403,11 +412,17 @@ void AliAODTagCreator::FillEventTag(AliAODEvent* aod, AliEventTag* evTag)
        if(vertex->GetType() == 2) nV0s      += 1;
        if(vertex->GetType() == 3) nCascades += 1;
     }
+    Int_t nTracks = fAODEvent->GetNTracks();
     for (Int_t nTr = 0; nTr < nTracks; nTr++) {
        AliAODTrack *track = fAODEvent->GetTrack(nTr);
        
        Double_t fPt = track->Pt();
-       if(fPt > maxPt) maxPt = fPt;
+       if(fPt > maxPt) {
+           maxPt = fPt;
+           etamaxPt = track->Eta();
+           phimaxPt = track->Phi();
+       }
+       
        if(track->Charge() > 0) {
            nPos++;
            if(fPt > fLowPtCut)      nCh1GeV++;
@@ -450,10 +465,12 @@ void AliAODTagCreator::FillEventTag(AliAODEvent* aod, AliEventTag* evTag)
            if(fPt > fHighPtCut) nEl3GeV++;
            if(fPt > fVeryHighPtCut) nEl10GeV++;
        }
-           
        totalP += track->P();
        meanPt += fPt;
        ntrack++;
+       // forward muons (in the dimuon spectrometer)
+       if(track->IsMuonTrack()) nFWMuons++;   
+                                 
     }//track loop
     //
     // Fill the event tags  
@@ -474,6 +491,7 @@ void AliAODTagCreator::FillEventTag(AliAODEvent* aod, AliEventTag* evTag)
     evTag->SetNumOfKaons(nKaons);
     evTag->SetNumOfPions(nPions);
     evTag->SetNumOfMuons(nMuons);
+    evTag->SetNumOfFWMuons(nFWMuons);
     evTag->SetNumOfElectrons(nElectrons);
     evTag->SetNumOfPhotons(nGamas);
     evTag->SetNumOfPi0s(nPi0s);
@@ -489,8 +507,15 @@ void AliAODTagCreator::FillEventTag(AliAODEvent* aod, AliEventTag* evTag)
     evTag->SetNumOfElectronsAbove1GeV(nEl1GeV);
     evTag->SetNumOfElectronsAbove3GeV(nEl3GeV);
     evTag->SetNumOfElectronsAbove10GeV(nEl10GeV);
+
+    tmp.Clear();
+    evTag->SetNumOfPHOSClusters(fAODEvent->GetPHOSClusters(&tmp));
+    tmp.Clear();
+    evTag->SetNumOfEMCALClusters(fAODEvent->GetEMCALClusters(&tmp));
        
     evTag->SetTotalMomentum(totalP);
     evTag->SetMeanPt(meanPt);
     evTag->SetMaxPt(maxPt);
+    evTag->SetEtaMaxPt(etamaxPt);
+    evTag->SetPhiMaxPt(phimaxPt);
 }