Update (Chiara)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Apr 2011 20:59:42 +0000 (20:59 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Apr 2011 20:59:42 +0000 (20:59 +0000)
PWG3/vertexingHF/AliAnalysisTaskSED0Mass.cxx
PWG3/vertexingHF/AliAnalysisTaskSEHFQA.cxx
PWG3/vertexingHF/AliAnalysisTaskSEHFQA.h
PWG3/vertexingHF/macros/AddTaskHFQA.C

index 275d10c..623c098 100644 (file)
@@ -608,8 +608,8 @@ void AliAnalysisTaskSED0Mass::UserCreateOutputObjects()
     TH1F* hpospair=new TH1F(namedistr.Data(),"Number of positive pairs",fCuts->GetNPtBins(),-0.5,fCuts->GetNPtBins()-0.5);
     namedistr="hnegpair";
     TH1F* hnegpair=new TH1F(namedistr.Data(),"Number of negative pairs",fCuts->GetNPtBins(),-0.5,fCuts->GetNPtBins()-0.5);
-    fDistr->Add(hpospair);
-    fDistr->Add(hnegpair);
+    fOutputMass->Add(hpospair);
+    fOutputMass->Add(hnegpair);
   }
 
   const char* nameoutput=GetOutputSlot(3)->GetContainer()->GetName();
@@ -618,7 +618,8 @@ void AliAnalysisTaskSED0Mass::UserCreateOutputObjects()
 
   fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
   fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)");
-  fNentries->GetXaxis()->SetBinLabel(3,"nD0Selected");
+  if(fReadMC) fNentries->GetXaxis()->SetBinLabel(3,"nD0Selected");
+  else fNentries->GetXaxis()->SetBinLabel(3,"Dstar<-D0");
   fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS");
   fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1");
   fNentries->GetXaxis()->SetBinLabel(6,"no daughter");
@@ -769,8 +770,11 @@ void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/)
   Int_t nSelectedloose=0,nSelectedtight=0;  
   for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) {
     AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArray->UncheckedAt(iD0toKpi);
-
-    if(d->GetSelectionMap()) if(!d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
+    if(d->GetSelectionMap()) if(!d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)){
+       fNentries->Fill(2);     
+       continue; //skip the D0 from Dstar
+      }
 
     Bool_t unsetvtx=kFALSE;
     if(!d->GetOwnPrimaryVtx()) {
@@ -977,9 +981,7 @@ void AliAnalysisTaskSED0Mass::FillVarHists(AliAODEvent* aod,AliAODRecoDecayHF2Pr
       normalizedDecayLengthxy=decayLengthxy/part->DecayLengthXYError();
 
       ptProng[0]=prong0->Pt(); ptProng[1]=prong1->Pt();
-      // ptProng[0]=part->PtProng(0); ptProng[1]=part->PtProng(1);
       d0Prong[0]=part->Getd0Prong(0); d0Prong[1]=part->Getd0Prong(1);
 
       if(fArray==1) cout<<"LS signal: ERROR"<<endl;
       for (Int_t iprong=0; iprong<2; iprong++){
@@ -1129,13 +1131,12 @@ void AliAnalysisTaskSED0Mass::FillVarHists(AliAODEvent* aod,AliAODRecoDecayHF2Pr
       fillthis="hptB2prongsnoMcut_";
       fillthis+=ptbin;
       ((TH1F*)listout->FindObject(fillthis))->Fill(((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt());
-    ((TH1F*)listout->FindObject(fillthis))->Fill(((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt());
+      ((TH1F*)listout->FindObject(fillthis))->Fill(((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt());
     }
     //apply cut on invariant mass on the pair
     if(TMath::Abs(minvD0-mPDG)<invmasscut || TMath::Abs(minvD0bar-mPDG)<invmasscut){
       if(fSys==0){
-       //ptProng[0]=part->PtProng(0); ptProng[1]=part->PtProng(1);
-       ptProng[0]=((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt(); ptProng[1]=((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt(); 
+       ptProng[0]=((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt(); ptProng[1]=((AliAODTrack*)fDaughterTracks.UncheckedAt(0))->Pt();
        cosThetaStarD0 = part->CosThetaStarD0();
        cosThetaStarD0bar = part->CosThetaStarD0bar();
       }
@@ -1371,12 +1372,12 @@ void AliAnalysisTaskSED0Mass::FillMassHists(AliAODRecoDecayHF2Prong *part, TClon
   //printf("SELECTED\n");
   Int_t ptbin=cuts->PtBin(part->Pt());
 
-  AliAODTrack *prong=(AliAODTrack*)fDaughterTracks.UncheckedAt(0);
-  if(!prong) {
-    AliDebug(2,"No daughter found");
-    return;
-  }
-  else{
+  // AliAODTrack *prong=(AliAODTrack*)fDaughterTracks.UncheckedAt(0);
+  // if(!prong) {
+  //   AliDebug(2,"No daughter found");
+  //   return;
+  // }
+  // else{
     // if(prong->Charge()==1) {
     //   ((TH1F*)fDistr->FindObject("hpospair"))->Fill(fCuts->GetNPtBins()+ptbin);
     //   //fTotPosPairs[ptbin]++;
@@ -1384,7 +1385,7 @@ void AliAnalysisTaskSED0Mass::FillMassHists(AliAODRecoDecayHF2Prong *part, TClon
     //   ((TH1F*)fDistr->FindObject("hnegpair"))->Fill(fCuts->GetNPtBins()+ptbin);
     //   //fTotNegPairs[ptbin]++;
     // }
-  }
+  //  }
  
   // for(Int_t it=0;it<2;it++){
  
index 3a8e451..a767c00 100644 (file)
@@ -68,6 +68,7 @@ AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
   fOutputTrack(0x0),
   fOutputCounters(0x0),
   fOutputCheckCentrality(0x0),
+  fOutputEvSelection(0x0),
   fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
   fCuts(0x0),
   fEstimator(AliRDHFCuts::kCentTRK),
@@ -79,6 +80,7 @@ AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
   fOnOff[0]=kTRUE;
   fOnOff[1]=kTRUE;
   fOnOff[2]=kTRUE;
+  fOnOff[3]=kTRUE;
 }
 
 //____________________________________________________________________________
@@ -89,6 +91,7 @@ AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSE
   fOutputTrack(0x0),
   fOutputCounters(0x0),
   fOutputCheckCentrality(0x0),
+  fOutputEvSelection(0x0),
   fDecayChannel(ch),
   fCuts(0x0),
   fEstimator(AliRDHFCuts::kCentTRK),
@@ -104,6 +107,7 @@ AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSE
   fOnOff[0]=kTRUE;
   fOnOff[1]=kTRUE;
   fOnOff[2]=kTRUE;
+  fOnOff[3]=kTRUE;
 
   // Output slot #1 writes into a TH1F container (number of events)
   DefineOutput(1,TH1F::Class());  //My private output
@@ -138,6 +142,9 @@ AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSE
     // Output slot #6 writes into a TList container (TH1F)
     DefineOutput(6,TList::Class());  //My private output
   }
+
+  if(fOnOff[3]) DefineOutput(7,TList::Class());  //My private output
+
 }
 
 //___________________________________________________________________________
@@ -154,6 +161,8 @@ AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA()
 
   delete fOutputCheckCentrality;
 
+  delete fOutputEvSelection;
+
 }
 
 //___________________________________________________________________________
@@ -429,13 +438,30 @@ void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
     }
   }
 
+  //event selection (z vertex for the moment)
+  if(fOnOff[3]){
+    fOutputEvSelection=new TList();
+    fOutputEvSelection->SetOwner();
+    fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
+    AliCounterCollection *evselection=new AliCounterCollection("evselection");
+    evselection->AddRubric("run",500000);
+    evselection->AddRubric("evnonsel","zvtx");
+    evselection->Init();
+
+    TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20);
+
+    fOutputEvSelection->Add(evselection);
+    fOutputEvSelection->Add(hzvtx);
+  }
+
   // Post the data
   PostData(1,fNEntries);
   if(fOnOff[1]) PostData(2,fOutputPID);
   if(fOnOff[0]) PostData(3,fOutputTrack);
   PostData(4,fCuts);
   if(fOnOff[2]) PostData(5,fOutputCounters);
-  
+  if(fOnOff[3]) PostData(7,fOutputEvSelection);
+
   if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
 }
 
@@ -602,10 +628,6 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
       break; 
     }
   }
-
-
-  if(!aod) {delete [] pdgdaughters;return;}
-
   Bool_t isSimpleMode=fSimpleMode;
   if(!arrayProng) {
     AliInfo("Branch not found! The output will contain only trak related histograms\n");
@@ -634,12 +656,10 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
       return;
     }
   }
+  if(!aod) {delete [] pdgdaughters;return;}
   // fix for temporary bug in ESDfilter 
   // the AODs with null vertex pointer didn't pass the PhysSel
-  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
-    delete [] pdgdaughters;
-    return;
-  }
+  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
 
   // count event
   fNEntries->Fill(0); 
@@ -654,6 +674,8 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
   //TString trigclass=aod->GetFiredTriggerClasses();
   //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
 
+  Int_t runNumber = aod->GetRunNumber();
+
   Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kFALSE;
   //select event
   if(!fCuts->IsEventSelected(aod)) {
@@ -662,10 +684,12 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
     if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
     if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
     if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
+    if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count("evnonsel:zvtx/Run:%d",runNumber);
   }
+
   if(evSelected || (!evSelected && !evSelbyCentrality && evSelByVertex && !evselByPileup)){ //events selected or not selected because of vtx or pileup
     if(fOnOff[2] && fCuts->GetUseCentrality()){
-      Int_t runNumber = aod->GetRunNumber();
+
       Float_t stdCentf=fCuts->GetCentrality(aod);
       Int_t stdCent = (Int_t)(stdCentf+0.5);
       Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
@@ -703,11 +727,19 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
     }
   }
 
+  if(fOnOff[3]){
+    const AliVVertex *vertex = aod->GetPrimaryVertex();
+    Double_t zvtx=vertex->GetZ();
+    if(evSelected || (!evSelected && zvtx > 10.))
+    ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
+  }
+
   if(!evSelected) {
     delete [] pdgdaughters;
     return; //discard all events not selected (vtx and/or centrality)
   }
 
+
   Int_t ntracks=0;
   Int_t isGoodTrack=0, isFakeTrack=0;
 
@@ -845,8 +877,8 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
              isGoodTrack++;
            }
          }
-       }//simple mode: no IsSelected on tracks: use "manual" cuts    
-      }//fill track histos
+       } //simple mode: no IsSelected on tracks: use "manual" cuts   
+      } //fill track histos
     } //end loop on tracks
 
       //fill once per event
@@ -900,6 +932,7 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
            Int_t label=0;
            if(fReadMC)label=track->GetLabel();
            if(fOnOff[0]){
+             
              if(fReadMC && label<0) {
                isFakeTrack++;
                ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
@@ -911,7 +944,7 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
            
                ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
              }
-           }     
+           }
            if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
          
              AliAODPid *pid = track->GetDetPid();
index 7749857..746ad68 100644 (file)
@@ -44,6 +44,7 @@ class AliAnalysisTaskSEHFQA : public AliAnalysisTaskSE
   void SetTrackOn(Bool_t trackon=kTRUE){fOnOff[0]=trackon;}
   void SetPIDOn(Bool_t pidon=kTRUE){fOnOff[1]=pidon;}
   void SetCentralityOn(Bool_t centron=kTRUE){fOnOff[2]=centron;}
+  void SetEvSelectionOn(Bool_t evselon=kTRUE){fOnOff[3]=evselon;}
 
   //getters
   AliRDHFCuts* GetCutObject() const {return fCuts;}
@@ -51,6 +52,7 @@ class AliAnalysisTaskSEHFQA : public AliAnalysisTaskSE
   Bool_t GetTrackStatus() const {return fOnOff[0];}
   Bool_t GetPIDStatus() const {return fOnOff[1];}
   Bool_t GetCentralityStatus() const {return fOnOff[2];}
+  Bool_t GetEvSelStatus() const {return fOnOff[3];}
 
  private:
   AliAnalysisTaskSEHFQA(const AliAnalysisTaskSEHFQA &source);
@@ -61,13 +63,14 @@ class AliAnalysisTaskSEHFQA : public AliAnalysisTaskSE
  TList* fOutputTrack;      //! list sent on output slot 3
  TList* fOutputCounters;   //! list sent on output slot 5
  TList* fOutputCheckCentrality;   //! list sent on output slot 6
+ TList* fOutputEvSelection; //! list sent on output slot 7
  DecChannel fDecayChannel; //identify the decay channel
  AliRDHFCuts* fCuts;       // object containing cuts
  AliRDHFCuts::ECentrality fEstimator; //2nd estimator for centrality
  Bool_t fReadMC;           // flag to read MC
  Bool_t fSimpleMode;       // if true, don't do candidates (much faster in PbPb)
- Bool_t fOnOff[3];         // on-off the QA on tracks (0), PID (1), centrality (2) -- default is {kTRUE,kTRUE,kTRUE}
- ClassDef(AliAnalysisTaskSEHFQA,5); //AnalysisTaskSE for the quality assurance of HF in hadrons
+ Bool_t fOnOff[4];         // on-off the QA on tracks (0), PID (1), centrality (2), event selection -- default is {kTRUE,kTRUE,kTRUE,kTRUE}
+ ClassDef(AliAnalysisTaskSEHFQA,6); //AnalysisTaskSE for the quality assurance of HF in hadrons
 
 };
 
index 83865fc..bd29eac 100644 (file)
@@ -16,11 +16,11 @@ AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString
     stdcuts=kTRUE;
   }
 
-  Bool_t onoff[3]={kTRUE,kTRUE,kTRUE};
+  Bool_t onoff[4]={kTRUE,kTRUE,kFALSE,kTRUE};
 
   AliRDHFCuts *analysiscuts=0x0;
 
-  TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",out5name="countersCentrality",out6name="outputCentrCheck",inname="input",suffix="",cutsobjname="",centr="";
+  TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",out5name="countersCentrality",out6name="outputCentrCheck",out7name="outputEvSel",inname="input",suffix="",cutsobjname="",centr="";
   filename = AliAnalysisManager::GetCommonFileName();
   filename += ":PWG3_D2H_QA";
 
@@ -88,6 +88,7 @@ AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString
   out4name=cutsobjname;
   out5name+=suffix;
   out6name+=suffix;
+  out7name+=suffix;
 
   if(!analysiscuts && filecutsname!="none"){
     cout<<"Specific AliRDHFCuts not found"<<endl;
@@ -102,6 +103,7 @@ AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString
   out4name+=centr;
   out5name+=centr;
   out6name+=centr;
+  out7name+=centr;
 
  
   AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
@@ -111,6 +113,7 @@ AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString
   taskQA->SetTrackOn(onoff[0]);
   taskQA->SetPIDOn(onoff[1]);
   taskQA->SetCentralityOn(onoff[2]);
+  taskQA->SetEvSelectionOn(onoff[3]);
   mgr->AddTask(taskQA);
 
   //
@@ -136,6 +139,9 @@ AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString
   AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
   if(onoff[2]) mgr->ConnectOutput(taskQA,6,coutput6);
 
+  AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(out7name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //event selection
+  if(onoff[3]) mgr->ConnectOutput(taskQA,7,coutput7);
+
  return taskQA;
 }