FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
unpack_mbs.C
Go to the documentation of this file.
1 
2 void unpack_mbs()
3 {
4  TStopwatch timer;
5  timer.Start();
6 
7  // Create source with unpackers ----------------------------------------------
8  TString dir = getenv("VMCWORKDIR");
9  TString tutdir = dir + "/advanced/MbsTutorial";
10 
11  FairLmdSource* source = new FairLmdSource();
12  source->AddFile("sample_data_2.lmd");
13 
14  // NeuLAND MBS parameters -------------------------------
15  Short_t type = 94;
16  Short_t subType = 9400;
17  Short_t procId = 12;
18  Short_t subCrate = 0;
19  Short_t control = 3;
20  FairMBSUnpack* unpacker = new FairMBSUnpack(type, subType, procId, subCrate, control);
21  source->AddUnpacker(unpacker);
22  // ------------------------------------------------------
23 
24  // Create online run ---------------------------------------------------------
25  FairRunOnline* run = new FairRunOnline(source);
26  run->SetSink(new FairRootFileSink("output.root"));
27  run->ActivateHttpServer();
28  run->SetAutoFinish(kFALSE);
29  // ---------------------------------------------------------------------------
30 
31  // Create analysis task ------------------------------------------------------
32  FairMBSTask* task = new FairMBSTask("ExampleTask", 1);
33  run->AddTask(task);
34  // ---------------------------------------------------------------------------
35 
36  // Initialize ----------------------------------------------------------------
37  run->Init();
38  // ---------------------------------------------------------------------------
39 
40  // Runtime data base ---------------------------------------------------------
41  FairRuntimeDb* rtdb = run->GetRuntimeDb();
42  Bool_t kParameterMerged = kTRUE;
43  FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
44  parOut->open("params.root");
45  rtdb->setOutput(parOut);
46  rtdb->print();
47  // ---------------------------------------------------------------------------
48 
49  // Run -----------------------------------------------------------------------
50  run->Run(0, 400);
51  rtdb->saveOutput();
52  // ---------------------------------------------------------------------------
53 
54  timer.Stop();
55  Double_t rtime = timer.RealTime();
56  Double_t ctime = timer.CpuTime();
57  Int_t nHits = unpacker->GetNHitsTotal();
58  if (9086 == nHits) {
59  cout << endl << endl;
60  cout << "Macro finished successfully." << endl;
61  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
62  }
63 }
Bool_t kParameterMerged
void ActivateHttpServer(Int_t refreshRate=10000, Int_t httpPort=8080)
list of container factories
Definition: FairRuntimeDb.h:24
Int_t GetNHitsTotal()
Definition: FairMBSUnpack.h:44
void print(void)
void SetSink(FairSink *tempSink)
Definition: FairRun.h:84
void SetAutoFinish(Bool_t val)
Definition: FairRunOnline.h:52
void AddFile(TString fileName)
FairParRootFileIo * parOut
void AddUnpacker(FairUnpack *unpacker)
void Run(Int_t Ev_start, Int_t Ev_end)
FairRuntimeDb * GetRuntimeDb(void)
Definition: FairRun.h:80
void unpack_mbs()
Definition: unpack_mbs.C:2
Bool_t setOutput(FairParIo *)
virtual void AddTask(FairTask *t)
Definition: FairRun.cxx:70
Bool_t open(const Text_t *fname, Option_t *option="READ", const Text_t *ftitle="", Int_t compress=1)
void saveOutput(void)