using namespace std;
#include <iostream>
#include <iomanip>
#include <math.h>
#include "TH2.h"
#include "TProfile.h"
#include "TROOT.h"
#include "hades.h"
#include "htree.h"
#include "hcategory.h"
#include "hdatasource.h"
#include "hevent.h"
#include "hiterator.h"
#include "hruntimedb.h"
#include "hmessagemgr.h"
#include "heventheader.h"
#include "hstart2cal.h"
#include "hstart2hit.h"
#include "htboxchan.h"
#include "hrichcal.h"
#include "hrichhit.h"
#include "hmdcseg.h"
#include "hmdcraw.h"
#include "hmdccal1.h"
#include "hmdccal1sim.h"
#include "hmdchit.h"
#include "hmdctimecut.h"
#include "hmdccutstat.h"
#include "htofhit.h"
#include "htofcluster.h"
#include "hrpchit.h"
#include "hrpccluster.h"
#include "hshowerhittof.h"
#include "hsplinetrack.h"
#include "hrktrackB.h"
#include "hbasetrack.h"
#include "hmetamatch2.h"
#include "hparticlecand.h"
#include "hstartdef.h"
#include "richdef.h"
#include "hmdcdef.h"
#include "tofdef.h"
#include "rpcdef.h"
#include "showerdef.h"
#include "walldef.h"
#include "hwallraw.h"
#include "hwallhit.h"
#include "emcdef.h"
#include "hemcdetector.h"
#include "hemcraw.h"
#include "hemccal.h"
#include "hemccluster.h"
#include "hmdctrackgdef.h"
#include "hqaoutputps.h"
#include "hqamaker.h"
#include "hqahistograms.h"
#include "hqavariations.h"
#include "hqascalers.h"
#include "hparticlecand.h"
#include "hrpcdetector.h"
#include "TF1.h"
#include "hqatreemaker.h"
#include "htime.h"
#define DTHETA 5
#define DPHI 5
Int_t HQAMaker::cutResults[4] = {0, 0, 0, 0};
ClassImp(HQAMaker)
HQAMaker::HQAMaker(void)
{
nEvent = 0;
nProcessed = 0;
nCountCalEvents = 0;
hists = 0;
varHists = 0;
kFIRST = kTRUE;
kPDF = kTRUE;
fUseSlowPar = kTRUE;
samplingRate = 1;
intervalSize = 1000;
nInterval = 0;
lTrack.set(1, 0);
lMdc.set(2, 0, 0);
initIteratorPointers();
cutStat = 0;
setParContainers();
betaMin = -1000.;
nCountCalEvents = 0;
fbeamtime="none";
}
HQAMaker::HQAMaker(const Text_t *n, const Text_t *t) : HReconstructor(n, t)
{
nEvent = 0;
nProcessed = 0;
hists = 0;
varHists = 0;
kFIRST = kTRUE;
kPDF = kTRUE;
fUseSlowPar = kTRUE;
samplingRate = 1;
intervalSize = 1000;
nInterval = 0;
isSim = kFALSE;
lTrack.set(1, 0);
lMdc.set(2, 0, 0);
initIteratorPointers();
cutStat = 0;
setParContainers();
betaMin = -1000.;
nCountCalEvents = 0;
fbeamtime="none";
}
HQAMaker::~HQAMaker(void)
{
if (cutStat) HMdcCutStat::deleteHMdcCutStat();
}
void HQAMaker::initIteratorPointers()
{
iterStCal = NULL;
iterStHit = NULL;
iterRichCal = NULL;
iterRichHit = NULL;
iterMdcRaw = NULL;
iterMdcCal1 = NULL;
iterMdcHit = NULL;
iterMdcSeg = NULL;
iterShoHit = NULL;
iterTofHit = NULL;
iterTofCluster = NULL;
iterRpcHit = NULL;
iterRpcCluster = NULL;
iterFwRaw = NULL;
iterFwHit = NULL;
iterEmcRaw = NULL;
iterEmcCal = NULL;
iterEmcClus = NULL;
iterSplineTrk = NULL;
iterRungeKuttaTrk = NULL;
iterMetaMatch = NULL;
iterParticleCand = NULL;
iterHTBoxChan = NULL;
catSplineTrk = NULL;
catRungeKuttaTrk = NULL;
catShoHit = NULL;
catTfHit = NULL;
catTfClust = NULL;
fCatRpcHit = NULL;
fCatRpcCluster = NULL;
fCatParticleCand = NULL;
}
Bool_t HQAMaker::init(void)
{
TH1* hist = NULL;
TIterator* hist_iterator = NULL;
TString old_directory = gDirectory->GetPath();
gROOT->cd();
hists = new HQAHistograms();
varHists = new HQAVariations(intervalSize);
scalers = new HQAScalers();
hists->bookHist();
varHists->bookHist();
scalers->bookScalers();
hist_iterator = hists->getHistList()->MakeIterator();
while ((hist = (TH1*)hist_iterator->Next())) {
hist->SetDirectory(0);
}
delete hist_iterator;
hist_iterator = varHists->getHistList()->MakeIterator();
while ((hist = (TH1*)hist_iterator->Next())) {
hist->SetDirectory(0);
}
delete hist_iterator;
cutStat = HMdcCutStat::getObject();
if (!cutStat) {
ERROR_msg(HMessageMgr::DET_QA, "RETRIEVED 0 POINTER FOR HMDCCUTSTAT!");
exit(1);
}
Bool_t FlagIterPointer = getIteratorPointers();
if(fUseSlowPar){
SlowPar = (HSlowPar*)gHades->getRuntimeDb()->getContainer("SlowPar");
if(SlowPar) {
TString name;
for (Int_t k=0;k<6;k++)
{
name=Form("HAD:RICH:HV:PS:C%i:vmon",k);
SlowPar->addToChannelList(name);
}
for(Int_t plane=1; plane<5; plane++)
{
for(Int_t sec=1; sec<7; sec++)
{
for (Int_t k=0;k<12;k++)
{
name=Form("HAD:MDCHV:P%i:S%i:VMON_C%i",plane,sec,k);
SlowPar->addToChannelList(name);
}
}
}
}
else{
ERROR_msg(HMessageMgr::DET_QA, "RETRIEVED 0 POINTER FOR HSLOWPAR!");
return kFALSE;
}
}
gDirectory->Cd(old_directory.Data());
return FlagIterPointer;
}
void HQAMaker::Print(const Option_t *)
{
Int_t nHists = 0, nVarHists = 0;
if (hists) nHists = hists->getHistList()->GetSize();
if (varHists) nVarHists = varHists->getHistList()->GetSize();
SEPERATOR_msg("-", 70);
INFO_msg(10, HMessageMgr::DET_QA, "HQAMaker: HADES data quality assessment");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%-35s%s", "QA statistics", "Histogram summary");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%-35s%s", "-------------", "-----------------");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%-23s%-5i%9i%s", "Event sampling rate: 1/", samplingRate, nHists, " general hists");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%-15s%-5i%5s%9i%s", "Interval size:", intervalSize, "events ", nVarHists, " run var hists");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%5i%-41s", intervalSize / samplingRate, "QA'd events/interval");
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%s%-8i", "Max # events for var hists (=500*intervalSize): ", 500 * intervalSize);
INFO_msg(10, HMessageMgr::DET_QA, "*extra events are added to overflow bins*");
if (kPDF) {
TString pdfFile = psFile(0, psFile.Last('.')) + ".pdf";
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%s%-57s", "PDF file:", (const Char_t*)pdfFile);
INFO_msg(10, HMessageMgr::DET_QA, "*ps2pdf will be used to generate pdf file*");
TString txtFile = psFile(0, psFile.Last('.')) + ".txt";
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%s%-57s", "scalers:", (const Char_t*)txtFile);
} else
gHades->getMsg()->info(10, HMessageMgr::DET_QA, this->GetName(), "%s%-57s", "PS file:", (const Char_t*)psFile);
SEPERATOR_msg("-", 70);
}
Bool_t HQAMaker::getIteratorPointers()
{
HEvent *event = gHades->getCurrentEvent();
if (!event) {
ERROR_msg(HMessageMgr::DET_QA, "QA maker needs a Hydra event structure");
return kFALSE;
}
HCategory *catStCal = event->getCategory(catStart2Cal);
if (catStCal)
iterStCal = (HIterator *)catStCal->MakeIterator("native");
HCategory *catStHit = event->getCategory(catStart2Hit);
if (catStHit)
iterStHit = (HIterator *)catStHit->MakeIterator("native");
HCategory *catDaqScal = event->getCategory(catTBoxChan);
if (catDaqScal)
iterHTBoxChan = (HIterator *)catDaqScal->MakeIterator("native");
HCategory *catRicCal = event->getCategory(catRichCal);
if (catRicCal)
iterRichCal = (HIterator *)catRicCal->MakeIterator("native");
HCategory *catRicHit = event->getCategory(catRichHit);
if (catRicHit)
iterRichHit = (HIterator *)catRicHit->MakeIterator("native");
HCategory *catMdRaw = event->getCategory(catMdcRaw);
if (catMdRaw)
iterMdcRaw = (HIterator *)catMdRaw->MakeIterator("native");
HCategory *catMdCal1 = event->getCategory(catMdcCal1);
if (catMdCal1)
iterMdcCal1 = (HIterator *)catMdCal1->MakeIterator("native");
if (catMdCal1)(catMdCal1->getClass() != HMdcCal1Sim::Class()) ? isSim = kFALSE : isSim = kTRUE;
HCategory *catMdHit = event->getCategory(catMdcHit);
if (catMdHit)
iterMdcHit = (HIterator *)catMdHit->MakeIterator("native");
HCategory *catMdSeg = event->getCategory(catMdcSeg);
if (catMdSeg)
iterMdcSeg = (HIterator *)catMdSeg->MakeIterator();
catTfHit = event->getCategory(catTofHit);
if (catTfHit)
iterTofHit = (HIterator *)catTfHit->MakeIterator("native");
catTfClust = event->getCategory(catTofCluster);
if (catTfClust)
iterTofCluster = (HIterator *)catTfClust->MakeIterator("native");
fCatRpcHit = event->getCategory(catRpcHit);
if (fCatRpcHit)
iterRpcHit = (HIterator*)fCatRpcHit->MakeIterator("native");
fCatRpcCluster = event->getCategory(catRpcCluster);
if (fCatRpcCluster)
iterRpcCluster = (HIterator*)fCatRpcCluster->MakeIterator("native");
HCategory *catFwRaw = event->getCategory(catWallRaw);
if (catFwRaw)
iterFwRaw = (HIterator *)catFwRaw->MakeIterator("native");
HCategory *catFwHit = event->getCategory(catWallHit);
if (catFwHit)
iterFwHit = (HIterator *)catFwHit->MakeIterator("native");
HCategory *cEmcRaw = event->getCategory(catEmcRaw);
if (cEmcRaw)
iterEmcRaw = (HIterator *)cEmcRaw->MakeIterator("native");
HCategory *cEmcCal = event->getCategory(catEmcCal);
if (cEmcCal)
iterEmcCal = (HIterator *)cEmcCal->MakeIterator("native");
HCategory *cEmcClus = event->getCategory(catEmcCluster);
if (cEmcClus)
iterEmcClus = (HIterator *)cEmcClus->MakeIterator("native");
catShoHit = event->getCategory(catShowerHit);
if (catShoHit) {
iterShoHit = (HIterator *)catShoHit->MakeIterator("native");
}
catSplineTrk = event->getCategory(catSplineTrack);
if (catSplineTrk) {
iterSplineTrk = (HIterator *)catSplineTrk->MakeIterator("native");
}
catRungeKuttaTrk = event->getCategory(catRKTrackB);
if (catRungeKuttaTrk) {
iterRungeKuttaTrk = (HIterator *)catRungeKuttaTrk->MakeIterator("native");
}
HCategory *catMeta = event->getCategory(catMetaMatch);
if (catMeta) {
iterMetaMatch = (HIterator *)catMeta->MakeIterator("native");
}
fCatParticleCand = event->getCategory(catParticleCand);
if (fCatParticleCand) {
iterParticleCand = (HIterator *)fCatParticleCand->MakeIterator("native");
}
return kTRUE;
}
void HQAMaker::setParContainers()
{
}
Int_t HQAMaker::execute()
{
if (kFIRST) {
kFIRST = kFALSE;
buildPSFilename();
Print();
TDirectory* dir = gDirectory;
TString histFileTree = psFile(0, psFile.Last('.')) + "_Tree.root";
fileTree = new TFile(histFileTree, "RECREATE");
TString dst_filename = gHades->getDataSource()->getCurrentFileName();
dst_filename = dst_filename(dst_filename.Last('/') + 1, dst_filename.Last('.') - dst_filename.Last('/') - 1);
cout <<"DSTFileName: "<<dst_filename <<endl;
TFileInfo.fTFileName=dst_filename;
TFileInfo.fTRunId=gHades->getDataSource()->getCurrentRunId();
TFileInfo.fTRefId=gHades->getDataSource()->getCurrentRefId();
HTime::splitFileName(dst_filename,TFileInfo.fTType,TFileInfo.fTYear,TFileInfo.fTDay,TFileInfo.fTHour,TFileInfo.fTMin,TFileInfo.fTSec,TFileInfo.fTEvB);
TString name;
Int_t runID = gHades->getDataSource()->getCurrentRunId();
if(!isSim && fUseSlowPar)
{
HSlowChan SlowChan;
for (Int_t k=0;k<6;k++)
{
SlowChan.clear();
name=Form("HAD:RICH:HV:PS:C%i:vmon",k);
SlowPar->getChannel(runID,name,&SlowChan);
TRich.fTHVMean[k]=SlowChan.mean;
TRich.fTHVSigma[k]=SlowChan.rms;
TRich.fTHVMin[k]=SlowChan.min;
TRich.fTHVMax[k]=SlowChan.max;
}
for(Int_t plane=0; plane<4; plane++)
{
for(Int_t sec=0; sec<6; sec++)
{
for(Int_t k=0; k<12; k++)
{
SlowChan.clear();
name=Form("HAD:MDCHV:P%i:S%i:VMON_C%i",plane+1,sec+1,k);
SlowPar->getChannel(runID,name,&SlowChan);
TMdc.fTHVMean[sec][plane][k]=SlowChan.mean;
TMdc.fTHVSigma[sec][plane][k]=SlowChan.rms;
TMdc.fTHVMin[sec][plane][k]=SlowChan.min;
TMdc.fTHVMax[sec][plane][k]=SlowChan.max;
}
}
}
}
fileTree->cd();
outputTree = new TTree("T","QA Tree");
outputTree->Branch("TFileInfo",&TFileInfo,1000,0);
outputTree->Branch("TStart",&TStart,1000,0);
outputTree->Branch("TRich",&TRich,1000,0);
outputTree->Branch("TMdc",&TMdc,1000,0);
outputTree->Branch("TTof",&TTof,1000,0);
outputTree->Branch("TRpc",&TRpc,1000,0);
outputTree->Branch("TShw",&TShw,1000,0);
outputTree->Branch("TPhy",&TPhy,1000,0);
dir->cd();
}
Int_t eventid = gHades->getCurrentEvent()->getHeader()->getId();
if (eventid == 14) {
fillHistDaqScaler();
nCountCalEvents++;
}
if (!(gHades->isCalibration())) {
if (nEvent % intervalSize == 0) nInterval++;
if (nEvent % samplingRate == 0) {
Int_t eventSize = gHades->getCurrentEvent()->getHeader()->getEventSize();
varHists->evtHeader_eventSize_Var->Fill(nEvent, eventSize);
fillHistStart();
fillHistRich();
fillHistMdc();
fillHistTof();
fillHistRpc();
fillHistShower();
fillHistWall();
fillHistEmc();
fillHistMatching();
fillHistSpline();
fillHistRungeKutta();
fillHistRichMDC();
fillHistPid();
fillHistShowerRpc();
fillMassSpectrum();
nProcessed++;
}
}
nEvent++;
return 0;
}
void HQAMaker::buildPSFilename()
{
if (fDir.IsNull() && (!psFile.Contains("/"))) {
WARNING_msg(HMessageMgr::DET_QA, 10, "dir not specified, QA output written to present dir");
}
if (psFile.IsNull()) {
if (gHades->getOutputFile() != 0) {
dstFile = gHades->getOutputFile()->GetName();
} else {
dstFile = gHades->getDataSource()->getCurrentFileName();
dstFile.Replace(0, dstFile.Last('/') + 1, "");
}
psFile = dstFile(dstFile.Last('/') + 1, dstFile.Last('.') - dstFile.Last('/') - 1) + ".pdf";
}
if (!fDir.IsNull()) {
if (!(fDir[fDir.Length()-1] == '/')) {
fDir += "/";
}
}
if (!psFile.Contains("/")) {
psFile = fDir + psFile;
}
}
Bool_t HQAMaker::finalize(void)
{
if (nProcessed == 0) {
cout << "--------------------------------------------------------- \n";
cout << "-- WARNING: QA MAKER, Number of processed events is 0. -- \n";
cout << "------ qa pdf document will not be created -------------- \n";
cout << "--------------------------------------------------------- \n";
return 1;
} else {
fillScalers();
finalizeHistStart();
finalizeHistDaqScaler();
finalizeHistRich();
finalizeHistMdc();
finalizeHistTof();
finalizeHistRpc();
finalizeHistShower();
finalizeHistRichMDC();
finalizeHistPid();
finalizeHistShowerRpc();
finalizeMassSpectrum();
Bool_t ret = makePS();
TFileInfo.fTNumEvents=nEvent;
outputTree->Fill();
fileTree->cd();
outputTree->Write();
fileTree->Save();
fileTree->Close();
return ret;
}
}
Bool_t HQAMaker::makePS()
{
HQAOutputPS *outPS = new HQAOutputPS(psFile);
outPS->setDSTFileName(dstFile);
outPS->setStats(nEvent, nProcessed);
outPS->makeHist(hists->getHistList());
outPS->writeHist(hists->getHistList(), varHists->getHistList(), psFile);
outPS->setNHistPerPage(3);
outPS->makeHist(varHists->getHistList());
outPS->makeText(scalers->getScalerList());
outPS->saveScal(scalers->getScalerList(), psFile);
delete outPS;
return kTRUE;
}
void HQAMaker::fillHistStart()
{
Int_t triggerBit = (gHades->getCurrentEvent()->getHeader()->getTBit());
HStart2Cal *stCal = 0;
HStart2Hit *stHit = 0;
HTofHit *tofHit = 0;
Float_t tof_corr = 0;
Float_t dist = 0;
Float_t stm0CalTime[NSTART_STRIPS];
Float_t stm1CalTime[NSTART_STRIPS];
Float_t vtCalTime[NSTART_STRIPS];
for (Int_t ii = 0; ii < NSTART_STRIPS ; ii++) {
stm0CalTime[ii] = -10000.0;
stm1CalTime[ii] = -10000.0;
vtCalTime[ii] = -10000.0;
}
for (Int_t ii = 0; ii < 32 ; ii++) {
if ((triggerBit & (1 << ii)) != 0) {
hists->stLatchHist->Fill(ii);
}
}
fillGlobalVertex();
if (iterStCal) {
iterStCal->Reset();
while ((stCal = (HStart2Cal*) iterStCal->Next()) != 0) {
if (fabs(stCal->getTime(1)) <30.0) {
if(stCal->getModule() == 0){
if(stCal->getStrip()>NSTART_STRIPS-1) { cout<<"start cal strip to large "<<stCal->getStrip()<<endl; continue;}
varHists->stCal_meanStrip_Var->Fill(nEvent, stCal->getStrip());
hists->stCal_tof->Fill(stCal->getTime(1));
hists->stCal_stripMod0->Fill(stCal->getStrip());
stm0CalTime[stCal->getStrip()] = stCal->getTime(1);
hists->stCal_tof_strip[stCal->getStrip()]->Fill(stCal->getTime(1));
}
if(stCal->getModule() == 1){
hists->stCal_stripMod1->Fill(stCal->getStrip());
stm1CalTime[stCal->getStrip()] = stCal->getTime(1);
}
if(stCal->getModule() == 3){
varHists->vtCal_meanStrip_Var->Fill(nEvent, stCal->getStrip());
hists->vtCal_strip->Fill(stCal->getStrip());
vtCalTime[stCal->getStrip()] = stCal->getTime(1);
hists->vtCal_tof->Fill(stCal->getTime(1));
hists->vtCal_tof_strip[stCal->getStrip()]->Fill(stCal->getTime(1));
}
}
}
}
for (Int_t im = 0; im < NSTART_STRIPS; im++) {
if(vtCalTime[im] > -1000.0){
for (Int_t jm = 0; jm < NSTART_STRIPS; jm++) {
if(stm0CalTime[jm] > -10000)hists->Stm0Vtdiff_vs_stStrip[im]->Fill(jm,stm0CalTime[jm] - vtCalTime[im]);
if(stm1CalTime[jm] > -10000)hists->Stm1Vtdiff_vs_stStrip[im]->Fill(jm,stm1CalTime[jm] - vtCalTime[im]);
}
}
}
if (iterStHit) {
iterStHit->Reset();
while ((stHit = (HStart2Hit*) iterStHit->Next()) != 0) {
if (stHit->getModule() == 0) {
if(stHit->getStrip()>NSTART_STRIPS-1) { cout<<"start hit strip to large "<<stHit->getStrip()<<endl; continue;}
hists->stHit_vs_stStrip->Fill(stHit->getStrip(), stHit->getTime());
hists->stHit_tof->Fill(stHit->getTime());
for (Int_t ii = 0; ii < 9 ; ii++) {
if ((triggerBit & (1 << ii)) != 0) {
hists->stHit_vs_stStrip_Trigg[ii+1]->Fill(stHit->getStrip(), stHit->getTime());
}
}
if (iterTofHit) {
iterTofHit->Reset();
while ((tofHit = (HTofHit*) iterTofHit->Next()) != 0) {
tofHit->getDistance(dist);
tof_corr = tofHit->getTof() + (2100. - dist) / 299.792458;
hists->stHit_tof_vs_startstripe->Fill(stHit->getStrip(), tof_corr);
}
}
}
}
}
}
void HQAMaker::finalizeHistStart()
{
if (hists->stLatchHist->GetEntries() > 0) {
if (nProcessed == 0) hists->stLatchHist->Scale(1.);
else hists->stLatchHist->Scale(1. / nProcessed);
}
if(hists->stHit_tof->GetEntries()>0)
{
TStart.fTHitTimeMean=hists->stHit_tof->GetMean(1);
TStart.fTHitTimeRms=hists->stHit_tof->GetRMS(1);
}
if(hists->stCal_tof->GetEntries()>0&&hists->vtCal_tof->GetEntries()>0)
{
TStart.fTHitToNoveto=hists->stCal_tof->GetEntries()/(hists->vtCal_tof->GetEntries());
}
if(hists->stVertexXY->GetEntries()>0)
{
TStart.fTVertexX=hists->stVertexXY->GetMean(1);
TStart.fTVertexY=hists->stVertexXY->GetMean(2);
}
if(hists->stVertexZ->GetEntries()>0) {TStart.fTVertexZ=hists->stVertexZ->GetMean(1);}
for(Int_t i=0;i<NSTART_STRIPS;i++)
{
if(hists->stCal_tof_strip[i]->GetEntries()>0)
{
TStart.fTStCalTime[i]=hists->stCal_tof_strip[i]->GetMean(1);
}
if(hists->vtCal_tof_strip[i]->GetEntries()>0)
{
TStart.fTVtCalTime[i]=hists->vtCal_tof_strip[i]->GetMean(1);
}
}
}
void HQAMaker::fillHistRich()
{
HRichCal *richCal = 0;
Int_t nDataObjs;
Int_t RingCounter[6];
for(Int_t i=0; i<6; i++)
{
RingCounter[i]=0;
}
if (iterRichCal) {
iterRichCal->Reset();
nDataObjs = ((TObjArray*)iterRichCal->GetCollection())->GetEntries();
varHists->richCal_n_Var->Fill(nEvent, nDataObjs);
while ((richCal = (HRichCal*) iterRichCal->Next()) != 0) {
hists->richCal_row->Fill(richCal->getRow());
hists->richCal_column->Fill(richCal->getCol());
hists->richCal_nSec->Fill(richCal->getSector());
}
}
HRichHit *richHit = 0;
Float_t theta, phi, r2d = 57.29578;
if (iterRichHit) {
iterRichHit->Reset();
nDataObjs = ((TObjArray*)iterRichHit->GetCollection())->GetEntries();
varHists->richHit_n_Var->Fill(nEvent, nDataObjs);
while ((richHit = (HRichHit*) iterRichHit->Next()) != 0)
{
RingCounter[richHit->getSector()]++;
theta = richHit->getTheta();
phi = richHit->getPhi();
if (theta == 0) {
continue;
}
hists->richHit_theta->Fill(theta);
hists->richHit_phi->Fill(phi);
hists->richHit_nSec->Fill(richHit->getSector());
hists->richHit_scat->Fill(sin(theta / r2d)*sin((phi - 90) / r2d), sin(theta / r2d)*cos((phi - 90) / r2d));
hists->richHit_radius->Fill(richHit->getRadius());
hists->richHit_centroid->Fill(richHit->getCentroid());
hists->richHit_chargeAmpl->Fill(richHit->getRingAmplitude());
hists->richHit_ringCol->Fill(richHit->getRingCenterX());
hists->richHit_ringRow->Fill(richHit->getRingCenterY());
hists->richHit_ringLocMax4->Fill(richHit->getRingLocalMax4());
hists->richHit_houTraVsPatMat->Fill(richHit->getRingHouTra() , richHit->getRingPatMat());
hists->richHit_patMatVsTheta->Fill(richHit->getRingPatMat() , theta);
hists->richHit_houTraVsTheta->Fill(richHit->getRingHouTra() , theta);
hists->richHit_chargeAmplVsTheta->Fill(richHit->getRingAmplitude() , theta);
hists->richHit_radiusVsTheta->Fill(richHit->getRadius() , theta);
if(richHit->getRingPadNr()!=0)hists->richHit_AverCharge[richHit->getSector()]->Fill(richHit->getRingAmplitude()/richHit->getRingPadNr());
hists->richHit_NumPads[richHit->getSector()]->Fill(richHit->getRingPadNr());
}
for(Int_t i=0;i<6;i++)
{
hists->richHit_NumRings[i]->Fill(RingCounter[i]);
}
}
}
void HQAMaker::finalizeHistRich()
{
for(Int_t i=0; i<6; i++)
{
if(hists->richHit_AverCharge[i]->GetEntries()>0)
{
TRich.fTAvChargeMax[i]=hists->richHit_AverCharge[i]->GetBinCenter(hists->richHit_AverCharge[i]->GetMaximumBin());
TRich.fTAvChargeMean[i]=hists->richHit_AverCharge[i]->GetMean();
}
if(hists->richHit_NumPads[i]->GetEntries()>0)
{
TRich.fTNumPadsMax[i]=hists->richHit_NumPads[i]->GetBinCenter(hists->richHit_NumPads[i]->GetMaximumBin());
TRich.fTNumPadsMean[i]=hists->richHit_NumPads[i]->GetMean();
}
if(hists->richHit_NumRings[i]->GetEntries()>0)
{
TRich.fTNumRingsMax[i]=hists->richHit_NumRings[i]->GetBinCenter(hists->richHit_NumRings[i]->GetMaximumBin());
TRich.fTNumRingsMean[i]=hists->richHit_NumRings[i]->GetMean();
}
}
}
void HQAMaker::fillHistMdc()
{
HMdcRaw *mdcRaw = 0;
if (iterMdcRaw)
{
iterMdcRaw->Reset();
while ((mdcRaw = (HMdcRaw*) iterMdcRaw->Next()) != 0) {
Int_t sector = mdcRaw->getSector();
Int_t module = mdcRaw->getModule();
Int_t mbo = mdcRaw->getMbo();
if (module == 0) hists->mdcRaw_mboVsSector_m0->Fill(mbo, sector);
else if (module == 1) hists->mdcRaw_mboVsSector_m1->Fill(mbo, sector);
else if (module == 2) hists->mdcRaw_mboVsSector_m2->Fill(mbo, sector);
else if (module == 3) hists->mdcRaw_mboVsSector_m3->Fill(mbo, sector);
TMdc.fTMboCounts[sector][module][mbo]++;
TMdc.fTCountsRaw[sector][module]++;
}
}
HMdcCal1 *mdcCal1 = 0;
HMdcCal1Sim *mdcCal1Sim = 0;
if (iterMdcCal1) {
iterMdcCal1->Reset();
Int_t n[4][6];
for (Int_t i = 0; i < 4; i++) for (Int_t j = 0; j < 6; j++) n[i][j] = 0;
while ((mdcCal1 = (HMdcCal1*) iterMdcCal1->Next()) != 0) {
if (isSim) {
mdcCal1Sim = (HMdcCal1Sim*) mdcCal1;
if (mdcCal1Sim->getStatus1() < 1) continue;
}
Int_t sector = mdcCal1->getSector();
Int_t module = mdcCal1->getModule();
Int_t layer = mdcCal1->getLayer();
n[module][sector]++;
Float_t time1 = mdcCal1->getTime1();
Float_t time2 = mdcCal1->getTime2();
hists->mdcCal1_t2mt1_vs_t1[sector][module]->Fill(time2 - time1, time1);
hists->mdcCal1_t2mt1_vs_t1_plane[ module]->Fill(time2 - time1, time1);
hists->mdcCal1_t2mt1[sector][module]->Fill(time2 - time1);
hists->mdcCal1_t2mt1_V2[sector][module][layer]->Fill(time2 - time1);
hists->mdcCal1_t1[sector][module]->Fill(time1);
hists->mdcCal1_t1_V2[sector][module][layer]->Fill(time1);
if (module == 0) hists->mdcCal1_time1VsSector_m0->Fill(time1, sector);
else if (module == 1) hists->mdcCal1_time1VsSector_m1->Fill(time1, sector);
else if (module == 2) hists->mdcCal1_time1VsSector_m2->Fill(time1, sector);
else if (module == 3) hists->mdcCal1_time1VsSector_m3->Fill(time1, sector);
if (module == 0) varHists->mdcCal1_time1_m0_Var->Fill(nEvent, time1);
else if (module == 1) varHists->mdcCal1_time1_m1_Var->Fill(nEvent, time1);
else if (module == 2) varHists->mdcCal1_time1_m2_Var->Fill(nEvent, time1);
else if (module == 3) varHists->mdcCal1_time1_m3_Var->Fill(nEvent, time1);
if (module == 0) varHists->mdcCal1_time2m1_m0_Var->Fill(nEvent, time2 - time1);
else if (module == 1) varHists->mdcCal1_time2m1_m1_Var->Fill(nEvent, time2 - time1);
else if (module == 2) varHists->mdcCal1_time2m1_m2_Var->Fill(nEvent, time2 - time1);
else if (module == 3) varHists->mdcCal1_time2m1_m3_Var->Fill(nEvent, time2 - time1);
Float_t tat = mdcCal1->getTime2() - mdcCal1->getTime1();
if (module == 0) hists->mdcCal1_tatVsSector_m0->Fill(tat, sector);
else if (module == 1) hists->mdcCal1_tatVsSector_m1->Fill(tat, sector);
else if (module == 2) hists->mdcCal1_tatVsSector_m2->Fill(tat, sector);
else if (module == 3) hists->mdcCal1_tatVsSector_m3->Fill(tat, sector);
TMdc.fTLayerCounts[sector][module][layer]++;
TMdc.fTCountsCal[sector][module]++;
}
for (Int_t sector = 0; sector < 6; sector++) {
hists->mdcCal1_nVsSector_m0->Fill(n[0][sector], sector);
hists->mdcCal1_nVsSector_m1->Fill(n[1][sector], sector);
hists->mdcCal1_nVsSector_m2->Fill(n[2][sector], sector);
hists->mdcCal1_nVsSector_m3->Fill(n[3][sector], sector);
}
}
HMdcHit *mdcHit = 0;
if (iterMdcHit) {
iterMdcHit->Reset();
while ((mdcHit = (HMdcHit*) iterMdcHit->Next()) != 0) {
Int_t sector, module;
Float_t x1, y1, x2, y2, angle;
mdcHit->getSecMod(sector, module);
x1 = -mdcHit->getX();
y1 = mdcHit->getY();
if (module == 0) y1 = (y1 + 650) * .65;
if (module == 1) y1 = (y1 + 950) * .58;
if (module == 2) y1 = (y1 + 1800) * .58;
if (module == 3) y1 = (y1 + 1900) * .68;
angle = ((float) sector) * 60. / 57.2967;
x2 = x1 * cos(angle) + y1 * sin(angle);
y2 = -x1 * sin(angle) + y1 * cos(angle);
if (module == 0) hists->mdcHit_scat_m0->Fill(x2, y2);
if (module == 1) hists->mdcHit_scat_m1->Fill(x2, y2);
if (module == 2) hists->mdcHit_scat_m2->Fill(x2, y2);
if (module == 3) hists->mdcHit_scat_m3->Fill(x2, y2);
}
}
HMdcSeg *mdcSeg = 0;
if (iterMdcSeg)
{
iterMdcSeg->Reset();
while ((mdcSeg = (HMdcSeg*) iterMdcSeg->Next()) != 0)
{
Int_t sector, segment;
sector=mdcSeg->getSec();
segment=mdcSeg->getIOSeg();
hists->mdcSeg_Chi2[sector][segment]->Fill(mdcSeg->getChi2());
TMdc.fTSegCounter[sector][segment]++;
if(mdcSeg->getChi2()>0)
{
TMdc.fTSegCounterFit[sector][segment]++;
}
}
}
}
void HQAMaker::finalizeHistMdc()
{
Int_t c[8];
Char_t buf[500];
Int_t ib;
for (Int_t m = 0; m < 4; m++) {
for (Int_t s = 0; s < 6; s++) {
cutStat->getCal1StatCut(s, m, &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6],&c[7]);
sprintf(buf, "%i %i %i %i %i %i %i %i %i %i \n",
s, m,
c[0], c[1], c[2], c[3], c[4], c[5], c[6] ,c[7]
);
DEBUG_msg(1, HMessageMgr::DET_QA, buf);
ib = m * 6 + s + 1;
hists->mdcCutCounts[0]->SetBinContent(ib, c[7]);
hists->mdcCutCounts[1]->SetBinContent(ib, c[0]);
hists->mdcCutCounts[2]->SetBinContent(ib, c[1]);
hists->mdcCutCounts[3]->SetBinContent(ib, c[2]);
hists->mdcCutCounts[4]->SetBinContent(ib, c[3]);
hists->mdcCutCounts[5]->SetBinContent(ib, c[4]);
hists->mdcCutCounts[6]->SetBinContent(ib, c[5]);
hists->mdcCutCounts[7]->SetBinContent(ib, c[6]);
}
}
DEBUG_msg(1, HMessageMgr::DET_QA, buf);
if (cutStat) cutStat->printParam();
cout <<"Events"<<nEvent <<endl;
for(Int_t i=0; i<6;i++)
{
for(Int_t j=0; j<2; j++)
{
TMdc.fTSegCounter[i][j]=TMdc.fTSegCounter[i][j]/nProcessed;
TMdc.fTSegCounterFit[i][j]=TMdc.fTSegCounterFit[i][j]/nProcessed;
if(hists->mdcSeg_Chi2[i][j]->GetEntries())
{
TMdc.fTSegChi2Mean[i][j]=hists->mdcSeg_Chi2[i][j]->GetMean();
TMdc.fTSegChi2Max[i][j]=hists->mdcSeg_Chi2[i][j]->GetBinCenter(hists->mdcSeg_Chi2[i][j]->GetMaximumBin());
}
}
for(Int_t j=0; j<4; j++)
{
for(Int_t k=0; k<16; k++)
{
TMdc.fTMboCounts[i][j][k]=TMdc.fTMboCounts[i][j][k]/nProcessed;
}
for(Int_t k=0; k<6; k++)
{
TMdc.fTLayerCounts[i][j][k]=TMdc.fTLayerCounts[i][j][k]/nProcessed;
if(hists->mdcCal1_t2mt1_V2[i][j][k]->GetEntries())
{
TMdc.fTToTCalMean[i][j][k]=hists->mdcCal1_t2mt1_V2[i][j][k]->GetMean();
TMdc.fTToTCalMax[i][j][k]=hists->mdcCal1_t2mt1_V2[i][j][k]->GetBinCenter(hists->mdcCal1_t2mt1_V2[i][j][k]->GetMaximumBin());
}
if(hists->mdcCal1_t1_V2[i][j][k]->GetEntries())
{
TMdc.fTTime1CalMean[i][j][k]=hists->mdcCal1_t1_V2[i][j][k]->GetMean();
TMdc.fTTime1CalMax[i][j][k]=hists->mdcCal1_t1_V2[i][j][k]->GetBinCenter(hists->mdcCal1_t1_V2[i][j][k]->GetMaximumBin());
}
}
TMdc.fTCountsRaw[i][j]=TMdc.fTCountsRaw[i][j]/nProcessed;
TMdc.fTCountsCal[i][j]=TMdc.fTCountsCal[i][j]/nProcessed;
}
}
}
void HQAMaker::fillHistTof()
{
HTofHit *tofHit = 0;
Float_t x, y, z, theta, phi;
Int_t nDataObjs;
Int_t TofCounts[6]={0,0,0,0,0,0};
if (iterTofHit) {
iterTofHit->Reset();
nDataObjs = ((TObjArray*)iterTofHit->GetCollection())->GetEntries();
varHists->tofHit_n_Var->Fill(nEvent, nDataObjs);
while ((tofHit = (HTofHit*) iterTofHit->Next()) != 0)
{
tofHit->getTheta(theta);
tofHit->getPhi(phi);
hists->tofHit_nSec->Fill(tofHit->getSector());
tofHit->getXYZLab(x, y, z);
hists->tofHit_scat->Fill(-x, y);
hists->tofHit_tof->Fill(tofHit->getTof());
hists->tofHit_phi->Fill(phi);
hists->tofHit_theta->Fill(theta);
TofCounts[(Int_t)tofHit->getSector()]++;
TTof.fTHits[(Int_t)tofHit->getSector()]++;
}
for(Int_t i=0;i<6;i++)
{
hists->tofHit_n[i]->Fill(TofCounts[i]);
}
hists->tofHit_tot->Fill(TofCounts[0]+TofCounts[1]+TofCounts[2]+TofCounts[3]+TofCounts[4]+TofCounts[5]);
}
}
void HQAMaker::finalizeHistTof()
{
if (hists->tofHit_nSec->GetEntries() > 0) {
if (nProcessed == 0)
hists->tofHit_nSec->Scale(1.);
else
hists->tofHit_nSec->Scale(1. / nProcessed);
}
for(Int_t i=0; i<6; i++)
{
if(hists->tofHit_n[i]->GetEntries()>0)
{
TTof.fTHitMultiMean[i]=hists->tofHit_n[i]->GetMean();
TTof.fTHitMultiMax[i]=hists->tofHit_n[i]->GetBinCenter(hists->tofHit_n[i]->GetMaximumBin());
}
if(nProcessed>0)
{
TTof.fTHits[i]=TTof.fTHits[i]/nProcessed;
}
}
if(hists->tofHit_tot->GetEntries()>0)
{
TTof.fTHitTotMultiMean=hists->tofHit_tot->GetMean();
TTof.fTHitTotMultiMax=hists->tofHit_tot->GetBinCenter(hists->tofHit_tot->GetMaximumBin());
hists->tofHit_tot->GetXaxis()->SetRangeUser(10,100.5);
TTof.fTHitTotMultiMax2=hists->tofHit_tot->GetBinCenter(hists->tofHit_tot->GetMaximumBin());
hists->tofHit_tot->GetXaxis()->SetRangeUser(-0.5,100.5);
}
if(hists->tofHit_tof->GetEntries()>0)
{
TTof.fTHitTofMean=hists->tofHit_tof->GetMean();
TTof.fTHitTofMax=hists->tofHit_tof->GetBinCenter(hists->tofHit_tof->GetMaximumBin());
}
}
void HQAMaker::fillHistRpc()
{
HRpcHit *rpcHit = 0;
Float_t x, y, z;
Int_t nDataObjs;
Int_t RPCCounts[6]={0,0,0,0,0,0};
if (iterRpcHit)
{
iterRpcHit->Reset();
nDataObjs = ((TObjArray*)iterRpcHit->GetCollection())->GetEntries();
varHists->rpcHit_n_Var->Fill(nEvent, nDataObjs);
while ((rpcHit = (HRpcHit*) iterRpcHit->Next()) != 0)
{
rpcHit->getXYZLab(x, y, z);
hists->rpcHit_nSec ->Fill(rpcHit->getSector());
hists->rpcHit_scat ->Fill(-x, y);
hists->rpcHit_tof ->Fill(rpcHit->getTof());
hists->rpcHit_phi ->Fill(rpcHit->getPhi());
hists->rpcHit_theta->Fill(rpcHit->getTheta());
RPCCounts[rpcHit->getSector()]++;
TRpc.fTHits[(Int_t)rpcHit->getSector()]++;
}
for(Int_t i=0;i<6;i++)
{
hists->rpcHit_n[i]->Fill(RPCCounts[i]);
}
hists->rpcHit_tot->Fill(RPCCounts[0]+RPCCounts[1]+RPCCounts[2]+RPCCounts[3]+RPCCounts[4]+RPCCounts[5]);
}
}
void HQAMaker::finalizeHistRpc()
{
if (hists->rpcHit_nSec->GetEntries() > 0) {
if (nProcessed == 0)
hists->rpcHit_nSec->Scale(1.);
else
hists->rpcHit_nSec->Scale(1. / nProcessed);
}
for(Int_t i=0; i<6; i++)
{
if(hists->rpcHit_n[i]->GetEntries()>0)
{
TRpc.fTHitMultiMean[i]=hists->rpcHit_n[i]->GetMean();
TRpc.fTHitMultiMax[i]=hists->rpcHit_n[i]->GetBinCenter(hists->rpcHit_n[i]->GetMaximumBin());
}
if(nProcessed>0)
{
TRpc.fTHits[i]=TRpc.fTHits[i]/nProcessed;
}
}
if(hists->rpcHit_tot->GetEntries()>0)
{
TRpc.fTHitTotMultiMean=hists->rpcHit_tot->GetMean();
TRpc.fTHitTotMultiMax=hists->rpcHit_tot->GetBinCenter(hists->rpcHit_tot->GetMaximumBin());
hists->rpcHit_tot->GetXaxis()->SetRangeUser(10,200.5);
TRpc.fTHitTotMultiMax2=hists->rpcHit_tot->GetBinCenter(hists->rpcHit_tot->GetMaximumBin());
hists->rpcHit_tot->GetXaxis()->SetRangeUser(-0.5,200.5);
}
if(hists->rpcHit_tof->GetEntries()>0)
{
TRpc.fTHitTofMean=hists->rpcHit_tof->GetMean();
TRpc.fTHitTofMax=hists->rpcHit_tof->GetBinCenter(hists->rpcHit_tof->GetMaximumBin());
}
}
void HQAMaker::fillHistShower()
{
Float_t sum, dummy1, phi, theta, charge, x, y, z;
Int_t row, col, mod, sec;
Int_t nDataObjs;
Int_t ShowerCounts[6]={0,0,0,0,0,0};
Int_t ShowerCounts2[6][3];
for(Int_t i=0; i<6; i++)
{
for(Int_t j=0; j<3; j++)
{
ShowerCounts2[i][j]=0;
}
}
HShowerHit *shoHit = 0;
if (iterShoHit) {
iterShoHit->Reset();
nDataObjs = ((TObjArray*)iterShoHit->GetCollection())->GetEntries();
varHists->shoHit_n_Var->Fill(nEvent, nDataObjs);
while ((shoHit = (HShowerHit*) iterShoHit->Next()) != 0) {
row = shoHit->getRow();
col = shoHit->getCol();
mod = shoHit->getModule();
sec = shoHit->getSector();
charge = shoHit->getCharge();
hists->shoHit_nSec->Fill(sec);
hists->shoHit_sectorVsModule->Fill(sec, mod);
hists->shoHit_nRow->Fill(row);
hists->shoHit_nCol->Fill(col);
if ((sum = shoHit->getSum(mod)) > 0.0) {
hists->shoHitSums[sec][mod]->Fill(sum);
}
if (mod == 0) hists->shoHit_chargeVsSector_m0->Fill(charge, sec);
else if (mod == 1) hists->shoHit_chargeVsSector_m1->Fill(charge, sec);
else if (mod == 2) hists->shoHit_chargeVsSector_m2->Fill(charge, sec);
if (mod == 0) hists->shoHit_rowVsSector_m0->Fill(row, sec);
else if (mod == 1) hists->shoHit_rowVsSector_m1->Fill(row, sec);
else if (mod == 2) hists->shoHit_rowVsSector_m2->Fill(row, sec);
if (mod == 0) hists->shoHit_colVsSector_m0->Fill(col, sec);
else if (mod == 1) hists->shoHit_colVsSector_m1->Fill(col, sec);
else if (mod == 2) hists->shoHit_colVsSector_m2->Fill(col, sec);
shoHit->getSphereCoord(&dummy1, &phi, &theta);
hists->shoHit_phi->Fill(phi);
hists->shoHit_theta->Fill(theta);
shoHit->getLabXYZ(&x, &y, &z);
hists->shoHit_scat->Fill(-x, y);
ShowerCounts[sec]++;
ShowerCounts2[sec][mod]++;
}
for(Int_t i=0;i<6;i++)
{
hists->shoHit_n[i]->Fill(ShowerCounts[i]);
for(Int_t j=0;j<3;j++)
{
hists->shoHit_nm[i][j]->Fill(ShowerCounts2[i][j]);
}
}
}
}
void HQAMaker::finalizeHistShower()
{
if (hists->shoHit_nSec->GetEntries() > 0)
{
if (nProcessed == 0)
hists->shoHit_nSec->Scale(1.);
else {
hists->shoHit_nSec->Scale(1. / nProcessed);
hists->shoHit_nCol->Scale(1. / nProcessed);
hists->shoHit_nRow->Scale(1. / nProcessed);
hists->shoHit_sectorVsModule->Scale(1. / nProcessed);
hists->shoHit_scat->Scale(1. / nProcessed);
hists->shoHit_theta->Scale(1. / nProcessed);
hists->shoHit_phi->Scale(1. / nProcessed);
for (Int_t s = 0; s < 6; s++) {
for (Int_t m = 0; m < 3; m++) {
hists->shoHitSums[s][m]->Scale(1. / nProcessed);
}
}
}
}
for(Int_t i=0; i<6; i++)
{
for(Int_t j=0; j<3; j++)
{
if(hists->shoHit_nm[i][j]->GetEntries() > 0)
{
TShw.fTHitMultiMean[i][j]=hists->shoHit_nm[i][j]->GetMean();
TShw.fTHitMultiMax[i][j]=hists->shoHit_nm[i][j]->GetBinCenter(hists->shoHit_nm[i][j]->GetMaximumBin());
}
if(hists->shoHitSums[i][j]!=0)
{
TShw.fTHitChargeMean[i][j]=hists->shoHitSums[i][j]->GetMean();
TShw.fTHitChargeMax[i][j]=hists->shoHitSums[i][j]->GetBinCenter(hists->shoHitSums[i][j]->GetMaximumBin());
}
}
}
}
void HQAMaker::fillHistWall()
{
HWallRaw *fwRaw = 0;
HWallHit *fwHit = 0;
Int_t multWall = 0;
Int_t wallCell = 0;
Int_t multCell = 0;
Int_t wallCellArr[4];
for (Int_t i = 0; i < 4; i++) {
wallCellArr[i] = 0;
}
if (iterFwRaw) {
iterFwRaw->Reset();
while ((fwRaw = (HWallRaw*) iterFwRaw->Next()) != 0) {
multCell = fwRaw->getNHits();
if (multCell <= 0) continue;
if (multCell > fwRaw->getMaxMult()) {
multCell = fwRaw->getMaxMult();
}
wallCell = fwRaw->getCell();
if (((wallCell >= 0) && (wallCell <= 5)) ||
((wallCell >= 12) && (wallCell <= 17)) ||
((wallCell >= 24) && (wallCell <= 29)) ||
((wallCell >= 36) && (wallCell <= 41)) ||
((wallCell >= 48) && (wallCell <= 53)) ||
((wallCell >= 60) && (wallCell <= 64))) wallCellArr[0]++;
if (((wallCell >= 6) && (wallCell <= 11)) ||
((wallCell >= 18) && (wallCell <= 23)) ||
((wallCell >= 30) && (wallCell <= 35)) ||
((wallCell >= 42) && (wallCell <= 47)) ||
((wallCell >= 54) && (wallCell <= 59)) ||
((wallCell >= 67) && (wallCell <= 71))) wallCellArr[1]++;
if (((wallCell >= 72) && (wallCell <= 76)) ||
((wallCell >= 84) && (wallCell <= 89)) ||
((wallCell >= 96) && (wallCell <= 101)) ||
((wallCell >= 108) && (wallCell <= 113)) ||
((wallCell >= 120) && (wallCell <= 125)) ||
((wallCell >= 132) && (wallCell <= 137))) wallCellArr[2]++;
if (((wallCell >= 79) && (wallCell <= 83)) ||
((wallCell >= 90) && (wallCell <= 95)) ||
((wallCell >= 102) && (wallCell <= 107)) ||
((wallCell >= 114) && (wallCell <= 119)) ||
((wallCell >= 126) && (wallCell <= 131)) ||
((wallCell >= 138) && (wallCell <= 143))) wallCellArr[3]++;
if (wallCell < 144) hists->hWallCellSmall ->Fill(wallCell);
if (wallCell >= 144 && wallCell < 208) hists->hWallCellMedium->Fill(wallCell);
if (wallCell >= 208) hists->hWallCellLarge ->Fill(wallCell);
multWall++;
}
hists->hMultWall ->Fill((Float_t)multWall);
hists->hWallHitNumI ->Fill((Float_t)wallCellArr[0]);
hists->hWallHitNumII ->Fill((Float_t)wallCellArr[1]);
hists->hWallHitNumIII->Fill((Float_t)wallCellArr[2]);
hists->hWallHitNumIV ->Fill((Float_t)wallCellArr[3]);
}
if (iterFwHit) {
iterFwHit->Reset();
Int_t wallCell;
Float_t wallX, wallY, wallZ, wallTime, wallCharge;
while ((fwHit = (HWallHit*)iterFwHit->Next())) {
wallCell = fwHit->getCell();
wallTime = fwHit->getTime();
wallCharge = fwHit->getCharge();
fwHit->getXYZLab(wallX, wallY, wallZ);
wallX = wallX / 10;
wallY = wallY / 10;
hists->hWallXY->Fill(wallX, wallY);
hists->hWallCellTime->Fill((Float_t)wallCell, wallTime);
hists->hWallCellAdc ->Fill((Float_t)wallCell, wallCharge);
}
}
}
void HQAMaker::fillHistEmc()
{
HEmcRaw * emcRaw = 0;
HEmcCal * emcCal = 0;
HEmcCluster * emcClus = 0;
Int_t multRaw = 0;
Int_t multRawF = 0;
Int_t multCal = 0;
Int_t multClus = 0;
Float_t time, width;
Float_t phi, theta;
Float_t x, y;
if (iterEmcRaw) {
iterEmcRaw->Reset();
while ((emcRaw = (HEmcRaw*) iterEmcRaw->Next()) != 0) {
multRawF = emcRaw->getFastMultiplicity();
if (multRawF <= 0) continue;
++multRaw;
Int_t sector, cell;
Char_t row, col;
emcRaw->getAddress(sector, cell, row, col);
UChar_t position = HEmcDetector::getPositionFromCell(cell);
hists->hEmcRawPattern->Fill(sector * 200 + position);
emcRaw->getFastTimeAndWidth(0, time, width);
hists->hEmcRawTimeCell->Fill(sector * 200 + position, time);
hists->hEmcRawWidthCell->Fill(sector * 200 + position, width);
}
hists->hEmcRawMult->Fill(multRaw);
}
if (iterEmcCal) {
iterEmcCal->Reset();
while ((emcCal = (HEmcCal*) iterEmcCal->Next()) != 0) {
Char_t sector, col, row;
UChar_t cell;
emcCal->getAddress(sector, cell, row, col);
if (sector < 0)
continue;
++multCal;
UChar_t position = HEmcDetector::getPositionFromCell(cell);
time = emcCal->getTime();
width = emcCal->getEnergy();
hists->hEmcCalTime->Fill(time);
hists->hEmcCalEnergy->Fill(width);
hists->hEmcCalTimeCell->Fill(sector * 200 + position, time);
hists->hEmcCalEnergyCell->Fill(sector * 200 + position, width);
hists->hEmcCalCol->Fill(col);
hists->hEmcCalRow->Fill(row);
hists->hEmcCalRowCol->Fill(col, row);
}
hists->hEmcCalMult->Fill(multCal);
}
if (iterEmcClus) {
iterEmcClus->Reset();
while ((emcClus = (HEmcCluster*) iterEmcClus->Next()) != 0) {
Int_t sector, cell;
sector = emcClus->getSector();
cell = emcClus->getCell();
if (sector < 0)
continue;
++multClus;
UChar_t position = HEmcDetector::getPositionFromCell(cell);
hists->hEmcClusSize->Fill(emcClus->getNCells());
time = emcClus->getTime();
width = emcClus->getEnergy();
hists->hEmcClusTime->Fill(time);
hists->hEmcClusEnergy->Fill(width);
hists->hEmcClusTimeCell->Fill(sector * 200 + position, time);
hists->hEmcClusEnergyCell->Fill(sector * 200 + position, width);
phi = emcClus->getPhi();
theta = emcClus->getTheta();
hists->hEmcClusPhi->Fill(phi);
hists->hEmcClusTheta->Fill(theta);
hists->hEmcClusThetaPhi->Fill(phi, theta);
x = emcClus->getXLab();
y = emcClus->getYLab();
hists->hEmcClusXYlab->Fill(x, y);
}
hists->hEmcClusMult->Fill(multClus);
}
}
void HQAMaker::fillHistSpline()
{
}
void HQAMaker::fillHistRungeKutta()
{
Float_t mass, theta, phi, r2d = 57.29578;
Int_t system, charge, sec;
HRKTrackB *rungeKuttaTrk = 0;
if (iterRungeKuttaTrk) {
iterRungeKuttaTrk->Reset();
while ((rungeKuttaTrk = (HRKTrackB*) iterRungeKuttaTrk->Next()) != 0) {
if (rungeKuttaTrk->getBeta() > betaMin) {
if (rungeKuttaTrk->getChiq() > 100000.) continue;
system = rungeKuttaTrk->getSystem();
charge = rungeKuttaTrk->getPolarity();
mass = rungeKuttaTrk->getMass2();
sec = rungeKuttaTrk->getSector();
if (mass >= 0) {
mass = sqrt(mass);
hists->rungeKuttaTrack_massCharge->Fill(mass * charge);
}
theta = rungeKuttaTrk->getTheta() * r2d;
phi = rungeKuttaTrk->getPhi() * r2d + 60.*sec;
if (phi > 360.) phi -= 360.;
hists->rungeKuttaTrack_scat->Fill(sin(theta / r2d)*sin((phi - 90) / r2d), sin(theta / r2d)*cos((phi - 90) / r2d));
if (system == 0) {
hists->trackingRK_sys0[sec]->Fill(mass * charge);
}
if (system == 1) {
hists->trackingRK_sys1[sec]->Fill(mass * charge);
}
}
}
}
}
void HQAMaker::finalizeHistDaqScaler()
{
for (Int_t ii = 0; ii < 8; ii++) {
((TAxis *)(hists->histAllScalerTrend) ->GetXaxis()) ->SetRange(0, nCountCalEvents);
}
}
void HQAMaker::fillHistRichMDC()
{
HMdcSeg *mdcSeg = 0;
HRichHit *richHit = 0;
Int_t richSec;
Float_t mdcPhi, mdcTheta;
Float_t richPhi, richTheta;
Int_t iSec;
Float_t rad2deg = 180.0 / TMath::Pi();
for (iSec = 0; iSec < 6; iSec++) {
lMdc[0] = iSec;
lMdc[1] = 0;
if (iterMdcSeg) {
iterMdcSeg->Reset();
iterMdcSeg->gotoLocation(lMdc);
while ((mdcSeg = (HMdcSeg*) iterMdcSeg->Next()) != 0) {
mdcPhi = mdcSeg->getPhi() * rad2deg ;
if (iSec != 5) mdcPhi = mdcPhi + iSec * 60;
else mdcPhi = mdcPhi - 60.;
mdcTheta = mdcSeg->getTheta() * rad2deg;
if (iterRichHit) {
iterRichHit->Reset();
while ((richHit = (HRichHit*) iterRichHit->Next()) != 0) {
richTheta = richHit->getTheta();
richPhi = richHit->getPhi();
richSec = richHit->getSector();
if (richSec != iSec) continue;
hists->richmdc_dtheta[richSec]->Fill(richTheta - mdcTheta);
hists->richmdc_dphi[richSec]->Fill((richPhi - mdcPhi)*sin(mdcTheta / rad2deg));
if (fabs((richPhi - mdcPhi)*sin(mdcTheta / rad2deg)) > DPHI) continue;
if (fabs((richTheta - mdcTheta)) > DTHETA) continue;
hists->richmdc_lep->Fill(iSec);
}
}
}
}
}
}
void HQAMaker::finalizeHistRichMDC()
{
Float_t scaleF;
if (nProcessed == 0) scaleF = 1.0;
else scaleF = 1. / nProcessed;
for (Int_t s = 0; s < 6; s++) {
hists->richmdc_dtheta[s]->Scale(scaleF);
hists->richmdc_dphi[s]->Scale(scaleF);
}
hists->richmdc_lep->Scale(scaleF);
}
void HQAMaker::fillScalers()
{
TH1D *proj = 0;
for (Int_t sec = 0; sec < 6; sec++) {
if (hists->richCal_nSec->GetEntries() > 0)
(*scalers->richCal_n).fData[sec] = (float) hists->richCal_nSec->GetBinContent(sec + 1) / nProcessed;
if (hists->richHit_nSec->GetEntries() > 0)
(*scalers->richHit_n)[sec] = 1000. * (float) hists->richHit_nSec->GetBinContent(sec + 1) / nProcessed;
if (hists->mdcCal1_nVsSector_m0->GetEntries() > 0) {
proj = hists->mdcCal1_nVsSector_m0->ProjectionX("proj", sec + 1, sec + 1);
(*scalers->mdcCal1_n_m0)[sec] = proj->GetMean();
delete proj;
}
if (hists->mdcCal1_nVsSector_m1->GetEntries() > 0) {
proj = hists->mdcCal1_nVsSector_m1->ProjectionX("proj", sec + 1, sec + 1);
(*scalers->mdcCal1_n_m1)[sec] = proj->GetMean();
delete proj;
}
if (hists->mdcCal1_nVsSector_m2->GetEntries() > 0) {
proj = hists->mdcCal1_nVsSector_m2->ProjectionX("proj", sec + 1, sec + 1);
(*scalers->mdcCal1_n_m2)[sec] = proj->GetMean();
delete proj;
}
if (hists->mdcCal1_nVsSector_m3->GetEntries() > 0) {
proj = hists->mdcCal1_nVsSector_m3->ProjectionX("proj", sec + 1, sec + 1);
(*scalers->mdcCal1_n_m3)[sec] = proj->GetMean();
delete proj;
}
if (hists->tofHit_nSec->GetEntries() > 0)
(*scalers->tofHit_n)[sec] = (float) hists->tofHit_nSec->GetBinContent(sec + 1) / nProcessed;
if (hists->shoHit_nSec->GetEntries() > 0)
(*scalers->shoHit_n)[sec] = (float) hists->shoHit_nSec->GetBinContent(sec + 1) / nProcessed;
if (hists->shoHitTof_nSec->GetEntries() > 0)
(*scalers->shoHitTof_n)[sec] = (float) hists->shoHitTof_nSec->GetBinContent(sec + 1) / nProcessed;
}
}
void HQAMaker::fillHistMatching()
{
HSplineTrack *track = 0;
HRKTrackB *trackRK = NULL;
HTofCluster *Cluster = 0;
HShowerHit *Shower = 0;
HMetaMatch2 *meta = 0;
HRpcCluster *RpcCl = 0;
Float_t rad2deg = 180.0 / TMath::Pi();
if (iterMetaMatch) {
iterMetaMatch->Reset();
while ((meta = (HMetaMatch2 *)iterMetaMatch->Next()) != 0) {
if (meta->getSystem() < 0) continue;
if ((meta->getSplineInd() != -1)) {
track = (HSplineTrack *)catSplineTrk->getObject(meta->getSplineInd());
Bool_t rkSuccess = kTRUE;
Int_t rkReplaceInd = meta->getRungeKuttaInd();
Float_t rkchi2 = -1;
if (rkReplaceInd >= 0) trackRK = (HRKTrackB*) catRungeKuttaTrk->getObject(rkReplaceInd);
else trackRK = 0;
if (trackRK != 0) {
rkchi2 = trackRK->getChiq();
}
if (trackRK && rkchi2 < 0) {
rkSuccess = kFALSE ;
}
if (meta->getSystem() > -1){hists->hsecspline ->Fill(track->getSector());}
if (meta->getSystem() == 1){hists->hsecspline1->Fill(track->getSector());}
if (meta->getSystem() == 0){hists->hsecspline0->Fill(track->getSector());}
Int_t MetaSector = meta->getSector();
if (meta->getSystem()==1) {
Int_t indtof = meta->getTofClstInd(0);
if (indtof >= 0) Cluster = (HTofCluster *) catTfClust->getObject(indtof);
else Cluster = NULL;
if (Cluster) {
if (!rkSuccess) trackRK = NULL;
else {
Int_t indrk = meta->getRungeKuttaIndTofClst(0);
if (indrk >= 0) trackRK = (HRKTrackB*)catRungeKuttaTrk -> getObject(indrk);
}
Int_t TOFsector;
TOFsector = Cluster->getSector();
if(MetaSector!=TOFsector)cout<<"Something strange with META TOF"<<endl;
hists->hXdiffvstofstrip->Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), meta->getTofClstDX(0));
hists->hYdiffvstofstrip->Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), meta->getTofClstDY(0));
hists->htof_quality->Fill(meta->getSector(), meta->getTofClstQuality(0));
hists->hXdiffTof[TOFsector] ->Fill(meta->getTofClstDX(0));
hists->hYdiffTof[TOFsector] ->Fill(meta->getTofClstDY(0));
if (trackRK) {
hists->hXdiffvstofstripRK -> Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), (trackRK -> getMETAdx()));
hists->hYdiffvstofstripRK -> Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), (trackRK -> getMETAdy()));
hists->htof_qualityRK -> Fill(Cluster->getSector(),trackRK ->getQualityTof());
}
if (trackRK&&trackRK->getPolarity()<0&&trackRK->getP()>300&&Cluster->getTof()>6.5&&Cluster->getTof()<9.5) {
hists->hXdiffvstofstripRK_neg -> Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), (trackRK -> getMETAdx()));
hists->hYdiffvstofstripRK_neg -> Fill((Cluster->getSector() * 64 + (Cluster->getModule() * 8) + Cluster->getCell()), (trackRK -> getMETAdy()));
hists->hXdiffvsthetaRK_neg -> Fill((Cluster->getSector() * 100 + trackRK->getTheta()*rad2deg), (trackRK -> getMETAdx()));
hists->hYdiffvsthetaRK_neg -> Fill((Cluster->getSector() * 100 + trackRK->getTheta()*rad2deg), (trackRK -> getMETAdy()));
}
}
}
if (meta->getSystem()==0) {
Int_t indshower = meta->getShowerHitInd(0);
if (indshower >= 0) Shower = (HShowerHit *) catShoHit->getObject(indshower);
else Shower = NULL;
if (Shower) {
Float_t ShwX, ShwY, ShwSigmaX, ShwSigmaY;
Int_t ShwSector;
Char_t ShwRow, ShwCol;
Shower->getXY(&ShwX, &ShwY);
ShwRow = Shower->getRow();
ShwCol = Shower->getCol();
ShwSigmaX = Shower->getSigmaX();
ShwSigmaY = Shower->getSigmaY();
ShwSector = Shower->getSector();
if (ShwSigmaX == 0 || ShwSigmaY == 0.0) cout << "--Error: ShowerSigma could not be 0! " << endl;
if(MetaSector!=ShwSector)cout<<"Something strange with META Shower"<<endl;
hists->hXdiffvsshowersector->Fill(meta->getSector(), meta->getShowerHitDX(0));
hists->hYdiffvsshowersector->Fill(meta->getSector(), meta->getShowerHitDY(0));
hists->hXdiffvsshw->Fill(meta->getSector(), (meta->getShowerHitDX(0)) / ShwSigmaX);
hists->hYdiffvsshw->Fill(meta->getSector(), (meta->getShowerHitDY(0)) / ShwSigmaY);
hists->hshower_quality ->Fill(meta->getSector(), meta->getShowerHitQuality(0));
hists->hXdiffvsshoCol ->Fill(ShwCol + (meta->getSector() * 33), meta->getShowerHitDX(0));
hists->hXdiffvsshoRow ->Fill(ShwRow + (meta->getSector() * 33), meta->getShowerHitDX(0));
hists->hYdiffvsshoCol ->Fill(ShwCol + (meta->getSector() * 33), meta->getShowerHitDY(0));
hists->hYdiffvsshoRow ->Fill(ShwRow + (meta->getSector() * 33), meta->getShowerHitDY(0));
hists->hXdiffsho[ShwSector] ->Fill(meta->getShowerHitDX(0)/ShwSigmaX);
hists->hYdiffsho[ShwSector] ->Fill(meta->getShowerHitDY(0)/ShwSigmaY);
if (!rkSuccess) trackRK = NULL;
else {
Int_t indrk = meta->getRungeKuttaIndShowerHit(0);
if (indrk >= 0) trackRK = (HRKTrackB*)catRungeKuttaTrk -> getObject(indrk);
}
if (trackRK) {
hists -> hXdiffvsshowersectorRK -> Fill(meta->getSector(), trackRK -> getMETAdx());
hists -> hYdiffvsshowersectorRK -> Fill(meta->getSector(), trackRK -> getMETAdy());
hists -> hshower_qualityRK -> Fill(meta->getSector(), trackRK -> getQualityShower());
hists -> hXdiffvsshoColRK ->Fill(ShwCol + (meta->getSector() * 33), trackRK -> getMETAdx());
hists -> hXdiffvsshoRowRK ->Fill(ShwRow + (meta->getSector() * 33), trackRK -> getMETAdx());
hists -> hYdiffvsshoColRK ->Fill(ShwCol + (meta->getSector() * 33), trackRK -> getMETAdy());
hists -> hYdiffvsshoRowRK ->Fill(ShwRow + (meta->getSector() * 33), trackRK -> getMETAdy());
}
}
}
if (meta->getSystem()==0) {
Int_t indRpc = meta->getRpcClstInd(0);
if (indRpc >= 0) RpcCl = (HRpcCluster *) fCatRpcCluster->getObject(indRpc);
else RpcCl = NULL;
if (RpcCl) {
Float_t RpcSigmaX, RpcSigmaY;
RpcSigmaX = RpcCl->getXRMS();
RpcSigmaY = RpcCl->getYRMS();
if (RpcSigmaX == 0 || RpcSigmaY == 0.0) cout << "--Error: RpcSigma could not be 0! " << endl;
hists->hXdiffvsRpcsector->Fill(meta->getSector(), meta->getRpcClstDX(0));
hists->hYdiffvsRpcsector->Fill(meta->getSector(), meta->getRpcClstDY(0));
hists->hXdiffvsRpc->Fill(meta->getSector(), (meta->getRpcClstDX(0)) / RpcSigmaX);
hists->hYdiffvsRpc->Fill(meta->getSector(), (meta->getRpcClstDY(0)) / RpcSigmaY);
hists->hRpc_quality ->Fill(meta->getSector(), meta->getRpcClstQuality(0));
hists->hXdiffRpc[(Int_t)meta->getSector()] ->Fill(meta->getRpcClstDX(0)/RpcSigmaX);
hists->hYdiffRpc[(Int_t)meta->getSector()] ->Fill(meta->getRpcClstDY(0)/RpcSigmaY);
}
}
}
}
}
}
void HQAMaker::fillHistPid()
{
HParticleCand *pCand = NULL;
HStart2Cal *stCal = NULL;
HStart2Hit *pStartHit = NULL;
HRpcCluster *pRpcClu = NULL;
HTofCluster *pTofClu = NULL;
Int_t multRK = 0;
Int_t multLepCand = 0;
Bool_t isGoodRich = kFALSE;
Int_t MetaCounts[6][2];
Int_t MetaCountsSelect[6][2];
for(Int_t i=0; i<6; i++)
{
for(Int_t j=0; j<2; j++)
{
MetaCounts[i][j]=0;
MetaCountsSelect[i][j]=0;
}
}
Float_t startTime = 0.0;
Int_t startStrip = -1;
if (iterStHit) {
iterStHit->Reset();
while (NULL != (pStartHit = static_cast<HStart2Hit*>(iterStHit->Next()))) {
if (pStartHit->getModule() == 0) {
startStrip = pStartHit->getStrip();
startTime = pStartHit->getTime();
}
}
}
Float_t startCalTimeMod0 = 0.0;
Int_t startCalStripMod0 = -1;
Float_t startCalTimeMod1 = 0.0;
Int_t startCalStripMod1 = -1;
if (NULL == iterParticleCand) {
return ;
}
iterParticleCand->Reset();
Int_t nDataObjs = static_cast<TObjArray*>(const_cast<TCollection*>(iterParticleCand->GetCollection()))->GetEntries();
varHists->particleCand_n_Var->Fill(nEvent, nDataObjs);
while (NULL != (pCand = dynamic_cast<HParticleCand*>(iterParticleCand->Next()))) {
isGoodRich = kFALSE;
if( ( pCand->getRingAmplitude() ) / (pCand->getRingNumPads() ) > 80 ) {
isGoodRich = kTRUE;
}
if (pCand->getSystem() > -1 ) {
multRK++;
if (pCand->isRichMatch(Particle::kIsRICHRK) && isGoodRich ) {
++multLepCand;
}
} else {
continue;
}
if (pCand->getChi2() > 0 && pCand->getChi2() < 1000)
{
Float_t fPidTimeCorr = 0.0;
if (pCand->getBeta() != 0.) {
fPidTimeCorr = 7. / pCand->getBeta();
}
if (pCand->isRichMatch(Particle::kIsRICHRK) && isGoodRich )
{
if (pCand->getSystem() == 0 && pCand->getRpcInd() > -1 && fCatRpcCluster )
{
if (NULL != (pRpcClu = static_cast<HRpcCluster*>(fCatRpcCluster->getObject(pCand->getRpcInd()))) && (pRpcClu->getClusterType() == 1 ) ) {
hists->hparticle_lepton_tof_vs_rod_sys0->Fill(pCand->getSector() * 192 + pRpcClu->getColumn1() * 32 + pRpcClu->getCell1(), fPidTimeCorr);
}
}
if (pCand->getSystem() == 1 && pCand->getTofClstInd() > -1 && catTfClust)
{
if (NULL != (pTofClu = static_cast<HTofCluster*>(catTfClust->getObject(pCand->getTofClstInd())))) {
hists->hparticle_lepton_tof_vs_rod_sys1->Fill(pCand->getSector() * 64 + (pTofClu->getModule() * 8 + pTofClu->getCell()), fPidTimeCorr);
}
}
if (pCand->getSystem() == 0)
{
hists->hparticle_lepton_tof_vs_startstrip_sys0->Fill(startStrip, fPidTimeCorr);
hists->hparticle_lepton_tof_all_sys0->Fill(fPidTimeCorr);
if(startStrip>-1)
{
hists->hparticle_lepton_tof_vs_start_sys0[startStrip]->Fill(fPidTimeCorr);
}
}
if (pCand->getSystem() == 1)
{
hists->hparticle_lepton_tof_vs_startstrip_sys1->Fill(startStrip, fPidTimeCorr);
hists->hparticle_lepton_tof_all_sys1->Fill(fPidTimeCorr);
if(startStrip>-1)
{
hists->hparticle_lepton_tof_vs_start_sys1[startStrip]->Fill(fPidTimeCorr);
}
}
}
if (pCand->getSystem() > -1)
{
hists->hparticle_RK_theta_sec[pCand->getSector()]->Fill(pCand->getTheta());
hists->hparticle_RK_phi->Fill(pCand->getPhi());
if (pCand->getCharge() == -1 && pCand->getMomentum() > 300)
{
hists->hparticle_RK_neg_theta_sec[pCand->getSector()]->Fill(pCand->getTheta());
hists->hparticle_RK_neg_phi->Fill(pCand->getPhi());
Float_t beta_c = (pCand->getMomentum())/TMath::Sqrt((pCand->getMomentum())*(pCand->getMomentum())+139*139.);
Float_t tof_c;
Float_t time_diff;
if (pCand->getSystem() ==0 && pCand->getRpcInd() > -1 && fCatRpcCluster)
{
if (NULL != (pRpcClu = static_cast<HRpcCluster*>(fCatRpcCluster->getObject(pCand->getRpcInd()))) &&
(pRpcClu->getClusterType() == 1) && pCand->getCharge() < 0. && pCand->getMomentum() > 200.0 )
{
tof_c = ( pCand->getBeta()*( pRpcClu->getTof()))/beta_c;
time_diff = (pRpcClu->getTof()) - tof_c;
hists->hparticle_pi_tof_vs_rod_sys0->Fill(pCand->getSector() * 192 + pRpcClu->getColumn1() * 32 + pRpcClu->getCell1(), time_diff);
hists->hparticle_pi_tof_vs_startstrip_sys0->Fill(startStrip, time_diff);
hists->hparticle_pi_tof_all_sys0->Fill(time_diff);
if(startStrip>-1)
{
hists->hparticle_pi_tof_vs_start_sys0[startStrip]->Fill(time_diff);
if (iterStCal) {
iterStCal->Reset();
while (( stCal = (HStart2Cal*) iterStCal->Next()) != 0 ) {
if (stCal->getModule() == 0) {
for(int t=1; t<stCal->getMaxMultiplicity()+1 ; t++){
if( fabs( stCal->getTime(t)) < 20.0 ){
startCalTimeMod0 = stCal->getTime(t);
startCalStripMod0 = stCal->getStrip();
hists->hparticle_pi_tof_vs_startMod0_sys0[startCalStripMod0]
->Fill(time_diff + startTime - startCalTimeMod0 );
}
}
}
if (stCal->getModule() == 1) {
for(int t=1; t<stCal->getMaxMultiplicity()+1 ; t++){
if( fabs( stCal->getTime(t)) < 20.0 ){
startCalTimeMod1 = stCal->getTime(t);
startCalStripMod1 = stCal->getStrip();
hists->hparticle_pi_tof_vs_startMod1_sys0[startCalStripMod1]
->Fill(time_diff + startTime - startCalTimeMod1 );
}
}
}
}
}
}
}
}
if (pCand->getSystem() == 1 && pCand->getTofClstInd() > -1 && catTfClust)
{
if (NULL != (pTofClu = static_cast<HTofCluster*>(catTfClust->getObject(pCand->getTofClstInd()))) &&
pCand->getCharge() < 0. && pCand->getMomentum() > 300.0)
{
tof_c = ( pCand->getBeta()*( pTofClu->getTof()))/beta_c;
time_diff = (pTofClu->getTof()) - tof_c;
hists->hparticle_pi_tof_vs_rod_sys1->Fill(pCand->getSector() * 64 + (pTofClu->getModule() * 8 + pTofClu->getCell()), time_diff);
hists->hparticle_pi_eloss_vs_rod_sys1->Fill(pCand->getSector() * 64 + (pTofClu->getModule() * 8 + pTofClu->getCell()),pTofClu->getEdep() );
hists->hparticle_pi_tof_vs_startstrip_sys1->Fill(startStrip, time_diff);
hists->hparticle_pi_tof_all_sys1->Fill(time_diff);
hists->hparticle_pi_metahit_vs_phi_sys1->Fill(pCand->getPhi(),(pTofClu->getModule() * 8 + pTofClu->getCell()));
if(startStrip>-1)
{
hists->hparticle_pi_tof_vs_start_sys1[startStrip]->Fill(time_diff);
}
}
}
}
}
if (pCand->getSystem() == 1 && catTfClust)
{
if (NULL != (pTofClu = static_cast<HTofCluster*>(catTfClust->getObject(pCand->getTofClstInd()))) && pCand->getCharge() == 1 && pCand->getMomentum() > 300 && pCand->getMomentum() < 350 &&pCand->getBeta()>0.25&&pCand->getBeta()<0.4 )
{
hists->hparticle_p_eloss_vs_rod_sys1->Fill(pCand->getSector() * 64 + (pTofClu->getModule() * 8 + pTofClu->getCell()),pTofClu->getEdep() );
}
}
if (pCand->getCharge() > 0 && pCand->getBeta() < 1) {
if (pCand->getSystem() == 0) hists->hparticle_rk_momdif_sys0_sec[pCand->getSector()]
->Fill(pCand->getMomentum(), pCand->getMomentum() - (938.*pCand->getBeta() * 1. / sqrt(1. - pCand->getBeta()*pCand->getBeta())));
if (pCand->getSystem() == 1) hists->hparticle_rk_momdif_sys1_sec[pCand->getSector()]
->Fill(pCand->getMomentum(), pCand->getMomentum() - (938.*pCand->getBeta() * 1. / sqrt(1. - pCand->getBeta()*pCand->getBeta())));
}
if(pCand->isTofClstUsed()||pCand->isTofClstUsed())
{
hists->hparticle_MetaMatchQualTof[pCand->getSector()]->Fill(pCand->getMetaMatchQuality());
}
if(pCand->isRpcClstUsed())
{
hists->hparticle_MetaMatchQualRpc[pCand->getSector()]->Fill(pCand->getMetaMatchQuality());
}
if(pCand->getShowerInd()>-1)
{
hists->hparticle_MetaMatchQualShw[pCand->getSector()]->Fill(pCand->getMetaMatchQualityShower());
}
if(pCand->getSystem()>-1&&pCand->getSystem()<2)
{
MetaCounts[pCand->getSector()][pCand->getSystem()]++;
if(pCand->isFlagBit(Particle::kIsUsed))
{
MetaCountsSelect[pCand->getSector()][pCand->getSystem()]++;
}
}
if(pCand->getSystem()==1)
{
hists->hparticle_TofdEdx->Fill(pCand->getTofdEdx());
}
}
}
hists->hparticle_multrk->Fill(multRK);
varHists->particleCandLep_n_Var->Fill(nEvent, multLepCand);
for(Int_t i=0; i<6; i++)
{
for(Int_t j=0;j<2;j++)
{
hists->hparticle_mult[i][j]->Fill(MetaCounts[i][j]);
hists->hparticle_mult_select[i][j]->Fill(MetaCountsSelect[i][j]);
}
}
}
void HQAMaker::finalizeHistPid()
{
Text_t buffer[80];
for(Int_t i=0; i<6; i++)
{
if(hists->hparticle_MetaMatchQualTof[i]->GetEntries()>0)
{
TPhy.fTMetaMatchTofMean[i]=hists->hparticle_MetaMatchQualTof[i]->GetMean();
TPhy.fTMetaMatchTofMax[i]=hists->hparticle_MetaMatchQualTof[i]->GetBinCenter(hists->hparticle_MetaMatchQualTof[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualTof[i]->GetXaxis()->SetRangeUser(0,10);
TPhy.fTMetaMatchTofMax2[i]=hists->hparticle_MetaMatchQualTof[i]->GetBinCenter(hists->hparticle_MetaMatchQualTof[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualTof[i]->GetXaxis()->SetRangeUser(-10,10);
}
if(hists->hparticle_MetaMatchQualRpc[i]->GetEntries()>0)
{
TPhy.fTMetaMatchRpcMean[i]=hists->hparticle_MetaMatchQualRpc[i]->GetMean();
TPhy.fTMetaMatchRpcMax[i]=hists->hparticle_MetaMatchQualRpc[i]->GetBinCenter(hists->hparticle_MetaMatchQualRpc[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualRpc[i]->GetXaxis()->SetRangeUser(0,10);
TPhy.fTMetaMatchRpcMax2[i]=hists->hparticle_MetaMatchQualRpc[i]->GetBinCenter(hists->hparticle_MetaMatchQualRpc[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualRpc[i]->GetXaxis()->SetRangeUser(-10,10);
}
if(hists->hparticle_MetaMatchQualShw[i]->GetEntries()>0)
{
TPhy.fTMetaMatchShwMean[i]=hists->hparticle_MetaMatchQualShw[i]->GetMean();
TPhy.fTMetaMatchShwMax[i]=hists->hparticle_MetaMatchQualShw[i]->GetBinCenter(hists->hparticle_MetaMatchQualShw[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualShw[i]->GetXaxis()->SetRangeUser(0,10);
TPhy.fTMetaMatchShwMax2[i]=hists->hparticle_MetaMatchQualShw[i]->GetBinCenter(hists->hparticle_MetaMatchQualShw[i]->GetMaximumBin());
hists->hparticle_MetaMatchQualShw[i]->GetXaxis()->SetRangeUser(-10,10);
}
for(Int_t j=0; j<2; j++)
{
if(hists->hparticle_mult[i][j]->GetEntries()>0)
{
TPhy.fTMultiMean[i][j]=hists->hparticle_mult[i][j]->GetMean();
TPhy.fTMultiMax[i][j]=hists->hparticle_mult[i][j]->GetBinCenter(hists->hparticle_mult[i][j]->GetMaximumBin());
}
if(hists->hparticle_mult_select[i][j]->GetEntries()>0)
{
TPhy.fTMultiMeanSelect[i][j]=hists->hparticle_mult_select[i][j]->GetMean();
TPhy.fTMultiMaxSelect[i][j]=hists->hparticle_mult_select[i][j]->GetBinCenter(hists->hparticle_mult_select[i][j]->GetMaximumBin());
}
}
}
if(hists->hparticle_lepton_tof_all_sys0->GetEntries()>0)
{
TPhy.fTTimeLepSumSys0Mean=hists->hparticle_lepton_tof_all_sys0->GetMean();
TPhy.fTTimeLepSumSys0Max=hists->hparticle_lepton_tof_all_sys0->GetBinCenter(hists->hparticle_lepton_tof_all_sys0->GetMaximumBin());
TPhy.fTTimeLepSumSys0Sig=hists->hparticle_lepton_tof_all_sys0->GetRMS();
}
if(hists->hparticle_lepton_tof_all_sys1->GetEntries()>0)
{
TPhy.fTTimeLepSumSys1Mean=hists->hparticle_lepton_tof_all_sys1->GetMean();
TPhy.fTTimeLepSumSys1Max=hists->hparticle_lepton_tof_all_sys1->GetBinCenter(hists->hparticle_lepton_tof_all_sys1->GetMaximumBin());
TPhy.fTTimeLepSumSys1Sig=hists->hparticle_lepton_tof_all_sys1->GetRMS();
}
if(hists->hparticle_pi_tof_all_sys0->GetEntries()>0)
{
TPhy.fTTimePiSumSys0Mean=hists->hparticle_pi_tof_all_sys0->GetMean();
TPhy.fTTimePiSumSys0Max=hists->hparticle_pi_tof_all_sys0->GetBinCenter(hists->hparticle_pi_tof_all_sys0->GetMaximumBin());
TPhy.fTTimePiSumSys0Sig=hists->hparticle_pi_tof_all_sys0->GetRMS();
for(Int_t n=0; n<3; n++)
{
hists->hparticle_pi_tof_GaussFit_all_sys0->ReleaseParameter(n);
hists->hparticle_pi_tof_GaussFit_all_sys0->SetParameter(n,0.0);
}
if(hists->hparticle_pi_tof_all_sys0->GetEntries()>300)
{
hists->hparticle_pi_tof_GaussFit_all_sys0->SetParameter(0,hists->hparticle_pi_tof_all_sys0->GetMaximum());
hists->hparticle_pi_tof_GaussFit_all_sys0->SetParameter(1,TPhy.fTTimePiSumSys0Max);
hists->hparticle_pi_tof_GaussFit_all_sys0->SetParameter(2,1.0);
hists->hparticle_pi_tof_GaussFit_all_sys0->SetRange(TPhy.fTTimePiSumSys0Max-1,TPhy.fTTimePiSumSys0Max+1);
hists->hparticle_pi_tof_all_sys0->Fit("hparticle_pi_tof_GaussFit_all_sys0","+Q","",TPhy.fTTimePiSumSys0Max-0.7,TPhy.fTTimePiSumSys0Max+0.5);
TPhy.fTTimePiSumSys0FitMean=hists->hparticle_pi_tof_GaussFit_all_sys0->GetParameter(1);
}
}
if(hists->hparticle_pi_tof_all_sys1->GetEntries()>0)
{
TPhy.fTTimePiSumSys1Mean=hists->hparticle_pi_tof_all_sys1->GetMean();
TPhy.fTTimePiSumSys1Max=hists->hparticle_pi_tof_all_sys1->GetBinCenter(hists->hparticle_pi_tof_all_sys1->GetMaximumBin());
TPhy.fTTimePiSumSys1Sig=hists->hparticle_pi_tof_all_sys1->GetRMS();
for(Int_t n=0; n<3; n++)
{
hists->hparticle_pi_tof_GaussFit_all_sys1->ReleaseParameter(n);
hists->hparticle_pi_tof_GaussFit_all_sys1->SetParameter(n,0.0);
}
if(hists->hparticle_pi_tof_all_sys1->GetEntries()>300)
{
hists->hparticle_pi_tof_GaussFit_all_sys1->SetParameter(0,hists->hparticle_pi_tof_all_sys1->GetMaximum());
hists->hparticle_pi_tof_GaussFit_all_sys1->SetParameter(1,TPhy.fTTimePiSumSys1Max);
hists->hparticle_pi_tof_GaussFit_all_sys1->SetParameter(2,1.0);
hists->hparticle_pi_tof_GaussFit_all_sys1->SetRange(TPhy.fTTimePiSumSys1Max-1,TPhy.fTTimePiSumSys1Max+1);
hists->hparticle_pi_tof_all_sys1->Fit("hparticle_pi_tof_GaussFit_all_sys1","+Q","",TPhy.fTTimePiSumSys1Max-0.7,TPhy.fTTimePiSumSys1Max+0.5);
TPhy.fTTimePiSumSys1FitMean=hists->hparticle_pi_tof_GaussFit_all_sys1->GetParameter(1);
}
}
for(Int_t i=0; i<NSTART_STRIPS; i++)
{
if(hists->hparticle_lepton_tof_vs_start_sys0[i]->GetEntries()>0)
{
TPhy.fTTimeLepStaSys0Mean[i]=hists->hparticle_lepton_tof_vs_start_sys0[i]->GetMean();
TPhy.fTTimeLepStaSys0Max[i]=hists->hparticle_lepton_tof_vs_start_sys0[i]->GetBinCenter(hists->hparticle_lepton_tof_vs_start_sys0[i]->GetMaximumBin());
TPhy.fTTimeLepStaSys0Sig[i]=hists->hparticle_lepton_tof_vs_start_sys0[i]->GetRMS();
}
if(hists->hparticle_lepton_tof_vs_start_sys1[i]->GetEntries()>0)
{
TPhy.fTTimeLepStaSys1Mean[i]=hists->hparticle_lepton_tof_vs_start_sys1[i]->GetMean();
TPhy.fTTimeLepStaSys1Max[i]=hists->hparticle_lepton_tof_vs_start_sys1[i]->GetBinCenter(hists->hparticle_lepton_tof_vs_start_sys1[i]->GetMaximumBin());
TPhy.fTTimeLepStaSys1Sig[i]=hists->hparticle_lepton_tof_vs_start_sys1[i]->GetRMS();
}
if(hists->hparticle_pi_tof_vs_start_sys0[i]->GetEntries()>0)
{
TPhy.fTTimePiStaSys0Mean[i]=hists->hparticle_pi_tof_vs_start_sys0[i]->GetMean();
TPhy.fTTimePiStaSys0Max[i]=hists->hparticle_pi_tof_vs_start_sys0[i]->GetBinCenter(hists->hparticle_pi_tof_vs_start_sys0[i]->GetMaximumBin());
TPhy.fTTimePiStaSys0Sig[i]=hists->hparticle_pi_tof_vs_start_sys0[i]->GetRMS();
for(Int_t n=0; n<3; n++)
{
hists->hparticle_pi_tof_GaussFit_sys0[i]->ReleaseParameter(n);
hists->hparticle_pi_tof_GaussFit_sys0[i]->SetParameter(n,0.0);
}
if(hists->hparticle_pi_tof_vs_start_sys0[i]->GetEntries()>300)
{
sprintf(buffer,"hparticle_pi_tof_GaussFit_sys0[%i]",i);
hists->hparticle_pi_tof_GaussFit_sys0[i]->SetParameter(0,hists->hparticle_pi_tof_vs_start_sys0[i]->GetMaximum());
hists->hparticle_pi_tof_GaussFit_sys0[i]->SetParameter(1,TPhy.fTTimePiStaSys0Max[i]);
hists->hparticle_pi_tof_GaussFit_sys0[i]->SetParameter(2,1.0);
hists->hparticle_pi_tof_GaussFit_sys0[i]->SetRange(TPhy.fTTimePiStaSys0Max[i]-1,TPhy.fTTimePiStaSys0Max[i]+1);
hists->hparticle_pi_tof_vs_start_sys0[i]->Fit(buffer,"+Q","",TPhy.fTTimePiStaSys0Max[i]-0.7,TPhy.fTTimePiStaSys0Max[i]+0.5);
TPhy.fTTimePiStaSys0FitMean[i]=hists->hparticle_pi_tof_GaussFit_sys0[i]->GetParameter(1);
}
}
if(hists->hparticle_pi_tof_vs_start_sys1[i]->GetEntries()>0)
{
TPhy.fTTimePiStaSys1Mean[i]=hists->hparticle_pi_tof_vs_start_sys1[i]->GetMean();
TPhy.fTTimePiStaSys1Max[i]=hists->hparticle_pi_tof_vs_start_sys1[i]->GetBinCenter(hists->hparticle_pi_tof_vs_start_sys1[i]->GetMaximumBin());
TPhy.fTTimePiStaSys1Sig[i]=hists->hparticle_pi_tof_vs_start_sys1[i]->GetRMS();
for(Int_t n=0; n<3; n++)
{
hists->hparticle_pi_tof_GaussFit_sys1[i]->ReleaseParameter(n);
hists->hparticle_pi_tof_GaussFit_sys1[i]->SetParameter(n,0.0);
}
if(hists->hparticle_pi_tof_vs_start_sys1[i]->GetEntries()>300)
{
sprintf(buffer,"hparticle_pi_tof_GaussFit_sys1[%i]",i);
hists->hparticle_pi_tof_GaussFit_sys1[i]->SetParameter(0,hists->hparticle_pi_tof_vs_start_sys1[i]->GetMaximum());
hists->hparticle_pi_tof_GaussFit_sys1[i]->SetParameter(1,TPhy.fTTimePiStaSys1Max[i]);
hists->hparticle_pi_tof_GaussFit_sys1[i]->SetParameter(2,1.0);
hists->hparticle_pi_tof_GaussFit_sys1[i]->SetRange(TPhy.fTTimePiStaSys1Max[i]-1,TPhy.fTTimePiStaSys1Max[i]+1);
hists->hparticle_pi_tof_vs_start_sys1[i]->Fit(buffer,"+Q","",TPhy.fTTimePiStaSys1Max[i]-0.7,TPhy.fTTimePiStaSys1Max[i]+0.5);
TPhy.fTTimePiStaSys1FitMean[i]=hists->hparticle_pi_tof_GaussFit_sys1[i]->GetParameter(1);
}
}
}
if(hists->hparticle_TofdEdx->GetEntries()>0)
{
TPhy.fTTofdEdxMean=hists->hparticle_TofdEdx->GetMean();
TPhy.fTTofdEdxMax=hists->hparticle_TofdEdx->GetBinCenter(hists->hparticle_TofdEdx->GetMaximumBin());
}
}
void HQAMaker::fillHistDaqScaler()
{
HTBoxChan *pTBoxChannel;
Int_t chan = 0;
UInt_t scaler = 0;
if (!iterHTBoxChan) {
return;
}
iterHTBoxChan->Reset();
while ((pTBoxChannel = (HTBoxChan *)iterHTBoxChan->Next()) != 0) {
pTBoxChannel->getScalerData(chan, scaler);
hists-> histAllScalerCh -> Fill(chan+1,scaler);
hists-> histAllScalerTrend -> Fill(nCountCalEvents, chan+1,scaler);
if(chan>=74&&chan<82) hists-> histInputScaler->Fill(chan+1-74,scaler);
if(chan>=93&&chan<101) hists-> histDownScaler->Fill(chan+1-93,scaler);
if(chan>=129&&chan<137)hists-> histGatedScaler->Fill(chan+1-129,scaler);
if(chan>=112&&chan<120)hists-> histAcceptScaler->Fill(chan+1-112,scaler);
if(chan>=46&&chan<54) hists-> histStartScaler->Fill(chan+1-46,scaler);
if(chan==82) hists-> histStartScaler->Fill(9,scaler);
if(chan>=54&&chan<62) hists-> histVetoScaler->Fill(chan+1-54,scaler);
if(chan>=62&&chan<68) hists-> histTofScaler->Fill(chan+1-62,scaler);
if(chan>=68&&chan<74) hists-> histRpcScaler->Fill(chan+1-68,scaler);
}
}
void HQAMaker::fillHistShowerRpc()
{
HShowerHit *shoHit = 0;
HRpcHit *rpcHit = 0;
Int_t shoSec, shoMod, rpcSec;
Float_t shoX, shoY, rpcX, rpcY;
if (iterShoHit && iterRpcHit) {
iterShoHit->Reset();
while ((shoHit = (HShowerHit*) iterShoHit->Next()) != 0) {
shoSec = shoHit->getSector();
shoMod = shoHit->getModule();
shoHit->getXY(&shoX, &shoY);
iterRpcHit->Reset();
while ((rpcHit = (HRpcHit*) iterRpcHit->Next()) != 0) {
rpcSec = rpcHit->getSector();
rpcX = rpcHit->getXMod();
rpcY = rpcHit->getYMod();
if (shoSec == rpcSec) {
switch (shoMod) {
case 0:
hists->shorpcXdiff_pre[shoSec]->Fill(shoX - rpcX);
hists->shorpcYdiff_pre[shoSec]->Fill(shoY - rpcY);
hists->shorpcXvs_pre[shoSec]->Fill(shoX, rpcX);
hists->shorpcYvs_pre[shoSec]->Fill(shoY, rpcY);
break;
case 1:
hists->shorpcXdiff_post1[shoSec]->Fill(shoX - rpcX);
hists->shorpcYdiff_post1[shoSec]->Fill(shoY - rpcY);
hists->shorpcXvs_post1[shoSec]->Fill(shoX, rpcX);
hists->shorpcYvs_post1[shoSec]->Fill(shoY, rpcY);
break;
case 2:
hists->shorpcXdiff_post2[shoSec]->Fill(shoX - rpcX);
hists->shorpcYdiff_post2[shoSec]->Fill(shoY - rpcY);
hists->shorpcXvs_post2[shoSec]->Fill(shoX, rpcX);
hists->shorpcYvs_post2[shoSec]->Fill(shoY, rpcY);
break;
}
}
}
}
}
}
void HQAMaker::finalizeHistShowerRpc()
{
}
void HQAMaker::fillGlobalVertex()
{
HVertex pGlobVertex = gHades->getCurrentEvent()->getHeader()->getVertex();
Float_t fVertX = pGlobVertex.getX();
Float_t fVertY = pGlobVertex.getY();
Float_t fVertZ = pGlobVertex.getZ();
Float_t fVertChi2 = pGlobVertex.getChi2();
if (fVertChi2 > -1.0) {
hists->stVertexXY->Fill(fVertX, fVertY);
hists->stVertexZ->Fill(fVertZ);
}
}
void HQAMaker::fillMassSpectrum()
{
HParticleCand *pCand = 0;
if (NULL == iterParticleCand) {
return ;
}
iterParticleCand->Reset();
while (NULL != (pCand = dynamic_cast<HParticleCand*>(iterParticleCand->Next())))
{
hists->hparticle_mass ->Fill(sqrt(pCand->getMass2())*pCand->getCharge());
if(pCand->getSystem()==0)
{
hists->hparticle_mass_RPC ->Fill(sqrt(pCand->getMass2())*pCand->getCharge());
}
if(pCand->getSystem()==1)
{
hists->hparticle_mass_TOF ->Fill(sqrt(pCand->getMass2())*pCand->getCharge());
}
}
}
void HQAMaker::finalizeMassSpectrum()
{
for(Int_t n = 0; n < 3; n++)
{
hists->hparticle_mass_GaussFit->ReleaseParameter(n);
hists->hparticle_mass_GaussFit->SetParameter(n,0.0);
hists->hparticle_mass_GaussFit_1->ReleaseParameter(n);
hists->hparticle_mass_GaussFit_1->SetParameter(n,0.0);
hists->hparticle_mass_GaussFit_2->ReleaseParameter(n);
hists->hparticle_mass_GaussFit_2->SetParameter(n,0.0);
hists->hparticle_mass_RPC_GaussFit->ReleaseParameter(n);
hists->hparticle_mass_RPC_GaussFit->SetParameter(n,0.0);
hists->hparticle_mass_RPC_GaussFit_1->ReleaseParameter(n);
hists->hparticle_mass_RPC_GaussFit_1->SetParameter(n,0.0);
hists->hparticle_mass_RPC_GaussFit_2->ReleaseParameter(n);
hists->hparticle_mass_RPC_GaussFit_2->SetParameter(n,0.0);
hists->hparticle_mass_TOF_GaussFit->ReleaseParameter(n);
hists->hparticle_mass_TOF_GaussFit->SetParameter(n,0.0);
hists->hparticle_mass_TOF_GaussFit_1->ReleaseParameter(n);
hists->hparticle_mass_TOF_GaussFit_1->SetParameter(n,0.0);
hists->hparticle_mass_TOF_GaussFit_2->ReleaseParameter(n);
hists->hparticle_mass_TOF_GaussFit_2->SetParameter(n,0.0);
}
hists->hparticle_mass_GaussFit->SetParameter(0,hists->hparticle_mass->GetMaximum());
hists->hparticle_mass_GaussFit->SetParameter(1,900.0);
hists->hparticle_mass_GaussFit->SetParameter(2,30.0);
hists->hparticle_mass_GaussFit_1->SetParameter(0,hists->hparticle_mass->GetMaximum()/3.0);
hists->hparticle_mass_GaussFit_1->SetParameter(1,140.0);
hists->hparticle_mass_GaussFit_1->SetParameter(2,30.0);
hists->hparticle_mass_GaussFit_2->SetParameter(0,hists->hparticle_mass->GetMaximum());
hists->hparticle_mass_GaussFit_2->SetParameter(1,-140.0);
hists->hparticle_mass_GaussFit_2->SetParameter(2,30.0);
hists->hparticle_mass_RPC_GaussFit->SetParameter(0,hists->hparticle_mass_RPC->GetMaximum());
hists->hparticle_mass_RPC_GaussFit->SetParameter(1,900.0);
hists->hparticle_mass_RPC_GaussFit->SetParameter(2,30.0);
hists->hparticle_mass_RPC_GaussFit_1->SetParameter(0,hists->hparticle_mass_RPC->GetMaximum()/3.0);
hists->hparticle_mass_RPC_GaussFit_1->SetParameter(1,140.0);
hists->hparticle_mass_RPC_GaussFit_1->SetParameter(2,30.0);
hists->hparticle_mass_RPC_GaussFit_2->SetParameter(0,hists->hparticle_mass_RPC->GetMaximum());
hists->hparticle_mass_RPC_GaussFit_2->SetParameter(1,-140.0);
hists->hparticle_mass_RPC_GaussFit_2->SetParameter(2,30.0);
hists->hparticle_mass_TOF_GaussFit->SetParameter(0,hists->hparticle_mass_TOF->GetMaximum());
hists->hparticle_mass_TOF_GaussFit->SetParameter(1,900.0);
hists->hparticle_mass_TOF_GaussFit->SetParameter(2,30.0);
hists->hparticle_mass_TOF_GaussFit_1->SetParameter(0,hists->hparticle_mass_TOF->GetMaximum()/3.0);
hists->hparticle_mass_TOF_GaussFit_1->SetParameter(1,140.0);
hists->hparticle_mass_TOF_GaussFit_1->SetParameter(2,30.0);
hists->hparticle_mass_TOF_GaussFit_2->SetParameter(0,hists->hparticle_mass_TOF->GetMaximum());
hists->hparticle_mass_TOF_GaussFit_2->SetParameter(1,-140.0);
hists->hparticle_mass_TOF_GaussFit_2->SetParameter(2,30.0);
hists->hparticle_mass_GaussFit->SetRange(810,1030);
hists->hparticle_mass_GaussFit_1->SetRange(90,190);
hists->hparticle_mass_GaussFit_2->SetRange(-190,-90);
hists->hparticle_mass_RPC_GaussFit->SetRange(810,1030);
hists->hparticle_mass_RPC_GaussFit_1->SetRange(90,190);
hists->hparticle_mass_RPC_GaussFit_2->SetRange(-190,-90);
hists->hparticle_mass_TOF_GaussFit->SetRange(810,1030);
hists->hparticle_mass_TOF_GaussFit_1->SetRange(90,190);
hists->hparticle_mass_TOF_GaussFit_2->SetRange(-190,-90);
hists->hparticle_mass->Fit("hparticle_mass_GaussFit","+Q","",810,1030);
hists->hparticle_mass->Fit("hparticle_mass_GaussFit_1","+Q","",90,190);
hists->hparticle_mass->Fit("hparticle_mass_GaussFit_2","+Q","",-190,-90);
if(hists->hparticle_mass->GetEntries()>0)
{
TPhy.fTMass_proton = hists->hparticle_mass_GaussFit->GetParameter(1);
TPhy.fTMass_pip = hists->hparticle_mass_GaussFit_1->GetParameter(1);
TPhy.fTMass_pim = hists->hparticle_mass_GaussFit_2->GetParameter(1);
TPhy.fTChi2_proton = hists->hparticle_mass_GaussFit->GetChisquare();
TPhy.fTChi2_pip = hists->hparticle_mass_GaussFit_1->GetChisquare();
TPhy.fTChi2_pim = hists->hparticle_mass_GaussFit_2->GetChisquare();
}
hists->hparticle_mass_RPC->Fit("hparticle_mass_RPC_GaussFit","+Q","",810,1030);
hists->hparticle_mass_RPC->Fit("hparticle_mass_RPC_GaussFit_1","+Q","",90,190);
hists->hparticle_mass_RPC->Fit("hparticle_mass_RPC_GaussFit_2","+Q","",-190,90);
if(hists->hparticle_mass_RPC->GetEntries()>0)
{
TPhy.fTMass_proton_RPC = hists->hparticle_mass_RPC_GaussFit->GetParameter(1);
TPhy.fTMass_pip_RPC = hists->hparticle_mass_RPC_GaussFit_1->GetParameter(1);
TPhy.fTMass_pim_RPC = hists->hparticle_mass_RPC_GaussFit_2->GetParameter(1);
TPhy.fTChi2_proton_RPC = hists->hparticle_mass_RPC_GaussFit->GetChisquare();
TPhy.fTChi2_pip_RPC = hists->hparticle_mass_RPC_GaussFit_1->GetChisquare();
TPhy.fTChi2_pim_RPC = hists->hparticle_mass_RPC_GaussFit_2->GetChisquare();
}
hists->hparticle_mass_TOF->Fit("hparticle_mass_TOF_GaussFit","+Q","",810,1030);
hists->hparticle_mass_TOF->Fit("hparticle_mass_TOF_GaussFit_1","+Q","",90,190);
hists->hparticle_mass_TOF->Fit("hparticle_mass_TOF_GaussFit_2","+Q","",-190,90);
if(hists->hparticle_mass_TOF->GetEntries()>0)
{
TPhy.fTMass_proton_TOF = hists->hparticle_mass_TOF_GaussFit->GetParameter(1);
TPhy.fTMass_pip_TOF = hists->hparticle_mass_TOF_GaussFit_1->GetParameter(1);
TPhy.fTMass_pim_TOF = hists->hparticle_mass_TOF_GaussFit_2->GetParameter(1);
TPhy.fTChi2_proton_TOF = hists->hparticle_mass_TOF_GaussFit->GetChisquare();
TPhy.fTChi2_pip_TOF = hists->hparticle_mass_TOF_GaussFit_1->GetChisquare();
TPhy.fTChi2_pim_TOF = hists->hparticle_mass_TOF_GaussFit_2->GetChisquare();
}
}