Update of the flatenning task and macros
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Jul 2012 21:14:16 +0000 (21:14 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Jul 2012 21:14:16 +0000 (21:14 +0000)
PWGPP/VZERO/AliAnaVZEROEPFlatenning.cxx
PWGPP/VZERO/FillVZEROEPOADBFull.C [new file with mode: 0644]
PWGPP/VZERO/runAnaEPFlatenningProof.C

index e9bb978..2c8de00 100644 (file)
@@ -192,14 +192,14 @@ void AliAnaVZEROEPFlatenning::UserExec(Option_t *)
   Bool_t goodEvent = kTRUE;
   Bool_t isSelected;
   if (fUsePhysSel)
-    isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kMB | AliVEvent::kSemiCentral));
+    isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral));
   else
     isSelected = ((esdV0->GetV0ADecision()==1) && (esdV0->GetV0CDecision()==1));
 
   if (!isSelected) goodEvent = kFALSE;
 
   AliCentrality *centrality = fEvent->GetCentrality();
-  //  Float_t percentile = centrality->GetCentralityPercentile("V0M");
+  //  Float_t spdPercentile = centrality->GetCentralityPercentile("V0M");
   Float_t spdPercentile = centrality->GetCentralityPercentile("CL1");
 
   TString inputDataType = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -301,12 +301,14 @@ void AliAnaVZEROEPFlatenning::UserExec(Option_t *)
       fX2[8]->Fill(spdPercentile,c2A);
       fY2[8]->Fill(spdPercentile,s2A);
       fX2Y2[8]->Fill(spdPercentile,c2A*s2A);
-      fX2Corr[8]->Fill(spdPercentile,qxA);
-      fY2Corr[8]->Fill(spdPercentile,qyA);
-      fX2Y2Corr[8]->Fill(spdPercentile,qxA*qyA);
       Double_t psiA = TMath::ATan2(qyA,qxA)/2.;
       fPsiAFlatCentr->Fill(spdPercentile,psiA);
-      Double_t psiAOrg = fEvent->GetEventplane()->GetEventplane("V0A",fEvent,2);
+      //      Double_t psiAOrg = fEvent->GetEventplane()->GetEventplane("V0A",fEvent,2);
+      Double_t qxEP = 0, qyEP = 0;
+      Double_t psiAOrg = fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent,8,2,qxEP,qyEP);
+      fX2Corr[8]->Fill(spdPercentile,qxEP);
+      fY2Corr[8]->Fill(spdPercentile,qyEP);
+      fX2Y2Corr[8]->Fill(spdPercentile,qxEP*qyEP);
       fPsiARawCentr->Fill(spdPercentile,psiAOrg);
       fCos8Psi[8]->Fill(spdPercentile, 2./4.*TMath::Cos(2.*4.*psiAOrg));
     }
@@ -314,12 +316,14 @@ void AliAnaVZEROEPFlatenning::UserExec(Option_t *)
       fX2[9]->Fill(spdPercentile,c2C);
       fY2[9]->Fill(spdPercentile,s2C);
       fX2Y2[9]->Fill(spdPercentile,c2C*s2C);
-      fX2Corr[9]->Fill(spdPercentile,qxC);
-      fY2Corr[9]->Fill(spdPercentile,qyC);
-      fX2Y2Corr[9]->Fill(spdPercentile,qxC*qyC);
       Double_t psiC = TMath::ATan2(qyC,qxC)/2.;
       fPsiCFlatCentr->Fill(spdPercentile,psiC);
-      Double_t psiCOrg = fEvent->GetEventplane()->GetEventplane("V0C",fEvent,2);
+      //      Double_t psiCOrg = fEvent->GetEventplane()->GetEventplane("V0C",fEvent,2);
+      Double_t qxEP = 0, qyEP = 0;
+      Double_t psiCOrg = fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent,9,2,qxEP,qyEP);
+      fX2Corr[9]->Fill(spdPercentile,qxEP);
+      fY2Corr[9]->Fill(spdPercentile,qyEP);
+      fX2Y2Corr[9]->Fill(spdPercentile,qxEP*qyEP);
       fPsiCRawCentr->Fill(spdPercentile,psiCOrg);
       fCos8Psi[9]->Fill(spdPercentile, 2./4.*TMath::Cos(2.*4.*psiCOrg));
    }
@@ -327,12 +331,14 @@ void AliAnaVZEROEPFlatenning::UserExec(Option_t *)
       fX2[10]->Fill(spdPercentile,c2A+c2C);
       fY2[10]->Fill(spdPercentile,s2A+s2C);
       fX2Y2[10]->Fill(spdPercentile,(c2A+c2C)*(s2A+s2C));
-      fX2Corr[10]->Fill(spdPercentile,qxA+qxC);
-      fY2Corr[10]->Fill(spdPercentile,qyA+qyC);
-      fX2Y2Corr[10]->Fill(spdPercentile,(qxA+qxC)*(qyA+qyC));
       Double_t psiAC = TMath::ATan2(qyA+qyC,qxA+qxC)/2.;
       fPsiACFlatCentr->Fill(spdPercentile,psiAC);
-      Double_t psiACOrg = fEvent->GetEventplane()->GetEventplane("V0",fEvent,2);
+      //      Double_t psiACOrg = fEvent->GetEventplane()->GetEventplane("V0",fEvent,2);
+      Double_t qxEP = 0, qyEP = 0;
+      Double_t psiACOrg = fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent,10,2,qxEP,qyEP);
+      fX2Corr[10]->Fill(spdPercentile,qxEP);
+      fY2Corr[10]->Fill(spdPercentile,qyEP);
+      fX2Y2Corr[10]->Fill(spdPercentile,qxEP*qyEP);
       fPsiACRawCentr->Fill(spdPercentile,psiACOrg);
       fCos8Psi[10]->Fill(spdPercentile, 2./4.*TMath::Cos(2.*4.*psiACOrg));
     }
diff --git a/PWGPP/VZERO/FillVZEROEPOADBFull.C b/PWGPP/VZERO/FillVZEROEPOADBFull.C
new file mode 100644 (file)
index 0000000..f93abd2
--- /dev/null
@@ -0,0 +1,155 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include "TFile.h"
+#include "TString.h"
+#include "TProfile.h"
+#include "TList.h"
+#include "TSystem.h"
+
+#include "AliOADBContainer.h"
+#include "AliAnalysisManager.h"
+#endif
+
+void FillVZEROEPOADBFull(const char* filename = "AOD083.txt", Bool_t mbOnly = kFALSE)
+{
+  gSystem->Load("libCore.so");  
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libPhysics.so");
+  gSystem->Load("libMinuit");
+  gSystem->Load("libSTEERBase");
+  gSystem->Load("libESD");
+  gSystem->Load("libAOD");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");   
+  gSystem->Load("libOADB");
+
+  AliOADBContainer * oadbCont = new AliOADBContainer("vzeroEP");
+
+  {
+    TList *defaultList = new TList;
+    defaultList->SetName("Default");
+    TProfile *profHisto = NULL;
+    TFile fInputDefault("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000170162.root");
+    TList *inputList = (TList*)fInputDefault.Get("coutput");
+    for(Int_t i = 0; i < 11; ++i) {
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
+      profHisto->SetDirectory(0);
+      defaultList->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
+      profHisto->SetDirectory(0);
+      defaultList->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
+      profHisto->SetDirectory(0);
+      defaultList->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
+      profHisto->SetDirectory(0);
+      defaultList->Add(profHisto);
+    }
+    fInputDefault.Close();
+    oadbCont->AddDefaultObject(defaultList);
+    printf("Run 170162 filled\n");
+  }
+
+  {
+    TList *list1 = new TList;
+    TProfile *profHisto = NULL;
+    TFile fInput1("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000169683.root");
+    TList *inputList = (TList*)fInput1.Get("coutput");
+    for(Int_t i = 0; i < 11; ++i) {
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
+      profHisto->SetDirectory(0);
+      list1->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
+      profHisto->SetDirectory(0);
+      list1->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
+      profHisto->SetDirectory(0);
+      list1->Add(profHisto);
+      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
+      profHisto->SetDirectory(0);
+      list1->Add(profHisto);
+    }
+    oadbCont->AppendObject(list1, 169683, 169683);
+    printf("Run 169683 filled\n");
+  }
+
+  // loop of over all other runs
+  Int_t runList[500];
+  ifstream *fruns = new ifstream (filename);
+  if (!*fruns) return;
+  TString strLine;
+  Int_t count = 0;
+  while (strLine.ReadLine(*fruns)) {
+    runList[count++] = strLine.Atoi();
+  }
+  delete fruns;
+
+  for(Int_t irun = 0; irun < count; ++irun) {
+    TList *list2 = new TList;
+    TProfile *profHisto = NULL;
+    TFile fInput2(Form("csemi/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
+    TList *inputList = (TList*)fInput2.Get("coutput");
+    TFile fInput3(Form("cpbi2/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
+    TList *inputListBis = (TList*)fInput3.Get("coutput");
+    for(Int_t i = 0; i < 11; ++i) {
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
+      profHisto->SetDirectory(0);
+      Int_t ibin = profHisto->FindBin(62.5);
+      profHisto->SetBinContent(ibin,0);
+      profHisto->SetBinError(ibin,0);
+      profHisto->SetBinEntries(ibin,0);
+      if (mbOnly) {
+       profHisto = (TProfile*)inputListBis->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
+       profHisto->SetDirectory(0);
+      }
+      else
+       profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2_%d",i)));
+      list2->Add(profHisto);
+
+      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
+      profHisto->SetDirectory(0);
+      profHisto->SetBinContent(ibin,0);
+      profHisto->SetBinError(ibin,0);
+      profHisto->SetBinEntries(ibin,0);
+      if (mbOnly) {
+       profHisto = (TProfile*)inputListBis->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
+       profHisto->SetDirectory(0);
+      }
+      else
+       profHisto->Add((TProfile*)inputListBis->FindObject(Form("fY2_%d",i)));
+      list2->Add(profHisto);
+
+      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
+      profHisto->SetDirectory(0);
+      profHisto->SetBinContent(ibin,0);
+      profHisto->SetBinError(ibin,0);
+      profHisto->SetBinEntries(ibin,0);
+      if (mbOnly) {
+       profHisto = (TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
+       profHisto->SetDirectory(0);
+      }
+      else
+       profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i)));
+      list2->Add(profHisto);
+
+      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
+      profHisto->SetDirectory(0);
+      profHisto->SetBinContent(ibin,0);
+      profHisto->SetBinError(ibin,0);
+      profHisto->SetBinEntries(ibin,0);
+      if (mbOnly) {
+       profHisto = (TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
+       profHisto->SetDirectory(0);
+      }
+      else
+       profHisto->Add((TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i)));
+      list2->Add(profHisto);
+    }
+    oadbCont->AppendObject(list2, runList[irun], runList[irun]);
+    printf("Run %d filled\n",runList[irun]);
+  }
+
+  TString oadbFileName = Form("%s/COMMON/EVENTPLANE/data/vzero.root", AliAnalysisManager::GetOADBPath());
+  oadbCont->WriteToFile(oadbFileName.Data());
+}
index b859660..a5e4514 100644 (file)
@@ -16,23 +16,42 @@ void runAnaEPFlatenningProof(Int_t mode = 0, const char *folder = "/alice/data",
     Char_t *alienuser = gSystem->Getenv("alien_API_USER");
     cout<<"==> Your AliEn username is: "<<alienuser<<endl;
 
+    //    TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-33-02a");
+
     TProof *p = TProof::Open(alienuser!=0 ? Form("%s@alice-caf.cern.ch",
                                                 alienuser) : "alice-caf.cern.ch",
                             workers>0 ? Form("workers=%d",workers) : "");
 
-    gProof->EnablePackage("VO_ALICE@AliRoot::v5-02-16-AN");
+    gProof->EnablePackage("VO_ALICE@AliRoot::v5-03-23-AN");
+
+    if (1) {
+      gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE);
+      gSystem->Setenv("OADB_PATH","alien:///alice/cern.ch/user/c/cheshkov/OADB");
+      gProof->Exec("gSystem->Setenv(\"OADB_PATH\",\"alien:///alice/cern.ch/user/c/cheshkov/OADB\")",kTRUE);
+    }
   }
 
   // Create the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("EPFlatenningAnalysis");
 
-  AliESDInputHandler* esdH = new AliESDInputHandler();
-  esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend.fTracks Kinks MuonTracks TrdTracks");
-  esdH->SetReadFriends(kFALSE);
-  mgr->SetInputEventHandler(esdH);
+  Bool_t esdData = kTRUE;
+  TString tempStr1 = folder;
+  if (tempStr1.Contains("AOD")) esdData = kFALSE;
+  TString tempStr2 = dataset;
+  if (tempStr2.Contains("AOD")) esdData = kFALSE;
+  if (esdData) {
+    AliESDInputHandler* esdH = new AliESDInputHandler();
+    esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend.fTracks Kinks MuonTracks TrdTracks");
+    esdH->SetReadFriends(kFALSE);
+    mgr->SetInputEventHandler(esdH);
+  }
+  else {
+    AliAODInputHandler* aodH = new AliAODInputHandler();
+    mgr->SetInputEventHandler(aodH);
+  }
 
   // physics and centrality selection
-  if (usePS) {
+  if (esdData && usePS) {
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
     AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(kFALSE);
   }
@@ -42,6 +61,12 @@ void runAnaEPFlatenningProof(Int_t mode = 0, const char *folder = "/alice/data",
 
   // Create task
   if (mode==0 || mode==2) {
+    if (0) {
+      gProof->Load(Form("%s/STEER/STEERBase/AliEventplane.cxx++g",
+                       gSystem->Getenv("ALICE_ROOT")));
+      gProof->Load(Form("%s/ANALYSIS/AliVZEROEPSelectionTask.cxx++g",
+                       gSystem->Getenv("ALICE_ROOT")));
+    }
     gProof->Load(Form("%s/AliAnaVZEROEPFlatenning.cxx++g",
                      gSystem->pwd()));
   }
@@ -49,10 +74,14 @@ void runAnaEPFlatenningProof(Int_t mode = 0, const char *folder = "/alice/data",
     gROOT->LoadMacro(Form("%s/AliAnaVZEROEPFlatenning.cxx++g",
                          gSystem->pwd()));
   }
+
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
+  AliVZEROEPSelectionTask *selTask = AddTaskVZEROEPSelection();
+
   AliAnaVZEROEPFlatenning *task = new AliAnaVZEROEPFlatenning("AliAnaVZEROEPFlatenning");
   task->SetMBTrigName(minBias);
   if (usePS) task->SetUsePhysSel(kTRUE);
-  task->SetInput("VZERO.EPFlatenning.PS.LHC11h_000169683_p1_muon_ESDs.root");
+  task->SetInput("/home/cheshkov/alice/AliRoot/PWGPP/VZERO/save/VZERO.EPFlatenning.PS.LHC11h_000170162_p1_muon_.root");
   
   // Add task
   mgr->AddTask(task);
@@ -67,7 +96,6 @@ void runAnaEPFlatenningProof(Int_t mode = 0, const char *folder = "/alice/data",
   mgr->ConnectInput(task, 0, cinput);
   mgr->ConnectOutput(task, 1, coutput);
 
-
   // Enable debug printouts
   mgr->SetDebugLevel(3);