]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONmassPlot_ESD.C
Updated to use the new CTP framework (Christian)
[u/mrichter/AliRoot.git] / MUON / MUONmassPlot_ESD.C
index 454ce595e3acd71e8547123340a04c8acadba70f..21af0a13e271431b1924787b30a7e6eddd672ac3 100644 (file)
@@ -72,7 +72,6 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
   //Reset ROOT and connect tree file
   gROOT->Reset();
 
-
   // File for histograms and histogram booking
   TFile *histoFile = new TFile("MUONmassPlot.root", "RECREATE");
   TH1F *hPtMuon = new TH1F("hPtMuon", "Muon Pt (GeV/c)", 100, 0., 20.);
@@ -82,9 +81,10 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
   TH1F *hChi2PerDof = new TH1F("hChi2PerDof", "Muon track chi2/d.o.f.", 100, 0., 20.);
   TH1F *hInvMassAll = new TH1F("hInvMassAll", "Mu+Mu- invariant mass (GeV/c2)", 480, 0., 12.);
   TH1F *hInvMassBg = new TH1F("hInvMassBg", "Mu+Mu- invariant mass BG(GeV/c2)", 480, 0., 12.);
-TH2F *hInvMassAll_vs_Pt = new TH2F("hInvMassAll_vs_Pt","hInvMassAll_vs_Pt",480,0.,12.,80,0.,20.);
-TH2F *hInvMassBgk_vs_Pt = new TH2F("hInvMassBgk_vs_Pt","hInvMassBgk_vs_Pt",480,0.,12.,80,0.,20.);
-TH1F *hInvMassRes;
+  TH2F *hInvMassAll_vs_Pt = new TH2F("hInvMassAll_vs_Pt","hInvMassAll_vs_Pt",480,0.,12.,80,0.,20.);
+  TH2F *hInvMassBgk_vs_Pt = new TH2F("hInvMassBgk_vs_Pt","hInvMassBgk_vs_Pt",480,0.,12.,80,0.,20.);
+  TH1F *hInvMassRes;
+  TH1F *hPrimaryVertex = new TH1F("hPrimaryVertex","SPD reconstructed Z vertex",120,-12,12);
 
   if (ResType == 553) {
     hInvMassRes = new TH1F("hInvMassRes", "Mu+Mu- invariant mass (GeV/c2) around Upsilon", 60, 8., 11.);
@@ -102,6 +102,9 @@ TH1F *hInvMassRes;
 
   // settings
   Int_t EventInMass = 0;
+  Int_t EventInMassMatch = 0;
+  Int_t NbTrigger = 0;
+
   Float_t muonMass = 0.105658389;
 //   Float_t UpsilonMass = 9.46037;
 //   Float_t JPsiMass = 3.097;
@@ -113,6 +116,7 @@ TH1F *hInvMassRes;
 
   Int_t ntrackhits, nevents;
   Double_t fitfmin;
+  Double_t fZVertex;
 
  
   TLorentzVector fV1, fV2, fVtot;
@@ -128,8 +132,6 @@ TH1F *hInvMassRes;
     return kFALSE;
   }
 
-  runLoader->LoadgAlice();
-  gAlice = runLoader->GetAliRun();
   if (!gAlice) {
     Error("MUONmass_ESD", "no galice object found");
     return kFALSE;
@@ -150,6 +152,9 @@ TH1F *hInvMassRes;
     return kFALSE;
   }
   tree->SetBranchAddress("ESD", &esd);
+  
+  
+  AliESDVertex* Vertex = (AliESDVertex*) esd->AliESD::GetVertex();
 
   runLoader->LoadHeader();
   nevents = runLoader->GetNumberOfEvents();
@@ -167,6 +172,10 @@ TH1F *hInvMassRes;
       return kFALSE;
     }
 
+    // get the SPD reconstructed vertex (vertexer) and fill the histogram
+    fZVertex = Vertex->GetZv();
+    hPrimaryVertex->Fill(fZVertex);
+
     Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ; 
 
     //    printf("\n Nb of events analysed: %d\r",iEvent);
@@ -181,7 +190,7 @@ TH1F *hInvMassRes;
       thetaY = muonTrack->GetThetaY();
 
       pYZ     =  1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
-      fPzRec1  = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaX));
+      fPzRec1  = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY));
       fPxRec1  = fPzRec1 * TMath::Tan(thetaX);
       fPyRec1  = fPzRec1 * TMath::Tan(thetaY);
       fCharge = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum()));
@@ -231,7 +240,7 @@ TH1F *hInvMassRes;
          thetaY = muonTrack->GetThetaY();
 
          pYZ     =  1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
-         fPzRec2  = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaX));
+         fPzRec2  = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY));
          fPxRec2  = fPzRec2 * TMath::Tan(thetaX);
          fPyRec2  = fPzRec2 * TMath::Tan(thetaY);
          fCharge2 = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum()));
@@ -262,8 +271,18 @@ TH1F *hInvMassRes;
              hInvMassAll->Fill(invMass);
              hInvMassRes->Fill(invMass);
              hInvMassAll_vs_Pt->Fill(invMass,fVtot.Pt());
+             Int_t ptTrig;
+             if (ResType == 553) 
+               ptTrig =  0x400;// mask for Hpt unlike sign pair
+             else 
+               ptTrig =  0x200;// mask for Lpt unlike sign pair
+
+             if (esd->GetTriggerMask() &  ptTrig) NbTrigger++; 
              if (invMass > massMin && invMass < massMax) {
                EventInMass++;
+               if (muonTrack->GetMatchTrigger() && (esd->GetTriggerMask() & ptTrig))// match with trigger
+                 EventInMassMatch++;
+
                hRapResonance->Fill(fVtot.Rapidity());
                hPtResonance->Fill(fVtot.Pt());
              }
@@ -316,16 +335,10 @@ TH1F *hInvMassRes;
   histoFile->Write();
   histoFile->Close();
 
-  cout << "MUONmassPlot " << endl;
-  cout << "FirstEvent " << FirstEvent << endl;
-  cout << "LastEvent " << LastEvent << endl;
-  cout << "ResType " << ResType << endl;
-  cout << "Chi2Cut " << Chi2Cut << endl;
-  cout << "PtCutMin " << PtCutMin << endl;
-  cout << "PtCutMax " << PtCutMax << endl;
-  cout << "massMin " << massMin << endl;
-  cout << "massMax " << massMax << endl;
+  cout << endl;
   cout << "EventInMass " << EventInMass << endl;
+  cout << "NbTrigger " << NbTrigger << endl;
+  cout << "EventInMass match with trigger " << EventInMassMatch << endl;
 
   return kTRUE;
 }