]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONmassPlot_ESD.C
Obsolete file (Ivana)
[u/mrichter/AliRoot.git] / MUON / MUONmassPlot_ESD.C
index fd99cde511df7d9c2fe6076e9c6e7dd2bae0169f..c507878e65062fb804f0882058710b8d639464ef 100644 (file)
@@ -1,5 +1,6 @@
 #if !defined(__CINT__) || defined(__MAKECINT__)
 // ROOT includes
+#include "TTree.h"
 #include "TBranch.h"
 #include "TClonesArray.h"
 #include "TLorentzVector.h"
@@ -16,6 +17,7 @@
 #include "AliHeader.h"
 #include "AliLoader.h"
 #include "AliStack.h"
+#include "AliMagF.h"
 #include "AliESD.h"
 
 // MUON includes
@@ -70,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.);
@@ -114,7 +115,10 @@ TH1F *hInvMassRes;
 
  
   TLorentzVector fV1, fV2, fVtot;
-  
+
+  // set off mag field 
+  AliMagF::SetReadField(kFALSE);
+
   // open run loader and load gAlice, kinematics and header
   AliRunLoader* runLoader = AliRunLoader::Open(filename);
   if (!runLoader) {
@@ -123,8 +127,6 @@ TH1F *hInvMassRes;
     return kFALSE;
   }
 
-  runLoader->LoadgAlice();
-  gAlice = runLoader->GetAliRun();
   if (!gAlice) {
     Error("MUONmass_ESD", "no galice object found");
     return kFALSE;
@@ -138,6 +140,14 @@ TH1F *hInvMassRes;
     return kFALSE;
   }
   
+  AliESD* esd = new AliESD();
+  TTree* tree = (TTree*) esdFile->Get("esdTree");
+  if (!tree) {
+    Error("CheckESD", "no ESD tree found");
+    return kFALSE;
+  }
+  tree->SetBranchAddress("ESD", &esd);
+
   runLoader->LoadHeader();
   nevents = runLoader->GetNumberOfEvents();
         
@@ -146,20 +156,18 @@ TH1F *hInvMassRes;
 
     // get current event
     runLoader->GetEvent(iEvent);
-    
+   
     // get the event summary data
-    char esdName[256]; 
-    sprintf(esdName, "ESD%d", iEvent);
-    AliESD* esd = (AliESD*) esdFile->Get(esdName);
+    tree->GetEvent(iEvent);
     if (!esd) {
-      Error("MUONmass_ESD", "no ESD object found for event %d", iEvent);
+      Error("CheckESD", "no ESD object found for event %d", iEvent);
       return kFALSE;
     }
 
-    Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ; //
+    Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ; 
 
     //    printf("\n Nb of events analysed: %d\r",iEvent);
-    //   cout << " number of tracks: " << nrectracks  <<endl;
+    //      cout << " number of tracks: " << nTracks  <<endl;
   
     // loop over all reconstructed tracks (also first track of combination)
     for (Int_t iTrack = 0; iTrack <  nTracks;  iTrack++) {
@@ -170,7 +178,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()));
@@ -220,7 +228,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()));
@@ -264,7 +272,7 @@ TH1F *hInvMassRes;
     } // for (Int_t iTrack = 0; iTrack < nrectracks; iTrack++)
 
     hNumberOfTrack->Fill(nTracks);
-    esdFile->Delete();
+    //    esdFile->Delete();
   } // for (Int_t iEvent = FirstEvent;
 
 // Loop over events for bg event