QA update by Sylwester
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jul 2008 17:14:06 +0000 (17:14 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jul 2008 17:14:06 +0000 (17:14 +0000)
TRD/qaAnalysis/AliTRDqaBasic.cxx [new file with mode: 0644]
TRD/qaAnalysis/AliTRDqaBasic.h [new file with mode: 0644]
TRD/qaAnalysis/AliTRDqaESDFriends.cxx
TRD/qaAnalysis/runTRDqaAnalysis.C

diff --git a/TRD/qaAnalysis/AliTRDqaBasic.cxx b/TRD/qaAnalysis/AliTRDqaBasic.cxx
new file mode 100644 (file)
index 0000000..5a815ec
--- /dev/null
@@ -0,0 +1,244 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDqaBasic.cxx 23387 2008-01-17 17:25:16Z cblume $ */
+
+//
+// This class is a part of a package of high level QA monitoring for TRD.
+//
+// S. Radomski
+// radomski@physi.uni-heidelberg.de
+// March 2008
+//
+
+#include "AliTRDqaBasic.h"
+#include "AliTRDqaAT.h"
+
+#include "TMath.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TChain.h"
+
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+
+//______________________________________________________________________________
+
+AliTRDqaBasic::AliTRDqaBasic() 
+  : AliAnalysisTask("",""),  
+    fChain(0),
+    fESD(0),
+    fOutputContainer(0),
+    fTrackCuts(0),
+    fStatus(0),
+    fnTracks(0),
+    fPtIn(0),
+    fPtOut(0),
+    fPtVtx(0),
+    fPtVtxSec(0),
+    fPtPt(0)
+{
+  //
+  // default dummy constructor
+  //
+}
+//______________________________________________________________________________
+
+AliTRDqaBasic:: AliTRDqaBasic(AliTRDqaBasic& /*trd*/)
+  : AliAnalysisTask("",""),  
+    fChain(0),
+    fESD(0),
+    fOutputContainer(0),
+    fTrackCuts(0),
+    fStatus(0),
+    fnTracks(0),
+    fPtIn(0),
+    fPtOut(0),
+    fPtVtx(0),
+    fPtVtxSec(0),
+    fPtPt(0)
+{
+  //
+  // Dummy copy constructor
+  //
+
+  //return *this;
+}
+
+
+//______________________________________________________________________________
+AliTRDqaBasic::AliTRDqaBasic(const char *name) 
+  : AliAnalysisTask(name,""),  
+    fChain(0),
+    fESD(0),
+    fOutputContainer(0),
+    fTrackCuts(0),
+    fStatus(0),
+    fnTracks(0),
+    fPtIn(0),
+    fPtOut(0),
+    fPtVtx(0),
+    fPtVtxSec(0),
+    fPtPt(0)
+{
+  // Constructor.
+  // Input slot #0 works with an Ntuple
+  DefineInput(0, TChain::Class());
+  // Output slot #0 writes into a TH1 container
+  DefineOutput(0,  TObjArray::Class()) ; 
+}
+
+//______________________________________________________________________________
+void AliTRDqaBasic::ConnectInputData(const Option_t *)
+{
+  // Initialisation of branch container and histograms 
+
+  //AliInfo(Form("*** Initialization of %s", GetName())) ; 
+
+  fChain = (TChain*)GetInputData(0);
+  fESD = new AliESDEvent();
+  fESD->ReadFromTree(fChain);
+}
+
+//________________________________________________________________________
+void AliTRDqaBasic::CreateOutputObjects()
+{
+  // build histograms
+  fStatus   = new TH1D("status", ";status bit", 32, -0.5, 31.5);
+  fPtIn     = new TH1D("ptIn", ";p_{T}, GeV/c", 100, 0, 15);
+  fPtOut    = new TH1D("ptOut", ";p_{T}, GeV/c", 100, 0, 15);
+  fPtVtx    = new TH1D("ptVtx", ";p_{T}, GeV/c", 100, 0, 15);
+  fPtVtxSec = new TH1D("ptVtxSec", ";p_{T}, GeV/c", 100, 0, 15);
+  fnTracks  = new TH1D("nTracks", "", 200, -0.5, 199.5);
+  
+  fPtPt     = new TH2D("ptpt", ";p_{T} from inner plane, GeV/c;p_{T} at vertex, GeV/c", 
+                      100, 0, 10, 100, 0, 10);
+
+  Int_t c = 0;
+  fOutputContainer = new TObjArray(50);
+
+  fOutputContainer->AddAt(fStatus, c++);
+  fOutputContainer->AddAt(fPtIn, c++);
+  fOutputContainer->AddAt(fPtOut, c++);
+  fOutputContainer->AddAt(fPtVtx, c++);
+  fOutputContainer->AddAt(fPtVtxSec, c++);
+  fOutputContainer->AddAt(fnTracks, c++);
+  fOutputContainer->AddAt(fPtPt, c++);  
+
+  printf("n hist = %d\n", c);
+  
+  // initialize cuts
+  fTrackCuts =  new AliESDtrackCuts("AliESDtrackCuts");
+  fTrackCuts->DefineHistograms(0);
+
+  // default cuts for ITS+TPC
+  Double_t cov1 = 2;
+  Double_t cov2 = 2;
+  Double_t cov3 = 0.5;
+  Double_t cov4 = 0.5;
+  Double_t cov5 = 2;
+  Double_t nSigma = 3;
+
+  TString tag("Global tracking");
+
+  fTrackCuts->SetMaxCovDiagonalElements(cov1, cov2, cov3, cov4, cov5);
+
+  fTrackCuts->SetMinNsigmaToVertex(nSigma);
+  fTrackCuts->SetRequireSigmaToVertex(kTRUE);
+
+  fTrackCuts->SetRequireTPCRefit(kTRUE);
+  fTrackCuts->SetAcceptKingDaughters(kFALSE);
+
+  fTrackCuts->SetMinNClustersTPC(50);
+  fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
+}
+//______________________________________________________________________________
+void AliTRDqaBasic::Exec(Option_t *) 
+{
+  // Process one event
+  Long64_t entry = fChain->GetReadEntry() ;
+  if (!(entry%100)) Info("Exec", "Entry = %ld", entry);
+
+  // Processing of one event 
+   
+  if (!fESD) {
+    //AliError("fESD is not connected to the input!") ; 
+    return ; 
+  }
+  
+  Int_t nTracks = fESD->GetNumberOfTracks();
+  fnTracks->Fill(nTracks); 
+
+  // track loop
+  for(Int_t i=0; i<nTracks; i++) {
+    
+    //
+    // track selection 
+    //
+    // param in and Out
+    // TRDrefit and TRDPid bit
+    //
+    AliESDtrack *track = fESD->GetTrack(i);
+    const AliExternalTrackParam *paramOut = track->GetOuterParam();
+    const AliExternalTrackParam *paramIn = track->GetInnerParam();
+
+    // long track ..
+    if (!paramIn) continue;
+    if (!paramOut) continue;
+    
+    UInt_t status = track->GetStatus();
+    if (!(status & AliESDtrack::kTPCrefit)) continue;
+
+    //if (!fTrackCuts->AcceptTrack(track)) continue;
+    
+    AliTRDqaAT::FillStatus(fStatus, status);
+
+    fPtIn->Fill(paramIn->Pt());
+    fPtOut->Fill(paramOut->Pt());
+    fPtVtx->Fill(track->Pt());
+    if (track->GetConstrainedParam())
+      fPtVtxSec->Fill(track->GetConstrainedParam()->Pt());
+    
+    fPtPt->Fill(paramIn->Pt(), track->Pt());
+  }
+
+  PostData(0, fOutputContainer);
+}
+
+//______________________________________________________________________________
+void AliTRDqaBasic::Terminate(Option_t *)
+{
+  // save histograms
+  fOutputContainer = (TObjArray*)GetOutputData(0);
+  
+  TFile *file = new TFile("outBasic.root", "RECREATE");
+  fOutputContainer->Write();
+  file->Flush();
+  file->Close();
+  delete file;
+
+  //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) {
+  //  TObject *obj = fOu
+  // }
+}
+
+//______________________________________________________________________________
diff --git a/TRD/qaAnalysis/AliTRDqaBasic.h b/TRD/qaAnalysis/AliTRDqaBasic.h
new file mode 100644 (file)
index 0000000..aa7bc5e
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef ALITRDQBASIC_H
+#define ALITRDQBASIC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+/* $Id: AliTRDqaBasic.h 23387 2008-01-17 17:25:16Z cblume $ */
+
+////////////////////////////////////////////////////////////////////////////
+//
+// This class is a part of a package of high level QA monitoring for TRD.
+//
+// S. Radomski
+// radomski@physi.uni-heidelberg.de
+// March 2008
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliAnalysisTask.h"  
+
+class TTree; 
+class AliESDEvent; 
+class TH1D; 
+class TH2D;
+class AliExternalTrackParam;
+class AliESDtrackCuts;
+
+class AliTRDqaBasic : public AliAnalysisTask {
+
+ public:
+
+  AliTRDqaBasic();
+  AliTRDqaBasic(const char *name);
+  AliTRDqaBasic(AliTRDqaBasic& trd);
+  AliTRDqaBasic& operator = (const AliTRDqaBasic& /*g*/) { return *this; };
+  virtual ~AliTRDqaBasic() {}
+   
+  virtual void Exec(Option_t * opt = "");
+  virtual void ConnectInputData(Option_t *);
+  virtual void CreateOutputObjects();
+  virtual void Terminate(Option_t * opt = "");
+
+ private:
+  TTree        * fChain;             //!pointer to the analyzed TTree or TChain
+  AliESDEvent  * fESD;               //! Declaration of leave types
+
+  TObjArray * fOutputContainer;      //! output data container
+  
+  // cuts
+  AliESDtrackCuts *fTrackCuts;       // Cuts
+
+  // histograms
+
+  TH1D *fStatus;                     // track status
+
+  TH1D *fnTracks;                    // histogram
+  TH1D *fPtIn;                       // histogram
+  TH1D *fPtOut;                      // histogram
+  TH1D *fPtVtx;                      // histogram
+  TH1D *fPtVtxSec;                   // histogram
+
+  TH2D *fPtPt;                       // histogram
+
+  ClassDef(AliTRDqaBasic, 0);        // a TRD analysis task 
+
+};
+#endif // ALITRDQBASIC_H
index c70cda4..b325113 100644 (file)
@@ -116,7 +116,8 @@ void AliTRDqaESDFriends::Exec(Option_t *)
 {
   // Process one event
   
-  //Long64_t entry = fChain->GetReadEntry() ;
+  Long64_t entry = fChain->GetReadEntry() ;
+  if (!(entry%100)) Info("Exec", "Entry = %ld", entry);
 
   // Processing of one event 
    
@@ -152,7 +153,20 @@ void AliTRDqaESDFriends::Exec(Option_t *)
     if (track->GetTRDpidQuality() < 6) continue;
 
     // standard selection
+    AliESDfriend *fr = (AliESDfriend*)fESD->FindListObject("AliESDfriend");
+    if (fr) fESD->SetESDfriend(fr);
+
+    AliESDfriendTrack *f = (AliESDfriendTrack*)track->GetFriendTrack();
     
+    if (!f) continue;
+
+    //AliKalmanTrack *trdTrack = 0;
+    //if (f) trdTrack = f->GetTRDtrack();
+    //if (trdTrack) trdTrack->Print();
+
+    //if (f) f->Dump();
+    //if (f) f->Print();
+      
     //  fESD->GetList()->Print();
     //AliESDfriend *f = (AliESDfriend*)fESD->FindListObject("ESDfriend");
     //if (f) f->Print();
index 29b0dea..ad89317 100644 (file)
@@ -7,15 +7,25 @@ void runTRDqaAnalysis(const char *chainName, int limit = 0) {
   // limit -- number of files to be processed
   //
   //
+  
+  /**/
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libSTEERBase.so");
+  gSystem->Load("libESD.so");
+  /**/
 
   gSystem->Load("libANALYSIS.so");
+  gSystem->Load("libANALYSISalice.so");
   gSystem->Load("libTRDqaAnalysis.so");
   
-    // Setup chain
+  // Setup chain
   TChain *chain = new TChain("esdTree");
   //chain->SetBranchStatus("*",0);
   //chain->SetBranchStatus("*fTracks*",1);
-  //esdTree->SetBranchStatus("ESDfriend*",1);
+  //chain->SetBranchStatus("ESDfriend*",1);
+  //chain->SetBranchStatus("ESDfriend.*",1);
 
   int nfiles = 0;
   fstream  coll(chainName, ios_base::in);
@@ -28,14 +38,15 @@ void runTRDqaAnalysis(const char *chainName, int limit = 0) {
   } 
   
   // Create an analysis manager
-  AliAnalysisManager *mgr = new AliAnalysisManager("qaTasks", "No safety");
-  AliAnalysisTask *tasks[4];
-  AliAnalysisDataContainer *out[4];
+  AliAnalysisManager *mgr = new AliAnalysisManager("qaTasks", "title");
+  AliAnalysisTask *tasks[5];
+  AliAnalysisDataContainer *out[5];
 
   tasks[0] = new AliTRDqaElectronSpectra("trdElectronSpectra");
   tasks[1] = new AliTRDqaESDFriends("trdESDFriends");
   tasks[2] = new AliTRDqaEnergyDeposit("trdEnergyDeposit");
-  tasks[3] = new AliTRDqaJPsi("trdJPsi");
+  tasks[3] = new AliTRDqaBasic("trdBasic");
+  tasks[4] = new AliTRDqaJPsi("trdJPsi");
   
   AliAnalysisDataContainer *cinput = 
     mgr->CreateContainer("inputESD", TTree::Class(), AliAnalysisManager::kInputContainer);
@@ -43,7 +54,8 @@ void runTRDqaAnalysis(const char *chainName, int limit = 0) {
   out[0] = mgr->CreateContainer("oES", TObjArray::Class(), AliAnalysisManager::kOutputContainer);
   out[1] = mgr->CreateContainer("oEF", TObjArray::Class(), AliAnalysisManager::kOutputContainer);
   out[2] = mgr->CreateContainer("oED", TObjArray::Class(), AliAnalysisManager::kOutputContainer);
-  out[3] = mgr->CreateContainer("oEJ", TObjArray::Class(), AliAnalysisManager::kOutputContainer);  
+  out[3] = mgr->CreateContainer("oBS", TObjArray::Class(), AliAnalysisManager::kOutputContainer);
+  out[4] = mgr->CreateContainer("oEJ", TObjArray::Class(), AliAnalysisManager::kOutputContainer);  
 
   // register
   for(int i=0; i<4; i++) {