From 709e7213e8becd8c33b2e3f48975ae690b6549b6 Mon Sep 17 00:00:00 2001 From: Vardan Tadevosyan <tadevosn@jlab.org> Date: Mon, 23 Sep 2013 14:37:31 -0400 Subject: [PATCH] Added total and Preshower energy depositions in the cluster associated to the 1-st track --- examples/PARAM/52949/hcal.param.vt.52949 | 2 +- examples/PARAM/52949/hcana.param | 3 ++ examples/comptrackedep.C | 57 +++++++++++++++++++++++ examples/comptrackepr.C | 57 +++++++++++++++++++++++ examples/comptrackx.C | 57 +++++++++++++++++++++++ examples/comptrackxy.C | 59 ++++++++++++++++++++++++ examples/comptracky.C | 57 +++++++++++++++++++++++ examples/output_52949.def | 11 +++++ src/THcShower.cxx | 37 ++++++++++++--- src/THcShower.h | 12 +++-- 10 files changed, 339 insertions(+), 13 deletions(-) create mode 100644 examples/comptrackedep.C create mode 100644 examples/comptrackepr.C create mode 100644 examples/comptrackx.C create mode 100644 examples/comptrackxy.C create mode 100644 examples/comptracky.C diff --git a/examples/PARAM/52949/hcal.param.vt.52949 b/examples/PARAM/52949/hcal.param.vt.52949 index 3970fb3..8e5f719 100644 --- a/examples/PARAM/52949/hcal.param.vt.52949 +++ b/examples/PARAM/52949/hcal.param.vt.52949 @@ -4,7 +4,7 @@ hcal_slop = 7.5 ;Turn on HMS cal. fiducial volume cut. 0="no cut" ;Default hcal_fv_test=0 -hcal_fv_test = 1 +hcal_fv_test = 0 hcal_pos_cal_const =0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001 diff --git a/examples/PARAM/52949/hcana.param b/examples/PARAM/52949/hcana.param index 9d0dd73..d49faaa 100644 --- a/examples/PARAM/52949/hcana.param +++ b/examples/PARAM/52949/hcana.param @@ -17,3 +17,6 @@ hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2" hcal_layer_names = "1pr 2ta 3ta 4ta" hhodo_plane_names = "1x 1y 2x 2y" + +hpcentral=0.811 + diff --git a/examples/comptrackedep.C b/examples/comptrackedep.C new file mode 100644 index 0000000..d9ae599 --- /dev/null +++ b/examples/comptrackedep.C @@ -0,0 +1,57 @@ +void comptrackedep(Int_t run) +{ + TFile* f = new TFile(Form("hodtest_%d.root",run)); + cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; + TH1F* h = tre; + + TFile* f1 = new TFile(Form("%d_hbk.root",run)); + cout << "Engine root file " << Form("%d_hbk.root",run) << endl; + TH1F* h1; + switch (run) { + case 50017 : + // h1 = h212; //A+ + break; + default : + h1 = h420; //edep + } + + TCanvas *c1 = new TCanvas("c1", "Shower 1 track cluster Edep", 1000, 667); + + // gPad->SetLogy(); + + h1->SetFillColor(kGreen); + h1->SetLineColor(kGreen); + h1->Draw(); + + h->SetLineColor(kBlue); + h->SetFillStyle(0); + h->SetLineWidth(2); + h->Draw("same"); + + TLatex l; + l.SetTextSize(0.04); + Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); + Float_t xmin = h1->GetXaxis()->GetXmin(); + Float_t xmax = h1->GetXaxis()->GetXmax(); + Float_t xt = xmin + 0.67*(xmax-xmin); + + l.SetTextColor(kGreen); + l.DrawLatex(xt,0.65*maxy,"Engine"); + l.SetTextColor(kBlue); + l.DrawLatex(xt,0.75*maxy,"hcana"); + + // Difference between the histograms. + + TCanvas *c2 = new TCanvas("c2", "Edep differences", 1000, 667); + + TH1F* dif = h->Clone(); + + dif->Add(h,h1,1.,-1.); + + dif->SetTitle("Edep Difference"); + dif->SetFillColor(kRed); + dif->SetLineColor(kRed); + dif->SetLineWidth(1); + dif->SetFillStyle(1111); + dif->Draw(); +} diff --git a/examples/comptrackepr.C b/examples/comptrackepr.C new file mode 100644 index 0000000..a02a6e1 --- /dev/null +++ b/examples/comptrackepr.C @@ -0,0 +1,57 @@ +void comptrackepr(Int_t run) +{ + TFile* f = new TFile(Form("hodtest_%d.root",run)); + cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; + TH1F* h = trepr; + + TFile* f1 = new TFile(Form("%d_hbk.root",run)); + cout << "Engine root file " << Form("%d_hbk.root",run) << endl; + TH1F* h1; + switch (run) { + case 50017 : + // h1 = h212; //A+ + break; + default : + h1 = h421; //epr + } + + TCanvas *c1 = new TCanvas("c1", "Shower Largest cluster Edep", 1000, 667); + + // gPad->SetLogy(); + + h1->SetFillColor(kGreen); + h1->SetLineColor(kGreen); + h1->Draw(); + + h->SetLineColor(kBlue); + h->SetFillStyle(0); + h->SetLineWidth(2); + h->Draw("same"); + + TLatex l; + l.SetTextSize(0.04); + Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); + Float_t xmin = h1->GetXaxis()->GetXmin(); + Float_t xmax = h1->GetXaxis()->GetXmax(); + Float_t xt = xmin + 0.75*(xmax-xmin); + + l.SetTextColor(kGreen); + l.DrawLatex(xt,0.65*maxy,"Engine"); + l.SetTextColor(kBlue); + l.DrawLatex(xt,0.75*maxy,"hcana"); + + // Difference between the histograms. + + TCanvas *c2 = new TCanvas("c2", "Epr differences", 1000, 667); + + TH1F* dif = h->Clone(); + + dif->Add(h,h1,1.,-1.); + + dif->SetTitle("Epr Difference"); + dif->SetFillColor(kRed); + dif->SetLineColor(kRed); + dif->SetLineWidth(1); + dif->SetFillStyle(1111); + dif->Draw(); +} diff --git a/examples/comptrackx.C b/examples/comptrackx.C new file mode 100644 index 0000000..c67aac2 --- /dev/null +++ b/examples/comptrackx.C @@ -0,0 +1,57 @@ +void comptrackx(Int_t run) +{ + TFile* f = new TFile(Form("hodtest_%d.root",run)); + cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; + TH1F* h = trx; + + TFile* f1 = new TFile(Form("%d_hbk.root",run)); + cout << "Engine root file " << Form("%d_hbk.root",run) << endl; + TH1F* h1; + switch (run) { + case 50017 : + // h1 = h212; //A+ + break; + default : + h1 = h417; //X + } + + TCanvas *c1 = new TCanvas("c1", "Shower Largest cluster X", 1000, 667); + + // gPad->SetLogy(); + + h1->SetFillColor(kGreen); + h1->SetLineColor(kGreen); + h1->Draw(); + + h->SetLineColor(kBlue); + h->SetFillStyle(0); + h->SetLineWidth(2); + h->Draw("same"); + + TLatex l; + l.SetTextSize(0.04); + Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); + Float_t xmin = h1->GetXaxis()->GetXmin(); + Float_t xmax = h1->GetXaxis()->GetXmax(); + Float_t xt = xmin + 0.67*(xmax-xmin); + + l.SetTextColor(kGreen); + l.DrawLatex(xt,0.65*maxy,"Engine"); + l.SetTextColor(kBlue); + l.DrawLatex(xt,0.75*maxy,"hcana"); + + // Difference between the histograms. + + TCanvas *c2 = new TCanvas("c2", "Track X differences", 1000, 667); + + TH1F* dif = h->Clone(); + + dif->Add(h,h1,1.,-1.); + + dif->SetTitle("Hcal track X Difference"); + dif->SetFillColor(kRed); + dif->SetLineColor(kRed); + dif->SetLineWidth(1); + dif->SetFillStyle(1111); + dif->Draw(); +} diff --git a/examples/comptrackxy.C b/examples/comptrackxy.C new file mode 100644 index 0000000..b0c4b91 --- /dev/null +++ b/examples/comptrackxy.C @@ -0,0 +1,59 @@ +void comptrackxy(Int_t run) +{ + TFile* f = new TFile(Form("hodtest_%d.root",run)); + cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; + TH2F* h = trx_vs_try; + + TFile* f1 = new TFile(Form("%d_hbk.root",run)); + cout << "Engine root file " << Form("%d_hbk.root",run) << endl; + TH2F* h1; + switch (run) { + case 50017 : + // h1 = h212; //A+ + break; + default : + h1 = h419; //Y vs Y + } + + TCanvas *c1 = new TCanvas("c1", "Shower Largest cluster X", 1000, 667); + + // gPad->SetLogy(); + + h1->SetMarkerColor(kGreen); + // h1->SetLineColor(kGreen); + h1->Draw(); + + h->SetMarkerColor(kBlue); + // h->SetFillStyle(0); + // h->SetLineWidth(2); + h->Draw("same"); + + /* + TLatex l; + l.SetTextSize(0.04); + Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); + Float_t xmin = h1->GetXaxis()->GetXmin(); + Float_t xmax = h1->GetXaxis()->GetXmax(); + Float_t xt = xmin + 0.67*(xmax-xmin); + + l.SetTextColor(kGreen); + l.DrawLatex(xt,0.095*maxy,"Engine"); + l.SetTextColor(kBlue); + l.DrawLatex(xt,0.045*maxy,"hcana"); + */ + + // Difference between the histograms. + + TCanvas *c2 = new TCanvas("c2", "X differences", 1000, 667); + + TH1F* dif = h->Clone(); + + dif->Add(h,h1,1.,-1.); + + // dif->SetTitle("X Difference"); + // dif->SetFillColor(kRed); + // dif->SetLineColor(kRed); + // dif->SetLineWidth(1); + // dif->SetFillStyle(1111); + dif->Draw("LEGO2"); +} diff --git a/examples/comptracky.C b/examples/comptracky.C new file mode 100644 index 0000000..554a518 --- /dev/null +++ b/examples/comptracky.C @@ -0,0 +1,57 @@ +void comptracky(Int_t run) +{ + TFile* f = new TFile(Form("hodtest_%d.root",run)); + cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; + TH1F* h = try; + + TFile* f1 = new TFile(Form("%d_hbk.root",run)); + cout << "Engine root file " << Form("%d_hbk.root",run) << endl; + TH1F* h1; + switch (run) { + case 50017 : + // h1 = h212; //A+ + break; + default : + h1 = h418; //Y + } + + TCanvas *c1 = new TCanvas("c1", "Shower track Y", 1000, 667); + + // gPad->SetLogy(); + + h1->SetFillColor(kGreen); + h1->SetLineColor(kGreen); + h1->Draw(); + + h->SetLineColor(kBlue); + h->SetFillStyle(0); + h->SetLineWidth(2); + h->Draw("same"); + + TLatex l; + l.SetTextSize(0.04); + Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); + Float_t xmin = h1->GetXaxis()->GetXmin(); + Float_t xmax = h1->GetXaxis()->GetXmax(); + Float_t xt = xmin + 0.67*(xmax-xmin); + + l.SetTextColor(kGreen); + l.DrawLatex(xt,0.65*maxy,"Engine"); + l.SetTextColor(kBlue); + l.DrawLatex(xt,0.755*maxy,"hcana"); + + // Difference between the histograms. + + TCanvas *c2 = new TCanvas("c2", "Hcal Y differences", 1000, 667); + + TH1F* dif = h->Clone(); + + dif->Add(h,h1,1.,-1.); + + dif->SetTitle("Y Difference"); + dif->SetFillColor(kRed); + dif->SetLineColor(kRed); + dif->SetLineWidth(1); + dif->SetFillStyle(1111); + dif->Draw(); +} diff --git a/examples/output_52949.def b/examples/output_52949.def index a59a141..283b044 100644 --- a/examples/output_52949.def +++ b/examples/output_52949.def @@ -63,6 +63,17 @@ TH1F eprmax 'HMS PrSh Max Clust. Edep' H.cal.eprmax 100 -0.1 0.811 # X coordinate the largest cluster. TH1F xmax 'HMS Cal Max Clust. X' H.cal.xmax 150 -75. 75. +# Track coordinates at the front of calorimeter +TH2F trx_vs_try 'HMS Track X vs Y at calor.' H.cal.try H.cal.trx 80 -40. 40. 150 -75. 75. H.dc.ntrack==1 +TH1F trx 'HMS Track X at calorimeter' H.cal.trx 150 -75. 75. H.dc.ntrack==1 +TH1F try 'HMS Track Y at calorimeter' H.cal.try 80 -40. 40. H.dc.ntrack==1 + +# Energy of the cluster associated to the main (currently first) track +TH1F tre 'HMS Cal Track Clust. Edep' H.cal.tre 200 -0.1 1.622 H.dc.ntrack==1 + +# Preshower Energy of the cluster associated to the main (currently 1st) track +TH1F trepr 'HMS PrSh Track Clust. Edep' H.cal.trepr 100 -0.1 0.811 H.dc.ntrack==1 + #Calorimeter ADC channels TH1F hcaladc_A1p 'HMS Cal ADC A1p - PED' H.cal.1pr.apos_p[0] 150 50 500 TH1F hcaladc_A2p 'HMS Cal ADC A2p - PED' H.cal.1pr.apos_p[1] 150 50 500 diff --git a/src/THcShower.cxx b/src/THcShower.cxx index f96bc72..78c2fe9 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -444,8 +444,10 @@ Int_t THcShower::DefineVariables( EMode mode ) { "mult", "Multiplicity of largest cluster", "fMult" }, // { "nblk", "Numbers of blocks in main cluster", "fNblk" }, // { "eblk", "Energies of blocks in main cluster", "fEblk" }, - // { "trx", "track x-position in det plane", "fTRX" }, - // { "try", "track y-position in det plane", "fTRY" }, + { "trx", "track x-position in det plane (1st track)", "fTRX" }, + { "try", "track y-position in det plane (1st track)", "fTRY" }, + { "tre", "track energy in the calorimeter (1st track)", "fTRE" }, + { "trepr", "track energy in the preshower (1st track)", "fTREpr" }, { 0 } }; return DefineVarsFromList( vars, mode ); @@ -500,7 +502,11 @@ void THcShower::Clear(Option_t* opt) fMult = 0; fE = 0.; fEpr = 0.; - fX = -75.; //out of acceptance + fX = -75.; //out of acceptance + fTRX = -75.; //out of acceptance + fTRY = -40.; //out of acceptance + fTRE = -1.; + fTREpr = -1.; } //_____________________________________________________________________________ @@ -707,9 +713,25 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) // << " Phi = " << theTrack->GetPhi() // << endl; - MatchCluster(theTrack, ClusterList); + Double_t Xtr; + Double_t Ytr; + + Int_t mclust = MatchCluster(theTrack, ClusterList, Xtr, Ytr); + + if (i==0) { + fTRX = Xtr; + fTRY = Ytr; + if (mclust >= 0) { + THcShowerCluster* cluster = (*ClusterList).ListedCluster(mclust); + fTRE = (*cluster).clE(); + fTREpr = (*cluster).clEpr(); + } + } + } + cout << " fTRX = " << fTRX << " fTRY = " << fTRY << endl; + if (fdbg_clusters_cal) cout << "THcShower::CoarseProcess return ---------------------------" <<endl; @@ -719,7 +741,8 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) //----------------------------------------------------------------------------- Int_t THcShower::MatchCluster(THaTrack* Track, - THcShowerClusterList* ClusterList) + THcShowerClusterList* ClusterList, + Double_t& XTrFront, Double_t& YTrFront) { // Match a cluster to a given track. @@ -730,8 +753,8 @@ Int_t THcShower::MatchCluster(THaTrack* Track, << " Phi = " << Track->GetPhi() << endl; - Double_t XTrFront = kBig; - Double_t YTrFront = kBig; + XTrFront = kBig; + YTrFront = kBig; Double_t pathl = kBig; // Track interception with face of the calorimeter. The coordinates are diff --git a/src/THcShower.h b/src/THcShower.h index 9bfe9ab..14ca900 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -107,10 +107,12 @@ public: Double_t fX; // x-position (cm) of the largest cluster Double_t fZ; // z-position (cm) of the largest cluster Int_t fMult; // # of hits in the largest cluster - // Int_t fNblk; // Number of blocks in main cluster - // Double_t* fEblk; // Energies of blocks in main cluster - // Double_t fTRX; // track x-position in det plane" - // Double_t fTRY; // track y-position in det plane", + // Int_t fNblk; // Number of blocks in main cluster + // Double_t* fEblk; // Energies of blocks in main cluster + Double_t fTRX; // track x-position in det plane (1st track) + Double_t fTRY; // track y-position in det plane (1st track) + Double_t fTRE; // Energy (MeV) of the cluster associated to track + Double_t fTREpr; // Preshower Energy (MeV) of the track's cluster // Potential Hall C parameters. Mostly here for demonstration @@ -146,7 +148,7 @@ public: void Setup(const char* name, const char* description); - Int_t MatchCluster(THaTrack*, THcShowerClusterList*); + Int_t MatchCluster(THaTrack*, THcShowerClusterList*, Double_t&, Double_t&); ClassDef(THcShower,0) // Generic class }; -- GitLab