Added histograms for beam spot and run dependent trigger count
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Dec 2009 09:29:03 +0000 (09:29 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Dec 2009 09:29:03 +0000 (09:29 +0000)
PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
PWG4/JetTasks/AliAnalysisTaskJetServices.h

index c027e29..0e26c6c 100644 (file)
@@ -74,9 +74,11 @@ AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(): AliAnalysisTaskSE(),
   fh2ESDTriggerCount(0x0),
   fh2TriggerVtx(0x0),
   fh2ESDTriggerVtx(0x0),
+  fh2ESDTriggerRun(0x0),
+  fh2VtxXY(0x0),
   fHistList(0x0)  
 {
-
+  fRunRange[0] = fRunRange[1] = 0; 
 }
 
 AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(const char* name):
@@ -92,8 +94,11 @@ AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(const char* name):
   fh2ESDTriggerCount(0x0),
   fh2TriggerVtx(0x0),
   fh2ESDTriggerVtx(0x0),
+  fh2ESDTriggerRun(0x0),
+  fh2VtxXY(0x0),
   fHistList(0x0)  
 {
+  fRunRange[0] = fRunRange[1] = 0; 
   DefineOutput(1,TList::Class());
 }
 
@@ -185,6 +190,14 @@ void AliAnalysisTaskJetServices::UserCreateOutputObjects()
   fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",nBinPt,binLimitsPt);
   fHistList->Add(fh1PtHardTrials);
 
+  // 3 decisions, 0 trigger X, X + SPD vertex, X + SPD vertex in range  
+  // 3 triggers BB BE/EB EE
+
+  fh2ESDTriggerRun = new TH2F("fh2ESDTriggerRun","Trigger vs run number:run;trigger",(Int_t)(1+fRunRange[1]-fRunRange[0]),fRunRange[0]-0.5,fRunRange[1]+0.5,10,-0.5,9.5);
+  fHistList->Add(fh2ESDTriggerRun);
+
+  fh2VtxXY = new TH2F("fh2VtxXY","Beam Spot all INT triggered events;x (cm);y (cm)",160,-10,10,160,-10,10);
+  fHistList->Add(fh2VtxXY);
   // =========== Switch on Sumw2 for all histos ===========
   for (Int_t i=0; i<fHistList->GetEntries(); ++i) {
     TH1 *h1 = dynamic_cast<TH1*>(fHistList->At(i));
@@ -241,6 +254,56 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     esd = dynamic_cast<AliESDEvent*>(InputEvent());
   }
   
+  if(esd){
+    Float_t run = (Float_t)esd->GetRunNumber();
+    const AliESDVertex *vtxESD = esd->GetPrimaryVertex();
+    Float_t zvtx = -999;
+    Float_t xvtx = -999;
+    Float_t yvtx = -999;
+
+    if(vtxESD->GetNContributors()>0){
+      zvtx = vtxESD->GetZ();
+      yvtx = vtxESD->GetY();
+      xvtx = vtxESD->GetX();
+    }
+
+    Int_t iTrig = -1;
+    if(esd->GetFiredTriggerClasses().Contains("CINT1B")
+       ||esd->GetFiredTriggerClasses().Contains("CSMBB")
+       ||esd->GetFiredTriggerClasses().Contains("MB1")
+       ||esd->GetFiredTriggerClasses().Contains("CINT6B")){
+      iTrig = 0;
+    }
+    else if(esd->GetFiredTriggerClasses().Contains("CINT1A")
+           ||esd->GetFiredTriggerClasses().Contains("CSMBA")
+           ||esd->GetFiredTriggerClasses().Contains("CINT6A")
+           ||esd->GetFiredTriggerClasses().Contains("CINT1C")
+           ||esd->GetFiredTriggerClasses().Contains("CSMBC")
+           ||esd->GetFiredTriggerClasses().Contains("CINT6C")){
+      // empty bunch or bunch empty
+      iTrig = 1;
+    }
+    if(esd->GetFiredTriggerClasses().Contains("CINT1-E")
+       ||esd->GetFiredTriggerClasses().Contains("CINT6-E")){
+      iTrig = 2;
+    }
+
+    
+    if(iTrig>=0){
+      iTrig *= 3;
+      fh2ESDTriggerRun->Fill(run,iTrig+1);
+      if(vtxESD->GetNContributors()>0){
+       fh2ESDTriggerRun->Fill(run,iTrig+2);
+       fh2VtxXY->Fill(xvtx,yvtx);
+      }
+      if(TMath::Abs(zvtx)<fZVtxCut&&TMath::Abs(xvtx)<0.5&&TMath::Abs(yvtx)<0.5)fh2ESDTriggerRun->Fill(run,iTrig+3);
+    }
+    else{
+      fh2ESDTriggerRun->Fill(run,0);
+    }
+
+
+  }
   
   // loop over all possible trigger and 
   for(int it = AliAnalysisHelperJetTasks::kAcceptAll;it < AliAnalysisHelperJetTasks::kTrigger;it++){
index 091c333..dc9baec 100644 (file)
@@ -44,7 +44,8 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     virtual Bool_t Notify();
 
     virtual void SetAODInput(Bool_t b){fUseAODInput = b;}
-
+    virtual void SetRunRange(Float_t fLo,Float_t fUp){fRunRange[0] = fLo;fRunRange[1] = fUp;}
+    
     enum { kAllTriggered = 0,kTriggeredSPDVertex,kTriggeredVertexIn,kSelected,kConstraints};
 
  private:
@@ -54,7 +55,8 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
 
     Bool_t        fUseAODInput;        // take jet from input AOD not from ouptu AOD
     Float_t       fAvgTrials;          // Average number of trials
-    Float_t       fZVtxCut;          // Average number of trials
+    Float_t       fZVtxCut;            // Average number of trials
+    Float_t       fRunRange[2];        // only important for real data for 
     TProfile*     fh1Xsec;             // pythia cross section and trials
     TH1F*         fh1Trials;           // trials are added
     TH1F*         fh1PtHard;           // Pt har of the event...       
@@ -63,10 +65,11 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     TH2F*         fh2ESDTriggerCount;  // number of fire triggers in each case
     TH2F*         fh2TriggerVtx;       // vtx. position vs. trigger decision
     TH2F*         fh2ESDTriggerVtx;  // vtx. position vs. trigger decision 
-
+    TH2F*         fh2ESDTriggerRun;  // fired triggers vs. run number
+    TH2F*         fh2VtxXY;          // XY position of VTX were available
     TList *fHistList; // Output list
    
-    ClassDef(AliAnalysisTaskJetServices,1)
+    ClassDef(AliAnalysisTaskJetServices,2)
 };
  
 #endif