BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
MwpcDigitsAnalysisHist.C
Go to the documentation of this file.
1#include "TCanvas.h"
2#include "TChain.h"
3#include "TClonesArray.h"
4#include "TGraph.h"
5#include "TH1F.h"
6#include "TH2F.h"
7#include "TLine.h"
8#include "TMath.h"
9
10// #include "../../globaltracking/BmnHitFinderRun1.h"
11
12using namespace TMath;
13
14const UInt_t kNPLANES = 16;
15const UInt_t kNREALWIRES = 240;
16const UInt_t kNWIRES = 256;
17const Int_t Number = 4;
18const Int_t nb = 100;
19
21{
22 // gStyle->SetOptStat(0);
23 /* Load basic libraries */
24 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
25 bmnloadlibs(); // load bmn libraries
26
27 TChain* eveTree = new TChain("cbmsim");
28 TString inName = Form("bmn_run%04d_digi.root", runId);
29 eveTree->Add(inName);
30
31 TClonesArray* MwpcDigits;
32 TClonesArray* MwpcHits = new TClonesArray("BmnMwpcHit");
33 eveTree->SetBranchAddress("MWPC", &MwpcDigits);
34
35 Long64_t nEvents = eveTree->GetEntries();
36 cout << nEvents << endl;
37
38 TH2F* h_MWPC1 = new TH2F("h_MWPC1", "h_MWPC1", 200, -20, 20, 200, -20, 20);
39 TH2F* h_MWPC2 = new TH2F("h_MWPC2", "h_MWPC2", 200, -20, 20, 200, -20, 20);
40
41 for (Int_t iEv = 0; iEv < nEvents; iEv++) {
42 if (iEv % 100 == 0)
43 cout << "EVENT: " << iEv << endl;
44 MwpcHits->Clear();
45 eveTree->GetEntry(iEv);
46 ProcessMwpcDigits(MwpcDigits, MwpcHits);
47 // cout << MwpcDigits->GetEntriesFast() << endl;
48 for (Int_t iHit = 0; iHit < MwpcHits->GetEntriesFast(); ++iHit) {
49 BmnMwpcHit* hit = (BmnMwpcHit*)MwpcHits->At(iHit);
50 // cout << hit->GetMwpcId() << endl;
51 if (hit->GetMwpcId() == 0)
52 h_MWPC1->Fill(hit->GetX(), hit->GetY());
53 if (hit->GetMwpcId() == 1)
54 h_MWPC2->Fill(hit->GetX(), hit->GetY());
55 }
56 }
57
58 TCanvas* c_mwpc1 = new TCanvas("mwpc1", "mwpc1", 1000, 1000);
59 h_MWPC1->Draw("colz");
60 TCanvas* c_mwpc2 = new TCanvas("mwpc2", "mwpc2", 1000, 1000);
61 h_MWPC2->Draw("colz");
62}
int Int_t
unsigned int UInt_t
long long Long64_t
#define gROOT
char * Form(const char *fmt,...)
Short_t GetMwpcId() const
Definition BmnMwpcHit.h:32
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 UInt_t kNPLANES
const UInt_t kNWIRES
const Int_t Number
const UInt_t kNREALWIRES
const Int_t nb
void MwpcDigitsAnalysisHist(UInt_t runId=0)