Addes script to compare Naiive, Poisson to Hits, Primaries
[u/mrichter/AliRoot.git] / FMD / scripts / ShowDigits.C
CommitLineData
d389af40 1//
2// Script to digit multiplicity information to std::cout.
3//
4void
824466d5 5ShowDigits(Int_t det=2)
d389af40 6{
7 AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
8 runLoader->LoadgAlice();
9 runLoader->LoadHeader();
10 gAlice = runLoader->GetAliRun();
11 AliFMD* fmd = static_cast<AliFMD*>(gAlice->GetDetector("FMD"));
12 AliLoader* fmdLoader = runLoader->GetLoader("FMDLoader");
13 fmdLoader->LoadDigits("READ");
14
824466d5 15 TH1* h = new TH1F("digitData", "Digit Data", 128, 0, 1024);
d389af40 16 Int_t nEvents = runLoader->TreeE()->GetEntries();
17 for (Int_t event = 0; event < nEvents; event++) {
18 cout << "Event # " << event << endl;
19 runLoader->GetEvent(event);
20 TClonesArray* digits = 0;
21 TTree* treeD = fmdLoader->TreeD();
22 TBranch* branch = treeD->GetBranch("FMD");
23 branch->SetAddress(&digits);
24
25 Int_t total = 0;
26 Int_t nEntries = treeD->GetEntries();
27 for (Int_t entry = 0; entry < nEntries; entry++) {
28 cout << " Entry # " << entry << endl;
29 treeD->GetEntry(entry);
30
31 Int_t nDigits = digits->GetLast();
32 for (Int_t i = 0; i < nDigits; i++) {
33 // cout << " Digit # " << i << endl;
34 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->UncheckedAt(i));
35 if (digit->Counts() > 12) {
36 digit->Print();
37 total++;
38 }
824466d5 39 if (digit->Detector() == det)
40 h->Fill(digit->Counts());
d389af40 41 }
42 }
43 cout << "Total number of digits: " << total << endl;
44 }
824466d5 45
46 TCanvas* c = new TCanvas("digit", "Digit Data");
47 c->SetFillColor(0);
48 c->SetLogy();
49 c->SetBorderMode(0);
50 h->Draw();
d389af40 51}