]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding trigger classes
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Dec 2009 13:28:58 +0000 (13:28 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Dec 2009 13:28:58 +0000 (13:28 +0000)
v0 histograms

PWG0/dNdEta/AlidNdEtaTask.cxx
PWG0/dNdEta/AlidNdEtaTask.h
PWG0/dNdEta/dNdEtaAnalysis.cxx
PWG0/dNdEta/drawPlots.C
PWG0/dNdEta/drawSystematics.C
PWG0/dNdEta/run.C
PWG0/dNdEta/run.sh

index 3d7de5e34b317fdfc2492518ecf8c40d3deb0854..fc5027cc14bbef4d1556d3d68dddf684e8b21e0f 100644 (file)
 #include "AliCorrectionMatrix3D.h"
 #include "dNdEta/dNdEtaAnalysis.h"
 #include "AliTriggerAnalysis.h"
+#include "AliPhysicsSelection.h"
+
+//#define FULLALIROOT
+
+#ifdef FULLALIROOT
+  #include "../ITS/AliITSRecPoint.h"
+  #include "AliCDBManager.h"
+  #include "AliCDBEntry.h"
+  #include "AliGeomManager.h"
+  #include "TGeoManager.h"
+#endif
 
 ClassImp(AlidNdEtaTask)
 
@@ -48,6 +59,8 @@ AlidNdEtaTask::AlidNdEtaTask(const char* opt) :
   fOption(opt),
   fAnalysisMode((AliPWG0Helper::AnalysisMode) (AliPWG0Helper::kTPC | AliPWG0Helper::kFieldOn)),
   fTrigger(AliTriggerAnalysis::kMB1),
+  fRequireTriggerClass(),
+  fRejectTriggerClass(),
   fFillPhi(kFALSE),
   fDeltaPhiCut(-1),
   fReadMC(kFALSE),
@@ -57,6 +70,8 @@ AlidNdEtaTask::AlidNdEtaTask(const char* opt) :
   fCheckEventType(kFALSE),
   fSymmetrize(kFALSE),
   fEsdTrackCuts(0),
+  fPhysicsSelection(0),
+  fTriggerAnalysis(0),
   fdNdEtaAnalysisESD(0),
   fMult(0),
   fMultVtx(0),
@@ -74,6 +89,7 @@ AlidNdEtaTask::AlidNdEtaTask(const char* opt) :
   fPhi(0),
   fRawPt(0),
   fEtaPhi(0),
+  fModuleMap(0),
   fDeltaPhi(0),
   fDeltaTheta(0),
   fFiredChips(0),
@@ -149,6 +165,21 @@ void AlidNdEtaTask::ConnectInputData(Option_t *)
 
   // disable info messages of AliMCEvent (per event)
   AliLog::SetClassDebugLevel("AliMCEvent", AliLog::kWarning - AliLog::kDebug + 1);
+  
+  #ifdef FULLALIROOT
+    if (fCheckEventType)
+      AliCDBManager::Instance()->SetDefaultStorage("raw://");
+    else
+      AliCDBManager::Instance()->SetDefaultStorage("MC", "Residual");
+    AliCDBManager::Instance()->SetRun(0);
+    
+    AliCDBManager* mgr = AliCDBManager::Instance();
+    AliCDBEntry* obj = mgr->Get(AliCDBPath("GRP", "Geometry", "Data"));
+    AliGeomManager::SetGeometry((TGeoManager*) obj->GetObject());
+    
+    AliGeomManager::GetNalignable("ITS");
+    AliGeomManager::ApplyAlignObjsFromCDB("ITS");
+  #endif
 }
 
 void AlidNdEtaTask::CreateOutputObjects()
@@ -197,7 +228,7 @@ void AlidNdEtaTask::CreateOutputObjects()
 
   fEtaPhi = new TH2F("fEtaPhi", "fEtaPhi;#eta;#phi in rad.;count", 80, -4, 4, 18*5, 0, 2 * TMath::Pi());
   fOutput->Add(fEtaPhi);
-
+  
   fTriggerVsTime = new TGraph; //TH1F("fTriggerVsTime", "fTriggerVsTime;trigger time;count", 100, 0, 100);
   fTriggerVsTime->SetName("fTriggerVsTime");
   fTriggerVsTime->GetXaxis()->SetTitle("trigger time");
@@ -212,22 +243,31 @@ void AlidNdEtaTask::CreateOutputObjects()
   fStats->GetXaxis()->SetBinLabel(5, "physics events after veto");
   fOutput->Add(fStats);
   
-  fStats2 = new TH2F("fStats2", "fStats2", 6, -0.5, 5.5, 7, -0.5, 6.5);
-  fStats2->GetXaxis()->SetBinLabel(1, "No Vertex");
-  fStats2->GetXaxis()->SetBinLabel(2, "|z-vtx| > 10");
-  fStats2->GetXaxis()->SetBinLabel(3, "0 tracklets");
-  fStats2->GetXaxis()->SetBinLabel(4, "Splash identification");
-  fStats2->GetXaxis()->SetBinLabel(5, "Scan Veto");
-  fStats2->GetXaxis()->SetBinLabel(6, "Selected");
+  fStats2 = new TH2F("fStats2", "fStats2", 7, -0.5, 6.5, 10, -0.5, 9.5);
+  
+  fStats2->GetXaxis()->SetBinLabel(1, "No trigger");
+  fStats2->GetXaxis()->SetBinLabel(2, "Splash identification");
+  fStats2->GetXaxis()->SetBinLabel(3, "No Vertex");
+  fStats2->GetXaxis()->SetBinLabel(4, "|z-vtx| > 10");
+  fStats2->GetXaxis()->SetBinLabel(5, "0 tracklets");
+  fStats2->GetXaxis()->SetBinLabel(6, "V0 Veto");
+  fStats2->GetXaxis()->SetBinLabel(7, "Selected");
+  
   fStats2->GetYaxis()->SetBinLabel(1, "n/a");
-  fStats2->GetYaxis()->SetBinLabel(2, "emptyA");
-  fStats2->GetYaxis()->SetBinLabel(3, "emptyC");
-  fStats2->GetYaxis()->SetBinLabel(4, "emptyAC");
-  fStats2->GetYaxis()->SetBinLabel(5, "BB");
+  fStats2->GetYaxis()->SetBinLabel(2, "empty");
+  fStats2->GetYaxis()->SetBinLabel(3, "BBA");
+  fStats2->GetYaxis()->SetBinLabel(4, "BBC");
+  fStats2->GetYaxis()->SetBinLabel(5, "BBA BBC");
   fStats2->GetYaxis()->SetBinLabel(6, "BGA");
   fStats2->GetYaxis()->SetBinLabel(7, "BGC");
+  fStats2->GetYaxis()->SetBinLabel(8, "BGA BGC");
+  fStats2->GetYaxis()->SetBinLabel(9, "BBA BGC");
+  fStats2->GetYaxis()->SetBinLabel(10, "BGA BBC");
   fOutput->Add(fStats2);
 
+  fTrackletsVsClusters = new TH2F("fTrackletsVsClusters", ";tracklets;clusters in ITS", 50, -0.5, 49.5, 1000, -0.5, 999.5);
+  fOutput->Add(fTrackletsVsClusters);
+  
   if (fAnalysisMode & AliPWG0Helper::kSPD)
   {
     fDeltaPhi = new TH1F("fDeltaPhi", "fDeltaPhi;#Delta #phi;Entries", 500, -0.2, 0.2);
@@ -236,15 +276,16 @@ void AlidNdEtaTask::CreateOutputObjects()
     fOutput->Add(fDeltaTheta);
     fFiredChips = new TH2F("fFiredChips", "fFiredChips;Chips L1 + L2;tracklets", 1201, -0.5, 1201, 50, -0.5, 49.5);
     fOutput->Add(fFiredChips);
-    fTrackletsVsClusters = new TH2F("fTrackletsVsClusters", ";tracklets;clusters in ITS", 50, -0.5, 49.5, 1000, -0.5, 999.5);
-    fOutput->Add(fTrackletsVsClusters);
     fTrackletsVsUnassigned = new TH2F("fTrackletsVsUnassigned", ";tracklets;unassigned clusters in L0", 50, -0.5, 49.5, 200, -0.5, 199.5);
     fOutput->Add(fTrackletsVsUnassigned);
     for (Int_t i=0; i<2; i++)
     {
-      fZPhi[i] = new TH2F(Form("fZPhi_%d", i), Form("fZPhi Layer %d;z (cm);#phi (rad.)", i), 200, -20, 20, 180, 0, TMath::Pi() * 2);
+      fZPhi[i] = new TH2F(Form("fZPhi_%d", i), Form("fZPhi Layer %d;z (cm);#phi (rad.)", i), 200, -15, 15, 200, 0, TMath::Pi() * 2);
       fOutput->Add(fZPhi[i]);
     }
+    
+    fModuleMap = new TH1F("fModuleMap", "fModuleMap;module number;cluster count", 240, -0.5, 239.5);
+    fOutput->Add(fModuleMap);
   }
 
   if (fAnalysisMode & AliPWG0Helper::kTPC || fAnalysisMode & AliPWG0Helper::kTPCITS)
@@ -289,6 +330,18 @@ void AlidNdEtaTask::CreateOutputObjects()
     fEsdTrackCuts->SetName("fEsdTrackCuts");
     fOutput->Add(fEsdTrackCuts);
   }
+  
+  if (!fPhysicsSelection)
+    fPhysicsSelection = new AliPhysicsSelection;
+    
+  fPhysicsSelection->SetName("AliPhysicsSelection_outputlist"); // to prevent conflict with object that is automatically streamed back
+  //AliLog::SetClassDebugLevel("AliPhysicsSelection", AliLog::kDebug);
+  //fOutput->Add(fPhysicsSelection);
+  
+  fTriggerAnalysis = new AliTriggerAnalysis;
+  fTriggerAnalysis->EnableHistograms();
+  fTriggerAnalysis->SetSPDGFOThreshhold(2);
+  fOutput->Add(fTriggerAnalysis);
 }
 
 void AlidNdEtaTask::Exec(Option_t*)
@@ -312,8 +365,9 @@ void AlidNdEtaTask::Exec(Option_t*)
       return;
     }
     
-    //Printf("Trigger classes: %s:", fESD->GetFiredTriggerClasses().Data());
-
+//    if (fCheckEventType)
+//      eventTriggered = fPhysicsSelection->IsCollisionCandidate(fESD);
+    
     // check event type (should be PHYSICS = 7)
     if (fCheckEventType)
     {
@@ -324,69 +378,86 @@ void AlidNdEtaTask::Exec(Option_t*)
         return;
       }
       
+      //Printf("Trigger classes: %s:", fESD->GetFiredTriggerClasses().Data());
+      
+      Bool_t accept = kTRUE;
+      if (fRequireTriggerClass.Length() > 0 && !fESD->IsTriggerClassFired(fRequireTriggerClass))
+        accept = kFALSE;
+      if (fRejectTriggerClass.Length() > 0 && fESD->IsTriggerClassFired(fRejectTriggerClass))
+        accept = kFALSE;
+        
+      if (!accept)
+      {
+        Printf("Skipping event because it does not have the correct trigger class(es): %s", fESD->GetFiredTriggerClasses().Data());
+        return;
+      }
+
       fStats->Fill(4);
+    }
+    
+    fTriggerAnalysis->FillHistograms(fESD);
+    
+    AliTriggerAnalysis::V0Decision v0A = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide);
+    AliTriggerAnalysis::V0Decision v0C = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide);
+    
+    Int_t vZero = 0;
+    if (v0A != AliTriggerAnalysis::kV0Invalid && v0C != AliTriggerAnalysis::kV0Invalid)
+    {
+      if (v0A == AliTriggerAnalysis::kV0Empty && v0C == AliTriggerAnalysis::kV0Empty) vZero = 1;
+      if (v0A == AliTriggerAnalysis::kV0BB    && v0C == AliTriggerAnalysis::kV0Empty) vZero = 2;
+      if (v0A == AliTriggerAnalysis::kV0Empty && v0C == AliTriggerAnalysis::kV0BB)    vZero = 3;
+      if (v0A == AliTriggerAnalysis::kV0BB    && v0C == AliTriggerAnalysis::kV0BB)    vZero = 4;
+      if (v0A == AliTriggerAnalysis::kV0BG    && v0C == AliTriggerAnalysis::kV0Empty) vZero = 5;
+      if (v0A == AliTriggerAnalysis::kV0Empty && v0C == AliTriggerAnalysis::kV0BG)    vZero = 6;
+      if (v0A == AliTriggerAnalysis::kV0BG    && v0C == AliTriggerAnalysis::kV0BG)    vZero = 7;
+      if (v0A == AliTriggerAnalysis::kV0BB    && v0C == AliTriggerAnalysis::kV0BG)    vZero = 8;
+      if (v0A == AliTriggerAnalysis::kV0BG    && v0C == AliTriggerAnalysis::kV0BB)    vZero = 9;
+    }
       
-      const Int_t kMaxEvents = 30;
+    Bool_t filled = kFALSE;
+      
+    // trigger 
+    eventTriggered = fTriggerAnalysis->IsTriggerFired(fESD, fTrigger);
+    
+    if (!eventTriggered)
+    {
+      fStats2->Fill(0.0, vZero);
+      filled = kTRUE;
+    }
+    
+    if (v0A == AliTriggerAnalysis::kV0BG || v0C == AliTriggerAnalysis::kV0BG)
+      eventTriggered = kFALSE;
+    
+    if (eventTriggered)
+    {
+      fStats->Fill(3);
+    }
+      
+    if (fCheckEventType)
+    {
+      /*const Int_t kMaxEvents = 1;
       UInt_t maskedEvents[kMaxEvents][2] = { 
-      {0, 0x1ac4a5},
-      {0, 0x4a34af}, 
-      {0, 0x697b0f}, 
-      {0, 0x74a07d}, 
-      {0, 0x864339}, 
-      {0, 0x94fbfb}, 
-      {0, 0xb87d2b}, 
-      {0, 0xd471f3}, 
-      {0, 0xddb0e3}, 
-      {0, 0xf30af3}, 
-      {1, 0xef46f}, 
-      {1, 0x12cdd1}, 
-      {1, 0x2d7591}, 
-      {1, 0x925245}, 
-      {1, 0x9af0fd}, 
-      {1, 0xb880d5}, 
-      {1, 0xb91b0b}, 
-      {0, 0x134066}, 
-      {0, 0x140dbc}, 
-      {0, 0x1d85f6}, 
-      {0, 0x8cb1da}, 
-      {0, 0xf9b31c}, 
-      {1, 0x500dbc}, 
-      {1, 0x587134}, 
-      {1, 0x687dbe}, 
-      {1, 0x6eab78}, 
-      {1, 0x894caa},
-      {0, 0x845fb3}, 
-      {0, 0x22b966}, 
-      {0, 0xb1d576}
-   
-//      {0, 0xbe8f99}, //put back in after discussion with adam
-//      {1, 0x2b43d4}, //put back in after discussion with adam
-
-/*      ,{0, 0x23585E}, // jet test
-      {0, 0x50EF2F},
-      {0, 0x672ADD}*/
+        {-1, -1}
       };
-      
-      Bool_t veto = kFALSE;
-
+    
       for (Int_t i=0; i<kMaxEvents; i++)
       {
         if (fESD->GetPeriodNumber() == maskedEvents[i][0] && fESD->GetOrbitNumber() == maskedEvents[i][1])
         {
-           Printf("Skipping event because it is masked: period: %d orbit: %x", fESD->GetPeriodNumber(), fESD->GetOrbitNumber());
-           veto = kTRUE;
+          Printf("Skipping event because it is masked: period: %d orbit: %x", fESD->GetPeriodNumber(), fESD->GetOrbitNumber());
+          if (!filled)
+          {
+            fStats2->Fill(1, vZero);
+            filled = kTRUE;
+          }
+          return;
         }
-      }
+      }*/
       
-      Int_t decision = (veto) ? 4 : -1;
-      
-      if (!veto)
+      // ITS cluster tree
+      AliESDInputHandlerRP* handlerRP = dynamic_cast<AliESDInputHandlerRP*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+      if (handlerRP)
       {
-        // ITS cluster tree
-        AliESDInputHandlerRP* handlerRP = dynamic_cast<AliESDInputHandlerRP*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-        if (!handlerRP)
-          return;
-          
         TTree* itsClusterTree = handlerRP->GetTreeR("ITS");  
         if (!itsClusterTree)
           return;
@@ -408,6 +479,30 @@ void AlidNdEtaTask::Exec(Option_t*)
           
           Int_t nClusters = itsClusters->GetEntriesFast();
           totalClusters += nClusters;
+          
+          #ifdef FULLALIROOT
+            if (fAnalysisMode & AliPWG0Helper::kSPD)
+            {
+              // loop over clusters
+              while (nClusters--) {
+                AliITSRecPoint* cluster = (AliITSRecPoint*) itsClusters->UncheckedAt(nClusters);
+                
+                Int_t layer = cluster->GetLayer();
+                
+                if (layer > 1)
+                  continue;
+                  
+                Float_t xyz[3] = {0., 0., 0.};
+                cluster->GetGlobalXYZ(xyz);
+                
+                Float_t phi = TMath::Pi() + TMath::ATan2(-xyz[1], -xyz[0]);
+                Float_t z = xyz[2];
+                
+                fZPhi[layer]->Fill(z, phi);
+                fModuleMap->Fill(layer * 80 + cluster->GetDetectorIndex());
+              }
+            }
+          #endif
         }
                 
         const AliMultiplicity* mult = fESD->GetMultiplicity();
@@ -421,477 +516,73 @@ void AlidNdEtaTask::Exec(Option_t*)
         if (totalClusters > limit)
         {
           Printf("Skipping event because %d clusters is above limit of %d from %d tracklets: Period number: %d Orbit number: %x", totalClusters, limit, mult->GetNumberOfTracklets(), fESD->GetPeriodNumber(), fESD->GetOrbitNumber());
-          decision = 3;
-        }
-        else 
-        {
-          vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
-          if (!vtxESD)
-          {
-            decision = 0;
-          }
-          else
+          if (!filled)
           {
-            Double_t vtx[3];
-            vtxESD->GetXYZ(vtx);
-            
-            if (TMath::Abs(vtx[2]) > 10)
-            {
-              decision = 1;
-            }
-            else
-            {
-              if (mult->GetNumberOfTracklets() == 0)
-              {
-                decision = 2;
-              }
-              else
-              {
-                decision = 5;
-              }
-            }
+            fStats2->Fill(1, vZero);
+            filled = kTRUE;
           }
+          return; // TODO we skip this also for the MC. not good...
         }
       }
+    }
+          
+    vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
+    if (!vtxESD)
+    {
+      if (!filled)
+      {
+        fStats2->Fill(2, vZero);
+        filled = kTRUE;
+      }
+    }
+    else
+    {
+      Double_t vtx[3];
+      vtxESD->GetXYZ(vtx);
       
-      const Int_t kMaxVZero = 190;
-      
-      #define emptyA 1
-      #define emptyC 2
-      #define BBA 3
-      #define BBC 4
-      #define BGA 5
-      #define BGC 6
-      UInt_t vzeroAnalysis[kMaxVZero][4] = {
-        
-        {0, 0x5d31bc, emptyA, BBC},
-        {0, 0x5e4dcc, BBA, BBC},
-        {0, 0x6063a8, BBA, BBC},
-        {0, 0x613d53, BBA, BBC},
-        {0, 0x655069, BBA, BBC},
-        {0, 0x65e1cf, BBA, BBC},
-        {0, 0x66cea0, BBA, BBC},
-        {0, 0x672add, BBA, BBC},
-        {0, 0x68e567, BBA, BBC},
-        {0, 0x697b0f, BBA, emptyC},
-        {0, 0x6a686d, BGA, BBC},
-        {0, 0x6c4c2f, BBA, BBC},
-        {0, 0x6ca84d, BBA, BBC},
-        {0, 0x6ee60b, BBA, BBC},
-        {0, 0x6fa64f, BBA, BBC},
-        {0, 0x71cc8d, BBA, BBC},
-        {0, 0x74a07d, BBA, BBC},
-        {0, 0x77761b, BGA, BBC},
-        {0, 0x783454, BBA, BBC},
-        {0, 0x7d2414, BBA, BBC},
-        {0, 0x7f443f, BBA, BBC},
-        {0, 0x815daa, BBA, BBC},
-        {0, 0x8367dd, BBA, BBC},
-        {0, 0x838852, BBA, BBC},
-        {0, 0x845fb3, BBA, BBC},
-        {0, 0x84c722, emptyA, BBC},
-        {0, 0x86256e, BBA, BBC},
-        {0, 0x864339, BBA, BBC},
-        {0, 0x869be0, BGA, BBC},
-        {0, 0x895222, BBA, BBC},
-        {0, 0x8c1a56, emptyA, BBC},
-        {0, 0x8cb1da, BBA, BBC},
-        {0, 0x8e954e, BBA, BGC},
-        {0, 0x8fe645, BBA, BBC},
-        {0, 0x91bafc, BBA, BBC},
-        {0, 0x93ae80, BBA, BBC},
-        {0, 0x94f793, BBA, BBC},
-        {0, 0x94fbfb, BBA, BBC},
-        {0, 0x954c20, emptyA, BBC},
-        {0, 0x965e0f, BBA, BBC},
-        {0, 0x96a30e, BBA, BBC},
-        {0, 0x972f1d, BBA, BBC},
-        {0, 0x98fd10, BBA, BBC},
-        {0, 0x9a0472, BBA, BBC},
-        {0, 0x9c4894, BBA, BBC},
-        {0, 0x9e6dc8, emptyA, emptyC},
-        {0, 0x9f5e8b, BBA, BBC},
-        {0, 0xa035bb, BBA, BGC},
-        {0, 0xa53f7c, BBA, BBC},
-        {0, 0xa56537, BBA, BBC},
-        {0, 0xa60957, BBA, BBC},
-        {0, 0xa689db, BBA, BBC},
-        {0, 0xa6d494, BBA, BBC},
-        {0, 0xa6d935, BBA, BBC},
-        {0, 0xa8671a, BBA, BBC},
-        {0, 0xaa7956, BBA, BBC},
-        {0, 0xaee392, BBA, BBC},
-        {0, 0xb1d576, BBA, BBC},
-        {0, 0xb235c3, BBA, BGC},
-        {0, 0xb24b2d, BBA, BBC},
-        {0, 0xb2f999, BBA, emptyC},
-        {0, 0xb5acac, BBA, BBC},
-        {0, 0xb60ef4, BBA, BBC},
-        {0, 0xb7f38a, BBA, BBC},
-        {0, 0xb87d2b, BBA, BBC},
-        {0, 0xb8d564, BGA, BBC},
-        {0, 0xb9722e, BBA, BBC},
-        {0, 0xb98a5b, BBA, BBC},
-        {0, 0xb99f55, BBA, BBC},
-        {0, 0xbda770, BBA, BBC},
-        {0, 0xbe8f99, BBA, BBC},
-        {0, 0xc226a0, emptyA, BBC},
-        {0, 0xc2b248, BBA, BBC},
-        {0, 0xc56f42, emptyA, emptyC},
-        {0, 0xc6ec01, BBA, emptyC},
-        {0, 0xc768f2, BBA, BBC},
-        {0, 0xc7f149, BBA, BBC},
-        {0, 0xc94a96, BBA, BBC},
-        {0, 0xcbf834, BBA, BBC},
-        {0, 0xce4b94, BBA, BBC},
-        {0, 0xcf1b7b, BBA, BBC},
-        {0, 0xcf7257, BBA, BBC},
-        {0, 0xcffe10, BBA, BBC},
-        {0, 0xd471f3, BBA, BBC},
-        {0, 0xd5b0c6, BBA, BGC},
-        {0, 0xd5c7e7, BBA, BBC},
-        {0, 0xd8b421, emptyA, emptyC},
-        {0, 0xd978ed, BBA, BBC},
-        {0, 0xdbee52, BBA, emptyC},
-        {0, 0xdc0425, BBA, BBC},
-        {0, 0xdcc9e1, BBA, BBC},
-        {0, 0xddb0e3, BBA, BBC},
-        {0, 0xddd1a7, BGA, BBC},
-        {0, 0xdfd2c6, BBA, BBC},
-        {0, 0xe1db66, BBA, BBC},
-        {0, 0xe27106, BBA, BBC},
-        {0, 0xe69c79, BBA, BBC},
-        {0, 0xe71d7b, BBA, BBC},
-        {0, 0xe80a68, BBA, BBC},
-        {0, 0xea06fc, BBA, BBC},
-        {0, 0xf01c8e, BBA, BBC},
-        {0, 0xf08660, BBA, BBC},
-        {0, 0xf1a165, BBA, BBC},
-        {0, 0xf30af3, BBA, BBC},
-        {0, 0xf7635b, BGA, BBC},
-        {0, 0xf7a36c, emptyA, BBC},
-        {0, 0xf9b31c, BBA, BBC},
-        {0, 0xfb35f9, emptyA, BBC},
-        {0, 0xfc22dd, BBA, BBC},
-        {0, 0xfe58ba, BBA, BBC},
-        {0, 0xff5c1f, BBA, BBC},
-        {0, 0xff93b5, emptyA, BBC},
-        {1, 0x3513, BBA, BBC},
-        {1, 0x20656, BBA, BBC},
-        {1, 0x4345d, BBA, BBC},
-        {1, 0x5ec2f, BBA, BBC},
-        {1, 0x8140f, BBA, BBC},
-        {1, 0x93898, BBA, BBC},
-        {1, 0xef46f, BBA, BBC},
-        {1, 0xfff01, BGA, BBC},
-        {1, 0x10ce3e, BBA, BBC},
-        {1, 0x117f6a, BBA, BBC},
-        {1, 0x12cdd1, BBA, emptyC},
-        {1, 0x14b973, BBA, BGC},
-        {1, 0x155e84, BBA, BBC},
-        {1, 0x181dda, BBA, BBC},
-        {1, 0x1bd5b5, BBA, BBC},
-        {1, 0x1ca304, BBA, BBC},
-        {1, 0x1d095a, emptyA, BBC},
-        {1, 0x1e0125, BBA, BBC},
-        {1, 0x24a1c5, BBA, BBC},
-        {1, 0x24c960, BBA, BBC},
-        {1, 0x2638f4, BBA, BBC},
-        {1, 0x27cdee, BBA, BBC},
-        {1, 0x283e0d, BBA, BBC},
-        {1, 0x29b1f3, BBA, BBC},
-        {1, 0x2b43d4, BBA, BBC},
-        {1, 0x2bb918, BBA, BBC},
-        {1, 0x2d7591, BBA, BBC},
-        {1, 0x2da5ac, BGA, BBC},
-        {1, 0x2e2d65, BBA, BBC},
-        {1, 0x33bef9, BBA, BBC},
-        {1, 0x35505d, BBA, BBC},
-        {1, 0x36084d, BBA, BBC},
-        {1, 0x380b1f, emptyA, emptyC},
-        {1, 0x38d478, BBA, BBC},
-        {1, 0x3a0622, BBA, BBC},
-        {1, 0x3a194e, emptyA, emptyC},
-        {1, 0x3b5972, emptyA, BBC},
-        {1, 0x3ed6f5, BBA, BBC},
-        {1, 0x3ef093, BBA, BBC},
-        {1, 0x422847, BBA, BBC},
-        {1, 0x426bbb, BBA, BBC},
-        {1, 0x4b2f9b, BBA, BBC},
-        {1, 0x4c5781, emptyA, BBC},
-        {1, 0x4f1137, BBA, BBC},
-        {1, 0x4fe5ae, BBA, BBC},
-        {1, 0x500dbc, BBA, BBC},
-        {1, 0x502a5e, BGA, BBC},
-        {1, 0x505769, BBA, BBC},
-        {1, 0x507bd3, BBA, BBC},
-        {1, 0x55b3ef, BBA, BBC},
-        {1, 0x56333f, BBA, BBC},
-        {1, 0x587134, BBA, BBC},
-        {1, 0x5b4847, BBA, BGC},
-        {1, 0x5b777a, BBA, BBC},
-        {1, 0x5b7dde, BBA, BBC},
-        {1, 0x5b7e14, BBA, BBC},
-        {1, 0x5cd9ca, BBA, BBC},
-        {1, 0x5e7c42, BBA, BBC},
-        {1, 0x5facec, BBA, BBC},
-        {1, 0x6030ae, BBA, BBC},
-        {1, 0x64a772, BBA, BBC},
-        {1, 0x687dbe, BBA, BBC},
-        {1, 0x68c5dd, BBA, BGC},
-        {1, 0x692064, BBA, BBC},
-        {1, 0x6949da, BBA, BBC},
-        {1, 0x6db110, BBA, BBC},
-        {1, 0x6eab78, BBA, BBC},
-        {1, 0x6fc13d, BGA, BBC},
-        {1, 0x7463b6, BBA, BBC},
-        {1, 0x749cec, BBA, BBC},
-        {1, 0x756547, BBA, BBC},
-        {1, 0x77819e, BBA, BBC},
-        {1, 0x785e0b, BBA, BBC},
-        {1, 0x7b3caa, BBA, BBC},
-        {1, 0x7cccbb, BBA, BBC},
-        {1, 0x7e7e17, BBA, BBC},
-        {1, 0x7fc0f5, BBA, BBC},
-        {1, 0x806ee5, BBA, emptyC}
+      if (TMath::Abs(vtx[2]) > 10)
+      {
+        if (!filled)
+        {
+          fStats2->Fill(3, vZero);
+          filled = kTRUE;
+        }
+      }
         
-/* first cvetan list         
-        {0, 0x5d31bc, emptyA, emptyC},
-        {0, 0x5e4dcc, BBA, BBC},
-        {0, 0x6063a8, BBA, BBC},
-        {0, 0x613d53, BBA, BBC},
-        {0, 0x655069, BBA, BBC},
-        {0, 0x65e1cf, BBA, BBC},
-        {0, 0x66cea0, BBA, BBC},
-        {0, 0x672add, BBA, BBC},
-        {0, 0x68e567, BBA, BBC},
-        {0, 0x697b0f, emptyA, emptyC},
-        {0, 0x6a686d, BGA, BBC},
-        {0, 0x6c4c2f, BBA, BBC},
-        {0, 0x6ca84d, BBA, BBC},
-        {0, 0x6ee60b, BBA, BBC},
-        {0, 0x6fa64f, BBA, BBC},
-        {0, 0x71cc8d, BBA, BBC},
-        {0, 0x74a07d, BBA, BBC},
-        {0, 0x77761b, BGA, BBC},
-        {0, 0x783454, BBA, BBC},
-        {0, 0x7d2414, BBA, BBC},
-        {0, 0x7f443f, BBA, BBC},
-        {0, 0x815daa, BBA, BBC},
-        {0, 0x8367dd, BBA, BBC},
-        {0, 0x838852, BBA, BBC},
-        {0, 0x845fb3, BBA, BBC},
-        {0, 0x84c722, emptyA, emptyC},
-        {0, 0x86256e, BBA, BBC},
-        {0, 0x864339, BBA, BBC},
-        {0, 0x869be0, BGA, BBC},
-        {0, 0x895222, BBA, BBC},
-        {0, 0x8c1a56, emptyA, emptyC},
-        {0, 0x8cb1da, BBA, BBC},
-        {0, 0x8e954e, BBA, BGC},
-        {0, 0x8fe645, BBA, BBC},
-        {0, 0x91bafc, BBA, BBC},
-        {0, 0x93ae80, BBA, BBC},
-        {0, 0x94f793, BBA, BBC},
-        {0, 0x94fbfb, BBA, BBC},
-        {0, 0x954c20, emptyA, emptyC},
-        {0, 0x965e0f, BBA, BBC},
-        {0, 0x96a30e, BBA, BBC},
-        {0, 0x972f1d, BBA, BBC},
-        {0, 0x98fd10, BBA, BBC},
-        {0, 0x9a0472, BBA, BBC},
-        {0, 0x9c4894, BBA, BBC},
-        {0, 0x9e6dc8, emptyA, emptyC},
-        {0, 0x9f5e8b, BBA, BBC},
-        {0, 0xa035bb, BBA, BGC},
-        {0, 0xa53f7c, BBA, BBC},
-        {0, 0xa56537, BBA, BBC},
-        {0, 0xa60957, BBA, BBC},
-        {0, 0xa689db, BBA, BBC},
-        {0, 0xa6d494, BBA, BBC},
-        {0, 0xa6d935, BBA, BBC},
-        {0, 0xa8671a, BBA, BBC},
-        {0, 0xaa7956, BBA, BBC},
-        {0, 0xaee392, BBA, BBC},
-        {0, 0xb1d576, BBA, BBC},
-        {0, 0xb235c3, BBA, BGC},
-        {0, 0xb24b2d, BBA, BBC},
-        {0, 0xb2f999, emptyA, emptyC},
-        {0, 0xb5acac, BBA, BBC},
-        {0, 0xb60ef4, BBA, BBC},
-        {0, 0xb7f38a, BBA, BBC},
-        {0, 0xb87d2b, BBA, BBC},
-        {0, 0xb8d564, BGA, BBC},
-        {0, 0xb9722e, BBA, BBC},
-        {0, 0xb98a5b, BBA, BBC},
-        {0, 0xb99f55, BBA, BBC},
-        {0, 0xbda770, BBA, BBC},
-        {0, 0xbe8f99, BBA, BBC},
-        {0, 0xc226a0, BBA, BBC},
-        {0, 0xc2b248, BBA, BBC},
-        {0, 0xc56f42, emptyA, emptyC},
-        {0, 0xc6ec01, emptyA, emptyC},
-        {0, 0xc768f2, BBA, BBC},
-        {0, 0xc7f149, BBA, BBC},
-        {0, 0xc94a96, BBA, BBC},
-        {0, 0xcbf834, BBA, BBC},
-        {0, 0xce4b94, BBA, BBC},
-        {0, 0xcf1b7b, BBA, BBC},
-        {0, 0xcf7257, BBA, BBC},
-        {0, 0xcffe10, BBA, BBC},
-        {0, 0xd471f3, BBA, BBC},
-        {0, 0xd5b0c6, BBA, BGC},
-        {0, 0xd5c7e7, BBA, BBC},
-        {0, 0xd8b421, emptyA, emptyC},
-        {0, 0xd978ed, BBA, BBC},
-        {0, 0xdbee52, BBA, emptyC},
-        {0, 0xdc0425, BBA, BBC},
-        {0, 0xdcc9e1, BBA, BBC},
-        {0, 0xddb0e3, BBA, BBC},
-        {0, 0xddd1a7, BGA, BBC},
-        {0, 0xdfd2c6, BBA, BBC},
-        {0, 0xe1db66, BBA, BBC},
-        {0, 0xe27106, BBA, BBC},
-        {0, 0xe69c79, BBA, BBC},
-        {0, 0xe71d7b, BBA, BBC},
-        {0, 0xe80a68, BBA, BBC},
-        {0, 0xea06fc, BBA, BBC},
-        {0, 0xf01c8e, BBA, BBC},
-        {0, 0xf08660, BBA, BBC},
-        {0, 0xf1a165, BBA, BBC},
-        {0, 0xf30af3, BBA, BBC},
-        {0, 0xf7635b, BGA, BBC},
-        {0, 0xf7a36c, emptyA, emptyC},
-        {0, 0xf9b31c, BBA, BBC},
-        {0, 0xfb35f9, emptyA, emptyC},
-        {0, 0xfc22dd, BBA, BBC},
-        {0, 0xfe58ba, BBA, BBC},
-        {0, 0xff5c1f, BBA, BBC},
-        {0, 0xff93b5, emptyA, emptyC},
-        {1, 0x3513, BBA, BBC},
-        {1, 0x20656, BBA, BBC},
-        {1, 0x4345d, BBA, BBC},
-        {1, 0x5ec2f, BBA, BBC},
-        {1, 0x8140f, BBA, BBC},
-        {1, 0x93898, BBA, BBC},
-        {1, 0xef46f, BBA, BBC},
-        {1, 0xfff01, BGA, BBC},
-        {1, 0x10ce3e, BBA, BBC},
-        {1, 0x117f6a, BBA, BBC},
-        {1, 0x12cdd1, BBA, emptyC},
-        {1, 0x14b973, BBA, BGC},
-        {1, 0x155e84, BBA, BBC},
-        {1, 0x181dda, BBA, BBC},
-        {1, 0x1bd5b5, BBA, BBC},
-        {1, 0x1ca304, BBA, BBC},
-        {1, 0x1d095a, emptyA, emptyC},
-        {1, 0x1e0125, BBA, BBC},
-        {1, 0x24a1c5, BBA, BBC},
-        {1, 0x24c960, BBA, BBC},
-        {1, 0x2638f4, BBA, BBC},
-        {1, 0x27cdee, BBA, BBC},
-        {1, 0x283e0d, BBA, BBC},
-        {1, 0x29b1f3, BBA, BBC},
-        {1, 0x2b43d4, BBA, BBC},
-        {1, 0x2bb918, BBA, BBC},
-        {1, 0x2d7591, BBA, BBC},
-        {1, 0x2da5ac, BGA, BBC},
-        {1, 0x2e2d65, BBA, BBC},
-        {1, 0x33bef9, BBA, BBC},
-        {1, 0x35505d, BBA, BBC},
-        {1, 0x36084d, BBA, BBC},
-        {1, 0x380b1f, emptyA, emptyC},
-        {1, 0x38d478, BBA, BBC},
-        {1, 0x3a0622, BBA, BBC},
-        {1, 0x3a194e, emptyA, emptyC},
-        {1, 0x3b5972, emptyA, emptyC},
-        {1, 0x3ed6f5, BBA, BBC},
-        {1, 0x3ef093, BBA, BBC},
-        {1, 0x422847, BBA, BBC},
-        {1, 0x426bbb, BBA, BBC},
-        {1, 0x4b2f9b, BBA, BBC},
-        {1, 0x4c5781, emptyA, emptyC},
-        {1, 0x4f1137, BBA, BBC},
-        {1, 0x4fe5ae, BBA, BBC},
-        {1, 0x500dbc, BBA, BBC},
-        {1, 0x502a5e, BGA, BBC},
-        {1, 0x505769, BBA, BBC},
-        {1, 0x507bd3, BBA, BBC},
-        {1, 0x55b3ef, BBA, BBC},
-        {1, 0x56333f, BBA, BBC},
-        {1, 0x587134, BBA, BBC},
-        {1, 0x5b4847, BBA, BGC},
-        {1, 0x5b777a, BBA, BBC},
-        {1, 0x5b7dde, BBA, BBC},
-        {1, 0x5b7e14, BBA, BBC},
-        {1, 0x5cd9ca, BBA, BBC},
-        {1, 0x5e7c42, BBA, BBC},
-        {1, 0x5facec, BBA, BBC},
-        {1, 0x6030ae, BBA, BBC},
-        {1, 0x64a772, BBA, BBC},
-        {1, 0x687dbe, BBA, BBC},
-        {1, 0x68c5dd, BBA, BGC},
-        {1, 0x692064, BBA, BBC},
-        {1, 0x6949da, BBA, BBC},
-        {1, 0x6db110, BBA, BBC},
-        {1, 0x6eab78, BBA, BBC},
-        {1, 0x6fc13d, BGA, BBC},
-        {1, 0x7463b6, BBA, BBC},
-        {1, 0x749cec, BBA, BBC},
-        {1, 0x756547, BBA, BBC},
-        {1, 0x77819e, BBA, BBC},
-        {1, 0x785e0b, BBA, BBC},
-        {1, 0x7b3caa, BBA, BBC},
-        {1, 0x7cccbb, BBA, BBC},
-        {1, 0x7e7e17, BBA, BBC},
-        {1, 0x7fc0f5, BBA, BBC},
-        {1, 0x806ee5, BBA, emptyC} */
-        };
-      
-      Bool_t found = kFALSE;
+      const AliMultiplicity* mult = fESD->GetMultiplicity();
+      if (!mult)
+        return;
       
-      for (Int_t i=1; i<kMaxVZero; i++)
+      if (mult->GetNumberOfTracklets() == 0)
       {
-        if (fESD->GetPeriodNumber() == vzeroAnalysis[i-1][0] && fESD->GetOrbitNumber() == vzeroAnalysis[i-1][1])
+        if (!filled)
         {
-          found = kTRUE;
-          Int_t vZero = -1;
-          if (vzeroAnalysis[i][2] == emptyA && vzeroAnalysis[i][3] == BBC)
-            vZero = 1;
-          if (vzeroAnalysis[i][2] == BBA && vzeroAnalysis[i][3] == emptyC)
-            vZero = 2;
-          if (vzeroAnalysis[i][2] == emptyA && vzeroAnalysis[i][3] == emptyC)
-            vZero = 3;
-          if (vzeroAnalysis[i][2] == BBA && vzeroAnalysis[i][3] == BBC)
-            vZero = 4;
-          if (vzeroAnalysis[i][2] == BGA && vzeroAnalysis[i][3] == BBC)
-            vZero = 5;
-          if (vzeroAnalysis[i][2] == BBA && vzeroAnalysis[i][3] == BGC)
-            vZero = 6;
-            
-          fStats2->Fill(decision, vZero);
-          break;
+          fStats2->Fill(4, vZero);
+          filled = kTRUE;
         }
       }
-      
-      if (!found)
-        fStats2->Fill(decision, 0);
-      
-      if (decision == 3 || decision == 4)
+    }
+    
+    if (fCheckEventType)
+    {
+      if (vZero >= 5)
       {
-        Printf("Skipping event %d: Period number: %d Orbit number: %x", decision, fESD->GetPeriodNumber(), fESD->GetOrbitNumber());
+        if (!filled)
+          fStats2->Fill(5, vZero);
         return;
       }
     }
+        
+    if (!filled)
+      fStats2->Fill(6, vZero);
+      
+    //Printf("Skipping event %d: Period number: %d Orbit number: %x", decision, fESD->GetPeriodNumber(), fESD->GetOrbitNumber());
       
-    fStats->Fill(5);
-    
-    // trigger definition
-    static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;
-    eventTriggered = triggerAnalysis->IsTriggerFired(fESD, fTrigger);
     if (eventTriggered)
       fStats->Fill(3);
-
+    
+    fStats->Fill(5);
+    
     // get the ESD vertex
     vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
     
@@ -1031,15 +722,15 @@ void AlidNdEtaTask::Exec(Option_t*)
         fPhi->Fill(phi);
         fEtaPhi->Fill(eta, phi);
         
-        if (deltaPhi < 0.01)
-        {
-          // layer 0
-          Float_t z = vtx[2] + 3.9 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
-          fZPhi[0]->Fill(z, phi);
-          // layer 1
-          z = vtx[2] + 7.6 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
-          fZPhi[1]->Fill(z, phi);
-        }
+//         if (deltaPhi < 0.01)
+//         {
+//           // layer 0
+//           Float_t z = vtx[2] + 3.9 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
+//           fZPhi[0]->Fill(z, phi);
+//           // layer 1
+//           z = vtx[2] + 7.6 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
+//           fZPhi[1]->Fill(z, phi);
+//         }
 
         if (vtxESD && TMath::Abs(vtx[2]) < 10)
         {
@@ -1159,6 +850,9 @@ void AlidNdEtaTask::Exec(Option_t*)
           ++inputCount;
         }
         
+        if (inputCount > 30)
+          Printf("Event with %d accepted TPC tracks. Period number: %d Orbit number: %x Bunch crossing number: %d", inputCount, fESD->GetPeriodNumber(), fESD->GetOrbitNumber(), fESD->GetBunchCrossNumber());
+        
         // TODO restrict inputCount used as measure for the multiplicity to |eta| < 1
   
         delete list;
@@ -1207,8 +901,8 @@ void AlidNdEtaTask::Exec(Option_t*)
         fdNdEtaAnalysisESD->FillEvent(vtx[2], inputCount);
 
         // control hist
-       if (inputCount > 0)
-               fEvents->Fill(vtx[2]);
+        if (inputCount > 0)
+          fEvents->Fill(vtx[2]);
 
         if (fReadMC)
         {
@@ -1433,6 +1127,7 @@ void AlidNdEtaTask::Terminate(Option_t *)
     fEtaPhi = dynamic_cast<TH2F*> (fOutput->FindObject("fEtaPhi"));
     for (Int_t i=0; i<2; ++i)
       fZPhi[i] = dynamic_cast<TH2F*> (fOutput->FindObject(Form("fZPhi_%d", i)));
+    fModuleMap = dynamic_cast<TH1F*> (fOutput->FindObject("fModuleMap"));
     fDeltaPhi = dynamic_cast<TH1F*> (fOutput->FindObject("fDeltaPhi"));
     fDeltaTheta = dynamic_cast<TH1F*> (fOutput->FindObject("fDeltaTheta"));
     fFiredChips = dynamic_cast<TH2F*> (fOutput->FindObject("fFiredChips"));
@@ -1443,6 +1138,8 @@ void AlidNdEtaTask::Terminate(Option_t *)
     fStats2 = dynamic_cast<TH2F*> (fOutput->FindObject("fStats2"));
 
     fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCuts"));
+    fPhysicsSelection = dynamic_cast<AliPhysicsSelection*> (fOutput->FindObject("AliPhysicsSelection_outputlist"));
+    fTriggerAnalysis = dynamic_cast<AliTriggerAnalysis*> (fOutput->FindObject("AliTriggerAnalysis"));
   }
 
   if (!fdNdEtaAnalysisESD)
@@ -1495,6 +1192,12 @@ void AlidNdEtaTask::Terminate(Option_t *)
         new TCanvas("control3", "control3", 500, 500);
         fEvents->Draw();
     }
+    
+    if (fStats2)
+    {
+      new TCanvas;
+      fStats2->Draw("TEXT");
+    }
 
     TFile* fout = new TFile("analysis_esd_raw.root", "RECREATE");
 
@@ -1504,6 +1207,15 @@ void AlidNdEtaTask::Terminate(Option_t *)
     if (fEsdTrackCuts)
       fEsdTrackCuts->SaveHistograms("esd_track_cuts");
 
+    if (fPhysicsSelection)
+    {
+      fPhysicsSelection->SaveHistograms("physics_selection");
+      fPhysicsSelection->Print();
+    }
+    
+    if (fTriggerAnalysis)
+      fTriggerAnalysis->SaveHistograms();
+
     if (fMult)
       fMult->Write();
 
@@ -1539,6 +1251,9 @@ void AlidNdEtaTask::Terminate(Option_t *)
       if (fZPhi[i])
         fZPhi[i]->Write();
     
+    if (fModuleMap)
+      fModuleMap->Write();
+    
     if (fFiredChips)
       fFiredChips->Write();
 
index 9c634e33646c5d86a79de34d1962aeca15709cd4..2a42b2e373f3c942b63a62427cf05dc9d950e21d 100644 (file)
@@ -15,6 +15,8 @@ class TH2F;
 class TH3F;
 class AliESDEvent;
 class TGraph;
+class AliPhysicsSelection;
+class AliTriggerAnalysis;
 
 class AlidNdEtaTask : public AliAnalysisTask {
   public:
@@ -34,6 +36,7 @@ class AlidNdEtaTask : public AliAnalysisTask {
     void SetOnlyPrimaries(Bool_t flag = kTRUE) { fOnlyPrimaries = flag; }
     void SetUseMCKine(Bool_t flag = kTRUE) { fUseMCKine = flag; }
     void SetTrigger(AliTriggerAnalysis::Trigger trigger) { fTrigger = trigger; }
+    void SetTriggerClasses(const char* require, const char* reject) { fRequireTriggerClass = require; fRejectTriggerClass = reject; }
     void SetFillPhi(Bool_t flag = kTRUE) { fFillPhi = flag; }
     void SetDeltaPhiCut(Float_t cut) { fDeltaPhiCut = cut; }
     void SetCheckEventType(Bool_t flag = kTRUE) { fCheckEventType = flag; }
@@ -42,23 +45,27 @@ class AlidNdEtaTask : public AliAnalysisTask {
     void SetOption(const char* opt) { fOption = opt; }
 
  protected:
-    AliESDEvent *fESD;    //! ESD object
-    TList* fOutput;                  //! list send on output slot 0
+    AliESDEvent *fESD;                         //! ESD object
+    TList* fOutput;                            //! list send on output slot 0
 
-    TString fOption;      // option string
+    TString fOption;                           // option string
     AliPWG0Helper::AnalysisMode fAnalysisMode; // detector that is used for analysis
     AliTriggerAnalysis::Trigger fTrigger;      // trigger that is used
+    TString fRequireTriggerClass;              // trigger class that is required
+    TString fRejectTriggerClass;               // trigger class that is rejected
     Bool_t fFillPhi;                           // if true phi is filled as 3rd coordinate in all maps
     Float_t fDeltaPhiCut;                      // cut in delta phi (only SPD)
 
-    Bool_t  fReadMC;       // if true reads MC data (to build correlation maps)
-    Bool_t  fUseMCVertex;  // the MC vtx is used instead of the ESD vertex (for syst. check)
-    Bool_t  fOnlyPrimaries;// Process only primaries by using the MC information (for syst. check)
-    Bool_t  fUseMCKine;    // use the MC values for each found track/tracklet (for syst. check)
+    Bool_t  fReadMC;          // if true reads MC data (to build correlation maps)
+    Bool_t  fUseMCVertex;     // the MC vtx is used instead of the ESD vertex (for syst. check)
+    Bool_t  fOnlyPrimaries;   // Process only primaries by using the MC information (for syst. check)
+    Bool_t  fUseMCKine;       // use the MC values for each found track/tracklet (for syst. check)
     Bool_t  fCheckEventType;  // check if event type is physics (for real data)
-    Bool_t  fSymmetrize;     // move all negative to positive eta
+    Bool_t  fSymmetrize;      // move all negative to positive eta
 
     AliESDtrackCuts* fEsdTrackCuts;         // Object containing the parameters of the esd track cuts
+    AliPhysicsSelection* fPhysicsSelection; // Event Selection object
+    AliTriggerAnalysis* fTriggerAnalysis;
 
     // Gathered from ESD
     dNdEtaAnalysis* fdNdEtaAnalysisESD;     //! contains the dndeta from the ESD
@@ -87,6 +94,7 @@ class AlidNdEtaTask : public AliAnalysisTask {
     TH1F* fRawPt;                 //! raw pt distribution
     TH2F* fEtaPhi;                //! raw eta - phi distribution
     TH2F* fZPhi[2];               //! raw z - phi distribution from tracklets per layer (only SPD)
+    TH1F* fModuleMap;             //! count clusters as function of module number (only SPD)
     TH1F* fDeltaPhi;              //! histogram of delta_phi values for tracklets (only for SPD analysis)
     TH1F* fDeltaTheta;            //! histogram of delta_theta values for tracklets (only for SPD analysis)
     TH2F* fFiredChips;            //! fired chips l1+l2 vs. number of tracklets (only for SPD analysis)
index ae044f0d549166b49a973836d8728a6d2eadae91..e4584cdb297090a76631f74f48f6b48481b7d93b 100644 (file)
@@ -254,6 +254,7 @@ void dNdEtaAnalysis::Finish(AlidNdEtaCorrection* correction, Float_t ptCut, Alid
 
   TH2F* rawMeasured = (TH2F*) fData->GetEventCorrection()->GetMeasuredHistogram()->Clone("rawMeasured");
 
+  fData->ResetErrorsOnCorrections();
   fData->Multiply();
 
   if (correctionType >= AlidNdEtaCorrection::kVertexReco)
index a09ce002454e93cd7f583ffecb8ddda4384e2943..e91d270cf9ae8a8e691715b8947408d8d66fd86f 100644 (file)
@@ -3164,7 +3164,7 @@ void FitDiamondVsMult()
   gStyle->SetPadGridX(kTRUE);
   gStyle->SetPadGridY(kTRUE);
   
-  Int_t max = 25;
+  Int_t max = 40;
   
   for (Int_t i=0; i<2; i++)
   {
@@ -3190,7 +3190,7 @@ void FitDiamondVsMult()
   }
 }
 
-void CompareQualityHists(const char* fileName1, const char* fileName2, const char* plotName, Int_t rebin1 = 1, Int_t rebin2 = 1)
+void CompareQualityHists(const char* fileName1, const char* fileName2, const char* plotName, Int_t rebin1 = 1, Int_t rebin2 = 1, const char* exec = 0)
 {
   file1 = TFile::Open(fileName1);
   hist1 = (TH1*) file1->Get(plotName);
@@ -3198,6 +3198,17 @@ void CompareQualityHists(const char* fileName1, const char* fileName2, const cha
   file2 = TFile::Open(fileName2);
   hist2 = (TH1*) file2->Get(plotName);
   
+  if (exec)
+  {
+    hist1 = (TH1*) gROOT->ProcessLine(Form(exec, hist1, "hist1a"));
+    hist2 = (TH1*) gROOT->ProcessLine(Form(exec, hist2, "hist2a"));
+  }
+  
+  CompareQualityHists(hist1, hist2, rebin1, rebin2);
+}
+
+void CompareQualityHists(TH1* hist1, TH1* hist2, Int_t rebin1 = 1, Int_t rebin2 = 1)
+{
   hist1->SetLineColor(1);
   hist2->SetLineColor(2);
  
@@ -3216,12 +3227,30 @@ void CompareQualityHists(const char* fileName1, const char* fileName2, const cha
   }
 
   c = new TCanvas;
+  hist1->GetYaxis()->SetRangeUser(0, hist1->GetMaximum() * 1.3);
   hist1->DrawCopy();
   hist2->DrawCopy("SAME");
+  c->SaveAs(Form("%s_1.png", hist1->GetName()));
   
-  c2 = new TCanvas;
-  hist1->Divide(hist2);
-  hist1->DrawCopy();
+  for (Int_t i=1; i<=hist1->GetNbinsX(); i++)
+    if (hist1->GetBinContent(i) == 0 && hist2->GetBinContent(i) > 0 || hist1->GetBinContent(i) > 0 && hist2->GetBinContent(i) == 0)
+      Printf("Inconsistent bin %d: %f %f", i, hist1->GetBinContent(i), hist2->GetBinContent(i));
+  
+  if (rebin1 == rebin2)
+  {
+    c2 = new TCanvas;
+    hist1->Divide(hist2);
+    hist1->DrawCopy();
+    c2->SaveAs(Form("%s_2.png", hist1->GetName()));
+    
+    for (Int_t i=1; i<=hist1->GetNbinsX(); i++)
+      if (hist1->GetBinContent(i) > 0.9 && hist1->GetBinContent(i) < 1.1)
+        hist1->SetBinContent(i, 0);
+        
+    new TCanvas;
+    hist1->SetMarkerStyle(20);
+    hist1->DrawCopy("P");
+  }
 }
 
 void DrawClustersVsTracklets()
@@ -3265,4 +3294,82 @@ void VertexPlotBackgroundNote()
   proj->Draw("SAME");
   
   
-}
\ No newline at end of file
+}
+
+void BackgroundAnalysis(const char* signal, const char* background)
+{
+  TFile::Open(signal);
+  signalHist = (TH2*) gFile->Get("fTrackletsVsClusters");
+  
+  TFile::Open(background);
+  backgroundHist = (TH2*) gFile->Get("fTrackletsVsClusters");
+  
+  Printf("For events with >= 1 tracklet:");
+  
+  func = new TF1("func", "[0] + x * 11", 0, 30);
+  for (Int_t a = 50; a <= 100; a += 10)
+  {
+    func->SetParameter(0, a);
+    
+    Float_t signalCount = 0;
+    Float_t backgroundCount = 0;
+    for (Int_t x = 2; x <= signalHist->GetNbinsX(); x++)
+    {
+      signalCount += signalHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY());
+      backgroundCount += backgroundHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY());
+    }
+    
+    Float_t signalFraction = 100.0 * signalCount / signalHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY());
+    Float_t backgroundFraction = 100.0 * backgroundCount / backgroundHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY());
+    
+    Printf("Cut at a = %d; Removed %.2f %% of the background (%.0f events); Removed %.2f %% of the signal", a, backgroundFraction, backgroundCount, signalFraction);
+  }
+}
+
+void ZPhiPlots()
+{
+  TFile::Open("analysis_esd_raw.root");
+  
+  for (Int_t i=0; i<2; i++)
+  {  
+    hist = (TH2*) gFile->Get(Form("fZPhi_%d", i));
+    
+    c = new TCanvas;
+    hist->SetStats(0);
+    hist->Draw("COLZ");
+    c->SaveAs(Form("ZPhi_%d.png", i));
+  }
+}
+
+void DrawStats(Bool_t all = kFALSE)
+{
+  if (all)
+  {
+    Int_t count = 4;
+    const char* list[] = { "CINT1B-ABCE-NOPF-ALL/spd", "CINT1A-ABCE-NOPF-ALL/spd", "CINT1C-ABCE-NOPF-ALL/spd", "CINT1-E-NOPF-ALL/spd" };
+  }
+  else
+  {
+    Int_t count = 1;
+    const char* list[] = { "." };
+  }
+  
+  for (Int_t i=0; i<count; i++)
+  {
+    TFile::Open(Form("%s/analysis_esd_raw.root", list[i]));
+  
+    hist = (TH2*) gFile->Get("fStats2");
+    
+    c = new TCanvas(list[i], list[i], 800, 600);
+    gPad->SetBottomMargin(0.2);
+    gPad->SetLeftMargin(0.2);
+    gPad->SetRightMargin(0.2);
+    hist->Draw("TEXT");
+    hist->SetMarkerSize(2);
+    //hist->GetYaxis()->SetRangeUser(0, 0);
+    
+    gROOT->Macro("increaseFonts.C");
+  
+    c->SaveAs(Form("%s/stats.png", list[i]));
+  }
+}
index 95af45d1492981a07ee7b452d0c3d1265b73eef3..38de7a779d093596dc94d83b6af2d352211bc365 100644 (file)
@@ -974,30 +974,76 @@ void mergeCorrectionsWithDifferentCrosssections(Int_t correctionTarget = 3, Char
   fout->Close();
 }
 
-void CreateCorrectionsWithUA5CrossSections(const Char_t* correctionFileName="correction_mapprocess-types.root", const Char_t* outputFileName="correction_map2.root") {
+void CreateCorrectionsWithUA5CrossSections(Int_t origin, const Char_t* correctionFileName="correction_mapprocess-types.root", const Char_t* outputFileName="correction_map2.root") {
   //
   // Function used to merge standard corrections with vertex
   // reconstruction corrections obtained by a certain mix of ND, DD
   // and SD events.
   //
+  // origin: 
+  //   -1 = Pythia (test)
+  //   0 = UA5
+  //   1 = Data 1.8 TeV
+  //   2 = Tel-Aviv
+  //   3 = Durham
+  //
 
   loadlibs();
 
   const Char_t* typeName[] = { "vertexreco", "trigger", "vtxtrigger" };
   
-  Float_t ua5_SD = 0.153;
-  Float_t ua5_DD = 0.080;
-  Float_t ua5_ND = 0.767;
-
-  //Karel:
+  Float_t ref_SD = -1;
+  Float_t ref_DD = -1;
+  Float_t ref_ND = -1;
+  
+  switch (origin)
+  {
+    case -1: // Pythia, as test
+      ref_SD = 0.223788;
+      ref_DD = 0.123315;
+      ref_ND = 0.652897;
+      break;
+      
+    case 0: // UA5
+      ref_SD = 0.153;
+      ref_DD = 0.080;
+      ref_ND = 0.767;
+      break;
+      
+    case 1: // data 1.8 TeV
+      ref_SD = 0.152;
+      ref_DD = 0.092;
+      ref_ND = 1 - ref_SD - ref_DD;
+      break;
+      
+    case 2: // tel-aviv model
+      ref_SD = 0.171;
+      ref_DD = 0.094;
+      ref_ND = 1 - ref_SD - ref_DD;
+      break;
+    
+    case 3: // durham model
+      ref_SD = 0.190;
+      ref_DD = 0.125;
+      ref_ND = 1 - ref_SD - ref_DD;
+      break;
+    
+    default:
+      return;
+  }
+      
+  //Karel (UA5):
 //     fsd = 0.153 +- 0.031
 //     fdd = 0.080 +- 0.050
 //     fnd = 0.767 +- 0.059
 
-  // Pythia, as test
-/*  ua5_SD = 0.223788;
-  ua5_DD = 0.123315;
-  ua5_ND = 0.652897; */
+//       Karel (1.8 TeV):
+//       
+//       Tel-Aviv model Sd/Inel = 0.171           Dd/Inel = 0.094
+//       Durham model   Sd/Inel = 0.190           Dd/Inel = 0.125
+//       Data           Sd/Inel = 0.152 +- 0.030  Dd/Inel = 0.092 +- 0.45
+
+
   
   // standard correction
   TFile::Open(correctionFileName);
@@ -1045,9 +1091,9 @@ void CreateCorrectionsWithUA5CrossSections(const Char_t* correctionFileName="cor
   
   Printf("Ratios in the correction map are: ND=%f, DD=%f, SD=%f", nd, dd, sd);
   
-  Float_t scaleND = ua5_ND / nd;
-  Float_t scaleDD = ua5_DD / dd;
-  Float_t scaleSD = ua5_SD / sd;
+  Float_t scaleND = ref_ND / nd;
+  Float_t scaleDD = ref_DD / dd;
+  Float_t scaleSD = ref_SD / sd;
   
   Printf("ND=%.2f, DD=%.2f, SD=%.2f",scaleND, scaleDD, scaleSD);
 
index 62bfddf5da7e0afc500d8d98fb433f6107e127ac..77479248b835a75f1ecb365db9e859926d4c2b6d 100644 (file)
@@ -19,7 +19,7 @@ void Load(const char* taskName, Bool_t debug)
     AliLog::SetClassDebugLevel(taskName, AliLog::kWarning);
 }
 
-void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Bool_t mc = kTRUE, const char* option = "")
+void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Int_t requiredData = 1, const char* option = "", const char* requireClass = "", const char* rejectClass = "")
 {
   // runWhat options: 0 = AlidNdEtaTask
   //                  1 = AlidNdEtaCorrectionTask
@@ -29,6 +29,10 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
   //                1 proof with chain
   //                2 proof with dataset
   //
+  // requiredData option: 0 = only ESD
+  //                      1 = ESD+MC
+  //                      2 = RAW (ESD+check on event type)
+  //
   // option is passed to the task(s)
   //   option SAVE is removed and results in moving the output files to maps/<ds name>/<trigger>/<det>
   //
@@ -41,7 +45,7 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
   if (runWhat == 1 || runWhat == 2)
   {
     Printf("Running AlidNdEtaCorrectionTask");
-    if (!mc)
+    if (requiredData != 1)
     {
       Printf("AlidNdEtaCorrectionTask needs MC. Exiting...");
       return;
@@ -53,9 +57,12 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
 
   if (aProof)
   {
+    TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a"); 
     TProof::Open("alicecaf"); 
-    //gProof->SetParallel(1);
+    //gProof->SetParallel(2);
+    //gProof->SetParameter("PROOF_Packetizer", "TPacketizer");
 
+    Bool_t fullAliroot = kFALSE;
     // Enable the needed package
     if (1)
     {
@@ -70,10 +77,21 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
       gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
       gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
     }
+    else if (!fullAliroot)
+    {
+      gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par");
+      gProof->EnablePackage("AF-v4-18-12-AN");
+    }
     else
     {
-      gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release/AF-v4-17");
-      gProof->EnablePackage("AF-v4-17");
+      // needed if ITS recpoints are accessed, see AlidNdEtaTask, FULLALIROOT define statement
+      gProof->UploadPackage("$ALICE_ROOT/v4-18-12-AN-all.par");
+      gProof->EnablePackage("v4-18-12-AN-all");
+    
+      gProof->Exec("TGrid::Connect(\"alien://\")", kTRUE);
+      
+      // TODO add this to loadlibs.C
+      gProof->Exec("gSystem->Load(\"libXMLParser\")", kTRUE);
     }
 
     gProof->UploadPackage("$ALICE_ROOT/PWG0base");
@@ -97,10 +115,13 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
   mgr = new AliAnalysisManager;
 
   // Add ESD handler
-  //AliESDInputHandler* esdH = new AliESDInputHandler;
-  AliESDInputHandler* esdH = new AliESDInputHandlerRP; // for RecPoints
   
-  esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDVZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades AliESDTZERO ALIESDACORDE MuonTracks TrdTracks CaloClusters");
+  if (fullAliroot)
+    AliESDInputHandler* esdH = new AliESDInputHandlerRP; // for RecPoints
+  else
+    AliESDInputHandler* esdH = new AliESDInputHandlerRP;
+  
+  esdH->SetInactiveBranches("AliESDACORDE FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades ALIESDACORDE MuonTracks TrdTracks CaloClusters");
   mgr->SetInputEventHandler(esdH);
 
   AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn;
@@ -139,7 +160,7 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
     Load("AlidNdEtaTask", aDebug);
     task = new AlidNdEtaTask(optStr);
 
-    if (mc)
+    if (requiredData == 1)
       task->SetReadMC();
 
     // syst. error flags
@@ -154,7 +175,9 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
     task->SetTrackCuts(esdTrackCuts);
     //task->SetDeltaPhiCut(0.05);
     
-    task->SetCheckEventType();
+    if (requiredData == 2)
+      task->SetCheckEventType();
+    task->SetTriggerClasses(requireClass, rejectClass);
 
     mgr->AddTask(task);
 
@@ -190,7 +213,7 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
     mgr->ConnectOutput(task2, 0, cOutput);
   }
 
-  if (mc) {
+  if (requiredData == 1) {
     // Enable MC event handler
     AliMCEventHandler* handler = new AliMCEventHandler;
     handler->SetReadTR(kFALSE);
@@ -227,6 +250,13 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
         default: Printf("ERROR: Trigger undefined for path to files"); return;
       }
       
+      if (strlen(requireClass) > 0 && strlen(rejectClass) == 0)
+      {
+        path += Form("/%s", requireClass);
+      }
+      else if (strlen(rejectClass) > 0)
+        path += Form("/%s--%s", requireClass, rejectClass);
+      
       if (analysisMode & AliPWG0Helper::kSPD)
         path += "/spd";
       
@@ -237,7 +267,7 @@ void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool
       if (runWhat == 0 || runWhat == 2)
       {
         gSystem->Rename("analysis_esd_raw.root", path + "/analysis_esd_raw.root");
-        if (mc)
+        if (requiredData == 1)
           gSystem->Rename("analysis_mc.root", path + "/analysis_mc.root");
       }
       if (runWhat == 1 || runWhat == 2)
index 1d3ad5de185beef130e645b7117e26081622f88f..54484e58e1fbbb6fe20bbd257f1e68c9d2e85771 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash
-rm analysis_{mc,esd,esd_raw}.root correction_map.root
-root.exe -b -q 'run.C(2,"'$1'",-1,0,0,2,1,"")'
-aliroot correct.C
+
+for I in CINT1A-ABCE-NOPF-ALL CINT1C-ABCE-NOPF-ALL CINT1-E-NOPF-ALL
+#for I in CINT1B-ABCE-NOPF-ALL CINT1A-ABCE-NOPF-ALL CINT1C-ABCE-NOPF-ALL CINT1-E-NOPF-ALL
+do
+  root -b -q 'run.C(0, "/PWG0/jgrosseo/run", -1, 0, 0, 2, 2, "SAVE", "'$I'")'
+done
+