Make tasks aware of AliPhysicsSlection, fixes to Three Jets Task to fill output in...
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jan 2010 06:46:37 +0000 (06:46 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jan 2010 06:46:37 +0000 (06:46 +0000)
PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
PWG4/JetTasks/AliAnalysisTaskJetServices.h
PWG4/JetTasks/AliAnalysisTaskThreeJets.cxx
PWG4/JetTasks/AliAnalysisTaskThreeJets.h
PWG4/JetTasks/AliAnalysisTaskUE.cxx

index 3754cfc..83d0bac 100644 (file)
@@ -70,7 +70,6 @@ AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(): AliAnalysisTaskSE(),
   fAvgTrials(1),
   fZVtxCut(8.),
   fRealData(kFALSE),
-  fPhysicsSelection(0),
   fh1Xsec(0x0),
   fh1Trials(0x0),
   fh1PtHard(0x0),
@@ -92,7 +91,6 @@ AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(const char* name):
   fAvgTrials(1),
   fZVtxCut(8.),
   fRealData(kFALSE),
-  fPhysicsSelection(0),
   fh1Xsec(0x0),
   fh1Trials(0x0),
   fh1PtHard(0x0),
@@ -157,13 +155,6 @@ void AliAnalysisTaskJetServices::UserCreateOutputObjects()
 
   Bool_t oldStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
-
-  if(!fPhysicsSelection)
-    fPhysicsSelection = new AliPhysicsSelection();
-  fPhysicsSelection->SetName("AliPhysicsSelection_outputlist"); // to prevent conflict with object that is automatically streamed back
-  //AliLog::SetClassDebugLevel("AliPhysicsSelection", AliLog::kDebug);
-  fHistList->Add(fPhysicsSelection);
-
   fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
   fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
   fHistList->Add(fh1Xsec);
@@ -349,9 +340,12 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     if(esd){
       const AliESDVertex *vtxESD = esd->GetPrimaryVertex();
       //      Printf(">> ESDvtx %s %s",vtxESD->GetName(),vtxESD->GetTitle());vtxESD->Print();
-      Bool_t cand = true;
-      if(fRealData)cand = fPhysicsSelection->IsCollisionCandidate(esd);
-      if(cand) fh2ESDTriggerCount->Fill(it,kSelectedALICE); 
+      Bool_t cand = fInputHandler->IsEventSelected();
+      if(cand){
+       fh2ESDTriggerCount->Fill(it,kSelectedALICE); 
+       fh2ESDTriggerCount->Fill(it,kSelected);
+       AliAnalysisHelperJetTasks::Selected(kTRUE,kTRUE);// select this event
+      }
       if(vtxESD->GetNContributors()>0){
        if(esdTrig)fh2ESDTriggerCount->Fill(it,kTriggeredSPDVertex);
        Float_t zvtx = vtxESD->GetZ();
@@ -360,18 +354,11 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
        fh2ESDTriggerVtx->Fill(it,zvtx);
        if(TMath::Abs(zvtx)<fZVtxCut&&esdTrig&&TMath::Abs(xvtx)<0.5&&TMath::Abs(yvtx)<0.5){
          fh2ESDTriggerCount->Fill(it,kTriggeredVertexIn);
+         if(cand)fh2ESDTriggerCount->Fill(it,kSelectedALICEVertexIn);
          // here we select based on ESD info...
-         if(esdTrig&&(it==AliAnalysisHelperJetTasks::kMB1)){
-           fh2ESDTriggerCount->Fill(it,kSelected);
-           AliAnalysisHelperJetTasks::Selected(kTRUE,kTRUE);// select this event
-         }
        }
-
-
       }
-
     }
-
   }
 
 
@@ -416,44 +403,4 @@ void AliAnalysisTaskJetServices::Terminate(Option_t */*option*/)
 {
   // Terminate analysis
   //
-
-  TDirectory* owd = gDirectory;
-
-  if (fDebug > 1) printf("AnalysisJetServices: Terminate() \n");
-
-  fHistList = dynamic_cast<TList*> (GetOutputData(1));
-  if (!fHistList)
-    Printf("ERROR: fHistList not available");
-
-
-
-  AliAnalysisDataContainer *cont = GetOutputSlot(1)->GetContainer();
-  TString filename = cont->GetFileName();
-  TFile *f = NULL;
-  // Check first if the file is already opened
-  f = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
-  if (f) {
-    // Cd to file
-    f->cd();
-    // Check for a folder request
-    TString dir = cont->GetFolderName(); 
-    if (!dir.IsNull()) {
-      if (!f->GetDirectory(dir)) f->mkdir(dir);
-      f->cd(dir);
-    }
-  }
-
-  if (fHistList)
-  {
-    fPhysicsSelection = dynamic_cast<AliPhysicsSelection*> (fHistList->FindObject("AliPhysicsSelection_outputlist"));
-  }
-
-  if (fPhysicsSelection)
-    {
-      fPhysicsSelection->SaveHistograms("physics_selection");
-      fPhysicsSelection->Print();
-    }
-
-  owd->cd();
-
 }
index 6a94ae4..3db6154 100644 (file)
@@ -25,7 +25,6 @@ class TChain;
 class TH2F;
 class TH3F;
 class TProfile;
-class AliPhysicsSelection;
 
 
 
@@ -48,7 +47,7 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     virtual void SetRunRange(Float_t fLo,Float_t fUp){fRunRange[0] = fLo;fRunRange[1] = fUp;}
     virtual void SetRealData(Bool_t b){fRealData = b;}
 
-    enum { kAllTriggered = 0,kTriggeredSPDVertex,kTriggeredVertexIn,kSelectedALICE,kSelected,kConstraints};
+    enum { kAllTriggered = 0,kTriggeredSPDVertex,kTriggeredVertexIn,kSelectedALICE,kSelectedALICEVertexIn,kSelected,kConstraints};
 
  private:
 
@@ -60,7 +59,6 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     Float_t       fZVtxCut;            // Average number of trials
     Float_t       fRunRange[2];        // only important for real data for 
     Bool_t        fRealData;           // true for real data to allow correct trigger slection
-    AliPhysicsSelection *fPhysicsSelection;         // the physics selction class
     TProfile*     fh1Xsec;             // pythia cross section and trials
     TH1F*         fh1Trials;           // trials are added
     TH1F*         fh1PtHard;           // Pt har of the event...       
@@ -73,7 +71,7 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     TH2F*         fh2VtxXY;          // XY position of VTX were available
     TList *fHistList; // Output list
    
-    ClassDef(AliAnalysisTaskJetServices,2)
+    ClassDef(AliAnalysisTaskJetServices,3)
 };
  
 #endif
index bac2484..46391d5 100644 (file)
@@ -68,6 +68,8 @@ ClassImp(AliAnalysisTaskThreeJets)
                                                         fR(0x0),
                                                         fList(0x0),
 
+                                                        fhStopHisto(0x0),
+
                                                         fGlobVar(1),
                                                         fXsection(1),
 
@@ -146,6 +148,8 @@ AliAnalysisTaskThreeJets::AliAnalysisTaskThreeJets(const char * name):
   fR(0x0),
   fList(0x0),
 
+  fhStopHisto(0x0),
+
   fGlobVar(1),
   fXsection(1),
 
@@ -255,6 +259,11 @@ void AliAnalysisTaskThreeJets::UserCreateOutputObjects()
 
   fList = new TList();
 
+  //histogram, that maps were the code returns
+  fhStopHisto = new TH1I("StopHisto", "", 8, 0, 8);
+  fhStopHisto->SetXTitle("No. of the return");
+  fList->Add(fhStopHisto);
+
   fhX3X4Gen = new TH2F("X3vsX4Gen", "", 22, 0.6, 1.02, 33, 0.4, 1.02);
   fhX3X4Gen->SetXTitle("X_{3}");
   fhX3X4Gen->SetYTitle("X_{4}");
@@ -478,7 +487,9 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
   //primary vertex
   AliAODVertex * pvtx = dynamic_cast<AliAODVertex*>(fAOD->GetPrimaryVertex());
   if(!pvtx){
-    if (fDebug > 1)     Printf("%s:%d AOD Vertex found",(char*)__FILE__,__LINE__);
+    //return #1
+    fhStopHisto->Fill(0.5);
+    PostData(1, fList);
     return;
   }
   
@@ -491,12 +502,15 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
   //array of reconstructed jets from the AOD input
   TClonesArray *aodRecJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchRec.Data()));
   if(!aodRecJets){
-    Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data());
+    //return #2
+    fhStopHisto->Fill(1.5);  
+    PostData(1, fList);
     return;
   }
   
   // reconstructed jets
   nRecJets = aodRecJets->GetEntries(); 
+  Printf("--- Jets found in bRec: %d", nRecJets);
   nRecJets = TMath::Min(nRecJets, kMaxJets);
   
   for(int ir = 0;ir < nRecJets;++ir)
@@ -514,7 +528,10 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
     
     if(!aodGenJets)
       {
-       printf("NO MC jets Found\n");
+       printf("NO MC jets Found\n");  
+       //return #3
+       fhStopHisto->Fill(2.5);  
+       PostData(1, fList);
        return;
       }
     
@@ -631,7 +648,12 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
          }
       }
 
-    if(nGenSel == 0) return;
+    if(nGenSel == 0){  
+      //return #4
+      fhStopHisto->Fill(3.5);  
+      PostData(1, fList);
+      return;
+    }
     
     for (Int_t gj = 0; gj < nGenSel; gj++)
       {
@@ -685,7 +707,13 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
          pTrackMCAll[nAllTracksMC] = part->Pt();
          nAllTracksMC++;
        }
-      if(nAllTracksMC == 0) return;
+      if(nAllTracksMC == 0){  
+       //return #5
+       fhStopHisto->Fill(4.5);  
+       PostData(1, fList);
+       return;
+      }
+
       for(Int_t iJet = 0; iJet < nGenSel; iJet++)
        {
          Int_t nJetTracks = 0;
@@ -709,13 +737,18 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
          nInJet[iJet] = nJetTracks;
        }
       
-      if(nAccTr == 0) return;
-      if(fDebug)Printf("*********** Number of Jets : %d ***************\n", nGenSel);  
+      if(nAccTr == 0){
+       //return #6
+       fhStopHisto->Fill(5.5);  
+       PostData(1, fList);
+       return;
+      }
+       //      if(fDebug)Printf("*********** Number of Jets : %d ***************\n", nGenSel);  
       Double_t pTav[kMaxJets];
       for(Int_t i = 0; i < nGenSel; i++)
        {
          Double_t pTsum = 0;
-         if(fDebug)Printf("*********** Number of particles in Jet %d = %d *******************\n", i+3, nInJet[i]);
+         //      if(fDebug)Printf("*********** Number of particles in Jet %d = %d *******************\n", i+3, nInJet[i]);
          for(Int_t iT = 0; iT < nInJet[i]; iT++)
            {
              Double_t pt = inJetPartV[i][iT].Pt();
@@ -882,7 +915,7 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
   Int_t tag1 = 0;
 
   AliAODJet recSelJets[kMaxJets];
-
+  Printf("---- Number of reco jets: %d\n",nRecJets);
   for(Int_t i = 0; i < nRecJets; i++)
     {
       if(nRecJets == 1)
@@ -914,8 +947,14 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
        }
     } 
   
-  if(nRecSel == 0) return;
-  
+  if(nRecSel == 0)
+    {
+      //return #7
+      fhStopHisto->Fill(6.5);  
+      PostData(1, fList);
+      return;
+    }
+
   //sort rec/gen jets by energy in C.M.S
   for (Int_t rj = 0; rj < nRecSel; rj++)
     {
@@ -967,7 +1006,12 @@ void AliAnalysisTaskThreeJets::UserExec(Option_t * )
       nAccJets++;
     }
  
-  if (nAccJets == 0) return;
+  if (nAccJets == 0){
+    //return #8
+    fhStopHisto->Fill(7.5); 
+    PostData(1, fList);
+    return;
+  }
 
   for(Int_t i = 0; i < nAODtracks; i++)
     {
index 01febbd..798c6bf 100644 (file)
@@ -82,6 +82,7 @@ class AliAnalysisTaskThreeJets : public AliAnalysisTaskSE
   Double_t fR; // radius\r
   TList * fList; // output list\r
 \r
+  TH1I * fhStopHisto; //Histogram to check were the code returns
   Int_t fGlobVar; // globvar\r
   Double_t fXsection; // xsectio\r
 \r
index e31757a..eadd451 100644 (file)
@@ -47,6 +47,7 @@
 
 #include "AliGenPythiaEventHeader.h"
 #include "AliAnalysisHelperJetTasks.h"
+#include "AliInputEventHandler.h"
 #include "AliStack.h"
 #include "AliLog.h"
 
@@ -249,16 +250,15 @@ void  AliAnalysisTaskUE::CreateOutputObjects()
 void  AliAnalysisTaskUE::Exec(Option_t */*option*/)
 {
   //Trigger selection ************************************************
-  AliAnalysisHelperJetTasks::Trigger trig;
-  trig = (const enum AliAnalysisHelperJetTasks::Trigger)fTrigger;
-  //ckb tmp  if (AliAnalysisHelperJetTasks::IsTriggerFired(fAOD,trig)){
-  if (AliAnalysisHelperJetTasks::Selected()){
-       if (fDebug > 1) AliInfo(" Trigger Selection: event ACCEPTED ... ");
-  }else{
-       if (fDebug > 1) AliInfo(" Trigger Selection: event REJECTED ... ");
-       return;
-  }
-  
+   AliInputEventHandler* inputHandler = (AliInputEventHandler*) 
+         ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+    if (inputHandler->IsEventSelected()){
+      if (fDebug > 1) AliInfo(" Trigger Selection: event ACCEPTED ... ");
+    }else{
+      if (fDebug > 1) AliInfo(" Trigger Selection: event REJECTED ... ");
+      return;
+    }
+
   //Event selection (vertex) *****************************************
   AliKFVertex primVtx(*(fAOD->GetPrimaryVertex()));
   Int_t nTracksPrim=primVtx.GetNContributors();