]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Preparation for the FEC parameter tuning studies
authormivanov <marian.ivanov@cern.ch>
Thu, 23 Jan 2014 14:15:11 +0000 (15:15 +0100)
committermivanov <marian.ivanov@cern.ch>
Thu, 23 Jan 2014 14:15:11 +0000 (15:15 +0100)
TPC/fastSimul/AliTPCclusterFast.cxx
TPC/fastSimul/README.txt
TPC/fastSimul/simul.C
TPC/fastSimul/simul.sh

index 27fcdc5526ba3c4471912c90684a02a2a4afa37d..41c38b97d8639634cc1bc30303e1d991a4e444a3 100644 (file)
@@ -21,7 +21,6 @@
 #include "TVectorD.h"
 #include "TMatrixD.h"
 #include "TH1.h"
-#include "THnSparse.h"
 #include "TClonesArray.h"
 #include "TTreeStream.h"
 
@@ -80,8 +79,6 @@ public:
   AliTPCtrackFast();
   void Add(AliTPCtrackFast &track2);
   void MakeTrack();
-  void UpdatedEdxHisto();
-  void MakeHisto();
   static void Simul(const char* simul, Int_t ntracks);
   Double_t  CookdEdxNtot(Double_t f0,Float_t f1);
   Double_t  CookdEdxQtot(Double_t f0,Float_t f1);
@@ -99,15 +96,6 @@ public:
   TClonesArray *fCl;   // array of clusters  
   //
   Bool_t   fInit;      // initialization flag
-  THnSparse    *fHistoNtot;    // histograms of trunc mean Ntot
-  THnSparse    *fHistoQtot;    // histograms of trunc mean Qtot
-  THnSparse    *fHistoQNtot;   // histograms of trunc mean Qtot/Ntot
-  //
-  THnSparse    *fHistoDtot;    // histograms of trunc mean digit tot
-  THnSparse    *fHistoDmax;    // histograms of trunc mean digit max
-  THnSparse    *fHistoDtotRaw;    // histograms of trunc mean digit tot
-  THnSparse    *fHistoDmaxRaw;    // histograms of trunc mean digit max
-
   //
   //
   ClassDef(AliTPCtrackFast,2)  // container for
@@ -133,14 +121,7 @@ AliTPCtrackFast::AliTPCtrackFast():
   fAngleZ(0),
   fN(0),
   fCl(0),
-  fInit(kFALSE),
-  fHistoNtot(0),
-  fHistoQtot(0),
-  fHistoQNtot(0),
-  fHistoDtot(0),
-  fHistoDmax(0),
-  fHistoDtotRaw(0),
-  fHistoDmaxRaw(0)
+  fInit(kFALSE)
 {
   //
   //
@@ -150,96 +131,9 @@ AliTPCtrackFast::AliTPCtrackFast():
 void AliTPCtrackFast::Add(AliTPCtrackFast &track2){
   if (!track2.fInit) return;
   
-  fHistoNtot->Add(track2.fHistoNtot);    // histograms of trunc mean Ntot
-  fHistoQtot->Add(track2.fHistoQtot);    // histograms of trunc mean Qtot
-  fHistoQNtot->Add(track2.fHistoQNtot);   // histograms of trunc mean Qtot/Ntot
-  //
-  fHistoDtot->Add(track2.fHistoDtot);    // histograms of trunc mean digit tot
-  fHistoDmax->Add(track2.fHistoDmax);    // histograms of trunc mean digit max
-  fHistoDtotRaw->Add(track2.fHistoDtotRaw);    // histograms of trunc mean digit tot
-  fHistoDmaxRaw->Add(track2.fHistoDmaxRaw);    // histograms of trunc mean digit max
 }
 
-void AliTPCtrackFast::MakeHisto(){
-  //
-  // make default histo
-  //
-  // dEdx histogram THnSparse
-  // 0 - value
-  // 1 - fMNprim - number of generated primaries
-  // 2 - fNpoints
-  // 3 - fFraction
-  // 4 - fDiff
-  // 5 - fAngleY
-  // 6 - fAngleZ
-  
-  Double_t xmin[7],  xmax[7];
-  Int_t    nbins[7];
-  if (fInit) return;
-  //
-  nbins[1] = 10; xmin[1]=10;  xmax[1]=30;    // fMNprim
-  nbins[2] = 8;  xmin[2]=80;  xmax[2]=160;   // fNPoints
-  nbins[3] = 6;  xmin[3]=0.45; xmax[3]=1.05;     // trunc mean fraction
-
-  nbins[4] = 5;  xmin[4]=0.0; xmax[4]=0.4;   // fDiff
-  nbins[5] = 10; xmin[5]=0;   xmax[5]=2;     // fAngleY
-  nbins[6] = 10; xmin[6]=0;   xmax[6]=2;     // fAngleZ
-  //
-  nbins[0] =100; xmin[0]=2; xmax[0]=8;
-  fHistoNtot = new THnSparseF("dNdxall/dNdxprim","dNdxall/dNdxprim", 4, nbins, xmin,xmax);
-  nbins[0] =100; xmin[0]=2; xmax[0]=8;
-  fHistoQtot = new THnSparseF("dQdx/dNdxprim","dQdxall/dNdxprim", 4, nbins, xmin,xmax);
-  nbins[0] =100; xmin[0]=0.5; xmax[0]=1.5;
-  fHistoQNtot = new THnSparseF("dQdx/dNdxprim","dQdxprim/dNdxprim", 4, nbins, xmin,xmax);
-  //
-  nbins[0] =100; xmin[0]=0.05; xmax[0]=8;
-  fHistoDtot = new THnSparseF("dQtotdx/dNdxprim","dQtotdx/dNdx", 7, nbins, xmin,xmax);
-  fHistoDmax = new THnSparseF("dQmaxdx/dNdxprim","dQmaxdx/dNdx", 7, nbins, xmin,xmax);
-  fHistoDtotRaw = new THnSparseF("raw dQtotdx/dNdxprim","raw dQtotdx/dNdx", 7, nbins, xmin,xmax);
-  fHistoDmaxRaw = new THnSparseF("raw dQmaxdx/dNdxprim","raw dQmaxdx/dNdx", 7, nbins, xmin,xmax);
-  fInit=kTRUE;
-}
 
-void  AliTPCtrackFast::UpdatedEdxHisto(){
-  //
-  //fill default histo
-  //
-  if (!fInit) MakeHisto();
-  Double_t x[7];
-  x[1] = fMNprim;
-  x[2] = fN;
-  //
-  x[4] = fDiff;
-  x[5] = TMath::Abs(fAngleY);
-  x[6] = TMath::Abs(fAngleZ);
-
-  for (Int_t i=0;i<7;i++){
-    Float_t frac = 0.5+Float_t(i)*0.1;
-    x[3] = frac;
-    Double_t cNtot = CookdEdxNtot(0.01,frac);
-    Double_t cQtot = CookdEdxQtot(0.01,frac);
-    // MC -using hits
-    x[0] = cNtot/fMNprim;
-    fHistoNtot->Fill(x);
-    x[0] = cQtot/fMNprim;
-    fHistoQtot->Fill(x);
-    x[0] = cQtot/cNtot;
-    fHistoQNtot->Fill(x);
-    // MC - using digits 
-    Double_t dQtot = CookdEdxDtot(0.01,frac,1,2.5,1,kTRUE);
-    Double_t dQmax = CookdEdxDmax(0.01,frac,1,2.5,1,kTRUE);
-    Double_t dQrawtot = CookdEdxDtot(0.01,frac,1,2.5,1,kFALSE);
-    Double_t dQrawmax = CookdEdxDmax(0.01,frac,1,2.5,1,kFALSE);
-    x[0] = dQtot/fMNprim;
-    fHistoDtot->Fill(x);
-    x[0] = dQmax/fMNprim;
-    fHistoDmax->Fill(x);
-    x[0] = dQrawtot/fMNprim;
-    fHistoDtotRaw->Fill(x);
-    x[0] = dQrawmax/fMNprim;
-    fHistoDmaxRaw->Fill(x);
-  }
-}
 
 void AliTPCtrackFast::MakeTrack(){
   //
@@ -259,7 +153,6 @@ void AliTPCtrackFast::MakeTrack(){
     cluster->GenerElectrons();
     cluster->Digitize();
   }
-  UpdatedEdxHisto();
 }
 
 Double_t  AliTPCtrackFast::CookdEdxNtot(Double_t f0,Float_t f1){
@@ -344,7 +237,7 @@ void AliTPCtrackFast::Simul(const char* fname, Int_t ntracks){
   // 
   //
   AliTPCtrackFast fast;
-  TTreeSRedirector cstream(fname);
+  TTreeSRedirector cstream(fname,"recreate");
   for (Int_t itr=0; itr<ntracks; itr++){
     //
     fast.fMNprim=(5+50*gRandom->Rndm());
index 75b52bdca5721e92d255e948c2c1e8de05296a25..4f3fc004e3c3b2f954983235137bd78304969f91 100644 (file)
@@ -1,9 +1,34 @@
+#############################################################################################
 Macros to do fast simulation of processes important for tuning of reconstruction.
+Currently fast simulation of ionization digitization and cluster finder - AliTPCclusterFast
+#############################################################################################
 
-Currently fast simulation of ionization digitization and cluster
-finder - AliTPCclusterFast
 
-And the edge effect in rphi testEdgeFit.C
+How to use it?
+a) which macro to use (I know it was somewhere in AliRoot but with the GIT page I dont find it anymore),
+b) what is the basic functionality of the functions
+c) what do I need to run it (aliroot version?) 
+d) how would I run it and extract space point resolution and dEdx resolution
+    (best step by step for dummies)?
 
 
 
+
+a) Which macro to use (I know it was somewhere in AliRoot
+
+   Example case - submit 40 jobs with 100 tracks.
+   
+   source $ALICE_ROOT/TPCdev/TPC/fastSimul/simul.sh
+   makeEnvLocal             #this is just example please setup your environmnet script to set env variables 
+   makeSubmitRUN 40 100
+
+c) what do I need to run it (aliroot version?) 
+   Recent AliRoot
+
+
+b) What is the basic functionality of the functions?
+   Provides cluster and track functionitility - possible to modify parameters of the reconstruction/ resp. harware setup   See example usage simul.C:DrawdEdxResolExample()
+   
+   
+   
+
index c7d42001a4622d028b4a8c8bf9a847c22c80e382..3b5f76bc4d9704d9599d60a87e64bd001655f8d0 100644 (file)
@@ -1,24 +1,11 @@
 /*
 
-gROOT->LoadMacro("$ALICE_ROOT/TPC/fastSimul/AliTPCclusterFast.cxx+");
-.L $ALICE_ROOT/TPC/fastSimul/simul.C
-//Merge()
+  Macro to generate random tracks and clusters.
+  Fast MC - Geant equivalent used
 
-TFile f("mergetrack.root");
-track = (AliTPCtrackFast*)f.Get("track");
-//
-// Draw debug stream
-//
-gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
-gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
-AliXRDPROOFtoolkit tool;
-TChain * chain = tool.MakeChain("track.txt","simulTrack",0,200000);
-chain->Lookup();
- gProof->Exec("gSystem->Load(\"$ALICE_ROOT/TPC/fastSimul/AliTPCclusterFast_cxx.so\")",kFALSE);
 
 */
 
-class THnSparse;
 
 void simul(Int_t npoints){ 
   //
@@ -26,7 +13,8 @@ void simul(Int_t npoints){
   //
   printf("Hallo world\n");
   gRandom->SetSeed(0);
-  gROOT->LoadMacro("$ALICE_ROOT/TPC/fastSimul/AliTPCclusterFast.cxx+");
+  gROOT->LoadMacro("$mcPath/AliTPCclusterFast.cxx+");
   AliTPCclusterFast::fPRF = new TF1("fprf","gausn",-5,5);
   AliTPCclusterFast::fTRF = new TF1("ftrf","gausn",-5,5);
   AliTPCclusterFast::fPRF->SetParameters(1,0,0.5);
@@ -65,119 +53,25 @@ void Merge(){
 
 
 
-void DrawDedxMC(THnSparse * hstat){
-  //
+
+void DrawdEdxResolExample(){
   //
+  // Example analysis to make an space point resolution study
   //
-  TH1 * hisMean[7];
-  TH1 * hisSigma[7];
-  TObjArray arr;
-  for (Int_t ifrac=0; ifrac<6; ifrac++){
-    Float_t frac = 0.5+0.1*Float_t(ifrac);
-    hstat->GetAxis(3)->SetRange(ifrac+1,ifrac+1);
-    hstat->GetAxis(2)->SetRangeUser(120,160);
-    TH2F * his = (TH2F*)hstat->Projection(0,1);
-    his->FitSlicesY(0,0,-1,0,"QNR",&arr);
-    delete his;
-    hisMean[ifrac]  = (TH1*) arr.At(1)->Clone();
-    hisSigma[ifrac] = (TH1*) arr.At(2)->Clone();
-    arr.SetOwner(kTRUE); arr.Delete();
-    //
-    hisSigma[ifrac]->Divide(hisMean[ifrac]);
-    hisMean[ifrac]->SetMaximum(6);
-    hisMean[ifrac]->SetMinimum(0);
-    hisSigma[ifrac]->SetMaximum(0.07);
-    hisSigma[ifrac]->SetMinimum(0.03);
-    //
-    hisMean[ifrac]->SetDirectory(0);
-    hisSigma[ifrac]->SetDirectory(0);
-    hisMean[ifrac]->SetXTitle("N_{prim}");
-    hisSigma[ifrac]->SetXTitle("N_{prim}");
-    hisMean[ifrac]->SetYTitle("Q/N_{prim}");
-    hisSigma[ifrac]->SetYTitle("#sigma_{Q/N_{prim}}/(Q/N_{prim})");
-    hisMean[ifrac]->SetMarkerColor(kmicolors[ifrac+1]);
-    hisMean[ifrac]->SetMarkerStyle(kmimarkers[ifrac+1]);
-    hisSigma[ifrac]->SetMarkerColor(kmicolors[ifrac+1]);
-    hisSigma[ifrac]->SetMarkerStyle(kmimarkers[ifrac+1]);
-  }
-  TCanvas * c = new TCanvas(hstat->GetName(),hstat->GetName(),600,800);
-  TLegend *legend = new TLegend(0.55,0.70,0.95,0.95, hstat->GetName());
-  c->Divide(1,2);
-  for (Int_t ifrac=0; ifrac<6; ifrac++){
-    c->cd(1);
-    if (ifrac==0) hisMean[ifrac]->Draw();
-    legend->AddEntry(hisMean[ifrac],Form("%f",0.5+0.1*ifrac));
-    hisMean[ifrac]->Draw("same");
-    c->cd(2);
-    if (ifrac==0) hisSigma[ifrac]->Draw();
-    hisSigma[ifrac]->Draw("same");
-  }
-  c->Draw();
-  legend->Draw();
-  TString fname=hstat->GetName();
-  fname.ReplaceAll("/","_");
-  c->SaveAs(Form("pic/%s.eps",fname.Data()));
-  c->SaveAs(Form("pic/%s.gif",fname.Data()));
-  c->SaveAs(Form("pic/%s.root",fname.Data()));
-}
-
-
-
+  TChain * chain  = AliXRDPROOFtoolkit::MakeChain("trackerSimul.list", "simulTrack",0,100); 
+  chain->SetCacheSize(10000000000);
 
-void DrawDedxN(THnSparse * hstat){
   //
+  // 1.) Qmax/Qtot as function of the input ionization density
   //
+  chain->Draw("tr.CookdEdxDmax(0,0.6,1,0,1,0)/tr.CookdEdxDtot(0,0.6,1,0,1,0):tr.fMNprim>>hisQtotMax(10,10,50)","","prof",10000);
   //
-  TH1 * hisMean[7];
-  TH1 * hisSigma[7];
-  TObjArray arr;
-  for (Int_t ifrac=0; ifrac<6; ifrac++){
-    Float_t frac = 0.5+0.1*Float_t(ifrac);
-    hstat->GetAxis(3)->SetRange(ifrac+1,ifrac+1);
-    hstat->GetAxis(2)->SetRangeUser(80,160);
-    hstat->GetAxis(1)->SetRangeUser(15,18);
-    TH2F * his = (TH2F*)hstat->Projection(0,2);
-    his->FitSlicesY(0,0,-1,0,"QNR",&arr);
-    delete his;
-    hisMean[ifrac]  = (TH1*) arr.At(1)->Clone();
-    hisSigma[ifrac] = (TH1*) arr.At(2)->Clone();
-    arr.SetOwner(kTRUE); arr.Delete();
-    //
-    hisSigma[ifrac]->Divide(hisMean[ifrac]);
-    hisMean[ifrac]->SetMaximum(6);
-    hisMean[ifrac]->SetMinimum(0);
-    hisSigma[ifrac]->SetMaximum(0.07);
-    hisSigma[ifrac]->SetMinimum(0.03);
-    //
-    hisMean[ifrac]->SetDirectory(0);
-    hisSigma[ifrac]->SetDirectory(0);
-    hisMean[ifrac]->SetXTitle("N_{cl}");
-    hisSigma[ifrac]->SetXTitle("N_{cl}");
-    hisMean[ifrac]->SetYTitle("Q/N_{prim}");
-    hisSigma[ifrac]->SetYTitle("#sigma_{Q/N_{prim}}/(Q/N_{prim})");
-    hisMean[ifrac]->SetMarkerColor(kmicolors[ifrac+1]);
-    hisMean[ifrac]->SetMarkerStyle(kmimarkers[ifrac+1]);
-    hisSigma[ifrac]->SetMarkerColor(kmicolors[ifrac+1]);
-    hisSigma[ifrac]->SetMarkerStyle(kmimarkers[ifrac+1]);
-  }
-  TCanvas * c = new TCanvas(hstat->GetName(),hstat->GetName(),600,800);
-  TLegend *legend = new TLegend(0.55,0.70,0.95,0.95, hstat->GetName());
-  c->Divide(1,2);
-  for (Int_t ifrac=0; ifrac<6; ifrac++){
-    c->cd(1);
-    if (ifrac==0) hisMean[ifrac]->Draw();
-    legend->AddEntry(hisMean[ifrac],Form("%f",0.5+0.1*ifrac));
-    hisMean[ifrac]->Draw("same");
-    c->cd(2);
-    if (ifrac==0) hisSigma[ifrac]->Draw();
-    hisSigma[ifrac]->Draw("same");
-  }
-  c->Draw();
-  legend->Draw();
-  TString fname=hstat->GetName();
-  fname+="NCl";
-  fname.ReplaceAll("/","_");
-  c->SaveAs(Form("pic/%s.eps",fname.Data()));
-  c->SaveAs(Form("pic/%s.gif",fname.Data()));
-  c->SaveAs(Form("pic/%s.root",fname.Data()));
+  // 2.) Non linearity due to the tucncation Qtot_{60%}/Qtot 100% 
+  //
+  chain->Draw("tr.CookdEdxDtot(0,0.6,1,0,1,0)/tr.CookdEdxDtot(0,0.99,1,0,1,0):tr.fMNprim>>hisQtot60100(10,10,50)","","prof",10000);
+  //
+  //
+  //
+
+
 }
index bab94432601934b593dcdbbcd106c68a3cf7295d..9d555b811cf181126c6f87a0853b418c8606e05b 100755 (executable)
@@ -1,32 +1,93 @@
 #!/bin/sh
 
-# 1 argument      - the path to the environment setup
-# 2 argument      - the job ID
-# 3 argument      - number of events in the file
-# 4 argument      - output path
-
-# Example
-# myvar=0
-# $ALICE_ROOT/TPC/fastSimul/simul.sh  /u/miranov/.balice64HEAD0108 $myvar 1000 `pwd`
-# while [ $myvar -ne 100 ] ; do bsub  do something ;  myvar=$(( $myvar + 1 )) ; echo $myvar ; done
+
+
+main()
+{
+  #
+  # run in proper action depending on the selection
+  #  
+  if [[ $# -lt 1 ]]; then
+    if [[ ! "$0" =~ "bash" ]]; then
+      echo " Please select action"
+    fi
+    return
+  fi
+  runMode=$1
+  umask 0002
+  shift
+  case $runMode in
+   "runJob") runJob "$@";;
+    "makeEnvLocal") makeEnvLocal "$@";;
+    "makeSubmitRun") makeSubmitRun "$@";;
+   *) 
+   eval "${runMode} $@" 
+   ;;
+  esac
+  return;
+}
+
+
+
+exampleCase(){
 #
-# 1 SETUP given ROOT and ALIROOT
+#  Example case to subit Toy MC jobs
+# 
+   source $ALICE_ROOT/TPCdev/TPC/fastSimul/simul.sh
+   makeEnvLocal
+   makeSubmitRUN 40 100
+   ls `pwd`/MC*/trackerSimul.root >  trackerSimul.list
+
+}
+
+
+
+runJob()
+{
+#runFastMCJob      
+    echo  $ROOTSYS
+    which root.exe
+    which aliroot
+    echo PWD `pwd`
+    ntracks=$1
+    echo Submitting ntracks = $ntracks
+    echo command aliroot  -q -b  "$mcPath/simul.C\($ntracks\)"    
+    command aliroot  -q -b  "$mcPath/simul.C($ntracks)"    
+    return;
+}
+
+
+makeEnvLocal(){
 #
-echo   $1
-source $1
-echo  $ROOTSYS
-which root.exe
-which aliroot
 #
-#  make directory
+# Example usage local 
+# jobs to be submitted form the lxb1001 or lxb1002
+#(here we have 80 nodes and user disk)
+# 
+    echo makeEnvLocal
+    export baliceTPC=$HOME/.baliceTPC
+    export mcPath=$ALICE_ROOT/TPC/fastSimul
+    export batchCommand="qsub -cwd  -V "
+}
+
+makeSubmitRUN(){
 #
+# submits jobs
+#   
+    wdir=`pwd`;
+    njobs=$1
+    ntracks=$2
+    for (( job=1; job <= $njobs; job++ ));  do  
+       echo $job;  
+       mkdir $wdir/MC$job
+       cd $wdir/MC$job
+       echo $batchCommand    -o  toyMC.log  $mcPath/simul.sh runJob  $ntracks
+       $batchCommand    -o  toyMC.log  $mcPath/simul.sh runJob $ntracks
+       cd $wdir
+    done 
+}
+
+
 
-cd $4
-mkdir $2
-cd $2
-cp ~/rootlogon.C .
-echo Job ID  $2
-echo
-echo PWD `pwd`
+main "$@"
 
-command aliroot  -q -b  "$ALICE_ROOT/TPC/fastSimul/simul.C($3)"
\ No newline at end of file