diff --git a/analysis/detectors/tof/CbmTofAnaTestbeam.cxx b/analysis/detectors/tof/CbmTofAnaTestbeam.cxx index c8baf404171128aece0de0f7efa412c7d2a5a037..62d735478eb00306de71448c02b3a599e08105f9 100644 --- a/analysis/detectors/tof/CbmTofAnaTestbeam.cxx +++ b/analysis/detectors/tof/CbmTofAnaTestbeam.cxx @@ -5247,7 +5247,6 @@ Bool_t CbmTofAnaTestbeam::FillHistos() { } if (iM0 == iNbMatchedHits) { LOG(debug) << Form("no valid match in %d hits for Addr 0x%08x found ", - iNbMatchedHits, pHitRef->GetAddress()); if (fair::Logger::Logging(fair::Severity::debug1)) LOG(fatal) << "Check for consistency!"; return 0; @@ -7937,7 +7936,7 @@ Bool_t CbmTofAnaTestbeam::WriteHistos() { TDirectory* oldDir = gDirectory; // Write histogramms to the file - TFile* fHist = new TFile(fCalOutFileName, "RECREATE"); + TFile* fHist = new TFile(fCalOutFileName, "RECREATE"); fHist->cd(); switch (fiCorMode) { @@ -8171,7 +8170,7 @@ Bool_t CbmTofAnaTestbeam::WriteHistos() { if (hResidualT->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hResidualT->GetRMS()); /* - TFitResultPtr tFitResult = hResidualT->Fit("gaus", "QS"); + TFitResultPtr tFitResult = hResidualT->Fit("gaus", "SQM"); dRMS = tFitResult->Parameter(2); */ fhSelTypeNNResidualT_Width->SetBinContent(iSelType + 1, dRMS); @@ -8180,7 +8179,7 @@ Bool_t CbmTofAnaTestbeam::WriteHistos() { if (hResidualX->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hResidualX->GetRMS()); /* - TFitResultPtr tFitResult = hResidualX->Fit("gaus", "QS"); + TFitResultPtr tFitResult = hResidualX->Fit("gaus", "SQM"); dRMS = tFitResult->Parameter(2); */ fhSelTypeNNResidualX_Width->SetBinContent(iSelType + 1, dRMS); @@ -8189,7 +8188,7 @@ Bool_t CbmTofAnaTestbeam::WriteHistos() { if (hResidualY->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hResidualY->GetRMS()); /* - TFitResultPtr tFitResult = hResidualY->Fit("gaus", "QS"); + TFitResultPtr tFitResult = hResidualY->Fit("gaus", "SQM"); dRMS = tFitResult->Parameter(2); */ fhSelTypeNNResidualY_Width->SetBinContent(iSelType + 1, dRMS); diff --git a/reco/detectors/tof/CbmTofCalibrator.cxx b/reco/detectors/tof/CbmTofCalibrator.cxx index af6b73a4b45264fe877cc97631f725dc14502bbf..f99d8dd4f574ac448b29024eb6e64ea5bfbb8b92 100644 --- a/reco/detectors/tof/CbmTofCalibrator.cxx +++ b/reco/detectors/tof/CbmTofCalibrator.cxx @@ -414,7 +414,7 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) Double_t dFLim = 0.5; // CAUTION, fixed numeric value Double_t dBinSize = hBy->GetBinWidth(1); dFLim = TMath::Max(dFLim, 5. * dBinSize); - TFitResultPtr fRes = hBy->Fit("gaus", "SQM0", "", dFMean - dFLim, dFMean + dFLim); + TFitResultPtr fRes = hBy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); dBeamTOff = fRes->Parameter(1); //overwrite mean LOG(info) << "Found beam counter with average TOff = " << dBeamTOff; } diff --git a/reco/detectors/tof/CbmTofEventClusterizer.cxx b/reco/detectors/tof/CbmTofEventClusterizer.cxx index 86ee64dfaaeae73e279256e9ebde694cfbb1efe1..6a15a572aee59229497d8eeaa7f1f36d649f571b 100644 --- a/reco/detectors/tof/CbmTofEventClusterizer.cxx +++ b/reco/detectors/tof/CbmTofEventClusterizer.cxx @@ -3211,15 +3211,10 @@ Bool_t CbmTofEventClusterizer::WriteHistos() if ((fCalSmAddr < 0) || (fCalSmAddr != iSmAddr)) { // select detectors for updating offsets LOG(info) << "WriteHistos (calMode==3): update Offsets and Gains, " "keep Walk and DelTof for " - << Form("Addr 0x%08x ", TMath::Abs(fCalSmAddr)) << "Smtype" << iSmType << ", Sm " << iSm - << ", Rpc " << iRpc << " with " << iNbCh << " channels " + << Form("Addr 0x%08x ", TMath::Abs(fCalSmAddr)) << "TSR " << iSmType << iSm << iRpc << " with " + << iNbCh << " channels " << " using selector " << fCalSel; - /* - Double_t dTRefMean=0.; - if (5 == iSmType && fTRefMode%10 == iSm){ // reference counter - dTRefMean=htempTOff->GetMean(2); - } - */ + Double_t dVscal = 1.; Double_t dVW = 1.; if (0) // NULL != fhSmCluSvel[iSmType]) @@ -3283,8 +3278,8 @@ Bool_t CbmTofEventClusterizer::WriteHistos() } } Double_t dYShift = dYMeanFit - dYMeanAv; - LOG(info) << Form("CalibY for TSR %d%d%d: DY %5.2f, Fit %5.2f, Av %5.2f ", iSmType, iSm, iRpc, dYShift, - dYMeanFit, dYMeanAv); + LOG(debug) << Form("CalibY for TSR %d%d%d: DY %5.2f, Fit %5.2f, Av %5.2f ", iSmType, iSm, iRpc, dYShift, + dYMeanFit, dYMeanAv); for (Int_t iCh = 0; iCh < iNbCh; iCh++) // update Offset and Gain { Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1); //set default @@ -3371,6 +3366,7 @@ Bool_t CbmTofEventClusterizer::WriteHistos() Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (fiBeamRefAddr == iUniqueId) { + if (iFindT0 == 1) continue; // action already done // don't shift time of reference counter on average if (iCh == 0) { Double_t dW = 0.; @@ -3386,9 +3382,9 @@ Bool_t CbmTofEventClusterizer::WriteHistos() Double_t dBinSize = hTy->GetBinWidth(1); dFLim = TMath::Max(dFLim, 5. * dBinSize); TFitResultPtr fRes = hTy->Fit("gaus", "SQM0", "", dFMean - dFLim, dFMean + dFLim); - LOG(info) << "CalibC " - << Form(" TSRC %d%d%d%d gaus %8.2f %8.2f %8.2f ", iSmType, iSm, iRpc, iRefCh, - fRes->Parameter(0), fRes->Parameter(1), fRes->Parameter(2)); + LOG(debug) << "CalibC " + << Form(" TSRC %d%d%d%d gaus %8.2f %8.2f %8.2f ", iSmType, iSm, iRpc, iRefCh, + fRes->Parameter(0), fRes->Parameter(1), fRes->Parameter(2)); TBeamRefMean += fRes->Parameter(1) * dWCh; //overwrite mean } else { @@ -3407,13 +3403,13 @@ Bool_t CbmTofEventClusterizer::WriteHistos() TBeamRefMean = 0.; } if (htempTOff_px->GetBinContent(iCh + 1) > 0.) - LOG(info) << Form("CalibA %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, TM %8.3f , " - "TAV %8.3f, TWM %8.3f, TOff %8.3f, TOffnew %8.3f, ", - fCalMode, fCalSel, fTRefMode, iSmType, iSm, iRpc, iCh, - htempTOff_px->GetBinContent(iCh + 1), TMean, - ((TProfile*) hAvTOff_pfx)->GetBinContent(iSm * iNbRpc + iRpc + 1), TBeamRefMean, - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + TMean - TBeamRefMean); + LOG(debug) << Form("CalibA %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, TM %8.3f , " + "TAV %8.3f, TWM %8.3f, TOff %8.3f, TOffnew %8.3f, ", + fCalMode, fCalSel, fTRefMode, iSmType, iSm, iRpc, iCh, + htempTOff_px->GetBinContent(iCh + 1), TMean, + ((TProfile*) hAvTOff_pfx)->GetBinContent(iSm * iNbRpc + iRpc + 1), TBeamRefMean, + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + TMean - TBeamRefMean); // TMean-=((TProfile *)hAvTOff_pfx)->GetBinContent(iSm*iNbRpc+iRpc+1); TMean -= TBeamRefMean; } // beam counter end @@ -3426,12 +3422,12 @@ Bool_t CbmTofEventClusterizer::WriteHistos() fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean; //if(iSmType==0 && iSm==4 && iRpc==2 && iCh==26) - LOG(info) << Form("CalibB %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, YM %6.3f" - ", dTY %6.3f, TM %8.3f, Off %8.3f,%8.3f -> %8.3f,%8.3f ", - fCalMode, fCalSel, fTRefMode, iSmType, iSm, iRpc, iCh, - htempTOff_px->GetBinContent(iCh + 1), YMean, dTYOff, TMean, dOff0, dOff1, - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + LOG(debug) << Form("CalibB %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, YM %6.3f" + ", dTY %6.3f, TM %8.3f, Off %8.3f,%8.3f -> %8.3f,%8.3f ", + fCalMode, fCalSel, fTRefMode, iSmType, iSm, iRpc, iCh, + htempTOff_px->GetBinContent(iCh + 1), YMean, dTYOff, TMean, dOff0, dOff1, + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); } /* Double_t TotMean=((TProfile *)htempTot_pfx)->GetBinContent(iCh+1); diff --git a/reco/detectors/tof/CbmTofFindTracks.cxx b/reco/detectors/tof/CbmTofFindTracks.cxx index 566f1e5fe64db8ec218767931eca8e0bbaad2b04..de064e29e89e00379c7e9572ee27116b6a8de732 100644 --- a/reco/detectors/tof/CbmTofFindTracks.cxx +++ b/reco/detectors/tof/CbmTofFindTracks.cxx @@ -62,17 +62,15 @@ ClassImp(CbmTofFindTracks); CbmTofFindTracks* CbmTofFindTracks::fInstance = 0; // ----- Default constructor ------------------------------------------- -CbmTofFindTracks::CbmTofFindTracks() - : CbmTofFindTracks::CbmTofFindTracks("TofFindTracks", "Main", NULL) { +CbmTofFindTracks::CbmTofFindTracks() : CbmTofFindTracks::CbmTofFindTracks("TofFindTracks", "Main", NULL) +{ if (!fInstance) fInstance = this; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ -CbmTofFindTracks::CbmTofFindTracks(const char* name, - const char* /*title*/, - CbmTofTrackFinder* finder) +CbmTofFindTracks::CbmTofFindTracks(const char* name, const char* /*title*/, CbmTofTrackFinder* finder) : FairTask(name) , fFinder(finder) , fFitter(NULL) @@ -193,14 +191,16 @@ CbmTofFindTracks::CbmTofFindTracks(const char* name, , fdBeamMomentumLab(0.) , fbRemoveSignalPropagationTime(kFALSE) , fiBeamMaxHMul(1000) - , fiCalOpt(0) { + , fiCalOpt(0) +{ if (!fInstance) fInstance = this; } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- -CbmTofFindTracks::~CbmTofFindTracks() { +CbmTofFindTracks::~CbmTofFindTracks() +{ if (fInstance == this) fInstance = 0; fTrackArray->Delete(); } @@ -208,7 +208,8 @@ CbmTofFindTracks::~CbmTofFindTracks() { // ----- Public method Init (abstract in base class) -------------------- -InitStatus CbmTofFindTracks::Init() { +InitStatus CbmTofFindTracks::Init() +{ // Check for Track finder if (!fFinder) { @@ -221,8 +222,7 @@ InitStatus CbmTofFindTracks::Init() { cout << "-W- CbmTofFindTracks::Init: No track fitter selected!" << endl; return kERROR; } - cout << Form("-D- CbmTofFindTracks::Init: track fitter at 0x%p", fFitter) - << endl; + cout << Form("-D- CbmTofFindTracks::Init: track fitter at 0x%p", fFitter) << endl; fTrackletTools = new CbmTofTrackletTools(); // initialize tools @@ -237,11 +237,9 @@ InitStatus CbmTofFindTracks::Init() { ioman->InitSink(); fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("Event")); - if (!fEventsColl) - fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); - if (!fEventsColl) { - LOG(info) << "CbmEvent not found in input file, assume eventwise input"; - } else { + if (!fEventsColl) fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); + if (!fEventsColl) { LOG(info) << "CbmEvent not found in input file, assume eventwise input"; } + else { fTofHitArray = new TClonesArray("CbmTofHit"); } @@ -269,7 +267,8 @@ InitStatus CbmTofFindTracks::Init() { fTofHitArrayOut = new TClonesArray("CbmTofHit", 100); ioman->Register("TofTracks", "TOF", fTrackArrayOut, kTRUE); ioman->Register("TofCalHit", "TOF", fTofHitArrayOut, kTRUE); - } else { + } + else { ioman->Register("TofTracks", "TOF", fTrackArray, kTRUE); cout << "-I- CbmTofFindTracks::Init:TofTrack array registered" << endl; @@ -282,8 +281,7 @@ InitStatus CbmTofFindTracks::Init() { fFinder->Init(); if (fOutHstFileName == "") { fOutHstFileName = "./FindTofTracks.hst.root"; } - LOG(info) << "CbmTofFindTracks::Init: Hst Output filename = " - << fOutHstFileName; + LOG(info) << "CbmTofFindTracks::Init: Hst Output filename = " << fOutHstFileName; if (kFALSE == InitParameters()) return kFATAL; @@ -300,16 +298,11 @@ InitStatus CbmTofFindTracks::Init() { if (0 == iCh) { LOG(info) << Form("Init found RpcInd %d, %lu at Addr 0x%08x, ModType %d, " "ModId %d, RpcId %d ", - iRpc, - fRpcAddr.size(), - iCellId, - fTofId->GetSMType(iCellId), - fTofId->GetSModule(iCellId), + iRpc, fRpcAddr.size(), iCellId, fTofId->GetSMType(iCellId), fTofId->GetSModule(iCellId), fTofId->GetCounter(iCellId)); if (fTofId->GetSMType(iCellId) == 5) { bBeamCounter = kTRUE; - LOG(info) << "Found beam counter in setup! at RpcInd " << iRpc - << ", Addr.size " << fRpcAddr.size(); + LOG(info) << "Found beam counter in setup! at RpcInd " << iRpc << ", Addr.size " << fRpcAddr.size(); } fMapRpcIdParInd[iCellId] = iRpc; fRpcAddr.push_back(iCellId); @@ -333,14 +326,14 @@ InitStatus CbmTofFindTracks::Init() { } } - LOG(info) << Form("BeamCounter to be used in tracking: 0x%08x", - fiBeamCounter); + LOG(info) << Form("BeamCounter to be used in tracking: 0x%08x", fiBeamCounter); return kSUCCESS; } // ------------------------------------------------------------------------- /************************************************************************************/ -Bool_t CbmTofFindTracks::LoadCalParameter() { +Bool_t CbmTofFindTracks::LoadCalParameter() +{ UInt_t NSt = fMapRpcIdParInd.size(); fvToff.resize(NSt); for (uint i = 0; i < NSt; i++) @@ -381,67 +374,51 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { TH1D* fhtmpWZ = (TH1D*) gDirectory->FindObjectAny(Form("hPullZ_Smt_Width")); gROOT->cd(); - if (NULL == fhtmp) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Off") - << " not found. "; - } else { + if (NULL == fhtmp) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Off") << " not found. "; } + else { fhPullT_Smt_Off = (TH1D*) fhtmp->Clone(); for (UInt_t iSt = 0; iSt < NSt; iSt++) fvToff[iSt] = fhPullT_Smt_Off->GetBinContent(iSt + 1); } - if (NULL == fhtmpX) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Off") - << " not found. "; - } else { + if (NULL == fhtmpX) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Off") << " not found. "; } + else { fhPullX_Smt_Off = (TH1D*) fhtmpX->Clone(); for (UInt_t iSt = 0; iSt < NSt; iSt++) fvXoff[iSt] = fhPullX_Smt_Off->GetBinContent(iSt + 1); } - if (NULL == fhtmpY) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Off") - << " not found. "; - } else { + if (NULL == fhtmpY) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Off") << " not found. "; } + else { fhPullY_Smt_Off = (TH1D*) fhtmpY->Clone(); for (UInt_t iSt = 0; iSt < NSt; iSt++) fvYoff[iSt] = fhPullY_Smt_Off->GetBinContent(iSt + 1); } - if (NULL == fhtmpZ) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Off") - << " not found. "; - } else { + if (NULL == fhtmpZ) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Off") << " not found. "; } + else { fhPullZ_Smt_Off = (TH1D*) fhtmpZ->Clone(); for (UInt_t iSt = 0; iSt < NSt; iSt++) fvZoff[iSt] = fhPullZ_Smt_Off->GetBinContent(iSt + 1); } - if (NULL == fhtmpW) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Width") - << " not found. "; - } else { + if (NULL == fhtmpW) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Width") << " not found. "; } + else { if (fbUseSigCalib) fhPullT_Smt_Width = (TH1D*) fhtmpW->Clone(); } - if (NULL == fhtmpWX) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Width") - << " not found. "; - } else { + if (NULL == fhtmpWX) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Width") << " not found. "; } + else { if (fbUseSigCalib) fhPullX_Smt_Width = (TH1D*) fhtmpWX->Clone(); } - if (NULL == fhtmpWY) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Width") - << " not found. "; - } else { + if (NULL == fhtmpWY) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Width") << " not found. "; } + else { if (fbUseSigCalib) fhPullY_Smt_Width = (TH1D*) fhtmpWY->Clone(); } - if (NULL == fhtmpWZ) { - LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Width") - << " not found. "; - } else { + if (NULL == fhtmpWZ) { LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Width") << " not found. "; } + else { if (fbUseSigCalib) fhPullZ_Smt_Width = (TH1D*) fhtmpWZ->Clone(); } @@ -451,11 +428,7 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { if (NULL == fhPullT_Smt_Off) { // provide default TOffset histogram fhPullT_Smt_Off = - new TH1F(Form("hPullT_Smt_Off"), - Form("Tracklet PullT vs RpcInd ; RpcInd ; #DeltaT (ns)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullT_Smt_Off"), Form("Tracklet PullT vs RpcInd ; RpcInd ; #DeltaT (ns)"), nSmt, 0, nSmt); // Initialize Parameter if (fiCorMode == 3) // hidden option, FIXME @@ -465,35 +438,22 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { for (it = fMapRpcIdParInd.begin(); it != fMapRpcIdParInd.end(); it++) { if (it->second == iDet) break; } - LOG(debug1) << Form(" iDet %d -> iUniqueId ? 0x%08x, 0x%08x ", - iDet, - it->first, - it->second); + LOG(debug1) << Form(" iDet %d -> iUniqueId ? 0x%08x, 0x%08x ", iDet, it->first, it->second); Int_t iUniqueId = it->first; CbmTofCell* fChannelInfo = fDigiPar->GetCell(iUniqueId); if (NULL != fChannelInfo) { - Double_t dVal = - 0.; // FIXME numeric constant in code, default for cosmic - if (fiBeamCounter != iUniqueId) - dVal = - fChannelInfo->GetZ() * fTtTarg; // use calibration target value + Double_t dVal = 0.; // FIXME numeric constant in code, default for cosmic + if (fiBeamCounter != iUniqueId) dVal = fChannelInfo->GetZ() * fTtTarg; // use calibration target value fhPullT_Smt_Off->SetBinContent(iDet + 1, dVal); - LOG(info) << Form("Initialize det 0x%08x at %d, z=%f with TOff %6.2f", - iUniqueId, - iDet + 1, - fChannelInfo->GetZ(), - dVal); + LOG(info) << Form("Initialize det 0x%08x at %d, z=%f with TOff %6.2f", iUniqueId, iDet + 1, + fChannelInfo->GetZ(), dVal); } } } if (NULL == fhPullT_Smt_Width) { // provide default TWidth histogram fhPullT_Smt_Width = - new TH1F(Form("hPullT_Smt_Width"), - Form("Tracklet ResiT Width vs RpcInd ; RpcInd ; RMS(T) (ns)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullT_Smt_Width"), Form("Tracklet ResiT Width vs RpcInd ; RpcInd ; RMS(T) (ns)"), nSmt, 0, nSmt); // Initialize Parameter for (Int_t iDet = 0; iDet < nSmt; iDet++) { @@ -501,23 +461,14 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { } } - LOG(info) << "CbmTofFindTracks::LoadCalParameter: fhPullT_Smt_Off at " - << fhPullT_Smt_Off; + LOG(info) << "CbmTofFindTracks::LoadCalParameter: fhPullT_Smt_Off at " << fhPullT_Smt_Off; if (NULL == fhPullX_Smt_Off) // provide default XOffset histogram fhPullX_Smt_Off = - new TH1F(Form("hPullX_Smt_Off"), - Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullX_Smt_Off"), Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"), nSmt, 0, nSmt); if (NULL == fhPullX_Smt_Width) { fhPullX_Smt_Width = - new TH1F(Form("hPullX_Smt_Width"), - Form("Tracklet ResiX Width vs RpcInd ; RpcInd ; RMS(X) (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullX_Smt_Width"), Form("Tracklet ResiX Width vs RpcInd ; RpcInd ; RMS(X) (cm)"), nSmt, 0, nSmt); // Initialize Parameter for (Int_t iDet = 0; iDet < nSmt; iDet++) { fhPullX_Smt_Width->SetBinContent(iDet + 1, fSIGX); @@ -526,18 +477,10 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { if (NULL == fhPullY_Smt_Off) // provide default YOffset histogram fhPullY_Smt_Off = - new TH1F(Form("hPullY_Smt_Off"), - Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullY_Smt_Off"), Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"), nSmt, 0, nSmt); if (NULL == fhPullY_Smt_Width) { fhPullY_Smt_Width = - new TH1F(Form("hPullY_Smt_Width"), - Form("Tracklet ResiY Width vs RpcInd ; RpcInd ; RMS(Y) (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullY_Smt_Width"), Form("Tracklet ResiY Width vs RpcInd ; RpcInd ; RMS(Y) (cm)"), nSmt, 0, nSmt); // Initialize Parameter for (Int_t iDet = 0; iDet < nSmt; iDet++) { fhPullY_Smt_Width->SetBinContent(iDet + 1, fSIGY); @@ -546,18 +489,10 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { if (NULL == fhPullZ_Smt_Off) // provide default TOffset histogram fhPullZ_Smt_Off = - new TH1F(Form("hPullZ_Smt_Off"), - Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullZ_Smt_Off"), Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"), nSmt, 0, nSmt); if (NULL == fhPullZ_Smt_Width) { fhPullZ_Smt_Width = - new TH1F(Form("hPullZ_Smt_Width"), - Form("Tracklet ResiZ Width vs RpcInd ; RpcInd ; RMS(Z) (cm)"), - nSmt, - 0, - nSmt); + new TH1F(Form("hPullZ_Smt_Width"), Form("Tracklet ResiZ Width vs RpcInd ; RpcInd ; RMS(Z) (cm)"), nSmt, 0, nSmt); // Initialize Parameter for (Int_t iDet = 0; iDet < nSmt; iDet++) { fhPullZ_Smt_Width->SetBinContent(iDet + 1, fSIGZ); @@ -571,7 +506,8 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { return kTRUE; } //------------------------------------------------------------------------------------------------- -Bool_t CbmTofFindTracks::InitParameters() { +Bool_t CbmTofFindTracks::InitParameters() +{ // Initialize the TOF GeoHandler Bool_t isSimulation = kFALSE; Int_t iGeoVersion = fGeoHandler->Init(isSimulation); @@ -587,21 +523,19 @@ Bool_t CbmTofFindTracks::InitParameters() { case k12b: fTofId = new CbmTofDetectorId_v12b(); break; case k14a: fTofId = new CbmTofDetectorId_v14a(); break; case k21a: fTofId = new CbmTofDetectorId_v21a(); break; - default: - LOG(fatal) << "CbmTofFindTracks::InitParameters: Invalid Detector ID " - << iGeoVersion; + default: LOG(fatal) << "CbmTofFindTracks::InitParameters: Invalid Detector ID " << iGeoVersion; } // create digitization parameters from geometry file - CbmTofCreateDigiPar* tofDigiPar = - new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); + CbmTofCreateDigiPar* tofDigiPar = new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); LOG(info) << "Create DigiPar "; tofDigiPar->Init(); return kTRUE; } // ----- SetParContainers ------------------------------------------------- -void CbmTofFindTracks::SetParContainers() { +void CbmTofFindTracks::SetParContainers() +{ FairRunAna* ana = FairRunAna::Instance(); FairRuntimeDb* rtdb = ana->GetRuntimeDb(); // rtdb->getContainer("CbmGeoPassivePar"); @@ -615,25 +549,23 @@ void CbmTofFindTracks::SetParContainers() { // rtdb->getContainer("CbmFieldPar"); fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar")); - LOG(info) << " CbmTofFindTracks::SetParContainers found " - << fDigiPar->GetNrOfModules() << " cells "; + LOG(info) << " CbmTofFindTracks::SetParContainers found " << fDigiPar->GetNrOfModules() << " cells "; fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar")); } // ------------------------------------------------------------------------- -Bool_t CbmTofFindTracks::WriteHistos() { +Bool_t CbmTofFindTracks::WriteHistos() +{ if (fiCorMode < 0) return kTRUE; - LOG(info) << Form("CbmTofFindTracks::WriteHistos: %s, mode = %d", - fCalOutFileName.Data(), - fiCorMode); + LOG(info) << Form("CbmTofFindTracks::WriteHistos: %s, mode = %d", fCalOutFileName.Data(), fiCorMode); // Write histogramms to the file /// Save old global file and folder pointer to avoid messing with FairRoot TFile* oldFile = gFile; TDirectory* oldDir = gDirectory; - TFile* fHist = new TFile(fCalOutFileName, "RECREATE"); + TFile* fHist = new TFile(fCalOutFileName, "RECREATE"); fHist->cd(); const Double_t RMSmin = 0.03; // in ns @@ -647,30 +579,24 @@ Bool_t CbmTofFindTracks::WriteHistos() { Double_t nx = htmp1D->GetNbinsX(); for (Int_t ix = 1; ix < nx; ix++) { Double_t dVal = 0; - if (fhPullT_Smt_Off != NULL) { - dVal = fhPullT_Smt_Off->GetBinContent(ix + 1); - } else { + if (fhPullT_Smt_Off != NULL) { dVal = fhPullT_Smt_Off->GetBinContent(ix + 1); } + else { fhPullT_Smt_Off = htmp1D; } - TH1D* hTOff1DY = - fhTOff_HMul2->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, ""); + TH1D* hTOff1DY = fhTOff_HMul2->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; if (hTOff1DY->GetEntries() > 100) { //Double_t dMean=hTOff1DY->GetMean(); - Int_t iBmax = hTOff1DY->GetMaximumBin(); - TAxis* xaxis = hTOff1DY->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content - Double_t dLim = 1000.; //1.5*hTOff1DY->GetRMS(); - TFitResultPtr fRes = - hTOff1DY->Fit("gaus", "S", "", dMean - dLim, dMean + dLim); - dFMean = fRes->Parameter(1); + Int_t iBmax = hTOff1DY->GetMaximumBin(); + TAxis* xaxis = hTOff1DY->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Double_t dLim = 1000.; //1.5*hTOff1DY->GetRMS(); + TFitResultPtr fRes = hTOff1DY->Fit("gaus", "S", "", dMean - dLim, dMean + dLim); + dFMean = fRes->Parameter(1); } dVal -= dFMean; - LOG(info) << "Init TOff " << ix << ": Old " - << fhPullT_Smt_Off->GetBinContent(ix + 1) << ", Cnts " - << hTOff1D->GetBinContent(ix + 1) << ", FitMean " << dFMean - << " -> " << dVal; + LOG(info) << "Init TOff " << ix << ": Old " << fhPullT_Smt_Off->GetBinContent(ix + 1) << ", Cnts " + << hTOff1D->GetBinContent(ix + 1) << ", FitMean " << dFMean << " -> " << dVal; fhPullT_Smt_Off->SetBinContent(ix + 1, dVal); } } @@ -690,15 +616,13 @@ Bool_t CbmTofFindTracks::WriteHistos() { Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1); dVal -= htmp1D->GetBinContent(ix + 1); - LOG(debug1) << "Update hPullT_Smt_Off " << ix << ": " - << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + " - << htmp1D->GetBinContent(ix + 1) << " + " - << hTOff1D->GetBinContent(ix + 1) << " -> " << dVal; + LOG(debug1) << "Update hPullT_Smt_Off " << ix << ": " << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + " + << htmp1D->GetBinContent(ix + 1) << " + " << hTOff1D->GetBinContent(ix + 1) << " -> " << dVal; fhPullT_Smt_Off->SetBinContent(ix + 1, dVal); } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; } } @@ -716,39 +640,33 @@ Bool_t CbmTofFindTracks::WriteHistos() { for (Int_t ix = 0; ix < nx; ix++) { Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1); dVal -= hTOff1D->GetBinContent(ix + 1); - TH1D* hTOff1DY = - fhTOff_Smt->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, ""); + TH1D* hTOff1DY = fhTOff_Smt->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; if (hTOff1DY->GetEntries() > 100) { //Double_t dMean=hTOff1DY->GetMean(); - Int_t iBmax = hTOff1DY->GetMaximumBin(); - TAxis* xaxis = hTOff1DY->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content - Double_t dLim = 1.5 * hTOff1DY->GetRMS(); - TFitResultPtr fRes = - hTOff1DY->Fit("gaus", "S", "", dMean - dLim, dMean + dLim); - Int_t iFitStatus = fRes; + Int_t iBmax = hTOff1DY->GetMaximumBin(); + TAxis* xaxis = hTOff1DY->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Double_t dLim = 1.5 * hTOff1DY->GetRMS(); + TFitResultPtr fRes = hTOff1DY->Fit("gaus", "SQM", "", dMean - dLim, dMean + dLim); + Int_t iFitStatus = fRes; if (iFitStatus == 0) { // check validity of fit dFMean = fRes->Parameter(1); - dVal += - hTOff1D->GetBinContent(ix + 1); //revert default correction + dVal += hTOff1D->GetBinContent(ix + 1); //revert default correction dVal -= dFMean; } - LOG(info) << "Update hPullT_Smt_Off Ind " << ix << ": Old " - << fhPullT_Smt_Off->GetBinContent(ix + 1) << ", Pull " - << htmp1D->GetBinContent(ix + 1) << ", Dev@Peak " - << hTOff1D->GetBinContent(ix + 1) << ", FitMean " - << dFMean << " -> " << dVal; - } else { - LOG(debug1) << "Update hPullT_Smt_Off " << ix - << ": insufficient counts: " << hTOff1DY->GetEntries(); + LOG(info) << "Update hPullT_Smt_Off Ind " << ix << ": Old " << fhPullT_Smt_Off->GetBinContent(ix + 1) + << ", Pull " << htmp1D->GetBinContent(ix + 1) << ", Dev@Peak " << hTOff1D->GetBinContent(ix + 1) + << ", FitMean " << dFMean << " -> " << dVal; + } + else { + LOG(debug1) << "Update hPullT_Smt_Off " << ix << ": insufficient counts: " << hTOff1DY->GetEntries(); } fhPullT_Smt_Off->SetBinContent(ix + 1, dVal); } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; } } break; @@ -762,44 +680,38 @@ Bool_t CbmTofFindTracks::WriteHistos() { for (Int_t ix = 0; ix < nx; ix++) { TH1D* hpy = fhPullT_Smt->ProjectionY("_py", ix + 1, ix + 1); if (hpy->GetEntries() > 100.) { - Int_t iBmax = hpy->GetMaximumBin(); - TAxis* xaxis = hpy->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content - Double_t dRMS = TMath::Abs(hpy->GetRMS()); - Double_t dLim = 1.5 * dRMS; - TFitResultPtr fRes = - hpy->Fit("gaus", "S", "", dMean - dLim, dMean + dLim); - Double_t dFMean = fRes->Parameter(1); + Int_t iBmax = hpy->GetMaximumBin(); + TAxis* xaxis = hpy->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Double_t dRMS = TMath::Abs(hpy->GetRMS()); + Double_t dLim = 1.5 * dRMS; + TFitResultPtr fRes = hpy->Fit("gaus", "SQM", "", dMean - dLim, dMean + dLim); + Double_t dFMean = fRes->Parameter(1); Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1); dVal -= dFMean; TF1* fg = hpy->GetFunction("gaus"); Double_t dFMeanError = fg->GetParError(1); - LOG(info) << "Update hPullT_Smt_Off3 Ind " << ix - << Form(", 0x%08x: ", fRpcAddr[ix]) - << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + " - << dFMean << ", Err " << dFMeanError << " -> " << dVal - << ", Width " << dRMS << ", Chi2 " << fg->GetChisquare(); + LOG(info) << "Update hPullT_Smt_Off3 Ind " << ix << Form(", 0x%08x: ", fRpcAddr[ix]) + << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + " << dFMean << ", Err " << dFMeanError << " -> " + << dVal << ", Width " << dRMS << ", Chi2 " << fg->GetChisquare(); if (dFMeanError < 0.05) { // FIXME: hardwired constant if (dRMS < RMSmin) dRMS = RMSmin; if (dRMS > fSIGT * 3.0) dRMS = fSIGT * 3.; - if (fRpcAddr[ix] - != fiBeamCounter) // don't correct beam counter time + if (fRpcAddr[ix] != fiBeamCounter) // don't correct beam counter time fhPullT_Smt_Off->SetBinContent(ix + 1, dVal); else - LOG(info) << "No Off3 correction for beam counter at index " - << ix; + LOG(info) << "No Off3 correction for beam counter at index " << ix; fhPullT_Smt_Width->SetBinContent(ix + 1, dRMS); } - } else { - LOG(debug1) << "Update hPullT_Smt_Off " << ix - << ": insufficient counts: " << hpy->GetEntries(); + } + else { + LOG(debug1) << "Update hPullT_Smt_Off " << ix << ": insufficient counts: " << hpy->GetEntries(); } } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found "; } } @@ -818,16 +730,14 @@ Bool_t CbmTofFindTracks::WriteHistos() { //dVal -= htmp1D->GetBinContent(ix + 1); if (hpy->GetEntries() > 100.) { // Fit gaussian - Double_t dFMean = hpy->GetBinCenter(hpy->GetMaximumBin()); - Double_t dFLim = 0.5; // CAUTION, fixed numeric value - Double_t dBinSize = hpy->GetBinWidth(1); - dFLim = TMath::Max(dFLim, 5. * dBinSize); - TFitResultPtr fRes = - hpy->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); + Double_t dFMean = hpy->GetBinCenter(hpy->GetMaximumBin()); + Double_t dFLim = 0.5; // CAUTION, fixed numeric value + Double_t dBinSize = hpy->GetBinWidth(1); + dFLim = TMath::Max(dFLim, 5. * dBinSize); + TFitResultPtr fRes = hpy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); dVal -= fRes->Parameter(1); Double_t dRMS = fRes->Parameter(2); - LOG(debug) << "PeakFit at " << dFMean << ", lim " << dFLim - << " : mean " << fRes->Parameter(1) << ", width " + LOG(debug) << "PeakFit at " << dFMean << ", lim " << dFLim << " : mean " << fRes->Parameter(1) << ", width " << dRMS; dRMS = TMath::Abs(hpy->GetRMS()); @@ -837,19 +747,16 @@ Bool_t CbmTofFindTracks::WriteHistos() { // limit maximal shift in X, for larger values, change geometry file if (dVal < -3.) dVal = -3.; if (dVal > 3.) dVal = 3.; - LOG(info) << "Update hPullX_Smt_Off " << ix << ": " - << fhPullX_Smt_Off->GetBinContent(ix + 1) << " + " - << htmp1D->GetBinContent(ix + 1) << " -> " << dVal - << ", Width " << dRMS; - if (fRpcAddr[ix] - != fiBeamCounter) // don't correct beam counter position + LOG(info) << "Update hPullX_Smt_Off " << ix << ": " << fhPullX_Smt_Off->GetBinContent(ix + 1) << " + " + << htmp1D->GetBinContent(ix + 1) << " -> " << dVal << ", Width " << dRMS; + if (fRpcAddr[ix] != fiBeamCounter) // don't correct beam counter position fhPullX_Smt_Off->SetBinContent(ix + 1, dVal); fhPullX_Smt_Width->SetBinContent(ix + 1, dRMS); } } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullX_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullX_Smt_Off not found "; } } @@ -868,19 +775,16 @@ Bool_t CbmTofFindTracks::WriteHistos() { // Fit gaussian TH1D* hpy = fhPullY_Smt->ProjectionY("_py", ix + 1, ix + 1); if (hpy->GetEntries() > 100.) { - Double_t dFMean = hpy->GetBinCenter(hpy->GetMaximumBin()); - Double_t dFLim = 2.; // CAUTION, fixed numeric value - Double_t dBinSize = hpy->GetBinWidth(1); - dFLim = TMath::Max(dFLim, 5. * dBinSize); - TFitResultPtr fRes = - hpy->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); + Double_t dFMean = hpy->GetBinCenter(hpy->GetMaximumBin()); + Double_t dFLim = 2.; // CAUTION, fixed numeric value + Double_t dBinSize = hpy->GetBinWidth(1); + dFLim = TMath::Max(dFLim, 5. * dBinSize); + TFitResultPtr fRes = hpy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); dVal -= fRes->Parameter(1); Double_t dRMS = fRes->Parameter(2); - LOG(debug) << "PeakFit at " << dFMean << ", lim " << dFLim - << " : mean " << fRes->Parameter(1) << ", width " + LOG(debug) << "PeakFit at " << dFMean << ", lim " << dFLim << " : mean " << fRes->Parameter(1) << ", width " << dRMS; - if (fRpcAddr[ix] - != fiBeamCounter) // don't correct beam counter position + if (fRpcAddr[ix] != fiBeamCounter) // don't correct beam counter position fhPullY_Smt_Off->SetBinContent(ix + 1, dVal); dRMS = TMath::Abs(hpy->GetRMS()); @@ -888,15 +792,13 @@ Bool_t CbmTofFindTracks::WriteHistos() { if (dRMS > fSIGY * 3.0) dRMS = fSIGY * 3.; fhPullY_Smt_Width->SetBinContent(ix + 1, dRMS); - LOG(debug1) << "Update hPullY_Smt_Off " << ix << ": " - << fhPullY_Smt_Off->GetBinContent(ix + 1) << " + " - << htmp1D->GetBinContent(ix + 1) << " -> " << dVal - << ", Width " << dRMS; + LOG(debug1) << "Update hPullY_Smt_Off " << ix << ": " << fhPullY_Smt_Off->GetBinContent(ix + 1) << " + " + << htmp1D->GetBinContent(ix + 1) << " -> " << dVal << ", Width " << dRMS; } } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullY_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullY_Smt_Off not found "; } } @@ -919,34 +821,26 @@ Bool_t CbmTofFindTracks::WriteHistos() { if (hpy->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hpy->GetRMS()); - LOG(debug1) << "Update hPullZ_Smt_Off " << ix << ": " - << fhPullZ_Smt_Off->GetBinContent(ix + 1) << " + " - << htmp1D->GetBinContent(ix + 1) << " -> " << dVal - << ", Width " << dRMS; + LOG(debug1) << "Update hPullZ_Smt_Off " << ix << ": " << fhPullZ_Smt_Off->GetBinContent(ix + 1) << " + " + << htmp1D->GetBinContent(ix + 1) << " -> " << dVal << ", Width " << dRMS; if (dRMS < 1.5) dRMS = 1.5; fhPullZ_Smt_Width->SetBinContent(ix + 1, dRMS); } } - } else { - LOG(warning) - << "CbmTofFindTracks::WriteHistos: fhPullZ_Smt_Off not found "; + } + else { + LOG(warning) << "CbmTofFindTracks::WriteHistos: fhPullZ_Smt_Off not found "; } } break; case 7: // extract residual widthes in T, X, Y, Z { - for (Int_t iStation = 0; - iStation < static_cast<Int_t>(fMapRpcIdParInd.size()); - iStation++) { - TH1D* hResidualT = - fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualX = - fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualY = - fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualZ = - fhPullZ_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + for (Int_t iStation = 0; iStation < static_cast<Int_t>(fMapRpcIdParInd.size()); iStation++) { + TH1D* hResidualT = fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualX = fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualY = fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualZ = fhPullZ_Smt->ProjectionY("_py", iStation + 1, iStation + 1); if (hResidualT->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hResidualT->GetRMS()); @@ -999,25 +893,24 @@ Bool_t CbmTofFindTracks::WriteHistos() { TString hname = Form("hPull%s_Station_%d", "TB", iSt); TH1* h1 = (TH1*) gROOT->FindObjectAny(hname); if (h1->GetEntries() > 100) { - Double_t dFMean = h1->GetMean(); - Double_t dFLim = 2.5 * h1->GetRMS(); - TFitResultPtr fRes = - h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); - Double_t dDOff = fRes->Parameter(1); - Double_t dSig = fRes->Parameter(2); - Int_t iRpcInd = fMapRpcIdParInd[fMapStationRpcId[iSt]]; - Double_t dVal = fhPullT_Smt_Off->GetBinContent(iRpcInd + 1); + Double_t dFMean = h1->GetMean(); + Double_t dFLim = 2.5 * h1->GetRMS(); + TFitResultPtr fRes = h1->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); + Double_t dDOff = fRes->Parameter(1); + Double_t dSig = fRes->Parameter(2); + Int_t iRpcInd = fMapRpcIdParInd[fMapStationRpcId[iSt]]; + Double_t dVal = fhPullT_Smt_Off->GetBinContent(iRpcInd + 1); dVal -= dDOff; - LOG(info) << "Update hPullT_Smt_OffP Ind " << iSt << ", Ind " << iRpcInd - << ": " << fhPullT_Smt_Off->GetBinContent(iRpcInd + 1) - << " - " << dDOff << " -> " << dVal << ", Width " << dSig; + LOG(info) << "Update hPullT_Smt_OffP Ind " << iSt << ", Ind " << iRpcInd << ": " + << fhPullT_Smt_Off->GetBinContent(iRpcInd + 1) << " - " << dDOff << " -> " << dVal << ", Width " + << dSig; fhPullT_Smt_Off->SetBinContent(iRpcInd + 1, dVal); if (dSig < fSIGT * 0.5) dSig = 0.5 * fSIGT; if (dSig > fSIGT * 3.0) dSig = fSIGT * 3.; fhPullT_Smt_Width->SetBinContent(iRpcInd + 1, dSig); - } else { - LOG(info) << "CbmTofFindTracks::WriteHistos: Too few entries in histo " - << hname; + } + else { + LOG(info) << "CbmTofFindTracks::WriteHistos: Too few entries in histo " << hname; } } break; @@ -1026,17 +919,11 @@ Bool_t CbmTofFindTracks::WriteHistos() { if (NULL != fhPullT_Smt_Off) { // always extract residual widthes in T, X, Y, Z - for (Int_t iStation = 0; - iStation < static_cast<Int_t>(fMapRpcIdParInd.size()); - iStation++) { - TH1D* hResidualT = - fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualX = - fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualY = - fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1); - TH1D* hResidualZ = - fhPullZ_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + for (Int_t iStation = 0; iStation < static_cast<Int_t>(fMapRpcIdParInd.size()); iStation++) { + TH1D* hResidualT = fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualX = fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualY = fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1); + TH1D* hResidualZ = fhPullZ_Smt->ProjectionY("_py", iStation + 1, iStation + 1); if (hResidualT->GetEntries() > 100.) { Double_t dRMS = TMath::Abs(hResidualT->GetRMS()); if (dRMS < RMSmin) dRMS = RMSmin; @@ -1083,31 +970,29 @@ Bool_t CbmTofFindTracks::WriteHistos() { // ----- Public method Exec -------------------------------------------- -void CbmTofFindTracks::Exec(Option_t* opt) { +void CbmTofFindTracks::Exec(Option_t* opt) +{ if (fair::Logger::Logging(fair::Severity::debug)) { fDigiBdfPar->printParams(); } if (!fEventsColl) { // fTofHitArray = (TClonesArray*)fTofHitArrayIn->Clone(); fTofHitArray = (TClonesArray*) fTofHitArrayIn; ExecFind(opt); - } else { + } + else { Int_t iNbTrks = 0; Int_t iNbCalHits = 0; fTrackArrayOut->Delete(); //Clear("C"); fTofHitArrayOut->Delete(); //Clear("C"); for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) { CbmEvent* tEvent = dynamic_cast<CbmEvent*>(fEventsColl->At(iEvent)); - LOG(debug) << "Process event " << iEvent << " with " - << tEvent->GetNofData(ECbmDataType::kTofHit) << " hits"; + LOG(debug) << "Process event " << iEvent << " with " << tEvent->GetNofData(ECbmDataType::kTofHit) << " hits"; if (fTofHitArray) fTofHitArray->Clear("C"); Int_t iNbHits = 0; fTofHitIndexArray.resize(tEvent->GetNofData(ECbmDataType::kTofHit)); - for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kTofHit); - iHit++) { - Int_t iHitIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofHit, iHit)); - CbmTofHit* tHit = - dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(iHitIndex)); + for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kTofHit); iHit++) { + Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofHit, iHit)); + CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(iHitIndex)); fTofHitIndexArray[iNbHits] = iHitIndex; new ((*fTofHitArray)[iNbHits++]) CbmTofHit(*tHit); } @@ -1119,11 +1004,9 @@ void CbmTofFindTracks::Exec(Option_t* opt) { CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk); new ((*fTrackArrayOut)[iNbTrks]) CbmTofTracklet(*pTrk); pTrk = (CbmTofTracklet*) fTrackArrayOut->At(iNbTrks); - for (Int_t iHit = 0; iHit < pTrk->GetNofHits(); - iHit++) //update to original index + for (Int_t iHit = 0; iHit < pTrk->GetNofHits(); iHit++) //update to original index { - pTrk->SetTofHitIndex(iHit, - fTofHitIndexArray[pTrk->GetTofHitIndex(iHit)]); + pTrk->SetTofHitIndex(iHit, fTofHitIndexArray[pTrk->GetTofHitIndex(iHit)]); } tEvent->AddData(ECbmDataType::kTofTrack, iNbTrks); iNbTrks++; @@ -1139,7 +1022,8 @@ void CbmTofFindTracks::Exec(Option_t* opt) { } } -void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { +void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) +{ fiEvent++; ResetStationsFired(); if (NULL != fTofUHitArray) fTofUHitArray->Clear("C"); @@ -1170,9 +1054,7 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { if (0. != fdBeamMomentumLab) { Double_t dTargetTimeOffset = pHit->GetZ() / fdBeamMomentumLab - * TMath::Sqrt(TMath::Power(fdBeamMomentumLab, 2.) - + TMath::Power(0.938271998, 2.)) - / TMath::Ccgs() * 1.0e09; + * TMath::Sqrt(TMath::Power(fdBeamMomentumLab, 2.) + TMath::Power(0.938271998, 2.)) / TMath::Ccgs() * 1.0e09; pHit->SetTime(pHit->GetTime() - dTargetTimeOffset); } @@ -1180,7 +1062,7 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { // TVector3 hitPos(pHit->GetX(), pHit->GetY(), 0.); // TVector3 hitPosErr(1.,1.,5.0); // including positioning uncertainty pHit->SetPosition(hitPos); - TVector3 hitPosErr0(1., 1., 1.); // including positioning uncertainty + TVector3 hitPosErr0(1., 1., 1.); // including positioning uncertainty pHit->SetPositionError(hitPosErr0); // } } @@ -1195,9 +1077,7 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { Double_t dSignalPropagationTime = 0.5 - * (fChannelInfo->GetSizey() >= fChannelInfo->GetSizex() - ? fChannelInfo->GetSizey() - : fChannelInfo->GetSizex()) + * (fChannelInfo->GetSizey() >= fChannelInfo->GetSizex() ? fChannelInfo->GetSizey() : fChannelInfo->GetSizex()) / fDigiBdfPar->GetSigVel(iModuleType, iModuleIndex, iCounterIndex); pHit->SetTime(pHit->GetTime() - dSignalPropagationTime); @@ -1205,8 +1085,7 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { // tune positions and times Double_t dTcor = 0.; - if ((iDetId & DetMask) - != fiBeamCounter) { // do not modify diamond position + if ((iDetId & DetMask) != fiBeamCounter) { // do not modify diamond position Int_t iRpcInd = fMapRpcIdParInd[iDetId]; pHit->SetTime(pHit->GetTime() + fvToff[iRpcInd]); pHit->SetX(pHit->GetX() + fvXoff[iRpcInd]); @@ -1238,31 +1117,18 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { LOG(debug) << Form("Exec found Hit %02d, addr 0x%08x, sta %02d, %02d, HM " "%02d, X %6.2f(%3.2f) Y " "%6.2f(%3.2f) Z %6.2f(%3.2f) T %6.2f(%3.2f) (%6.2f)", - iHit, - pHit->GetAddress(), - GetStationOfAddr(iDetId), - fDigiBdfPar->GetTrackingStation(pHit), - fStationHMul[GetStationOfAddr(iDetId)], - pHit->GetX(), - pHit->GetDx(), - pHit->GetY(), - pHit->GetDy(), - pHit->GetZ(), - pHit->GetDz(), - pHit->GetTime(), - pHit->GetTimeError(), - dTcor); + iHit, pHit->GetAddress(), GetStationOfAddr(iDetId), fDigiBdfPar->GetTrackingStation(pHit), + fStationHMul[GetStationOfAddr(iDetId)], pHit->GetX(), pHit->GetDx(), pHit->GetY(), pHit->GetDy(), + pHit->GetZ(), pHit->GetDz(), pHit->GetTime(), pHit->GetTimeError(), dTcor); } - LOG(debug) << Form( - "CbmTofFindTracks::Exec NStationsFired %d > %d Min ?, NbStations %d", - GetNStationsFired(), - GetMinNofHits(), - fDigiBdfPar->GetNbTrackingStations()); + LOG(debug) << Form("CbmTofFindTracks::Exec NStationsFired %d > %d Min ?, NbStations %d", GetNStationsFired(), + GetMinNofHits(), fDigiBdfPar->GetNbTrackingStations()); if (GetNStationsFired() < GetMinNofHits()) { fInspectEvent = kFALSE; // mark event as non trackable - } else + } + else fInspectEvent = kTRUE; CheckMaxHMul(); @@ -1275,11 +1141,9 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { fNofTracks = fFinder->DoFind(fTofHitArray, fTrackArray); // fTrackArray->Compress(); fStop.Set(); - fdTrackingTime = fStop.GetSec() - fStart.GetSec() - + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9; + fdTrackingTime = fStop.GetSec() - fStart.GetSec() + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9; - LOG(debug) << Form("CbmTofFindTracks::Exec found %d Tracklets in %f sec", - fTrackArray->GetEntriesFast(), + LOG(debug) << Form("CbmTofFindTracks::Exec found %d Tracklets in %f sec", fTrackArray->GetEntriesFast(), fdTrackingTime); FindVertex(); @@ -1293,7 +1157,8 @@ void CbmTofFindTracks::ExecFind(Option_t* /*opt*/, CbmEvent* tEvent) { // ----- Public method Finish ------------------------------------------ -void CbmTofFindTracks::Finish() { +void CbmTofFindTracks::Finish() +{ if (fiEvent < 1000) return; // preserve calibration histos in event display if (fiCalOpt > 0) fTofCalibrator->UpdateCalHist(fiCalOpt); WriteHistos(); @@ -1302,288 +1167,100 @@ void CbmTofFindTracks::Finish() { } // ------------------------------------------------------------------------- -void CbmTofFindTracks::CreateHistograms() { +void CbmTofFindTracks::CreateHistograms() +{ - TDirectory* oldir = - gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager! - gROOT - ->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager ! + TDirectory* oldir = gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager! + gROOT->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager ! // define histos here Double_t nSmt = fMapRpcIdParInd.size(); - LOG(info) << Form( - " CbmTofFindTracks::CreateHistograms for %d counters, %d stations ", - (Int_t) nSmt, - fNTofStations); - - fhTrklMul = new TH1F( - Form("hTrklMul"), Form("Tracklet Multiplicity; MulTracklet"), 100, 0, 100); - - fhAllHitsStation = new TH1F(Form("hAllHitsStation"), - Form("Reconstructed Hits; Station #"), - fNTofStations, - 0, - fNTofStations); - fhAllHitsSmTypes = new TH1F( - Form("hAllHitsSmTypes"), Form("Reconstructed Hits; SmType #"), 10, 0, 10); - - fhUsedHitsStation = - new TH1F(Form("hUsedHitsStation"), - Form("Used (HMul>2) / Reconstructed Hits; Station #"), - fNTofStations, - 0, - fNTofStations); - - fhTrklChi2 = new TH2F(Form("hTrklChi2"), - Form("Tracklet Chi; HMul_{Tracklet}; #chi"), - 8, - 2, - 10, - 100, - 0, + LOG(info) << Form(" CbmTofFindTracks::CreateHistograms for %d counters, %d stations ", (Int_t) nSmt, fNTofStations); + + fhTrklMul = new TH1F(Form("hTrklMul"), Form("Tracklet Multiplicity; MulTracklet"), 100, 0, 100); + + fhAllHitsStation = + new TH1F(Form("hAllHitsStation"), Form("Reconstructed Hits; Station #"), fNTofStations, 0, fNTofStations); + fhAllHitsSmTypes = new TH1F(Form("hAllHitsSmTypes"), Form("Reconstructed Hits; SmType #"), 10, 0, 10); + + fhUsedHitsStation = new TH1F(Form("hUsedHitsStation"), Form("Used (HMul>2) / Reconstructed Hits; Station #"), + fNTofStations, 0, fNTofStations); + + fhTrklChi2 = new TH2F(Form("hTrklChi2"), Form("Tracklet Chi; HMul_{Tracklet}; #chi"), 8, 2, 10, 100, 0, ((CbmTofTrackFinderNN*) fFinder)->GetChiMaxAccept()); - fhTrackingTimeNhits = new TH2F(Form("hTrackingTimeNhits"), - Form("Tracking Time; NHits; #Deltat (s)"), - 100, - 0, - 200, - 50, - 0, - 0.1); - - fhTrklMulNhits = new TH2F(Form("hTrklMulNhits"), - Form("Tracklet Multiplicity; NHits; NTracklet"), - 150, - 0, - 150, - 30, - 0, - 30); - - fhTrklMulMaxMM = new TH2F(Form("hTrklMulMaxMax-1"), - Form("Tracklet Multiplicity; TMulMax; TMulMax-1"), - 10, - 0, - 10, - 10, - 0, - 10); - fhTrklMul3D = new TH3F(Form("hTrklMul3D"), - Form("Tracklet Multiplicities; TMul3; TMul4; TMul5"), - 10, - 0, - 10, - 10, - 0, - 10, - 10, - 0, - 10); + fhTrackingTimeNhits = + new TH2F(Form("hTrackingTimeNhits"), Form("Tracking Time; NHits; #Deltat (s)"), 100, 0, 200, 50, 0, 0.1); + + fhTrklMulNhits = + new TH2F(Form("hTrklMulNhits"), Form("Tracklet Multiplicity; NHits; NTracklet"), 150, 0, 150, 30, 0, 30); + + fhTrklMulMaxMM = + new TH2F(Form("hTrklMulMaxMax-1"), Form("Tracklet Multiplicity; TMulMax; TMulMax-1"), 10, 0, 10, 10, 0, 10); + fhTrklMul3D = + new TH3F(Form("hTrklMul3D"), Form("Tracklet Multiplicities; TMul3; TMul4; TMul5"), 10, 0, 10, 10, 0, 10, 10, 0, 10); fhTrklHMul = - new TH2F(Form("hTrklHMul"), - Form("Tracklet Hit - Multiplicity; HMul_{Tracklet}; Mul_{HMul}"), - 8, - 2, - 10, - 20, - 0, - 20); - fhTrklZ0xHMul = - new TH2F(Form("hTrklZ0xHMul"), - Form("Tracklet Z0x vs. Hit - Multiplicity; HMul_{Tracklet}; Z0x"), - 8, - 2, - 10, - 100, - -500, - 500); - fhTrklZ0yHMul = - new TH2F(Form("hTrklZ0yHMul"), - Form("Tracklet Z0y vs. Hit - Multiplicity; HMul_{Tracklet}; Z0y"), - 8, - 2, - 10, - 100, - -300, - 300); - - fhTrklTxHMul = - new TH2F(Form("hTrklTxHMul"), - Form("Tracklet Tx vs. Hit - Multiplicity; HMul_{Tracklet}; Tx"), - 8, - 2, - 10, - 100, - -0.65, - 0.65); - - fhTrklTyHMul = - new TH2F(Form("hTrklTyHMul"), - Form("Tracklet Ty vs. Hit - Multiplicity; HMul_{Tracklet}; Ty"), - 8, - 2, - 10, - 100, - -0.65, - 0.65); + new TH2F(Form("hTrklHMul"), Form("Tracklet Hit - Multiplicity; HMul_{Tracklet}; Mul_{HMul}"), 8, 2, 10, 20, 0, 20); + fhTrklZ0xHMul = new TH2F(Form("hTrklZ0xHMul"), Form("Tracklet Z0x vs. Hit - Multiplicity; HMul_{Tracklet}; Z0x"), 8, + 2, 10, 100, -500, 500); + fhTrklZ0yHMul = new TH2F(Form("hTrklZ0yHMul"), Form("Tracklet Z0y vs. Hit - Multiplicity; HMul_{Tracklet}; Z0y"), 8, + 2, 10, 100, -300, 300); + + fhTrklTxHMul = new TH2F(Form("hTrklTxHMul"), Form("Tracklet Tx vs. Hit - Multiplicity; HMul_{Tracklet}; Tx"), 8, 2, + 10, 100, -0.65, 0.65); + + fhTrklTyHMul = new TH2F(Form("hTrklTyHMul"), Form("Tracklet Ty vs. Hit - Multiplicity; HMul_{Tracklet}; Ty"), 8, 2, + 10, 100, -0.65, 0.65); Double_t TTMAX = 0.2; - fhTrklTtHMul = - new TH2F(Form("hTrklTtHMul"), - Form("Tracklet Tt vs. Hit - Multiplicity; HMul_{Tracklet}; Tt"), - 8, - 2, - 10, - 100, - -TTMAX, - TTMAX); - fhTrklVelHMul = new TH2F( - Form("hTrklVelHMul"), - Form("Tracklet Vel vs. Hit - Multiplicity; HMul_{Tracklet}; v (cm/ns)"), - 8, - 2, - 10, - 100, - 0., - 50.); - fhTrklT0HMul = - new TH2F(Form("hTrklT0HMul"), - Form("Tracklet T0 vs. Hit - Multiplicity; HMul_{Tracklet}; T0"), - 8, - 2, - 10, - 100, - -0.5, - 0.5); - - fhTrklT0Mul = new TH2F( - Form("hTrklT0Mul"), - Form( - "Tracklet #DeltaT0 vs. Trkl - Multiplicity; Mul_{Tracklet}; #Delta(T0)"), - 10, - 0, - 10, - 100, - -2., - 2.); - fhTrklDT0SmMis = new TH2F( - Form("hTrklDT0SmMis"), - Form("Tracklet DeltaT0 vs. Trkl - ID; SmType_{missed}; #Delta(T0)"), - 10, - 0, - 10, - 100, - -2., - 2.); - fhTrklDT0StMis2 = new TH2F( - Form("hTrklDT0SmMis2"), - Form("Tracklet DeltaT0 vs. Station - ID; St2_{missed}; #Delta(T0)"), - 50, - 0, - 50, - 100, - -2., - 2.); + fhTrklTtHMul = new TH2F(Form("hTrklTtHMul"), Form("Tracklet Tt vs. Hit - Multiplicity; HMul_{Tracklet}; Tt"), 8, 2, + 10, 100, -TTMAX, TTMAX); + fhTrklVelHMul = + new TH2F(Form("hTrklVelHMul"), Form("Tracklet Vel vs. Hit - Multiplicity; HMul_{Tracklet}; v (cm/ns)"), 8, 2, 10, + 100, 0., 50.); + fhTrklT0HMul = new TH2F(Form("hTrklT0HMul"), Form("Tracklet T0 vs. Hit - Multiplicity; HMul_{Tracklet}; T0"), 8, 2, + 10, 100, -0.5, 0.5); + + fhTrklT0Mul = + new TH2F(Form("hTrklT0Mul"), Form("Tracklet #DeltaT0 vs. Trkl - Multiplicity; Mul_{Tracklet}; #Delta(T0)"), 10, 0, + 10, 100, -2., 2.); + fhTrklDT0SmMis = new TH2F(Form("hTrklDT0SmMis"), Form("Tracklet DeltaT0 vs. Trkl - ID; SmType_{missed}; #Delta(T0)"), + 10, 0, 10, 100, -2., 2.); + fhTrklDT0StMis2 = + new TH2F(Form("hTrklDT0SmMis2"), Form("Tracklet DeltaT0 vs. Station - ID; St2_{missed}; #Delta(T0)"), 50, 0, 50, + 100, -2., 2.); Double_t X0MAX = 40.; - fhTrklXY0_0 = - new TH2F(Form("hTrklXY0_0"), - Form("Tracklet XY at z=0 for hmulmax ; x (cm); y (cm)"), - 100, - -X0MAX, - X0MAX, - 100, - -X0MAX, - X0MAX); - fhTrklXY0_1 = - new TH2F(Form("hTrklXY0_1"), - Form("Tracklet XY at z=0 for hmulmax-1 ; x (cm); y (cm)"), - 100, - -X0MAX * 2., - X0MAX * 2., - 100, - -X0MAX * 2., - X0MAX * 2.); - fhTrklXY0_2 = - new TH2F(Form("hTrklXY0_2"), - Form("Tracklet XY at z=0 for hmulmax-2 ; x (cm); y (cm)"), - 100, - -X0MAX * 3., - X0MAX * 3., - 100, - -X0MAX * 3., - X0MAX * 3.); + fhTrklXY0_0 = new TH2F(Form("hTrklXY0_0"), Form("Tracklet XY at z=0 for hmulmax ; x (cm); y (cm)"), 100, -X0MAX, + X0MAX, 100, -X0MAX, X0MAX); + fhTrklXY0_1 = new TH2F(Form("hTrklXY0_1"), Form("Tracklet XY at z=0 for hmulmax-1 ; x (cm); y (cm)"), 100, + -X0MAX * 2., X0MAX * 2., 100, -X0MAX * 2., X0MAX * 2.); + fhTrklXY0_2 = new TH2F(Form("hTrklXY0_2"), Form("Tracklet XY at z=0 for hmulmax-2 ; x (cm); y (cm)"), 100, + -X0MAX * 3., X0MAX * 3., 100, -X0MAX * 3., X0MAX * 3.); Double_t DT0MAX = 5.; if (fT0MAX == 0) fT0MAX = DT0MAX; - fhPullT_Smt = - new TH2F(Form("hPullT_Smt"), - Form("Tracklet ResiT vs RpcInd ; RpcInd ; #DeltaT (ns)"), - nSmt, - 0, - nSmt, - 501, - -fT0MAX, - fT0MAX); + fhPullT_Smt = new TH2F(Form("hPullT_Smt"), Form("Tracklet ResiT vs RpcInd ; RpcInd ; #DeltaT (ns)"), nSmt, 0, nSmt, + 501, -fT0MAX, fT0MAX); Double_t DX0MAX = 5.; - fhPullX_Smt = - new TH2F(Form("hPullX_Smt"), - Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"), - nSmt, - 0, - nSmt, - 100, - -DX0MAX, - DX0MAX); + fhPullX_Smt = new TH2F(Form("hPullX_Smt"), Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"), nSmt, 0, nSmt, + 100, -DX0MAX, DX0MAX); Double_t DY0MAX = 5.; - fhPullY_Smt = - new TH2F(Form("hPullY_Smt"), - Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"), - nSmt, - 0, - nSmt, - 100, - -DY0MAX, - DY0MAX); + fhPullY_Smt = new TH2F(Form("hPullY_Smt"), Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"), nSmt, 0, nSmt, + 100, -DY0MAX, DY0MAX); Double_t DZ0MAX = 20.; - fhPullZ_Smt = - new TH2F(Form("hPullZ_Smt"), - Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"), - nSmt, - 0, - nSmt, - 100, - -DZ0MAX, - DZ0MAX); - - fhTOff_Smt = new TH2F(Form("hTOff_Smt"), - Form("Tracklet TOff; RpcInd ; TOff (ns)"), - nSmt, - 0, - nSmt, - 501, - -fT0MAX, - fT0MAX); - fhTOff_HMul2 = new TH2F(Form("hTOff_HMul2"), - Form("Tracklet TOff(HMul2); RpcInd ; TOff (ns)"), - nSmt, - 0, - nSmt, - 500, - -fT0MAX, - fT0MAX); + fhPullZ_Smt = new TH2F(Form("hPullZ_Smt"), Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"), nSmt, 0, nSmt, + 100, -DZ0MAX, DZ0MAX); + + fhTOff_Smt = + new TH2F(Form("hTOff_Smt"), Form("Tracklet TOff; RpcInd ; TOff (ns)"), nSmt, 0, nSmt, 501, -fT0MAX, fT0MAX); + fhTOff_HMul2 = new TH2F(Form("hTOff_HMul2"), Form("Tracklet TOff(HMul2); RpcInd ; TOff (ns)"), nSmt, 0, nSmt, 500, + -fT0MAX, fT0MAX); Double_t DTTMAX = 0.09; - fhDeltaTt_Smt = new TH2F(Form("hDeltaTt_Smt"), - Form("Tracklet DeltaTt; RpcInd ; #DeltaTt (ns/cm)"), - nSmt, - 0, - nSmt, - 100, - -DTTMAX, - DTTMAX); + fhDeltaTt_Smt = new TH2F(Form("hDeltaTt_Smt"), Form("Tracklet DeltaTt; RpcInd ; #DeltaTt (ns/cm)"), nSmt, 0, nSmt, + 100, -DTTMAX, DTTMAX); vhPullX.resize(fNTofStations); vhPullY.resize(fNTofStations); @@ -1604,205 +1281,74 @@ void CbmTofFindTracks::CreateHistograms() { vhUCDXDY_DT.resize(fNTofStations); for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { - vhPullX[iSt] = new TH1F(Form("hPullX_Station_%d", iSt), - Form("hResiX_Station_%d; #DeltaX (cm)", iSt), - 99, - -DX0MAX, - DX0MAX); - vhPullY[iSt] = new TH1F(Form("hPullY_Station_%d", iSt), - Form("hResiY_Station_%d; #DeltaY (cm)", iSt), - 99, - -DY0MAX, - DY0MAX); - vhPullZ[iSt] = new TH1F(Form("hPullZ_Station_%d", iSt), - Form("hResiZ_Station_%d; #DeltaZ (cm)", iSt), - 99, - -50., - 50.); - vhPullT[iSt] = new TH1F(Form("hPullT_Station_%d", iSt), - Form("hResiT_Station_%d; #DeltaT (ns)", iSt), - 59, - -fT0MAX, - fT0MAX); - vhPullTB[iSt] = new TH1F(Form("hPullTB_Station_%d", iSt), - Form("hResiTB_Station_%d; #DeltaT (ns)", iSt), - 59, - -1.25 * fT0MAX, - 1.25 * fT0MAX); + vhPullX[iSt] = + new TH1F(Form("hPullX_Station_%d", iSt), Form("hResiX_Station_%d; #DeltaX (cm)", iSt), 99, -DX0MAX, DX0MAX); + vhPullY[iSt] = + new TH1F(Form("hPullY_Station_%d", iSt), Form("hResiY_Station_%d; #DeltaY (cm)", iSt), 99, -DY0MAX, DY0MAX); + vhPullZ[iSt] = + new TH1F(Form("hPullZ_Station_%d", iSt), Form("hResiZ_Station_%d; #DeltaZ (cm)", iSt), 99, -50., 50.); + vhPullT[iSt] = + new TH1F(Form("hPullT_Station_%d", iSt), Form("hResiT_Station_%d; #DeltaT (ns)", iSt), 59, -fT0MAX, fT0MAX); + vhPullTB[iSt] = new TH1F(Form("hPullTB_Station_%d", iSt), Form("hResiTB_Station_%d; #DeltaT (ns)", iSt), 59, + -1.25 * fT0MAX, 1.25 * fT0MAX); const Double_t TOTmax = 50.; vhResidualTBWalk[iSt] = - new TH2F(Form("hResidualTBWalk_Station_%d", iSt), - Form("hResidualTBWalk_Station_%d; #DeltaT (ns)", iSt), - TOTmax, - 0., - TOTmax, - 59, - -1.25 * fT0MAX, - 1.25 * fT0MAX); + new TH2F(Form("hResidualTBWalk_Station_%d", iSt), Form("hResidualTBWalk_Station_%d; #DeltaT (ns)", iSt), TOTmax, + 0., TOTmax, 59, -1.25 * fT0MAX, 1.25 * fT0MAX); vhResidualYWalk[iSt] = - new TH2F(Form("hResidualYWalk_Station_%d", iSt), - Form("hResidualYWalk_Station_%d; #DeltaT (ns)", iSt), - TOTmax, - 0., - TOTmax, - 59, - -DY0MAX, - DY0MAX); + new TH2F(Form("hResidualYWalk_Station_%d", iSt), Form("hResidualYWalk_Station_%d; #DeltaT (ns)", iSt), TOTmax, + 0., TOTmax, 59, -DY0MAX, DY0MAX); Double_t XSIZ = 16.; Int_t Nbins = 32.; CbmTofCell* fChannelInfo = fDigiPar->GetCell(fMapStationRpcId[iSt]); if (NULL == fChannelInfo) { - LOG(fatal) << "Geometry for station " << iSt << ", Rpc " - << fMapStationRpcId[iSt] << " not defined "; + LOG(fatal) << "Geometry for station " << iSt << ", Rpc " << fMapStationRpcId[iSt] << " not defined "; return; } - Int_t NbinsX = 2 * XSIZ / fChannelInfo->GetSizex(); - vhXY_AllTracks[iSt] = - new TH2F(Form("hXY_AllTracks_%d", iSt), - Form("hXY_AllTracks_%d; x(cm); y (cm)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ); - vhXY_AllStations[iSt] = - new TH2F(Form("hXY_AllStations_%d", iSt), - Form("hXY_AllStations_%d; x(cm); y (cm)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ); + Int_t NbinsX = 2 * XSIZ / fChannelInfo->GetSizex(); + vhXY_AllTracks[iSt] = new TH2F(Form("hXY_AllTracks_%d", iSt), Form("hXY_AllTracks_%d; x(cm); y (cm)", iSt), NbinsX, + -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ); + vhXY_AllStations[iSt] = new TH2F(Form("hXY_AllStations_%d", iSt), Form("hXY_AllStations_%d; x(cm); y (cm)", iSt), + NbinsX, -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ); vhXY_MissedStation[iSt] = - new TH2F(Form("hXY_MissedStation_%d", iSt), - Form("hXY_MissedStation_%d; x(cm); y (cm)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ); - vhXY_DX[iSt] = - new TH3F(Form("hXY_DX_%d", iSt), - Form("hXY_DX_%d; x(cm); y (cm); #DeltaX (cm)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ, - Nbins, - -2., - 2.); - vhXY_DY[iSt] = - new TH3F(Form("hXY_DY_%d", iSt), - Form("hXY_DY_%d; x(cm); y (cm); #DeltaY (cm)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ, - Nbins, - -2., - 2.); - vhXY_DT[iSt] = - new TH3F(Form("hXY_DT_%d", iSt), - Form("hXY_DT_%d; x(cm); y (cm); #DeltaT (ns)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ, - Nbins, - -0.5, - 0.5); - vhXY_TOT[iSt] = - new TH3F(Form("hXY_TOT_%d", iSt), - Form("hXY_TOT_%d; x(cm); y (cm); TOT (a.u.)", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ, - Nbins, - 0., - 10.); - vhXY_CSZ[iSt] = new TH3F(Form("hXY_CSZ_%d", iSt), - Form("hXY_CSZ_%d; x(cm); y (cm); CSZ ()", iSt), - NbinsX, - -XSIZ, - XSIZ, - Nbins, - -XSIZ, - XSIZ, - 6, - 1., - 7.); + new TH2F(Form("hXY_MissedStation_%d", iSt), Form("hXY_MissedStation_%d; x(cm); y (cm)", iSt), NbinsX, -XSIZ, + XSIZ, Nbins, -XSIZ, XSIZ); + vhXY_DX[iSt] = new TH3F(Form("hXY_DX_%d", iSt), Form("hXY_DX_%d; x(cm); y (cm); #DeltaX (cm)", iSt), NbinsX, -XSIZ, + XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -2., 2.); + vhXY_DY[iSt] = new TH3F(Form("hXY_DY_%d", iSt), Form("hXY_DY_%d; x(cm); y (cm); #DeltaY (cm)", iSt), NbinsX, -XSIZ, + XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -2., 2.); + vhXY_DT[iSt] = new TH3F(Form("hXY_DT_%d", iSt), Form("hXY_DT_%d; x(cm); y (cm); #DeltaT (ns)", iSt), NbinsX, -XSIZ, + XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -0.5, 0.5); + vhXY_TOT[iSt] = new TH3F(Form("hXY_TOT_%d", iSt), Form("hXY_TOT_%d; x(cm); y (cm); TOT (a.u.)", iSt), NbinsX, + -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ, Nbins, 0., 10.); + vhXY_CSZ[iSt] = new TH3F(Form("hXY_CSZ_%d", iSt), Form("hXY_CSZ_%d; x(cm); y (cm); CSZ ()", iSt), NbinsX, -XSIZ, + XSIZ, Nbins, -XSIZ, XSIZ, 6, 1., 7.); vhUDXDY_DT[iSt] = new TH3F(Form("hUDXDY_DT_%d", iSt), Form("Unused missing hit - DXDY_DT_%d; #Deltax " "(cm); #Deltay (cm); #DeltaT (ns)", iSt), - 11, - -3., - 3., - 11, - -3., - 3., - 101, - -50., - 50.); + 11, -3., 3., 11, -3., 3., 101, -50., 50.); vhUCDXDY_DT[iSt] = new TH3F(Form("hUCDXDY_DT_%d", iSt), Form("Unused close hit - DXDY_DT_%d; #Deltax " "(cm); #Deltay (cm); #DeltaT (ns)", iSt), - 11, - -3., - 3., - 11, - -3., - 3., - 101, - -50., - 50.); + 11, -3., 3., 11, -3., 3., 101, -50., 50.); } // vertex histrograms Double_t NNORM = 40.; - fhVTXNorm = new TH1F(Form("hVTXNorm"), - Form("Vertex Normalisation; #_{TrackletHits}"), - NNORM, - 0, - NNORM); - fhVTX_XY0 = new TH2F(Form("hVTX_XY0"), - Form("Vertex XY at z=0 ; x (xm); y (cm)"), - 100, - -X0MAX, - X0MAX, - 100, - -X0MAX, - X0MAX); - fhVTX_DT0_Norm = - new TH2F(Form("hVTX_DT0_Norm"), - Form("Vertex #DeltaT at z=0 ; #_{TrackletHits}; #DeltaT (ns)"), - NNORM, - 0, - NNORM, - 100, - -2., - 2.); - - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + fhVTXNorm = new TH1F(Form("hVTXNorm"), Form("Vertex Normalisation; #_{TrackletHits}"), NNORM, 0, NNORM); + fhVTX_XY0 = + new TH2F(Form("hVTX_XY0"), Form("Vertex XY at z=0 ; x (xm); y (cm)"), 100, -X0MAX, X0MAX, 100, -X0MAX, X0MAX); + fhVTX_DT0_Norm = new TH2F(Form("hVTX_DT0_Norm"), Form("Vertex #DeltaT at z=0 ; #_{TrackletHits}; #DeltaT (ns)"), + NNORM, 0, NNORM, 100, -2., 2.); + + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! } -void CbmTofFindTracks::FindVertex() { +void CbmTofFindTracks::FindVertex() +{ fVTX_T = 0.; //reset fVTX_X = 0.; fVTX_Y = 0.; @@ -1813,14 +1359,9 @@ void CbmTofFindTracks::FindVertex() { CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk); if (NULL == pTrk) continue; Double_t w = pTrk->GetNofHits(); - LOG(debug1) << Form( - "CbmTofFindTracks::FindVertex: N %3.0f, w %3.0f, min %d", - fVTXNorm, - w, - fMinNofHits); - - if (w > (Double_t) - fMinNofHits) { // for further analysis request minimum number of hits + LOG(debug1) << Form("CbmTofFindTracks::FindVertex: N %3.0f, w %3.0f, min %d", fVTXNorm, w, fMinNofHits); + + if (w > (Double_t) fMinNofHits) { // for further analysis request minimum number of hits fVTXNorm += w; fVTX_T += w * pTrk->GetFitT(0.); fVTX_X += w * pTrk->GetFitX(0.); @@ -1833,18 +1374,14 @@ void CbmTofFindTracks::FindVertex() { fVTX_Y /= fVTXNorm; fVTX_Z /= fVTXNorm; } - LOG(debug) << Form( - "CbmTofFindTracks::FindVertex: N %3.0f, T %6.2f, X=%6.2f, Y=%6.2f Z=%6.2f ", - fVTXNorm, - fVTX_T, - fVTX_X, - fVTX_Y, - fVTX_Z); + LOG(debug) << Form("CbmTofFindTracks::FindVertex: N %3.0f, T %6.2f, X=%6.2f, Y=%6.2f Z=%6.2f ", fVTXNorm, fVTX_T, + fVTX_X, fVTX_Y, fVTX_Z); } static Int_t iWarnNotDefined = 0; -void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { +void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) +{ // Locate reference ("beam counter") hit CbmTofHit* pRefHit = NULL; Double_t RefMinTime = 1.E300; @@ -1857,7 +1394,8 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { pRefHit = pHit; RefMinTime = pRefHit->GetTime(); } - } else { // take earliest hit as reference + } + else { // take earliest hit as reference if (pHit->GetTime() < RefMinTime) { pRefHit = pHit; RefMinTime = pRefHit->GetTime(); @@ -1877,9 +1415,8 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk); if (NULL == pTrk) continue; if (pTrk->GetNofHits() > fNTofStations) { - LOG(error) << "CbmTofFindTracks::FillHistograms: more hits (" - << pTrk->GetNofHits() << ") than stations (" << fNTofStations - << ")"; + LOG(error) << "CbmTofFindTracks::FillHistograms: more hits (" << pTrk->GetNofHits() << ") than stations (" + << fNTofStations << ")"; continue; } @@ -1902,18 +1439,12 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { Double_t dTOff = pHit->GetTime() - pHit->GetR() * fTtTarg - dTRef0; LOG(debug1) << Form("<D> CbmTofFindTracks::FillHistograms: iDetId1 " "0x%08x, iST1 = %d with dTOff %f at RpcInd %d", - iDetId, - iSt, - dTOff, - fMapRpcIdParInd[fMapStationRpcId[iSt]]); - fhTOff_HMul2->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dTOff); + iDetId, iSt, dTOff, fMapRpcIdParInd[fMapStationRpcId[iSt]]); + fhTOff_HMul2->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dTOff); } // loop over tracklets' hits } - if ( - pTrk->GetNofHits() - > fMinNofHits) { // for further analysis request at least 3 matched hits + if (pTrk->GetNofHits() > fMinNofHits) { // for further analysis request at least 3 matched hits iTMul++; fhTrklChi2->Fill(pTrk->GetNofHits(), pTrk->GetChiSq()); @@ -1921,12 +1452,8 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { CbmTofTrackletParam* tPar = pTrk->GetTrackParameter(); Double_t dTt = pTrk->GetTt(); - LOG(debug) << Form("Trk %d info: Lz=%6.2f Z0x=%6.2f Z0y=%6.2f Tt=%6.4f", - iTrk, - tPar->GetLz(), - pTrk->GetZ0x(), - pTrk->GetZ0y(), - dTt) + LOG(debug) << Form("Trk %d info: Lz=%6.2f Z0x=%6.2f Z0y=%6.2f Tt=%6.4f", iTrk, tPar->GetLz(), pTrk->GetZ0x(), + pTrk->GetZ0y(), dTt) << tPar->ToString(); fhTrklZ0xHMul->Fill(pTrk->GetNofHits(), pTrk->GetFitX(0.)); @@ -1944,62 +1471,37 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { default:; } - if ( - fiBeamCounter > -1 - && fdR0Lim - > 0.) // consider only tracks originating from nominal interaction point + if (fiBeamCounter > -1 && fdR0Lim > 0.) // consider only tracks originating from nominal interaction point { if (pTrk->GetR0() > fdR0Lim) continue; } if (dTt > 0.) for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { - Int_t iH = pTrk->GetStationHitIndex( - fMapStationRpcId[iSt]); // Station Hit index - if (iH < 0) continue; // Station not part of tracklet + Int_t iH = pTrk->GetStationHitIndex(fMapStationRpcId[iSt]); // Station Hit index + if (iH < 0) continue; // Station not part of tracklet fhUsedHitsStation->Fill(iSt); - if (pTrk->GetNofHits() < GetNReqStations()) - continue; // fill Pull histos only for complete tracks + if (pTrk->GetNofHits() < GetNReqStations()) continue; // fill Pull histos only for complete tracks CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iH); //if (0 == fMapStationRpcId[iSt]) pHit->SetTime(pTrk->GetT0()); // set time of fake hit, abandoned /* cout << " -D- CbmTofFindTracks::FillHistograms: "<< iSt <<", " <<fMapStationRpcId[iSt]<<", "<< iH <<", "<< iH0 <<", "<<pHit->ToString() << endl; */ - Double_t dDZ = - pHit->GetZ() - tPar->GetZ(); // z- Distance to reference point - Double_t dDX = - pHit->GetX() - - pTrk->GetFitX( - pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; - Double_t dDY = - pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; - Double_t dDT = - pHit->GetTime() - - pTrk->GetFitT( - pHit->GetZ()); // pTrk->GetTdif(fMapStationRpcId[iSt]); - Double_t dDTB = - fTrackletTools->GetTdif(pTrk, - fMapStationRpcId[iSt], - pHit); // ignore pHit in calc of reference - Double_t dTOT = pHit->GetCh() / 10.; // misuse of channel field + Double_t dDZ = pHit->GetZ() - tPar->GetZ(); // z- Distance to reference point + Double_t dDX = pHit->GetX() - pTrk->GetFitX(pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; + Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; + Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()); // pTrk->GetTdif(fMapStationRpcId[iSt]); + Double_t dDTB = fTrackletTools->GetTdif(pTrk, fMapStationRpcId[iSt], + pHit); // ignore pHit in calc of reference + Double_t dTOT = pHit->GetCh() / 10.; // misuse of channel field Double_t dZZ = pHit->GetZ() - tPar->GetZy(pHit->GetY()); - LOG(debug) << Form( - " St %d Id 0x%08x Hit %2d, Z %6.2f - DX %6.2f, DY %6.2f, " - "Z %6.2f, DT %6.2f, %6.2f, ZZ %6.2f, Tt %6.4f ", - iSt, - fMapStationRpcId[iSt], - iH, - pHit->GetZ(), - dDX, - dDY, - dDZ, - dDT, - dDTB, - dZZ, - dTt) << tPar->ToString(); + LOG(debug) << Form(" St %d Id 0x%08x Hit %2d, Z %6.2f - DX %6.2f, DY %6.2f, " + "Z %6.2f, DT %6.2f, %6.2f, ZZ %6.2f, Tt %6.4f ", + iSt, fMapStationRpcId[iSt], iH, pHit->GetZ(), dDX, dDY, dDZ, dDT, dDTB, dZZ, dTt) + << tPar->ToString(); vhPullX[iSt]->Fill(dDX); vhPullY[iSt]->Fill(dDY); @@ -2009,33 +1511,26 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { vhResidualTBWalk[iSt]->Fill(dTOT, dDTB); vhResidualYWalk[iSt]->Fill(dTOT, dDY); - fhPullT_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dDT); - fhPullX_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dDX); - fhPullY_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dDY); + fhPullT_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dDT); + fhPullX_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dDX); + fhPullY_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dDY); /* fhPullT_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetTdif(pTrk,fMapStationRpcId[iSt], pHit) ); fhPullX_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetXdif(pTrk,fMapStationRpcId[iSt], pHit) ); fhPullY_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetYdif(pTrk,fMapStationRpcId[iSt], pHit) ); */ - fhPullZ_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dZZ); + fhPullZ_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dZZ); Double_t dDeltaTt = dTt - fTtTarg; - fhDeltaTt_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dDeltaTt); + fhDeltaTt_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dDeltaTt); //XXX use BRef as Referenz!!! if (pRefHit != NULL) { - Double_t dTOff = - dDeltaTt * //pHit->GetR(); - TMath::Sqrt(TMath::Power(pHit->GetX() - pRefHit->GetX(), 2) - + TMath::Power(pHit->GetY() - pRefHit->GetY(), 2) - + TMath::Power(pHit->GetZ() - pRefHit->GetZ(), 2)) - * TMath::Sign(1, pHit->GetZ() - pRefHit->GetZ()); - fhTOff_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], - dTOff); + Double_t dTOff = dDeltaTt * //pHit->GetR(); + TMath::Sqrt(TMath::Power(pHit->GetX() - pRefHit->GetX(), 2) + + TMath::Power(pHit->GetY() - pRefHit->GetY(), 2) + + TMath::Power(pHit->GetZ() - pRefHit->GetZ(), 2)) + * TMath::Sign(1, pHit->GetZ() - pRefHit->GetZ()); + fhTOff_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]], dTOff); } } @@ -2045,8 +1540,7 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { } // condition on NofHits>2 end // monitoring of tracklet hits with selected velocities from reference counters - if (TMath::Abs(pTrk->GetRefVel((UInt_t)(fNReqStations - 1)) - fdRefVelMean) - < fdRefDVel) { + if (TMath::Abs(pTrk->GetRefVel((UInt_t)(fNReqStations - 1)) - fdRefVelMean) < fdRefDVel) { fhTrklVelHMul->Fill(pTrk->GetNofHits(), 1. / pTrk->GetTt()); for (Int_t iH = 0; iH < pTrk->GetNofHits(); iH++) { CbmTofHit* pHit = pTrk->GetTofHitPointer(iH); @@ -2057,15 +1551,11 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { Int_t iSt = GetStationOfAddr(iAddr); Double_t hitpos[3] = {3 * 0.}; Double_t hitpos_local[3] = {3 * 0.}; - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); Int_t iRpcInd = fMapRpcIdParInd[iChId & DetMask]; - hitpos[0] = - pHit->GetX() - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[1] = - pHit->GetY() - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[2] = - pHit->GetZ() - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[0] = pHit->GetX() - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[1] = pHit->GetY() - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[2] = pHit->GetZ() - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); gGeoManager->MasterToLocal(hitpos, hitpos_local); vhXY_AllTracks[iSt]->Fill(hitpos_local[0], hitpos_local[1]); } @@ -2074,8 +1564,7 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { LOG(debug) << "Complete Tracklet in event " << fiEvent; for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { - Int_t iH = pTrk->GetStationHitIndex( - fMapStationRpcId[iSt]); // Station Hit index + Int_t iH = pTrk->GetStationHitIndex(fMapStationRpcId[iSt]); // Station Hit index if (iH < 0) { LOG(debug) << " Incomplete Tracklet, skip station " << iSt; continue; // Station not part of tracklet @@ -2087,41 +1576,28 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { CbmTofCell* fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { //faked hit, take init values - } else { + } + else { /* TGeoNode *fNode=*/ // prepare global->local trafo - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); Int_t iRpcInd = fMapRpcIdParInd[iChId & DetMask]; - hitpos[0] = - pHit->GetX() - - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[1] = - pHit->GetY() - - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[2] = - pHit->GetZ() - - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[0] = pHit->GetX() - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[1] = pHit->GetY() - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[2] = pHit->GetZ() - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); /* TGeoNode* cNode= gGeoManager->GetCurrentNode();*/ gGeoManager->MasterToLocal(hitpos, hitpos_local); } vhXY_AllStations[iSt]->Fill(hitpos_local[0], hitpos_local[1]); - Double_t dDX = - pHit->GetX() - - pTrk->GetFitX( - pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; - Double_t dDY = - pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; + Double_t dDX = pHit->GetX() - pTrk->GetFitX(pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; + Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; //Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetR()); //pTrk->GetTdif(fMapStationRpcId[iSt]); - Double_t dDTB = - fTrackletTools->GetTdif(pTrk, - fMapStationRpcId[iSt], - pHit); // ignore pHit in calc of reference + Double_t dDTB = fTrackletTools->GetTdif(pTrk, fMapStationRpcId[iSt], + pHit); // ignore pHit in calc of reference vhXY_DX[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDX); vhXY_DY[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDY); vhXY_DT[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDTB); Double_t dCSZ = ((Double_t)(pHit->GetFlag() % 100)) * 0.5; - Double_t dTOT = ((Double_t) pHit->GetCh()) * 0.1 - / dCSZ; // counteract UHIT flagging + Double_t dTOT = ((Double_t) pHit->GetCh()) * 0.1 / dCSZ; // counteract UHIT flagging vhXY_TOT[iSt]->Fill(hitpos_local[0], hitpos_local[1], dTOT); vhXY_CSZ[iSt]->Fill(hitpos_local[0], hitpos_local[1], dCSZ); @@ -2136,99 +1612,60 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { Double_t hitpos_localD[3]; Int_t NIter = 5; Int_t iRpcInd = fMapRpcIdParInd[iAddr]; - Int_t iNbCh = - fDigiBdfPar->GetNbChan(CbmTofAddress::GetSmType(iAddr), - CbmTofAddress::GetRpcId(iAddr)); + Int_t iNbCh = fDigiBdfPar->GetNbChan(CbmTofAddress::GetSmType(iAddr), CbmTofAddress::GetRpcId(iAddr)); while (zPos != zPosMiss && 0 < NIter--) { fChannelInfoD = fDigiPar->GetCell(iAddr); - gGeoManager->FindNode(fChannelInfoD->GetX(), - fChannelInfoD->GetY(), - fChannelInfoD->GetZ()); - zPos = fChannelInfoD->GetZ() - + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); - hitposD[0] = - pTrk->GetFitX(zPos) - - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); - hitposD[1] = - pTrk->GetFitY(zPos) - - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); + gGeoManager->FindNode(fChannelInfoD->GetX(), fChannelInfoD->GetY(), fChannelInfoD->GetZ()); + zPos = fChannelInfoD->GetZ() + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + hitposD[0] = pTrk->GetFitX(zPos) - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); + hitposD[1] = pTrk->GetFitY(zPos) - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); hitposD[2] = fChannelInfoD->GetZ(); /* TGeoNode* cNode=*/gGeoManager->GetCurrentNode(); gGeoManager->MasterToLocal(hitposD, hitpos_localD); // Check for consistency of geometry Int_t iChTrafo = CbmTofAddress::GetChannelId(iAddr); - Int_t iChMiss = hitpos_localD[0] / fChannelInfoD->GetSizex() - + (iNbCh - 1) / 2; + Int_t iChMiss = hitpos_localD[0] / fChannelInfoD->GetSizex() + (iNbCh - 1) / 2; if (iChMiss < 0) iChMiss = 0; if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1; assert(fDigiBdfPar); if (iChMiss > -1 && iChMiss < iNbCh) { - Int_t iAddrMiss = CbmTofAddress::GetUniqueAddress( - CbmTofAddress::GetSmId(iAddr), - CbmTofAddress::GetRpcId(iAddr), - iChMiss, - 0, - CbmTofAddress::GetSmType(iAddr)); + Int_t iAddrMiss = + CbmTofAddress::GetUniqueAddress(CbmTofAddress::GetSmId(iAddr), CbmTofAddress::GetRpcId(iAddr), + iChMiss, 0, CbmTofAddress::GetSmType(iAddr)); CbmTofCell* fChannelInfoMiss = fDigiPar->GetCell(iAddrMiss); if (NULL == fChannelInfoMiss) { - LOG(fatal) - << Form("Geo consistency check 0x%08x, 0x%08x failed at " - "St%d, z=%7.2f,%7.2f: iChTrafo %d, Miss %d , " - "xloc %6.2f, dx %4.2f", - iAddr, - iAddrMiss, - iSt, - zPos, - zPosMiss, - iChTrafo, - iChMiss, - hitpos_local[0], - fChannelInfo->GetSizex()); + LOG(fatal) << Form("Geo consistency check 0x%08x, 0x%08x failed at " + "St%d, z=%7.2f,%7.2f: iChTrafo %d, Miss %d , " + "xloc %6.2f, dx %4.2f", + iAddr, iAddrMiss, iSt, zPos, zPosMiss, iChTrafo, iChMiss, hitpos_local[0], + fChannelInfo->GetSizex()); } - zPosMiss = - fChannelInfoMiss->GetZ() - + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); - LOG(debug) << Form( - "Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: " - "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f", - iAddr, - iSt, - zPos, - zPosMiss, - iChTrafo, - iChMiss, - hitpos_localD[0], - fChannelInfoD->GetSizex()); + zPosMiss = fChannelInfoMiss->GetZ() + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + LOG(debug) << Form("Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: " + "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f", + iAddr, iSt, zPos, zPosMiss, iChTrafo, iChMiss, hitpos_localD[0], + fChannelInfoD->GetSizex()); fChannelInfo = fChannelInfoMiss; iAddr = iAddrMiss; - } else + } + else zPosMiss = zPos; - LOG(debug) << Form( - "Predicted hit in Last Station 0x%08x at local pos x %6.2f, " - "y %6.2f, z %6.2f, cell %p", - iAddr, - hitpos_localD[0], - hitpos_localD[1], - zPos, - fChannelInfoD); - LOG(debug) << Form( - "Measured hit in Last Station 0x%08x at local pos x %6.2f, " - "y %6.2f, z %6.2f, cell %p", - pHit->GetAddress(), - hitpos_local[0], - hitpos_local[1], - pHit->GetZ(), - fChannelInfo); + LOG(debug) << Form("Predicted hit in Last Station 0x%08x at local pos x %6.2f, " + "y %6.2f, z %6.2f, cell %p", + iAddr, hitpos_localD[0], hitpos_localD[1], zPos, fChannelInfoD); + LOG(debug) << Form("Measured hit in Last Station 0x%08x at local pos x %6.2f, " + "y %6.2f, z %6.2f, cell %p", + pHit->GetAddress(), hitpos_local[0], hitpos_local[1], pHit->GetZ(), fChannelInfo); } } } } - } else { + } + else { if (pTrk->GetNofHits() == fNReqStations - 1) { // one hit missing for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { - Int_t iH = pTrk->GetStationHitIndex( - fMapStationRpcId[iSt]); // Station Hit index - if (iH < 0) { // find geo element for the missing Station iSt + Int_t iH = pTrk->GetStationHitIndex(fMapStationRpcId[iSt]); // Station Hit index + if (iH < 0) { // find geo element for the missing Station iSt Int_t iAddr = fMapStationRpcId[iSt]; if (iAddr < 1) continue; //Int_t iChId = CbmTofAddress::GetUniqueAddress(0,0,0,0,iSmType); @@ -2238,8 +1675,7 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { if (iWarnNotDefined++ < 100) LOG(warning) << Form("CbmTofFindTracks::FillHistograms: Cell " "0x%08x not defined for Station %d", - iAddr, - iSt); + iAddr, iSt); continue; } /* TGeoNode *fNode= */ // prepare global->local trafo @@ -2249,108 +1685,68 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { Double_t hitpos_local[3]; Int_t NIter = 5; Int_t iRpcInd = fMapRpcIdParInd[iAddr]; - Int_t iNbCh = - fDigiBdfPar->GetNbChan(CbmTofAddress::GetSmType(iAddr), - CbmTofAddress::GetRpcId(iAddr)); + Int_t iNbCh = fDigiBdfPar->GetNbChan(CbmTofAddress::GetSmType(iAddr), CbmTofAddress::GetRpcId(iAddr)); while (zPos != zPosMiss && 0 < NIter--) { fChannelInfo = fDigiPar->GetCell(iAddr); - gGeoManager->FindNode(fChannelInfo->GetX(), - fChannelInfo->GetY(), - fChannelInfo->GetZ()); - zPos = fChannelInfo->GetZ() - + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[0] = - pTrk->GetFitX(zPos) - - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); - hitpos[1] = - pTrk->GetFitY(zPos) - - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + zPos = fChannelInfo->GetZ() + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[0] = pTrk->GetFitX(zPos) - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1); + hitpos[1] = pTrk->GetFitY(zPos) - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1); hitpos[2] = fChannelInfo->GetZ(); /* TGeoNode* cNode=*/gGeoManager->GetCurrentNode(); gGeoManager->MasterToLocal(hitpos, hitpos_local); // Check for consistency of geometry Int_t iChTrafo = CbmTofAddress::GetChannelId(iAddr); - Int_t iChMiss = - hitpos_local[0] / fChannelInfo->GetSizex() + (iNbCh - 1) / 2; + Int_t iChMiss = hitpos_local[0] / fChannelInfo->GetSizex() + (iNbCh - 1) / 2; if (iChMiss < 0) iChMiss = 0; if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1; assert(fDigiBdfPar); if (iChMiss > -1 && iChMiss < iNbCh) { - Int_t iAddrMiss = CbmTofAddress::GetUniqueAddress( - CbmTofAddress::GetSmId(iAddr), - CbmTofAddress::GetRpcId(iAddr), - iChMiss, - 0, - CbmTofAddress::GetSmType(iAddr)); + Int_t iAddrMiss = + CbmTofAddress::GetUniqueAddress(CbmTofAddress::GetSmId(iAddr), CbmTofAddress::GetRpcId(iAddr), + iChMiss, 0, CbmTofAddress::GetSmType(iAddr)); CbmTofCell* fChannelInfoMiss = fDigiPar->GetCell(iAddrMiss); if (NULL == fChannelInfoMiss) { - LOG(fatal) - << Form("Geo consistency check 0x%08x, 0x%08x failed at " - "St%d, z=%7.2f,%7.2f: iChTrafo %d, Miss %d , " - "xloc %6.2f, dx %4.2f", - iAddr, - iAddrMiss, - iSt, - zPos, - zPosMiss, - iChTrafo, - iChMiss, - hitpos_local[0], - fChannelInfo->GetSizex()); + LOG(fatal) << Form("Geo consistency check 0x%08x, 0x%08x failed at " + "St%d, z=%7.2f,%7.2f: iChTrafo %d, Miss %d , " + "xloc %6.2f, dx %4.2f", + iAddr, iAddrMiss, iSt, zPos, zPosMiss, iChTrafo, iChMiss, hitpos_local[0], + fChannelInfo->GetSizex()); } - zPosMiss = - fChannelInfoMiss->GetZ() - + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); - - LOG(debug) << Form( - "Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: " - "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f", - iAddr, - iSt, - zPos, - zPosMiss, - iChTrafo, - iChMiss, - hitpos_local[0], - fChannelInfo->GetSizex()); + zPosMiss = fChannelInfoMiss->GetZ() + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1); + + LOG(debug) << Form("Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: " + "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f", + iAddr, iSt, zPos, zPosMiss, iChTrafo, iChMiss, hitpos_local[0], + fChannelInfo->GetSizex()); fChannelInfo = fChannelInfoMiss; iAddr = iAddrMiss; - } else + } + else zPosMiss = zPos; } if (iSt == fNReqStations - 1) LOG(debug) << Form("Missing hit in Last Station in event %d at " "local pos x %6.2f, y %6.2f, z %6.2f", - fiEvent, - hitpos_local[0], - hitpos_local[1], - zPos); + fiEvent, hitpos_local[0], hitpos_local[1], zPos); vhXY_MissedStation[iSt]->Fill(hitpos_local[0], hitpos_local[1]); // correlation analysis for (Int_t iTrk1 = iTrk + 1; iTrk1 < fTrackArray->GetEntriesFast(); iTrk1++) { - CbmTofTracklet* pTrk1 = - (CbmTofTracklet*) fTrackArray->At(iTrk1); + CbmTofTracklet* pTrk1 = (CbmTofTracklet*) fTrackArray->At(iTrk1); if (NULL == pTrk1 || pTrk == pTrk1) continue; - if (pTrk1->GetNofHits() - >= fNReqStations) { // all possible hits are there - fhTrklDT0SmMis->Fill(iSt, - pTrk->GetFitT(0.) - pTrk1->GetFitT(0.)); - } else { - if (pTrk1->GetNofHits() - == fNReqStations - 1) { // one hit missing + if (pTrk1->GetNofHits() >= fNReqStations) { // all possible hits are there + fhTrklDT0SmMis->Fill(iSt, pTrk->GetFitT(0.) - pTrk1->GetFitT(0.)); + } + else { + if (pTrk1->GetNofHits() == fNReqStations - 1) { // one hit missing for (Int_t iSt1 = 0; iSt1 < fNTofStations; iSt1++) { - Int_t iH1 = pTrk1->GetStationHitIndex( - fMapStationRpcId[iSt1]); // Station Hit index - if ( - iH1 - < 0) { // find geo element for the missing Station iSt + Int_t iH1 = pTrk1->GetStationHitIndex(fMapStationRpcId[iSt1]); // Station Hit index + if (iH1 < 0) { // find geo element for the missing Station iSt //Int_t iSmType1 = fMapStationRpcId[iSt1]; (FU) not used //if (iSmType1 < 1) continue; - fhTrklDT0StMis2->Fill(Double_t(iSt * 10 + iSt1), - pTrk->GetFitT(0.) - - pTrk1->GetFitT(0.)); + fhTrklDT0StMis2->Fill(Double_t(iSt * 10 + iSt1), pTrk->GetFitT(0.) - pTrk1->GetFitT(0.)); } } } @@ -2363,11 +1759,8 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { } // velocity selection end } // loop over tracklets end - if (HMul.size() > 3) - fhTrklMulMaxMM->Fill(HMul[fNTofStations], HMul[fNTofStations - 1]); - if (HMul.size() > 5) - fhTrklMul3D->Fill( - HMul[fNTofStations], HMul[fNTofStations - 1], HMul[fNTofStations - 2]); + if (HMul.size() > 3) fhTrklMulMaxMM->Fill(HMul[fNTofStations], HMul[fNTofStations - 1]); + if (HMul.size() > 5) fhTrklMul3D->Fill(HMul[fNTofStations], HMul[fNTofStations - 1], HMul[fNTofStations - 2]); fhTrklMulNhits->Fill(fTofHitArray->GetEntriesFast(), iTMul); fhTrackingTimeNhits->Fill(fTofHitArray->GetEntriesFast(), fdTrackingTime); @@ -2402,15 +1795,11 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntriesFast(); iTrk++) { CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk); if (NULL == pTrk) continue; - if ( - pTrk->GetNofHits() - > fMinNofHits) { // for further analysis request min # of matched hits + if (pTrk->GetNofHits() > fMinNofHits) { // for further analysis request min # of matched hits for (Int_t iTrk1 = iTrk + 1; iTrk1 < fTrackArray->GetEntriesFast(); iTrk1++) { CbmTofTracklet* pTrk1 = (CbmTofTracklet*) fTrackArray->At(iTrk1); if (NULL == pTrk1) continue; - if ( - pTrk1->GetNofHits() - > fMinNofHits) { // for further analysis request min # of matched hits + if (pTrk1->GetNofHits() > fMinNofHits) { // for further analysis request min # of matched hits //cout << " -D- iT "<<iTrk<<", iT1 "<<iTrk1<<endl; fhTrklT0Mul->Fill(iTMul, pTrk->GetFitT(0.) - pTrk1->GetFitT(0.)); } @@ -2419,11 +1808,9 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { } } - LOG(debug1) << Form("CbmTofFindTracks::FillHistograms: HMul.size() %u ", - (UInt_t) HMul.size()); + LOG(debug1) << Form("CbmTofFindTracks::FillHistograms: HMul.size() %u ", (UInt_t) HMul.size()); for (UInt_t uHMul = 2; uHMul < HMul.size(); uHMul++) { - LOG(debug1) << Form( - "CbmTofFindTracks::FillHistograms() HMul %u, #%d", uHMul, HMul[uHMul]); + LOG(debug1) << Form("CbmTofFindTracks::FillHistograms() HMul %u, #%d", uHMul, HMul[uHMul]); if (HMul[uHMul] > 0) { fhTrklHMul->Fill(uHMul, HMul[uHMul]); } } @@ -2433,8 +1820,7 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { Int_t iAddr = (pHit->GetAddress() & DetMask); fhAllHitsSmTypes->Fill(GetStationOfAddr(iAddr)); //cout << " -D- " << iSmType <<", " << fTypeStation[iSmType] << endl; - if (GetStationOfAddr(iAddr) > -1) - fhAllHitsStation->Fill(GetStationOfAddr(iAddr)); + if (GetStationOfAddr(iAddr) > -1) fhAllHitsStation->Fill(GetStationOfAddr(iAddr)); } // vertex stuff fhVTXNorm->Fill(fVTXNorm); @@ -2445,20 +1831,19 @@ void CbmTofFindTracks::FillHistograms(CbmEvent* tEvent) { if (NULL == pTrk) continue; if (Double_t w = pTrk->GetNofHits() > (Double_t) fMinNofHits) { if (fVTXNorm > w) { - Double_t DeltaT0 = - pTrk->GetFitT(0.) - - (fVTXNorm * fVTX_T - w * pTrk->GetFitT(0.)) / (fVTXNorm - w); + Double_t DeltaT0 = pTrk->GetFitT(0.) - (fVTXNorm * fVTX_T - w * pTrk->GetFitT(0.)) / (fVTXNorm - w); fhVTX_DT0_Norm->Fill(fVTXNorm, DeltaT0); } } } } - if (0 == fMapStationRpcId[0]) { // Generated Pseudo TofHit at origin + if (0 == fMapStationRpcId[0]) { // Generated Pseudo TofHit at origin fTofHitArray->RemoveAt(fTofHitArray->GetEntriesFast() - 1); // remove added hit } } -void CbmTofFindTracks::SetStations(Int_t ival) { +void CbmTofFindTracks::SetStations(Int_t ival) +{ fStationType.resize(fNTofStations); for (Int_t i = 0; i < 10; i++) fTypeStation[i] = -1; // initialize @@ -2473,27 +1858,21 @@ void CbmTofFindTracks::SetStations(Int_t ival) { } } -void CbmTofFindTracks::SetStation(Int_t iVal, - Int_t iModType, - Int_t iModId, - Int_t iRpcId) { +void CbmTofFindTracks::SetStation(Int_t iVal, Int_t iModType, Int_t iModId, Int_t iRpcId) +{ Int_t iCenterCh = 0; - if (NULL != fDigiBdfPar) - iCenterCh = - TMath::Floor((fDigiBdfPar->GetNbChan(iModType, iRpcId) - 1) / 2); - Int_t iAddr = - CbmTofAddress::GetUniqueAddress(iModId, iRpcId, iCenterCh, 0, iModType); + if (NULL != fDigiBdfPar) iCenterCh = TMath::Floor((fDigiBdfPar->GetNbChan(iModType, iRpcId) - 1) / 2); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(iModId, iRpcId, iCenterCh, 0, iModType); fMapStationRpcId[iVal] = iAddr; } -void CbmTofFindTracks::SetBeamCounter(Int_t iModType, - Int_t iModId, - Int_t iRpcId) { - fiBeamCounter = - CbmTofAddress::GetUniqueAddress(iModId, iRpcId, 0, 0, iModType); +void CbmTofFindTracks::SetBeamCounter(Int_t iModType, Int_t iModId, Int_t iRpcId) +{ + fiBeamCounter = CbmTofAddress::GetUniqueAddress(iModId, iRpcId, 0, 0, iModType); } -Int_t CbmTofFindTracks::GetStationOfAddr(Int_t iAddr) { +Int_t CbmTofFindTracks::GetStationOfAddr(Int_t iAddr) +{ std::map<Int_t, Int_t>::iterator it; for (it = fMapStationRpcId.begin(); it != fMapStationRpcId.end(); it++) //std::map <Int_t, Int_t>::iterator it = fMapStationRpcId.find(iAddr); @@ -2509,61 +1888,59 @@ Int_t CbmTofFindTracks::GetStationOfAddr(Int_t iAddr) { return it->first; } -void CbmTofFindTracks::PrintSetup() { - for (std::map<Int_t, Int_t>::iterator it = fMapStationRpcId.begin(); - it != fMapStationRpcId.end(); - it++) { - cout << " <I> Tracking station " << it->first << " contains RpcId " - << Form("0x%08x", it->second) << endl; +void CbmTofFindTracks::PrintSetup() +{ + for (std::map<Int_t, Int_t>::iterator it = fMapStationRpcId.begin(); it != fMapStationRpcId.end(); it++) { + cout << " <I> Tracking station " << it->first << " contains RpcId " << Form("0x%08x", it->second) << endl; } } -Double_t CbmTofFindTracks::GetTOff(Int_t iAddr) { +Double_t CbmTofFindTracks::GetTOff(Int_t iAddr) +{ //cout << Form(" <D> GetTOff for 0x%08x at HistoIndex %d: %7.1f ", iAddr, fMapRpcIdParInd[iAddr], //(Double_t)fhPullT_Smt_Off->GetBinContent( fMapRpcIdParInd[iAddr] + 1)) <<endl; return (Double_t) fhPullT_Smt_Off->GetBinContent(fMapRpcIdParInd[iAddr] + 1); } -Double_t CbmTofFindTracks::GetSigT(Int_t iAddr) { - return (Double_t) fhPullT_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] - + 1); +Double_t CbmTofFindTracks::GetSigT(Int_t iAddr) +{ + return (Double_t) fhPullT_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] + 1); } -Double_t CbmTofFindTracks::GetSigX(Int_t iAddr) { - return (Double_t) fhPullX_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] - + 1); +Double_t CbmTofFindTracks::GetSigX(Int_t iAddr) +{ + return (Double_t) fhPullX_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] + 1); } -Double_t CbmTofFindTracks::GetSigY(Int_t iAddr) { - return (Double_t) fhPullY_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] - + 1); +Double_t CbmTofFindTracks::GetSigY(Int_t iAddr) +{ + return (Double_t) fhPullY_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] + 1); } -Double_t CbmTofFindTracks::GetSigZ(Int_t iAddr) { - return (Double_t) fhPullZ_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] - + 1); +Double_t CbmTofFindTracks::GetSigZ(Int_t iAddr) +{ + return (Double_t) fhPullZ_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr] + 1); } -Int_t CbmTofFindTracks::GetNStationsFired() { +Int_t CbmTofFindTracks::GetNStationsFired() +{ Int_t iNSt = 0; for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { if (fStationHMul[iSt] > 0 && fStationHMul[iSt] < fiStationMaxHMul) iNSt++; - LOG(debug2) << Form("Station %d, Addr 0x%08x, HMul %d, Max %d, Sum %d", - iSt, - GetAddrOfStation(iSt), - fStationHMul[iSt], - fiStationMaxHMul, - iNSt); + LOG(debug2) << Form("Station %d, Addr 0x%08x, HMul %d, Max %d, Sum %d", iSt, GetAddrOfStation(iSt), + fStationHMul[iSt], fiStationMaxHMul, iNSt); } return iNSt; } -void CbmTofFindTracks::ResetStationsFired() { +void CbmTofFindTracks::ResetStationsFired() +{ for (Int_t iSt = 0; iSt < fNTofStations; iSt++) fStationHMul[iSt] = 0; } -void CbmTofFindTracks::FillUHits() { +void CbmTofFindTracks::FillUHits() +{ // collect unused hits in active tracking stations Int_t iNbUHits = 0; for (Int_t iHit = 0; iHit < fTofHitArray->GetEntriesFast(); iHit++) { @@ -2576,7 +1953,8 @@ void CbmTofFindTracks::FillUHits() { } } -Bool_t CbmTofFindTracks::CheckHit2Track(CbmTofHit* pHit) { +Bool_t CbmTofFindTracks::CheckHit2Track(CbmTofHit* pHit) +{ Int_t iAddr = (pHit->GetAddress() & DetMask); Int_t iSt = GetStationOfAddr(iAddr); if (iSt < 0 || iSt >= GetNofStations()) return kFALSE; @@ -2588,39 +1966,32 @@ Bool_t CbmTofFindTracks::CheckHit2Track(CbmTofHit* pHit) { Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()); LOG(debug) << Form("Test Trk %d with HMul %d for Addr 0x%08x in station %d " "with dx %5.1f, dy %5.1f, dt %5.1f", - iTrk, - pTrk->GetNofHits(), - iAddr, - iSt, - dDX, - dDY, - dDT); + iTrk, pTrk->GetNofHits(), iAddr, iSt, dDX, dDY, dDT); if (!(pTrk->ContainsAddr(iAddr))) { LOG(debug3) << "Fill histo " << vhUDXDY_DT[iSt]->GetName(); vhUDXDY_DT[iSt]->Fill(dDX, dDY, dDT); - } else { + } + else { vhUCDXDY_DT[iSt]->Fill(dDX, dDY, dDT); } } return kFALSE; } -void CbmTofFindTracks::CheckMaxHMul() { +void CbmTofFindTracks::CheckMaxHMul() +{ fInspectEvent = kTRUE; for (Int_t iSt = 0; iSt < fNTofStations; iSt++) { - if (fStationHMul[iSt] > fiStationMaxHMul) { - fInspectEvent = kFALSE; - } else { - if (fMapStationRpcId[iSt] == fiBeamCounter - && fStationHMul[iSt] > fiBeamMaxHMul) { - fInspectEvent = kFALSE; - } + if (fStationHMul[iSt] > fiStationMaxHMul) { fInspectEvent = kFALSE; } + else { + if (fMapStationRpcId[iSt] == fiBeamCounter && fStationHMul[iSt] > fiBeamMaxHMul) { fInspectEvent = kFALSE; } } } } -void CbmTofFindTracks::PrintMapRpcIdParInd() { +void CbmTofFindTracks::PrintMapRpcIdParInd() +{ std::map<Int_t, Int_t>::iterator it = fMapRpcIdParInd.begin(); while (it != fMapRpcIdParInd.end()) { LOG(info) << Form("MapRpcIdParInd: %d, 0x%08x ", it->second, it->first);