]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/SPECTRA/PiKaPr/TPCTOFpA/AliAnalysisTPCTOFpA.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TPCTOFpA / AliAnalysisTPCTOFpA.cxx
index 98f0ba77537a2cd1fb1812d80b196bdf31bc5f73..d1ec18ab124a9d58973d2136f768869b53b42f6d 100644 (file)
@@ -268,7 +268,7 @@ void AliAnalysisTPCTOFpA::UserCreateOutputObjects()
 
   Int_t kDcaBinsTemp = 76;
   if (fEvenDCAbinning) kDcaBinsTemp = 150;
-  const Int_t kDcaBins = (const Int_t) kDcaBinsTemp;
+  const Int_t kDcaBins = (Int_t) kDcaBinsTemp;
 
   const Float_t kDcaBinsTPConlyFactor = 5; //need to change binning of DCA plot for tpconly
   // sort pT-bins ..
@@ -455,10 +455,16 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
     // SPD vertex
     vertex = fESD->GetPrimaryVertexSPD();
     /* quality checks on SPD-vertex */ 
-    TString vertexType = vertex->GetTitle();
-    if (vertexType.Contains("vertexer: Z") && (vertex->GetDispersion() > 0.04 || vertex->GetZRes() > 0.25))  isVertexOk = kFALSE; //vertex = 0x0; //
-    if (vertex->GetNContributors()<1)  isVertexOk = kFALSE; //vertex = 0x0; //
+    if (!vertex) {
+      isVertexOk = kFALSE;
+    }
+    else {
+      TString vertexType = vertex->GetTitle();
+      if (vertexType.Contains("vertexer: Z") && (vertex->GetDispersion() > 0.04 || vertex->GetZRes() > 0.25))  isVertexOk = kFALSE; //vertex = 0x0; //
+      if (vertex->GetNContributors()<1)  isVertexOk = kFALSE; //vertex = 0x0; //
+    }
   }  
+
   //
   // small track loop to determine trigger Pt, multiplicity or centrality
   //
@@ -524,9 +530,9 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
     */
   }
   //
-  Int_t rootS = fESD->GetBeamEnergy() < 1000 ? 0 : 1;
+  //Int_t rootS = fESD->GetBeamEnergy() < 1000 ? 0 : 1;
   if (fESD->GetEventSpecie() == 4) { // PbPb
-    rootS = 2;
+    //rootS = 2;
     AliCentrality *esdCentrality = fESD->GetCentrality();
     centrality = esdCentrality->GetCentralityClass10("V0M") + 1; // centrality percentile determined with V0
     if (TMath::Abs(centrality - 1) < 1e-5) {
@@ -561,8 +567,8 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
 
 
   
-  Int_t nContributors = 0;
-  if (fESD->GetPrimaryVertexTPC()) nContributors = fESD->GetPrimaryVertexTPC()->GetNContributors();
+  //Int_t nContributors = 0;
+  //if (fESD->GetPrimaryVertexTPC()) nContributors = fESD->GetPrimaryVertexTPC()->GetNContributors();
   //
   
   //  Int_t processtype = 0;
@@ -577,7 +583,7 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
     PostData(1, fListHist);
     return;
   } else {
-    if (TMath::Abs(vertex->GetZv()) > 10) {
+    if (TMath::Abs(vertex->GetZ()) > 10) {
       fHistMult->Fill(-1, processCode);
       PostData(1, fListHist);
       return;
@@ -609,11 +615,11 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
       //
       Double_t xv = trackMC->Vx();
       Double_t yv = trackMC->Vy();
-      Double_t zv = trackMC->Vz();
+      //Double_t zv = trackMC->Vz();
       Double_t dxy = 0;
       dxy = TMath::Sqrt(xv*xv + yv*yv); // so stupid to avoid warnings
-      Double_t dz = 0;
-      dz = TMath::Abs(zv); // so stupid to avoid warnings
+      //Double_t dz = 0;
+      //dz = TMath::Abs(zv); // so stupid to avoid warnings
       //
       // vertex cut - selection of primaries
       //
@@ -637,12 +643,12 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
       //
 
       if (!fSmallTHnSparse){
-       Double_t vecHistMC[10] = {iPart, centrality,  pT, sign, rap, 0, 1, 0, dxy, 0};
+       Double_t vecHistMC[10] = {static_cast<Double_t>(iPart), centrality,  pT, static_cast<Double_t>(sign), rap, 0, 1, 0, dxy, 0};
        if (!fOnlyQA) fHistMCparticles->Fill(vecHistMC);
       }
       else{
        if (rap>fRapidityCutLow && rap<fRapidityCutHigh){
-         Double_t vecHistMC[8] = {iPart, centrality,  pT, sign, 1, 0, dxy, 0};
+         Double_t vecHistMC[8] = {static_cast<Double_t>(iPart), centrality,  pT, static_cast<Double_t>(sign), 1, 0, dxy, 0};
          if (!fOnlyQA) fHistMCparticles->Fill(vecHistMC);
        }
       }
@@ -659,7 +665,7 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
     PostData(1, fListHist);
     return;
   } else {
-    if (TMath::Abs(vertex->GetZv()) > 10) {
+    if (TMath::Abs(vertex->GetZ()) > 10) {
       fHistMult->Fill(-1, processCode);
       PostData(1, fListHist);
       return;
@@ -836,6 +842,7 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
 //                      fESDpid->NumberOfSigmasTPC(track,AliPID::kKaon),
 //                      fESDpid->NumberOfSigmasTPC(track,AliPID::kProton)};
 
+/*
     Double_t tofQA[4] = {0.,0.,0.,0.}; 
     if (!fUseTPConlyTracks) {
       tofQA[0] = fESDpid->NumberOfSigmasTOF(track,AliPID::kElectron, time0);
@@ -849,18 +856,18 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
       tofQA[0] = fESDpid->NumberOfSigmasTOF(trackForTOF,AliPID::kKaon, time0);
       tofQA[0] = fESDpid->NumberOfSigmasTOF(trackForTOF,AliPID::kProton, time0);
     }
-
+*/
 
     //save information for every particle type  // loop over assumed particle type
     for(Int_t iPart = 0; iPart < 3; iPart++) {
 
       if (!fSmallTHnSparse) {
-       Double_t vecHistReal[9]  = {iPart,  centrality,   pT, sign,  rap[iPart], pullsTPC[iPart], hasTOF, pullsTOF[iPart], dca[0]};
+       Double_t vecHistReal[9]  = {static_cast<Double_t>(iPart),  centrality,   pT, static_cast<Double_t>(sign),  rap[iPart], pullsTPC[iPart], static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0]};
        if (!fOnlyQA) fHistRealTracks->Fill(vecHistReal);
       }
       else {
        if (pullsTPC[iPart]>fTPCnSigmaCutLow && pullsTPC[iPart]<fTPCnSigmaCutHigh && rap[iPart]>fRapidityCutLow && rap[iPart]<fRapidityCutHigh) {
-         Double_t vecHistReal[7]  = {iPart,  centrality,   pT, sign, hasTOF, pullsTOF[iPart], dca[0]};
+         Double_t vecHistReal[7]  = {static_cast<Double_t>(iPart),  centrality,   pT, static_cast<Double_t>(sign), static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0]};
          if (!fOnlyQA) fHistRealTracks->Fill(vecHistReal);
        }
       }
@@ -880,8 +887,8 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
        TParticle *trackMC = stack->Particle(TMath::Abs(track->GetLabel()));
        Int_t pdg = TMath::Abs(trackMC->GetPdgCode());
        //
-       if (pdg != assumedPdg && stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()))) code = 2;
-       if (pdg != assumedPdg && stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()))) code = 5;
+       if (pdg != assumedPdg) code = 2;
+       //if (pdg != assumedPdg && stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()))) code = 5;
        if (pdg == assumedPdg && stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()))) code = 1;
        if (pdg == assumedPdg && stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()))) {
          code = 3;
@@ -892,8 +899,17 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
            if (trackMother->GetPdgCode() == 3222) motherCode = 8; //Sigma+
          }
        }
-       if (pdg == assumedPdg && stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()))) code = 4;
-       
+
+
+       //FILL MATERIAL TEMPLATE FOR KAONS WITH ELECTRONS
+       if (iPart != 1){
+         if (pdg == assumedPdg && stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()))) code = 4;
+       }       
+       else {
+         if (pdg == 11) code = 4;
+         //cout << "got an electron for  kaons!" << endl;
+       }
+
        //
        // muons need special treatment, because they are indistinguishable from pions
        //
@@ -930,11 +946,11 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
        // IMPORTANT BIG PROBLEM HERE THE PROBABLILITY TO HAVE A PID SIGNAL MUST BE IN !!!!!!!!!!!!
        //
        if (!fSmallTHnSparse){
-         Double_t vectorHistMC[10] = {iPart,  centrality,  pT, sign,  rap[iPart], pullsTPC[iPart], hasTOF, pullsTOF[iPart], dca[0], code};
+         Double_t vectorHistMC[10] = {static_cast<Double_t>(iPart),  centrality,  pT, static_cast<Double_t>(sign),  rap[iPart], pullsTPC[iPart], static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0], static_cast<Double_t>(code)};
          if (!fOnlyQA) { 
            fHistMCparticles->Fill(vectorHistMC);
            if (motherCode != -1 && fSaveMotherPDG) { //if mother of weak decay is K0, lambda or sigma+ add track again with this information
-             Double_t vectorHistMCmother[10] = {iPart,  centrality,  pT, sign,  rap[iPart], pullsTPC[iPart], hasTOF, pullsTOF[iPart], dca[0], motherCode};
+             Double_t vectorHistMCmother[10] = {static_cast<Double_t>(iPart),  centrality,  pT, static_cast<Double_t>(sign),  rap[iPart], pullsTPC[iPart], static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0], static_cast<Double_t>(motherCode)};
              fHistMCparticles->Fill(vectorHistMCmother);
            }
          }
@@ -942,11 +958,11 @@ void AliAnalysisTPCTOFpA::UserExec(Option_t *)
        else{
          if (pullsTPC[iPart]>fTPCnSigmaCutLow && pullsTPC[iPart]<fTPCnSigmaCutHigh && rap[iPart]>fRapidityCutLow && rap[iPart]<fRapidityCutHigh) {
            //                              0,           1,   2,    3,           4,               5,      6,               7,      8,   9
-           Double_t vectorHistMC[8] = {iPart,  centrality,  pT, sign, hasTOF, pullsTOF[iPart], dca[0], code};
+           Double_t vectorHistMC[8] = {static_cast<Double_t>(iPart),  centrality,  pT, static_cast<Double_t>(sign), static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0], static_cast<Double_t>(code)};
            if (!fOnlyQA) { 
              fHistMCparticles->Fill(vectorHistMC);
              if (motherCode != -1 && fSaveMotherPDG) { //if mother of weak decay is K0, lambda or sigma+ add track again with this information
-               Double_t vectorHistMCmother[8] = {iPart,  centrality,  pT, sign, hasTOF, pullsTOF[iPart], dca[0], motherCode};
+               Double_t vectorHistMCmother[8] = {static_cast<Double_t>(iPart),  centrality,  pT, static_cast<Double_t>(sign), static_cast<Double_t>(hasTOF), pullsTOF[iPart], dca[0], static_cast<Double_t>(motherCode)};
                fHistMCparticles->Fill(vectorHistMCmother);
              }
            }
@@ -1007,7 +1023,7 @@ void AliAnalysisTPCTOFpA::BinLogAxis(const TH1 *h) {
   //
   // Method for the correct logarithmic binning of histograms
   //
-  TAxis *axis = h->GetXaxis();
+  TAxis *axis = const_cast<TAxis*>(h->GetXaxis());
   int bins = axis->GetNbins();
 
   Double_t from = axis->GetXmin();