15 #include <calobase/TowerInfoContainer.h>
16 #include <calobase/TowerInfo.h>
24 #include <TGraphErrors.h>
28 #include <TLorentzVector.h>
37 using namespace MbdDefs;
50 _savefname(
"bbcstudy.root" ),
63 _tree =
new TTree(
"t",
"BbcCheck");
64 _tree->Branch(
"run",&
f_run,
"run/I");
65 _tree->Branch(
"ch",&
f_ch,
"ch/I");
66 _tree->Branch(
"qmean",&
f_qmean,
"qmean/F");
67 _tree->Branch(
"qmerr",&
f_qmerr,
"qmerr/F");
70 for (
int ipmt=0; ipmt<128; ipmt++)
72 name =
"h_bbcq"; name += ipmt;
73 title =
"bbc charge, ch "; title += ipmt;
74 h_bbcq[ipmt] =
new TH1F(name,title,1200,0,60);
77 name =
"g_bbcq"; name += ipmt;
78 title =
"mbdq, ch "; title += ipmt;
79 g_bbcq[ipmt] =
new TGraphErrors();
80 g_bbcq[ipmt]->SetName(name);
81 g_bbcq[ipmt]->SetTitle(name);
90 for (
int iarm=0; iarm<2; iarm++)
92 name =
"h_bbcqtot"; name += iarm;
93 title =
"bbc charge, arm "; title += iarm;
94 h_bbcqtot[iarm] =
new TH1F(name,title,1400,0,1400);
97 name =
"hevt_bbct"; name += iarm;
98 title =
"bbc times, arm "; title += iarm;
99 hevt_bbct[iarm] =
new TH1F(name,title,200,7.5,11.5);
102 h_bbcqsum =
new TH1F(
"h_bbcqsum",
"MBD/BBC north + south charge sum",3000,0.,3000.);
103 h2_bbcqsum =
new TH2F(
"h2_bbcqsum",
"north BBCQ vs South BBCQ",1400,0.,1400.,1400,0.,1400.);
105 h_zdce =
new TH1F(
"h_zdce",
"ZDC Energy",820,-50,4050);
106 h_zdctimecut =
new TH1F(
"h_zdctimecut",
"zdctimecut", 50, -17.5 , 32.5);
108 h_emcale =
new TH1F(
"h_emcale",
"Emcal Energy",3000,-100,2900);
109 h_emcaltimecut =
new TH1F(
"h_emcaltimecut",
"emcaltimecut", 50, -17.5 , 32.5);
111 h_ohcale =
new TH1F(
"h_ohcale",
"OHCAL Energy",1000,-100,900);
112 h_ohcaltimecut =
new TH1F(
"h_ohcaltimecut",
"ohcaltimecut", 50, -17.5 , 32.5);
114 h_ihcale =
new TH1F(
"h_ihcale",
"IHCAL Energy",1000,-100,900);
115 h_ihcaltimecut =
new TH1F(
"h_ihcaltimecut",
"ihcaltimecut", 50, -17.5 , 32.5);
117 h_bz =
new TH1F(
"h_bz",
"MBD z-vertex",1200,-300,300);
119 gaussian =
new TF1(
"gaussian",
"gaus",0,20);
122 c_bbct =
new TCanvas(
"c_bbct",
"BBC Times",1200,800);
189 _bbcout = findNode::getClass<MbdOut>(topNode,
"MbdOut");
193 _bbcpmts = findNode::getClass<MbdPmtContainer>(topNode,
"MbdPmtContainer");
194 if(!
_bbcpmts &&
f_evt<4) cout <<
PHWHERE <<
" MbdPmtContainer node not found on node tree" << endl;
213 h_bbcq[ipmt]->Scale( norm );
227 cout <<
"Nevents processed integral " <<
nprocessed <<
"\t" << nevents <<
"\t" << nevents/
nprocessed << endl;
243 GlobalVertexMap *vertexmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
244 if ( vertexmap && !vertexmap->
empty() )
249 float vtx_z = vtx->
get_z();
252 cout <<
"ERROR, vertices do not match " << vtx_z <<
"\t" << bz << endl;
258 static int counter = 0;
259 if ( counter < 4 ) cout <<
"GlobalVertexMap not found or is empty" << endl;
263 if ( fabs(bz)>60. )
return;
264 if ( bqn<10 && bqs>150 )
return;
283 h_bbcq[ipmt]->Fill( q*r );
298 int getmaxtime, tcut = -1;
300 for(
int bin = 1; bin < h->GetNbinsX()+1; bin++)
302 double c = h->GetBinContent(bin);
303 double max = h->GetMaximum();
304 int bincenter = h->GetBinCenter(bin);
307 getmaxtime = bincenter;
308 if(getmaxtime != -1) tcut = getmaxtime;
318 TowerInfoContainer* zdctowers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_ZDC");
323 double zdc_etot = 0.;
326 for (
int ich = 0; ich <
size; ich++)
333 if (ich == 0 || ich == 2 || ich == 4 || ich == 8 || ich == 10 || ich == 12)
335 if( zdct > (max_zdc_t - range) && zdct < (max_zdc_t + range))
349 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
364 if( abs(t - max_emcal_t) < range )
376 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
391 if( abs(t - max_hcal_t) < range )
403 TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
418 if( abs(t - max_hcal_t) < range )