]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fixes for MC and MC QA
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 3 Apr 2011 09:58:38 +0000 (09:58 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 3 Apr 2011 09:58:38 +0000 (09:58 +0000)
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskPIDflowQA.cxx
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h
PWG2/FLOW/macros/AddTaskFlowCentralityPID.C
PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C
PWG2/FLOW/macros/runFlowTaskCentralityTrain.C

index 146d50d09438e8f85bc5ec1e9f8b4b6670764452..b32fe6587af0d952c195a0a879a623357410d608 100644 (file)
@@ -376,12 +376,14 @@ void  AliAnalysisTaskPIDflowQA::UserCreateOutputObjects()
     fOutputList->Add(fTPCsignalPmc);
   }
 
-  fTOFtime=new TH2F("fTOFtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 0.4, 1.1);//
+  fTOFtime=new TH2F("fTOFtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
   fOutputList->Add(fTOFtime);
-  fTOFtimeE=new TH2F("fTOFtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,500, -0.25, 0.25);//
-  fTOFtimePi=new TH2F("fTOFtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,500, -0.25, 0.25);//
-  fTOFtimeK=new TH2F("fTOFtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,500, -0.25, 0.25);//
-  fTOFtimeP=new TH2F("fTOFtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,500, -0.25, 0.25);//
+  fTOFtime=new TH2F("fTOFtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
+  fOutputList->Add(fTOFtime);
+  fTOFtimeE=new TH2F("fTOFtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,500, -8000, 8000);//
+  fTOFtimePi=new TH2F("fTOFtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,500, -8000, 8000);//
+  fTOFtimeK=new TH2F("fTOFtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,500, -8000, 8000);//
+  fTOFtimeP=new TH2F("fTOFtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,500, -8000, 8000);//
   //fOutputList->Add(fTOFtimeE);
   //fOutputList->Add(fTOFtimePi);
   //fOutputList->Add(fTOFtimeK);
@@ -544,28 +546,28 @@ void  AliAnalysisTaskPIDflowQA::UserCreateOutputObjects()
   fCutsTOFProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbeta);
   fCutsTOFProtons->SetQA();
   fCutsTPCElectrons = new AliFlowTrackCuts("tpc electron cuts");
-  fCutsTPCElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCdedx);
+  fCutsTPCElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCpid);
   fCutsTPCElectrons->SetQA();
   fCutsTPCPions = new AliFlowTrackCuts("tpc pion cuts");
-  fCutsTPCPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCdedx);
+  fCutsTPCPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
   fCutsTPCPions->SetQA();
   fCutsTPCKaons = new AliFlowTrackCuts("tpc kaon cuts");
-  fCutsTPCKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCdedx);
+  fCutsTPCKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCpid);
   fCutsTPCKaons->SetQA();
   fCutsTPCProtons = new AliFlowTrackCuts("tpc proton cuts");
-  fCutsTPCProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCdedx);
+  fCutsTPCProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCpid);
   fCutsTPCProtons->SetQA();
 
   //fOutputList->Add(fESDpid);
 
-  fOutputList->Add(fCutsTPCElectrons);
-  fOutputList->Add(fCutsTPCPions);
-  fOutputList->Add(fCutsTPCKaons);
-  fOutputList->Add(fCutsTPCProtons);
-  fOutputList->Add(fCutsTOFElectrons);
-  fOutputList->Add(fCutsTOFPions);
-  fOutputList->Add(fCutsTOFKaons);
-  fOutputList->Add(fCutsTOFProtons);
+  fOutputList->Add(fCutsTPCElectrons->GetQA());
+  fOutputList->Add(fCutsTPCPions->GetQA());
+  fOutputList->Add(fCutsTPCKaons->GetQA());
+  fOutputList->Add(fCutsTPCProtons->GetQA());
+  fOutputList->Add(fCutsTOFElectrons->GetQA());
+  fOutputList->Add(fCutsTOFPions->GetQA());
+  fOutputList->Add(fCutsTOFKaons->GetQA());
+  fOutputList->Add(fCutsTOFProtons->GetQA());
 
   if (fUseDebugFile) fFile = fopen("debug.txt","w");
 
@@ -810,9 +812,8 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
                      (track->GetStatus() & AliESDtrack::kTOFpid) &&
                      (track->GetTOFsignal() > 12000) &&
                      (track->GetTOFsignal() < 100000) &&
-                     (track->GetIntegratedLength() > 365) &&
-                     !(track->GetStatus() & AliESDtrack::kTOFmismatch);
-
+                     (track->GetIntegratedLength() > 365);
+  
   if (!goodtrack) return;
 
   const AliExternalTrackParam* innerParam = track->GetInnerParam();
@@ -828,6 +829,12 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
   Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
   track->GetIntegratedTimes(integratedTimes);
 
+  Double_t tpcpid[AliPID::kSPECIES];
+  track->GetTPCpid(tpcpid);
+
+  if (track->GetStatus() & AliESDtrack::kTOFmismatch) return;
+
+
   //beta
   Float_t beta = l/timeTOF/c;
   Float_t betaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
@@ -849,6 +856,8 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
   }
 
   //responses
+  fTOFtime->Fill(p,timeTOF);
+
   fTOFbeta->Fill(p,beta);
   fTOFbetaE->Fill(p,betadiff[0]);
   fTOFbetaPi->Fill(p,betadiff[2]);
@@ -888,6 +897,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
         fTOFyieldSelEmcP->Fill(pt);
       }
     }
+    printf("electron: pt: %.1f | %.1f, %.1f, %.1f, %.1f, %.1f\n",pt,tpcpid[0],tpcpid[1],tpcpid[2],tpcpid[3],tpcpid[4]);
   }
   if (fCutsTOFPions->IsSelected(track)) 
   {
@@ -917,6 +927,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
         fTOFyieldSelPimcP->Fill(pt);
       }
     }
+    printf("pion    : pt: %.1f | %.1f, %.1f, %.1f, %.1f, %.1f\n",pt,tpcpid[0],tpcpid[1],tpcpid[2],tpcpid[3],tpcpid[4]);
   }
   if (fCutsTOFKaons->IsSelected(track)) 
   {
@@ -946,6 +957,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
         fTOFyieldSelKmcP->Fill(pt);
       }
     }
+    printf("kaon    : pt: %.1f | %.1f, %.1f, %.1f, %.1f, %.1f\n",pt,tpcpid[0],tpcpid[1],tpcpid[2],tpcpid[3],tpcpid[4]);
   }
   if (fCutsTOFProtons->IsSelected(track)) 
   {
@@ -975,6 +987,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
         fTOFyieldSelPmcP->Fill(pt);
       }
     }
+    printf("proton  : pt: %.1f | %.1f, %.1f, %.1f, %.1f, %.1f\n",pt,tpcpid[0],tpcpid[1],tpcpid[2],tpcpid[3],tpcpid[4]);
   }
 
 }
index b31dcf7d581dd027c8eacec51cfa98be9b0ea324..aeef079ebb6ad3e5ae0df640a7055e50d05df022 100644 (file)
@@ -63,6 +63,7 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fAliESDtrackCuts(NULL),
   fQA(NULL),
   fCutMC(kFALSE),
+  fCutMChasTrackReferences(kFALSE),
   fCutMCprocessType(kFALSE),
   fMCprocessType(kPNoProcess),
   fCutMCPID(kFALSE),
@@ -130,6 +131,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fAliESDtrackCuts(NULL),
   fQA(NULL),
   fCutMC(kFALSE),
+  fCutMChasTrackReferences(kFALSE),
   fCutMCprocessType(kFALSE),
   fMCprocessType(kPNoProcess),
   fCutMCPID(kFALSE),
@@ -205,6 +207,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fAliESDtrackCuts(NULL),
   fQA(NULL),
   fCutMC(that.fCutMC),
+  fCutMChasTrackReferences(that.fCutMChasTrackReferences),
   fCutMCprocessType(that.fCutMCprocessType),
   fMCprocessType(that.fMCprocessType),
   fCutMCPID(that.fCutMCPID),
@@ -285,6 +288,7 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
   //these guys we don't need to copy, just reinit
   if (that.fQA) {fQA->Delete(); delete fQA; fQA=NULL; DefineHistograms();} 
   fCutMC=that.fCutMC;
+  fCutMChasTrackReferences=that.fCutMChasTrackReferences;
   fCutMCprocessType=that.fCutMCprocessType;
   fMCprocessType=that.fMCprocessType;
   fCutMCPID=that.fCutMCPID;
@@ -508,6 +512,10 @@ Bool_t AliFlowTrackCuts::PassesMCcuts(AliMCEvent* mcEvent, Int_t label)
     Int_t processID = particle->GetUniqueID();
     if (processID != fMCprocessType ) return kFALSE;
   }
+  if (fCutMChasTrackReferences)
+  {
+    if (mcparticle->GetNumberOfTrackReferences()<1) return kFALSE;
+  }
   return kTRUE;
 }
 
@@ -563,6 +571,7 @@ Bool_t AliFlowTrackCuts::PassesCuts(AliVParticle* vparticle)
   Bool_t pass=kTRUE;
   //check the common cuts for the current particle fTrack (MC,AOD,ESD)
   Double_t pt = fTrack->Pt();
+  Double_t p = fTrack->P();
   if (!fFakesAreOK) {if (fTrackLabel<0) pass=kFALSE;}
   if (fCutPt) {if (pt < fPtMin || pt >= fPtMax ) pass=kFALSE;}
   if (fCutEta) {if (fTrack->Eta() < fEtaMin || fTrack->Eta() >= fEtaMax ) pass=kFALSE;}
@@ -584,6 +593,32 @@ Bool_t AliFlowTrackCuts::PassesCuts(AliVParticle* vparticle)
   if (esdTrack) { if (!PassesESDcuts(esdTrack)) { pass=kFALSE; } }
   if (aodTrack) { if (!PassesAODcuts(aodTrack)) { pass=kFALSE; } }
 
+  if (fQA)
+  {
+    Float_t pdg = 0;
+    Int_t pdgcode = fMCparticle->PdgCode();
+    switch (TMath::Abs(pdgcode))
+    {
+      case 11:
+        pdg = AliPID::kElectron + 0.5; break;
+      case 13:
+        pdg = AliPID::kMuon + 0.5; break;
+      case 211:
+        pdg = AliPID::kPion + 0.5; break;
+      case 321:
+        pdg = AliPID::kKaon + 0.5; break;
+      case 2212:
+        pdg = AliPID::kProton + 0.5; break;
+      default:
+        pdg = AliPID::kUnknown + 0.5; break;
+    }
+    pdg = TMath::Sign(pdg,static_cast<Float_t>(pdgcode));
+    if (fMCparticle) QAbefore(2)->Fill(p,pdg);
+    if (fMCparticle) QAbefore(3)->Fill(p,IsPhysicalPrimary()?0.5:-0.5);
+    if (fMCparticle && pass) QAafter(2)->Fill(p,pdg);
+    if (fMCparticle && pass) QAafter(3)->Fill(p,IsPhysicalPrimary()?0.5:-0.5);
+  }
+
   //true by default, if we didn't set any cuts
   return pass;
 }
@@ -1289,10 +1324,14 @@ void AliFlowTrackCuts::DefineHistograms()
   after->SetName("after");
   fQA->Add(before);
   fQA->Add(after);
-  before->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1));
-  after->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1));
-  before->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500));
-  after->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500));
+  before->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1)); //0
+  after->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1)); //0
+  before->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500)); //1
+  after->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500)); //1
+  before->Add(new TH2F("MC pid",";p[GeV/c];species",kNbinsP,binsP,10,-5, 5)); //2
+  after->Add(new TH2F("MC pid",";p[GeV/c];species",kNbinsP,binsP,10,-5, 5)); //2
+  before->Add(new TH2F("MC primary",";p[GeV/c];primary",kNbinsP,binsP,2,-1,1)); //3
+  after->Add(new TH2F("MC primary",";p[GeV/c];primary",kNbinsP,binsP,2,-1,1)); //3
   TH1::AddDirectory(adddirstatus);
 }
 
@@ -2325,3 +2364,4 @@ Long64_t AliFlowTrackCuts::Merge(TCollection* list)
   }
   return number;
 }
+
index 0b8994337a1a98cabe7087ead2fad8242d33a971..7706ad0f1a4764498c504be14ce16de7c5f084d2 100644 (file)
@@ -143,6 +143,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   //MC stuff
   void SetIgnoreSignInMCPID( Bool_t b ) {fIgnoreSignInMCPID=b;}
   void SetCutMC( Bool_t b=kTRUE );
+  void SetCutMChasTrackReferences(Bool_t b=kTRUE) {fCutMChasTrackReferences=b;}
   void SetMCprocessType( TMCProcess t ) { fMCprocessType = t; fCutMCprocessType=kTRUE; SetCutMC();}
   void SetMCisPrimary( Bool_t b ) { fMCisPrimary=b; fCutMCisPrimary=kTRUE; SetCutMC();}
   void SetMCPID( Int_t pid ) { fMCPID=pid; fCutMCPID=kTRUE; SetCutMC(); }
@@ -228,6 +229,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   AliESDtrackCuts* fAliESDtrackCuts; //alianalysis cuts
   TList* fQA;                        //qa histograms go here
   Bool_t fCutMC;                     //do we cut on MC?
+  Bool_t fCutMChasTrackReferences;   //did we leave a trace in the detector?
   Bool_t fCutMCprocessType;          //do we cut on mc process type?
   TMCProcess fMCprocessType;         //mc process type
   Bool_t fCutMCPID;                  //cut on MC pid?
@@ -296,7 +298,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   static const Int_t fgkNumberOfV0tracks=64; //number of V0 channels
 
-  ClassDef(AliFlowTrackCuts,7)
+  ClassDef(AliFlowTrackCuts,8)
 };
 
 #endif
index 9794159dc7d728966c5b0ceb92dac36a940dab9e..c8aaf8f0d752823a0c9f4885746a1dd257669c85 100644 (file)
@@ -14,7 +14,8 @@ void AddTaskFlowCentralityPID( Float_t centrMin=0.,
                                AliFlowTrackCuts::PIDsource sourcePID = AliFlowTrackCuts::kTOFpid,
                                Int_t charge=0,
                                Int_t harmonic=2,
-                               Bool_t doQA=kFALSE )
+                               Bool_t doQA=kFALSE,
+                               TString uniqueStr="" )
 {
   // Define the range for eta subevents (for SP method)
   Double_t minA = -0.9;
@@ -141,6 +142,7 @@ void AddTaskFlowCentralityPID( Float_t centrMin=0.,
   cutsPOI->SetQA(doQA);
 
   TString outputSlotName("");
+  outputSlotName+=uniqueStr;
   outputSlotName+=Form("V%i ",harmonic);
   outputSlotName+=cutsRP->GetName();
   outputSlotName+=" ";
@@ -433,8 +435,10 @@ void AddTaskFlowCentralityPID( Float_t centrMin=0.,
  
   if (taskFE->GetQAOn())
   {
+    TString outputQA = fileName;
+    outputQA += ":QA";
     AliAnalysisDataContainer* coutputFEQA = 
-    mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:QA",fileName));
+    mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA);
     mgr->ConnectOutput(taskFE,2,coutputFEQA);
   }
 
index 78ec24712af271e09a7fab342f3dee3e2298cd8e..917284e5424634227a6911a2442a5193f37cd74b 100644 (file)
@@ -22,7 +22,7 @@ void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid,
                                     Bool_t useFlowParFiles = kTRUE,
                                     Bool_t DATA = kTRUE,
                                     //const Char_t* dataDir="/data/alice2/ab/grid/21-16/TEST/data/",
-                                    const Char_t* dataDir="/data/alice2/mikolaj/flowPaper/data/137161/",
+                                    const Char_t* dataDir="fileList",
                                     Int_t nEvents = 1e4,
                                     Int_t offset=0 )
 {
@@ -70,7 +70,9 @@ void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid,
 
   //Add the centrality determination task
   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
-  AddTaskCentrality();
+  AliCentralitySelectionTask* centSelTask = AddTaskCentrality();
+  if (!DATA) centSelTask->SetMCInput();
+
 
   //Add the TOF tender
   gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskTenderTOF.C");
index 27c610526578589b899b7bd3e6ea441568c47732..fd4c7e92c6ab6f6666534364ea61aa0bf9574e47 100644 (file)
@@ -69,7 +69,9 @@ void runFlowTaskCentralityTrain( Int_t mode = mPROOF,
 
   //Add the centrality determination task
   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
-  AddTaskCentrality();
+  AliCentralitySelectionTask* centSelTask = AddTaskCentrality();
+  if (!DATA) centSelTask->SetMCInput();
+
 
   if (useTender)
   {