Next lego train
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2012 10:43:08 +0000 (10:43 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2012 10:43:08 +0000 (10:43 +0000)
PWGHF/hfe/macros/AddTaskHFEtpctofPbPb.C
PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C

index 5550f3e..36ff1bc 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTask *AddTaskHFEtpctofPbPb(Bool_t isMC,Int_t aodfilter=-1, Int_t tpcCls=110,  Int_t tpcClsPID = 70, Double_t tpcClsRatio = 0.6, Double_t tpcClShared = 0.1, Int_t itsCls=4,Double_t itsChi2PerClusters=36.,Int_t itspixelcut=AliHFEextraCuts::kAny, Double_t dcaxy=1.0, Double_t dcaz=2.0, Double_t tofs=3., Double_t ipSig=3.0, Float_t prodlow=0., Float_t prodhigh=100., Bool_t beauty=kTRUE,Bool_t kMCQA = kFALSE, Bool_t kDEStep = kFALSE, Int_t addflag=0,Int_t etacor=0,TString listname=""){
+AliAnalysisTask *AddTaskHFEtpctofPbPb(Bool_t isaod, Bool_t isMC,Int_t aodfilter=-1, Int_t tpcCls=120,  Int_t tpcClsPID = 80, Double_t tpcClsRatio = 0.6, Double_t tpcClShared = 1.1, Int_t itsCls=4,Double_t itsChi2PerClusters=36.,Int_t itspixelcut=AliHFEextraCuts::kBoth, Double_t dcaxy=1.0, Double_t dcaz=2.0, Bool_t usetof=kFALSE, Double_t tofs=3.,Bool_t etacor=kFALSE,TString listname="",Double_t tpceff=0.5, Float_t prodlow=0., Float_t prodhigh=100.,Bool_t kMCQA = kFALSE){
 
   // libraries in case
   gSystem->Load("libANALYSIS.so");
@@ -7,54 +7,62 @@ AliAnalysisTask *AddTaskHFEtpctofPbPb(Bool_t isMC,Int_t aodfilter=-1, Int_t tpcC
 
   //set config file name
   TString configFile("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C");
-  //TString configFile("/d/alice12/bailhache/AliRootInstallations/11_09_2012/AliRoot/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C");
+  //TString configFile("/d/alice12/bailhache/AliRootInstallations/07_10_2012/AliRoot/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C");
   TString checkconfig="ConfigHFEpbpb";
   if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
     gROOT->LoadMacro(configFile.Data());
 
   
-  // Name of the directory
-  Int_t itpcClsRatio = (Int_t) tpcClsRatio*10;
-  Int_t itpcClShared = (Int_t) tpcClShared*10;
-  Int_t iitsChi2PerClusters = (Int_t) itsChi2PerClusters*10;
-  Int_t idcaxy = (Int_t) dcaxy*10;
-  Int_t idcaz = (Int_t) dcaz*10;
-  Int_t itofs = (Int_t) tofs*10;
-  Int_t iipSig = (Int_t) ipSig;
-  Int_t iprodlow = (Int_t) prodlow;
-  Int_t iprodhigh = (Int_t) prodhigh*10;
-  Int_t ibeauty = 0;
+  // Name 
+  Int_t itpcClsRatio = (Int_t) (tpcClsRatio*10);
+  Int_t itpcClShared = (Int_t) (tpcClShared*10);
+  Int_t iitsChi2PerClusters = (Int_t) (itsChi2PerClusters*10);
+  Int_t idcaxy = (Int_t) (dcaxy*10);
+  Int_t idcaz = (Int_t) (dcaz*10);
+  Int_t itofs = (Int_t) (tofs*10);
+  Int_t iprodlow = (Int_t) (prodlow*10);
+  Int_t iprodhigh = (Int_t) (prodhigh*10);
+  Int_t itof = 0;
   Int_t iMCQA = 0;
-  Int_t iDEStep = 0;
-  if(beauty) ibeauty = 1;
+  Int_t ietacor = 0;
+  Int_t itpceff = (Int_t) (tpceff*10);
+  if(usetof) itof=kTRUE;
   if(kMCQA) iMCQA = 1;
-  if(kDEStep) iDEStep = 1;
-
-
-  TString appendix(TString::Format("a%dT%dTP%dTR%dTS%dI%dIC%dIp%dDCAx%dz%dTOF%dIP%dprodL%dH%dB%dM%dD%da%de%d",aodfilter,tpcCls,tpcClsPID,itpcClsRatio,itpcClShared,itsCls,iitsChi2PerClusters,itspixelcut,idcaxy,idcaz,itofs,iipSig,iprodlow,iprodhigh,ibeauty,iMCQA,iDEStep,addflag,etacor));
+  if(etacor) ietacor = 1;
+  
+  TString appendix(TString::Format("f%dt%dtp%dtr%dts%di%dic%di%ddcaxy%dz%dtof%dts%de%dtpc%dprodlow%dhigh%dmc%d",aodfilter,tpcCls,tpcClsPID,itpcClsRatio,itpcClShared,itsCls,iitsChi2PerClusters,itspixelcut,idcaxy,idcaz,itof,itofs,ietacor,itpceff,iprodlow,iprodhigh,iMCQA));
   printf("appendix %s\n", appendix.Data());
   
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
 
-  // Check the analysis type using the event handlers connected to the analysis manager.
-  //==============================================================================
+  // ESD or AOD
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr->GetInputEventHandler()) {
     printf("AddTaskEventplane", "This task requires an input event handler");
     return NULL;
   }
   TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  Bool_t isaod = kFALSE;
+  if (inputDataType == "AOD") isaod = kTRUE;
 
-  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
-  AliAnalysisTaskHFE *task = ConfigHFEpbpb(isMC,appendix,aodfilter,tpcCls,tpcClsPID,tpcClsRatio,tpcClShared,itsCls,itsChi2PerClusters,itspixelcut,dcaxy,dcaz,tofs,ipSig,prodlow,prodhigh,beauty,kMCQA,kDEStep,addflag,0,etacor,listname);  
+  
+  // TPC cut
+  // 0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100,one more per history
+  // http://www.physi.uni-heidelberg.de/~pachmay/projects/hfe/pid/tpc/
+  // without eta correction 50%
+  Double_t tpcdEdxcutlow[12] = {0.03,0.15,0.24,0.3,0.39,0.48,0.5,0.51,0.5,0.5,0.5,0.5};
+  // with eta correction 50%
+  // Double_t tpcdEdxcutlow[12] = {-0.01,0.076,0.197,0.26,0.298,0.3,0.3,0.3,0.3,0.3,0.3,0.3};
+  Double_t tpcdEdxcuthigh[12] = {3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
 
-  if (inputDataType == "AOD"){
-    task->SetFillNoCuts(kTRUE);
-    task->SetApplyCutAOD(kTRUE);
-  }
 
-   
+  // Task
+  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
+  AliAnalysisTaskHFE *task = ConfigHFEpbpb(isaod,isMC,appendix,aodfilter,tpcCls,tpcClsPID,tpcClsRatio,tpcClShared,itsCls,itsChi2PerClusters,itspixelcut,dcaxy,dcaz,usetof,tofs,etacor,listname,tpcdEdxcutlow,tpcdEdxcuthigh,prodlow,prodhigh,kMCQA);  
+
   mgr->AddTask(task);
 
+
+  // Write Output 
   TString containerName = mgr->GetCommonFileName();
   containerName += ":";
   containerName += appendix.Data();
index 457c78d..f436c55 100644 (file)
@@ -24,28 +24,32 @@ TF1* GetEtaCorrection(TString listname){
 }
 
 
-AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t useMC=kFALSE,
+AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t isaod,
+                                 Bool_t useMC,
                                  TString appendix,
                                  Int_t aodfilter=-1,
                                  UChar_t TPCcl=70, UChar_t TPCclPID = 80, 
                                  Double_t TPCclRatio = 0.6, Double_t TPCclshared = 1.1,
                                  UChar_t ITScl=3,  Double_t ITSchi2perclusters=99999999.,
-                                 Int_t itspixelcut=AliHFEextraCuts::kFirst,
+                                 Int_t itspixelcut=AliHFEextraCuts::kBoth,
                                   Double_t dcaxy=1.0, Double_t dcaz=2.0,
+                                 Bool_t usetof=kFALSE,
                                  Double_t TOFs=3.,
-                                 Double_t IpSig=3.,                              
+                                 Bool_t etacor=kFALSE,TString listname="",
+                                 Double_t* tpcdEdxcutlow=NULL,Double_t* tpcdEdxcuthigh=NULL,
                                  Float_t prodlow=0., Float_t prodhigh=100., 
-                                 Bool_t beauty=kFALSE,
-                                 Bool_t kMCQA = kFALSE, 
-                                 Bool_t kDEStep = kFALSE,
-                                 Int_t addflag=0, Int_t ptbin=0, 
-                                 Int_t etacor=0, TString listname="",
+                                 Bool_t kMCQA = kFALSE,
                                  Int_t nondefaultcentr=0, Float_t* arraycentr=NULL,
-                                 Double_t* tpcdEdxcut=NULL,Double_t tpcu=3.0){
+                                 Int_t ptbin=0){
   //
   // HFE standard task configuration
   //
 
+  for(Int_t k=0; k < 12; k++) {
+    printf("TPC dEdx cut low %f, high %f for %d\n",tpcdEdxcutlow[k],tpcdEdxcuthigh[k],k);
+  }
+
+
   AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts pbpb TOF TPC");
   hfecuts->CreateStandardCuts();
 
@@ -60,10 +64,8 @@ AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t useMC=kFALSE,
   hfecuts->SetCutITSpixel(itspixelcut);
   hfecuts->SetCheckITSLayerStatus(kFALSE);
 
-  hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE,kTRUE);
-  // if(useMC && beauty) hfecuts->SetProductionVertex(prodlow,prodhigh,prodlow,prodhigh);
-  if(useMC) hfecuts->SetProductionVertex(prodlow,prodhigh,prodlow,prodhigh);
-
+ if(useMC) hfecuts->SetProductionVertex(prodlow,prodhigh,prodlow,prodhigh);
   hfecuts->SetMaxImpactParam(dcaxy,dcaz);
 
   // event cuts
@@ -71,7 +73,7 @@ AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t useMC=kFALSE,
   hfecuts->SetVertexRange(10.);
 
   // others
-  hfecuts->SetTOFPIDStep(kTRUE);
+   if(usetof) hfecuts->SetTOFPIDStep(kTRUE);
   //hfecuts->SetMaxChi2perClusterITS(36);
   //hfecuts->SetTOFMISMATCHStep(kTRUE);
   //hfecuts->SetTPCPIDCleanUpStep(kTRUE);
@@ -148,66 +150,62 @@ AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t useMC=kFALSE,
   // Define PID
   AliHFEpid *pid = task->GetPID();
   if(useMC) pid->SetHasMCData(kTRUE);
-  pid->AddDetector("TOF", 0);
-  pid->AddDetector("TPC", 1);
-  //pid->ConfigureTPCrejection();
+  if(usetof){
+    pid->AddDetector("TOF", 0);
+    pid->AddDetector("TPC", 1);
+    //pid->ConfigureTPCrejection();
+  }
+  else {
+    pid->AddDetector("TPC", 0);
+  }
 
+  if(usetof) pid->ConfigureTOF(TOFs);
 
   if(!useMC){
+    Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
+    if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));
     
-    // 0-10% 0.16
-    // 10-20% 0.29
-    // 20-30% 0.38
-    // 30-40% 0.44
-    Double_t paramsTPCdEdxcut[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
-    if((nondefaultcentr!=0) && tpcdEdxcut) memcpy(paramsTPCdEdxcut,tpcdEdxcut,sizeof(paramsTPCdEdxcut));
-
-    if(etacor==1&&nondefaultcentr==0)
-      {
-        Double_t tpcdEdxcutetacor[12]={-0.08, 0.016, 0.12,0.22,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3};
-       memcpy(paramsTPCdEdxcut,tpcdEdxcutetacor,sizeof(paramsTPCdEdxcut));
-      }
-    
+    Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
+    if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));
+
     char *cutmodel;
     cutmodel="pol0";
     
     for(Int_t a=0;a<11;a++)
-    {
-     //   cout << a << " " << paramsTPCdEdxcut[a] << endl;
-       Double_t tpcparam[1]={paramsTPCdEdxcut[a]};
-
-       pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparam,tpcu);
-    }
-
-    if(etacor==1)
+      {
+       //   cout << a << " " << paramsTPCdEdxcut[a] << endl;
+       Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};
+       Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];
+       pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);
+      }
+    
+    if(etacor)
       { 
        // Apply eta correction
        AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
        TF1 *etacorrection = GetEtaCorrection(listname);
        if(etacorrection) tpcpid->SetEtaCorrection(etacorrection);
-       
       }
-
   }
-  pid->ConfigureTOF(TOFs);
-
-  AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
-  if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs);
-
+  
   // QA
   task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
   //task->SetFillSignalOnly(kFALSE);    // for DE pluging for MC
   if(kMCQA) task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
   //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
   //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
-  if(kDEStep) task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
-  if(useMC && addflag==1) task->SetDebugStreaming();
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+  //if(useMC && addflag==1) task->SetDebugStreaming();
 
   task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
 
+  task->SetFillNoCuts(kTRUE);
 
+  if(isaod) {
+    task->SetAODAnalysis();
+    task->SetApplyCutAOD(kTRUE);
+  }
   printf("*************************************\n");
   printf("Configuring task PbPb \n"); 
   //if(isLHC10) printf("Configuring TPC1 Task 2010 :\n");