]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONreco.C
Bug fix (Yu.Belikov)
[u/mrichter/AliRoot.git] / MUON / MUONreco.C
CommitLineData
c4270ab7 1// Macro MUONreco.C for testing the C++ reconstruction code
8d4daf7f 2
3// Arguments:
4// FirstEvent (default 0)
5// LastEvent (default 0)
6// RecGeantHits (1 to reconstruct GEANT hits) (default 0)
7// FileName (for signal) (default "galice.root")
8// BkgGeantFileName (for background),
9// needed only if RecGeantHits = 1 and background to be added
83dbc640 10#include <iostream.h>
8d4daf7f 11void MUONreco (Int_t FirstEvent = 0, Int_t LastEvent = 0, Int_t RecGeantHits = 0, Text_t *FileName = "galice.root", Text_t *BkgGeantFileName = "")
12{
13 //
c4270ab7 14 cout << "MUONreco" << endl;
8d4daf7f 15 cout << "FirstEvent " << FirstEvent << endl;
16 cout << "LastEvent " << LastEvent << endl;
17 cout << "RecGeantHits " << RecGeantHits << endl;
18 cout << "FileName ``" << FileName << "''" << endl;
19 cout << "BkgGeantFileName ``" << BkgGeantFileName << "''" << endl;
20 // Dynamically link some shared libs
21 if (gClassTable->GetID("AliRun") < 0) {
22 gROOT->LoadMacro("loadlibs.C");
23 loadlibs();
24 }
25
c4270ab7 26 // Connect the Root Galice file containing Geometry, Kine, Hits
27 // and eventually RawClusters
8d4daf7f 28 TFile *file = (TFile*) gROOT->GetListOfFiles()->FindObject(FileName);
29 if (!file) {
30 printf("\n Creating file %s\n", FileName);
31 file = new TFile(FileName);
32 }
33 else printf("\n File %s found in file list\n", FileName);
34
35 // Get AliRun object from file or create it if not on file
36 if (!gAlice) {
37 gAlice = (AliRun*) file->Get("gAlice");
38 if (gAlice) printf("AliRun object found on file\n");
39 if (!gAlice) {
40 printf("\n Create new gAlice object");
41 gAlice = new AliRun("gAlice","Alice test program");
42 }
43 }
44
45 // Initializations
46 // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
47 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
83dbc640 48 //Reco->SetTrackMethod(2); //AZ - use Kalman
8d4daf7f 49 Reco->SetRecGeantHits(RecGeantHits);
50
51 // The right place for changing AliMUONEventReconstructor parameters
52 // with respect to the default ones
53// Reco->SetMaxSigma2Distance(100.0);
83dbc640 54 //Reco->SetPrintLevel(10);
55 //Reco->SetPrintLevel(2);
56 //Reco-> SetChamberThicknessInX0(0.05);
57 //Reco->SetEfficiency(1.); //0.95);
8d4daf7f 58 cout << "AliMUONEventReconstructor: actual parameters" << endl;
59 Reco->Dump();
60
61 // Loop over events
62 for (Int_t event = FirstEvent; event <= LastEvent; event++) {
63 cout << "Event: " << event << endl;
83dbc640 64 // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
8d4daf7f 65 Int_t nparticles = gAlice->GetEvent(event);
66 cout << "nparticles: " << nparticles << endl;
67 // prepare background file and/or event if necessary
68 if (RecGeantHits == 1) {
69 if (event == FirstEvent) Reco->SetBkgGeantFile(BkgGeantFileName);
70 if (Reco->GetBkgGeantFile())Reco->NextBkgGeantEvent();
71 }
72 Reco->EventReconstruct();
c7ba256d 73 // Write this event in a tree
74 Reco->FillEvent();
8d4daf7f 75 // Dump current event
76 Reco->EventDump();
77 } // Event loop
78}