BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
DchDigitsAnalysisHist.C
Go to the documentation of this file.
1#include "TCanvas.h"
2#include "TChain.h"
3#include "TGraph.h"
4#include "TH1F.h"
5#include "TH2F.h"
6#include "TLine.h"
7#include "TMath.h"
8
9// #include "../../globaltracking/BmnHitFinderRun1.h"
10
11using namespace TMath;
12
13const UInt_t kNPLANES = 16;
14const UInt_t kNREALWIRES = 240;
15const UInt_t kNWIRES = 256;
16const Int_t Number = 4;
17const Int_t nb = 100;
18const Float_t angles[kNPLANES] = {135, 135, 45, 45, 90, 90, 180, 180, 135, 135, 45, 45, 90, 90, 180, 180};
19const TString names[kNPLANES] = {"VA_1", "VB_1", "UA_1", "UB_1", "YA_1", "YB_1", "XA_1", "XB_1",
20 "VA_2", "VB_2", "UA_2", "UB_2", "YA_2", "YB_2", "XA_2", "XB_2"};
21
23{
24 // gStyle->SetOptStat(0);
25 /* Load basic libraries */
26 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
27 bmnloadlibs(); // load bmn libraries
28
29 TChain* eveTree = new TChain("cbmsim");
30 TString inName = Form("bmn_run%04d_digi.root", runId);
31 eveTree->Add(inName);
32
33 TClonesArray* DchDigits;
34 TClonesArray* DchHits = new TClonesArray("BmnDchHit");
35 eveTree->SetBranchAddress("DCH", &DchDigits);
36
37 Long64_t nEvents = eveTree->GetEntries();
38 cout << nEvents << endl;
39
40 TH2F* h_DCH1 = new TH2F("h_DCH1", "h_DCH1", 500, 0, 0, 500, 0, 0);
41 TH2F* h_DCH2 = new TH2F("h_DCH2", "h_DCH2", 500, 0, 0, 500, 0, 0);
42
43 for (Int_t iEv = 0; iEv < nEvents; iEv++) {
44 if (iEv % 100 == 0)
45 cout << "EVENT: " << iEv << endl;
46 DchHits->Clear();
47 eveTree->GetEntry(iEv);
48 ProcessDchDigits(DchDigits, DchHits);
49 // cout << DchHits->GetEntriesFast() << endl;
50 for (Int_t iHit = 0; iHit < DchHits->GetEntriesFast(); ++iHit) {
51 BmnDchHit* hit = (BmnDchHit*)DchHits->At(iHit);
52 if (hit->GetDchId() == 1)
53 h_DCH1->Fill(hit->GetX(), hit->GetY());
54 if (hit->GetDchId() == 2)
55 h_DCH2->Fill(hit->GetX(), hit->GetY());
56 }
57 }
58
59 TCanvas* c_dch1 = new TCanvas("dch1", "dch1", 1000, 1000);
60 h_DCH1->Draw("colz");
61 TCanvas* c_dch2 = new TCanvas("dch2", "dch2", 1000, 1000);
62 h_DCH2->Draw("colz");
63}
int Int_t
unsigned int UInt_t
float Float_t
long long Long64_t
#define gROOT
char * Form(const char *fmt,...)
UChar_t GetDchId() const
Definition BmnDchHit.h:43
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
Long64_t GetEntries() const override
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
void Clear(Option_t *option="") override
void Draw(Option_t *option="") override
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
const Float_t angles[kNPLANES]
const TString names[kNPLANES]
const UInt_t kNPLANES
const UInt_t kNWIRES
const Int_t Number
const UInt_t kNREALWIRES
const Int_t nb
void DchDigitsAnalysisHist(UInt_t runId=0)