]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
updates of HFE tasks
authorssakai <ssakai@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Apr 2013 13:59:20 +0000 (13:59 +0000)
committerssakai <ssakai@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Apr 2013 13:59:20 +0000 (13:59 +0000)
PWGHF/hfe/AliAnalysisTaskHFECal.cxx
PWGHF/hfe/AliHFENonPhotonicElectron.cxx
PWGHF/hfe/AliHFENonPhotonicElectron.h
PWGHF/hfe/AliHFEpid.cxx
PWGHF/hfe/AliHFEpid.h

index 4c0856b1c4d5db606a0ad888aa584e7f275db862..f905a7de3b1b7a8ec272650ba7446ae975ac701e 100644 (file)
@@ -1447,14 +1447,15 @@ void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent,
     
     // check chi2
     if(recg.GetNDF()<1) continue;
-    Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
-    if(TMath::Sqrt(TMath::Abs(chi2recg))>5.) continue;
 
     // mass const.
     recg.SetMassConstraint(0,0.0001);
     // v5-04-50-AN no constrain
     recg.GetMass(mass,width);
 
+    Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
+    if(TMath::Sqrt(TMath::Abs(chi2recg))>30.) continue;
+
     // angle   
     openingAngle = ge1.GetAngle(ge2);
     if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
index ae4da6827504e8a328e8b146e3d3a22c19c5f385..fcc2890d8d7d391f36061d8a82fb41d9ebe9e23a 100644 (file)
@@ -86,6 +86,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Cha
   ,fIncElectron                (NULL)
   ,fUSign              (NULL)
   ,fLSign              (NULL)
+  ,fUSmatches(NULL)
+  ,fLSmatches(NULL)
 //  ,fUSignAngle       (NULL)
 //  ,fLSignAngle       (NULL)
 {
@@ -124,6 +126,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
   ,fIncElectron                (NULL)
   ,fUSign              (NULL)
   ,fLSign              (NULL)
+  ,fUSmatches(NULL)
+  ,fLSmatches(NULL)
 //  ,fUSignAngle       (NULL)
 //  ,fLSignAngle       (NULL)
 {
@@ -162,6 +166,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElec
   ,fIncElectron                (ref.fIncElectron)
   ,fUSign              (ref.fUSign)
   ,fLSign              (ref.fLSign)
+  ,fUSmatches(ref.fUSmatches)
+  ,fLSmatches(ref.fLSmatches)
 //  ,fUSignAngle       (ref.fUSignAngle)
 //  ,fLSignAngle       (ref.fLSignAngle)
 {
@@ -273,53 +279,23 @@ void AliHFENonPhotonicElectron::Init()
     AliDebug(2,Form("bin phi is %f for %d",binLimAngle[i],i));
   }
 
-  Int_t nBinsTPC = 400;
-  Double_t minTPC = 20;
-  Double_t maxTPC = 220;
-  Double_t binLimTPC[nBinsTPC+1];
-  for(Int_t i=0; i<=nBinsTPC; i++)
-  {
-    binLimTPC[i]=(Double_t)minTPC + (maxTPC-minTPC)/nBinsTPC*(Double_t)i ;
-    AliDebug(2,Form("bin TPC is %f for %d",binLimTPC[i],i));
-  }
-
-  Int_t nBinsTPCSigma = 240;
-  Double_t minTPCSigma = -12.0;
-  Double_t maxTPCSigma =  12.0;
-  Double_t binLimTPCSigma[nBinsTPCSigma+1];
-  for(Int_t i=0; i<=nBinsTPCSigma; i++) binLimTPCSigma[i]=(Double_t)minTPCSigma + (maxTPCSigma-minTPCSigma)/nBinsTPCSigma*(Double_t)i ;
-
-  Int_t nBinsTOFSigma = 240;
-  Double_t minTOFSigma = -12.0;
-  Double_t maxTOFSigma =  12.0;
-  Double_t binLimTOFSigma[nBinsTOFSigma+1];
-  for(Int_t i=0; i<=nBinsTOFSigma; i++) binLimTOFSigma[i]=(Double_t)minTOFSigma + (maxTOFSigma-minTOFSigma)/nBinsTOFSigma*(Double_t)i ;
-
   // Associated Electron
-  const Int_t nDimAssElectron=7;
-  Int_t nBinAssElectron[nDimAssElectron] = {nBinsC,nBinsPt,nBinsSource,nBinsP,nBinsTPC,nBinsTPCSigma,nBinsTOFSigma};
+  const Int_t nDimAssElectron=3;
+  Int_t nBinAssElectron[nDimAssElectron] = {nBinsC,nBinsPt,nBinsSource};
   fAssElectron = new THnSparseF("fAssElectron","fAssElectron",nDimAssElectron,nBinAssElectron);
   fAssElectron->SetBinEdges(0,binLimC);
   fAssElectron->SetBinEdges(1,binLimPt);
   fAssElectron->SetBinEdges(2,binLimSource);
-  fAssElectron->SetBinEdges(3,binLimP);
-  fAssElectron->SetBinEdges(4,binLimTPC);
-  fAssElectron->SetBinEdges(5,binLimTPCSigma);
-  fAssElectron->SetBinEdges(6,binLimTOFSigma);
   fAssElectron->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fAssElectron");
 
   // Inclusive Electron
-  const Int_t nDimIncElectron=7;
-  Int_t nBinIncElectron[nDimIncElectron] = {nBinsC,nBinsPt,nBinsSource,nBinsP,nBinsTPC,nBinsTPCSigma,nBinsTOFSigma};
+  const Int_t nDimIncElectron=3;
+  Int_t nBinIncElectron[nDimIncElectron] = {nBinsC,nBinsPt,nBinsSource};
   fIncElectron = new THnSparseF("fIncElectron","fIncElectron",nDimIncElectron,nBinIncElectron);
   fIncElectron->SetBinEdges(0,binLimC);
   fIncElectron->SetBinEdges(1,binLimPt);
   fIncElectron->SetBinEdges(2,binLimSource);
-  fIncElectron->SetBinEdges(3,binLimP);
-  fIncElectron->SetBinEdges(4,binLimTPC);
-  fIncElectron->SetBinEdges(5,binLimTPCSigma);
-  fIncElectron->SetBinEdges(6,binLimTOFSigma);
   fIncElectron->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fIncElectron");
 
@@ -351,6 +327,22 @@ void AliHFENonPhotonicElectron::Init()
   fLSign->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fLSign");
 
+  // Histograms counting the number of like sign / unlike sign matches per inclusive track
+  const Int_t nBinsMatches = 50;
+  Double_t binLimMatches[nBinsMatches+1];
+  for(int ib = 0; ib <= nBinsMatches; ib++) binLimMatches[ib] = ib;
+  const Int_t nDimMatches = 3;  // centrality, pt_inc, number of matches 
+  const Int_t nBinsMatchHist[nDimMatches] = {nBinsC, nBinsPt, nBinsMatches};
+  fUSmatches = new THnSparseF("fUSmatches", "fUSmatches", nDimMatches, nBinsMatchHist);
+  fUSmatches->SetBinEdges(0,binLimC);
+  fUSmatches->SetBinEdges(1,binLimPt);
+  fUSmatches->SetBinEdges(2,binLimMatches);
+
+  fLSmatches = new THnSparseF("fLSmatches", "fLSmatches", nDimMatches, nBinsMatchHist);
+  fLSmatches->SetBinEdges(0,binLimC);
+  fLSmatches->SetBinEdges(1,binLimPt);
+  fLSmatches->SetBinEdges(2,binLimMatches);
+
 /*
   // ee angle Unlike Sign
   const Int_t nDimUSignAngle=3;
@@ -377,6 +369,8 @@ void AliHFENonPhotonicElectron::Init()
   fListOutput->Add(fIncElectron);
   fListOutput->Add(fUSign);
   fListOutput->Add(fLSign);
+  fListOutput->Add(fUSmatches);
+  fListOutput->Add(fLSmatches);
 //  fListOutput->Add(fUSignAngle);
 //  fListOutput->Add(fLSignAngle);
 
@@ -450,11 +444,11 @@ Int_t AliHFENonPhotonicElectron::FillPoolAssociatedTracks(AliVEvent *inputEvent,
       AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);
       if(aodtrack)
       {
-       // filter
-       if(fUseFilterAOD)
-       {
-         if(!(aodtrack->TestFilterBit(fFilter))) survivedbackground = kFALSE;
-       }
+             // filter
+             if(fUseFilterAOD)
+             {
+               if(!(aodtrack->TestFilterBit(fFilter))) survivedbackground = kFALSE;
+             }
 
       }
     }
@@ -474,16 +468,16 @@ Int_t AliHFENonPhotonicElectron::FillPoolAssociatedTracks(AliVEvent *inputEvent,
       hfetrack2.SetRecTrack(track);
       if(binct>-1)
       {
-       hfetrack2.SetCentrality((Int_t)binct);
-       AliDebug(2,Form("centrality %d and %d",binct,hfetrack2.GetCentrality()));
-       hfetrack2.SetPbPb();
+             hfetrack2.SetCentrality((Int_t)binct);
+             AliDebug(2,Form("centrality %d and %d",binct,hfetrack2.GetCentrality()));
+             hfetrack2.SetPbPb();
       }
 
       if(fPIDBackground->IsSelected(&hfetrack2,0x0,"recTrackCont",fPIDBackgroundQA))
       {
-       fArraytrack->AddAt(k,fCounterPoolBackground);
-       fCounterPoolBackground++;
-       AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));
+             fArraytrack->AddAt(k,fCounterPoolBackground);
+             fCounterPoolBackground++;
+             AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));
       }
     }
   } // loop tracks
@@ -504,36 +498,27 @@ Int_t AliHFENonPhotonicElectron::CountPoolAssociated(AliVEvent *inputEvent, Int_
 
   if(fnumberfound > 0) //!count only events with an inclusive electron
   {
-    Double_t valueAssElectron[7] = { binct, -1, -1, -1, -1, -20, -20};         //Centrality    Pt      Source  P       TPCsignal       TPCsigma        TOFsigma
+    Double_t valueAssElectron[3] = { binct, -1, -1};           //Centrality    Pt      Source
     Int_t iTrack2 = 0;
     Int_t indexmother2 = -1;
     AliVTrack *track2 = 0x0;
 
-    for(Int_t ii = 0; ii < fCounterPoolBackground; ii++)
-    {
+    for(Int_t ii = 0; ii < fCounterPoolBackground; ii++){
       iTrack2 = fArraytrack->At(ii);
       AliDebug(2,Form("track %d",iTrack2));
       track2 = (AliVTrack *)inputEvent->GetTrack(iTrack2);
 
-      if(!track2)
-      {
-       //printf("ERROR: Could not receive track %d", iTrack2);
-       continue;
+      if(!track2){
+             //printf("ERROR: Could not receive track %d", iTrack2);
+             continue;
       }
 
       // if MC look
-      if(fMCEvent || fAODArrayMCInfo)
-      {
-       valueAssElectron[2] = FindMother(TMath::Abs(track2->GetLabel()), indexmother2) ;
-      }
+      if(fMCEvent || fAODArrayMCInfo) valueAssElectron[2] = FindMother(TMath::Abs(track2->GetLabel()), indexmother2) ;
 
       fkPIDRespons = fPIDBackground->GetPIDResponse();
 
       valueAssElectron[1] = track2->Pt() ;
-      valueAssElectron[3] = track2->P() ;
-      valueAssElectron[4] = track2->GetTPCsignal() ;
-      valueAssElectron[5] = fkPIDRespons->NumberOfSigmasTPC( track2, AliPID::kElectron) ;
-      valueAssElectron[6] = fkPIDRespons->NumberOfSigmasTOF( track2, AliPID::kElectron) ;
 
       fAssElectron->Fill( valueAssElectron) ;
     }
@@ -578,7 +563,7 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
   fkPIDRespons = fPIDBackground->GetPIDResponse();
 
   //Set Fill-Arrays for THnSparse
-  Double_t valueIncElectron[7] = { binct, track1->Pt(), source, track1->P(), track1->GetTPCsignal(), fkPIDRespons->NumberOfSigmasTPC( track1, AliPID::kElectron), fkPIDRespons->NumberOfSigmasTOF( track1, AliPID::kElectron)};        //Centrality    Pt      Source  P       TPCsignal       TPCsigma        TOFsigma
+  Double_t valueIncElectron[3] = { binct, track1->Pt(), source};       //Centrality    Pt      Source  P       
   Double_t valueSign[7]                = { deltaphi, binct, track1->Pt(), -1, source, -1, -1};                 //DeltaPhi      Centrality      Pt      InvariantMass   Source  Angle   Pt
   //Double_t valueAngle[3]     = { -1, binct, source};                                                         //Angle         Centrality      Source
 
@@ -594,6 +579,10 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
   Int_t fPDGtrack2 = 0;
   Float_t fCharge2 = 0;
 
+  // count number of matches with opposite/same sign track in the given mass range
+  Int_t countsMatchLikesign(0),
+        countsMatchUnlikesign(0);
+
   Double_t dca12 = 0;
 
   TLorentzVector electron1;
@@ -632,14 +621,12 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
   fnumberfound++;
   //printf(Form("Inclusive Pool: TrackNr. %d, fnumberfound %d \n", iTrack1, fnumberfound));
 
-  for(Int_t idex = 0; idex < fCounterPoolBackground; idex++)
-  {
+  for(Int_t idex = 0; idex < fCounterPoolBackground; idex++){
     iTrack2 = fArraytrack->At(idex);
     AliDebug(2,Form("track %d",iTrack2));
     track2 = (AliVTrack *)vEvent->GetTrack(iTrack2);
 
-    if(!track2)
-    {
+    if(!track2){
       //printf("ERROR: Could not receive track %d", iTrack2);
       continue;
     }
@@ -658,39 +645,29 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
     AliDebug(2,"Different");
 
     // if MC look
-    if(fMCEvent || fAODArrayMCInfo)
-    {
+    if(fMCEvent || fAODArrayMCInfo){
       source2   = FindMother(TMath::Abs(track2->GetLabel()), indexmother2);
       pdg2      = CheckPdg(TMath::Abs(track2->GetLabel()));
 
-      if(source2 >=0 )
-      {
-       if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0))
-       {
-         if(source == kElectronfromconversion)
-         {
-           //valueAngle[2] = kElectronfromconversionboth;
-           valueSign[4] = kElectronfromconversionboth;
-         }
-
-         if(source == kElectronfrompi0)
-         {
-           //valueAngle[2] = kElectronfrompi0both;
-           valueSign[4] = kElectronfrompi0both;
-         }
-
-         if(source == kElectronfrometa)
-         {
-           //valueAngle[2] = kElectronfrometaboth;
-           valueSign[4] = kElectronfrometaboth;
-         }
-       }
+      if(source2 >=0 ){
+             if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0)){
+          switch(source){
+                  case kElectronfromconversion: 
+                          valueSign[4] = kElectronfromconversionboth; 
+                          break;
+                  case kElectronfrompi0: 
+                          valueSign[4] = kElectronfrompi0both; 
+                          break;
+                  case kElectronfrometa:
+                          valueSign[4] = kElectronfrometaboth;
+                          break;
+          };
+        }
       }
     }
 
 
-    if(fAlgorithmMA && (!aodeventu)) 
-    {
+    if(fAlgorithmMA && (!aodeventu)){
       /**                              *
        *       ESD-Analysis            *
        **                              */
@@ -727,14 +704,19 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
       if(angleESD > fMaxOpening3D) continue;                            //! Cut on Opening Angle
       if(invmassESD > fMaxInvMass) continue;                           //! Cut on Invariant Mass
 
-      if((fCharge1*fCharge2)>0.0)      fLSign->Fill( valueSign, weight);
-      else                             fUSign->Fill( valueSign, weight);
+      if((fCharge1*fCharge2)>0.0){     
+        fLSign->Fill( valueSign, weight);
+        // count like-sign background matched pairs per inclusive based on mass cut
+        if(invmassESD < 0.14) countsMatchLikesign++;
+      } else {
+        fUSign->Fill( valueSign, weight);
+        // count unlike-sign matched pairs per inclusive based on mass cut
+        if(invmassESD < 0.14) countsMatchUnlikesign++;
+      }
 
       if((fCharge1*fCharge2)>0.0)      kLSignPhotonic=kTRUE;
       else                             kUSignPhotonic=kTRUE;
-    }
-    else
-    {
+    } else {
       /**                              *
        *       AOD-AliKF-Analysis      *
        **                              */
@@ -744,6 +726,7 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
       fPDGtrack2 = 11;
       if(fCharge2>0) fPDGtrack2 = -11;
 
+      AliKFParticle::SetField(vEvent->GetMagneticField());
       AliKFParticle ktrack2(*track2, fPDGtrack2);
       AliKFParticle recoGamma(ktrack1,ktrack2);
 
@@ -759,11 +742,11 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
       // if set mass constraint
       if(fSetMassConstraint) //&& pVtx)
       {
-       primV += recoGamma;
-       primV -= ktrack1;
-       primV -= ktrack2;
-       recoGamma.SetProductionVertex(primV);
-       recoGamma.SetMassConstraint(0,0.0001);
+             primV += recoGamma;
+             primV -= ktrack1;
+             primV -= ktrack2;
+             recoGamma.SetProductionVertex(primV);
+             recoGamma.SetMassConstraint(0,0.0001);
       }
 
       recoGamma.GetMass(invmassAOD,width);
@@ -779,14 +762,27 @@ Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1,
       if(angleAOD > fMaxOpening3D) continue;                           //! Cut on Opening Angle
       if(invmassAOD > fMaxInvMass) continue;                           //! Cut on Invariant Mass
 
-      if((fCharge1*fCharge2)>0.0)      fLSign->Fill( valueSign, weight);
-      else                             fUSign->Fill( valueSign, weight);
+      if((fCharge1*fCharge2)>0.0){     
+        fLSign->Fill( valueSign, weight);
+        // count like-sign background matched pairs per inclusive based on mass cut
+        if(invmassAOD < 0.14) countsMatchLikesign++;
+      } else {
+        fUSign->Fill( valueSign, weight);
+        // count unlike-sign matched pairs per inclusive based on mass cut
+        if(invmassAOD < 0.14) countsMatchUnlikesign++;
+      }
 
       if((fCharge1*fCharge2)>0.0)      kLSignPhotonic=kTRUE;
       else                             kUSignPhotonic=kTRUE;
     }
   }
 
+  // Fill counted
+  Double_t valCountsLS[3] = {binct, track1->Pt(), countsMatchLikesign},
+           valCountsUS[3] = {binct, track1->Pt(), countsMatchUnlikesign}; 
+  fUSmatches->Fill(valCountsUS);
+  fLSmatches->Fill(valCountsLS);
+
   if( kUSignPhotonic &&  kLSignPhotonic) taggedphotonic = 6;
   if(!kUSignPhotonic &&  kLSignPhotonic) taggedphotonic = 4;
   if( kUSignPhotonic && !kLSignPhotonic) taggedphotonic = 2;
index d3b4ba7de899e8bc1a75c00f64b234d04128fd68..d4d3bcf9b8ba46b526c8f8bf2f184ebd78763fc3 100644 (file)
@@ -120,6 +120,8 @@ class AliHFENonPhotonicElectron : public TNamed {
   THnSparseF           *fIncElectron;                  //! centrality, pt, Source MC, P, TPCsignal
   THnSparseF           *fUSign;                        //! delta phi, c, pt, inv, source
   THnSparseF           *fLSign;                        //! delta phi, c, pt, inv, source
+  THnSparseF    *fUSmatches;  //! number of matched tracks with oposite sign per inclusive track after inv mass cut
+  THnSparseF    *fLSmatches;  //! number of matched tracks with same sign per inclusive track after inv mass cut
 //  THnSparseF         *fUSignAngle;                   //! angle, c, source
 //  THnSparseF         *fLSignAngle;                   //! angle, c, source
 
index 4ba66efccb26a4c6d32020d934fcc30313f18e91..10307b6eae7b3b037e2367e16969ea6f128c018d 100644 (file)
@@ -183,6 +183,23 @@ void AliHFEpid::ClearCommonObjects(){
   }
 }
 
+//____________________________________________________________
+void AliHFEpid::SetDetectorsForAnalysis(TString detectors){
+  //
+  // Set detectors used in Analysis to the position corresponding to their 
+  // position in the string
+  // Detectors are separated by ","
+  //
+  TObjArray *detarray = detectors.Tokenize(",");
+  TObjString *detString(NULL);
+  int ndet(0);
+  for(int idet = 0; idet < detarray->GetEntries(); idet++){
+    detString = dynamic_cast<TObjString *>(detarray->At(idet));
+    if(detString) AddDetector(detString->String(), ndet++);
+  }
+  AliDebug(1, Form("%d detectors used in Analysis", ndet));
+}
+
 //____________________________________________________________
 void AliHFEpid::AddDetector(TString detector, UInt_t position){
   //
index 912bfc9124fa17e08ddf93fd2ced697821e9bd2c..130ff22507d8e3f593c7b66e11b62707e651c9b1 100644 (file)
@@ -68,6 +68,7 @@ class AliHFEpid : public TNamed{
     Bool_t HasMCData() const { return TestBit(kHasMCData); };
 
     void AddDetector(TString detector, UInt_t position);
+    void SetDetectorsForAnalysis(TString detectors);
     void SetPIDResponse(const AliPIDResponse * const pid);
     void SetVarManager(AliHFEvarManager *vm) { fVarManager = vm; }
     void SetHasMCData(Bool_t hasMCdata = kTRUE) { SetBit(kHasMCData, hasMCdata); };