Presentation is loading. Please wait.

Presentation is loading. Please wait.

May 17 and 22, 20071 ALICE Offline Tutorial Markus Oldenburg – CERN May 17 and 22, 2007 – University of Sao Paulo.

Similar presentations

Presentation on theme: "May 17 and 22, 20071 ALICE Offline Tutorial Markus Oldenburg – CERN May 17 and 22, 2007 – University of Sao Paulo."— Presentation transcript:

1 May 17 and 22, 20071 ALICE Offline Tutorial Markus Oldenburg – CERN May 17 and 22, 2007 – University of Sao Paulo

2 May 17 and 22, 20072 ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, A.Peters, P.Saiz April 13, 2007 – v1.3 based on:

3 May 17 and 22, 20073 Part IV: PROOF Hands on training available online at: -> Seminars for more information (and more available data):

4 May 17 and 22, 20074 Warm up Preconditions login to make sure you are using the bash shell, otherwise switch to it echo $SHELL, bash set the correct environment (this works only for bash) source /afs/ Copy file from to a local directory and extract it Check AliROOT Start AliROOT. Does it show ROOT version 5.15/04? $ALICE_ROOT/STEER/AliSelector.h available? Add AliROOT include path To ~/.rootrc add ACLiC.IncludePaths: -I$(ALICE_ROOT)/include Go to the local directory from above Open AliROOT and load the TTree library: gSystem->Load(libTree) test if selector can be compiled.L AliMultiplicityESDSelector.cxx+

5 May 17 and 22, 20075 Some of the prerequisites of the last slide will not be necessary in the future! We needed to setup a working environment for now (Scientific Linux 3, correct Root version in combination with working ESD library in order to access PDC06 data). In general (in the ideal case ) you should be able to log in to (SLx4) and upload your current ESD library. In the near future the same versions of ROOT/AliRoot will be provided on lxplus as they are on CAF.

6 May 17 and 22, 20076 Files to be used CreateESDChain.C Creates a chain from a list of file names ESD100_110_v2.txt List of prod2006_2 PDC06 files distributed on the CAF ESD.par Par archive for PDC06 data ProofEnableAliRoot.C Enables an installed AliROOT on the CAF cluster AliMultiplicityESDSelector.{cxx,h} Selector that creates a uncorrected multiplicity histogram from the ESD AliMultiplicityMCSelector.{cxx,h} Selector that creates a multiplicity histogram from the MC AliEmptySelector.{cxx,h} Empty selector that can be used as a skeleton for your own analysis

7 May 17 and 22, 20077 Run selector locally Start AliRoot gSystem->Load(libTree) Create a chain chain = new TChain(esdTree) chain->Add(root:// //proofpool/pdc06/100/002/ chain->GetEntries() // Should return 100 Execute a selector locally chain->Process(AliMultiplicity ESDSelector.cxx++) NB: Instead of AliRoot, use root and root [0] gSystem->Load("libGeom") // pointer to geometry root [1] gSystem->Load("libEG") // pointer to PDG database root [2] gSystem->Load("libTree) // TTree library root [3] gSystem->Load("libESD) // ESD library

8 May 17 and 22, 20078 Run selector with PROOF Start ROOT and create chain as before chain = new TChain(esdTree) chain->Add(root:// pdc06/100/002/ Connect to PROOF server proof = TProof::Open( @lxb6046) Upload the ESD package proof->UploadPackage(ESD.par) proof->EnablePackage(ESD) Execute with PROOF chain->SetProof() chain->Process(AliMultiplicity ESDSelector.cxx++)

9 May 17 and 22, 20079 Run with a long chain Create longer chain.L CreateESDChain.C chain = CreateESDChain(ESD100_110_v2.txt) Execute the selector with PROOF chain->SetProof() chain->Process(AliMultiplicityESDSelector.cxx++) NB: Without CreateESDChain.C, do the following: chain = new TChain("esdTree") int count=0; TString file; ifstream in;"ESD100_110_v2.txt") while((++count >file)) chain->Add(file.Data());

10 May 17 and 22, 200710 Looking at the Selector SlaveBegin Called once per Slave before processing Multiplicity histogram is created Process Called once per event Tracks are counted, histogram filled SlaveTerminate Called once per Slave after processing Multiplicity histogram is filled into the output list Terminate Called once on the client (your laptop/PC) Multiplicity histogram is read from the output list and displayed

11 May 17 and 22, 200711 Changing the Selector Add a | | < 0.5 cut Int_t nGoodTracks = 0; for (Int_t i=0; i GetNumberOfTracks(); ++i) { AliESDtrack* track = fESD->GetTrack(i); Double_t p[3]; track->GetConstrainedPxPyPz(p); TVector3 vector(p); Float_t eta = vector.Eta(); if (TMath::Abs(eta) < 0.5) nGoodTracks++; } fMultiplicity->Fill(nGoodTracks);

12 May 17 and 22, 200712 Changing the Selector (2) Add a second plot: distribution Header file (.h file) Add new member: TH1F* fEta; // eta distribution Constructor Initialize member: fEta(0) SlaveBegin Create histogram fEta = new TH1F("fEta", "#eta distribution", 20, -2., 2.); Process Get like in previous example Fill histogram: fEta->Fill(eta);

13 May 17 and 22, 200713 Changing the Selector (3) SlaveTerminate Add histogram to the output list: fOutput->Add(fEta); Terminate Read histogram from the output list fEta = dynamic_cast (fOutput->FindObject("fEta")); Introduce an if statement if the object was retrieved if (!fEta) { AliDebug(AliLog::kError, fEta was not found); return; } Draw the histogram new TCanvas; fEta->DrawCopy();

14 May 17 and 22, 200714 Learning about Branches The ESD tree consists of several branches Switching off not needed branches increases speed of analysis significantly Looking at the available branches chain = new TChain(esdTree) chain->Add(root:// pdc06/100/002/ chain->Print() Disable all branches (in Init) tree->SetBranchStatus("*", 0) Enable a needed branch (in Init) tree->SetBranchStatus(fTracks.fCp, 1) Try this! What is the increase in processing speed?

15 May 17 and 22, 200715 Running with full AliROOT Start AliROOT Connect to PROOF server proof = TProof::Open( @lxb6046) Enable AliROOT.x ProofEnableAliRoot.C Create Chain.L CreateESDChain.C chain = CreateESDChain( ESD100_110_v2.txt) Execute the selector that accesses MC chain->SetProof() chain->Process(AliMultiplicity MCSelector.cxx++)

16 May 17 and 22, 200716 Accessing the event header AliSelectorRL::GetHeader returns the header Make AliHeader known to the class #include Retrieve the header (in Process) AliHeader* header = GetHeader(); if (!header) { AliDebug(AliLog::kError, "Header not available"); return kFALSE; } Retrieve a value from the header printf("This is run %d.\n", header->GetRun()); Run it and look at the log

17 May 17 and 22, 200717 Your own selector Start from AliEmptySelector Find a name Copy AliEmptySelector.h/.cxx to.h/.cxx Replace class names, define statement Put in your analysis code

18 May 17 and 22, 200718 Reading log files When your selector crashes You cannot access the output via the PROOF progress window Usually you have to restart the ROOT session Reading output from last query Open ROOT Get a PROOF manager object mgr = TProof::Mgr( @lxb6046) Get the log files from the last session logs = mgr->GetSessionLogs(0) Display them logs->Display() Search for a special word (e.g. segmentation violation) logs->Grep(segmentation violation) Save them to a file logs->Save(*, logs.txt)

19 May 17 and 22, 200719 Some Goodies... Resetting environment TProof::Reset( @lxb6046) Run with debug Process(, debug) Process(, moredebug) Compile with debug Process( +g) Create a package from AliROOT make ESD.par in your $ALICE_ROOT directory

20 May 17 and 22, 200720 Backup

21 May 17 and 22, 200721 PROOF Handout Connect to PROOF server proof = TProof::Open( @lxb6046) Upload the ESD package proof->UploadPackage(ESD.par) proof->EnablePackage(ESD) Enable AliROOT.x ProofEnableAliRoot.C Create small chain manually chain = new TChain(esdTree) chain->Add(root://lxb6046//proofpool/pdc06/100/ 002/ Create long chain.L CreateESDChain.C chain = CreateESDChain(ESD100_110_v2.txt) Execute a selector with PROOF chain->SetProof() chain->Process(AliMultiplicityESDSelector.cxx+)

22 May 17 and 22, 200722 Analysis with Selectors Create a selector TFile *fESD = TFile::Open(AliESDs.root); TTree *tESD = (TTree *)fESD->Get(esdTree); tESD->MakeSelector(); Info in : Files: esdTree.h and esdTree.C generated from TTree: esdTree Modify the selector accordingly and run it.! emacs esdTree.{C,h}& tESD->Process(esdTree.C); Use an existing example and modify it accordingly For further information on selectors: Check the analysis user guide provided by A.Peters Presentation of M.Biskup at the Root workshop 2005M.Biskup at the Root workshop 2005

23 May 17 and 22, 200723 Entries are processed in an arbitrary order Only the needed data is read Skeleton can be generated from a Tree Basics of Selectors Selectors contain skeleton of processing system Preprocessing and initialization Processing each event Post processing and clean-up

24 May 17 and 22, 200724 TSelector::SlaveBegin(); TSelector::SlaveTerminate(); TSelector::Init(TTree*) TList* fInput, fOutput; InputList OutputList results input data InputListOutputList PROOF network Selectors More complicated in a distributed environment Many computers to initialize and clean-up Many trees in a chain Input and output results should be transparently sent over network

25 May 17 and 22, 200725 PROOF and Selectors No users control on the order Many Trees are being processed Initialize each Slave The same code works also without PROOF (of course!) Client Slaves

26 May 17 and 22, 200726 Selectors - summary Skeletons generated from a tree Only methods need to be filled Simplify program structure Can be used for parallel processing as well as for local analysis More about the selectors during the PROOF tutorial

27 May 17 and 22, 200727 PROOF Installation Install ROOT with PROOF enabled (default) More information: Configuration (see next slides) xrootd config file: PROOF config file: proof.conf Start xrootd service Requires unprivileged user account

28 May 17 and 22, 200728 ## Load the XrdProofd protocol: xrd.protocol xproofd:1093 /opt/root/lib/ ## Set ROOTSYS xpd.rootsys /opt/root ## Working directory for sessions xpd.workdir /pool/proofbox

29 May 17 and 22, 200729 (2) ## xpd.resource static [ ] [ucfg: ] [wmx: ] [selopt: ] xpd.resource static /etc/proof/proof.conf wmx:-1 selopt:roundrobin ## Server role (master, worker) [default: any] xpd.role worker if lxb* xpd.role master if ## Master(s) allowed to connect. By default all connections are allowed. xpd.allow

30 May 17 and 22, 200730 proof.conf ## machine running the master master ## machine(s) running Workers, dual CPU machines have to be listed twice worker worker

31 May 17 and 22, 200731 Starting xrootd Service xrootd -b -l xrootd.log -R proofaccount -c -d Options: -b : background (skip for debugging) -l : log file -R : user account that runs xrootd service -c : configuration file -d : debug flag Do not forget full paths to the files

Download ppt "May 17 and 22, 20071 ALICE Offline Tutorial Markus Oldenburg – CERN May 17 and 22, 2007 – University of Sao Paulo."

Similar presentations

Ads by Google