Hello!
I have this code using an ntuple but I can’t seem to get the right results. I’m using this to draw hits inside a calorimeter. Each hit here has a corresponding id, which is labeled here as rid and mid. This id would then be the basis for the color of each hit. The position of a hit is labeled x, y, and z, and n is the event number.
When the hits are drawn, it should have different colors based on their rid (or mid). Unfortunately, the hits are drawn only with a single color.
My problem here now is how to get the rid (or mid) for a single hit and draw them correctly with their corresponding color (which is either rid or mid). A single event here would consist of a fewer than a hundred to more than 2000 hits.
I hope you could help. Thank you very much!
Best Regards,
zeus
======================snip======================
TFile *infile = new TFile("$mst/new_mst/anl-uds91-jun06_1x1_2m-500-1.root","READ");
TNtuple *dat = (TNtuple*)infile->Get("nodnt");
Float_t n,rid,mid,x,y,z;
dat->SetBranchAddress("n",&n);
dat->SetBranchAddress("rid",&rid);
dat->SetBranchAddress("mid",&mid);
dat->SetBranchAddress("x",&x);
dat->SetBranchAddress("y",&y);
dat->SetBranchAddress("z",&z);
TH1D *hN = new TH1D("hN","n",100,0,100);
Int_t counter = 0;
for (Int_t ievt = 1; ievt < 2; ievt++) {
cout << "procecssing event: " << ievt <<endl>Project("hN","n",Form("n==%i",ievt));
cout<<"number of hits = \t"<<nPts<<endl>SetMarkerStyle(21);
p->SetMarkerSize(0.3);
for(Int_t hit = 0; hit <nPts>GetEntry(count);
Int_t color = rid; // mid
p->SetPoint(hit, x, y, z);
p->SetMarkerColor(color+1);
// p->Draw();
}
p->Draw();
======================snip======================