From 8538d1e2da71bac819322eeefe15cf957dec3473 Mon Sep 17 00:00:00 2001 From: Norbert Herrmann <n.herrmann@physi.uni-heidelberg.de> Date: Sat, 20 Mar 2021 08:59:03 +0100 Subject: [PATCH] format changes --- MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx | 2960 +++------ MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx | 498 +- .../unpacker/CbmMcbm2018UnpackerAlgoTof.cxx | 553 +- macro/beamtime/pl_all_CluRateRatio.C | 87 +- .../tof/Create_TOF_Geometry_v21a_mcbm.C | 503 +- macro/mcbm/mcbm_hadron_analysis_nh.C | 198 +- reco/detectors/tof/CbmTofCalibrator.cxx | 400 +- reco/detectors/tof/CbmTofEventClusterizer.cxx | 5428 ++++++----------- reco/detectors/tof/CbmTofEventClusterizer.h | 191 +- reco/detectors/tof/CbmTofExtendTracks.cxx | 977 +-- 10 files changed, 3915 insertions(+), 7880 deletions(-) diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx index 12066ade69..1d73748e43 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx @@ -51,6 +51,7 @@ #include "TROOT.h" #include "TRandom3.h" #include "TVector3.h" +#include <thread> // this_thread::sleep_for #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> @@ -58,10 +59,8 @@ #include <chrono> #include <iomanip> -#include <string> -#include <thread> // this_thread::sleep_for - #include <stdexcept> +#include <string> struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -221,7 +220,8 @@ CbmDeviceHitBuilderTof::CbmDeviceHitBuilderTof() { } -CbmDeviceHitBuilderTof::~CbmDeviceHitBuilderTof() { +CbmDeviceHitBuilderTof::~CbmDeviceHitBuilderTof() +{ if (NULL != fOutRootFile) { LOG(info) << "Finally close root file " << fOutRootFile->GetName(); fOutRootFile->cd(); @@ -233,7 +233,8 @@ CbmDeviceHitBuilderTof::~CbmDeviceHitBuilderTof() { } } -void CbmDeviceHitBuilderTof::InitTask() try { +void CbmDeviceHitBuilderTof::InitTask() +try { // Get the information about created channels from the device // Check if the defined channels from the topology (by name) // are in the list of channels which are possible/allowed @@ -246,10 +247,8 @@ void CbmDeviceHitBuilderTof::InitTask() try { LOG(info) << "Number of defined input channels: " << noChannel; for (auto const& entry : fChannels) { LOG(info) << "Channel name: " << entry.first; - if (!IsChannelNameAllowed(entry.first)) - throw InitTaskError("Channel name does not match."); - if (entry.first != "syscmd") - OnData(entry.first, &CbmDeviceHitBuilderTof::HandleData); + if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); + if (entry.first != "syscmd") OnData(entry.first, &CbmDeviceHitBuilderTof::HandleData); else OnData(entry.first, &CbmDeviceHitBuilderTof::HandleMessage); } @@ -257,12 +256,14 @@ void CbmDeviceHitBuilderTof::InitTask() try { InitContainers(); LoadGeometry(); InitRootOutput(); -} catch (InitTaskError& e) { +} +catch (InitTaskError& e) { LOG(error) << e.what(); ChangeState(fair::mq::Transition::ErrorFound); } -bool CbmDeviceHitBuilderTof::IsChannelNameAllowed(std::string channelName) { +bool CbmDeviceHitBuilderTof::IsChannelNameAllowed(std::string channelName) +{ for (auto const& entry : fAllowedChannels) { std::size_t pos1 = channelName.find(entry); if (pos1 != std::string::npos) { @@ -270,19 +271,17 @@ bool CbmDeviceHitBuilderTof::IsChannelNameAllowed(std::string channelName) { std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry); const vector<std::string>::size_type idx = pos - fAllowedChannels.begin(); LOG(info) << "Found " << entry << " in " << channelName; - LOG(info) << "Channel name " << channelName - << " found in list of allowed channel names at position " - << idx; + LOG(info) << "Channel name " << channelName << " found in list of allowed channel names at position " << idx; return true; } } - LOG(info) << "Channel name " << channelName - << " not found in list of allowed channel names."; + LOG(info) << "Channel name " << channelName << " not found in list of allowed channel names."; LOG(error) << "Stop device."; return false; } -Bool_t CbmDeviceHitBuilderTof::InitWorkspace() { +Bool_t CbmDeviceHitBuilderTof::InitWorkspace() +{ LOG(info) << "Init work space for CbmDeviceHitBuilderTof."; fOutRootFileName = fConfig->GetValue<string>("OutRootFile"); fiMaxEvent = fConfig->GetValue<int64_t>("MaxEvent"); @@ -321,8 +320,8 @@ Bool_t CbmDeviceHitBuilderTof::InitWorkspace() { fRun->SetSink(new FairRootFileSink(fOutRootFileName)); fOutRootFile = rootMgr->GetOutFile(); if (NULL == fOutRootFile) LOG(fatal) << "could not open root file"; - - } else + } + else LOG(fatal) << "could not init Sink"; } @@ -346,7 +345,8 @@ Bool_t CbmDeviceHitBuilderTof::InitWorkspace() { return kTRUE; } -Bool_t CbmDeviceHitBuilderTof::InitRootOutput() { +Bool_t CbmDeviceHitBuilderTof::InitRootOutput() +{ if (NULL != fOutRootFile) { LOG(info) << "Init Root Output to " << fOutRootFile->GetName(); @@ -383,7 +383,8 @@ Bool_t CbmDeviceHitBuilderTof::InitRootOutput() { } -Bool_t CbmDeviceHitBuilderTof::InitContainers() { +Bool_t CbmDeviceHitBuilderTof::InitContainers() +{ LOG(info) << "Init parameter containers for CbmDeviceHitBuilderTof."; FairRuntimeDb* fRtdb = FairRuntimeDb::instance(); @@ -419,24 +420,20 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { CbmMQTMessage tmsg(rep->GetData(), rep->GetSize()); switch (iSet) { case 0: - fDigiPar = - static_cast<CbmTofDigiPar*>(tmsg.ReadObject(tmsg.GetClass())); + fDigiPar = static_cast<CbmTofDigiPar*>(tmsg.ReadObject(tmsg.GetClass())); //fDigiPar->print(); break; case 1: - fDigiBdfPar = static_cast<CbmTofDigiBdfPar*>( - tmsg.ReadObject(tmsg.GetClass())); + fDigiBdfPar = static_cast<CbmTofDigiBdfPar*>(tmsg.ReadObject(tmsg.GetClass())); //fDigiBdfPar->print(); - LOG(info) << "Calib data file: " - << fDigiBdfPar->GetCalibFileName(); + LOG(info) << "Calib data file: " << fDigiBdfPar->GetCalibFileName(); fdMaxTimeDist = fDigiBdfPar->GetMaxTimeDist(); // in ns fdMaxSpaceDist = fDigiBdfPar->GetMaxDistAlongCh(); // in cm if (fMaxTimeDist != fdMaxTimeDist) { - fdMaxTimeDist = fMaxTimeDist; // modify default - fdMaxSpaceDist = - fdMaxTimeDist * fDigiBdfPar->GetSignalSpeed() - * 0.5; // cut consistently on positions (with default signal velocity) + fdMaxTimeDist = fMaxTimeDist; // modify default + fdMaxSpaceDist = fdMaxTimeDist * fDigiBdfPar->GetSignalSpeed() + * 0.5; // cut consistently on positions (with default signal velocity) } break; @@ -445,9 +442,7 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { cont->init(); cont->Print(); //fRtdb->InitContainer(parSet[iSet]); - if (NULL == fGeoMan) - fGeoMan = (TGeoManager*) ((FairGeoParSet*) cont) - ->GetGeometry(); //crashes + if (NULL == fGeoMan) fGeoMan = (TGeoManager*) ((FairGeoParSet*) cont)->GetGeometry(); //crashes LOG(info) << "GeoMan: " << fGeoMan << " " << gGeoManager; iGeoVersion = fGeoHandler->Init(isSimulation); if (k21a > iGeoVersion) { @@ -465,12 +460,10 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { assert(fRtdb); } // create digitization parameters from geometry file - tofDigiPar = - new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); + tofDigiPar = new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); LOG(info) << "Create DigiPar "; tofDigiPar->Init(); - fDigiPar = - (CbmTofDigiPar*) (fRtdb->getContainer("CbmTofDigiPar")); + fDigiPar = (CbmTofDigiPar*) (fRtdb->getContainer("CbmTofDigiPar")); if (NULL == fDigiPar) { LOG(error) << "CbmTofEventClusterizer::InitParameters => " "Could not obtain " @@ -483,11 +476,11 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { case 3: // Calib break; - default: - LOG(warn) << "Parameter Set " << iSet << " not implemented "; + default: LOG(warn) << "Parameter Set " << iSet << " not implemented "; } LOG(info) << "Received parameter from server:"; - } else { + } + else { LOG(warn) << "Received empty reply. Parameter not available"; } } @@ -497,24 +490,20 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { CreateHistograms(); - if (!InitCalibParameter()) - return kFALSE; // ChangeState(PAUSE); // for debugging - - fDutAddr = CbmTofAddress::GetUniqueAddress(fDutSm, fDutRpc, 0, 0, fDutId); - fSelAddr = CbmTofAddress::GetUniqueAddress(fSelSm, fSelRpc, 0, 0, fSelId); - fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, fSel2Rpc, 0, 0, fSel2Id); - fiBeamRefAddr = CbmTofAddress::GetUniqueAddress( - fiBeamRefSm, fiBeamRefDet, 0, 0, fiBeamRefType); - iIndexDut = fDigiBdfPar->GetDetInd(fDutAddr); - LOG(info) << Form("Use Dut 0x%08x, Sel 0x%08x, Sel2 0x%08x, BRef 0x%08x", - fDutAddr, - fSelAddr, - fSel2Addr, + if (!InitCalibParameter()) return kFALSE; // ChangeState(PAUSE); // for debugging + + fDutAddr = CbmTofAddress::GetUniqueAddress(fDutSm, fDutRpc, 0, 0, fDutId); + fSelAddr = CbmTofAddress::GetUniqueAddress(fSelSm, fSelRpc, 0, 0, fSelId); + fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, fSel2Rpc, 0, 0, fSel2Id); + fiBeamRefAddr = CbmTofAddress::GetUniqueAddress(fiBeamRefSm, fiBeamRefDet, 0, 0, fiBeamRefType); + iIndexDut = fDigiBdfPar->GetDetInd(fDutAddr); + LOG(info) << Form("Use Dut 0x%08x, Sel 0x%08x, Sel2 0x%08x, BRef 0x%08x", fDutAddr, fSelAddr, fSel2Addr, fiBeamRefAddr); return initOK; } -Bool_t CbmDeviceHitBuilderTof::ReInitContainers() { +Bool_t CbmDeviceHitBuilderTof::ReInitContainers() +{ LOG(info) << "ReInit parameter containers for CbmDeviceHitBuilderTof."; return kTRUE; @@ -522,30 +511,27 @@ Bool_t CbmDeviceHitBuilderTof::ReInitContainers() { // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) //bool CbmDeviceHitBuilderTof::HandleData(FairMQMessagePtr& msg, int /*index*/) -bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { +bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) +{ // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add // an output fNumMessages++; - LOG(debug) << "Received message " << fNumMessages << " with " << parts.Size() - << " parts" + LOG(debug) << "Received message " << fNumMessages << " with " << parts.Size() << " parts" << ", size0: " << parts.At(0)->GetSize(); - std::string msgStrE(static_cast<char*>(parts.At(0)->GetData()), - (parts.At(0))->GetSize()); + std::string msgStrE(static_cast<char*>(parts.At(0)->GetData()), (parts.At(0))->GetSize()); std::istringstream issE(msgStrE); boost::archive::binary_iarchive inputArchiveE(issE); inputArchiveE >> fEventHeader; - LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1] - << " " << fEventHeader[2]; + LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1] << " " << fEventHeader[2]; fiNDigiIn = 0; // LOG(debug) << "Received message # "<< fNumMessages // << " with size " << msg->GetSize()<<" at "<< msg->GetData(); //std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize()); - std::string msgStr(static_cast<char*>(parts.At(1)->GetData()), - (parts.At(1))->GetSize()); + std::string msgStr(static_cast<char*>(parts.At(1)->GetData()), (parts.At(1))->GetSize()); std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); @@ -562,8 +548,7 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { //vector descriptor and data separated -> transfer of vectors does not work reliably //std::vector<CbmTofDigi>* vdigi = static_cast<std::vector<CbmTofDigi>*>(msg->GetData()); // (*vdigi).resize(fiNDigiIn); - LOG(debug) << "vdigi vector at " << vdigi.data() << " with size " - << vdigi.size(); + LOG(debug) << "vdigi vector at " << vdigi.data() << " with size " << vdigi.size(); for (UInt_t iDigi = 0; iDigi < vdigi.size(); iDigi++) { LOG(debug) << "#" << iDigi << " " << vdigi[iDigi]->ToString(); @@ -612,8 +597,7 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { fTofDigiMatchColl->Clear("C"); fiNbHits = 0; - if (fNumMessages % 10000 == 0) - LOG(info) << "Processed " << fNumMessages << " messages"; + if (fNumMessages % 10000 == 0) LOG(info) << "Processed " << fNumMessages << " messages"; if (fEventHeader.size() > 3) { fhPulMul->Fill((Double_t) fEventHeader[3]); if (fEventHeader[3] > 0) { @@ -623,11 +607,9 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { } } - LOG(debug) << " Process msg " << fNumMessages << " at evt " << fdEvent - << ", PulMode " << fiPulserMode; + LOG(debug) << " Process msg " << fNumMessages << " at evt " << fdEvent << ", PulMode " << fiPulserMode; - if (fiPulserMode - > 0) { // don't process events without valid pulser correction + if (fiPulserMode > 0) { // don't process events without valid pulser correction if (fvPulserTimes[fiPulDetRef][0].size() == 0) return kTRUE; } @@ -657,8 +639,7 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { ChangeState(fair::mq::Transition::Stop); } } - if (!FillHistos()) - return kTRUE; // event not selected for histogramming, skip sending it + if (!FillHistos()) return kTRUE; // event not selected for histogramming, skip sending it //if(!SendHits()) return kFALSE; if (!SendAll()) return kFALSE; @@ -667,8 +648,8 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) { /************************************************************************************/ -bool CbmDeviceHitBuilderTof::HandleMessage(FairMQMessagePtr& msg, - int /*index*/) { +bool CbmDeviceHitBuilderTof::HandleMessage(FairMQMessagePtr& msg, int /*index*/) +{ const char* cmd = (char*) (msg->GetData()); const char cmda[4] = {*cmd}; LOG(info) << "Handle message " << cmd << ", " << cmd[0]; @@ -706,7 +687,8 @@ bool CbmDeviceHitBuilderTof::HandleMessage(FairMQMessagePtr& msg, } /************************************************************************************/ -Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { +Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() +{ // dimension and initialize calib parameter // Int_t iNbDet = fDigiBdfPar->GetNbDet(); Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes(); @@ -737,8 +719,7 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { // LOG(info)<<Form(" fvCPDelTof for SmT %d, R %d, B %d",iSmType,iSm*iNbRpc+iRpc,iBx); fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx].resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] = - 0.; // initialize + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] = 0.; // initialize } Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc); @@ -753,14 +734,10 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide); fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide); for (Int_t iSide = 0; iSide < nbSide; iSide++) { - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 0.; //initialize - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 1.; //initialize - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 0.; //initialize - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize( - nbClWalkBinX); + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.; //initialize + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 1.; //initialize + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.; //initialize + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize(nbClWalkBinX); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide][iWx] = 0.; } @@ -771,8 +748,7 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { } LOG(info) << "defaults set"; - TDirectory* oldir = - gDirectory; // <= 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 ! */ @@ -797,10 +773,9 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { fCalParFile->ls(); */ for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) { - Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType); - Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); - TProfile* hSvel = - (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iSmType)); + Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType); + Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); + TProfile* hSvel = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iSmType)); // copy Histo to memory TDirectory* curdir = gDirectory; @@ -809,13 +784,13 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { //TProfile *hSvelmem = //(TProfile*) hSvel->Clone(); gDirectory->cd(curdir->GetPath()); - } else { + } + else { LOG(info) << "Svel histogram not found for module type " << iSmType; } for (Int_t iPar = 0; iPar < 4; iPar++) { - TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny( - Form("cl_SmT%01d_Fpar%1d", iSmType, iPar)); + TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Fpar%1d", iSmType, iPar)); if (NULL != hFparcur) { gDirectory->cd(oldir->GetPath()); //TProfile *hFparmem = @@ -830,97 +805,61 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { if (NULL != hSvel) { Double_t Vscal = 1.; //hSvel->GetBinContent(iSm*iNbRpc+iRpc+1); if (Vscal == 0.) Vscal = 1.; - fDigiBdfPar->SetSigVel(iSmType, - iSm, - iRpc, - fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * Vscal); - LOG(info) << "Modify " << iSmType << iSm << iRpc << " Svel by " - << Vscal << " to " + fDigiBdfPar->SetSigVel(iSmType, iSm, iRpc, fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * Vscal); + LOG(info) << "Modify " << iSmType << iSm << iRpc << " Svel by " << Vscal << " to " << fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); } - TH2F* htempPos_pfx = (TH2F*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); - TH2F* htempTOff_pfx = (TH2F*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); - TH1D* htempTot_Mean = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); - TH1D* htempTot_Off = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); - if (NULL != htempPos_pfx && NULL != htempTOff_pfx - && NULL != htempTot_Mean && NULL != htempTot_Off) { + TH2F* htempPos_pfx = + (TH2F*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); + TH2F* htempTOff_pfx = + (TH2F*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); + TH1D* htempTot_Mean = + (TH1D*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); + TH1D* htempTot_Off = + (TH1D*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); + if (NULL != htempPos_pfx && NULL != htempTOff_pfx && NULL != htempTot_Mean && NULL != htempTot_Off) { Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); Int_t iNbinTot = htempTot_Mean->GetNbinsX(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) { - Double_t YMean = ((TProfile*) htempPos_pfx) - ->GetBinContent(iCh + 1); //nh +1 empirical(?) - Double_t TMean = - ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); + Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1); //nh +1 empirical(?) + Double_t TMean = ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); //Double_t dTYOff=YMean/fDigiBdfPar->GetSignalSpeed() ; - Double_t dTYOff = - YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean; for (Int_t iSide = 0; iSide < 2; iSide++) { - Double_t TotMean = htempTot_Mean->GetBinContent( - iCh * 2 + 1 + iSide); //nh +1 empirical(?) - if (0.001 < TotMean) { - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= - fdTTotMean / TotMean; - } - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide); + Double_t TotMean = htempTot_Mean->GetBinContent(iCh * 2 + 1 + iSide); //nh +1 empirical(?) + if (0.001 < TotMean) { fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; } + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide); } if (5 == iSmType || 8 == iSmType) { - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; } LOG(debug) << "InitCalibParameter:" - << " SmT " << iSmType << " Sm " << iSm << " Rpc " - << iRpc << " Ch " << iCh + << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc << " Ch " << iCh << Form(": YMean %f, TMean %f", YMean, TMean) << " -> " - << Form( - " %f, %f, %f, %f ", - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + << Form(" %f, %f, %f, %f ", fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]) << ", NbinTot " << iNbinTot; TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); - if (NULL != htempWalk0 - && NULL != htempWalk1) { // reinitialize Walk array + Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); + if (NULL != htempWalk0 && NULL != htempWalk1) { // reinitialize Walk array LOG(debug) << "Initialize Walk correction for " - << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d", - iSmType, - iSm, - iRpc, - iCh); + << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d", iSmType, iSm, iRpc, iCh); if (htempWalk0->GetNbinsX() != nbClWalkBinX) - LOG(error) - << "InitCalibParameter: Inconsistent Walk histograms"; + LOG(error) << "InitCalibParameter: Inconsistent Walk histograms"; for (Int_t iBin = 0; iBin < nbClWalkBinX; iBin++) { - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] = - htempWalk0->GetBinContent(iBin + 1); - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = - htempWalk1->GetBinContent(iBin + 1); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] = htempWalk0->GetBinContent(iBin + 1); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = htempWalk1->GetBinContent(iBin + 1); //LOG(debug)<<Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ",iSmType, iSm, iRpc, iCh, iBin, // fvCPWalk[iSmType][iSm*iNbRpc+iRpc][iCh][0][iBin]); if (5 == iSmType || 8 == iSmType) { // Pad structure @@ -930,53 +869,32 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { } } } - } else { - LOG(warn) << " Calibration histos " - << Form( - "cl_SmT%01d_sm%03d_rpc%03d_XXX", iSmType, iSm, iRpc) + } + else { + LOG(warn) << " Calibration histos " << Form("cl_SmT%01d_sm%03d_rpc%03d_XXX", iSmType, iSm, iRpc) << " not found. "; } for (Int_t iSel = 0; iSel < iNSel; iSel++) { TH1D* htmpDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); if (NULL == htmpDelTof) { - LOG(debug) << " Histos " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel) + LOG(debug) << " Histos " << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel) << " not found. "; continue; } LOG(debug) << " Load DelTof from histos " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel) - << "."; + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel) << "."; for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) { - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += - htmpDelTof->GetBinContent(iBx + 1); + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += htmpDelTof->GetBinContent(iBx + 1); } // copy Histo to memory // TDirectory * curdir = gDirectory; gDirectory->cd(oldir->GetPath()); - TH1D* h1DelTof = (TH1D*) htmpDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* h1DelTof = + (TH1D*) htmpDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); - LOG(debug) << " copy histo " << h1DelTof->GetName() - << " to directory " << oldir->GetName(); + LOG(debug) << " copy histo " << h1DelTof->GetName() << " to directory " << oldir->GetName(); gDirectory->cd(curdir->GetPath()); } @@ -984,80 +902,46 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() { } } // fCalParFile->Delete(); - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! LOG(info) << "InitCalibParameter: initialization done"; return kTRUE; } +static TH2F* fhBucDigiCor = NULL; /************************************************************************************/ // Histogram definitions -void CbmDeviceHitBuilderTof::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 ! +void CbmDeviceHitBuilderTof::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 ! // process event header info - fhEvDetMul = - new TH1F("hEvDetMul", "Detector multiplicity of Selector; Mul", 50, 0, 50); - fhPulMul = new TH1F("hPulMul", "Pulser multiplicity; Mul", 110, 0, 110); + fhEvDetMul = new TH1F("hEvDetMul", "Detector multiplicity of Selector; Mul", 50, 0, 50); + fhPulMul = new TH1F("hPulMul", "Pulser multiplicity; Mul", 110, 0, 110); Int_t iNDet = 0; for (Int_t iModTyp = 0; iModTyp < 10; iModTyp++) iNDet += fDigiBdfPar->GetNbSm(iModTyp) * fDigiBdfPar->GetNbRpc(iModTyp); - fhPulserTimesRaw = - new TH2F(Form("hPulserTimesRaw"), - Form("Pulser Times uncorrected; Det# []; t - t0 [ns]"), - iNDet * 2, - 0, - iNDet * 2, - 999, - -100., - 100.); + fhPulserTimesRaw = new TH2F(Form("hPulserTimesRaw"), Form("Pulser Times uncorrected; Det# []; t - t0 [ns]"), + iNDet * 2, 0, iNDet * 2, 999, -100., 100.); fhPulserTimeRawEvo.resize(iNDet * 2); for (Int_t iDetSide = 0; iDetSide < iNDet * 2; iDetSide++) { fhPulserTimeRawEvo[iDetSide] = new TProfile( Form("hPulserTimeRawEvo_%d", iDetSide), - Form("Raw Pulser TimeEvolution %d; PulserEvent# ; DeltaT [ns] ", - iDetSide), - 1000, - 0., - 1.E5, - -100., - 100.); + Form("Raw Pulser TimeEvolution %d; PulserEvent# ; DeltaT [ns] ", iDetSide), 1000, 0., 1.E5, -100., 100.); } - fhPulserTimesCor = - new TH2F(Form("hPulserTimesCor"), - Form("Pulser Times corrected; Det# []; t - t0 [ns]"), - iNDet * 2, - 0, - iNDet * 2, - 999, - -10., - 10.); - - fhDigiTimesRaw = - new TH2F(Form("hDigiTimesRaw"), - Form("Digi Times uncorrected; Det# []; t - t0 [ns]"), - iNDet * 2, - 0, - iNDet * 2, - 999, - -100., - 100.); - - fhDigiTimesCor = new TH2F(Form("hDigiTimesCor"), - Form("Digi Times corrected; Det# []; t - t0 [ns]"), - iNDet * 2, - 0, - iNDet * 2, - 999, - -100., - 100.); + fhPulserTimesCor = new TH2F(Form("hPulserTimesCor"), Form("Pulser Times corrected; Det# []; t - t0 [ns]"), iNDet * 2, + 0, iNDet * 2, 999, -10., 10.); + + fhDigiTimesRaw = new TH2F(Form("hDigiTimesRaw"), Form("Digi Times uncorrected; Det# []; t - t0 [ns]"), iNDet * 2, 0, + iNDet * 2, 999, -100., 100.); + + fhDigiTimesCor = new TH2F(Form("hDigiTimesCor"), Form("Digi Times corrected; Det# []; t - t0 [ns]"), iNDet * 2, 0, + iNDet * 2, 999, -100., 100.); + + fhBucDigiCor = new TH2F(Form("hBucDigiCor"), Form("Buc Digi Correlation; ch1 []; ch2 []"), 128, 0, 128, 128, 0, 128); Int_t iNbDet = fDigiBdfPar->GetNbDet(); fDetIdIndexMap.clear(); @@ -1073,30 +957,14 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); fhRpcDigiTot[iDetIndx] = new TH2F( Form("hDigiTot_SmT%01d_sm%03d_rpc%03d", iSmType, iSmId, iRpcId), - Form("Digi Tot of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", - iRpcId, - iSmId, - iSmType), - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 256, - 0, - 256); - - fhRpcDigiCor[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iSmType, iSmId, iRpcId), - Form( - "Digi Correlation of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + Form("Digi Tot of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", iRpcId, iSmId, iSmType), + 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 256, 0, 256); + + fhRpcDigiCor[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iSmType, iSmId, iRpcId), + Form("Digi Correlation of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId)); } if (0 == fiMode) return; // no cluster histograms needed @@ -1135,58 +1003,39 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; fhSmCluPosition[iS] = - new TH2F(Form("cl_SmT%01d_Pos", iS), - Form("Clu position of SmType %d; Sm+Rpc# []; ypos [cm]", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -YDMAX, - YDMAX); + new TH2F(Form("cl_SmT%01d_Pos", iS), Form("Clu position of SmType %d; Sm+Rpc# []; ypos [cm]", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -YDMAX, YDMAX); Double_t TSumMax = 1.E3; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; fhSmCluTOff[iS] = - new TH2F(Form("cl_SmT%01d_TOff", iS), - Form("Clu TimeZero in SmType %d; Sm+Rpc# []; TOff [ns]", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -TSumMax, - TSumMax); - - TProfile* hSvelcur = - (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iS)); + new TH2F(Form("cl_SmT%01d_TOff", iS), Form("Clu TimeZero in SmType %d; Sm+Rpc# []; TOff [ns]", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -TSumMax, TSumMax); + + TProfile* hSvelcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iS)); if (NULL == hSvelcur) { - fhSmCluSvel[iS] = new TProfile( - Form("cl_SmT%01d_Svel", iS), - Form("Clu Svel in SmType %d; Sm+Rpc# []; v/v_{nominal} ", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0.8, - 1.2); + fhSmCluSvel[iS] = + new TProfile(Form("cl_SmT%01d_Svel", iS), Form("Clu Svel in SmType %d; Sm+Rpc# []; v/v_{nominal} ", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0.8, 1.2); fhSmCluSvel[iS]->Sumw2(); - } else + } + else fhSmCluSvel[iS] = (TProfile*) hSvelcur->Clone(); fhSmCluFpar[iS].resize(4); for (Int_t iPar = 0; iPar < 4; iPar++) { - TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny( - Form("cl_SmT%01d_Fpar%1d", iS, iPar)); + TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Fpar%1d", iS, iPar)); if (NULL == hFparcur) { - LOG(info) << "Histo " << Form("cl_SmT%01d_Fpar%1d", iS, iPar) - << " not found, recreate ..."; - fhSmCluFpar[iS][iPar] = new TProfile( - Form("cl_SmT%01d_Fpar%1d", iS, iPar), - Form("Clu Fpar %d in SmType %d; Sm+Rpc# []; value ", iPar, iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - -100., - 100.); - } else + LOG(info) << "Histo " << Form("cl_SmT%01d_Fpar%1d", iS, iPar) << " not found, recreate ..."; + fhSmCluFpar[iS][iPar] = new TProfile(Form("cl_SmT%01d_Fpar%1d", iS, iPar), + Form("Clu Fpar %d in SmType %d; Sm+Rpc# []; value ", iPar, iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), -100., 100.); + } + else fhSmCluFpar[iS][iPar] = (TProfile*) hFparcur->Clone(); } @@ -1194,42 +1043,23 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { fhTSmCluTOff[iS].resize(iNSel); fhTSmCluTRun[iS].resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Loop over selectors - fhTSmCluPosition[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_Pos", iS, iSel), - Form("Clu position of SmType %d under Selector %02d; Sm+Rpc# " - "[]; ypos [cm]", - iS, - iSel), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -YDMAX, - YDMAX); - fhTSmCluTOff[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_TOff", iS, iSel), - Form("Clu TimeZero in SmType %d under Selector %02d; Sm+Rpc# " - "[]; TOff [ns]", - iS, - iSel), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -TSumMax, - TSumMax); - fhTSmCluTRun[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_TRun", iS, iSel), - Form("Clu TimeZero in SmType %d under Selector %02d; Event# " - "[]; TMean [ns]", - iS, - iSel), - 100, - 0, - MaxNbEvent, - 99, - -TSumMax, - TSumMax); + fhTSmCluPosition[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_Pos", iS, iSel), + Form("Clu position of SmType %d under Selector %02d; Sm+Rpc# " + "[]; ypos [cm]", + iS, iSel), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -YDMAX, YDMAX); + fhTSmCluTOff[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_TOff", iS, iSel), + Form("Clu TimeZero in SmType %d under Selector %02d; Sm+Rpc# " + "[]; TOff [ns]", + iS, iSel), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -TSumMax, TSumMax); + fhTSmCluTRun[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_TRun", iS, iSel), + Form("Clu TimeZero in SmType %d under Selector %02d; Event# " + "[]; TMean [ns]", + iS, iSel), + 100, 0, MaxNbEvent, 99, -TSumMax, TSumMax); } } @@ -1263,265 +1093,131 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) { LOG(warn) << "No DigiPar for Det " << Form("0x%08x", iUCellId); continue; } - LOG(info) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " - << iSmId << ", RpcId " << iRpcId << " => UniqueId " - << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " - << fChannelInfo->GetSizex() << ", dy " << fChannelInfo->GetSizey() - << Form(" ChPoi: %p ", fChannelInfo) << ", nbCh " + LOG(info) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId + << " => UniqueId " << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " << fChannelInfo->GetSizex() + << ", dy " << fChannelInfo->GetSizey() << Form(" ChPoi: %p ", fChannelInfo) << ", nbCh " << fDigiBdfPar->GetNbChan(iSmType, 0); // check access to all channel infos for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { - Int_t iCCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, iCh, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iCCellId); - if (NULL == fChannelInfo) - LOG(warn) << Form( - "missing ChannelInfo for ch %d addr 0x%08x", iCh, iCCellId); + Int_t iCCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, iCh, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iCCellId); + if (NULL == fChannelInfo) LOG(warn) << Form("missing ChannelInfo for ch %d addr 0x%08x", iCh, iCCellId); } fChannelInfo = fDigiPar->GetCell(iUCellId); - fhRpcCluMul[iDetIndx] = new TH1F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Mul", iSmType, iSmId, iRpcId), - Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d; M []; Cnts", - iRpcId, - iSmId, - iSmType), - 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId)); - - fhRpcCluRate[iDetIndx] = new TH1F( - Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSmId, iRpcId), - Form("Clu rate of Rpc #%03d in Sm %03d of type %d; Time (s); Rate (Hz)", - iRpcId, - iSmId, - iSmType), - 3600., - 0., - 3600.); - - fhRpcDTLastHits[iDetIndx] = new TH1F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iSmType, iSmId, iRpcId), - Form("Clu #DeltaT to last hits of Rpc #%03d in Sm %03d of type %d; log( " - "#DeltaT (ns)); counts", - iRpcId, - iSmId, - iSmType), - 100., - 0., - 10.); - - fhRpcDTLastHits_Tot[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Tot_DTLH", iSmType, iSmId, iRpcId), - Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); TOT " - "[ns]", - iRpcId, - iSmId, - iSmType), - 100, - 0., - 10., - 100, - fdTOTMin, - 4. * fdTOTMax); - - fhRpcDTLastHits_CluSize[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_CluSize_DTLH", iSmType, iSmId, iRpcId), - Form("Clu Size of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); " - "CluSize []", - iRpcId, - iSmId, - iSmType), - 100, - 0., - 10., - 16, - 0.5, - 16.5); + fhRpcCluMul[iDetIndx] = + new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Mul", iSmType, iSmId, iRpcId), + Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d; M []; Cnts", iRpcId, iSmId, iSmType), + 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + + fhRpcCluRate[iDetIndx] = + new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSmId, iRpcId), + Form("Clu rate of Rpc #%03d in Sm %03d of type %d; Time (s); Rate (Hz)", iRpcId, iSmId, iSmType), 3600., + 0., 3600.); + + fhRpcDTLastHits[iDetIndx] = new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iSmType, iSmId, iRpcId), + Form("Clu #DeltaT to last hits of Rpc #%03d in Sm %03d of type %d; log( " + "#DeltaT (ns)); counts", + iRpcId, iSmId, iSmType), + 100., 0., 10.); + + fhRpcDTLastHits_Tot[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Tot_DTLH", iSmType, iSmId, iRpcId), + Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); TOT " + "[ns]", + iRpcId, iSmId, iSmType), + 100, 0., 10., 100, fdTOTMin, 4. * fdTOTMax); + + fhRpcDTLastHits_CluSize[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_CluSize_DTLH", iSmType, iSmId, iRpcId), + Form("Clu Size of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); " + "CluSize []", + iRpcId, iSmId, iSmType), + 100, 0., 10., 16, 0.5, 16.5); Double_t YSCAL = 50.; if (fPosYMaxScal != 0.) YSCAL = fPosYMaxScal; Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; - fhRpcCluPosition[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId), - Form( - "Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -YDMAX, - YDMAX); + fhRpcCluPosition[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId), + Form("Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -YDMAX, YDMAX); fhRpcCluDelPos[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelPos", iSmType, iSmId, iRpcId), Form("Clu position difference of Rpc #%03d in Sm %03d of type " "%d; Strip []; #Deltaypos(clu) [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -10., - 10.); - - fhRpcCluDelMatPos[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatPos", iSmType, iSmId, iRpcId), - Form("Matched Clu position difference of Rpc #%03d in Sm %03d of type " - "%d; Strip []; #Deltaypos(mat) [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -5., - 5.); + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -10., 10.); + + fhRpcCluDelMatPos[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatPos", iSmType, iSmId, iRpcId), + Form("Matched Clu position difference of Rpc #%03d in Sm %03d of type " + "%d; Strip []; #Deltaypos(mat) [cm]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -5., 5.); Double_t TSumMax = 1.E3; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; fhRpcCluTOff[iDetIndx] = new TH2F( Form("cl_SmT%01d_sm%03d_rpc%03d_TOff", iSmType, iSmId, iRpcId), - Form( - "Clu TimeZero of Rpc #%03d in Sm %03d of type %d; Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -TSumMax, - TSumMax); - - fhRpcCluDelTOff[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelTOff", iSmType, iSmId, iRpcId), - Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " - "[]; #DeltaTOff(clu) [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -0.6, - 0.6); - - fhRpcCluDelMatTOff[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatTOff", iSmType, iSmId, iRpcId), - Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " - "[]; #DeltaTOff(mat) [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -0.6, - 0.6); - - fhRpcCluTrms[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Trms", iSmType, iSmId, iRpcId), - Form( - "Clu Time RMS of Rpc #%03d in Sm %03d of type %d; Strip []; Trms [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - 0., - 0.5); - - fhRpcCluTot[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId), - Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [ns]", - iRpcId, - iSmId, - iSmType), - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - fdTOTMin, - fdTOTMax); - - fhRpcCluSize[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Size", iSmType, iSmId, iRpcId), - Form( - "Clu size of Rpc #%03d in Sm %03d of type %d; Strip []; size [strips]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 16, - 0.5, - 16.5); + Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d; Strip []; TOff [ns]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -TSumMax, TSumMax); + + fhRpcCluDelTOff[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelTOff", iSmType, iSmId, iRpcId), + Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " + "[]; #DeltaTOff(clu) [ns]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -0.6, 0.6); + + fhRpcCluDelMatTOff[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatTOff", iSmType, iSmId, iRpcId), + Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " + "[]; #DeltaTOff(mat) [ns]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -0.6, 0.6); + + fhRpcCluTrms[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Trms", iSmType, iSmId, iRpcId), + Form("Clu Time RMS of Rpc #%03d in Sm %03d of type %d; Strip []; Trms [ns]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, 0., 0.5); + + fhRpcCluTot[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId), + Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [ns]", iRpcId, iSmId, iSmType), + 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, + fdTOTMin, fdTOTMax); + + fhRpcCluSize[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Size", iSmType, iSmId, iRpcId), + Form("Clu size of Rpc #%03d in Sm %03d of type %d; Strip []; size [strips]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 16, 0.5, 16.5); // Walk histos - fhRpcCluAvWalk[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), - Form("Walk in SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); - - fhRpcCluAvLnWalk[iDetIndx] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), - Form("Walk in SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), - nbClWalkBinX, - TMath::Log10(fdTOTMax / 50.), - TMath::Log10(fdTOTMax), - nbClWalkBinY, - -TSumMax, - TSumMax); + fhRpcCluAvWalk[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), + Form("Walk in SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); + + fhRpcCluAvLnWalk[iDetIndx] = + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), + Form("Walk in SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), nbClWalkBinX, + TMath::Log10(fdTOTMax / 50.), TMath::Log10(fdTOTMax), nbClWalkBinY, -TSumMax, TSumMax); fhRpcCluWalk[iDetIndx].resize(fDigiBdfPar->GetNbChan(iSmType, iRpcId)); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { fhRpcCluWalk[iDetIndx][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { fhRpcCluWalk[iDetIndx][iCh][iSide] = - new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), - Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", iSmType, iSmId, iRpcId, iCh, iSide), + Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", iSmType, iSmId, iRpcId, iCh, iSide), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); } /* (fhRpcCluWalk[iDetIndx]).push_back( hTemp ); @@ -1534,14 +1230,8 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { fhSeldT.resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) { - fhSeldT[iSel] = new TH2F(Form("cl_dt_Sel%02d", iSel), - Form("Selector time %02d; dT [ns]", iSel), - 99, - -fdDelTofMax * 10., - fdDelTofMax * 10., - 16, - -0.5, - 15.5); + fhSeldT[iSel] = new TH2F(Form("cl_dt_Sel%02d", iSel), Form("Selector time %02d; dT [ns]", iSel), 99, + -fdDelTofMax * 10., fdDelTofMax * 10., 16, -0.5, 15.5); } fhTRpcCluMul.resize(iNbDet); @@ -1563,21 +1253,16 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) { LOG(warn) << "No DigiPar for Det " << Form("0x%08x", iUCellId); continue; } - LOG(debug) << "DetIndx " << iDetIndx << ", SmType " << iSmType - << ", SmId " << iSmId << ", RpcId " << iRpcId - << " => UniqueId " - << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " - << fChannelInfo->GetSizex() << ", dy " - << fChannelInfo->GetSizey() - << Form(" poi: 0x%p ", fChannelInfo) << ", nbCh " - << fDigiBdfPar->GetNbChan(iSmType, iRpcId); + LOG(debug) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId + << " => UniqueId " << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " + << fChannelInfo->GetSizex() << ", dy " << fChannelInfo->GetSizey() << Form(" poi: 0x%p ", fChannelInfo) + << ", nbCh " << fDigiBdfPar->GetNbChan(iSmType, iRpcId); fhTRpcCluMul[iDetIndx].resize(iNSel); fhTRpcCluPosition[iDetIndx].resize(iNSel); @@ -1595,281 +1280,119 @@ void CbmDeviceHitBuilderTof::CreateHistograms() { for (Int_t iSel = 0; iSel < iNSel; iSel++) { fhTRpcCluMul[iDetIndx][iSel] = - new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Mul", - iSmType, - iSmId, - iRpcId, - iSel), + new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Mul", iSmType, iSmId, iRpcId, iSel), Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d " "under Selector %02d; M []; cnts", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0., - fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0., fDigiBdfPar->GetNbChan(iSmType, iRpcId)); - if (NULL == fhTRpcCluMul[iDetIndx][iSel]) - LOG(error) << " Histo not generated !"; + if (NULL == fhTRpcCluMul[iDetIndx][iSel]) LOG(error) << " Histo not generated !"; Double_t YSCAL = 50.; if (fPosYMaxScal != 0.) YSCAL = fPosYMaxScal; - Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; - fhTRpcCluPosition[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Pos", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu position of Rpc #%03d in Sm %03d of type %d under " - "Selector %02d; Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - -YDMAX, - YDMAX); + Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; + fhTRpcCluPosition[iDetIndx][iSel] = new TH2F( + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Pos", iSmType, iSmId, iRpcId, iSel), + Form("Clu position of Rpc #%03d in Sm %03d of type %d under " + "Selector %02d; Strip []; ypos [cm]", + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, -YDMAX, YDMAX); Double_t TSumMax = 1.E4; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; - fhTRpcCluTOff[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " - "Selector %02d; Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -TSumMax, - TSumMax); + fhTRpcCluTOff[iDetIndx][iSel] = new TH2F( + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff", iSmType, iSmId, iRpcId, iSel), + Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " + "Selector %02d; Strip []; TOff [ns]", + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -TSumMax, TSumMax); if (fTotMax != 0.) fdTOTMax = fTotMax; fhTRpcCluTot[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot", iSmType, iSmId, iRpcId, iSel), Form("Clu Tot of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; StripSide []; TOT [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 100, - fdTOTMin, - fdTOTMax); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 100, + fdTOTMin, fdTOTMax); fhTRpcCluSize[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size", iSmType, iSmId, iRpcId, iSel), Form("Clu size of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; Strip []; size [strips]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 16, - 0.5, - 16.5); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 16, 0.5, 16.5); // Walk histos - fhTRpcCluAvWalk[iDetIndx][iSel] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk; TOT; T-TSel", - iSmType, - iSmId, - iRpcId, - iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + fhTRpcCluAvWalk[iDetIndx][iSel] = + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk", iSmType, iSmId, iRpcId, iSel), + Form("Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk; TOT; T-TSel", iSmType, iSmId, iRpcId, iSel), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); // Tof Histos - fhTRpcCluDelTof[iDetIndx][iSel] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSmId, - iRpcId, - iSel), - Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof; TRef-TSel; T-TSel", - iSmType, - iSmId, - iRpcId, - iSel), - nbClDelTofBinX, - -fdDelTofMax, - fdDelTofMax, - nbClDelTofBinY, - -TSumMax, - TSumMax); + fhTRpcCluDelTof[iDetIndx][iSel] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSmId, iRpcId, iSel), + Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof; TRef-TSel; T-TSel", iSmType, iSmId, iRpcId, iSel), + nbClDelTofBinX, -fdDelTofMax, fdDelTofMax, nbClDelTofBinY, -TSumMax, TSumMax); // Position deviation histos fhTRpcCludXdY[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY", iSmType, iSmId, iRpcId, iSel), Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY; #Delta x [cm]; " "#Delta y [cm];", - iSmType, - iSmId, - iRpcId, - iSel), - nbCldXdYBinX, - -dXdYMax, - dXdYMax, - nbCldXdYBinY, - -dXdYMax, - dXdYMax); - - fhTRpcCluWalk[iDetIndx][iSel].resize( - fDigiBdfPar->GetNbChan(iSmType, iRpcId)); - for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); - iCh++) { + iSmType, iSmId, iRpcId, iSel), + nbCldXdYBinX, -dXdYMax, dXdYMax, nbCldXdYBinY, -dXdYMax, dXdYMax); + + fhTRpcCluWalk[iDetIndx][iSel].resize(fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { fhTRpcCluWalk[iDetIndx][iSel][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { fhTRpcCluWalk[iDetIndx][iSel][iCh][iSide] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide, + Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", iSmType, iSmId, iRpcId, iCh, iSide, iSel), + Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", iSmType, iSmId, iRpcId, iCh, iSide, iSel), - Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide, - iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); } } fhTRpcCluTOffDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 99, - -TSumMax, - TSumMax); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 99, -TSumMax, TSumMax); fhTRpcCluTotDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu Tot of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); TOT [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 100, - fdTOTMin, - fdTOTMax); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 100, fdTOTMin, fdTOTMax); fhTRpcCluSizeDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu size of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); size [strips]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 10, - 0.5, - 10.5); - - fhTRpcCluMemMulDTLastHits[iDetIndx][iSel] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_MemMul_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu Memorized Multiplicity of Rpc #%03d in Sm %03d of type %d " - "under Selector %02d; log(#DeltaT (ns)); TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 10, - 0, - 10); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 10, 0.5, 10.5); + + fhTRpcCluMemMulDTLastHits[iDetIndx][iSel] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_MemMul_DTLH", iSmType, iSmId, iRpcId, iSel), + Form("Clu Memorized Multiplicity of Rpc #%03d in Sm %03d of type %d " + "under Selector %02d; log(#DeltaT (ns)); TOff [ns]", + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 10, 0, 10); } } } - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! return; } /************************************************************************************/ -void CbmDeviceHitBuilderTof::WriteHistograms() { +void CbmDeviceHitBuilderTof::WriteHistograms() +{ TList* tHistoList(NULL); tHistoList = gROOT->GetList(); @@ -1890,7 +1413,8 @@ void CbmDeviceHitBuilderTof::WriteHistograms() { } /************************************************************************************/ -Bool_t CbmDeviceHitBuilderTof::BuildClusters() { +Bool_t CbmDeviceHitBuilderTof::BuildClusters() +{ fiNevtBuild++; if (!CalibRawDigis()) return kFALSE; if (0 == fiMode) return kTRUE; // no customer yet @@ -1900,7 +1424,8 @@ Bool_t CbmDeviceHitBuilderTof::BuildClusters() { } /************************************************************************************/ -Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { +Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() +{ Int_t iNbTofDigi = fiNDigiIn; pRef = NULL; for (Int_t iDigInd = 0; iDigInd < fiNDigiIn; iDigInd++) { @@ -1919,8 +1444,7 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { Int_t iAddr = pDigi->GetAddress() & DetMask; if (iAddr == fiBeamRefAddr) { //LOG(debug) << Form("Ref digi found for 0x%08x, Mask 0x%08x ", fiBeamRefAddr, DetMask); - if (NULL == pRef) - pRef = pDigi; + if (NULL == pRef) pRef = pDigi; else { if (pDigi->GetTime() < pRef->GetTime()) pRef = pDigi; } @@ -1928,20 +1452,16 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { Int_t iDetIndx = fDigiBdfPar->GetDetInd(iAddr); if (fDigiBdfPar->GetNbDet() - 1 < iDetIndx || iDetIndx < 0) { - LOG(debug) << Form( - " Wrong DetIndx %d >< %d,0 ", iDetIndx, fDigiBdfPar->GetNbDet()); + LOG(debug) << Form(" Wrong DetIndx %d >< %d,0 ", iDetIndx, fDigiBdfPar->GetNbDet()); break; } - fhRpcDigiTot[iDetIndx]->Fill(2 * pDigi->GetChannel() + pDigi->GetSide(), - pDigi->GetTot()); + fhRpcDigiTot[iDetIndx]->Fill(2 * pDigi->GetChannel() + pDigi->GetSide(), pDigi->GetTot()); if (NULL == fhRpcDigiCor[iDetIndx]) { if (100 < iMess++) - LOG(warn) << Form( - " DigiCor Histo for DetIndx %d derived from 0x%08x not found", - iDetIndx, - pDigi->GetAddress()); + LOG(warn) << Form(" DigiCor Histo for DetIndx %d derived from 0x%08x not found", iDetIndx, + pDigi->GetAddress()); continue; } @@ -1950,14 +1470,19 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { // for (Int_t iDigI2 =iDigInd+1; iDigI2<iNbTofDigi;iDigI2++){ for (Int_t iDigI2 = 0; iDigI2 < iNbTofDigi; iDigI2++) { CbmTofDigi* pDigi2 = &fvDigiIn[iDigI2]; + if (pDigi->GetAddress() != pDigi2->GetAddress()) + if (((pDigi->GetAddress() & DetMask) == 0x00003006 || (pDigi->GetAddress() & DetMask) == 0x0000b000) + && ((pDigi2->GetAddress() & DetMask) == 0x00003006 || (pDigi2->GetAddress() & DetMask) == 0x0000b000)) + fhBucDigiCor->Fill(pDigi->GetRpc() * 64 + pDigi->GetChannel() * 2 + pDigi->GetSide(), + pDigi2->GetRpc() * 64 + pDigi2->GetChannel() * 2 + pDigi2->GetSide()); + if (iDetIndx == fDigiBdfPar->GetDetInd(pDigi2->GetAddress())) { if (0. == pDigi->GetSide() && 1. == pDigi2->GetSide()) { - fhRpcDigiCor[iDetIndx]->Fill(pDigi->GetChannel(), - pDigi2->GetChannel()); - } else { + fhRpcDigiCor[iDetIndx]->Fill(pDigi->GetChannel(), pDigi2->GetChannel()); + } + else { if (1. == pDigi->GetSide() && 0. == pDigi2->GetSide()) { - fhRpcDigiCor[iDetIndx]->Fill(pDigi2->GetChannel(), - pDigi->GetChannel()); + fhRpcDigiCor[iDetIndx]->Fill(pDigi2->GetChannel(), pDigi->GetChannel()); } } if (pDigi->GetSide() != pDigi2->GetSide()) { @@ -1968,16 +1493,14 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { pDigi2Min = pDigi2; //LOG(debug) << "Digi2 found at "<<iDigI2<<" with TDif = "<<dTDifMin<<" ns"; } - } else if ( - TMath::Abs(pDigi->GetChannel() - pDigi2->GetChannel()) - == 1) { // opposite side missing, neighbouring channel has hit on opposite side // FIXME + } + else if (TMath::Abs(pDigi->GetChannel() - pDigi2->GetChannel()) + == 1) { // opposite side missing, neighbouring channel has hit on opposite side // FIXME // check that same side digi of neighbouring channel is absent Int_t iDigI3 = 0; for (; iDigI3 < iNbTofDigi; iDigI3++) { CbmTofDigi* pDigi3 = &fvDigiIn[iDigI3]; - if (pDigi3->GetSide() == pDigi->GetSide() - && pDigi2->GetChannel() == pDigi3->GetChannel()) - break; + if (pDigi3->GetSide() == pDigi->GetSide() && pDigi2->GetChannel() == pDigi3->GetChannel()) break; } if (iDigI3 == iNbTofDigi) { // same side neighbour did not fire Int_t iCorMode = 0; // Missing hit correction mode @@ -1985,60 +1508,32 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { case 0: // no action break; case 1: // shift found hit - LOG(debug) << Form("shift channel %d%d%d%d%d and ", - (Int_t) pDigi->GetType(), - (Int_t) pDigi->GetSm(), - (Int_t) pDigi->GetRpc(), - (Int_t) pDigi->GetChannel(), - (Int_t) pDigi->GetSide()) - << Form(" %d%d%d%d%d ", - (Int_t) pDigi2->GetType(), - (Int_t) pDigi2->GetSm(), - (Int_t) pDigi2->GetRpc(), - (Int_t) pDigi2->GetChannel(), - (Int_t) pDigi2->GetSide()); + LOG(debug) << Form("shift channel %d%d%d%d%d and ", (Int_t) pDigi->GetType(), (Int_t) pDigi->GetSm(), + (Int_t) pDigi->GetRpc(), (Int_t) pDigi->GetChannel(), (Int_t) pDigi->GetSide()) + << Form(" %d%d%d%d%d ", (Int_t) pDigi2->GetType(), (Int_t) pDigi2->GetSm(), + (Int_t) pDigi2->GetRpc(), (Int_t) pDigi2->GetChannel(), (Int_t) pDigi2->GetSide()); //if(pDigi->GetTime() < pDigi2->GetTime()) if (pDigi->GetSide() == 0) - pDigi2->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi->GetChannel(), - 1 - pDigi->GetSide(), + pDigi2->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi->GetChannel(), 1 - pDigi->GetSide(), pDigi->GetType()); else - pDigi->SetAddress(pDigi2->GetSm(), - pDigi2->GetRpc(), - pDigi2->GetChannel(), - 1 - pDigi2->GetSide(), + pDigi->SetAddress(pDigi2->GetSm(), pDigi2->GetRpc(), pDigi2->GetChannel(), 1 - pDigi2->GetSide(), pDigi2->GetType()); - LOG(debug) << Form("resultchannel %d%d%d%d%d and ", - (Int_t) pDigi->GetType(), - (Int_t) pDigi->GetSm(), - (Int_t) pDigi->GetRpc(), - (Int_t) pDigi->GetChannel(), - (Int_t) pDigi->GetSide()) - << Form(" %d%d%d%d%d ", - (Int_t) pDigi2->GetType(), - (Int_t) pDigi2->GetSm(), - (Int_t) pDigi2->GetRpc(), - (Int_t) pDigi2->GetChannel(), - (Int_t) pDigi2->GetSide()); + LOG(debug) << Form("resultchannel %d%d%d%d%d and ", (Int_t) pDigi->GetType(), (Int_t) pDigi->GetSm(), + (Int_t) pDigi->GetRpc(), (Int_t) pDigi->GetChannel(), (Int_t) pDigi->GetSide()) + << Form(" %d%d%d%d%d ", (Int_t) pDigi2->GetType(), (Int_t) pDigi2->GetSm(), + (Int_t) pDigi2->GetRpc(), (Int_t) pDigi2->GetChannel(), (Int_t) pDigi2->GetSide()); break; case 2: // insert missing hits CbmTofDigi* pDigiN = new CbmTofDigi(*pDigi); - pDigiN->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi2->GetChannel(), - pDigi->GetSide(), + pDigiN->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi2->GetChannel(), pDigi->GetSide(), pDigi->GetType()); pDigiN->SetTot(pDigi2->GetTot()); fvDigiIn.push_back(*pDigiN); CbmTofDigi* pDigiN2 = new CbmTofDigi(*pDigi2); - pDigiN2->SetAddress(pDigi2->GetSm(), - pDigi2->GetRpc(), - pDigi->GetChannel(), - pDigi2->GetSide(), + pDigiN2->SetAddress(pDigi2->GetSm(), pDigi2->GetRpc(), pDigi->GetChannel(), pDigi2->GetSide(), pDigi2->GetType()); pDigiN2->SetTot(pDigi->GetTot()); fvDigiIn.push_back(*pDigiN2); @@ -2051,32 +1546,22 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { } } if (pDigi2Min != NULL) { - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, - pDigi->GetType(), - pDigi->GetSm(), - pDigi->GetRpc(), - 0, + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc(), 0, pDigi->GetChannel()); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { - LOG(warn) << Form("Invalid ChannelInfo for 0x%08x, 0x%08x", - iChId, - pDigi2Min->GetAddress()) - << " TSRC " << pDigi->GetType() << pDigi->GetSm() - << pDigi->GetRpc() << pDigi->GetChannel(); + LOG(warn) << Form("Invalid ChannelInfo for 0x%08x, 0x%08x", iChId, pDigi2Min->GetAddress()) << " TSRC " + << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() << pDigi->GetChannel(); continue; } - if (fDigiBdfPar->GetSigVel( - pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc()) - * dTDifMin * 0.5 + if (fDigiBdfPar->GetSigVel(pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc()) * dTDifMin * 0.5 < fPosYMaxScal * fChannelInfo->GetSizey()) { //check consistency if (8 == pDigi->GetType() || 5 == pDigi->GetType()) { if (pDigi->GetTime() != pDigi2Min->GetTime()) { if (fiMsgCnt-- > 0) { - LOG(warn) << "Inconsistent duplicated digis in event " - << fiNevtBuild << ", Ind: " << iDigInd; + LOG(warn) << "Inconsistent duplicated digis in event " << fiNevtBuild << ", Ind: " << iDigInd; LOG(warn) << " " << pDigi->ToString(); LOG(warn) << " " << pDigi2Min->ToString(); } @@ -2096,15 +1581,15 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { Int_t iAddr = pDigi->GetAddress() & DetMask; Int_t iDet = fDetIdIndexMap[iAddr]; // Detector Index Int_t iSide = pDigi->GetSide(); - fhDigiTimesRaw->Fill(iDet * 2 + iSide, - pDigi->GetTime() - pRef->GetTime()); + fhDigiTimesRaw->Fill(iDet * 2 + iSide, pDigi->GetTime() - pRef->GetTime()); } } return kTRUE; } /************************************************************************************/ -Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { +Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() +{ CbmTofDigi* pDigi; CbmTofDigi* pCalDigi = NULL; Int_t iDigIndCal = -1; @@ -2127,11 +1612,8 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { <<Form("%f",pDigi->GetTime())<<" " <<pDigi->GetTot(); */ - if (pDigi->GetType() == 5 - || pDigi->GetType() - == 8) // for Pad counters generate fake digi to mockup a strip - if (pDigi->GetSide() == 1) - continue; // skip one side to avoid double entries + if (pDigi->GetType() == 5 || pDigi->GetType() == 8) // for Pad counters generate fake digi to mockup a strip + if (pDigi->GetSide() == 1) continue; // skip one side to avoid double entries Bool_t bValid = kTRUE; std::map<Int_t, Double_t>::iterator it; @@ -2141,15 +1623,15 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { LOG(debug)<<"CCT found valid ChannelDeadtime entry "<<mChannelDeadTime[iAddr] <<", DeltaT "<<pDigi->GetTime()-mChannelDeadTime[iAddr]; */ - if ((bValid = (pDigi->GetTime() - > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { + if ((bValid = (pDigi->GetTime() > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { // pCalDigi = // new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pDigi); fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); pCalDigi = &(fTofCalDigiVec->back()); iDigIndCal++; } - } else { + } + else { // pCalDigi = new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pDigi); fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); pCalDigi = &(fTofCalDigiVec->back()); @@ -2171,136 +1653,97 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { <<pDigi->GetTot(); */ if (fbPs2Ns) { - pCalDigi->SetTime(pCalDigi->GetTime() - / 1000.); // for backward compatibility - pCalDigi->SetTot(pCalDigi->GetTot() - / 1000.); // for backward compatibility + pCalDigi->SetTime(pCalDigi->GetTime() / 1000.); // for backward compatibility + pCalDigi->SetTot(pCalDigi->GetTot() / 1000.); // for backward compatibility } - if (fDigiBdfPar->GetNbSmTypes() - > pDigi->GetType() // prevent crash due to misconfiguration + if (fDigiBdfPar->GetNbSmTypes() > pDigi->GetType() // prevent crash due to misconfiguration && fDigiBdfPar->GetNbSm(pDigi->GetType()) > pDigi->GetSm() && fDigiBdfPar->GetNbRpc(pDigi->GetType()) > pDigi->GetRpc() - && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) - > pDigi->GetChannel()) { + && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { // apply calibration vectors - pCalDigi->SetTime( - pCalDigi->GetTime() - // calibrate Digi Time - fvCPTOff[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); + pCalDigi->SetTime(pCalDigi->GetTime() - // calibrate Digi Time + fvCPTOff[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); // LOG(debug)<<" CluCal-TOff: "<<pCalDigi->ToString(); - Double_t dTot = - pCalDigi->GetTot() - // subtract Offset - fvCPTotOff[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]; + Double_t dTot = pCalDigi->GetTot() - // subtract Offset + fvCPTotOff[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]; if (dTot < 0.001) dTot = 0.001; - pCalDigi->SetTot( - dTot * // calibrate Digi ToT - fvCPTotGain[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); + pCalDigi->SetTot(dTot * // calibrate Digi ToT + fvCPTotGain[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); // walk correction Double_t dTotBinSize = (fdTOTMax - fdTOTMin) / nbClWalkBinX; - Int_t iWx = (Int_t)((pCalDigi->GetTot() - fdTOTMin) / dTotBinSize); + Int_t iWx = (Int_t)((pCalDigi->GetTot() - fdTOTMin) / dTotBinSize); if (0 > iWx) iWx = 0; if (iWx >= nbClWalkBinX) iWx = nbClWalkBinX - 1; - Double_t dDTot = - (pCalDigi->GetTot() - fdTOTMin) / dTotBinSize - (Double_t) iWx - 0.5; + Double_t dDTot = (pCalDigi->GetTot() - fdTOTMin) / dTotBinSize - (Double_t) iWx - 0.5; Double_t dWT = - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]; + fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]; if (dDTot > 0) { // linear interpolation to next bin if (iWx < nbClWalkBinX - 1) { // linear interpolation to next bin - dWT += dDTot - * (fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx + 1] - - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]); //memory leak??? + dWT += + dDTot + * (fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx + 1] + - fvCPWalk[pCalDigi->GetType()] + [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + pCalDigi->GetRpc()] + [pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]); //memory leak??? } - } else // dDTot < 0, linear interpolation to next bin + } + else // dDTot < 0, linear interpolation to next bin { if (0 < iWx) { // linear interpolation to next bin - dWT -= dDTot - * (fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx - 1] - - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]); //memory leak??? + dWT -= + dDTot + * (fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx - 1] + - fvCPWalk[pCalDigi->GetType()] + [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + pCalDigi->GetRpc()] + [pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]); //memory leak??? } } pCalDigi->SetTime(pCalDigi->GetTime() - dWT); // calibrate Digi Time // LOG(debug)<<" CluCal-Walk: "<<pCalDigi->ToString(); - - } else { + } + else { LOG(info) << "Skip1 Digi " - << " Type " << pDigi->GetType() << " " - << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() - << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " - << pDigi->GetRpc() << " " - << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " - << pDigi->GetChannel() << " " + << " Type " << pDigi->GetType() << " " << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() << " " + << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " << pDigi->GetRpc() << " " + << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " << pDigi->GetChannel() << " " << fDigiBdfPar->GetNbChan(pDigi->GetType(), 0); } if (pCalDigi->GetType() == 5 - || pCalDigi->GetType() - == 8) { // for Pad counters generate fake digi to mockup a strip + || pCalDigi->GetType() == 8) { // for Pad counters generate fake digi to mockup a strip //CbmTofDigi* pCalDigi2 = // new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pCalDigi); fTofCalDigiVec->push_back(CbmTofDigi(*pCalDigi)); CbmTofDigi* pCalDigi2 = &(fTofCalDigiVec->back()); iDigIndCal++; if (pCalDigi->GetSide() == 0) - pCalDigi2->SetAddress(pCalDigi->GetSm(), - pCalDigi->GetRpc(), - pCalDigi->GetChannel(), - 1, - pCalDigi->GetType()); + pCalDigi2->SetAddress(pCalDigi->GetSm(), pCalDigi->GetRpc(), pCalDigi->GetChannel(), 1, pCalDigi->GetType()); else - pCalDigi2->SetAddress(pCalDigi->GetSm(), - pCalDigi->GetRpc(), - pCalDigi->GetChannel(), - 0, - pCalDigi->GetType()); + pCalDigi2->SetAddress(pCalDigi->GetSm(), pCalDigi->GetRpc(), pCalDigi->GetChannel(), 0, pCalDigi->GetType()); } } // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ ) iNbTofDigi = fTofCalDigiVec->size(); // fTofCalDigisColl->GetEntries(); // update because of added duplicted digis - LOG(debug) << "CbmTofHitBuilder: Sort " << fTofCalDigiVec->size() - << " calibrated digis "; + LOG(debug) << "CbmTofHitBuilder: Sort " << fTofCalDigiVec->size() << " calibrated digis "; if (iNbTofDigi > 1) { // fTofCalDigisColl->Sort(iNbTofDigi); // Time order again, in case modified by the calibration /// Sort the buffers of hits due to the time offsets applied - std::sort(fTofCalDigiVec->begin(), - fTofCalDigiVec->end(), - [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { - return a.GetTime() < b.GetTime(); - }); + std::sort(fTofCalDigiVec->begin(), fTofCalDigiVec->end(), + [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); }); // std::sort(fTofCalDigiVec->begin(), fTofCalDigiVec->end()); // if(!fTofCalDigisColl->IsSorted()){ // if ( ! std::is_sorted(fTofCalDigiVec->begin(), fTofCalDigiVec->end())) - if (!std::is_sorted(fTofCalDigiVec->begin(), - fTofCalDigiVec->end(), - [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { - return a.GetTime() < b.GetTime(); - })) + if (!std::is_sorted(fTofCalDigiVec->begin(), fTofCalDigiVec->end(), + [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); })) LOG(warning) << "CbmTofHitBuilder: Digi sorting not successful "; } @@ -2313,15 +1756,15 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { Int_t iAddr = pDigi->GetAddress() & DetMask; Int_t iDet = fDetIdIndexMap[iAddr]; // Detector Index Int_t iSide = pDigi->GetSide(); - fhDigiTimesCor->Fill(iDet * 2 + iSide, - pDigi->GetTime() - pRefCal->GetTime()); + fhDigiTimesCor->Fill(iDet * 2 + iSide, pDigi->GetTime() - pRefCal->GetTime()); } } return kTRUE; } /************************************************************************************/ -Bool_t CbmDeviceHitBuilderTof::BuildHits() { +Bool_t CbmDeviceHitBuilderTof::BuildHits() +{ Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes(); // Hit variables Double_t dWeightedTime = 0.0; @@ -2335,9 +1778,8 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { //Int_t iTrafoCell=-1; Int_t iNbChanInHit = 0; // Last Channel Temp variables - Int_t iLastChan = -1; - Double_t dLastPosX = - 0.0; // -> Comment to remove warning because set but never used + Int_t iLastChan = -1; + Double_t dLastPosX = 0.0; // -> Comment to remove warning because set but never used Double_t dLastPosY = 0.0; Double_t dLastTime = 0.0; // Channel Temp variables @@ -2367,8 +1809,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { */ fviClusterMul[iSmType][iSm][iRpc] = 0; Int_t iChId = 0; - Int_t iDetId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); + Int_t iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); ; Int_t iDetIndx = fDetIdIndexMap[iDetId]; // Detector Index if (0 == iChType) { @@ -2396,173 +1837,99 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { //LOG(debug3)<<"VDigisize " // << Form(" T %3d Sm %3d R %3d Ch %3d Size %3lu ", // iSmType,iSm,iRpc,iCh,fStorStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size()); - if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc].size()) - continue; - if (fvDeadStrips[iDetIndx] & (1 << iCh)) - continue; // skip over dead channels + if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc].size()) continue; + if (fvDeadStrips[iDetIndx] & (1 << iCh)) continue; // skip over dead channels //if( 0 < fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ) // fhNbDigiPerChan->Fill( fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ); - while (1 - < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - while ( - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetSide()) { + while ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetSide()) { // Not one Digi of each end! fiNbSameSide++; - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - > 2) { - LOG(debug) - << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc - << iCh << ", Times: " - << Form( - "%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime()) - << ", " - << Form( - "%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime()) - << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime() - << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetSide() - == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetSide()) { - LOG(debug) - << "3 consecutive SameSide Digis! on TSRC " << iSmType - << iSm << iRpc << iCh << ", Times: " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime() - << ", " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) - ->GetTime() - << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size(); + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() > 2) { + LOG(debug) << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " + << Form("%f", (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()) << ", " + << Form("%f", (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime()) + << ", DeltaT " + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetSide() + == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide()) { + LOG(debug) << "3 consecutive SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh + << ", Times: " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + << ", DeltaT " + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetTime() - > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1] - ->GetTime()) { + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetTime() + > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]->GetTime()) { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { - LOG(debug) << Form( - "Ev %8.0f, digis not properly time ordered, TSRCS " - "%d%d%d%d%d ", - fdEvent, - iSmType, - iSm, - iRpc, - iCh, - (Int_t) - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetSide()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { + LOG(debug) << Form("Ev %8.0f, digis not properly time ordered, TSRCS " + "%d%d%d%d%d ", + fdEvent, iSmType, iSm, iRpc, iCh, + (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() - + 1); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); } } - } else { - LOG(debug) - << "SameSide Erase fStor entries(d) " << iSmType - << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; + } + else { + LOG(debug) << "SameSide Erase fStor entries(d) " << iSmType << ", SR " << iSm * iNbRpc + iRpc + << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); } - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - break; + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) break; continue; } // same condition side end - LOG(debug) - << "digis processing for " - << Form( - " SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + LOG(debug) << "digis processing for " + << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - LOG(debug) << Form( - "Leaving digi processing for TSRC %d%d%d%d, size %3lu", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + LOG(debug) << Form("Leaving digi processing for TSRC %d%d%d%d, size %3lu", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); break; } /* Int_t iLastChId = iChId; // Save Last hit channel*/ // 2 Digis = both sides present - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); - iChId = fTofId->SetDetectorInfo(xDetInfo); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); - LOG(debug) - << Form("TSRC %d%d%d%d size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + iChId = fTofId->SetDetectorInfo(xDetInfo); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); + LOG(debug) << Form("TSRC %d%d%d%d size %3lu ", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) + << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { LOG(error) << "BuildHits: no geometry info! " - << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ", - iSmType, - iSm, - iRpc, - iCh, - iChId, - iUCellId); + << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ", iSmType, iSm, iRpc, iCh, iChId, iUCellId); break; } TGeoNode* fNode = // prepare local->global trafo - gGeoManager->FindNode(fChannelInfo->GetX(), - fChannelInfo->GetY(), - fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); // fNode->Print(); if ( NULL @@ -2575,18 +1942,14 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { ChangeState(fair::mq::Transition::Stop); } - CbmTofDigi* xDigiA = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - CbmTofDigi* xDigiB = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]; + CbmTofDigi* xDigiA = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]; dTimeDif = (xDigiA->GetTime() - xDigiB->GetTime()); if (5 == iSmType && dTimeDif != 0.) { // FIXME -> Overflow treatment in calib/tdc/TMbsCalibTdcTof.cxx - LOG(debug) - << "BuildHits: Diamond hit in " << iSm - << " with inconsistent digits " << xDigiA->GetTime() - << ", " << xDigiB->GetTime() << " -> " << dTimeDif; + LOG(debug) << "BuildHits: Diamond hit in " << iSm << " with inconsistent digits " + << xDigiA->GetTime() << ", " << xDigiB->GetTime() << " -> " << dTimeDif; /* LOG(debug) << " "<<xDigiA->ToString(); LOG(debug) << " "<<xDigiB->ToString(); @@ -2594,42 +1957,31 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { } if (1 == xDigiA->GetSide()) // 0 is the top side, 1 is the bottom side - dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDif * 0.5; + dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; else // 0 is the bottom side, 1 is the top side - dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDif * 0.5; + dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; if (TMath::Abs(dPosY) > fChannelInfo->GetSizey() - && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - > 2) { - LOG(debug) - << "Hit candidate outside correlation window, check for " - "better possible digis, " - << " mul " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); - - CbmTofDigi* xDigiC = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]; + && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() > 2) { + LOG(debug) << "Hit candidate outside correlation window, check for " + "better possible digis, " + << " mul " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); + + CbmTofDigi* xDigiC = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]; Double_t dPosYN = 0.; Double_t dTimeDifN = 0; - if (xDigiC->GetSide() == xDigiA->GetSide()) - dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); + if (xDigiC->GetSide() == xDigiA->GetSide()) dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); else dTimeDifN = xDigiA->GetTime() - xDigiC->GetTime(); - if (1 == xDigiA->GetSide()) - dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDifN * 0.5; + if (1 == xDigiA->GetSide()) dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; else - dPosYN = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDifN * 0.5; + dPosYN = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; if (TMath::Abs(dPosYN) < TMath::Abs(dPosY)) { - LOG(debug) - << "Replace digi on side " << xDigiC->GetSide() - << ", yPosNext " << dPosYN << " old: " << dPosY; + LOG(debug) << "Replace digi on side " << xDigiC->GetSide() << ", yPosNext " << dPosYN + << " old: " << dPosY; dTimeDif = dTimeDifN; dPosY = dPosYN; if (xDigiC->GetSide() == xDigiA->GetSide()) { @@ -2637,26 +1989,20 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { xDigiB = xDigiC; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(++( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() - + 1)); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( + ++(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1)); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1)); + ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1)); } } } if (xDigiA->GetSide() == xDigiB->GetSide()) { - LOG(error) - << "Wrong combinations of digis " - << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0] - << "," - << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]; + LOG(error) << "Wrong combinations of digis " << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0] + << "," << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]; } // The "Strip" time is the mean time between each end dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); @@ -2665,8 +2011,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { dTotS = xDigiA->GetTot() + xDigiB->GetTot(); // use local coordinates, (0,0,0) is in the center of counter ? - dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) - * fChannelInfo->GetSizex(); + dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); dPosZ = 0.; /* @@ -2693,8 +2038,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // a cluster is already started => check distance in space/time // For simplicity, just check along strip direction for now // and break cluster when a not fired strip is found - if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist - && iLastChan == iCh - 1 + if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist && iLastChan == iCh - 1 && TMath::Abs(dPosY - dLastPosY) < fdMaxSpaceDist) { // Add to cluster/hit dWeightedTime += dTime * dTotS; @@ -2704,26 +2048,20 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { dWeightsSum += dTotS; iNbChanInHit += 1; - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); - LOG(debug) - << " Add Digi and erase fStor entries(a): NbChanInHit " - << iNbChanInHit << ", " << iSmType << ", SR " - << iSm * iNbRpc + iRpc << ", Ch" << iCh; + LOG(debug) << " Add Digi and erase fStor entries(a): NbChanInHit " << iNbChanInHit << ", " + << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); } // if current Digis compatible with last fired chan else { @@ -2757,8 +2095,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // Simple errors, not properly done at all for now // Right way of doing it should take into account the weight distribution // and real system time resolution - TVector3 hitPosErr( - 0.5, 0.5, 0.5); // including positioning uncertainty + TVector3 hitPosErr(0.5, 0.5, 0.5); // including positioning uncertainty /* TVector3 hitPosErr( fChannelInfo->GetSizex()/TMath::Sqrt(12.0), // Single strips approximation 0.5, // Use generic value @@ -2773,13 +2110,10 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // Int_t iDetId = vPtsRef[0]->GetDetectorID();// detID = pt->GetDetectorID() <= from TofPoint // calc mean ch from dPosX=((Double_t)(-iNbCh/2 + iCh)+0.5)*fChannelInfo->GetSizex(); - Int_t iChm = - floor(dWeightedPosX / fChannelInfo->GetSizex()) - + iNbCh / 2; + Int_t iChm = floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; if (iChm < 0) iChm = 0; if (iChm > iNbCh - 1) iChm = iNbCh - 1; - iDetId = CbmTofAddress::GetUniqueAddress( - iSm, iRpc, iChm, 0, iSmType); + iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); //Int_t iRefId = 0; // Index of the correspondng TofPoint // if(NULL != fTofPointsColl) { //iRefId = fTofPointsColl->IndexOf( vPtsRef[0] ); @@ -2798,52 +2132,39 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { fviClusterMul[iSmType][iSm][iRpc]++; if (vDigiIndRef.size() < 2) { - LOG(warn) << "Digi refs for Hit " << fiNbHits << ": " - << vDigiIndRef.size(); + LOG(warn) << "Digi refs for Hit " << fiNbHits << ": " << vDigiIndRef.size(); } if (fiNbHits > 0) { - CbmTofHit* pHitL = - (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); - if (iDetId == pHitL->GetAddress() - && dWeightedTime == pHitL->GetTime()) { + CbmTofHit* pHitL = (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); + if (iDetId == pHitL->GetAddress() && dWeightedTime == pHitL->GetTime()) { LOG(debug) << "Store Hit twice? " - << " fiNbHits " << fiNbHits << ", " - << Form("0x%08x", iDetId); + << " fiNbHits " << fiNbHits << ", " << Form("0x%08x", iDetId); } } - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dWeightedTime, - vDigiIndRef - .size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dWeightsSum * 10.)); //channel -> Tot + CbmTofHit* pHit = + new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dWeightedTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dWeightsSum * 10.)); //channel -> Tot //0) ; //channel // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { - LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + else { pHit->Delete(); } /* new((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); CbmMatch* digiMatch = (CbmMatch *)fTofDigiMatchColl->At(fiNbHits); */ - CbmMatch* digiMatch = - new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); + CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - Double_t dTot = ((CbmTofDigi*) (&(fTofCalDigiVec->at( - vDigiIndRef.at(i))))) - ->GetTot(); - digiMatch->AddLink(CbmLink(dTot, - vDigiIndRef.at(i), - fiOutputTreeEntry, - fiFileIndex)); + Double_t dTot = ((CbmTofDigi*) (&(fTofCalDigiVec->at(vDigiIndRef.at(i)))))->GetTot(); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; @@ -2871,10 +2192,8 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) ); // Save next digi address - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); //LOG(debug2)<<"Erase fStor entries(b) "<<iSmType<<", SR "<<iSm*iNbRpc+iRpc<<", Ch"<<iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( @@ -2882,18 +2201,13 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); } // else of if current Digis compatible with last fired chan } // if( 0 < iNbChanInHit) else { - LOG(debug) << Form("1.Hit on channel %d, time: %f, PosY %f", - iCh, - dTime, - dPosY); + LOG(debug) << Form("1.Hit on channel %d, time: %f, PosY %f", iCh, dTime, dPosY); // first fired strip in this RPC dWeightedTime = dTime * dTotS; @@ -2905,10 +2219,8 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // Save pointer on CbmTofPoint //if(NULL != fTofPointsColl) // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) ); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); //LOG(debug)<<"Erase fStor entries(c) "<<iSmType<<", SR "<<iSm*iNbRpc+iRpc<<", Ch"<<iCh; @@ -2926,14 +2238,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { dLastPosX = dPosX; dLastPosY = dPosY; dLastTime = dTime; - if (AddNextChan(iSmType, - iSm, - iRpc, - iLastChan, - dLastPosX, - dLastPosY, - dLastTime, - dWeightsSum)) { + if (AddNextChan(iSmType, iSm, iRpc, iLastChan, dLastPosX, dLastPosY, dLastTime, dWeightsSum)) { iNbChanInHit = 0; // cluster already stored } } // while( 1 < fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ) @@ -2945,10 +2250,8 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { } // else of if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) ) } // if( 0 == iChType) else { - LOG(error) - << "=> Cluster building " - << "from digis to hits not implemented for pads, Sm type " - << iSmType << " Rpc " << iRpc; + LOG(error) << "=> Cluster building " + << "from digis to hits not implemented for pads, Sm type " << iSmType << " Rpc " << iRpc; return kFALSE; } // else of if( 0 == iChType) @@ -2996,19 +2299,16 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { // Event errors, not properly done at all for now // Right way of doing it should take into account the weight distribution // and real system time resolution - TVector3 hitPosErr( - 0.5, 0.5, 0.5); // including positioning uncertainty + TVector3 hitPosErr(0.5, 0.5, 0.5); // including positioning uncertainty /* TVector3 hitPosErr( fChannelInfo->GetSizex()/TMath::Sqrt(12.0), // Single strips approximation 0.5, // Use generic value 1.); */ - Int_t iChm = - floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; + Int_t iChm = floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; if (iChm < 0) iChm = 0; if (iChm > iNbCh - 1) iChm = iNbCh - 1; - iDetId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); + iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); //Int_t iRefId = 0; // Index of the correspondng TofPoint //if(NULL != fTofPointsColl) iRefId = fTofPointsColl->IndexOf( vPtsRef[0] ); /* @@ -3023,49 +2323,39 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { */ fviClusterMul[iSmType][iSm][iRpc]++; if (vDigiIndRef.size() < 2) { - LOG(warn) << "Digi refs for Hit " << fiNbHits << ": " - << vDigiIndRef.size(); + LOG(warn) << "Digi refs for Hit " << fiNbHits << ": " << vDigiIndRef.size(); } if (fiNbHits > 0) { CbmTofHit* pHitL = (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); - if (iDetId == pHitL->GetAddress() - && dWeightedTime == pHitL->GetTime()) + if (iDetId == pHitL->GetAddress() && dWeightedTime == pHitL->GetTime()) LOG(debug) << "Store Hit twice? " - << " fiNbHits " << fiNbHits << ", " - << Form("0x%08x", iDetId); + << " fiNbHits " << fiNbHits << ", " << Form("0x%08x", iDetId); } - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dWeightedTime, - vDigiIndRef.size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dWeightsSum * 10.)); //channel -> Tot + CbmTofHit* pHit = new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dWeightedTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dWeightsSum * 10.)); //channel -> Tot // 0) ; //channel // vDigiIndRef); // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { - LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + else { pHit->Delete(); } /* new((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); CbmMatch* digiMatch = (CbmMatch *)fTofDigiMatchColl->At(fiNbHits); */ - CbmMatch* digiMatch = - new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); + CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - Double_t dTot = - ((CbmTofDigi*) (&(fTofCalDigiVec->at(vDigiIndRef.at(i))))) - ->GetTot(); - digiMatch->AddLink(CbmLink( - dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); + Double_t dTot = ((CbmTofDigi*) (&(fTofCalDigiVec->at(vDigiIndRef.at(i)))))->GetTot(); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; @@ -3093,69 +2383,44 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { /************************************************************************************/ Bool_t CbmDeviceHitBuilderTof::MergeClusters() { return kTRUE; } -void CbmDeviceHitBuilderTof::LH_store(Int_t iSmType, - Int_t iSm, - Int_t iRpc, - Int_t iChm, - CbmTofHit* pHit) { +void CbmDeviceHitBuilderTof::LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit) +{ - if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) - fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); + if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); else { Double_t dLastTime = pHit->GetTime(); if (dLastTime >= fvLastHits[iSmType][iSm][iRpc][iChm].back()->GetTime()) { fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); - LOG(debug) << Form( - " Store LH from Ev %8.0f for TSRC %d%d%d%d, size %lu, addr 0x%08x, " - "time %f, dt %f", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - dLastTime, - dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()); - } else { + LOG(debug) << Form(" Store LH from Ev %8.0f for TSRC %d%d%d%d, size %lu, addr 0x%08x, " + "time %f, dt %f", + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), dLastTime, + dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()); + } + else { if (dLastTime - >= fvLastHits[iSmType][iSm][iRpc][iChm] - .front() - ->GetTime()) { // hit has to be inserted in the proper place + >= fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()) { // hit has to be inserted in the proper place std::list<CbmTofHit*>::iterator it; - for (it = fvLastHits[iSmType][iSm][iRpc][iChm].begin(); - it != fvLastHits[iSmType][iSm][iRpc][iChm].end(); - ++it) + for (it = fvLastHits[iSmType][iSm][iRpc][iChm].begin(); it != fvLastHits[iSmType][iSm][iRpc][iChm].end(); ++it) if ((*it)->GetTime() > dLastTime) break; fvLastHits[iSmType][iSm][iRpc][iChm].insert(--it, pHit); Double_t deltaTime = dLastTime - (*it)->GetTime(); LOG(debug) << Form("Hit inserted into LH from Ev %8.0f for TSRC " "%d%d%d%d, size %lu, addr 0x%08x, delta time %f ", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - deltaTime); - } else { // this hit is first - Double_t deltaTime = - dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime(); + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), deltaTime); + } + else { // this hit is first + Double_t deltaTime = dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime(); LOG(debug) << Form("first LH from Ev %8.0f for TSRC %d%d%d%d, size " "%lu, addr 0x%08x, delta time %f ", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - deltaTime); + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), deltaTime); if (deltaTime == 0.) { // remove hit, otherwise double entry? pHit->Delete(); - } else { + } + else { fvLastHits[iSmType][iSm][iRpc][iChm].push_front(pHit); } } @@ -3163,54 +2428,34 @@ void CbmDeviceHitBuilderTof::LH_store(Int_t iSmType, } } -void CbmDeviceHitBuilderTof::CheckLHMemory() { +void CbmDeviceHitBuilderTof::CheckLHMemory() +{ if ((Int_t) fvLastHits.size() != fDigiBdfPar->GetNbSmTypes()) - LOG(error) << Form("Inconsistent LH Smtype size %lu, %d ", - fvLastHits.size(), - fDigiBdfPar->GetNbSmTypes()); + LOG(error) << Form("Inconsistent LH Smtype size %lu, %d ", fvLastHits.size(), fDigiBdfPar->GetNbSmTypes()); for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { if ((Int_t) fvLastHits[iSmType].size() != fDigiBdfPar->GetNbSm(iSmType)) - LOG(error) << Form("Inconsistent LH Sm size %lu, %d T %d", - fvLastHits[iSmType].size(), - fDigiBdfPar->GetNbSm(iSmType), - iSmType); + LOG(error) << Form("Inconsistent LH Sm size %lu, %d T %d", fvLastHits[iSmType].size(), + fDigiBdfPar->GetNbSm(iSmType), iSmType); for (Int_t iSm = 0; iSm < fDigiBdfPar->GetNbSm(iSmType); iSm++) { - if ((Int_t) fvLastHits[iSmType][iSm].size() - != fDigiBdfPar->GetNbRpc(iSmType)) - LOG(error) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", - fvLastHits[iSmType][iSm].size(), - fDigiBdfPar->GetNbRpc(iSmType), - iSmType, - iSm); + if ((Int_t) fvLastHits[iSmType][iSm].size() != fDigiBdfPar->GetNbRpc(iSmType)) + LOG(error) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", fvLastHits[iSmType][iSm].size(), + fDigiBdfPar->GetNbRpc(iSmType), iSmType, iSm); for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { - if ((Int_t) fvLastHits[iSmType][iSm][iRpc].size() - != fDigiBdfPar->GetNbChan(iSmType, iRpc)) - LOG(error) << Form( - "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", - fvLastHits[iSmType][iSm][iRpc].size(), - fDigiBdfPar->GetNbChan(iSmType, iRpc), - iSmType, - iSm, - iRpc); + if ((Int_t) fvLastHits[iSmType][iSm][iRpc].size() != fDigiBdfPar->GetNbChan(iSmType, iRpc)) + LOG(error) << Form("Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", + fvLastHits[iSmType][iSm][iRpc].size(), fDigiBdfPar->GetNbChan(iSmType, iRpc), iSmType, iSm, + iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != iAddr) - LOG(error) << Form( - "Inconsistent address for Ev %8.0f in list of size %lu for " - "TSRC %d%d%d%d: 0x%08x, time %f", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) + LOG(error) << Form("Inconsistent address for Ev %8.0f in list of size %lu for " + "TSRC %d%d%d%d: 0x%08x, time %f", + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); } } } @@ -3218,53 +2463,33 @@ void CbmDeviceHitBuilderTof::CheckLHMemory() { LOG(debug) << Form("LH check passed for event %8.0f", fdEvent); } -void CbmDeviceHitBuilderTof::CleanLHMemory() { +void CbmDeviceHitBuilderTof::CleanLHMemory() +{ if ((Int_t) fvLastHits.size() != fDigiBdfPar->GetNbSmTypes()) - LOG(error) << Form("Inconsistent LH Smtype size %lu, %d ", - fvLastHits.size(), - fDigiBdfPar->GetNbSmTypes()); + LOG(error) << Form("Inconsistent LH Smtype size %lu, %d ", fvLastHits.size(), fDigiBdfPar->GetNbSmTypes()); for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { if ((Int_t) fvLastHits[iSmType].size() != fDigiBdfPar->GetNbSm(iSmType)) - LOG(error) << Form("Inconsistent LH Sm size %lu, %d T %d", - fvLastHits[iSmType].size(), - fDigiBdfPar->GetNbSm(iSmType), - iSmType); + LOG(error) << Form("Inconsistent LH Sm size %lu, %d T %d", fvLastHits[iSmType].size(), + fDigiBdfPar->GetNbSm(iSmType), iSmType); for (Int_t iSm = 0; iSm < fDigiBdfPar->GetNbSm(iSmType); iSm++) { - if ((Int_t) fvLastHits[iSmType][iSm].size() - != fDigiBdfPar->GetNbRpc(iSmType)) - LOG(error) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", - fvLastHits[iSmType][iSm].size(), - fDigiBdfPar->GetNbRpc(iSmType), - iSmType, - iSm); + if ((Int_t) fvLastHits[iSmType][iSm].size() != fDigiBdfPar->GetNbRpc(iSmType)) + LOG(error) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", fvLastHits[iSmType][iSm].size(), + fDigiBdfPar->GetNbRpc(iSmType), iSmType, iSm); for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { - if ((Int_t) fvLastHits[iSmType][iSm][iRpc].size() - != fDigiBdfPar->GetNbChan(iSmType, iRpc)) - LOG(error) << Form( - "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", - fvLastHits[iSmType][iSm][iRpc].size(), - fDigiBdfPar->GetNbChan(iSmType, iRpc), - iSmType, - iSm, - iRpc); + if ((Int_t) fvLastHits[iSmType][iSm][iRpc].size() != fDigiBdfPar->GetNbChan(iSmType, iRpc)) + LOG(error) << Form("Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", + fvLastHits[iSmType][iSm][iRpc].size(), fDigiBdfPar->GetNbChan(iSmType, iRpc), iSmType, iSm, + iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) while (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != iAddr) - LOG(error) << Form( - "Inconsistent address for Ev %8.0f in list of size %lu for " - "TSRC %d%d%d%d: 0x%08x, time %f", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) + LOG(error) << Form("Inconsistent address for Ev %8.0f in list of size %lu for " + "TSRC %d%d%d%d: 0x%08x, time %f", + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete(); fvLastHits[iSmType][iSm][iRpc][iCh].pop_front(); } @@ -3274,26 +2499,16 @@ void CbmDeviceHitBuilderTof::CleanLHMemory() { LOG(info) << Form("LH cleaning done after %8.0f events", fdEvent); } -Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, - Int_t iSm, - Int_t iRpc, - Int_t iLastChan, - Double_t dLastPosX, - Double_t dLastPosY, - Double_t dLastTime, - Double_t dLastTotS) { +Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iLastChan, Double_t dLastPosX, + Double_t dLastPosY, Double_t dLastTime, Double_t dLastTotS) +{ //Int_t iNbSm = fDigiBdfPar->GetNbSm( iSmType); Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); // Int_t iChType = fDigiBdfPar->GetChanType( iSmType, iRpc ); Int_t iCh = iLastChan + 1; - LOG(debug) << Form("Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ", - iSmType, - iSm, - iRpc, - iCh, - dLastTime, + LOG(debug) << Form("Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ", iSmType, iSm, iRpc, iCh, dLastTime, dLastPosY) << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (iCh == iNbCh) return kFALSE; @@ -3302,14 +2517,10 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, // fhNbDigiPerChan->Fill( fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ); if (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { Bool_t AddedHit = kFALSE; - for (Int_t i1 = 0; - i1 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; - i1++) { + for (Int_t i1 = 0; i1 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; i1++) { if (AddedHit) break; Int_t i2 = i1 + 1; - while ( - !AddedHit - && i2 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (!AddedHit && i2 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { // LOG(debug)<<"check digi pair "<<i1<<","<<i2<<" with size "<<fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size(); if ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1])->GetSide() @@ -3322,73 +2533,57 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); Double_t dTimeDif = xDigiA->GetTime() - xDigiB->GetTime(); Double_t dPosY = 0.; - if (1 == xDigiA->GetSide()) - dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + if (1 == xDigiA->GetSide()) dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; else - dPosY = - -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; - if (TMath::Abs(dPosY - dLastPosY) - < fdMaxSpaceDist) { // append digi pair to current cluster + if (TMath::Abs(dPosY - dLastPosY) < fdMaxSpaceDist) { // append digi pair to current cluster Double_t dNClHits = (Double_t)(vDigiIndRef.size() / 2); - Double_t dPosX = - ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); + Double_t dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); Double_t dTotS = xDigiA->GetTot() + xDigiB->GetTot(); Double_t dNewTotS = (dLastTotS + dTotS); - dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS; - dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS; - dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS; - dLastTotS = dNewTotS; + dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS; + dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS; + dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS; + dLastTotS = dNewTotS; // attach selected digis from pool Int_t Ind1 = fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; Int_t Ind2 = fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; vDigiIndRef.push_back(Ind1); vDigiIndRef.push_back(Ind2); // remove selected digis from pool - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + i1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1); std::vector<int>::iterator it; it = find(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(), - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end(), - Ind2); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end(), Ind2); if (it != fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end()) { - auto ipos = - it - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(); - LOG(debug) << "Found i2 " << i2 << " with Ind2 " << Ind2 - << " at position " << ipos; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos); + auto ipos = it - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(); + LOG(debug) << "Found i2 " << i2 << " with Ind2 " << Ind2 << " at position " << ipos; + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + ipos); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos); - } else { + } + else { LOG(error) << " Did not find i2 " << i2 << " with Ind2 " << Ind2; } //if(iCh == iNbCh-1) break; //Last strip reached if (iCh != (iNbCh - 1) - && AddNextChan(iSmType, - iSm, - iRpc, - iCh, - dLastPosX, - dLastPosY, - dLastTime, - dLastTotS)) { - LOG(debug) << "Added Strip " << iCh << " to cluster of size " - << dNClHits; + && AddNextChan(iSmType, iSm, iRpc, iCh, dLastPosX, dLastPosY, dLastTime, dLastTotS)) { + LOG(debug) << "Added Strip " << iCh << " to cluster of size " << dNClHits; return kTRUE; // signal hit was already added } AddedHit = kTRUE; @@ -3434,28 +2629,25 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, LOG(debug)<<"DigiIndRef "<<i<<" "<<vDigiIndRef.at(i)<<"(M"<<fviClusterMul[iSmType][iSm][iRpc]<<")"; } */ - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dLastTime, - vDigiIndRef.size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dLastTotS * 10.)); //channel -> Tot + CbmTofHit* pHit = new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dLastTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dLastTotS * 10.)); //channel -> Tot // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); if (fdMemoryTime > 0.) { // memorize hit LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + } + else { pHit->Delete(); } CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (Int_t i = 0; i < (Int_t) vDigiIndRef.size(); i++) { - Double_t dTot = - ((CbmTofDigi*) (&(fTofCalDigiVec->at(vDigiIndRef.at(i)))))->GetTot(); - digiMatch->AddLink( - CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); + Double_t dTot = ((CbmTofDigi*) (&(fTofCalDigiVec->at(vDigiIndRef.at(i)))))->GetTot(); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; vDigiIndRef.clear(); @@ -3463,29 +2655,30 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, return kTRUE; } -static Double_t f1_xboxe(double* x, double* par) { +static Double_t f1_xboxe(double* x, double* par) +{ double xx = x[0]; double wx = 1. - par[4] * TMath::Power(xx + par[5], 2); - double xboxe = par[0] * 0.25 - * (1. + TMath::Erf((xx + par[1] - par[3]) / par[2])) + double xboxe = par[0] * 0.25 * (1. + TMath::Erf((xx + par[1] - par[3]) / par[2])) * (1. + TMath::Erf((-xx + par[1] + par[3]) / par[2])); return xboxe * wx; } -void CbmDeviceHitBuilderTof::fit_ybox(const char* hname) { +void CbmDeviceHitBuilderTof::fit_ybox(const char* hname) +{ TH1* h1; h1 = (TH1*) gROOT->FindObjectAny(hname); if (NULL != h1) { fit_ybox(h1, 0.); } } -void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, Double_t ysize) { +void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, Double_t ysize) +{ Double_t* fpar = NULL; fit_ybox(h1, ysize, fpar); } -void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, - Double_t ysize, - Double_t* fpar = NULL) { +void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, Double_t ysize, Double_t* fpar = NULL) +{ TAxis* xaxis = h1->GetXaxis(); Double_t Ymin = xaxis->GetXmin(); Double_t Ymax = xaxis->GetXmax(); @@ -3517,22 +2710,16 @@ void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, err[i] = f1->GetParError(i); //cout << " FPar "<< i << ": " << res[i] << ", " << err[i] << endl; } - LOG(debug) << "YBox Fit of " << h1->GetName() - << " ended with chi2 = " << res[9] + LOG(debug) << "YBox Fit of " << h1->GetName() << " ended with chi2 = " << res[9] << Form(", strip length %7.2f +/- %5.2f, position resolution " "%7.2f +/- %5.2f at y_cen = %7.2f +/- %5.2f", - 2. * res[1], - 2. * err[1], - res[2], - err[2], - res[3], - err[3]); + 2. * res[1], 2. * err[1], res[2], err[2], res[3], err[3]); } -Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { - LOG(info) << "LoadGeometry starting for " << fDigiBdfPar->GetNbDet() - << " described detectors, " << fDigiPar->GetNrOfModules() - << " geometrically known modules "; +Bool_t CbmDeviceHitBuilderTof::LoadGeometry() +{ + LOG(info) << "LoadGeometry starting for " << fDigiBdfPar->GetNbDet() << " described detectors, " + << fDigiPar->GetNrOfModules() << " geometrically known modules "; //gGeoManager->Export("HitBuilder.loadgeo.root"); // write current status to file @@ -3541,8 +2728,7 @@ Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { for (Int_t icell = 0; icell < iNrOfCells; ++icell) { - Int_t cellId = - fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar + Int_t cellId = fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar fChannelInfo = fDigiPar->GetCell(cellId); Int_t smtype = fGeoHandler->GetSMType(cellId); @@ -3555,15 +2741,12 @@ Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { Double_t z = fChannelInfo->GetZ(); Double_t dx = fChannelInfo->GetSizex(); Double_t dy = fChannelInfo->GetSizey(); - LOG(debug) << "-I- InitPar " << icell << " Id: " << Form("0x%08x", cellId) - << " " << cell << " tmcs: " << smtype << " " << smodule << " " - << module << " " << cell << " x=" << Form("%6.2f", x) - << " y=" << Form("%6.2f", y) << " z=" << Form("%6.2f", z) - << " dx=" << dx << " dy=" << dy; + LOG(debug) << "-I- InitPar " << icell << " Id: " << Form("0x%08x", cellId) << " " << cell << " tmcs: " << smtype + << " " << smodule << " " << module << " " << cell << " x=" << Form("%6.2f", x) + << " y=" << Form("%6.2f", y) << " z=" << Form("%6.2f", z) << " dx=" << dx << " dy=" << dy; TGeoNode* fNode = // prepare local->global trafo - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); if (NULL == fNode) { // Transformation matrix not available !!!??? - Check LOG(error) << Form("Node at (%6.1f,%6.1f,%6.1f) : %p", @@ -3590,18 +2773,15 @@ Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - LOG(info) << " DetIndx " << iDetIndx << "(" << iNbDet << "), SmType " - << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId - << " => UniqueId " << Form("0x%08x ", iUniqueId) - << Form(" Svel %6.6f, DeadStrips 0x%08x ", - fDigiBdfPar->GetSigVel(iSmType, iSmId, iRpcId), + LOG(info) << " DetIndx " << iDetIndx << "(" << iNbDet << "), SmType " << iSmType << ", SmId " << iSmId << ", RpcId " + << iRpcId << " => UniqueId " << Form("0x%08x ", iUniqueId) + << Form(" Svel %6.6f, DeadStrips 0x%08x ", fDigiBdfPar->GetSigVel(iSmType, iSmId, iRpcId), fvDeadStrips[iDetIndx]); Int_t iCell = -1; while (kTRUE) { - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, ++iCell, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, ++iCell, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) break; } @@ -3649,11 +2829,7 @@ Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc); if (iNbChan == 0) { LOG(warn) << "LoadGeometry: StoreDigi without channels " - << Form("SmTy %3d, Sm %3d, NbRpc %3d, Rpc, %3d ", - iSmType, - iSm, - iNbRpc, - iRpc); + << Form("SmTy %3d, Sm %3d, NbRpc %3d, Rpc, %3d ", iSmType, iSm, iNbRpc, iRpc); } fStorDigi[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan); @@ -3696,7 +2872,8 @@ Bool_t CbmDeviceHitBuilderTof::LoadGeometry() { return kTRUE; } -Bool_t CbmDeviceHitBuilderTof::FillDigiStor() { +Bool_t CbmDeviceHitBuilderTof::FillDigiStor() +{ // Loop over the digis array and store the Digis in separate vectors for // each RPC modules @@ -3720,47 +2897,35 @@ Bool_t CbmDeviceHitBuilderTof::FillDigiStor() { <<Form("%f",pDigi->GetTime())<<" " <<pDigi->GetTot(); */ - if (fDigiBdfPar->GetNbSmTypes() - > pDigi->GetType() // prevent crash due to misconfiguration + if (fDigiBdfPar->GetNbSmTypes() > pDigi->GetType() // prevent crash due to misconfiguration && fDigiBdfPar->GetNbSm(pDigi->GetType()) > pDigi->GetSm() && fDigiBdfPar->GetNbRpc(pDigi->GetType()) > pDigi->GetRpc() - && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) - > pDigi->GetChannel()) { - fStorDigi[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] + && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { + fStorDigi[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()] + [pDigi->GetChannel()] .push_back(pDigi); - fStorDigiInd[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] + fStorDigiInd[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()] + [pDigi->GetChannel()] .push_back(iDigInd); - } else { + } + else { LOG(info) << "Skip2 Digi " - << " Type " << pDigi->GetType() << " " - << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() - << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " - << pDigi->GetRpc() << " " - << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " - << pDigi->GetChannel() << " " + << " Type " << pDigi->GetType() << " " << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() << " " + << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " << pDigi->GetRpc() << " " + << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " << pDigi->GetChannel() << " " << fDigiBdfPar->GetNbChan(pDigi->GetType(), 0); } } // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ ) return kTRUE; } -Bool_t CbmDeviceHitBuilderTof::SendHits() { +Bool_t CbmDeviceHitBuilderTof::SendHits() +{ //Output Log for (Int_t iHit = 0; iHit < fiNbHits; iHit++) { CbmTofHit* pHit = (CbmTofHit*) fTofHitsColl->At(iHit); - LOG(debug) << Form( - "Found Hit %d, addr 0x%08x, X %6.2f, Y %6.2f Z %6.2f T %6.2f CLS %d", - iHit, - pHit->GetAddress(), - pHit->GetX(), - pHit->GetY(), - pHit->GetZ(), - pHit->GetTime(), - pHit->GetFlag()); + LOG(debug) << Form("Found Hit %d, addr 0x%08x, X %6.2f, Y %6.2f Z %6.2f T %6.2f CLS %d", iHit, pHit->GetAddress(), + pHit->GetX(), pHit->GetY(), pHit->GetZ(), pHit->GetTime(), pHit->GetFlag()); } // prepare output hit vector std::vector<CbmTofHit*> vhit; @@ -3804,7 +2969,8 @@ Bool_t CbmDeviceHitBuilderTof::SendHits() { Bool_t CbmDeviceHitBuilderTof::SendAll() { return kTRUE; } -Bool_t CbmDeviceHitBuilderTof::FillHistos() { +Bool_t CbmDeviceHitBuilderTof::FillHistos() +{ Int_t iNbTofHits = fTofHitsColl->GetEntries(); CbmTofHit* pHit; //gGeoManager->SetTopVolume( gGeoManager->FindVolumeFast("tof_v14a") ); @@ -3824,10 +2990,8 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { if (0 < iNSel) { // check software triggers LOG(debug) << "FillHistos() for " << iNSel << " triggers" - << ", Dut " << fDutId << fDutSm << fDutRpc - << Form(", 0x%08x", fDutAddr) << ", Sel " << fSelId << fSelSm - << fSelRpc << Form(", 0x%08x", fSelAddr) << ", Sel2 " - << fSel2Id << fSel2Sm << fSel2Rpc + << ", Dut " << fDutId << fDutSm << fDutRpc << Form(", 0x%08x", fDutAddr) << ", Sel " << fSelId + << fSelSm << fSelRpc << Form(", 0x%08x", fSelAddr) << ", Sel2 " << fSel2Id << fSel2Sm << fSel2Rpc << Form(", 0x%08x", fSel2Addr); /* LOG(debug) <<"FillHistos: Muls: " @@ -3844,8 +3008,7 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Int_t iRpc = CbmTofAddress::GetRpcId(iDetId); //LOG(info) << Form(" indx %d, Id 0x%08x, TSR %d %d %d", iDetIndx, iDetId, iSmType, iSm, iRpc) // ; - if (NULL != fhRpcCluMul[iDetIndx]) - fhRpcCluMul[iDetIndx]->Fill(fviClusterMul[iSmType][iSm][iRpc]); // + if (NULL != fhRpcCluMul[iDetIndx]) fhRpcCluMul[iDetIndx]->Fill(fviClusterMul[iSmType][iSm][iRpc]); // } // do input distributions first @@ -3854,14 +3017,12 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { if (NULL == pHit) continue; if (StartAnalysisTime == 0.) { StartAnalysisTime = pHit->GetTime(); - LOG(info) << "StartAnalysisTime set to " << StartAnalysisTime - << " ns. "; + LOG(info) << "StartAnalysisTime set to " << StartAnalysisTime << " ns. "; } Int_t iDetId = (pHit->GetAddress() & DetMask); std::map<UInt_t, UInt_t>::iterator it = fDetIdIndexMap.find(iDetId); - if (it == fDetIdIndexMap.end()) - continue; // continue for invalid detector index - Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; + if (it == fDetIdIndexMap.end()) continue; // continue for invalid detector index + Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; Int_t iSmType = CbmTofAddress::GetSmType(iDetId); Int_t iSm = CbmTofAddress::GetSmId(iDetId); @@ -3872,17 +3033,11 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { //LOG(debug)<<"TimeAna "<<StartAnalysisTime<<", "<< pHit->GetTime()<<", "<<dTimeAna; fhRpcCluRate[iDetIndx]->Fill(dTimeAna); - if (fdMemoryTime > 0. - && fvLastHits[iSmType][iSm][iRpc][iCh].size() == 0) - LOG(error) << Form(" <E> hit not stored in memory for TSRC %d%d%d%d", - iSmType, - iSm, - iRpc, - iCh); + if (fdMemoryTime > 0. && fvLastHits[iSmType][iSm][iRpc][iCh].size() == 0) + LOG(error) << Form(" <E> hit not stored in memory for TSRC %d%d%d%d", iSmType, iSm, iRpc, iCh); //CheckLHMemory(); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for outdated hits + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for outdated hits //std::list<CbmTofHit *>::iterator it0=fvLastHits[iSmType][iSm][iRpc][iCh].begin(); //std::list<CbmTofHit *>::iterator itL=fvLastHits[iSmType][iSm][iRpc][iCh].end(); //CbmTofHit* pH0 = *it0; @@ -3892,57 +3047,33 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { if (pH0->GetTime() > pHL->GetTime()) LOG(warn) << Form("Invalid time ordering in ev %8.0f in list of " "size %lu for TSRC %d%d%d%d: Delta t %f ", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, pHL->GetTime() - pH0->GetTime()); //while( (*((std::list<CbmTofHit *>::iterator) fvLastHits[iSmType][iSm][iRpc][iCh].begin()))->GetTime()+fdMemoryTime < pHit->GetTime() while (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 2. - || fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime() - + fdMemoryTime - < pHit->GetTime()) { - LOG(debug) - << " pop from list size " - << fvLastHits[iSmType][iSm][iRpc][iCh].size() - << Form(" outdated hits for ev %8.0f in TSRC %d%d%d%d", - fdEvent, - iSmType, - iSm, - iRpc, - iCh) - << Form( - " with tHit - tLast %f ", - pHit->GetTime() - - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()) + || fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime() + fdMemoryTime < pHit->GetTime()) { + LOG(debug) << " pop from list size " << fvLastHits[iSmType][iSm][iRpc][iCh].size() + << Form(" outdated hits for ev %8.0f in TSRC %d%d%d%d", fdEvent, iSmType, iSm, iRpc, iCh) + << Form(" with tHit - tLast %f ", + pHit->GetTime() - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()) //(*((std::list<CbmTofHit *>::iterator) fvLastHits[iSmType][iSm][iRpc][iCh].begin()))->GetTime()) ; - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != pHit->GetAddress()) - LOG(error) << Form( - "Inconsistent address in list of size %lu for TSRC %d%d%d%d: " - "0x%08x, time %f", - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != pHit->GetAddress()) + LOG(error) << Form("Inconsistent address in list of size %lu for TSRC %d%d%d%d: " + "0x%08x, time %f", + fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete(); fvLastHits[iSmType][iSm][iRpc][iCh].pop_front(); } } //fvLastHits[iSmType][iSm][iRpc][iCh].size()>1) // plot remaining time difference to previous hits - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); Double_t dTotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis CbmLink L0 = digiMatch->GetLink(iLink); Int_t iDigInd0 = L0.GetIndex(); Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); @@ -3951,20 +3082,14 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { dTotSum += pDig0->GetTot() + pDig1->GetTot(); } - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (UInt_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (UInt_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhRpcDTLastHits[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime())); - fhRpcDTLastHits_CluSize[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - digiMatch->GetNofLinks() / 2.); - fhRpcDTLastHits_Tot[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), dTotSum); + fhRpcDTLastHits[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime())); + fhRpcDTLastHits_CluSize[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + digiMatch->GetNofLinks() / 2.); + fhRpcDTLastHits_Tot[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), dTotSum); } } } // iHitInd loop end @@ -3978,15 +3103,12 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Int_t iDetId = (pHit->GetAddress() & DetMask); if (fiBeamRefAddr == iDetId) { - if (fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] - > fiBeamRefMulMax) - break; + if (fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] > fiBeamRefMulMax) break; // Check Tot CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); Double_t TotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); Int_t iDigInd0 = L0.GetIndex(); if (iDigInd0 < (Int_t) fTofCalDigiVec->size()) { CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); @@ -3994,23 +3116,19 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } } TotSum /= (0.5 * digiMatch->GetNofLinks()); - if (TotSum > fhRpcCluTot[iIndexDut]->GetYaxis()->GetXmax()) - continue; // ignore too large clusters + if (TotSum > fhRpcCluTot[iIndexDut]->GetYaxis()->GetXmax()) continue; // ignore too large clusters fTRefHits = 1; if (pHit->GetTime() < dTRef) { dTRef = pHit->GetTime(); } iBeamRefMul++; - } else { //additional reference type multiplicity - if (fiBeamRefType == CbmTofAddress::GetSmType(iDetId)) - iBeamAddRefMul++; + } + else { //additional reference type multiplicity + if (fiBeamRefType == CbmTofAddress::GetSmType(iDetId)) iBeamAddRefMul++; } } - LOG(debug) << "FillHistos: BRefMul: " << iBeamRefMul << ", " - << iBeamAddRefMul; - if (iBeamRefMul == 0) - return kFALSE; // don't fill histos without reference time - if (iBeamAddRefMul < fiBeamAddRefMul) - return kFALSE; // ask for confirmation by other beam counters + LOG(debug) << "FillHistos: BRefMul: " << iBeamRefMul << ", " << iBeamAddRefMul; + if (iBeamRefMul == 0) return kFALSE; // don't fill histos without reference time + if (iBeamAddRefMul < fiBeamAddRefMul) return kFALSE; // ask for confirmation by other beam counters for (Int_t iSel = 0; iSel < iNSel; iSel++) { BSel[iSel] = kFALSE; @@ -4032,11 +3150,9 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } for (Int_t iRpc = iR0; iRpc < iRl; iRpc++) iDutMul += fviClusterMul[fDutId][fDutSm][iRpc]; - LOG(debug) << "Selector 0: DutMul " - << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " - << iDutMul << ", BRefMul " << iBeamRefMul - << " TRef: " << dTRef << ", BeamAddRefMul " - << iBeamAddRefMul << ", " << fiBeamAddRefMul; + LOG(debug) << "Selector 0: DutMul " << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " << iDutMul + << ", BRefMul " << iBeamRefMul << " TRef: " << dTRef << ", BeamAddRefMul " << iBeamAddRefMul + << ", " << fiBeamAddRefMul; if (iDutMul > 0 && iDutMul < fiCluMulMax) { dTTrig[iSel] = dDoubleMax; // LOG(debug1)<<"Found selector 0, NbHits "<<iNbTofHits; @@ -4056,11 +3172,8 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } } } - LOG(debug) << Form( - "Found selector 0 with mul %d from 0x%08x at %f ", - iDutMul, - pTrig[iSel]->GetAddress(), - dTTrig[iSel]); + LOG(debug) << Form("Found selector 0 with mul %d from 0x%08x at %f ", iDutMul, pTrig[iSel]->GetAddress(), + dTTrig[iSel]); } break; @@ -4072,8 +3185,7 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } for (Int_t iRpc = iR0; iRpc < iRl; iRpc++) iRefMul += fviClusterMul[fSelId][fSelSm][iRpc]; - LOG(debug) << "FillHistos(): selector 1: RefMul " - << fviClusterMul[fSelId][fSelSm][fSelRpc] << ", " + LOG(debug) << "FillHistos(): selector 1: RefMul " << fviClusterMul[fSelId][fSelSm][fSelRpc] << ", " << iRefMul << ", BRefMul " << iBeamRefMul; if (iRefMul > 0 && iRefMul < fiCluMulMax) { // LOG(debug1)<<"FillHistos(): Found selector 1"; @@ -4091,17 +3203,12 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } } } - LOG(debug) << Form( - "Found selector 1 with mul %d from 0x%08x at %f ", - iRefMul, - pTrig[iSel]->GetAddress(), - dTTrig[iSel]); + LOG(debug) << Form("Found selector 1 with mul %d from 0x%08x at %f ", iRefMul, pTrig[iSel]->GetAddress(), + dTTrig[iSel]); } break; - default: - LOG(info) << "FillHistos: selection not implemented " << iSel; - ; + default: LOG(info) << "FillHistos: selection not implemented " << iSel; ; } // switch end if (fTRefMode > 10) { dTTrig[iSel] = dTRef; } } // iSel - loop end @@ -4118,22 +3225,15 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Int_t iDetId = (pHit->GetAddress() & DetMask); if (fSel2Addr == iDetId) { Double_t dzscal = 1.; - if (fEnableMatchPosScaling) - dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); - Double_t dSEl2dXdz = (pHit->GetX() - pTrig[iSel]->GetX()) - / (pHit->GetZ() - pTrig[iSel]->GetZ()); - Double_t dSEl2dYdz = (pHit->GetY() - pTrig[iSel]->GetY()) - / (pHit->GetZ() - pTrig[iSel]->GetZ()); + if (fEnableMatchPosScaling) dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); + Double_t dSEl2dXdz = (pHit->GetX() - pTrig[iSel]->GetX()) / (pHit->GetZ() - pTrig[iSel]->GetZ()); + Double_t dSEl2dYdz = (pHit->GetY() - pTrig[iSel]->GetY()) / (pHit->GetZ() - pTrig[iSel]->GetZ()); - if (TMath::Sqrt( - TMath::Power( - pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) - + TMath::Power( - pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) + if (TMath::Sqrt(TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) + + TMath::Power(pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) < fdCaldXdYMax) { BSel[iSel] = kTRUE; - Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz - + dSEl2dYdz * dSEl2dYdz); + Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz + dSEl2dYdz * dSEl2dYdz); if (dX2Y2 < dSel2dXdYMin[iSel]) { ddXdZ[iSel] = dSEl2dXdz; ddYdZ[iSel] = dSEl2dYdz; @@ -4150,18 +3250,14 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - uTriggerPattern |= (0x1 << (iSel * 3 - + CbmTofAddress::GetRpcId( - pTrig[iSel]->GetAddress() & DetMask))); + uTriggerPattern |= (0x1 << (iSel * 3 + CbmTofAddress::GetRpcId(pTrig[iSel]->GetAddress() & DetMask))); } for (Int_t iSel = 0; iSel < iNSel; iSel++) { if (BSel[iSel]) { if (dTRef != 0. && fTRefHits > 0) { for (UInt_t uChannel = 0; uChannel < 16; uChannel++) { - if (uTriggerPattern & (0x1 << uChannel)) { - fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); - } + if (uTriggerPattern & (0x1 << uChannel)) { fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); } } } } @@ -4174,9 +3270,8 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Int_t iDetId = (pHit->GetAddress() & DetMask); std::map<UInt_t, UInt_t>::iterator it = fDetIdIndexMap.find(iDetId); - if (it == fDetIdIndexMap.end()) - continue; // continue for invalid detector index - Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; + if (it == fDetIdIndexMap.end()) continue; // continue for invalid detector index + Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; Int_t iSmType = CbmTofAddress::GetSmType(iDetId); Int_t iSm = CbmTofAddress::GetSmId(iDetId); @@ -4186,30 +3281,25 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { Double_t w = fviClusterMul[iSmType][iSm][iRpc]; - if (w == 0.) - w = 1.; + if (w == 0.) w = 1.; else w = 1. / w; - fhTRpcCluMul[iDetIndx][iSel]->Fill( - fviClusterMul[iSmType][iSm][iRpc], w); + fhTRpcCluMul[iDetIndx][iSel]->Fill(fviClusterMul[iSmType][iSm][iRpc], w); } } - if (fviClusterMul[iSmType][iSm][iRpc] > fiCluMulMax) - continue; // skip this event + if (fviClusterMul[iSmType][iSm][iRpc] > fiCluMulMax) continue; // skip this event if (iBeamRefMul == 0) break; Int_t iChId = pHit->GetAddress(); fChannelInfo = fDigiPar->GetCell(iChId); Int_t iCh = CbmTofAddress::GetChannelId(iChId); if (NULL == fChannelInfo) { - LOG(error) << "Invalid Channel Pointer for ChId " - << Form(" 0x%08x ", iChId) << ", Ch " << iCh; + LOG(error) << "Invalid Channel Pointer for ChId " << Form(" 0x%08x ", iChId) << ", Ch " << iCh; continue; } /*TGeoNode *fNode=*/ // prepare global->local trafo - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); /* LOG(debug1)<<"Hit info: " <<Form(" 0x%08x %d %f %f %f %f %f %d",iChId,iCh, @@ -4231,22 +3321,17 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { hitpos_local[0], hitpos_local[1], hitpos_local[2]) ; */ - fhRpcCluPosition[iDetIndx]->Fill( - (Double_t) iCh, hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); - fhSmCluPosition[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), - hitpos_local[1]); + fhRpcCluPosition[iDetIndx]->Fill((Double_t) iCh, hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); + fhSmCluPosition[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), hitpos_local[1]); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - fhTRpcCluPosition[iDetIndx][iSel]->Fill( - (Double_t) iCh, - hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); - fhTSmCluPosition[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), - hitpos_local[1]); + fhTRpcCluPosition[iDetIndx][iSel]->Fill((Double_t) iCh, + hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); + fhTSmCluPosition[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), hitpos_local[1]); } - if (TMath::Abs(hitpos_local[1]) > fChannelInfo->GetSizey() * fPosYMaxScal) - continue; + if (TMath::Abs(hitpos_local[1]) > fChannelInfo->GetSizey() * fPosYMaxScal) continue; /* LOG(debug1)<<" TofDigiMatchColl entries:" <<fTofDigiMatchColl->GetEntries() @@ -4262,33 +3347,25 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { <<digiMatch->GetNofLinks()<< " matches for iCh "<<iCh<<" at iHitInd "<<iHitInd ; */ - fhRpcCluSize[iDetIndx]->Fill((Double_t) iCh, - digiMatch->GetNofLinks() / 2.); + fhRpcCluSize[iDetIndx]->Fill((Double_t) iCh, digiMatch->GetNofLinks() / 2.); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - fhTRpcCluSize[iDetIndx][iSel]->Fill((Double_t) iCh, - digiMatch->GetNofLinks() / 2.); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + fhTRpcCluSize[iDetIndx][iSel]->Fill((Double_t) iCh, digiMatch->GetNofLinks() / 2.); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (UInt_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (UInt_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhTRpcCluSizeDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - digiMatch->GetNofLinks() / 2.); + fhTRpcCluSizeDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + digiMatch->GetNofLinks() / 2.); } } } Double_t TotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink++) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink++) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); Int_t iDigInd0 = L0.GetIndex(); if (iDigInd0 < (Int_t) fTofCalDigiVec->size()) { CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); @@ -4305,27 +3382,19 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Double_t dzscal = 1.; //Double_t dDist=0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); Int_t iDigInd0 = L0.GetIndex(); - Int_t iDigInd1 = - (digiMatch->GetLink(iLink + 1)).GetIndex(); //vDigish.at(ivDigInd+1); + Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); //vDigish.at(ivDigInd+1); //LOG(debug1)<<" " << iDigInd0<<", "<<iDigInd1; - if (iDigInd0 < (Int_t) fTofCalDigiVec->size() - && iDigInd1 < (Int_t) fTofCalDigiVec->size()) { + if (iDigInd0 < (Int_t) fTofCalDigiVec->size() && iDigInd1 < (Int_t) fTofCalDigiVec->size()) { CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); CbmTofDigi* pDig1 = &(fTofCalDigiVec->at(iDigInd1)); if ((Int_t) pDig0->GetType() != iSmType) { LOG(error) << Form(" Wrong Digi SmType for Tofhit %d in iDetIndx " "%d, Ch %d with %3.0f strips at Indx %d, %d", - iHitInd, - iDetIndx, - iCh, - dNstrips, - iDigInd0, - iDigInd1); + iHitInd, iDetIndx, iCh, dNstrips, iDigInd0, iDigInd1); } /* LOG(debug1)<<" fhRpcCluTot: Digi 0 "<<iDigInd0<<": Ch "<<pDig0->GetChannel()<<", Side "<<pDig0->GetSide() @@ -4334,105 +3403,66 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { <<" , StripSide "<<(Double_t)iCh*2.+pDig1->GetSide() <<", Tot0 " << pDig0->GetTot() <<", Tot1 "<<pDig1->GetTot(); */ - fhRpcCluTot[iDetIndx]->Fill( - pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); - fhRpcCluTot[iDetIndx]->Fill( - pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); + fhRpcCluTot[iDetIndx]->Fill(pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); + fhRpcCluTot[iDetIndx]->Fill(pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); Int_t iCh0 = pDig0->GetChannel(); Int_t iCh1 = pDig1->GetChannel(); Int_t iS0 = pDig0->GetSide(); Int_t iS1 = pDig1->GetSide(); if (iCh0 != iCh1 || iS0 == iS1) { - LOG(error) << Form( - " MT2 for Tofhit %d in iDetIndx %d, Ch %d from %3.0f strips: ", - iHitInd, - iDetIndx, - iCh, - dNstrips) - << Form(" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ", - iDigInd0, - iCh0, - iS0, - pDig0->GetTime()) - << Form(" Dig1: Ind %d, Ch %d, Side %d, T: %6.1f ", - iDigInd1, - iCh1, - iS1, - pDig1->GetTime()); + LOG(error) << Form(" MT2 for Tofhit %d in iDetIndx %d, Ch %d from %3.0f strips: ", iHitInd, iDetIndx, iCh, + dNstrips) + << Form(" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ", iDigInd0, iCh0, iS0, pDig0->GetTime()) + << Form(" Dig1: Ind %d, Ch %d, Side %d, T: %6.1f ", iDigInd1, iCh1, iS1, pDig1->GetTime()); continue; } if (0 > iCh0 || fDigiBdfPar->GetNbChan(iSmType, iRpc) <= iCh0) { - LOG(error) << Form( - " Wrong Digi for Tofhit %d in iDetIndx %d, Ch %d at Indx %d, %d " - "from %3.0f strips: %d, %d, %d, %d", - iHitInd, - iDetIndx, - iCh, - iDigInd0, - iDigInd1, - dNstrips, - iCh0, - iCh1, - iS0, - iS1); + LOG(error) << Form(" Wrong Digi for Tofhit %d in iDetIndx %d, Ch %d at Indx %d, %d " + "from %3.0f strips: %d, %d, %d, %d", + iHitInd, iDetIndx, iCh, iDigInd0, iDigInd1, dNstrips, iCh0, iCh1, iS0, iS1); continue; } - if ( - digiMatch->GetNofLinks() - > 2) //&& digiMatch->GetNofLinks()<8 ) // FIXME: hardcoded limits on CluSize + if (digiMatch->GetNofLinks() > 2) //&& digiMatch->GetNofLinks()<8 ) // FIXME: hardcoded limits on CluSize { dNstrips += 1.; - dMeanTimeSquared += TMath::Power( - 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime(), 2); + dMeanTimeSquared += TMath::Power(0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime(), 2); // fhRpcCluAvWalk[iDetIndx]->Fill(0.5*(pDig0->GetTot()+pDig1->GetTot()), // 0.5*(pDig0->GetTime()+pDig1->GetTime())-pHit->GetTime()); - fhRpcCluAvLnWalk[iDetIndx]->Fill( - TMath::Log10(0.5 * (pDig0->GetTot() + pDig1->GetTot())), - 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime()); + fhRpcCluAvLnWalk[iDetIndx]->Fill(TMath::Log10(0.5 * (pDig0->GetTot() + pDig1->GetTot())), + 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime()); Double_t dTotWeigth = (pDig0->GetTot() + pDig1->GetTot()) / TotSum; Double_t dCorWeigth = 1. - dTotWeigth; fhRpcCluDelTOff[iDetIndx]->Fill( - pDig0->GetChannel(), - dCorWeigth - * (0.5 * (pDig0->GetTime() + pDig1->GetTime()) - - pHit->GetTime())); + pDig0->GetChannel(), dCorWeigth * (0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime())); - Double_t dDelPos = 0.5 * (pDig0->GetTime() - pDig1->GetTime()) - * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t dDelPos = 0.5 * (pDig0->GetTime() - pDig1->GetTime()) * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (0 == pDig0->GetSide()) dDelPos *= -1.; - fhRpcCluDelPos[iDetIndx]->Fill( - pDig0->GetChannel(), dCorWeigth * (dDelPos - hitpos_local[1])); + fhRpcCluDelPos[iDetIndx]->Fill(pDig0->GetChannel(), dCorWeigth * (dDelPos - hitpos_local[1])); fhRpcCluWalk[iDetIndx][iCh0][iS0]->Fill( pDig0->GetTot(), pDig0->GetTime() - (pHit->GetTime() - - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); fhRpcCluWalk[iDetIndx][iCh1][iS1]->Fill( pDig1->GetTot(), pDig1->GetTime() - (pHit->GetTime() - - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); - - fhRpcCluAvWalk[iDetIndx]->Fill( - pDig0->GetTot(), - pDig0->GetTime() - - (pHit->GetTime() - - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); - fhRpcCluAvWalk[iDetIndx]->Fill( - pDig1->GetTot(), - pDig1->GetTime() - - (pHit->GetTime() - - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + + fhRpcCluAvWalk[iDetIndx]->Fill(pDig0->GetTot(), pDig0->GetTime() + - (pHit->GetTime() + - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] + / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + fhRpcCluAvWalk[iDetIndx]->Fill(pDig1->GetTot(), pDig1->GetTime() + - (pHit->GetTime() + - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] + / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); } // end of Clustersize > 1 condition /* LOG(debug1)<<" fhTRpcCluTot: Digi 0 "<<iDigInd0<<": Ch "<<pDig0->GetChannel()<<", Side "<<pDig0->GetSide() @@ -4444,75 +3474,51 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { if (NULL == pHit || NULL == pTrig[iSel]) { - LOG(info) << " invalid pHit, iSel " << iSel << ", iDetIndx " - << iDetIndx; + LOG(info) << " invalid pHit, iSel " << iSel << ", iDetIndx " << iDetIndx; break; } if (pHit->GetAddress() == pTrig[iSel]->GetAddress()) continue; - fhTRpcCluTot[iDetIndx][iSel]->Fill( - pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); - fhTRpcCluTot[iDetIndx][iSel]->Fill( - pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + fhTRpcCluTot[iDetIndx][iSel]->Fill(pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); + fhTRpcCluTot[iDetIndx][iSel]->Fill(pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (UInt_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (UInt_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - pDig0->GetTot()); - fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - pDig1->GetTot()); + fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + pDig0->GetTot()); + fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + pDig1->GetTot()); } } if (iLink == 0) { // Fill histo only once (for 1. digi entry) - if (fEnableMatchPosScaling) - dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); - fhTRpcCludXdY[iDetIndx][iSel]->Fill( - pHit->GetX() - dzscal * pTrig[iSel]->GetX(), - pHit->GetY() - dzscal * pTrig[iSel]->GetY()); + if (fEnableMatchPosScaling) dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); + fhTRpcCludXdY[iDetIndx][iSel]->Fill(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), + pHit->GetY() - dzscal * pTrig[iSel]->GetY()); dZsign[iSel] = 1.; if (pHit->GetZ() < pTrig[iSel]->GetZ()) dZsign[iSel] = -1.; } // look for geometrical match with selector hit //if( iSmType==fiBeamRefType // to get entries in diamond/BeamRef histos if (iSmType == 5 // FIXME, to get entries in diamond histos - || TMath::Sqrt( - TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), - 2.) - + TMath::Power( - pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) + || TMath::Sqrt(TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) + + TMath::Power(pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) < fdCaldXdYMax) { if (!fEnableMatchPosScaling && dSel2dXdYMin[iSel] < 1.E300) if (TMath::Sqrt( - TMath::Power( - pHit->GetX() - - (pTrig[iSel]->GetX() - + ddXdZ[iSel] - * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), - 2.) - + TMath::Power( - pHit->GetY() - - (pTrig[iSel]->GetY() - + ddYdZ[iSel] - * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), - 2.)) + TMath::Power(pHit->GetX() + - (pTrig[iSel]->GetX() + ddXdZ[iSel] * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), + 2.) + + TMath::Power(pHit->GetY() + - (pTrig[iSel]->GetY() + ddYdZ[iSel] * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), + 2.)) > 0.5 * fdCaldXdYMax) - continue; // refine position selection cut in cosmic measurement + continue; // refine position selection cut in cosmic measurement dTcor[iSel] = 0.; // precaution - if ( - dTRef != 0. - && TMath::Abs(dTRef - dTTrig[iSel]) - < fdDelTofMax) { // correct times for DelTof - velocity spread - if ( - iLink - == 0) { // do calculations only once (at 1. digi entry) // interpolate! + if (dTRef != 0. + && TMath::Abs(dTRef - dTTrig[iSel]) < fdDelTofMax) { // correct times for DelTof - velocity spread + if (iLink == 0) { // do calculations only once (at 1. digi entry) // interpolate! // calculate spatial distance to trigger hit /* dDist=TMath::Sqrt(TMath::Power(pHit->GetX()-pTrig[iSel]->GetX(),2.) @@ -4521,26 +3527,22 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { */ // determine correction value //if(fiBeamRefAddr != iDetId) // do not do this for reference counter itself - if (fTRefMode - < 11) // do not do this for trigger counter itself + if (fTRefMode < 11) // do not do this for trigger counter itself { Double_t dTentry = dTRef - dTTrig[iSel] + fdDelTofMax; - Int_t iBx = dTentry / 2. / fdDelTofMax * nbClDelTofBinX; + Int_t iBx = dTentry / 2. / fdDelTofMax * nbClDelTofBinX; if (iBx < 0) iBx = 0; if (iBx > nbClDelTofBinX - 1) iBx = nbClDelTofBinX - 1; Double_t dBinWidth = 2. * fdDelTofMax / nbClDelTofBinX; - Double_t dDTentry = - dTentry - ((Double_t) iBx) * dBinWidth; - Int_t iBx1 = 0; + Double_t dDTentry = dTentry - ((Double_t) iBx) * dBinWidth; + Int_t iBx1 = 0; dDTentry < 0 ? iBx1 = iBx - 1 : iBx1 = iBx + 1; Double_t w0 = 1. - TMath::Abs(dDTentry) / dBinWidth; Double_t w1 = 1. - w0; if (iBx1 < 0) iBx1 = 0; if (iBx1 > nbClDelTofBinX - 1) iBx1 = nbClDelTofBinX - 1; - dDelTof = - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * w0 - + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx1][iSel] - * w1; + dDelTof = fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * w0 + + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx1][iSel] * w1; //dDelTof *= dDist; // has to be consistent with fhTRpcCluDelTof filling /* LOG(debug1)<<Form(" DelTof for SmT %d, Sm %d, R %d, T %d, dTRef %6.1f, Bx %d, Bx1 %d, DTe %6.1f -> DelT %6.1f", @@ -4553,37 +3555,18 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { // Double_t dAvTot=0.5*(pDig0->GetTot()+pDig1->GetTot()); } // if(iLink==0) - LOG(debug) << Form( - " TRpcCluWalk for Ev %d, Link %d(%d), Sel %d, TSR %d%d%d, " - "Ch %d,%d, S %d,%d T %f, DelTof %6.1f, W-ent: %6.0f,%6.0f", - fiNevtBuild, - iLink, - (Int_t) digiMatch->GetNofLinks(), - iSel, - iSmType, - iSm, - iRpc, - iCh0, - iCh1, - iS0, - iS1, - dTTrig[iSel], - dDelTof, - fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries(), - fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()); + LOG(debug) << Form(" TRpcCluWalk for Ev %d, Link %d(%d), Sel %d, TSR %d%d%d, " + "Ch %d,%d, S %d,%d T %f, DelTof %6.1f, W-ent: %6.0f,%6.0f", + fiNevtBuild, iLink, (Int_t) digiMatch->GetNofLinks(), iSel, iSmType, iSm, iRpc, + iCh0, iCh1, iS0, iS1, dTTrig[iSel], dDelTof, + fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries(), + fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()); if (fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries() != fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()) - LOG(error) - << Form(" Inconsistent walk histograms -> debugging " - "necessary ... for %d, %d, %d, %d, %d, %d, %d ", - fiNevtBuild, - iDetIndx, - iSel, - iCh0, - iCh1, - iS0, - iS1); + LOG(error) << Form(" Inconsistent walk histograms -> debugging " + "necessary ... for %d, %d, %d, %d, %d, %d, %d ", + fiNevtBuild, iDetIndx, iSel, iCh0, iCh1, iS0, iS1); /* LOG(debug1)<<Form(" TRpcCluWalk values side %d: %f, %f, side %d: %f, %f ", iS0,pDig0->GetTot(),pDig0->GetTime() @@ -4616,35 +3599,27 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { if (iLink == 0) { // Fill histo only once (for 1. digi entry) //fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef-dTTrig[iSel],dTcor[iSel]/dDist); - fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef - dTTrig[iSel], - dTcor[iSel]); - fhTSmCluTOff[iSmType][iSel]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), dTcor[iSel]); + fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef - dTTrig[iSel], dTcor[iSel]); + fhTSmCluTOff[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), dTcor[iSel]); fhTSmCluTRun[iSmType][iSel]->Fill(fdEvent, dTcor[iSel]); - if ( - iDetId - != (pTrig[iSel]->GetAddress() - & DetMask)) { // transform matched hit-pair back into detector frame - hitpos[0] = pHit->GetX() - dzscal * pTrig[iSel]->GetX() - + fChannelInfo->GetX(); - hitpos[1] = pHit->GetY() - dzscal * pTrig[iSel]->GetY() - + fChannelInfo->GetY(); + if (iDetId + != (pTrig[iSel]->GetAddress() + & DetMask)) { // transform matched hit-pair back into detector frame + hitpos[0] = pHit->GetX() - dzscal * pTrig[iSel]->GetX() + fChannelInfo->GetX(); + hitpos[1] = pHit->GetY() - dzscal * pTrig[iSel]->GetY() + fChannelInfo->GetY(); hitpos[2] = pHit->GetZ(); - gGeoManager->MasterToLocal( - hitpos, hitpos_local); // transform into local frame - fhRpcCluDelMatPos[iDetIndx]->Fill((Double_t) iCh, - hitpos_local[1]); - fhRpcCluDelMatTOff[iDetIndx]->Fill( - (Double_t) iCh, - (pHit->GetTime() - dTTrig[iSel]) - dTTcor[iSel]); + gGeoManager->MasterToLocal(hitpos, hitpos_local); // transform into local frame + fhRpcCluDelMatPos[iDetIndx]->Fill((Double_t) iCh, hitpos_local[1]); + fhRpcCluDelMatTOff[iDetIndx]->Fill((Double_t) iCh, + (pHit->GetTime() - dTTrig[iSel]) - dTTcor[iSel]); } } // iLink==0 condition end } // position condition end } // Match condition end } // closing of selector loop - } else { - LOG(error) << "FillHistos: invalid digi index " << iDetIndx - << " digi0,1" << iDigInd0 << ", " << iDigInd1 + } + else { + LOG(error) << "FillHistos: invalid digi index " << iDetIndx << " digi0,1" << iDigInd0 << ", " << iDigInd1 << " - max:" << fTofCalDigiVec->size() // << " in event " << XXX ; @@ -4657,11 +3632,7 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Double_t dTrms = TMath::Sqrt(dVar); LOG(debug) << Form(" Trms for Tofhit %d in iDetIndx %d, Ch %d from " "%3.0f strips: %6.3f ns", - iHitInd, - iDetIndx, - iCh, - dNstrips, - dTrms); + iHitInd, iDetIndx, iCh, dNstrips, dTrms); fhRpcCluTrms[iDetIndx]->Fill((Double_t) iCh, dTrms); pHit->SetTimeError(dTrms); } @@ -4672,12 +3643,10 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { <<fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax() ; */ - if (TMath::Abs(hitpos_local[1]) - < (fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax())) { + if (TMath::Abs(hitpos_local[1]) < (fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax())) { if (dTRef != 0. && fTRefHits == 1) { fhRpcCluTOff[iDetIndx]->Fill((Double_t) iCh, pHit->GetTime() - dTRef); - fhSmCluTOff[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), - pHit->GetTime() - dTRef); + fhSmCluTOff[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), pHit->GetTime() - dTRef); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { @@ -4688,28 +3657,21 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { */ if (pHit->GetAddress() == pTrig[iSel]->GetAddress()) continue; - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (UInt_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (UInt_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; //LOG(debug1)<<Form(" %f,",pHit->GetTime()-(*itL)->GetTime()); } } // fill Time Offset histograms without velocity spread (DelTof) correction - fhTRpcCluTOff[iDetIndx][iSel]->Fill( - (Double_t) iCh, - pHit->GetTime() - - dTTrig[iSel]); // -dTTcor[iSel] only valid for matches - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + fhTRpcCluTOff[iDetIndx][iSel]->Fill((Double_t) iCh, + pHit->GetTime() + - dTTrig[iSel]); // -dTTcor[iSel] only valid for matches + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; for (Int_t iH = 0; iH < 1; iH++) { // use only last hit // for(Int_t iH=0; iH<fvLastHits[iSmType][iSm][iRpc][iCh].size()-1; iH++){//fill for all memorized hits @@ -4718,18 +3680,12 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { if (dTsinceLast > fdMemoryTime) LOG(error) << Form("Invalid Time since last hit on channel " "TSRC %d%d%d%d: %f > %f", - iSmType, - iSm, - iRpc, - iCh, - dTsinceLast, - fdMemoryTime); - - fhTRpcCluTOffDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(dTsinceLast), pHit->GetTime() - dTTrig[iSel]); - fhTRpcCluMemMulDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(dTsinceLast), - fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1); + iSmType, iSm, iRpc, iCh, dTsinceLast, fdMemoryTime); + + fhTRpcCluTOffDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(dTsinceLast), + pHit->GetTime() - dTTrig[iSel]); + fhTRpcCluMemMulDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(dTsinceLast), + fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1); } } } @@ -4741,18 +3697,17 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { } static Int_t iNPulserFound = 0; -Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { +Bool_t CbmDeviceHitBuilderTof::MonitorPulser() +{ iNPulserFound++; const Int_t iDet0 = fiPulDetRef; // Define reference detector const Double_t Tlim = 0.5; Int_t iDigi0 = -1; switch (fiPulserMode) { - case 1: // mcbm : - if ((UInt_t) fiNDigiIn - != fiPulMulMin * 2 + 2) { // 2 * working RPCs + 1 Diamond - LOG(debug) << "Incomplete or distorted pulser event " << iNPulserFound - << " with " << fiNDigiIn << " digis instead of " - << fiPulMulMin * 2 + 2; + case 1: // mcbm : + if ((UInt_t) fiNDigiIn != fiPulMulMin * 2 + 2) { // 2 * working RPCs + 1 Diamond + LOG(debug) << "Incomplete or distorted pulser event " << iNPulserFound << " with " << fiNDigiIn + << " digis instead of " << fiPulMulMin * 2 + 2; if ((UInt_t) fiNDigiIn < fiPulMulMin * 2) return kTRUE; } break; @@ -4779,29 +3734,21 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { } if (iDigi0 == -1) { - LOG(error) << Form( - "Pulser reference %d not found in pulser event %d of mul %d, return", - iDet0, - iNPulserFound, - fiNDigiIn); + LOG(error) << Form("Pulser reference %d not found in pulser event %d of mul %d, return", iDet0, iNPulserFound, + fiNDigiIn); return kTRUE; } if (fvPulserTimes[iDet0][0].size() > 0) LOG(debug) << fiNDigiIn << " pulser digis with ref in " - << Form("0x%08x at %d with deltaT %12.3f", - fvDigiIn[iDigi0].GetAddress(), - iDigi0, - fvDigiIn[iDigi0].GetTime() - - fvPulserTimes[iDet0][0].back()); + << Form("0x%08x at %d with deltaT %12.3f", fvDigiIn[iDigi0].GetAddress(), iDigi0, + fvDigiIn[iDigi0].GetTime() - fvPulserTimes[iDet0][0].back()); for (Int_t iDigi = 0; iDigi < fiNDigiIn; iDigi++) { Int_t iCh = fvDigiIn[iDigi].GetChannel(); - Int_t iDetIndx = - fDigiBdfPar->GetDetInd(fvDigiIn[iDigi].GetAddress() & DetMask); - fhRpcDigiTot[iDetIndx]->Fill(2 * iCh + fvDigiIn[iDigi].GetSide(), - fvDigiIn[iDigi].GetTot()); + Int_t iDetIndx = fDigiBdfPar->GetDetInd(fvDigiIn[iDigi].GetAddress() & DetMask); + fhRpcDigiTot[iDetIndx]->Fill(2 * iCh + fvDigiIn[iDigi].GetSide(), fvDigiIn[iDigi].GetTot()); Int_t iAddr = fvDigiIn[iDigi].GetAddress() & DetMask; Int_t iDet = fDetIdIndexMap[iAddr]; @@ -4812,10 +3759,9 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { case 1: // mCBM if (fvDigiIn[iDigi].GetType() != 5) { if (iCh != 0 && iCh != 31) continue; - if (fvDigiIn[iDigi].GetTot() > fiPulTotMax - || fvDigiIn[iDigi].GetTot() < fiPulTotMin) - continue; - } else { + if (fvDigiIn[iDigi].GetTot() > fiPulTotMax || fvDigiIn[iDigi].GetTot() < fiPulTotMin) continue; + } + else { LOG(debug) << "Found PulHit of Type 5 in Ch " << iCh; // if (iCh == 5) iSide=1; // Special case for diamond, pulser for channels 5-8 in channel 5, stored as side 1 // if (iCh !=0 && iCh != 5) continue; @@ -4831,55 +3777,43 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { break; } - if (fvPulserTimes[iDet][iSide].size() == (UInt_t) NPulserTimes) - fvPulserTimes[iDet][iSide].pop_front(); + if (fvPulserTimes[iDet][iSide].size() == (UInt_t) NPulserTimes) fvPulserTimes[iDet][iSide].pop_front(); if (iDet == iDet0 && 1 == iSide) { // check consistency of latest hit if (fvPulserTimes[iDet][iSide].size() > 1) { - Double_t TDif = (fvPulserTimes[iDet][iSide].back() - - fvPulserTimes[iDet][iSide].front()) + Double_t TDif = (fvPulserTimes[iDet][iSide].back() - fvPulserTimes[iDet][iSide].front()) / (fvPulserTimes[iDet][iSide].size() - 1); - if (TMath::Abs(fvDigiIn[iDigi].GetTime() - - fvPulserTimes[iDet][iSide].back() - TDif) + if (TMath::Abs(fvDigiIn[iDigi].GetTime() - fvPulserTimes[iDet][iSide].back() - TDif) > 1.E3) { // probably due to parallel processing // action, reset fvPulserTimes[iDet][iSide].clear(); - } else { - if (TMath::Abs(fvDigiIn[iDigi].GetTime() - - fvPulserTimes[iDet][iSide].back() - TDif) - > 10.) { + } + else { + if (TMath::Abs(fvDigiIn[iDigi].GetTime() - fvPulserTimes[iDet][iSide].back() - TDif) > 10.) { LOG(info) << Form("Unexpected Pulser Time for event %d, pulser %d: " "%15.1f instead %15.1f, TDif: %10.1f != %10.1f", - (int) fdEvent, - iNPulserFound, - fvDigiIn[iDigi].GetTime(), + (int) fdEvent, iNPulserFound, fvDigiIn[iDigi].GetTime(), fvPulserTimes[iDet][iSide].back() + TDif, - fvDigiIn[iDigi].GetTime() - - fvPulserTimes[iDet][iSide].back(), - TDif); + fvDigiIn[iDigi].GetTime() - fvPulserTimes[iDet][iSide].back(), TDif); // append dummy entry - fvPulserTimes[iDet][iSide].push_back( - (Double_t)(fvPulserTimes[iDet][iSide].back() + TDif)); + fvPulserTimes[iDet][iSide].push_back((Double_t)(fvPulserTimes[iDet][iSide].back() + TDif)); continue; } } } // append new entry - fvPulserTimes[iDet][iSide].push_back( - (Double_t)(fvDigiIn[iDigi].GetTime())); - } else { - Double_t dDeltaT0 = - (Double_t)(fvDigiIn[iDigi].GetTime() - fvDigiIn[iDigi0].GetTime()); + fvPulserTimes[iDet][iSide].push_back((Double_t)(fvDigiIn[iDigi].GetTime())); + } + else { + Double_t dDeltaT0 = (Double_t)(fvDigiIn[iDigi].GetTime() - fvDigiIn[iDigi0].GetTime()); // check consistency of latest hit if (fvPulserOffset[iDet][iSide] != 0.) if (TMath::Abs(dDeltaT0 - fvPulserOffset[iDet][iSide]) > Tlim) { - LOG(info) << "Unexpected pulser offset at ev " << fdEvent - << ", pulcnt " << iNPulserFound << " for Det " << iDet - << Form(", addr 0x%08x", iAddr) << ", side " << iSide - << ": " << dDeltaT0 - fvPulserOffset[iDet][iSide] << " ( " - << fvPulserTimes[iDet][iSide].size() << " ) "; + LOG(info) << "Unexpected pulser offset at ev " << fdEvent << ", pulcnt " << iNPulserFound << " for Det " + << iDet << Form(", addr 0x%08x", iAddr) << ", side " << iSide << ": " + << dDeltaT0 - fvPulserOffset[iDet][iSide] << " ( " << fvPulserTimes[iDet][iSide].size() << " ) "; fvPulserTimes[iDet][iSide].clear(); // skip this event // continue; @@ -4887,10 +3821,8 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { // fill monitoring histo if (fvPulserOffset[iDet][iSide] != 0.) { - fhPulserTimesRaw->Fill(iDet * 2 + iSide, - dDeltaT0 - fvPulserOffset[iDet][iSide]); - fhPulserTimeRawEvo[iDet * 2 + iSide]->Fill( - iNPulserFound, dDeltaT0 - fvPulserOffset[iDet][iSide]); + fhPulserTimesRaw->Fill(iDet * 2 + iSide, dDeltaT0 - fvPulserOffset[iDet][iSide]); + fhPulserTimeRawEvo[iDet * 2 + iSide]->Fill(iNPulserFound, dDeltaT0 - fvPulserOffset[iDet][iSide]); } // append new entry fvPulserTimes[iDet][iSide].push_back(dDeltaT0); @@ -4903,17 +3835,13 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { if (fvPulserTimes[iDet][iSide].size() > 0) { Double_t Tmean = 0.; std::list<Double_t>::iterator it; - for (it = fvPulserTimes[iDet][iSide].begin(); - it != fvPulserTimes[iDet][iSide].end(); - ++it) + for (it = fvPulserTimes[iDet][iSide].begin(); it != fvPulserTimes[iDet][iSide].end(); ++it) Tmean += *it; Tmean /= fvPulserTimes[iDet][iSide].size(); if (TMath::Abs(Tmean - fvPulserOffset[iDet][iSide]) > Tlim) - LOG(debug) << "New pulser offset at ev " << fdEvent << ", pulcnt " - << iNPulserFound << " for Det " << iDet << ", side " - << iSide << ": " << Tmean << " ( " - << fvPulserTimes[iDet][iSide].size() << " ) "; + LOG(debug) << "New pulser offset at ev " << fdEvent << ", pulcnt " << iNPulserFound << " for Det " << iDet + << ", side " << iSide << ": " << Tmean << " ( " << fvPulserTimes[iDet][iSide].size() << " ) "; fvPulserOffset[iDet][iSide] = Tmean; } @@ -4931,7 +3859,8 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { case 1: if (fvDigiIn[iDigi].GetType() != 5) { if (iCh != 0 && iCh != 31) continue; - } else { + } + else { //if (iCh == 5) iSide=1; // Special case for diamond, pulser for channels 5-8 in channel 5, stored as side 1 if (iCh > 39) iSide = 1; // Special case for diamond in Mar2019 // if(iCh !=0 && iCh != 5) continue; @@ -4946,8 +3875,7 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { } Double_t dDeltaT0 = - (Double_t)(fvDigiIn[iDigi].GetTime() - fvDigiIn[iDigi0].GetTime()) - - fvPulserOffset[iDet][iSide]; + (Double_t)(fvDigiIn[iDigi].GetTime() - fvDigiIn[iDigi0].GetTime()) - fvPulserOffset[iDet][iSide]; // fill monitoring histo fhPulserTimesCor->Fill(iDet * 2 + iSide, dDeltaT0); @@ -4955,7 +3883,8 @@ Bool_t CbmDeviceHitBuilderTof::MonitorPulser() { return kTRUE; } -Bool_t CbmDeviceHitBuilderTof::ApplyPulserCorrection() { +Bool_t CbmDeviceHitBuilderTof::ApplyPulserCorrection() +{ for (Int_t iDigi = 0; iDigi < fiNDigiIn; iDigi++) { Int_t iAddr = fvDigiIn[iDigi].GetAddress() & DetMask; Int_t iDet = fDetIdIndexMap[iAddr]; @@ -4975,8 +3904,7 @@ Bool_t CbmDeviceHitBuilderTof::ApplyPulserCorrection() { } break; } - fvDigiIn[iDigi].SetTime(fvDigiIn[iDigi].GetTime() - - fvPulserOffset[iDet][iSide]); + fvDigiIn[iDigi].SetTime(fvDigiIn[iDigi].GetTime() - fvPulserOffset[iDet][iSide]); } return kTRUE; } diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx index 1573c663a2..b1736e0650 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx @@ -6,9 +6,9 @@ */ #include "CbmDeviceUnpackTofMcbm2018.h" + #include "CbmDefs.h" #include "CbmMQDefs.h" - #include "CbmMcbm2018TofPar.h" #include "CbmMcbm2018UnpackerAlgoTof.h" //#include "CbmHistManager.h" @@ -35,9 +35,8 @@ #include <array> #include <iomanip> -#include <string> - #include <stdexcept> +#include <string> struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -117,15 +116,15 @@ CbmDeviceUnpackTofMcbm2018::CbmDeviceUnpackTofMcbm2018() , fviRpcSide() , fviRpcChUId() , fBuffer(CbmTbDaqBuffer::Instance()) - , fUnpackerAlgo(nullptr) { + , fUnpackerAlgo(nullptr) +{ fUnpackerAlgo = new CbmMcbm2018UnpackerAlgoTof(); } -CbmDeviceUnpackTofMcbm2018::~CbmDeviceUnpackTofMcbm2018() { - delete fUnpackerAlgo; -} +CbmDeviceUnpackTofMcbm2018::~CbmDeviceUnpackTofMcbm2018() { delete fUnpackerAlgo; } -void CbmDeviceUnpackTofMcbm2018::InitTask() try { +void CbmDeviceUnpackTofMcbm2018::InitTask() +try { // Get the information about created channels from the device // Check if the defined channels from the topology (by name) // are in the list of channels which are possible/allowed @@ -140,15 +139,13 @@ void CbmDeviceUnpackTofMcbm2018::InitTask() try { LOG(info) << "Number of defined channels: " << noChannel; for (auto const& entry : fChannels) { LOG(info) << "Channel name: " << entry.first; - if (!IsChannelNameAllowed(entry.first)) - throw InitTaskError("Channel name does not match."); + if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); if (entry.first == "syscmd") { OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleMessage); continue; } //if(entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleData); - if (entry.first != "tofdigis") - OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleParts); + if (entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleParts); else { fChannelsToSend[0].push_back(entry.first); LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0]; @@ -174,8 +171,7 @@ void CbmDeviceUnpackTofMcbm2018::InitTask() try { Int_t iRefCtrType = fConfig->GetValue<int64_t>("RefCtrType"); Int_t iRefCtrId = fConfig->GetValue<int64_t>("RefCtrId"); if (iRefModType > -1) - fiAddrRef = CbmTofAddress::GetUniqueAddress( - iRefModId, iRefCtrId, 0, 0, iRefModType, iRefCtrType); + fiAddrRef = CbmTofAddress::GetUniqueAddress(iRefModId, iRefCtrId, 0, 0, iRefModType, iRefCtrType); LOG(info) << " Using Reference counter address 0x" << std::hex << fiAddrRef; // Int_t iMaxAsicInactive = fConfig->GetValue<uint64_t>("MaxAsicInactive"); @@ -199,8 +195,7 @@ void CbmDeviceUnpackTofMcbm2018::InitTask() try { case 1: // eTof modules if (iGbtx % 2 == 0) for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) { - Int_t iAddr = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); AddReqDigiAddr(iAddr); } break; @@ -208,36 +203,31 @@ void CbmDeviceUnpackTofMcbm2018::InitTask() try { case 4: case 9: // HD 2-RPC boxes for (Int_t iRpc = 0; iRpc < 2; iRpc++) { - Int_t iAddr = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); AddReqDigiAddr(iAddr); } break; case 6: // Buc box for (Int_t iRpc = 0; iRpc < 2; iRpc++) { - Int_t iAddr = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); AddReqDigiAddr(iAddr); } break; case 7: // CERN box for (Int_t iRpc = 0; iRpc < 1; iRpc++) { - Int_t iAddr = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], iRpc, 0, 0, 7); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, 7); AddReqDigiAddr(iAddr); } break; case 8: // ceramics for (Int_t iRpc = 0; iRpc < 8; iRpc++) { - Int_t iAddr = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpc, 0, 0, fviRpcType[iGbtx]); AddReqDigiAddr(iAddr); } break; case 5: // add Diamond, single cell RPC - Int_t iAddr = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], 0, 0, 0, 5); + Int_t iAddr = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], 0, 0, 0, 5); AddReqDigiAddr(iAddr); break; } @@ -245,18 +235,18 @@ void CbmDeviceUnpackTofMcbm2018::InitTask() try { } LOG(info) << "ReqMode " << fiReqMode << " in " << fiReqTint << " ns " - << " with " << fiReqDigiAddr.size() << " detectors out of " - << fviNrOfRpc.size() << " GBTx, PulserMode " << fiPulserMode - << " with Mul " << fiPulMulMin << ", TotMin " << fiPulTotMin; + << " with " << fiReqDigiAddr.size() << " detectors out of " << fviNrOfRpc.size() << " GBTx, PulserMode " + << fiPulserMode << " with Mul " << fiPulMulMin << ", TotMin " << fiPulTotMin; LOG(info) << Form("ReqBeam 0x%08x", (uint) fiReqBeam); - -} catch (InitTaskError& e) { +} +catch (InitTaskError& e) { LOG(error) << e.what(); // Wrapper defined in CbmMQDefs.h to support different FairMQ versions cbm::mq::ChangeState(this, cbm::mq::Transition::ErrorFound); } -bool CbmDeviceUnpackTofMcbm2018::IsChannelNameAllowed(std::string channelName) { +bool CbmDeviceUnpackTofMcbm2018::IsChannelNameAllowed(std::string channelName) +{ for (auto const& entry : fAllowedChannels) { LOG(info) << "Inspect " << entry; std::size_t pos1 = channelName.find(entry); @@ -265,28 +255,24 @@ bool CbmDeviceUnpackTofMcbm2018::IsChannelNameAllowed(std::string channelName) { std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry); const vector<std::string>::size_type idx = pos - fAllowedChannels.begin(); LOG(info) << "Found " << entry << " in " << channelName; - LOG(info) << "Channel name " << channelName - << " found in list of allowed channel names at position " - << idx; + LOG(info) << "Channel name " << channelName << " found in list of allowed channel names at position " << idx; return true; } } - LOG(info) << "Channel name " << channelName - << " not found in list of allowed channel names."; + LOG(info) << "Channel name " << channelName << " not found in list of allowed channel names."; LOG(error) << "Stop device."; return false; } -Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() { +Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() +{ LOG(info) << "Init parameter containers for CbmDeviceUnpackTofMcbm2018."; // FairRuntimeDb* fRtdb = FairRuntimeDb::instance(); // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy std::string message {"CbmMcbm2018TofPar,111"}; - LOG(info) - << "Requesting parameter container CbmMcbm2018TofPar, sending message: " - << message; + LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message; FairMQMessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); FairMQMessagePtr rep(NewMessage()); @@ -295,12 +281,11 @@ Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() { if (Receive(rep, "parameters") >= 0) { if (rep->GetSize() != 0) { CbmMQTMessage tmsg(rep->GetData(), rep->GetSize()); - fUnpackPar = - dynamic_cast<CbmMcbm2018TofPar*>(tmsg.ReadObject(tmsg.GetClass())); - LOG(info) << "Received unpack parameter from parmq server: " - << fUnpackPar; + fUnpackPar = dynamic_cast<CbmMcbm2018TofPar*>(tmsg.ReadObject(tmsg.GetClass())); + LOG(info) << "Received unpack parameter from parmq server: " << fUnpackPar; fUnpackPar->Print(); - } else { + } + else { LOG(error) << "Received empty reply. Parameter not available"; } } @@ -330,13 +315,13 @@ Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() { return initOK; } -void CbmDeviceUnpackTofMcbm2018::SetParContainers() { +void CbmDeviceUnpackTofMcbm2018::SetParContainers() +{ FairRuntimeDb* fRtdb = FairRuntimeDb::instance(); TList* fParCList = fUnpackerAlgo->GetParList(); - LOG(info) << "Setting parameter containers for " << fParCList->GetEntries() - << " entries "; + LOG(info) << "Setting parameter containers for " << fParCList->GetEntries() << " entries "; for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); @@ -344,13 +329,11 @@ void CbmDeviceUnpackTofMcbm2018::SetParContainers() { std::string sParamName {tempObj->GetName()}; - FairParGenericSet* newObj = - dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data())); + FairParGenericSet* newObj = dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data())); LOG(info) << " - Get " << sParamName.data() << " at " << newObj; if (nullptr == newObj) { - LOG(error) << "Failed to obtain parameter container " << sParamName - << ", for parameter index " << iparC; + LOG(error) << "Failed to obtain parameter container " << sParamName << ", for parameter index " << iparC; return; } // if( nullptr == newObj ) if (iparC == 0) { @@ -362,12 +345,13 @@ void CbmDeviceUnpackTofMcbm2018::SetParContainers() { } // for( Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC ) } -void CbmDeviceUnpackTofMcbm2018::AddMsComponentToList(size_t component, - UShort_t usDetectorId) { +void CbmDeviceUnpackTofMcbm2018::AddMsComponentToList(size_t component, UShort_t usDetectorId) +{ fUnpackerAlgo->AddMsComponentToList(component, usDetectorId); } -Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { +Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() +{ LOG(info) << "ReInit parameter containers for CbmDeviceUnpackMcbm2018TofPar."; fuNrOfGdpbs = fUnpackPar->GetNrOfGdpbs(); @@ -408,14 +392,12 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { */ UInt_t uGet4topadi[32] = {4, 3, 2, 1, // provided by Jochen - 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, - 14, 13, 20, 19, 18, 17, 24, 23, 22, 21, - 28, 27, 26, 25, 32, 31, 30, 29}; + 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19, + 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29}; UInt_t uPaditoget4[32] = {4, 3, 2, 1, // provided by Jochen - 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, - 26, 25, 32, 31, 30, 29, 8, 7, 6, 5, - 16, 15, 14, 13, 24, 23, 22, 21}; + 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, 26, 25, 32, 31, + 30, 29, 8, 7, 6, 5, 16, 15, 14, 13, 24, 23, 22, 21}; for (UInt_t uChan = 0; uChan < fuNrOfChannelsPerFee; ++uChan) { fvuPadiToGet4[uChan] = uPaditoget4[uChan] - 1; @@ -425,14 +407,12 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { /// TODO: move these constants somewhere shared, e.g the parameter file fvuElinkToGet4.resize(kuNbGet4PerGbtx); fvuGet4ToElink.resize(kuNbGet4PerGbtx); - UInt_t kuElinkToGet4[kuNbGet4PerGbtx] = { - 27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14, - 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23, - 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11}; - UInt_t kuGet4ToElink[kuNbGet4PerGbtx] = { - 24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11, - 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0, - 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36}; + UInt_t kuElinkToGet4[kuNbGet4PerGbtx] = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14, + 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23, + 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11}; + UInt_t kuGet4ToElink[kuNbGet4PerGbtx] = {24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11, + 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0, + 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36}; for (UInt_t uLinkAsic = 0; uLinkAsic < kuNbGet4PerGbtx; ++uLinkAsic) { fvuElinkToGet4[uLinkAsic] = kuElinkToGet4[uLinkAsic]; fvuGet4ToElink[uLinkAsic] = kuGet4ToElink[uLinkAsic]; @@ -474,12 +454,8 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr; if (fviModuleId[iGbtx] > -1) - fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - fviRpcSide[iGbtx], - fviRpcType[iGbtx]); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, + fviRpcSide[iGbtx], fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; // LOG(debug)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]); @@ -504,12 +480,8 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr; if (fviModuleId[iGbtx] > -1) - fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - fviRpcSide[iGbtx], - fviRpcType[iGbtx]); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, + fviRpcSide[iGbtx], fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; // LOG(DEBUG)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]); @@ -524,45 +496,42 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { { LOG(info) << " Map diamond at GBTX - iCh = " << iCh; for (UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee) { - for (UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); - ++uCh) { + for (UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh) { if (uFee < 4 && (0 == uCh % 4 || uCh < 4)) { // if( 0 == uCh ) { fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], - 0, - uFee * fUnpackPar->GetNrOfChannelsPerFee() / 4 + uCh / 4 - + 40 * fviRpcSide[iGbtx], + fviModuleId[iGbtx], 0, + uFee * fUnpackPar->GetNrOfChannelsPerFee() / 4 + uCh / 4 + 40 * fviRpcSide[iGbtx], // 0, uFee + 10 * fviRpcSide[iGbtx], - 0, - fviRpcType[iGbtx]); - LOG(info) << Form( - "Map T0 Ch %d to Address 0x%08x", iCh, fviRpcChUId[iCh]); - } else + 0, fviRpcType[iGbtx]); + LOG(info) << Form("Map T0 Ch %d to Address 0x%08x", iCh, fviRpcChUId[iCh]); + } + else fviRpcChUId[iCh] = 0; iCh++; } // for( UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh ) - } // for( UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee ) + } // for( UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee ) } break; case 78: // cern-20-gap + ceramic module { LOG(info) << " Map CERN 20 gap at GBTX - iCh = " << iCh; + // clang-format off const Int_t StrMap[32] = {0, 1, 2, 3, 4, 31, 5, 6, 7, 30, 8, 9, 10, 29, 11, 12, 13, 14, 28, 15, 16, 17, 18, 27, 26, 25, 24, 23, 22, 21, 20, 19}; - Int_t iModuleId = 0; - Int_t iModuleType = 7; - Int_t iRpcMap = 0; + // clang-format on + Int_t iModuleId = 0; + Int_t iModuleType = 7; + Int_t iRpcMap = 0; for (Int_t iFeet = 0; iFeet < 2; iFeet++) { for (Int_t iStr = 0; iStr < 32; iStr++) { Int_t iStrMap = 31 - 12 - StrMap[iStr]; Int_t iSideMap = iFeet; if (iStrMap < 20) - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType); else fviRpcChUId[iCh] = 0; iCh++; @@ -575,8 +544,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { Int_t iModuleId = 0; Int_t iModuleType = 8; for (Int_t iRpc = 0; iRpc < 8; iRpc++) { - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleId, 7 - iRpc, 0, 0, iModuleType); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(iModuleId, 7 - iRpc, 0, 0, iModuleType); iCh++; } iCh += (24 + 2 * 32); @@ -616,11 +584,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { } if (iSideMap > -1) fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - iSideMap, - fviRpcType[iGbtx]); + CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; @@ -631,7 +595,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { case 6: // Buc box { - LOG(info) << " Map Buc box at GBTX - iCh = " << iCh; + LOG(info) << " DevMap Buc box at GBTX - iCh = " << iCh; const Int_t iRpc[5] = {0, -1, 0, 1, 1}; const Int_t iSide[5] = {1, -1, 0, 1, 0}; for (Int_t iFeet = 0; iFeet < 5; iFeet++) { @@ -669,11 +633,51 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { } if (iFeet > 2) iModuleIdMap = 1; } break; + case 7: { + // clang-format off + const Int_t iChMap[160]={ + 127, 126, 125, 124, 12, 13, 14, 15, 7, 6, 5, 4, 28, 29, 30, 31, 123, 122, 121, 120, 8, 9, 10, 11, 107, 106, 105, 104, 108, 109, 110, 111, + 39, 38, 37, 36, 52, 53, 54, 55, 63, 62, 61, 60, 128, 129, 130, 131, 43, 42, 41, 40, 148, 149, 150, 151, 59, 58, 57, 56, 132, 133, 134, 135, + 139, 138, 137, 136, 140, 141, 142, 143, 99, 98, 97, 96, 64, 65, 66, 67, 103, 102, 101, 100, 84, 85, 86, 87, 155, 154, 153, 152, 68, 69, 70, 71, + 159, 158, 157, 156, 144, 145, 146, 147, 47, 46, 45, 44, 76, 77, 78, 79, 51, 50, 49, 48, 20, 21, 22, 23, 35, 34, 33, 32, 116, 117, 118, 119, + 75, 74, 73, 72, 92, 93, 94, 95, 19, 18, 17, 16, 80, 81, 82, 83, 115, 114, 113, 112, 24, 25, 26, 27, 91, 90, 89, 88, 0, 1, 2, 3 + }; + // clang-format on + Int_t iInd = iFeet * 32 + iStr; + Int_t i = 0; + for (; i < 160; i++) + if (iInd == iChMap[i]) break; + iStrMap = i % 32; + Int_t iFeetInd = (i - iStrMap) / 32; + switch (iFeet) { + case 0: + iRpcMap = 0; + iSideMap = 1; + break; + case 1: + iRpcMap = 1; + iSideMap = 1; + break; + case 2: + iRpcMap = 1; + iSideMap = 0; + break; + case 3: + iRpcMap = 0; + iSideMap = 0; + break; + case 4: iSideMap = -1; break; + } + iModuleIdMap = fviModuleId[iGbtx]; + LOG(info) << "Buc of GBTX " << iGbtx + << Form(", Feet %1d, Str %2d, i %3d, FeetInd %1d, Rpc %1d, Side %1d, Str %2d ", iFeet, iStr, + i, iFeetInd, iRpcMap, iSideMap, iStrMap); + } break; default:; } if (iSideMap > -1) - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); + fviRpcChUId[iCh] = + CbmTofAddress::GetUniqueAddress(iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; @@ -687,77 +691,46 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { iCh += 160; break; - default: - LOG(error) << "Invalid Type specifier for Gbtx " << iGbtx << ": " - << fviRpcType[iGbtx]; + default: LOG(error) << "Invalid Type specifier for Gbtx " << iGbtx << ": " << fviRpcType[iGbtx]; } } for (UInt_t i = 0; i < uNrOfChannels; i = i + 8) { if (i % 64 == 0) LOG(info) << " Index " << i; - LOG(info) << Form("0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", - fviRpcChUId[i], - fviRpcChUId[i + 1], - fviRpcChUId[i + 2], - fviRpcChUId[i + 3], - fviRpcChUId[i + 4], - fviRpcChUId[i + 5], - fviRpcChUId[i + 6], - fviRpcChUId[i + 7]); + LOG(info) << Form("0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", fviRpcChUId[i], fviRpcChUId[i + 1], + fviRpcChUId[i + 2], fviRpcChUId[i + 3], fviRpcChUId[i + 4], fviRpcChUId[i + 5], + fviRpcChUId[i + 6], fviRpcChUId[i + 7]); } // for( UInt_t i = 0; i < uNrOfChannels; ++i) return kTRUE; } -void CbmDeviceUnpackTofMcbm2018::CreateHistograms() { +void CbmDeviceUnpackTofMcbm2018::CreateHistograms() +{ LOG(info) << "create Histos for " << fuNrOfGdpbs << " gDPBs "; fhRawTDigEvT0 = - new TH1F(Form("Raw_TDig-EvT0"), - Form("Raw digi time difference to 1st digi ; time [ns]; cts"), - 500, - 0, - 100.); + new TH1F(Form("Raw_TDig-EvT0"), Form("Raw digi time difference to 1st digi ; time [ns]; cts"), 500, 0, 100.); // fHM->Add( Form("Raw_TDig-EvT0"), fhRawTDigEvT0); fhRawTDigRef0 = - new TH1F(Form("Raw_TDig-Ref0"), - Form("Raw digi time difference to Ref ; time [ns]; cts"), - 6000, - -10000, - 50000); + new TH1F(Form("Raw_TDig-Ref0"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -10000, 50000); // fHM->Add( Form("Raw_TDig-Ref0"), fhRawTDigRef0); fhRawTDigRef = - new TH1F(Form("Raw_TDig-Ref"), - Form("Raw digi time difference to Ref ; time [ns]; cts"), - 6000, - -1000, - 5000); + new TH1F(Form("Raw_TDig-Ref"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -1000, 5000); // fHM->Add( Form("Raw_TDig-Ref"), fhRawTDigRef); - fhRawTRefDig0 = - new TH1F(Form("Raw_TRef-Dig0"), - Form("Raw Ref time difference to last digi ; time [ns]; cts"), - 9999, - -50000, - 50000); + fhRawTRefDig0 = new TH1F(Form("Raw_TRef-Dig0"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999, + -50000, 50000); // fHM->Add( Form("Raw_TRef-Dig0"), fhRawTRefDig0); fhRawTRefDig1 = - new TH1F(Form("Raw_TRef-Dig1"), - Form("Raw Ref time difference to last digi ; time [ns]; cts"), - 9999, - -5000, - 5000); + new TH1F(Form("Raw_TRef-Dig1"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000); // fHM->Add( Form("Raw_TRef-Dig1"), fhRawTRefDig1); - fhRawDigiLastDigi = - new TH1F(Form("Raw_Digi-LastDigi"), - Form("Raw Digi time difference to last digi ; time [ns]; cts"), - 9999, - -5000, - 5000); + fhRawDigiLastDigi = new TH1F(Form("Raw_Digi-LastDigi"), + Form("Raw Digi time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000); // 9999, -5000000, 5000000); // fHM->Add( Form("Raw_Digi-LastDigi"), fhRawDigiLastDigi); @@ -765,23 +738,13 @@ void CbmDeviceUnpackTofMcbm2018::CreateHistograms() { fhChCount.resize(fuNrOfGdpbs); fhChanCoinc.resize(fuNrOfGdpbs * fuNrOfFeePerGdpb / 2); for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) { - fhRawTotCh[uGdpb] = - new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb), - Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb, - 256, - 0., - 256.); + fhRawTotCh[uGdpb] = new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb), Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, 256, 0., 256.); // fHM->Add( Form("Raw_Tot_gDPB_%02u", uGdpb), fhRawTotCh[ uGdpb ]); fhChCount[uGdpb] = - new TH1I(Form("ChCount_gDPB_%02u", uGdpb), - Form("Channel counts gDPB %02u; channel; Hits", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb); + new TH1I(Form("ChCount_gDPB_%02u", uGdpb), Form("Channel counts gDPB %02u; channel; Hits", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb); // fHM->Add( Form("ChCount_gDPB_%02u", uGdpb), fhChCount[ uGdpb ]); /* for( UInt_t uLeftFeb = uGdpb*fuNrOfFebsPerGdpb / 2; @@ -795,34 +758,20 @@ void CbmDeviceUnpackTofMcbm2018::CreateHistograms() { } // for( UInt_t uLeftFeb = 0; uLeftFeb < fuNrOfFebsPerGdpb / 2; uLeftFeb ++ ) */ fhChanCoinc[uGdpb] = - new TH2F(Form("fhChanCoinc_%02u", uGdpb), - Form("Channels Coincidence %02u; Left; Right", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb, - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb); + new TH2F(Form("fhChanCoinc_%02u", uGdpb), Form("Channels Coincidence %02u; Left; Right", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb); } // for( UInt_t uGdpb = 0; uGdpb < fuMinNbGdpb; uGdpb ++) - fhDetChanCoinc = new TH2F("fhDetChanCoinc", - "Det Channels Coincidence; Left; Right", - 32, - 0., - 32, - 32, - 0., - 32); + fhDetChanCoinc = new TH2F("fhDetChanCoinc", "Det Channels Coincidence; Left; Right", 32, 0., 32, 32, 0., 32); } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg, - int /*index*/) { +bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg, int /*index*/) +{ // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add // an output fNumMessages++; - LOG(debug) << "Received message number " << fNumMessages << " with size " - << msg->GetSize(); + LOG(debug) << "Received message number " << fNumMessages << " with size " << msg->GetSize(); std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize()); std::istringstream iss(msgStr); @@ -837,27 +786,24 @@ bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg, BuildTint(0); - if (fNumMessages % 10000 == 0) - LOG(info) << "Processed " << fNumMessages << " time slices"; + if (fNumMessages % 10000 == 0) LOG(info) << "Processed " << fNumMessages << " time slices"; return true; } -bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, - int /*index*/) { +bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, int /*index*/) +{ // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add // an output fNumMessages++; - LOG(debug) << "Received message number " << fNumMessages << " with " - << parts.Size() << " parts"; + LOG(debug) << "Received message number " << fNumMessages << " with " << parts.Size() << " parts"; fles::StorableTimeslice ts {0}; switch (fiSelectComponents) { case 0: { - std::string msgStr(static_cast<char*>(parts.At(0)->GetData()), - (parts.At(0))->GetSize()); + std::string msgStr(static_cast<char*>(parts.At(0)->GetData()), (parts.At(0))->GetSize()); std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); inputArchive >> ts; @@ -877,8 +823,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, uint ncomp = parts.Size(); for (uint i = 0; i < ncomp; i++) { - std::string msgStr(static_cast<char*>(parts.At(i)->GetData()), - (parts.At(i))->GetSize()); + std::string msgStr(static_cast<char*>(parts.At(i)->GetData()), (parts.At(i))->GetSize()); std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); //fles::StorableTimeslice component{i}; @@ -886,8 +831,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, // CheckTimeslice(component); fUnpackerAlgo->AddMsComponentToList(0, 0x60); // TOF data - LOG(debug) << "HandleParts message " << fNumMessages << " with indx " - << component.index(); + LOG(debug) << "HandleParts message " << fNumMessages << " with indx " << component.index(); DoUnpack(component, 0); } } break; @@ -896,14 +840,13 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, BuildTint(0); - if (fNumMessages % 10000 == 0) - LOG(info) << "Processed " << fNumMessages << " time slices"; + if (fNumMessages % 10000 == 0) LOG(info) << "Processed " << fNumMessages << " time slices"; return true; } -bool CbmDeviceUnpackTofMcbm2018::HandleMessage(FairMQMessagePtr& msg, - int /*index*/) { +bool CbmDeviceUnpackTofMcbm2018::HandleMessage(FairMQMessagePtr& msg, int /*index*/) +{ const char* cmd = (char*) (msg->GetData()); const char cmda[4] = {*cmd}; LOG(info) << "Handle message " << cmd << ", " << cmd[0]; @@ -926,15 +869,13 @@ bool CbmDeviceUnpackTofMcbm2018::HandleMessage(FairMQMessagePtr& msg, return true; } -Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts, - size_t component) { - LOG(debug) << "Timeslice " << ts.index() << " contains " - << ts.num_microslices(component) << " microslices of component " - << component; +Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts, size_t component) +{ + LOG(debug) << "Timeslice " << ts.index() << " contains " << ts.num_microslices(component) + << " microslices of component " << component; if (kFALSE == fUnpackerAlgo->ProcessTs(ts)) { - LOG(error) << "Failed processing TS " << ts.index() - << " in unpacker algorithm class"; + LOG(error) << "Failed processing TS " << ts.index() << " in unpacker algorithm class"; return kTRUE; } // if( kFALSE == fUnpackerAlgo->ProcessTs( ts ) ) @@ -950,8 +891,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts, }); */ - LOG(debug) << "Insert " << vDigi.size() - << " digis into DAQ buffer with size " << fBuffer->GetSize(); + LOG(debug) << "Insert " << vDigi.size() << " digis into DAQ buffer with size " << fBuffer->GetSize(); for (auto digi : vDigi) { // copy Digi for insertion into DAQ buffer @@ -959,15 +899,10 @@ Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts, //if( (fDigi->GetAddress() & 0x000F00F ) != fiAddrRef ) fDigi->SetTime(fDigi->GetTime()+fdToffTof); // shift all Tof Times for v14a geometries if ((fDigi->GetAddress() & 0x000780F) != fiAddrRef) - fDigi->SetTime(fDigi->GetTime() - + fdToffTof); // shift all Tof Times for V21a - - LOG(debug) << "BufferInsert digi " - << Form( - "0x%08x at %012.2f", fDigi->GetAddress(), fDigi->GetTime()) - << Form(", first %012.2f, last %012.2f, size %u", - fBuffer->GetTimeFirst(), - fBuffer->GetTimeLast(), + fDigi->SetTime(fDigi->GetTime() + fdToffTof); // shift all Tof Times for V21a + + LOG(debug) << "BufferInsert digi " << Form("0x%08x at %012.2f", fDigi->GetAddress(), fDigi->GetTime()) + << Form(", first %012.2f, last %012.2f, size %u", fBuffer->GetTimeFirst(), fBuffer->GetTimeLast(), fBuffer->GetSize()); fBuffer->InsertData<CbmTofDigi>(fDigi); @@ -978,7 +913,8 @@ Bool_t CbmDeviceUnpackTofMcbm2018::DoUnpack(const fles::Timeslice& ts, return kTRUE; } -void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { +void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) +{ // iMode - sending condition // 0 (default)- build time interval only if last buffer entry is older the start + TSLength // 1 (finish), empty buffer without checking @@ -987,8 +923,7 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { double fdMaxDeltaT = (double) fiReqTint; // in ns LOG(debug) << "BuildTint: Buffer size " << fBuffer->GetSize() << ", DeltaT " - << (fBuffer->GetTimeLast() - fBuffer->GetTimeFirst()) / 1.E9 - << " s"; + << (fBuffer->GetTimeLast() - fBuffer->GetTimeFirst()) / 1.E9 << " s"; CbmTbDaqBuffer::Data data; CbmTofDigi* digi; @@ -1008,21 +943,16 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { Double_t dTEnd = digi->GetTime() + fdMaxDeltaT; Double_t dTEndMax = digi->GetTime() + 2 * fdMaxDeltaT; - LOG(debug) << Form( - "Next event at %f until %f, max %f ", digi->GetTime(), dTEnd, dTEndMax); + LOG(debug) << Form("Next event at %f until %f, max %f ", digi->GetTime(), dTEnd, dTEndMax); if (dTEnd > fTimeBufferLast) { LOG(warn) << Form("Remaining buffer < %f with %d entries is not " "sufficient for digi ending at %f -> skipped ", - fTimeBufferLast, - fBuffer->GetSize(), - dTEnd); + fTimeBufferLast, fBuffer->GetSize(), dTEnd); return; } - LOG(debug) << "BuildTint0 with digi " - << Form( - "0x%08x at %012.2f", digi->GetAddress(), digi->GetTime()); + LOG(debug) << "BuildTint0 with digi " << Form("0x%08x at %012.2f", digi->GetAddress(), digi->GetTime()); Bool_t bDet[fiReqDigiAddr.size()][2]; for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) @@ -1039,26 +969,33 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { //const Int_t AddrMask=0x003FFFFF; const Int_t AddrMask = 0x001FFFFF; Bool_t bOut = kFALSE; + Int_t iBucMul = 0; while (data.second != ECbmModuleId::kNotExist) { // build digi array digi = boost::any_cast<CbmTofDigi*>(data.first); - LOG(debug) << "GetNextData " << digi << ", " << data.second << ", " - << Form("%f %f", digi->GetTime(), dTEnd) << ", Mul " << nDigi; + LOG(debug) << "GetNextData " << digi << ", " << data.second << ", " << Form("%f %f", digi->GetTime(), dTEnd) + << ", Mul " << nDigi; assert(digi); if (nDigi == vdigi.size()) vdigi.resize(nDigi + 100); vdigi[nDigi++] = digi; + + Int_t iAddr = digi->GetAddress() & AddrMask; + if (iAddr == 0x00003006 || iAddr == 0x0000b006) { + iBucMul++; + LOG(debug) << Form("Event %10d: BucMul %2d, addr 0x%08x, side %d, strip %2d, rpc %d", fEventHeader[0], iBucMul, + digi->GetAddress(), (Int_t) digi->GetSide(), (Int_t) digi->GetChannel(), + (Int_t) digi->GetRpc()); + } for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) if ((digi->GetAddress() & AddrMask) == fiReqDigiAddr[i]) { Int_t j = ((CbmTofDigi*) digi)->GetSide(); bDet[i][j] = kTRUE; if (fiReqDigiAddr[i] == (Int_t) fiReqBeam) { bBeam = kTRUE; - LOG(debug) << "Found ReqBeam at index " << nDigi - 1 << ", req " - << i; + LOG(debug) << "Found ReqBeam at index " << nDigi - 1 << ", req " << i; } - if ((UInt_t) fiReqDigiAddr[i] == fiAddrRef) - bDet[i][1] = kTRUE; // diamond with pad readout + if ((UInt_t) fiReqDigiAddr[i] == fiAddrRef) bDet[i][1] = kTRUE; // diamond with pad readout // if ( (fiReqDigiAddr[i] & 0x0000F00F ) == 0x00008006) bDet[i][1]=kTRUE; // ceramic with pad readout Int_t str = ((CbmTofDigi*) digi)->GetChannel(); @@ -1068,21 +1005,16 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { case 0: case 1: if (str == 31) - if (digi->GetTot() > fiPulTotMin - && digi->GetTot() < fiPulTotMax) - bPul[i][0] = kTRUE; + if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][0] = kTRUE; if (str == 0) bPul[i][1] = kFALSE; - if ( - (UInt_t) fiReqDigiAddr[i] - == fiAddrRef) { //special mapping for MAr2019 diamond (T0) + if ((UInt_t) fiReqDigiAddr[i] == fiAddrRef) { //special mapping for MAr2019 diamond (T0) if (str == 0) bPul[i][0] = kTRUE; if (str == 40) bPul[i][1] = kTRUE; } break; case 2: if (str == 0) - if (digi->GetTot() > fiPulTotMin - && digi->GetTot() < fiPulTotMax) { + if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) { bPul[i][0] = kTRUE; if ((fiReqDigiAddr[i] & 0x000FF00F) == 0x00078006) { bPul[i][1] = kTRUE; // ceramic with pad readout @@ -1100,16 +1032,12 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { case 1: if (str == 31) bPul[i][0] = kFALSE; if (str == 0) - if (digi->GetTot() > fiPulTotMin - && digi->GetTot() < fiPulTotMax) - bPul[i][1] = kTRUE; + if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][1] = kTRUE; break; case 2: if (str == 0) bPul[i][0] = kFALSE; if (str == 31) - if (digi->GetTot() > fiPulTotMin - && digi->GetTot() < fiPulTotMax) - bPul[i][1] = kTRUE; + if (digi->GetTot() > fiPulTotMin && digi->GetTot() < fiPulTotMax) bPul[i][1] = kTRUE; break; default:; } @@ -1119,8 +1047,7 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { } //if(bOut) LOG(info)<<Form("Found 0x%08x, Req 0x%08x ", digi->GetAddress(), fiReqDigiAddr); if (dTEnd - digi->GetTime() < fdMaxDeltaT * 0.5) { - if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) - dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; + if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; else dTEnd = dTEndMax; }; @@ -1134,18 +1061,17 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { LOG(debug) << vdigi[iDigi]->ToString(); UInt_t iDetMul = 0; - if (fiReqDigiAddr.size() == 0) - bOut = kTRUE; // output everything + if (fiReqDigiAddr.size() == 0) bOut = kTRUE; // output everything else { if (fiReqMode == 0) { // check for presence of requested detectors for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) - if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) - break; + if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) break; else if (i == fiReqDigiAddr.size() - 1) { bOut = kTRUE; iDetMul = i; } - } else { // check for presence of any known detector + } + else { // check for presence of any known detector for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { iDetMul++; } if (iDetMul >= fiReqMode) { bOut = kTRUE; } @@ -1153,8 +1079,8 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { } if (bOut && fiReqDigiAddr.size() > 1) { - LOG(debug) << "Found Req coinc in event with " << nDigi << " digis in " - << iDetMul << " detectors, dTEnd = " << dTEnd; + LOG(debug) << "Found Req coinc in event with " << nDigi << " digis in " << iDetMul + << " detectors, dTEnd = " << dTEnd; } // determine Pulser status @@ -1167,15 +1093,13 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { LOG(debug) << "@Event " << fEventHeader[0] << ": iPulMul = " << iPulMul; bOut = kTRUE; } - LOG(debug) << "Process Ev " << fEventHeader[0] - << " with iDetMul = " << iDetMul << ", iPulMul = " << iPulMul; + LOG(debug) << "Process Ev " << fEventHeader[0] << " with iDetMul = " << iDetMul << ", iPulMul = " << iPulMul; fEventHeader[0]++; if ((Int_t) fiReqBeam > -1) { - if (bBeam) { - LOG(debug) << "Beam counter is present "; - } else { + if (bBeam) { LOG(debug) << "Beam counter is present "; } + else { LOG(debug) << "Beam counter is not present"; bOut = kFALSE; // request beam counter for event } @@ -1198,7 +1122,8 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++) delete vdigi[iDigi]; - } else { + } + else { LOG(debug) << " BuildTint cleanup of " << nDigi << " digis"; for (UInt_t iDigi = 0; iDigi < nDigi; iDigi++) { // vdigi[iDigi]->Delete(); @@ -1210,12 +1135,11 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) { } } -bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, - int idx) { - LOG(debug) << "Send Digis for event " << fNumTint << " with size " - << vdigi.size() << Form(" at %p ", &vdigi); - LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1] - << " " << fEventHeader[2] << " " << fEventHeader[3]; +bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) +{ + LOG(debug) << "Send Digis for event " << fNumTint << " with size " << vdigi.size() << Form(" at %p ", &vdigi); + LOG(debug) << "EventHeader: " << fEventHeader[0] << " " << fEventHeader[1] << " " << fEventHeader[2] << " " + << fEventHeader[3]; // Int_t NDigi=vdigi.size(); @@ -1329,8 +1253,7 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, // successfull transfer will return number of bytes // transfered (can be 0 if sending an empty message). - LOG(debug) << "Send data to channel " << idx << " " - << fChannelsToSend[idx][0]; + LOG(debug) << "Send data to channel " << idx << " " << fChannelsToSend[idx][0]; // if (Send(msg, fChannelsToSend[idx][0]) < 0) { @@ -1352,24 +1275,17 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, return true; } -void CbmDeviceUnpackTofMcbm2018::AddReqDigiAddr(Int_t iAddr) { +void CbmDeviceUnpackTofMcbm2018::AddReqDigiAddr(Int_t iAddr) +{ UInt_t iNReq = fiReqDigiAddr.size(); for (UInt_t i = 0; i < iNReq; i++) - if (fiReqDigiAddr[i] == iAddr) - return; // det already present, avoid double counting - fiReqDigiAddr.resize(iNReq - + 1); // hopefully the old entries are preserved ... + if (fiReqDigiAddr[i] == iAddr) return; // det already present, avoid double counting + fiReqDigiAddr.resize(iNReq + 1); // hopefully the old entries are preserved ... fiReqDigiAddr[iNReq] = iAddr; - LOG(info) << Form("Request Digi Address 0x%08x ", iAddr); + LOG(info) << Form("Request Digi Address 0x%08x at index %d", iAddr, iNReq); } -void CbmDeviceUnpackTofMcbm2018::SetIgnoreOverlapMs(Bool_t bFlagIn) { - fUnpackerAlgo->SetIgnoreOverlapMs(bFlagIn); -} +void CbmDeviceUnpackTofMcbm2018::SetIgnoreOverlapMs(Bool_t bFlagIn) { fUnpackerAlgo->SetIgnoreOverlapMs(bFlagIn); } -void CbmDeviceUnpackTofMcbm2018::SetTimeOffsetNs(Double_t dOffsetIn) { - fUnpackerAlgo->SetTimeOffsetNs(dOffsetIn); -} -void CbmDeviceUnpackTofMcbm2018::SetDiamondDpbIdx(UInt_t uIdx) { - fUnpackerAlgo->SetDiamondDpbIdx(uIdx); -} +void CbmDeviceUnpackTofMcbm2018::SetTimeOffsetNs(Double_t dOffsetIn) { fUnpackerAlgo->SetTimeOffsetNs(dOffsetIn); } +void CbmDeviceUnpackTofMcbm2018::SetDiamondDpbIdx(UInt_t uIdx) { fUnpackerAlgo->SetDiamondDpbIdx(uIdx); } diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx index 3325519a4c..89e1843644 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx @@ -26,9 +26,10 @@ #include <fstream> #include <iomanip> #include <iostream> -#include <stdint.h> #include <vector> +#include <stdint.h> + static Int_t NMappingWarnings = 100; /* @@ -109,8 +110,11 @@ CbmMcbm2018UnpackerAlgoTof::CbmMcbm2018UnpackerAlgoTof() , fhChCountRemap() , fvbChanThere() , fhChanCoinc() - , fhDetChanCoinc(nullptr) {} -CbmMcbm2018UnpackerAlgoTof::~CbmMcbm2018UnpackerAlgoTof() { + , fhDetChanCoinc(nullptr) +{ +} +CbmMcbm2018UnpackerAlgoTof::~CbmMcbm2018UnpackerAlgoTof() +{ /// Clear buffers for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb) { fvvmEpSupprBuffer[uGdpb].clear(); @@ -120,13 +124,15 @@ CbmMcbm2018UnpackerAlgoTof::~CbmMcbm2018UnpackerAlgoTof() { } // ------------------------------------------------------------------------- -Bool_t CbmMcbm2018UnpackerAlgoTof::Init() { +Bool_t CbmMcbm2018UnpackerAlgoTof::Init() +{ LOG(info) << "Initializing mCBM TOF 2019 unpacker algo"; return kTRUE; } void CbmMcbm2018UnpackerAlgoTof::Reset() {} -void CbmMcbm2018UnpackerAlgoTof::Finish() { +void CbmMcbm2018UnpackerAlgoTof::Finish() +{ /* /// Printout Goodbye message and stats LOG(INFO)<<"<I> MS statistics - Good: " << fiMsGood <<", Bad: " << fiMsBad; @@ -135,14 +141,16 @@ void CbmMcbm2018UnpackerAlgoTof::Finish() { } // ------------------------------------------------------------------------- -Bool_t CbmMcbm2018UnpackerAlgoTof::InitContainers() { +Bool_t CbmMcbm2018UnpackerAlgoTof::InitContainers() +{ LOG(info) << "Init parameter containers for CbmMcbm2018UnpackerAlgoTof"; Bool_t initOK = ReInitContainers(); return initOK; } -Bool_t CbmMcbm2018UnpackerAlgoTof::ReInitContainers() { +Bool_t CbmMcbm2018UnpackerAlgoTof::ReInitContainers() +{ LOG(info) << "**********************************************"; LOG(info) << "ReInit parameter containers for CbmMcbm2018UnpackerAlgoTof"; @@ -155,14 +163,16 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ReInitContainers() { return initOK; } -TList* CbmMcbm2018UnpackerAlgoTof::GetParList() { +TList* CbmMcbm2018UnpackerAlgoTof::GetParList() +{ if (nullptr == fParCList) fParCList = new TList(); fUnpackPar = new CbmMcbm2018TofPar("CbmMcbm2018TofPar"); fParCList->Add(fUnpackPar); return fParCList; } -Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { +Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() +{ LOG(INFO) << "InitParameters from " << fUnpackPar; fdMsSizeInNs = fUnpackPar->GetSizeMsInNs(); @@ -193,8 +203,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { fGdpbIdIndexMap.clear(); for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) { fGdpbIdIndexMap[fUnpackPar->GetGdpbId(i)] = i; - LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex - << fUnpackPar->GetGdpbId(i) << std::dec; + LOG(info) << "GDPB Id of TOF " << i << " : " << std::hex << fUnpackPar->GetGdpbId(i) << std::dec; } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i ) fuNrOfGbtx = fUnpackPar->GetNrOfGbtx(); @@ -223,8 +232,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 0: // CBM modules if (fviRpcSide[iGbtx] < 2) { // mTof modules - LOG(info) << " Map mTof box " << fviModuleId[iGbtx] - << " at GBTX - iCh = " << iCh; + LOG(info) << " Map mTof box " << fviModuleId[iGbtx] << " at GBTX - iCh = " << iCh; const Int_t RpcMap[5] = {4, 2, 0, 3, 1}; for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) { Int_t iStrMax = 32; @@ -236,12 +244,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr; if (fviModuleId[iGbtx] > -1) - fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - fviRpcSide[iGbtx], - fviRpcType[iGbtx]); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, + fviRpcSide[iGbtx], fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; // LOG(debug)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]); @@ -253,8 +257,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 1: // STAR eTOF modules if (fviRpcSide[iGbtx] < 2) { // mTof modules - LOG(info) << "Start eTOF module side " << fviRpcSide[iGbtx] << " at " - << iCh; + LOG(info) << "Start eTOF module side " << fviRpcSide[iGbtx] << " at " << iCh; const Int_t RpcMap[3] = {0, 1, 2}; for (Int_t iRpc = 0; iRpc < fviNrOfRpc[iGbtx]; iRpc++) { Int_t iStrMax = 32; @@ -266,12 +269,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { if (fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr; if (fviModuleId[iGbtx] > -1) - fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - fviRpcSide[iGbtx], - fviRpcType[iGbtx]); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, + fviRpcSide[iGbtx], fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; // LOG(DEBUG)<<Form("Map Ch %d to Address 0x%08x",iCh,fviRpcChUId[iCh]); @@ -286,8 +285,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 5: { LOG(info) << " Map diamond at GBTX - iCh = " << iCh; for (UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee) { - for (UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); - ++uCh) { + for (UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh) { /* if( uFee < 4 && 0 == uCh ) { fviRpcChUId[ iCh ] = CbmTofAddress::GetUniqueAddress( @@ -310,16 +308,11 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { /// => 1 T0 channel per GET4 /// => 1-2 eLinks per GET4 => GET4 ID = GET4 * 2 (+ 1) UInt_t uChannelT0 = uCh / 8 + 4 * fviRpcSide[iGbtx]; - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - fviModuleId[iGbtx], 0, uChannelT0, 0, fviRpcType[iGbtx]); + fviRpcChUId[iCh] = + CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], 0, uChannelT0, 0, fviRpcType[iGbtx]); LOG(info) << Form("T0 channel: %u from GBTx %2u Fee %2u " "Channel %2u, indx %d address %08x", - uChannelT0, - iGbtx, - uFee, - uCh, - iCh, - fviRpcChUId[iCh]); + uChannelT0, iGbtx, uFee, uCh, iCh, fviRpcChUId[iCh]); break; } // Valid T0 channel default: { @@ -330,26 +323,27 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { iCh++; } // for( UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh ) - } // for( UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee ) - } // if( 5 == fviRpcType[iGbtx] ) + } // for( UInt_t uFee = 0; uFee < fUnpackPar->GetNrOfFeePerGbtx(); ++uFee ) + } // if( 5 == fviRpcType[iGbtx] ) break; case 78: // cern-20-gap + ceramic module { LOG(info) << " Map CERN 20 gap at GBTX - iCh = " << iCh; + // clang-format off const Int_t StrMap[32] = {0, 1, 2, 3, 4, 31, 5, 6, 7, 30, 8, 9, 10, 29, 11, 12, 13, 14, 28, 15, 16, 17, 18, 27, 26, 25, 24, 23, 22, 21, 20, 19}; - Int_t iModuleId = 0; - Int_t iModuleType = 7; - Int_t iRpcMap = 0; + // clang-format on + Int_t iModuleId = 0; + Int_t iModuleType = 7; + Int_t iRpcMap = 0; for (Int_t iFeet = 0; iFeet < 2; iFeet++) { for (Int_t iStr = 0; iStr < 32; iStr++) { Int_t iStrMap = 31 - 12 - StrMap[iStr]; Int_t iSideMap = iFeet; if (iStrMap < 20) - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType); else fviRpcChUId[iCh] = 0; iCh++; @@ -364,8 +358,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { Int_t iModuleId = 0; Int_t iModuleType = 8; for (Int_t iRpc = 0; iRpc < 8; iRpc++) { - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleId, 7 - iRpc, 0, 0, iModuleType); + fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress(iModuleId, 7 - iRpc, 0, 0, iModuleType); iCh++; } iCh += (24 + 2 * 32); @@ -378,8 +371,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { [[fallthrough]]; case 9: // Star2 boxes { - LOG(info) << " Map Star2 box " << fviModuleId[iGbtx] - << " at GBTX - iCh = " << iCh; + LOG(info) << " Map Star2 box " << fviModuleId[iGbtx] << " at GBTX - iCh = " << iCh; const Int_t iRpc[5] = {1, -1, 1, 0, 0}; const Int_t iSide[5] = {1, -1, 0, 1, 0}; for (Int_t iFeet = 0; iFeet < 5; iFeet++) { @@ -410,11 +402,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { } if (iSideMap > -1) fviRpcChUId[iCh] = - CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], - iRpcMap, - iStrMap, - iSideMap, - fviRpcType[iGbtx]); + CbmTofAddress::GetUniqueAddress(fviModuleId[iGbtx], iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; iCh++; @@ -459,8 +447,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 0: iRpcMap = 0; break; case 1: iRpcMap = 1; break; } - if (iFeet % 2 == 1) - iModuleIdMap = 1; + if (iFeet % 2 == 1) iModuleIdMap = 1; else iModuleIdMap = 0; @@ -471,10 +458,52 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 2: iSideMap = 1; break; } } break; + + case 7: { + // clang-format off + const Int_t iChMap[160]={ + 127, 126, 125, 124, 12, 13, 14, 15, 7, 6, 5, 4, 28, 29, 30, 31, 123, 122, 121, 120, 8, 9, 10, 11, 107, 106, 105, 104, 108, 109, 110, 111, + 39, 38, 37, 36, 52, 53, 54, 55, 63, 62, 61, 60, 128, 129, 130, 131, 43, 42, 41, 40, 148, 149, 150, 151, 59, 58, 57, 56, 132, 133, 134, 135, + 139, 138, 137, 136, 140, 141, 142, 143, 99, 98, 97, 96, 64, 65, 66, 67, 103, 102, 101, 100, 84, 85, 86, 87, 155, 154, 153, 152, 68, 69, 70, 71, + 159, 158, 157, 156, 144, 145, 146, 147, 47, 46, 45, 44, 76, 77, 78, 79, 51, 50, 49, 48, 20, 21, 22, 23, 35, 34, 33, 32, 116, 117, 118, 119, + 75, 74, 73, 72, 92, 93, 94, 95, 19, 18, 17, 16, 80, 81, 82, 83, 115, 114, 113, 112, 24, 25, 26, 27, 91, 90, 89, 88, 0, 1, 2, 3 + }; + // clang-format on + Int_t iInd = iFeet * 32 + iStr; + Int_t i = 0; + for (; i < 160; i++) + if (iInd == iChMap[i]) break; + iStrMap = i % 32; + Int_t iFeetInd = (i - iStrMap) / 32; + switch (iFeet) { + case 0: + iRpcMap = 0; + iSideMap = 1; + break; + case 1: + iRpcMap = 1; + iSideMap = 1; + break; + case 2: + iRpcMap = 0; + iSideMap = 0; + break; + case 3: + iRpcMap = 1; + iSideMap = 0; + break; + case 4: iSideMap = -1; break; + } + iModuleIdMap = fviModuleId[iGbtx]; + LOG(info) << "Buc of GBTX " << iGbtx << " Ch " << iCh + << Form(", Feet %1d, Str %2d, Ind %3d, i %3d, FeetInd %1d, Rpc %1d, Side %1d, Str %2d ", + iFeet, iStr, iInd, i, iFeetInd, iRpcMap, iSideMap, iStrMap); + } break; + default:; } if (iSideMap > -1) - fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); + fviRpcChUId[iCh] = + CbmTofAddress::GetUniqueAddress(iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; @@ -494,8 +523,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { TString sPrintout = ""; for (UInt_t uCh = 0; uCh < uNrOfChannels; ++uCh) { if (0 == uCh % 8) sPrintout += "\n"; - if (0 == uCh % fuNrOfChannelsPerGdpb) - sPrintout += Form("\n Gdpb %u\n", uCh / fuNrOfChannelsPerGdpb); + if (0 == uCh % fuNrOfChannelsPerGdpb) sPrintout += Form("\n Gdpb %u\n", uCh / fuNrOfChannelsPerGdpb); sPrintout += Form(" 0x%08x", fviRpcChUId[uCh]); } // for( UInt_t i = 0; i < uNrOfChannels; ++i) LOG(info) << sPrintout; @@ -559,8 +587,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { } // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList(size_t component, - UShort_t usDetectorId) { +void CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList(size_t component, UShort_t usDetectorId) +{ /// Check for duplicates and ignore if it is the case for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx) if (component == fvMsComponentsList[uCompIdx]) return; @@ -568,13 +596,13 @@ void CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList(size_t component, /// Add to list fvMsComponentsList.push_back(component); - LOG(info) << "CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList => Component " - << component << " with detector ID 0x" << std::hex << usDetectorId - << std::dec << " added to list"; + LOG(info) << "CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList => Component " << component << " with detector ID 0x" + << std::hex << usDetectorId << std::dec << " added to list"; } // ------------------------------------------------------------------------- -Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessTs(const fles::Timeslice& ts) { +Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessTs(const fles::Timeslice& ts) +{ fulCurrentTsIdx = ts.index(); fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx); LOG(DEBUG) << "ProcessTs " << fulCurrentTsIdx; @@ -588,10 +616,9 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessTs(const fles::Timeslice& ts) { fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices(); fdTsCoreSizeInNs = fdMsSizeInNs * (fuNbCoreMsPerTs); fdTsFullSizeInNs = fdMsSizeInNs * (fuNbCoreMsPerTs + fuNbOverMsPerTs); - LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs - << " Core MS and " << fuNbOverMsPerTs - << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs - << " ns and a full duration of " << fdTsFullSizeInNs << " ns"; + LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs << " Core MS and " << fuNbOverMsPerTs + << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs << " ns and a full duration of " + << fdTsFullSizeInNs << " ns"; /// Ignore overlap ms if flag set by user fuNbMsLoop = fuNbCoreMsPerTs; @@ -606,17 +633,15 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessTs(const fles::Timeslice& ts) { /// Loop over core microslices (and overlap ones if chosen) for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) { /// Loop over registered components - for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); - ++uMsCompIdx) { + for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) { UInt_t uMsComp = fvMsComponentsList[uMsCompIdx]; if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) { - LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS " - << fuMsIndex << " for component " << uMsComp; + LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS " << fuMsIndex << " for component " << uMsComp; return kFALSE; } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) ) - } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx ) - } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ ) + } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx ) + } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ ) /// Fill plots if in monitor mode if (fbMonitorMode) { @@ -645,31 +670,25 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessTs(const fles::Timeslice& ts) { } */ /// Sort the buffers of hits due to the time offsets applied - sort(fDigiVect.begin(), - fDigiVect.end(), - [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { - return a.GetTime() < b.GetTime(); - }); + sort(fDigiVect.begin(), fDigiVect.end(), + [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); }); return kTRUE; } -Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, - size_t uMsCompIdx, - size_t uMsIdx) { - auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx); - fuCurrentEquipmentId = msDescriptor.eq_id; - const uint8_t* msContent = - reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx)); +Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx) +{ + auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx); + fuCurrentEquipmentId = msDescriptor.eq_id; + const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx)); uint32_t uSize = msDescriptor.size; fulCurrentMsIdx = msDescriptor.idx; // Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx); - LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex - << fuCurrentEquipmentId << std::dec << " has size: " << uSize; + LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec + << " has size: " << uSize; - if (0 == fvbMaskedComponents.size()) - fvbMaskedComponents.resize(ts.num_components(), kFALSE); + if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts.num_components(), kFALSE); fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF); // fuCurrDpbIdx = fDpbIdIndexMap[ fuCurrDpbId ]; @@ -678,13 +697,11 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, auto it = fGdpbIdIndexMap.find(fuCurrDpbId); if (it == fGdpbIdIndexMap.end()) { if (kFALSE == fvbMaskedComponents[uMsCompIdx]) { - LOG(info) - << "---------------------------------------------------------------"; + LOG(info) << "---------------------------------------------------------------"; LOG(info) << FormatMsHeaderPrintout(msDescriptor); - LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex - << fuCurrDpbId << std::dec << " in timeslice " - << fulCurrentTsIdx << " in microslice " << uMsIdx - << " component " << uMsCompIdx << "\n" + LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex << fuCurrDpbId << std::dec + << " in timeslice " << fulCurrentTsIdx << " in microslice " << uMsIdx << " component " << uMsCompIdx + << "\n" << "If valid this index has to be added in the TOF " "parameter file in the DbpIdArray field"; fvbMaskedComponents[uMsCompIdx] = kTRUE; @@ -708,15 +725,12 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, << "contain only complete gDPB messages!"; // Compute the number of complete messages in the input microslice buffer - uint32_t uNbMessages = - (uSize - (uSize % sizeof(gdpbv100::Message))) / sizeof(gdpbv100::Message); + uint32_t uNbMessages = (uSize - (uSize % sizeof(gdpbv100::Message))) / sizeof(gdpbv100::Message); // Prepare variables for the loop on contents - Int_t messageType = -111; - const uint64_t* pInBuff = - reinterpret_cast<const uint64_t*>(msContent); // for epoch cycle - const gdpbv100::Message* pMess = - reinterpret_cast<const gdpbv100::Message*>(pInBuff); + Int_t messageType = -111; + const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent); // for epoch cycle + const gdpbv100::Message* pMess = reinterpret_cast<const gdpbv100::Message*>(pInBuff); for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) { /// Catch the Epoch cycle block which is always the first 64b of the MS if (0 == uIdx) { @@ -728,15 +742,12 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, messageType = pMess[uIdx].getMessageType(); fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx(pMess[uIdx].getGdpbGenChipId()); - if (fuDiamondDpbIdx == fuCurrDpbIdx || 0x90 == fuCurrentMsSysId) - fuGet4Id = pMess[uIdx].getGdpbGenChipId(); + if (fuDiamondDpbIdx == fuCurrDpbIdx || 0x90 == fuCurrentMsSysId) fuGet4Id = pMess[uIdx].getGdpbGenChipId(); fuGet4Nr = (fuCurrDpbIdx * fuNrOfGet4PerGdpb) + fuGet4Id; - if (fuNrOfGet4PerGdpb <= fuGet4Id && !pMess[uIdx].isStarTrigger() - && (gdpbv100::kuChipIdMergedEpoch != fuGet4Id)) - LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS " - << fuNrOfGet4PerGdpb << " for GdpbIdx " << fuCurrDpbIdx - << " set in parameters."; + if (fuNrOfGet4PerGdpb <= fuGet4Id && !pMess[uIdx].isStarTrigger() && (gdpbv100::kuChipIdMergedEpoch != fuGet4Id)) + LOG(warning) << "Message with Get4 ID too high: " << fuGet4Id << " VS " << fuNrOfGet4PerGdpb << " for GdpbIdx " + << fuCurrDpbIdx << " set in parameters."; /* if( 1 == uIdx && gdpbv100::MSG_EPOCH != messageType ) @@ -758,10 +769,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, /// ===> Temporary solution: simply ignore these hits, may decrease efficiency /// ====> Not sufficient if more than one HIT is in wrong MS !!! if (1 == uIdx && gdpbv100::MSG_EPOCH != messageType) { - LOG(debug) << " CbmMcbm2018UnpackerAlgoTof ==> In timeslice " - << fulCurrentTsIdx << " in microslice " << fuMsIndex - << " component " << uMsCompIdx - << " first message is not an epoch: type " << messageType + LOG(debug) << " CbmMcbm2018UnpackerAlgoTof ==> In timeslice " << fulCurrentTsIdx << " in microslice " << fuMsIndex + << " component " << uMsCompIdx << " first message is not an epoch: type " << messageType << " -> It will be ignored! "; continue; } // if( 1 == uIdx && gdpbv100::MSG_EPOCH != messageType ) @@ -815,8 +824,7 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, break; } // case gdpbv100::MSG_STAR_TRI_A-D default: - LOG(error) << "Message type " << std::hex << std::setw(2) - << static_cast<uint16_t>(messageType) + LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType) << " not included in Get4 unpacker."; } // switch( mess.getMessageType() ) } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++) @@ -832,34 +840,31 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::ProcessMs(const fles::Timeslice& ts, } // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle( - const uint64_t& ulCycleData) { +void CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle(const uint64_t& ulCycleData) +{ ULong64_t ulEpochCycleVal = ulCycleData & gdpbv100::kulEpochCycleFieldSz; if (!(ulEpochCycleVal == fvulCurrentEpochCycle[fuCurrDpbIdx] || ulEpochCycleVal == fvulCurrentEpochCycle[fuCurrDpbIdx] + 1) && 0 < fulCurrentMsIdx) { LOG(warning) << "CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle => " - << " Missmatch in epoch cycles detected for Gdpb " - << fuCurrDpbIdx + << " Missmatch in epoch cycles detected for Gdpb " << fuCurrDpbIdx << ", probably fake cycles due to epoch index corruption! " - << Form(" Current cycle 0x%09llX New cycle 0x%09llX", - fvulCurrentEpochCycle[fuCurrDpbIdx], + << Form(" Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuCurrDpbIdx], ulEpochCycleVal); } // if epoch cycle did not stay constant or increase by exactly 1, except if first MS of the TS if (ulEpochCycleVal != fvulCurrentEpochCycle[fuCurrDpbIdx]) { LOG(info) << "CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle => " << " New epoch cycle for Gdpb " << fuCurrDpbIdx - << Form(": Current cycle 0x%09llX New cycle 0x%09llX", - fvulCurrentEpochCycle[fuCurrDpbIdx], + << Form(": Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuCurrDpbIdx], ulEpochCycleVal); } // if( ulEpochCycleVal != fvulCurrentEpochCycle[fuCurrDpbIdx] ) fvulCurrentEpochCycle[fuCurrDpbIdx] = ulEpochCycleVal; return; } -void CbmMcbm2018UnpackerAlgoTof::ProcessEpoch(const gdpbv100::Message& mess, - uint32_t /*uMesgIdx*/) { +void CbmMcbm2018UnpackerAlgoTof::ProcessEpoch(const gdpbv100::Message& mess, uint32_t /*uMesgIdx*/) +{ ULong64_t ulEpochNr = mess.getGdpbEpEpochNb(); /* if( ( 6 == fulCurrentTsIdx && 2 == fuCurrDpbIdx ) || @@ -900,8 +905,7 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessEpoch(const gdpbv100::Message& mess, */ fvulCurrentEpoch[fuCurrDpbIdx] = ulEpochNr; fvulCurrentEpochFull[fuCurrDpbIdx] = - ulEpochNr - + (gdpbv100::kuEpochCounterSz + 1) * fvulCurrentEpochCycle[fuCurrDpbIdx]; + ulEpochNr + (gdpbv100::kuEpochCounterSz + 1) * fvulCurrentEpochCycle[fuCurrDpbIdx]; /* /// Re-align the epoch number of the message in case it will be used later: @@ -913,21 +917,17 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessEpoch(const gdpbv100::Message& mess, /// Process the corresponding messages buffer for current gDPB ProcessEpSupprBuffer(); } -void CbmMcbm2018UnpackerAlgoTof::ProcessEndOfMsEpoch() { +void CbmMcbm2018UnpackerAlgoTof::ProcessEndOfMsEpoch() +{ /// Used to fake a "closing" epoch at the end of the MS - ULong64_t ulEpochNr = - (fvulCurrentEpoch[fuCurrDpbIdx] + 1) % gdpbv100::kuEpochCounterSz; + ULong64_t ulEpochNr = (fvulCurrentEpoch[fuCurrDpbIdx] + 1) % gdpbv100::kuEpochCounterSz; - if (0 < fvulCurrentEpoch[fuCurrDpbIdx] - && ulEpochNr < fvulCurrentEpoch[fuCurrDpbIdx]) { + if (0 < fvulCurrentEpoch[fuCurrDpbIdx] && ulEpochNr < fvulCurrentEpoch[fuCurrDpbIdx]) { LOG(info) << "CbmMcbm2018UnpackerAlgoTof::ProcessEndOfMsEpoch => " << " New epoch cycle for Gdpb " << fuCurrDpbIdx - << Form(": Current cycle 0x%09llX New cycle 0x%09llX", - fvulCurrentEpochCycle[fuCurrDpbIdx], + << Form(": Current cycle 0x%09llX New cycle 0x%09llX", fvulCurrentEpochCycle[fuCurrDpbIdx], fvulCurrentEpochCycle[fuCurrDpbIdx] + 1) - << Form("(old Ep %08llx new Ep %08llx)", - fvulCurrentEpoch[fuCurrDpbIdx], - ulEpochNr); + << Form("(old Ep %08llx new Ep %08llx)", fvulCurrentEpoch[fuCurrDpbIdx], ulEpochNr); fvulCurrentEpochCycle[fuCurrDpbIdx]++; } // if( 0 < fvulCurrentEpoch[ fuCurrDpbIdx ] && ulEpochNr < fvulCurrentEpoch[ fuCurrDpbIdx ] ) /* @@ -935,14 +935,13 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessEndOfMsEpoch() { fvulCurrentEpochFull[ fuCurrDpbIdx ] = ulEpochNr + ( gdpbv100::kuEpochCounterSz + 1 ) * fvulCurrentEpochCycle[ fuCurrDpbIdx ]; */ fvulCurrentEpochFull[fuCurrDpbIdx] = - ulEpochNr - + (gdpbv100::kuEpochCounterSz + 1) * fvulCurrentEpochCycle[fuCurrDpbIdx]; + ulEpochNr + (gdpbv100::kuEpochCounterSz + 1) * fvulCurrentEpochCycle[fuCurrDpbIdx]; /// Process the corresponding messages buffer for current gDPB ProcessEpSupprBuffer(); } -void CbmMcbm2018UnpackerAlgoTof::ProcessStarTrigger( - const gdpbv100::Message& mess) { +void CbmMcbm2018UnpackerAlgoTof::ProcessStarTrigger(const gdpbv100::Message& mess) +{ Int_t iMsgIndex = mess.getStarTrigMsgIndex(); switch (iMsgIndex) { @@ -953,57 +952,43 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessStarTrigger( break; case 2: fvulStarTsMid[fuCurrDpbIdx] = mess.getStarTsMidStarC(); break; case 3: { - ULong64_t ulNewGdpbTsFull = - (fvulGdpbTsMsb[fuCurrDpbIdx] << 24) + (fvulGdpbTsLsb[fuCurrDpbIdx]); - ULong64_t ulNewStarTsFull = (fvulStarTsMsb[fuCurrDpbIdx] << 48) - + (fvulStarTsMid[fuCurrDpbIdx] << 8) - + mess.getStarTsLsbStarD(); + ULong64_t ulNewGdpbTsFull = (fvulGdpbTsMsb[fuCurrDpbIdx] << 24) + (fvulGdpbTsLsb[fuCurrDpbIdx]); + ULong64_t ulNewStarTsFull = + (fvulStarTsMsb[fuCurrDpbIdx] << 48) + (fvulStarTsMid[fuCurrDpbIdx] << 8) + mess.getStarTsLsbStarD(); UInt_t uNewToken = mess.getStarTokenStarD(); UInt_t uNewDaqCmd = mess.getStarDaqCmdStarD(); UInt_t uNewTrigCmd = mess.getStarTrigCmdStarD(); - if ((uNewToken == fvuStarTokenLast[fuCurrDpbIdx]) - && (ulNewGdpbTsFull == fvulGdpbTsFullLast[fuCurrDpbIdx]) - && (ulNewStarTsFull == fvulStarTsFullLast[fuCurrDpbIdx]) - && (uNewDaqCmd == fvuStarDaqCmdLast[fuCurrDpbIdx]) + if ((uNewToken == fvuStarTokenLast[fuCurrDpbIdx]) && (ulNewGdpbTsFull == fvulGdpbTsFullLast[fuCurrDpbIdx]) + && (ulNewStarTsFull == fvulStarTsFullLast[fuCurrDpbIdx]) && (uNewDaqCmd == fvuStarDaqCmdLast[fuCurrDpbIdx]) && (uNewTrigCmd == fvuStarTrigCmdLast[fuCurrDpbIdx])) { UInt_t uTrigWord = ((fvuStarTrigCmdLast[fuCurrDpbIdx] & 0x00F) << 16) + ((fvuStarDaqCmdLast[fuCurrDpbIdx] & 0x00F) << 12) + ((fvuStarTokenLast[fuCurrDpbIdx] & 0xFFF)); LOG(warning) << "Possible error: identical STAR tokens found twice in " "a row => ignore 2nd! " - << " TS " << fulCurrentTsIdx << " gDBB #" << fuCurrDpbIdx - << " " + << " TS " << fulCurrentTsIdx << " gDBB #" << fuCurrDpbIdx << " " << Form("token = %5u ", fvuStarTokenLast[fuCurrDpbIdx]) - << Form("gDPB ts = %12llu ", - fvulGdpbTsFullLast[fuCurrDpbIdx]) - << Form("STAR ts = %12llu ", - fvulStarTsFullLast[fuCurrDpbIdx]) + << Form("gDPB ts = %12llu ", fvulGdpbTsFullLast[fuCurrDpbIdx]) + << Form("STAR ts = %12llu ", fvulStarTsFullLast[fuCurrDpbIdx]) << Form("DAQ cmd = %2u ", fvuStarDaqCmdLast[fuCurrDpbIdx]) - << Form("TRG cmd = %2u ", fvuStarTrigCmdLast[fuCurrDpbIdx]) - << Form("TRG Wrd = %5x ", uTrigWord); + << Form("TRG cmd = %2u ", fvuStarTrigCmdLast[fuCurrDpbIdx]) << Form("TRG Wrd = %5x ", uTrigWord); return; } // if exactly same message repeated // GDPB TS counter reset detection if (ulNewGdpbTsFull < fvulGdpbTsFullLast[fuCurrDpbIdx]) - LOG(debug) << "Probable reset of the GDPB TS: old = " - << Form("%16llu", fvulGdpbTsFullLast[fuCurrDpbIdx]) - << " new = " << Form("%16llu", ulNewGdpbTsFull) - << " Diff = -" - << Form("%8llu", - fvulGdpbTsFullLast[fuCurrDpbIdx] - ulNewGdpbTsFull) - << " GDPB #" << Form("%2u", fuCurrDpbIdx); + LOG(debug) << "Probable reset of the GDPB TS: old = " << Form("%16llu", fvulGdpbTsFullLast[fuCurrDpbIdx]) + << " new = " << Form("%16llu", ulNewGdpbTsFull) << " Diff = -" + << Form("%8llu", fvulGdpbTsFullLast[fuCurrDpbIdx] - ulNewGdpbTsFull) << " GDPB #" + << Form("%2u", fuCurrDpbIdx); // STAR TS counter reset detection if (ulNewStarTsFull < fvulStarTsFullLast[fuCurrDpbIdx]) - LOG(debug) << "Probable reset of the STAR TS: old = " - << Form("%16llu", fvulStarTsFullLast[fuCurrDpbIdx]) - << " new = " << Form("%16llu", ulNewStarTsFull) - << " Diff = -" - << Form("%8llu", - fvulStarTsFullLast[fuCurrDpbIdx] - ulNewStarTsFull) - << " GDPB #" << Form("%2u", fuCurrDpbIdx); + LOG(debug) << "Probable reset of the STAR TS: old = " << Form("%16llu", fvulStarTsFullLast[fuCurrDpbIdx]) + << " new = " << Form("%16llu", ulNewStarTsFull) << " Diff = -" + << Form("%8llu", fvulStarTsFullLast[fuCurrDpbIdx] - ulNewStarTsFull) << " GDPB #" + << Form("%2u", fuCurrDpbIdx); /// Check needed to avoid double counting if (fulCurrentMsIdx < fuNbCoreMsPerTs) { @@ -1039,13 +1024,14 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessStarTrigger( } // switch( iMsgIndex ) } // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::ProcessEpSupprBuffer() { +void CbmMcbm2018UnpackerAlgoTof::ProcessEpSupprBuffer() +{ Int_t iBufferSize = fvvmEpSupprBuffer[fuCurrDpbIdx].size(); if (0 == iBufferSize) return; - LOG(debug) << "Now processing stored messages for for gDPB " << fuCurrDpbIdx - << " with epoch number " << (fvulCurrentEpoch[fuCurrDpbIdx] - 1); + LOG(debug) << "Now processing stored messages for for gDPB " << fuCurrDpbIdx << " with epoch number " + << (fvulCurrentEpoch[fuCurrDpbIdx] - 1); /// Data are sorted between epochs, not inside => Epoch level ordering /// Sorting at lower bin precision level @@ -1064,15 +1050,13 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessEpSupprBuffer() { for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) { messageType = fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx].getMessageType(); - fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx( - fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx].getGdpbGenChipId()); + fuGet4Id = fUnpackPar->ElinkIdxToGet4Idx(fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx].getGdpbGenChipId()); if (fuDiamondDpbIdx == fuCurrDpbIdx || 0x90 == fuCurrentMsSysId) fuGet4Id = fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx].getGdpbGenChipId(); fuGet4Nr = (fuCurrDpbIdx * fuNrOfGet4PerGdpb) + fuGet4Id; /// Store the full message in the proper buffer - gdpbv100::FullMessage fullMess(fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx], - ulCurEpochGdpbGet4); + gdpbv100::FullMessage fullMess(fvvmEpSupprBuffer[fuCurrDpbIdx][iMsgIdx], ulCurEpochGdpbGet4); /// Do other actions on it if needed switch (messageType) { @@ -1096,16 +1080,22 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessEpSupprBuffer() { /// Should never appear there break; default: - LOG(error) << "Message type " << std::hex << std::setw(2) - << static_cast<uint16_t>(messageType) + LOG(error) << "Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType) << " not included in Get4 unpacker."; } // switch( mess.getMessageType() ) } // for( Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++ ) fvvmEpSupprBuffer[fuCurrDpbIdx].clear(); } + +static gdpbv100::FullMessage messlast = *(new gdpbv100::FullMessage()); // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) { +void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) +{ + + if (messlast == mess) return; + messlast = mess; + UInt_t uChannel = mess.getGdpbHitChanId(); UInt_t uTot = mess.getGdpbHit32Tot(); @@ -1114,26 +1104,22 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) { // => FTS = Fullt TS modulo 112 // UInt_t uFts = mess.getGdpbHitFullTs() % 112; - UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel; - UInt_t uChannelNrInFee = - (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel; + UInt_t uChannelNr = fuGet4Id * fuNrOfChannelsPerGet4 + uChannel; + UInt_t uChannelNrInFee = (fuGet4Id % fuNrOfGet4PerFee) * fuNrOfChannelsPerGet4 + uChannel; UInt_t uFeeNr = (fuGet4Id / fuNrOfGet4PerFee); UInt_t uFeeNrInSys = fuCurrDpbIdx * fuNrOfFeePerGdpb + uFeeNr; - UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee - + fUnpackPar->Get4ChanToPadiChan(uChannelNrInFee); + UInt_t uRemappedChannelNr = uFeeNr * fuNrOfChannelsPerFee + fUnpackPar->Get4ChanToPadiChan(uChannelNrInFee); // UInt_t uGbtxNr = (uFeeNr / fUnpackPar->GetNrOfFeePerGbtx()); // UInt_t uFeeInGbtx = (uFeeNr % fUnpackPar->GetNrOfFeePerGbtx()); // UInt_t uGbtxNrInSys = fuCurrDpbIdx * fUnpackPar->GetNrOfGbtxPerGdpb() + uGbtxNr; // UInt_t uChanInSyst = fuCurrDpbIdx * fuNrOfChannelsPerGdpb + uChannelNr; - UInt_t uRemappedChannelNrInSys = - fuCurrDpbIdx * fuNrOfChannelsPerGdpb + uFeeNr * fuNrOfChannelsPerFee - + fUnpackPar->Get4ChanToPadiChan(uChannelNrInFee); + UInt_t uRemappedChannelNrInSys = fuCurrDpbIdx * fuNrOfChannelsPerGdpb + uFeeNr * fuNrOfChannelsPerFee + + fUnpackPar->Get4ChanToPadiChan(uChannelNrInFee); /// Diamond FEE have straight connection from Get4 to eLink and from PADI to GET4 if (fuDiamondDpbIdx == fuCurrDpbIdx || 0x90 == fuCurrentMsSysId) { - uRemappedChannelNr = uChannelNr; - uRemappedChannelNrInSys = - fuCurrDpbIdx * fUnpackPar->GetNrOfChannelsPerGdpb() + uChannelNr; + uRemappedChannelNr = uChannelNr; + uRemappedChannelNrInSys = fuCurrDpbIdx * fUnpackPar->GetNrOfChannelsPerGdpb() + uChannelNr; } // if( fuDiamondDpbIdx == fuCurrDpbIdx || 0x90 == fuCurrentMsSysId ) // ULong_t ulHitTime = mess.getMsgFullTime( mess.getExtendedEpoch() ); @@ -1159,11 +1145,9 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) { } // if( fUnpackPar->GetNumberOfChannels() < uChanUId ) */ if (fviRpcChUId.size() < uRemappedChannelNrInSys) { - LOG(fatal) << "Invalid mapping index " << uRemappedChannelNrInSys << " VS " - << fviRpcChUId.size() << ", from GdpbNr " << fuCurrDpbIdx - << ", Get4 " << fuGet4Id << ", Ch " << uChannel << ", ChNr " - << uChannelNr << ", ChNrIF " << uChannelNrInFee << ", FiS " - << uFeeNrInSys; + LOG(fatal) << "Invalid mapping index " << uRemappedChannelNrInSys << " VS " << fviRpcChUId.size() + << ", from GdpbNr " << fuCurrDpbIdx << ", Get4 " << fuGet4Id << ", Ch " << uChannel << ", ChNr " + << uChannelNr << ", ChNrIF " << uChannelNrInFee << ", FiS " << uFeeNrInSys; return; } // if( fviRpcChUId.size() < uRemappedChannelNrInSys ) @@ -1183,54 +1167,46 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) { if (0 == uChanUId) { if (0 < NMappingWarnings--) - LOG(warning) << "Unused data item at " << uRemappedChannelNrInSys - << ", from GdpbNr " << fuCurrDpbIdx << ", Get4 " << fuGet4Id - << ", Ch " << uChannel << ", ChNr " << uChannelNr - << ", ChNrIF " << uChannelNrInFee << ", FiS " << uFeeNrInSys; + LOG(warning) << "Unused data item at " << uRemappedChannelNrInSys << ", from GdpbNr " << fuCurrDpbIdx << ", Get4 " + << fuGet4Id << ", Ch " << uChannel << ", ChNr " << uChannelNr << ", ChNrIF " << uChannelNrInFee + << ", FiS " << uFeeNrInSys; return; // Hit not mapped to digi } /// Apply offset to T0 only to TOF digis if (0x90 != fuCurrentMsSysId) dHitTime -= fdTimeOffsetNs; - LOG(debug) - << Form("Insert 0x%08x digi with time ", uChanUId) << dHitTime - << Form(", Tot %4.0f", dHitTot) - // << " into buffer with " << fBuffer->GetSize() << " data from " - // << Form("%11.1f to %11.1f ", fBuffer->GetTimeFirst(), fBuffer->GetTimeLast()) + LOG(debug) << Form("Insert 0x%08x digi with time ", uChanUId) << dHitTime + << Form(", Tot %4.0f", dHitTot) + // << " into buffer with " << fBuffer->GetSize() << " data from " + // << Form("%11.1f to %11.1f ", fBuffer->GetTimeFirst(), fBuffer->GetTimeLast()) - << " at epoch " << mess.getExtendedEpoch(); + << " at epoch " << mess.getExtendedEpoch(); // CbmTofDigi digi( uChanUId, dHitTime, dHitTot ); // fDigiVect.emplace_back( digi ); fDigiVect.emplace_back(uChanUId, dHitTime, dHitTot); } // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::ProcessSlCtrl( - const gdpbv100::FullMessage& /*mess*/) {} +void CbmMcbm2018UnpackerAlgoTof::ProcessSlCtrl(const gdpbv100::FullMessage& /*mess*/) {} // ------------------------------------------------------------------------- -void CbmMcbm2018UnpackerAlgoTof::ProcessSysMess( - const gdpbv100::FullMessage& mess) { +void CbmMcbm2018UnpackerAlgoTof::ProcessSysMess(const gdpbv100::FullMessage& mess) +{ switch (mess.getGdpbSysSubType()) { case gdpbv100::SYS_GET4_ERROR: { ProcessError(mess); break; } // case gdpbv100::SYSMSG_GET4_EVENT case gdpbv100::SYS_GDPB_UNKWN: { - LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8) - << mess.getGdpbSysUnkwData() << std::dec - << " Full message: " << std::hex << std::setw(16) - << mess.getData() << std::dec; + LOG(debug) << "Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.getGdpbSysUnkwData() << std::dec + << " Full message: " << std::hex << std::setw(16) << mess.getData() << std::dec; break; } // case gdpbv100::SYS_GDPB_UNKWN: case gdpbv100::SYS_GET4_SYNC_MISS: { if (mess.getGdpbSysFwErrResync()) - LOG(info) << Form("GET4 Resynchronization: Get4:0x%04x ", - mess.getGdpbGenChipId()) - << fuCurrDpbIdx; + LOG(info) << Form("GET4 Resynchronization: Get4:0x%04x ", mess.getGdpbGenChipId()) << fuCurrDpbIdx; else - LOG(info) << "GET4 synchronization pulse missing in gDPB " - << fuCurrDpbIdx; + LOG(info) << "GET4 synchronization pulse missing in gDPB " << fuCurrDpbIdx; break; } // case gdpbv100::SYS_GET4_SYNC_MISS: case gdpbv100::SYS_PATTERN: { @@ -1243,8 +1219,8 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessSysMess( } // default } // switch( mess.getGdpbSysSubType() ) } -void CbmMcbm2018UnpackerAlgoTof::ProcessError( - const gdpbv100::FullMessage& mess) { +void CbmMcbm2018UnpackerAlgoTof::ProcessError(const gdpbv100::FullMessage& mess) +{ uint32_t uErrorType = mess.getGdpbSysErrData(); switch (uErrorType) { @@ -1285,19 +1261,15 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessError( return; } -void CbmMcbm2018UnpackerAlgoTof::ProcessPattern( - const gdpbv100::FullMessage& mess) { +void CbmMcbm2018UnpackerAlgoTof::ProcessPattern(const gdpbv100::FullMessage& mess) +{ uint16_t usType = mess.getGdpbSysPattType(); uint16_t usIndex = mess.getGdpbSysPattIndex(); uint32_t uPattern = mess.getGdpbSysPattPattern(); switch (usType) { case gdpbv100::PATT_MISSMATCH: { - LOG(debug) << Form( - "Missmatch pattern message => Type %u, Index %2d, Pattern 0x%08X", - usType, - usIndex, - uPattern); + LOG(debug) << Form("Missmatch pattern message => Type %u, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern); /* if(usIndex==7) { TString Tok; @@ -1313,11 +1285,7 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessPattern( } // case gdpbv100::PATT_MISSMATCH: case gdpbv100::PATT_ENABLE: { - LOG(debug2) << Form( - "Enable pattern message => Type %d, Index %2d, Pattern 0x%08X", - usType, - usIndex, - uPattern); + LOG(debug2) << Form("Enable pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern); /* for( UInt_t uBit = 0; uBit < 32; ++uBit ) if( ( uPattern >> uBit ) & 0x1 ) @@ -1330,11 +1298,7 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessPattern( } // case gdpbv100::PATT_ENABLE: case gdpbv100::PATT_RESYNC: { - LOG(debug) << Form( - "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", - usType, - usIndex, - uPattern); + LOG(debug) << Form("RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern); break; } // case gdpbv100::PATT_RESYNC: @@ -1356,52 +1320,29 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessPattern( } // ------------------------------------------------------------------------- -Bool_t CbmMcbm2018UnpackerAlgoTof::CreateHistograms() { +Bool_t CbmMcbm2018UnpackerAlgoTof::CreateHistograms() +{ std::string sFolder = "Tof_Raw_gDPB"; LOG(info) << "create Histos for " << fuNrOfGdpbs << " gDPBs "; fhRawTDigEvT0 = - new TH1F(Form("Raw_TDig-EvT0"), - Form("Raw digi time difference to 1st digi ; time [ns]; cts"), - 500, - 0, - 100.); + new TH1F(Form("Raw_TDig-EvT0"), Form("Raw digi time difference to 1st digi ; time [ns]; cts"), 500, 0, 100.); fhRawTDigRef0 = - new TH1F(Form("Raw_TDig-Ref0"), - Form("Raw digi time difference to Ref ; time [ns]; cts"), - 6000, - -10000, - 50000); + new TH1F(Form("Raw_TDig-Ref0"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -10000, 50000); fhRawTDigRef = - new TH1F(Form("Raw_TDig-Ref"), - Form("Raw digi time difference to Ref ; time [ns]; cts"), - 6000, - -1000, - 5000); - - fhRawTRefDig0 = - new TH1F(Form("Raw_TRef-Dig0"), - Form("Raw Ref time difference to last digi ; time [ns]; cts"), - 9999, - -50000, - 50000); + new TH1F(Form("Raw_TDig-Ref"), Form("Raw digi time difference to Ref ; time [ns]; cts"), 6000, -1000, 5000); + + fhRawTRefDig0 = new TH1F(Form("Raw_TRef-Dig0"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999, + -50000, 50000); fhRawTRefDig1 = - new TH1F(Form("Raw_TRef-Dig1"), - Form("Raw Ref time difference to last digi ; time [ns]; cts"), - 9999, - -5000, - 5000); - - fhRawDigiLastDigi = - new TH1F(Form("Raw_Digi-LastDigi"), - Form("Raw Digi time difference to last digi ; time [ns]; cts"), - 9999, - -5000, - 5000); + new TH1F(Form("Raw_TRef-Dig1"), Form("Raw Ref time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000); + + fhRawDigiLastDigi = new TH1F(Form("Raw_Digi-LastDigi"), + Form("Raw Digi time difference to last digi ; time [ns]; cts"), 9999, -5000, 5000); /// Add pointers to the vector with all histo for access by steering class AddHistoToVector(fhRawTDigEvT0, sFolder); @@ -1416,39 +1357,20 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::CreateHistograms() { fhChCountRemap.resize(fuNrOfGdpbs); fhChanCoinc.resize(fuNrOfGdpbs); for (UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb++) { - fhRawTotCh[uGdpb] = - new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb), - Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb), - fuNrOfGet4PerGdpb * 4, - 0., - fuNrOfGet4PerGdpb * 4, - 256, - 0., - 256.); + fhRawTotCh[uGdpb] = new TH2F(Form("Raw_Tot_gDPB_%02u", uGdpb), Form("Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb), + fuNrOfGet4PerGdpb * 4, 0., fuNrOfGet4PerGdpb * 4, 256, 0., 256.); fhChCount[uGdpb] = - new TH1I(Form("ChCount_gDPB_%02u", uGdpb), - Form("Channel counts gDPB %02u; channel; Hits", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb); - - fhChCountRemap[uGdpb] = new TH1I( - Form("ChCountRemap_gDPB_%02u", uGdpb), - Form("Remapped channel counts gDPB %02u; Remapped channel; Hits", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb); + new TH1I(Form("ChCount_gDPB_%02u", uGdpb), Form("Channel counts gDPB %02u; channel; Hits", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb); + + fhChCountRemap[uGdpb] = new TH1I(Form("ChCountRemap_gDPB_%02u", uGdpb), + Form("Remapped channel counts gDPB %02u; Remapped channel; Hits", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb); fhChanCoinc[uGdpb] = - new TH2F(Form("fhChanCoinc_%02u", uGdpb), - Form("Channels Coincidence %02u; Left; Right", uGdpb), - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb, - fuNrOfChannelsPerGdpb, - 0., - fuNrOfChannelsPerGdpb); + new TH2F(Form("fhChanCoinc_%02u", uGdpb), Form("Channels Coincidence %02u; Left; Right", uGdpb), + fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb, fuNrOfChannelsPerGdpb, 0., fuNrOfChannelsPerGdpb); /// Add pointers to the vector with all histo for access by steering class AddHistoToVector(fhRawTotCh[uGdpb], sFolder); @@ -1457,18 +1379,9 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::CreateHistograms() { AddHistoToVector(fhChanCoinc[uGdpb], sFolder); } // for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; uGdpb ++) - fhVectorSize = - new TH1I("fhVectorSize", - "Size of the vector VS TS index; TS index; Size [bytes]", - 10000, - 0., - 10000.); + fhVectorSize = new TH1I("fhVectorSize", "Size of the vector VS TS index; TS index; Size [bytes]", 10000, 0., 10000.); fhVectorCapacity = - new TH1I("fhVectorCapacity", - "Size of the vector VS TS index; TS index; Size [bytes]", - 10000, - 0., - 10000.); + new TH1I("fhVectorCapacity", "Size of the vector VS TS index; TS index; Size [bytes]", 10000, 0., 10000.); AddHistoToVector(fhVectorSize, sFolder); AddHistoToVector(fhVectorCapacity, sFolder); @@ -1526,7 +1439,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::CreateHistograms() { */ return kTRUE; } -Bool_t CbmMcbm2018UnpackerAlgoTof::FillHistograms() { +Bool_t CbmMcbm2018UnpackerAlgoTof::FillHistograms() +{ /* UInt_t uNbEvents = fvEventsBuffer.size(); fhEventNbPerTs->Fill( uNbEvents ); @@ -1553,7 +1467,8 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::FillHistograms() { */ return kTRUE; } -Bool_t CbmMcbm2018UnpackerAlgoTof::ResetHistograms() { +Bool_t CbmMcbm2018UnpackerAlgoTof::ResetHistograms() +{ /* for( UInt_t uGdpb = 0; uGdpb < fuNrOfGdpbs; ++uGdpb ) { diff --git a/macro/beamtime/pl_all_CluRateRatio.C b/macro/beamtime/pl_all_CluRateRatio.C index 8d2b054de1..925ea19a5d 100644 --- a/macro/beamtime/pl_all_CluRateRatio.C +++ b/macro/beamtime/pl_all_CluRateRatio.C @@ -1,10 +1,6 @@ -void pl_all_CluRateRatio(Int_t iRef = 500, - Int_t iNSt = 3, - Double_t Tstart = 0., - Double_t Tend = 800., - Int_t iMode = 0, - Int_t iOpt = 0, - Double_t THR = 1.E5) { +void pl_all_CluRateRatio(Int_t iRef = 500, Int_t iNSt = 3, Double_t Tstart = 0., Double_t Tend = 800., Int_t iMode = 0, + Int_t iOpt = 0, Double_t THR = 1.E5) +{ // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); // TCanvas *can = new TCanvas("can","can",48,55,700,900); @@ -31,11 +27,9 @@ void pl_all_CluRateRatio(Int_t iRef = 500, TH1* hRat; TH1* hDis; TH2* h2; - const Int_t iTSR[11] = {500, 41, 31, 900, 901, 910, 911, 600, 601, 800, 801}; - const Double_t dArea[11] = { - 1., 18., 44.0, 896., 896., 896., 896., 280., 280., 32., 4.}; - const Double_t dDist[11] = { - 1., 353., 532.5, 386., 416., 416., 445., 478., 485., 517., 543.}; + const Int_t iTSR[11] = {500, 41, 31, 900, 901, 910, 911, 600, 601, 800, 801}; + const Double_t dArea[11] = {1., 18., 44.0, 896., 896., 896., 896., 280., 280., 32., 4.}; + const Double_t dDist[11] = {1., 353., 532.5, 386., 416., 416., 445., 478., 485., 517., 543.}; Int_t iCanv = 0; // if (h!=NULL) h->Delete(); @@ -54,12 +48,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, gROOT->cd(); switch (iMode) { - case 0: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); - break; - case 1: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); - break; + case 0: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); break; + case 1: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); break; } h = (TH1*) gROOT->FindObjectAny(hname); if (h != NULL) { @@ -82,9 +72,24 @@ void pl_all_CluRateRatio(Int_t iRef = 500, hRef->GetXaxis()->SetRangeUser(Tstart, Tend); hRef->Draw("histE"); hRef->Sumw2(); - //hRef->UseCurrentStyle(); + Double_t RateMax = hRef->GetMaximum(); + TH1F* hRefRate = + new TH1F("hRefRate", Form("Rate distribution; %s", hRef->GetYaxis()->GetTitle()), 100, 0., RateMax); + for (Int_t iBin = hRef->FindBin(Tstart); iBin < hRef->FindBin(Tend); iBin++) + hRefRate->Fill(hRef->GetBinContent(iBin)); + //hRefRate->Sumw2(); + Double_t RateAv = hRefRate->GetMean(1); + Double_t RateRMS = hRefRate->GetStdDev(1); + cout << "Reference counter average rate " << RateAv << ", RMS " << RateRMS << endl; + gStyle->SetOptStat(1111); + TCanvas* can2 = new TCanvas("can2", "can2", 700, 56, 500, 500); + can2->cd(1); + hRefRate->Draw("histE"); + hRefRate->UseCurrentStyle(); + gPad->Update(); } + can->cd(1); Int_t iCol = 1; for (Int_t iSt = 0; iSt < iNSt; iSt++) { iRp = iTSR[iSt] % 10; @@ -94,12 +99,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, gROOT->cd(); switch (iMode) { - case 0: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); - break; - case 1: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); - break; + case 0: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); break; + case 1: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); break; } h = (TH1*) gROOT->FindObjectAny(hname); if (h != NULL) { @@ -124,7 +125,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, if (iCol == 5) iCol++; // skip yellow //h->UseCurrentStyle(); //gPad->SetLogy(); - } else { + } + else { cout << "Histogram " << hname << " not existing. " << endl; } } @@ -141,12 +143,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, gROOT->cd(); switch (iMode) { - case 0: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); - break; - case 1: - hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); - break; + case 0: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSm, iRp); break; + case 1: hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSm, iRp); break; } h = (TH1*) gROOT->FindObjectAny(hname); if (h != NULL) { @@ -164,10 +162,7 @@ void pl_all_CluRateRatio(Int_t iRef = 500, hRat->Divide(h, hRef, 1. / dArea[iSt], 1. / dArea[IndRef], "B"); break; case 2: //flux=rate/area*dist**2 - hRat->Divide(h, - hRef, - dDist[iSt] * dDist[iSt] / dArea[iSt], - dDist[IndRef] * dDist[IndRef] / dArea[IndRef], + hRat->Divide(h, hRef, dDist[iSt] * dDist[iSt] / dArea[iSt], dDist[IndRef] * dDist[IndRef] / dArea[IndRef], "B"); break; case 10: { @@ -175,15 +170,15 @@ void pl_all_CluRateRatio(Int_t iRef = 500, Double_t dErr = 0.; for (Int_t iBin = 0; iBin < h->GetNbinsX(); iBin++) { if (iBin < 100) - cout << "h " << h->GetName() << " bin " << iBin << ", cts " - << hRef->GetBinContent(iBin + 1) << ", val " << dVal << endl; + cout << "h " << h->GetName() << " bin " << iBin << ", cts " << hRef->GetBinContent(iBin + 1) << ", val " + << dVal << endl; if (hRef->GetBinContent(iBin + 1) > THR) { dVal = h->GetBinContent(iBin + 1) / hRef->GetBinContent(iBin + 1); - dErr = - TMath::Sqrt(TMath::Power(h->GetBinContent(iBin + 1), -0.5) - + TMath::Power(hRef->GetBinContent(iBin + 1), -0.5)) - * dVal; - } else { + dErr = TMath::Sqrt(TMath::Power(h->GetBinContent(iBin + 1), -0.5) + + TMath::Power(hRef->GetBinContent(iBin + 1), -0.5)) + * dVal; + } + else { dErr = 0.; } hRat->SetBinContent(iBin + 1, dVal); @@ -195,7 +190,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, hRat->SetMinimum(1.E-2); hRat->Draw("L E"); hRat->GetXaxis()->SetRangeUser(Tstart, Tend); - } else + } + else hRat->Draw("L E SAME"); hRat->SetLineColor(iCol++); @@ -203,7 +199,8 @@ void pl_all_CluRateRatio(Int_t iRef = 500, //h->UseCurrentStyle(); gPad->SetLogy(); - } else { + } + else { cout << "Histogram " << hname << " not existing. " << endl; } leg->Draw(); diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21a_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21a_mcbm.C index 0d187df1de..9979f00e7b 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21a_mcbm.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21a_mcbm.C @@ -77,37 +77,26 @@ const TString ElectronicsMedium = "carbon"; // 6 Buc 2019 // 7 CERN 20gap // 8 Ceramic Pad -const Int_t NumberOfDifferentCounterTypes = 9; -const Float_t Glass_X[NumberOfDifferentCounterTypes] = - {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t Glass_Y[NumberOfDifferentCounterTypes] = - {27.0, 53., 26.8, 10., 0.2, 10., 6., 20., 2.4}; -const Float_t Glass_Z[NumberOfDifferentCounterTypes] = - {0.1, 0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1}; - -const Float_t GasGap_X[NumberOfDifferentCounterTypes] = - {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = - {27.0, 53., 26.8, 10., 0.2, 10., 6., 20., 2.4}; -const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = - {0.025, 0.025, 0.025, 0.025, 0.01, 0.02, 0.02, 0.02, 0.025}; - -const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = - {8, 8, 8, 8, 1, 8, 10, 20, 4}; +const Int_t NumberOfDifferentCounterTypes = 9; +const Float_t Glass_X[NumberOfDifferentCounterTypes] = {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t Glass_Y[NumberOfDifferentCounterTypes] = {27.0, 53., 26.8, 10., 0.2, 10., 6., 20., 2.4}; +const Float_t Glass_Z[NumberOfDifferentCounterTypes] = {0.1, 0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1}; + +const Float_t GasGap_X[NumberOfDifferentCounterTypes] = {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = {27.0, 53., 26.8, 10., 0.2, 10., 6., 20., 2.4}; +const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = {0.025, 0.025, 0.025, 0.025, 0.01, 0.02, 0.02, 0.02, 0.025}; + +const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {8, 8, 8, 8, 1, 8, 10, 20, 4}; //const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = - {32, 32, 32, 32, 8, 32, 32, 20, 1}; +const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {32, 32, 32, 32, 8, 32, 32, 20, 1}; //const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = - {-0.6, -0.6, -0.6, -0.6, -0.1, -0.6, -0.6, -0.6, -1.}; +const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = {-0.6, -0.6, -0.6, -0.6, -0.1, + -0.6, -0.6, -0.6, -1.}; -const Float_t Electronics_X[NumberOfDifferentCounterTypes] = - {34.0, 53.0, 32.0, 32., 0.3, 0.1, 28.8, 20., 0.1}; -const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = - {5.0, 5.0, 1.0, 1., 0.1, 0.1, 1.0, 1.0, 0.1}; -const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = - {0.3, 0.3, 0.3, 0.3, 0.1, 0.1, 0.1, 0.1, 0.1}; +const Float_t Electronics_X[NumberOfDifferentCounterTypes] = {34.0, 53.0, 32.0, 32., 0.3, 0.1, 28.8, 20., 0.1}; +const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = {5.0, 5.0, 1.0, 1., 0.1, 0.1, 1.0, 1.0, 0.1}; +const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = {0.3, 0.3, 0.3, 0.3, 0.1, 0.1, 0.1, 0.1, 0.1}; const Int_t NofModuleTypes = 10; // 5 Diamond @@ -116,43 +105,31 @@ const Int_t NofModuleTypes = 10; // 8 Ceramic // 9 Star2 // Aluminum box for all module types -const Float_t Module_Size_X[NofModuleTypes] = - {180., 180., 180., 180., 180., 5., 40., 30., 22.5, 100.}; -const Float_t Module_Size_Y[NofModuleTypes] = - {49., 49., 74., 28., 18., 5., 12., 30., 11., 49.}; -const Float_t Module_Over_Y[NofModuleTypes] = - {11.5, 11.5, 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; -const Float_t Module_Size_Z[NofModuleTypes] = - {11., 11., 13., 11., 11., 1., 12., 6., 6.2, 11.2}; -const Float_t Module_Thick_Alu_X_left = 0.1; -const Float_t Module_Thick_Alu_X_right = 1.0; -const Float_t Module_Thick_Alu_Y = 0.1; -const Float_t Module_Thick_Alu_Z = 0.1; +const Float_t Module_Size_X[NofModuleTypes] = {180., 180., 180., 180., 180., 5., 40., 30., 22.5, 100.}; +const Float_t Module_Size_Y[NofModuleTypes] = {49., 49., 74., 28., 18., 5., 12., 30., 11., 49.}; +const Float_t Module_Over_Y[NofModuleTypes] = {11.5, 11.5, 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; +const Float_t Module_Size_Z[NofModuleTypes] = {11., 11., 13., 11., 11., 1., 12., 6., 6.2, 11.2}; +const Float_t Module_Thick_Alu_X_left = 0.1; +const Float_t Module_Thick_Alu_X_right = 1.0; +const Float_t Module_Thick_Alu_Y = 0.1; +const Float_t Module_Thick_Alu_Z = 0.1; // Distance to the center of the TOF wall [cm]; const Float_t Wall_Z_Position = 400.; const Float_t MeanTheta = 0.; //Type of Counter for module -const Int_t CounterTypeInModule[NofModuleTypes] = - {0, 0, 1, 2, 3, 4, 6, 7, 8, 2}; -const Int_t NCounterInModule[NofModuleTypes] = {5, 5, 3, 5, 5, 1, 2, 1, 8, 2}; +const Int_t CounterTypeInModule[NofModuleTypes] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 2}; +const Int_t NCounterInModule[NofModuleTypes] = {5, 5, 3, 5, 5, 1, 2, 1, 8, 2}; // Placement of the counter inside the module -const Float_t CounterXStartPosition[NofModuleTypes] = - {-60.1, -66.0, -56.0, -60.0, -60.0, 0.0, 0., 0., -7., 0.}; -const Float_t CounterXDistance[NofModuleTypes] = - {29.3, 32.0, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., -1.}; -const Float_t CounterYStartPosition[NofModuleTypes] = - {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; -const Float_t CounterYDistance[NofModuleTypes] = - {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 1.}; -const Float_t CounterZDistance[NofModuleTypes] = - {-2.5, 0.0, 0.0, 2.5, 2.5, 0., 6., 0., 0.1, 4.}; -const Float_t CounterZStartPosition[NofModuleTypes] = - {0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -2.}; -const Float_t CounterRotationAngle[NofModuleTypes] = - {0., 8.7, 7.0, 0., 0., 0., 0., 0., 0., 0.}; +const Float_t CounterXStartPosition[NofModuleTypes] = {-60.1, -66.0, -56.0, -60.0, -60.0, 0.0, 0., 0., -7., 0.}; +const Float_t CounterXDistance[NofModuleTypes] = {29.3, 32.0, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., -1.}; +const Float_t CounterYStartPosition[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; +const Float_t CounterYDistance[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 1.}; +const Float_t CounterZDistance[NofModuleTypes] = {-2.5, 0.0, 0.0, 2.5, 2.5, 0., 6., 0., 0.1, 4.}; +const Float_t CounterZStartPosition[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -2.}; +const Float_t CounterRotationAngle[NofModuleTypes] = {0., 8.7, 7.0, 0., 0., 0., 0., 0., 0., 0.}; // Pole (support structure) const Int_t MaxNumberOfPoles = 20; @@ -199,15 +176,13 @@ const Float_t InnerSide_Module_Types[Inner_Module_NTypes] = {5.}; const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {2.}; //v13_3a //const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {0.}; //debug -const Float_t Outer_Module_First_Y_Position = 0.; -const Float_t Outer_Module_Last_Y_Position = 480.; -const Float_t Outer_Module_X_Offset = 3.; -const Int_t Outer_Module_Col = 4; -const Int_t Outer_Module_NTypes = 2; -const Float_t Outer_Module_Types[Outer_Module_NTypes][Outer_Module_Col] = - {1., 1., 1., 1., 2., 2., 2., 2.}; -const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = - {9., 9., 2., 0., 0., 0., 3., 4.}; //V13_3a +const Float_t Outer_Module_First_Y_Position = 0.; +const Float_t Outer_Module_Last_Y_Position = 480.; +const Float_t Outer_Module_X_Offset = 3.; +const Int_t Outer_Module_Col = 4; +const Int_t Outer_Module_NTypes = 2; +const Float_t Outer_Module_Types[Outer_Module_NTypes][Outer_Module_Col] = {1., 1., 1., 1., 2., 2., 2., 2.}; +const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {9., 9., 2., 0., 0., 0., 3., 4.}; //V13_3a //const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,0.,0., 0.,0.,0.,0.};//debug const Float_t Star2_First_Z_Position = TOF_Z_Front + 15.7; @@ -231,8 +206,7 @@ const Float_t Buc_Number[Buc_NTypes] = {1.}; //debugging, V16b const Float_t Buc_X_Offset[Buc_NTypes] = {0.}; const Int_t Cer_NTypes = 3; -const Float_t Cer_Z_Position[Cer_NTypes] = {(float) (TOF_Z_Front + 13.2), - (float) (TOF_Z_Front + 45.), +const Float_t Cer_Z_Position[Cer_NTypes] = {(float) (TOF_Z_Front + 13.2), (float) (TOF_Z_Front + 45.), (float) (TOF_Z_Front + 45.)}; const Float_t Cer_X_Position[Cer_NTypes] = {0., 49.8, 49.8}; const Float_t Cer_Y_Position[Cer_NTypes] = {-1., 5., 5.}; @@ -246,8 +220,7 @@ const Float_t CERN_X_Offset = 46.; //65.5; const Float_t CERN_rotate_Z = 90.; const Int_t CERN_NTypes = 1; const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType! -const Float_t CERN_Number[CERN_NTypes] = { - 1.}; // evtl. double for split signals +const Float_t CERN_Number[CERN_NTypes] = {1.}; // evtl. double for split signals // some global variables TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance @@ -288,7 +261,8 @@ void position_CERN(Int_t); void dump_info_file(); -void Create_TOF_Geometry_v21a_mcbm() { +void Create_TOF_Geometry_v21a_mcbm() +{ // Load needed material definition from media.geo file create_materials_from_media_file(); @@ -322,12 +296,9 @@ void Create_TOF_Geometry_v21a_mcbm() { TGeoVolume* tofstand = new TGeoVolumeAssembly(geoVersionStand); // Mar 2020 run - TGeoTranslation* stand_trans_local = - new TGeoTranslation("", TOF_X_Front_Stand, 0., 0.); - TGeoTranslation* stand_trans = - new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); - TGeoCombiTrans* stand_combi_trans = - new TGeoCombiTrans(*stand_trans, *tof_rotation); + TGeoTranslation* stand_trans_local = new TGeoTranslation("", TOF_X_Front_Stand, 0., 0.); + TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); + TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *tof_rotation); // Nov 2019 run // TGeoTranslation* stand_trans = new TGeoTranslation("", 12., 0., TOF_Z_Front_Stand); @@ -335,15 +306,13 @@ void Create_TOF_Geometry_v21a_mcbm() { TGeoRotation* stand_rot = new TGeoRotation(); stand_rot->RotateY(0.); //stand_rot->RotateY(1.0); - TGeoCombiTrans* stand_combi_trans_local = - new TGeoCombiTrans(*stand_trans_local, *stand_rot); + TGeoCombiTrans* stand_combi_trans_local = new TGeoCombiTrans(*stand_trans_local, *stand_rot); //tof->AddNode(tofstand, 1, stand_combi_trans); tof->AddNode(tofstand, 1, stand_combi_trans_local); //tof->AddNode(tofstand, 1); - for (Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; - counterType++) { + for (Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; counterType++) { gCounter[counterType] = create_new_counter(counterType); } @@ -364,12 +333,10 @@ void Create_TOF_Geometry_v21a_mcbm() { // position_CERN(1); position_Buc(1); - cout << "Outer Types " << Outer_Module_Types[0][0] << ", " - << Outer_Module_Types[1][0] << ", col=1: " << Outer_Module_Types[0][1] - << ", " << Outer_Module_Types[1][1] << endl; - cout << "Outer Number " << Outer_Module_Number[0][0] << ", " - << Outer_Module_Number[1][0] << ", col=1: " << Outer_Module_Number[0][1] - << ", " << Outer_Module_Number[1][1] << endl; + cout << "Outer Types " << Outer_Module_Types[0][0] << ", " << Outer_Module_Types[1][0] + << ", col=1: " << Outer_Module_Types[0][1] << ", " << Outer_Module_Types[1][1] << endl; + cout << "Outer Number " << Outer_Module_Number[0][0] << ", " << Outer_Module_Number[1][0] + << ", col=1: " << Outer_Module_Number[0][1] << ", " << Outer_Module_Number[1][1] << endl; // position_outer_tof_modules(4); // position_tof_poles(0); // position_tof_bars(0); @@ -422,7 +389,8 @@ void Create_TOF_Geometry_v21a_mcbm() { // top->Raytrace(); } -void create_materials_from_media_file() { +void create_materials_from_media_file() +{ // Use the FairRoot geometry interface to load the media which are already defined FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader"); FairGeoInterface* geoFace = geoLoad->getGeoInterface(); @@ -452,7 +420,8 @@ void create_materials_from_media_file() { geoBuild->createMedium(carbon); } -TGeoVolume* create_counter(Int_t modType) { +TGeoVolume* create_counter(Int_t modType) +{ //glass Float_t gdx = Glass_X[modType]; @@ -487,26 +456,22 @@ TGeoVolume* create_counter(Int_t modType) { TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // Single glass plate - TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); - TGeoVolume* glass_plate_vol = - new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor( - kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); + glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., 0.); // Single gas gap TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); //TGeoVolume* gas_gap_vol = //new TGeoVolume("tof_gas_gap", gas_gap, noActiveGasVolMed); - TGeoVolume* gas_gap_vol = - new TGeoVolume("tof_gas_active", gas_gap, activeGasVolMed); + TGeoVolume* gas_gap_vol = new TGeoVolume("tof_gas_active", gas_gap, activeGasVolMed); gas_gap_vol->Divide("Strip", 1, nstrips, -ggdx / 2., 0); gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap gas_gap_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_gap_trans = - new TGeoTranslation("", 0., 0., (gdz + ggdz) / 2.); + TGeoTranslation* gas_gap_trans = new TGeoTranslation("", 0., 0., (gdz + ggdz) / 2.); // Single subdivided active gas gap @@ -536,12 +501,10 @@ TGeoVolume* create_counter(Int_t modType) { TGeoVolume* multi_stack = new TGeoVolumeAssembly("multi_stack"); Int_t l; for (l = 0; l < ngaps; l++) { - TGeoTranslation* single_stack_trans = - new TGeoTranslation("", 0., 0., startzpos + l * dzpos); + TGeoTranslation* single_stack_trans = new TGeoTranslation("", 0., 0., startzpos + l * dzpos); multi_stack->AddNode(single_stack, l, single_stack_trans); } - TGeoTranslation* single_glass_back_trans = - new TGeoTranslation("", 0., 0., startzpos + ngaps * dzpos); + TGeoTranslation* single_glass_back_trans = new TGeoTranslation("", 0., 0., startzpos + ngaps * dzpos); multi_stack->AddNode(glass_plate_vol, l, single_glass_back_trans); // Add electronics above and below the glass stack to build a complete counter @@ -562,7 +525,8 @@ TGeoVolume* create_counter(Int_t modType) { return counter; } -TGeoVolume* create_new_counter(Int_t modType) { +TGeoVolume* create_new_counter(Int_t modType) +{ //glass Float_t gdx = Glass_X[modType]; @@ -590,16 +554,12 @@ TGeoVolume* create_new_counter(Int_t modType) { Float_t cdx = TMath::Max(gdx, ggdx); cdx = TMath::Max(cdx, dxe) + 0.2; Float_t cdy = TMath::Max(gdy, ggdy) + 2 * dye + 0.2; - Float_t cdz = ngaps * ggdz + (ngaps + 1) * gdz - + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok + Float_t cdz = ngaps * ggdz + (ngaps + 1) * gdz + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok //calculate thickness and first position in counter of single stack - Float_t dzpos = gdz + ggdz; - Float_t startzposglas = - -ngaps * (gdz + ggdz) - / 2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok - Float_t startzposgas = - startzposglas + gdz / 2. + ggdz / 2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok + Float_t dzpos = gdz + ggdz; + Float_t startzposglas = -ngaps * (gdz + ggdz) / 2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok + Float_t startzposgas = startzposglas + gdz / 2. + ggdz / 2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok // needed materials @@ -611,18 +571,15 @@ TGeoVolume* create_new_counter(Int_t modType) { // define counter volume TGeoBBox* counter_box = new TGeoBBox("", cdx / 2., cdy / 2., cdz / 2.); - TGeoVolume* counter = - new TGeoVolume("counter", counter_box, noActiveGasVolMed); + TGeoVolume* counter = new TGeoVolume("counter", counter_box, noActiveGasVolMed); counter->SetLineColor(kRed); // set line color for the counter counter->SetTransparency(70); // set transparency for the TOF // define single glass plate volume - TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); - TGeoVolume* glass_plate_vol = - new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor( - kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); + glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF // define single gas gap volume TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); TGeoVolume* gas_gap_vol = new TGeoVolume("Gap", gas_gap, activeGasVolMed); @@ -633,15 +590,13 @@ TGeoVolume* create_new_counter(Int_t modType) { // place 8 gas gaps and 9 glas plates in the counter for (Int_t igap = 0; igap <= ngaps; igap++) { // place (ngaps+1) glass plates - Float_t zpos_glas = startzposglas + igap * dzpos; - TGeoTranslation* glass_plate_trans = - new TGeoTranslation("", 0., 0., zpos_glas); + Float_t zpos_glas = startzposglas + igap * dzpos; + TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., zpos_glas); counter->AddNode(glass_plate_vol, igap, glass_plate_trans); // place ngaps gas gaps if (igap < ngaps) { - Float_t zpos_gas = startzposgas + igap * dzpos; - TGeoTranslation* gas_gap_trans = - new TGeoTranslation("", 0., 0., zpos_gas); + Float_t zpos_gas = startzposgas + igap * dzpos; + TGeoTranslation* gas_gap_trans = new TGeoTranslation("", 0., 0., zpos_gas); counter->AddNode(gas_gap_vol, igap, gas_gap_trans); } // cout <<"Zpos(Glas): "<< zpos_glas << endl; @@ -663,7 +618,8 @@ TGeoVolume* create_new_counter(Int_t modType) { return counter; } -TGeoVolume* create_tof_module(Int_t modType) { +TGeoVolume* create_tof_module(Int_t modType) +{ Int_t cType = CounterTypeInModule[modType]; Float_t dx = Module_Size_X[modType]; Float_t dy = Module_Size_Y[modType]; @@ -673,8 +629,7 @@ TGeoVolume* create_tof_module(Int_t modType) { Float_t width_aluy = Module_Thick_Alu_Y; Float_t width_aluz = Module_Thick_Alu_Z; - Float_t shift_gas_box = - (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; + Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; Float_t dxpos = CounterXDistance[modType]; Float_t startxpos = CounterXStartPosition[modType]; @@ -694,40 +649,34 @@ TGeoVolume* create_tof_module(Int_t modType) { TGeoTranslation* alu_box_trans = new TGeoTranslation("", 0., 0., 0.); module->AddNode(alu_box_vol, 0, alu_box_trans); - TGeoBBox* gas_box = new TGeoBBox("", - (dx - (width_aluxl + width_aluxr)) / 2., - (dy - 2 * width_aluy) / 2., - (dz - 2 * width_aluz) / 2.); - TGeoVolume* gas_box_vol = - new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); + TGeoBBox* gas_box = + new TGeoBBox("", (dx - (width_aluxl + width_aluxr)) / 2., (dy - 2 * width_aluy) / 2., (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); gas_box_vol->SetLineColor(kYellow); // set line color for the gas box gas_box_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_box_trans = - new TGeoTranslation("", shift_gas_box, 0., 0.); + TGeoTranslation* gas_box_trans = new TGeoTranslation("", shift_gas_box, 0., 0.); alu_box_vol->AddNode(gas_box_vol, 0, gas_box_trans); for (Int_t j = 0; j < 5; j++) { //loop over counters (modules) Float_t zpos; - if (0 == modType) { - zpos = dzoff *= -1; - } else { + if (0 == modType) { zpos = dzoff *= -1; } + else { zpos = 0.; } //cout << "counter z position " << zpos << endl; - TGeoTranslation* counter_trans = - new TGeoTranslation("", startxpos + j * dxpos, 0.0, zpos); + TGeoTranslation* counter_trans = new TGeoTranslation("", startxpos + j * dxpos, 0.0, zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = - new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } return module; } -TGeoVolume* create_new_tof_module(Int_t modType) { +TGeoVolume* create_new_tof_module(Int_t modType) +{ Int_t cType = CounterTypeInModule[modType]; Float_t dx = Module_Size_X[modType]; Float_t dy = Module_Size_Y[modType]; @@ -737,8 +686,7 @@ TGeoVolume* create_new_tof_module(Int_t modType) { Float_t width_aluy = Module_Thick_Alu_Y; Float_t width_aluz = Module_Thick_Alu_Z; - Float_t shift_gas_box = - (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; + Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; Float_t dxpos = CounterXDistance[modType]; Float_t startxpos = CounterXStartPosition[modType]; @@ -757,25 +705,19 @@ TGeoVolume* create_new_tof_module(Int_t modType) { module->SetLineColor(kGreen); // set line color for the alu box module->SetTransparency(20); // set transparency for the TOF - TGeoBBox* gas_box = new TGeoBBox("", - (dx - (width_aluxl + width_aluxr)) / 2., - (dy - 2 * width_aluy) / 2., - (dz - 2 * width_aluz) / 2.); - TGeoVolume* gas_box_vol = - new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); + TGeoBBox* gas_box = + new TGeoBBox("", (dx - (width_aluxl + width_aluxr)) / 2., (dy - 2 * width_aluy) / 2., (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); gas_box_vol->SetLineColor(kBlue); // set line color for the alu box gas_box_vol->SetTransparency(50); // set transparency for the TOF - TGeoTranslation* gas_box_trans = - new TGeoTranslation("", shift_gas_box, 0., 0.); + TGeoTranslation* gas_box_trans = new TGeoTranslation("", shift_gas_box, 0., 0.); module->AddNode(gas_box_vol, 0, gas_box_trans); - for (Int_t j = 0; j < NCounterInModule[modType]; - j++) { //loop over counters (modules) - //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) + for (Int_t j = 0; j < NCounterInModule[modType]; j++) { //loop over counters (modules) + //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) Float_t xpos, ypos, zpos; - if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { - zpos = dzoff *= -1; - } else { + if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { zpos = dzoff *= -1; } + else { zpos = CounterZStartPosition[modType] + j * dzoff; } //cout << "counter z position " << zpos << endl; @@ -786,8 +728,7 @@ TGeoVolume* create_new_tof_module(Int_t modType) { TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = - new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } @@ -795,7 +736,8 @@ TGeoVolume* create_new_tof_module(Int_t modType) { } -TGeoVolume* create_tof_pole() { +TGeoVolume* create_tof_pole() +{ // needed materials TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); @@ -807,10 +749,9 @@ TGeoVolume* create_tof_pole() { Float_t width_aluy = Pole_Thick_Y; Float_t width_aluz = Pole_Thick_Z; - TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); - TGeoBBox* pole_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); - TGeoVolume* pole_alu_vol = - new TGeoVolume("pole_alu", pole_alu_box, boxVolMed); + TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); + TGeoBBox* pole_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* pole_alu_vol = new TGeoVolume("pole_alu", pole_alu_box, boxVolMed); pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box pole_alu_vol->SetTransparency(20); // set transparency for the TOF TGeoTranslation* pole_alu_trans = new TGeoTranslation("", 0., 0., 0.); @@ -821,32 +762,28 @@ TGeoVolume* create_tof_pole() { Float_t air_dz = dz / 2. - width_aluz; // cout << "My pole." << endl; - if (air_dx <= 0.) - cout << "ERROR - No air volume in pole X, size: " << air_dx << endl; - if (air_dy <= 0.) - cout << "ERROR - No air volume in pole Y, size: " << air_dy << endl; - if (air_dz <= 0.) - cout << "ERROR - No air volume in pole Z, size: " << air_dz << endl; - - if ((air_dx > 0.) && (air_dy > 0.) - && (air_dz > 0.)) // crate air volume only, if larger than zero + if (air_dx <= 0.) cout << "ERROR - No air volume in pole X, size: " << air_dx << endl; + if (air_dy <= 0.) cout << "ERROR - No air volume in pole Y, size: " << air_dy << endl; + if (air_dz <= 0.) cout << "ERROR - No air volume in pole Z, size: " << air_dz << endl; + + if ((air_dx > 0.) && (air_dy > 0.) && (air_dz > 0.)) // crate air volume only, if larger than zero { TGeoBBox* pole_air_box = new TGeoBBox("", air_dx, air_dy, air_dz); // TGeoBBox* pole_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz); - TGeoVolume* pole_air_vol = - new TGeoVolume("pole_air", pole_air_box, airVolMed); + TGeoVolume* pole_air_vol = new TGeoVolume("pole_air", pole_air_box, airVolMed); pole_air_vol->SetLineColor(kYellow); // set line color for the alu box pole_air_vol->SetTransparency(70); // set transparency for the TOF TGeoTranslation* pole_air_trans = new TGeoTranslation("", 0., 0., 0.); pole_alu_vol->AddNode(pole_air_vol, 0, pole_air_trans); - } else - cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy - << " " << air_dz << endl; + } + else + cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy << " " << air_dz << endl; return pole; } -TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) { +TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) +{ // needed materials TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); @@ -863,8 +800,7 @@ TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) { TGeoTranslation* bar_alu_trans = new TGeoTranslation("", 0., 0., 0.); bar->AddNode(bar_alu_vol, 0, bar_alu_trans); - TGeoBBox* bar_air_box = new TGeoBBox( - "", dx / 2. - width_alux, dy / 2. - width_aluy, dz / 2. - width_aluz); + TGeoBBox* bar_air_box = new TGeoBBox("", dx / 2. - width_alux, dy / 2. - width_aluy, dz / 2. - width_aluz); TGeoVolume* bar_air_vol = new TGeoVolume("bar_air", bar_air_box, airVolMed); bar_air_vol->SetLineColor(kYellow); // set line color for the alu box bar_air_vol->SetTransparency(70); // set transparency for the TOF @@ -874,18 +810,19 @@ TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) { return bar; } -void position_tof_poles(Int_t modType) { +void position_tof_poles(Int_t modType) +{ TGeoTranslation* pole_trans = NULL; Int_t numPoles = 0; for (Int_t i = 0; i < NumberOfPoles; i++) { if (i < 2) { - pole_trans = - new TGeoTranslation("", -Pole_Offset + 2.0, 0., Pole_ZPos[i]); + pole_trans = new TGeoTranslation("", -Pole_Offset + 2.0, 0., Pole_ZPos[i]); gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); numPoles++; - } else { + } + else { Float_t xPos = Pole_Offset + Pole_Size_X / 2. + Pole_Col[i] * DxColl; Float_t zPos = Pole_ZPos[i]; pole_trans = new TGeoTranslation("", xPos, 0., zPos); @@ -900,7 +837,8 @@ void position_tof_poles(Int_t modType) { } } -void position_tof_bars(Int_t modType) { +void position_tof_bars(Int_t modType) +{ TGeoTranslation* bar_trans = NULL; @@ -950,7 +888,8 @@ void position_tof_bars(Int_t modType) { numBars++; } -void position_inner_tof_modules(Int_t modNType) { +void position_inner_tof_modules(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; @@ -975,29 +914,23 @@ void position_inner_tof_modules(Int_t modNType) { // for (Int_t j=1; j<modNType; j++){ Int_t modType; Int_t modNum; - for (Int_t j = 2; j < modNType; - j++) { // place only M4 type modules (modNType == 2) - //DEDE + for (Int_t j = 2; j < modNType; j++) { // place only M4 type modules (modNType == 2) + //DEDE modType = Inner_Module_Types[j]; modNum = 0; // for(Int_t i=0; i<Inner_Module_Number[j]; i++) { // for(Int_t i=0; i<1; i++) { // place 1x2 modules in the top and same in the bottom - for (Int_t i = 0; i < 2; - i++) { // place 2x2 modules in the top and same in the bottom + for (Int_t i = 0; i < 2; i++) { // place 2x2 modules in the top and same in the bottom ii++; - cout << "Inner ii " << ii << " Last " << Last_Size_Y << ", " - << Last_Over_Y << endl; - Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - - 2. * (Module_Over_Y[modType] + Last_Over_Y); + cout << "Inner ii " << ii << " Last " << Last_Size_Y << ", " << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - 2. * (Module_Over_Y[modType] + Last_Over_Y); // DeltaY = 1.5; cout << "DeltaY " << DeltaY << endl; yPos += DeltaY; Last_Size_Y = Module_Size_Y[modType]; Last_Over_Y = Module_Over_Y[modType]; - cout << "Position Inner Module " << i << " of " << Inner_Module_Number[j] - << " Type " << modType << " at Y = " << yPos - << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY - << endl; + cout << "Position Inner Module " << i << " of " << Inner_Module_Number[j] << " Type " << modType + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY << endl; /// module_trans = new TGeoTranslation("", xPos, yPos, zPos); /// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); @@ -1035,13 +968,11 @@ void position_inner_tof_modules(Int_t modNType) { TGeoCombiTrans* module_combi_trans = NULL; for (Int_t iMod = 0; iMod < NModules; iMod++) { - module_trans = new TGeoTranslation( - "", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]); - module_rot = new TGeoRotation(); + module_trans = new TGeoTranslation("", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]); + module_rot = new TGeoRotation(); module_rot->RotateZ(ModAng[iMod]); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; } @@ -1069,7 +1000,8 @@ void position_inner_tof_modules(Int_t modNType) { } -void position_Dia(Int_t modNType) { +void position_Dia(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(Dia_rotate_Z); @@ -1088,14 +1020,14 @@ void position_Dia(Int_t modNType) { ii++; module_trans = new TGeoTranslation("", xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; } } } -void position_Star2(Int_t modNType) { +void position_Star2(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(Star2_rotate_Z); @@ -1113,8 +1045,7 @@ void position_Star2(Int_t modNType) { ii++; module_trans = new TGeoTranslation("", xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; yPos += Star2_Delta_Y_Position; zPos += Star2_Delta_Z_Position; @@ -1122,7 +1053,8 @@ void position_Star2(Int_t modNType) { } } -void position_Buc(Int_t modNType) { +void position_Buc(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(Buc_rotate_Z); @@ -1140,8 +1072,7 @@ void position_Buc(Int_t modNType) { ii++; module_trans = new TGeoTranslation("", xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; yPos += Buc_Delta_Y_Position; zPos += Buc_Delta_Z_Position; @@ -1149,7 +1080,8 @@ void position_Buc(Int_t modNType) { } } -void position_cer_modules(Int_t modNType) { +void position_cer_modules(Int_t modNType) +{ Int_t ii = 0; Int_t modNum = 0; for (Int_t j = 1; j < modNType; j++) { @@ -1158,27 +1090,25 @@ void position_cer_modules(Int_t modNType) { Float_t yPos = Cer_Y_Position[j]; Float_t zPos = Cer_Z_Position[j]; TGeoTranslation* module_trans = NULL; - TGeoRotation* module_rot = - new TGeoRotation(Form("Cer%d", j), Cer_rotate_Z[j], -MeanTheta, 0.); + TGeoRotation* module_rot = new TGeoRotation(Form("Cer%d", j), Cer_rotate_Z[j], -MeanTheta, 0.); // module_rot->RotateZ(Cer_rotate_Z[j]); TGeoCombiTrans* module_combi_trans = NULL; for (Int_t i = 0; i < Cer_Number[j]; i++) { ii++; - cout << "Position Ceramic Module " << i << " of " << Cer_Number[j] - << " Type " << modType << " at X = " << xPos << ", Y = " << yPos - << ", Z = " << zPos << endl; + cout << "Position Ceramic Module " << i << " of " << Cer_Number[j] << " Type " << modType << " at X = " << xPos + << ", Y = " << yPos << ", Z = " << zPos << endl; // Front staggered module (Top if pair), top module_trans = new TGeoTranslation("", xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); // modNum++; } } } -void position_CERN(Int_t modNType) { +void position_CERN(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(CERN_rotate_Z); @@ -1197,14 +1127,14 @@ void position_CERN(Int_t modNType) { ii++; module_trans = new TGeoTranslation("", xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; } } } -void position_side_tof_modules(Int_t modNType) { +void position_side_tof_modules(Int_t modNType) +{ TGeoTranslation* module_trans = NULL; TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(180.); @@ -1218,67 +1148,51 @@ void position_side_tof_modules(Int_t modNType) { Int_t modNum = 0; for (Int_t i = 0; i < InnerSide_Module_Number[j]; i++) { ii++; - cout << "InnerSide ii " << ii << " Last " << Last_Size_Y << "," - << Last_Over_Y << endl; - Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - - 2. * (Module_Over_Y[modType] + Last_Over_Y); + cout << "InnerSide ii " << ii << " Last " << Last_Size_Y << "," << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - 2. * (Module_Over_Y[modType] + Last_Over_Y); if (ii > 1) { yPos += DeltaY; } Last_Size_Y = Module_Size_Y[modType]; Last_Over_Y = Module_Over_Y[modType]; Float_t xPos = InnerSide_Module_X_Offset; Float_t zPos = Wall_Z_Position; - cout << "Position InnerSide Module " << i << " of " - << InnerSide_Module_Number[j] << " Type " << modType - << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] - << " DeltaY = " << DeltaY << endl; + cout << "Position InnerSide Module " << i << " of " << InnerSide_Module_Number[j] << " Type " << modType + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY << endl; module_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; module_trans = new TGeoTranslation("", -xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; if (ii > 1) { module_trans = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; - module_trans = new TGeoTranslation( - "", xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_trans); + module_trans = new TGeoTranslation("", xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; - module_trans = new TGeoTranslation( - "", -xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + module_trans = new TGeoTranslation("", -xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; - module_trans = new TGeoTranslation( - "", xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_trans); + module_trans = new TGeoTranslation("", xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; - module_trans = new TGeoTranslation( - "", -xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + module_trans = new TGeoTranslation("", -xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum, module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); modNum++; } } @@ -1328,8 +1242,8 @@ void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) Pole_Col[NumberOfPoles] = j + 1; NumberOfPoles++; - Bar_Size_Z = Pole_ZPos[0] - zPos; - gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); + Bar_Size_Z = Pole_ZPos[0] - zPos; + gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); Bar_ZPos[NumberOfBars] = zPos + Bar_Size_Z / 2. - Pole_Size_Z / 2.; Bar_XPos[NumberOfBars] = xPos + Pole_Offset; NumberOfBars++; @@ -1339,69 +1253,52 @@ void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) Int_t modType = Outer_Module_Types[k][j]; Int_t numModules = Outer_Module_Number[k][j]; - cout << " Outer: position " << numModules << " of type " << modType - << " in col " << j << " at z = " << zPos << ", DzPos = " << DzPos - << endl; + cout << " Outer: position " << numModules << " of type " << modType << " in col " << j << " at z = " << zPos + << ", DzPos = " << DzPos << endl; for (Int_t i = 0; i < numModules; i++) { ii++; - cout << "Outer ii " << ii << " Last " << Last_Size_Y << "," - << Last_Over_Y << endl; - Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - - 2. * (Module_Over_Y[modType] + Last_Over_Y); + cout << "Outer ii " << ii << " Last " << Last_Size_Y << "," << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y - 2. * (Module_Over_Y[modType] + Last_Over_Y); if (ii > 1) { yPos += DeltaY; } Last_Size_Y = Module_Size_Y[modType]; Last_Over_Y = Module_Over_Y[modType]; - cout << "Position Outer Module " << i << " of " - << Outer_Module_Number[k][j] << " Type " << modType << "(#" + cout << "Position Outer Module " << i << " of " << Outer_Module_Number[k][j] << " Type " << modType << "(#" << modNum[modType] << ") " - << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] - << " DeltaY = " << DeltaY << endl; + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY << endl; module_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); modNum[modType]++; module_trans = new TGeoTranslation("", -xPos, yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); modNum[modType]++; if (ii > 1) { module_trans = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); modNum[modType]++; module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); modNum[modType]++; // second layer - module_trans = - new TGeoTranslation("", xPos, yPos - DeltaY / 2., zPos + DzPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_trans); + module_trans = new TGeoTranslation("", xPos, yPos - DeltaY / 2., zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); modNum[modType]++; - module_trans = - new TGeoTranslation("", -xPos, yPos - DeltaY / 2., zPos + DzPos); + module_trans = new TGeoTranslation("", -xPos, yPos - DeltaY / 2., zPos + DzPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); modNum[modType]++; - module_trans = - new TGeoTranslation("", xPos, -(yPos - DeltaY / 2.), zPos + DzPos); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_trans); + module_trans = new TGeoTranslation("", xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); modNum[modType]++; - module_trans = - new TGeoTranslation("", -xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + module_trans = new TGeoTranslation("", -xPos, -(yPos - DeltaY / 2.), zPos + DzPos); module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand) - ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); modNum[modType]++; } } @@ -1410,7 +1307,8 @@ void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) } -void dump_info_file() { +void dump_info_file() +{ TDatime datetime; // used to get timestamp printf("writing info file: %s\n", FileNameInfo.Data()); @@ -1435,8 +1333,7 @@ void dump_info_file() { if (TOF_Z_Front == 1020) fprintf(ifile, "SIS 300 muon\n"); fprintf(ifile, "\n"); - const Float_t TOF_Z_Back = - Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall + const Float_t TOF_Z_Back = Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall fprintf(ifile, "# envelope\n"); // Show extension of TRD @@ -1446,9 +1343,7 @@ void dump_info_file() { // Layer thickness fprintf(ifile, "# central tower position\n"); - fprintf(ifile, - "%7.2f cm center of staggered, front RPC cell at x=0\n", - Wall_Z_Position); + fprintf(ifile, "%7.2f cm center of staggered, front RPC cell at x=0\n", Wall_Z_Position); fprintf(ifile, "\n"); fclose(ifile); diff --git a/macro/mcbm/mcbm_hadron_analysis_nh.C b/macro/mcbm/mcbm_hadron_analysis_nh.C index d4a8f75612..34975d1a4c 100644 --- a/macro/mcbm/mcbm_hadron_analysis_nh.C +++ b/macro/mcbm/mcbm_hadron_analysis_nh.C @@ -1,16 +1,11 @@ -void mcbm_hadron_analysis( - Int_t nEvents = 10, - TString RunId = "test", - TString InDir = "./data/", - TString OutDir = "./data/", - TString setup = "mcbm_beam_2021_03", - bool timebased = kTRUE, - Double_t eventRate = 1.E7, - Double_t timeSliceLength = 1.e4, // Length of time-slice [ns] - Double_t Tint = 100., - Double_t ReqTofMul = 2, - Int_t parSet = 0 // cut parameter -) { +void mcbm_hadron_analysis_nh(Int_t nEvents = 10, TString RunId = "test", TString InDir = "./data/", + TString OutDir = "./data/", TString setup = "mcbm_beam_2021_03", bool timebased = kTRUE, + Double_t eventRate = 1.E7, + Double_t timeSliceLength = 1.e4, // Length of time-slice [ns] + Double_t Tint = 100., Double_t ReqTofMul = 2, + Int_t parSet = 0 // cut parameter +) +{ //TString TraDir ="../../../../../../uhlig/mcbm_proposal/data"; TString TraDir = InDir; TString InputFile = TraDir + "/" + RunId + ".tra.root"; @@ -19,14 +14,11 @@ void mcbm_hadron_analysis( TString ParFile = dataset + ".par.root"; TString DigiFile = dataset + ".event.raw.root"; TString RecoFile = dataset + ".rec.root"; - TString OutFile = OutDir + "/" + RunId + Form(".par%d", parSet) + ".ana.root"; + TString OutFile = OutDir + "/" + RunId + Form(".par%d", parSet) + ".ana.root"; if (timebased) { DigiFile = dataset + Form(".%2.1e", eventRate) + ".raw.root"; - RecoFile = - dataset + Form(".%2.1e.%d.%d", eventRate, (Int_t) Tint, (Int_t) ReqTofMul) - + ".rec.root"; - OutFile = OutDir + "/" + RunId - + Form(".%2.1e.%d.%d", eventRate, (Int_t) Tint, (Int_t) ReqTofMul) + RecoFile = dataset + Form(".%2.1e.%d.%d", eventRate, (Int_t) Tint, (Int_t) ReqTofMul) + ".rec.root"; + OutFile = OutDir + "/" + RunId + Form(".%2.1e.%d.%d", eventRate, (Int_t) Tint, (Int_t) ReqTofMul) + Form(".par%d", parSet) + ".ana.root"; } @@ -67,116 +59,76 @@ void mcbm_hadron_analysis( CbmHadronAnalysis* HadronAna = new CbmHadronAnalysis(); // in hadron HadronAna->SetBeamMomentum(2.73); // beam momentum - HadronAna->SetDY(0.5); // flow analysis exclusion window - HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction + HadronAna->SetDY(0.5); // flow analysis exclusion window + HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction switch (parSet) { - case 0: // with background - HadronAna->SetDistPrimLim( - 1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2( - 0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2( - 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim( - 0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin( - 5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax( - 25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD( - 10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin( - 0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 0: // with background + HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 1: // for signal with background Ni+Ni - HadronAna->SetDistPrimLim( - 1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2( - 0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2( - 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim( - 0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin( - 5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax( - 25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD( - 10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin( - 0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 1: // for signal with background Ni+Ni + HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 2: // for signal with background Au+Au - HadronAna->SetDistPrimLim( - 1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2( - 0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2( - 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim( - 0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin( - 8.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax( - 25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD( - 10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin( - 0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 2: // for signal with background Au+Au + HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin(8.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 3: // syst study around case 1 - HadronAna->SetDistPrimLim( - 0.8); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2( - 0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2( - 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim( - 0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin( - 5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax( - 25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD( - 10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin( - 0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 3: // syst study around case 1 + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 4: // syst study around case 1 - HadronAna->SetDistPrimLim( - 0.9); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2( - 0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2( - 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim( - 0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin( - 5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax( - 25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD( - 10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin( - 0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 4: // syst study around case 1 + HadronAna->SetDistPrimLim(0.9); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; } fRun->AddTask(HadronAna); @@ -198,9 +150,7 @@ void mcbm_hadron_analysis( std::cout << "Macro finished successfully." << std::endl; std::cout << "Output file is " << OutFile << std::endl; std::cout << "Parameter file is " << ParFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" - << std::endl - << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << std::endl << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ diff --git a/reco/detectors/tof/CbmTofCalibrator.cxx b/reco/detectors/tof/CbmTofCalibrator.cxx index 04322f07c4..64478fddd5 100644 --- a/reco/detectors/tof/CbmTofCalibrator.cxx +++ b/reco/detectors/tof/CbmTofCalibrator.cxx @@ -6,6 +6,7 @@ // CBMroot classes and includes #include "CbmTofCalibrator.h" + #include "CbmEvent.h" #include "CbmMatch.h" #include "CbmTofAddress.h" // in cbmdata/tof @@ -57,16 +58,18 @@ CbmTofCalibrator::CbmTofCalibrator() , fhCorTotOff() , fhCorSvel() , fhCorWalk() - , fDetIdIndexMap() {} + , fDetIdIndexMap() +{ +} CbmTofCalibrator::~CbmTofCalibrator() {} -InitStatus CbmTofCalibrator::Init() { +InitStatus CbmTofCalibrator::Init() +{ FairRootManager* fManager = FairRootManager::Instance(); // Get access to TofCalDigis - fTofCalDigiVec = - fManager->InitObjectAs<std::vector<CbmTofDigi> const*>("TofCalDigi"); + fTofCalDigiVec = fManager->InitObjectAs<std::vector<CbmTofDigi> const*>("TofCalDigi"); //dynamic_cast<std::vector<CbmTofDigi> const*>(fManager->GetObject("TofCalDigi")); if (NULL == fTofCalDigiVec) LOG(fatal) << "No access to TofCalDigis!"; @@ -78,27 +81,21 @@ InitStatus CbmTofCalibrator::Init() { } fDigiMan->Init(); - if (!fDigiMan->IsPresent(ECbmModuleId::kTof)) { - LOG(warn) << "CbmTofCalibrator: No digi input!"; - } + if (!fDigiMan->IsPresent(ECbmModuleId::kTof)) { LOG(warn) << "CbmTofCalibrator: No digi input!"; } // check for access to current calibration file fTofClusterizer = CbmTofEventClusterizer::Instance(); - if (NULL == fTofClusterizer) { - LOG(warn) << "CbmTofCalibrator: no access to active calibration"; - } else { + if (NULL == fTofClusterizer) { LOG(warn) << "CbmTofCalibrator: no access to active calibration"; } + else { TString CalParFileName = fTofClusterizer->GetCalParFileName(); LOG(info) << "Current calibration file: " << CalParFileName; } fTofFindTracks = CbmTofFindTracks::Instance(); - if (NULL == fTofFindTracks) { - LOG(warn) << "CbmTofCalibrator: no access to tof tracker "; - } + if (NULL == fTofFindTracks) { LOG(warn) << "CbmTofCalibrator: no access to tof tracker "; } // Get Access to MatchCollection fTofDigiMatchColl = (TClonesArray*) fManager->GetObject("TofCalDigiMatch"); - if (NULL == fTofDigiMatchColl) - fTofDigiMatchColl = (TClonesArray*) fManager->GetObject("TofDigiMatch"); + if (NULL == fTofDigiMatchColl) fTofDigiMatchColl = (TClonesArray*) fManager->GetObject("TofDigiMatch"); if (NULL == fTofDigiMatchColl) { LOG(error) << "CbmTofCalibrator: no access to DigiMatch "; @@ -119,7 +116,8 @@ InitStatus CbmTofCalibrator::Init() { return kSUCCESS; } -Bool_t CbmTofCalibrator::InitParameters() { +Bool_t CbmTofCalibrator::InitParameters() +{ LOG(info) << "InitParameters: get par pointers from RTDB"; // Get Base Container FairRun* ana = FairRun::Instance(); @@ -134,23 +132,15 @@ Bool_t CbmTofCalibrator::InitParameters() { return kTRUE; } -Bool_t CbmTofCalibrator::CreateCalHist() { +Bool_t CbmTofCalibrator::CreateCalHist() +{ // detector related distributions Int_t iNbDet = fDigiBdfPar->GetNbDet(); LOG(info) << "Define Calibrator histos for " << iNbDet << " detectors "; - fhCalR0 = new TH1D( - "hCalR0", "Tracklet distance to nominal vertex; R_0 [cm]", 100, 0., 0.5); - fhCalDX0 = new TH1D("hCalDX0", - "Tracklet distance to nominal vertex; #DeltaX_0 [cm]", - 100, - -0.5, - 0.5); - fhCalDY0 = new TH1D("hCalDY0", - "Tracklet distance to nominal vertex; #DeltaY_0 [cm]", - 100, - -0.5, - 0.5); + fhCalR0 = new TH1D("hCalR0", "Tracklet distance to nominal vertex; R_0 [cm]", 100, 0., 0.5); + fhCalDX0 = new TH1D("hCalDX0", "Tracklet distance to nominal vertex; #DeltaX_0 [cm]", 100, -0.5, 0.5); + fhCalDY0 = new TH1D("hCalDY0", "Tracklet distance to nominal vertex; #DeltaY_0 [cm]", 100, -0.5, 0.5); fhCalPosition.resize(iNbDet); fhCalPos.resize(iNbDet); @@ -164,77 +154,44 @@ Bool_t CbmTofCalibrator::CreateCalHist() { Int_t iUniqueId = fDigiBdfPar->GetDetUId(iDetIndx); fDetIdIndexMap[iUniqueId] = iDetIndx; - Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); - Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); - Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); + Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); + Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); + Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); CbmTofCell* fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) { LOG(warning) << "No DigiPar for Det " << Form("0x%08x", iUCellId); continue; } - Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * 0.8; - fhCalPosition[iDetIndx] = new TH2F( - Form("cal_SmT%01d_sm%03d_rpc%03d_Position", iSmType, iSmId, iRpcId), - Form( - "Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - -YDMAX, - YDMAX); + Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * 0.8; + fhCalPosition[iDetIndx] = + new TH2F(Form("cal_SmT%01d_sm%03d_rpc%03d_Position", iSmType, iSmId, iRpcId), + Form("Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, -YDMAX, YDMAX); YDMAX = 5; fhCalPos[iDetIndx] = new TH2F(Form("cal_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId), Form("Clu pos deviation of Rpc #%03d in Sm %03d of type %d; " "Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -YDMAX, - YDMAX); + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -YDMAX, YDMAX); Double_t TSumMax = 2.; //if(iSmType == 5) TSumMax *= 2.; // enlarge for diamond / beamcounter - fhCalTOff[iDetIndx] = - new TH2F(Form("cal_SmT%01d_sm%03d_rpc%03d_TOff", iSmType, iSmId, iRpcId), - Form("Clu T0 deviation of Rpc #%03d in Sm %03d of type %d; " - "Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -TSumMax, - TSumMax); + fhCalTOff[iDetIndx] = new TH2F(Form("cal_SmT%01d_sm%03d_rpc%03d_TOff", iSmType, iSmId, iRpcId), + Form("Clu T0 deviation of Rpc #%03d in Sm %03d of type %d; " + "Strip []; TOff [ns]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), + 99, -TSumMax, TSumMax); Double_t TotMax = 20.; //FIXME: has to be consistent with Clusterizer! fhCalTot[iDetIndx] = new TH2F( Form("cal_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId), - Form( - "Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [a.u.]", - iRpcId, - iSmId, - iSmType), - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - 0., - TotMax); + Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [a.u.]", iRpcId, iSmId, iSmType), + 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, 0., TotMax); TSumMax = 0.6; fhCalWalk[iDetIndx].resize(fDigiBdfPar->GetNbChan(iSmType, iRpcId)); @@ -242,25 +199,11 @@ Bool_t CbmTofCalibrator::CreateCalHist() { fhCalWalk[iDetIndx][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { fhCalWalk[iDetIndx][iCh][iSide] = - new TH2D(Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), + new TH2D(Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", iSmType, iSmId, iRpcId, iCh, iSide), Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk; Tot " "[a.u.]; #DeltaT [ns]", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), - nbClWalkBinX, - 0., - TotMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + iSmType, iSmId, iRpcId, iCh, iSide), + nbClWalkBinX, 0., TotMax, nbClWalkBinY, -TSumMax, TSumMax); } } } @@ -268,19 +211,14 @@ Bool_t CbmTofCalibrator::CreateCalHist() { return kTRUE; } -void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, - Int_t iOpt, - CbmEvent* tEvent) { +void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iOpt, CbmEvent* tEvent) +{ // fill deviation histograms on walk level if (pTrk->GetTt() < 0) return; // take tracks with positive velocity only - if (fbBeam - && !pTrk->ContainsAddr(CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, 5))) + if (fbBeam && !pTrk->ContainsAddr(CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, 5))) return; // request beam counter hit for calibration - if ( - fbBeam - && fdR0Lim - > 0.) // consider only tracks originating from nominal interaction point + if (fbBeam && fdR0Lim > 0.) // consider only tracks originating from nominal interaction point { fhCalR0->Fill(pTrk->GetR0()); if (pTrk->GetR0() > fdR0Lim) return; @@ -296,20 +234,17 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iRpc = CbmTofAddress::GetRpcId(iDetId); std::map<UInt_t, UInt_t>::iterator it = fDetIdIndexMap.find(iDetId); - if (it == fDetIdIndexMap.end()) - continue; // continue for invalid detector index - Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; + if (it == fDetIdIndexMap.end()) continue; // continue for invalid detector index + Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; Int_t iChId = pHit->GetAddress(); Int_t iCh = CbmTofAddress::GetChannelId(iChId); CbmTofCell* fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { - LOG(error) << "Invalid Channel Pointer for ChId " - << Form(" 0x%08x ", iChId) << ", Ch " << iCh; + LOG(error) << "Invalid Channel Pointer for ChId " << Form(" 0x%08x ", iChId) << ", Ch " << iCh; continue; } - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); Double_t hitpos[3]; hitpos[0] = pHit->GetX(); hitpos[1] = pHit->GetY(); @@ -323,13 +258,10 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Double_t hlocal_f[3]; gGeoManager->MasterToLocal(hitpos, hlocal_f); fhCalPosition[iDetIndx]->Fill((Double_t) iCh, - hlocal_p[1]); // transformed into LRF - fhCalPos[iDetIndx]->Fill( - (Double_t) iCh, hlocal_p[1] - hlocal_f[1]); // transformed into LRF - fhCalTOff[iDetIndx]->Fill( - (Double_t) iCh, - pHit->GetTime() - - pTrk->GetFitT(pHit->GetZ())); // residuals transformed into LRF + hlocal_p[1]); // transformed into LRF + fhCalPos[iDetIndx]->Fill((Double_t) iCh, hlocal_p[1] - hlocal_f[1]); // transformed into LRF + fhCalTOff[iDetIndx]->Fill((Double_t) iCh, + pHit->GetTime() - pTrk->GetFitT(pHit->GetZ())); // residuals transformed into LRF //fhCalTOff[iDetIndx]->Fill((Double_t)iCh,fTrackletTools->GetTdif(pTrk, iDetId, pHit)); Int_t iEA = pTrk->GetTofHitIndex(iHit); @@ -342,8 +274,7 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iTSA); Double_t hlocal_d[3]; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis CbmLink L0 = digiMatch->GetLink(iLink); Int_t iDigInd0 = L0.GetIndex(); Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); @@ -351,13 +282,14 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, const CbmTofDigi* tDigi0 = NULL; const CbmTofDigi* tDigi1 = NULL; if (tEvent != NULL) { //disable - LOG(debug) << "Locate MatchDigiInd " << iDigInd0 << " and " << iDigInd1 - << " in CalDigiVec of size " << fTofCalDigiVec->size(); + LOG(debug) << "Locate MatchDigiInd " << iDigInd0 << " and " << iDigInd1 << " in CalDigiVec of size " + << fTofCalDigiVec->size(); // <<" in current event not implemented"; //continue; tDigi0 = &(fTofCalDigiVec->at(iDigInd0)); tDigi1 = &(fTofCalDigiVec->at(iDigInd1)); - } else { // event wise entries + } + else { // event wise entries tDigi0 = fDigiMan->Get<CbmTofDigi>(iDigInd0); tDigi1 = fDigiMan->Get<CbmTofDigi>(iDigInd1); } @@ -366,24 +298,11 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iSide0 = tDigi0->GetSide(); LOG(debug) << "Fill Walk for Hit Ind " << iEA << ", " << iTSA - << Form(", TSRC %d%d%d%2d, DigiInd %2d, %2d", - iSmType, - iSm, - iRpc, - iCh, - iDigInd0, - iDigInd1) - << Form(", TSRCS %d%d%d%2d%d %d%d%d%2d%d", - (Int_t) tDigi0->GetType(), - (Int_t) tDigi0->GetSm(), - (Int_t) tDigi0->GetRpc(), - (Int_t) tDigi0->GetChannel(), - (Int_t) tDigi0->GetSide(), - (Int_t) tDigi1->GetType(), - (Int_t) tDigi1->GetSm(), - (Int_t) tDigi1->GetRpc(), - (Int_t) tDigi1->GetChannel(), - (Int_t) tDigi1->GetSide()); + << Form(", TSRC %d%d%d%2d, DigiInd %2d, %2d", iSmType, iSm, iRpc, iCh, iDigInd0, iDigInd1) + << Form(", TSRCS %d%d%d%2d%d %d%d%d%2d%d", (Int_t) tDigi0->GetType(), (Int_t) tDigi0->GetSm(), + (Int_t) tDigi0->GetRpc(), (Int_t) tDigi0->GetChannel(), (Int_t) tDigi0->GetSide(), + (Int_t) tDigi1->GetType(), (Int_t) tDigi1->GetSm(), (Int_t) tDigi1->GetRpc(), + (Int_t) tDigi1->GetChannel(), (Int_t) tDigi1->GetSide()); if (iDetIndx > (Int_t) fhCalWalk.size()) { LOG(error) << "Invalid DetIndx " << iDetIndx; @@ -411,32 +330,25 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, if (iCh0 != iCh1 || iSide0 == iSide1) { LOG(error) << "Invalid digi pair for TSR " << iSmType << iSm << iRpc - << Form( - " Ch %2d %2d side %d %d", iCh0, iCh1, iSide0, iSide1); + << Form(" Ch %2d %2d side %d %d", iCh0, iCh1, iSide0, iSide1); continue; } - hlocal_d[1] = -0.5 - * ((1. - 2. * tDigi0->GetSide()) * tDigi0->GetTime() - + (1. - 2. * tDigi1->GetSide()) * tDigi1->GetTime()) - * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + hlocal_d[1] = + -0.5 * ((1. - 2. * tDigi0->GetSide()) * tDigi0->GetTime() + (1. - 2. * tDigi1->GetSide()) * tDigi1->GetTime()) + * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (TMath::Abs(hlocal_d[1] - hlocal_p[1]) > 10.) { - LOG(warn) << "CMPY for TSRC " << iSmType << iSm << iRpc << iCh0 << ": " - << hlocal_f[1] << ", " << hlocal_p[1] << ", " << hlocal_d[1] - << ", TOT: " << tDigi0->GetTot() << " " << tDigi1->GetTot(); + LOG(warn) << "CMPY for TSRC " << iSmType << iSm << iRpc << iCh0 << ": " << hlocal_f[1] << ", " << hlocal_p[1] + << ", " << hlocal_d[1] << ", TOT: " << tDigi0->GetTot() << " " << tDigi1->GetTot(); } Int_t iWalkMode = (iOpt - iOpt % 10) / 10; switch (iWalkMode) { case 1: fhCalWalk[iDetIndx][iCh0][iSide0]->Fill( tDigi0->GetTot(), - tDigi0->GetTime() - + (1. - 2. * tDigi0->GetSide()) * hlocal_d[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - - pTrk->GetFitT( - pHit - ->GetZ()) //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit) + tDigi0->GetTime() + (1. - 2. * tDigi0->GetSide()) * hlocal_d[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) + - pTrk->GetFitT(pHit->GetZ()) //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit) + fTofFindTracks->GetTOff(iDetId) + 2. * (1. - 2. * tDigi0->GetSide()) * (hlocal_d[1] - hlocal_f[1]) / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)); @@ -452,20 +364,15 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, fhCalWalk[iDetIndx][iCh1][iSide1]->Fill( tDigi1->GetTot(), - tDigi1->GetTime() - + (1. - 2. * tDigi1->GetSide()) * hlocal_d[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - - pTrk->GetFitT( - pHit - ->GetZ()) //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit) + tDigi1->GetTime() + (1. - 2. * tDigi1->GetSide()) * hlocal_d[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) + - pTrk->GetFitT(pHit->GetZ()) //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit) + fTofFindTracks->GetTOff(iDetId) + 2. * (1. - 2. * tDigi1->GetSide()) * (hlocal_d[1] - hlocal_f[1]) / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)); break; case 0: { - Double_t dDeltaT = 0.5 * (tDigi0->GetTime() + tDigi1->GetTime()) - + fTofFindTracks->GetTOff(iDetId) + Double_t dDeltaT = 0.5 * (tDigi0->GetTime() + tDigi1->GetTime()) + fTofFindTracks->GetTOff(iDetId) - pTrk->GetFitT(pHit->GetZ()); fhCalWalk[iDetIndx][iCh0][iSide0]->Fill(tDigi0->GetTot(), dDeltaT); fhCalWalk[iDetIndx][iCh1][iSide1]->Fill(tDigi1->GetTot(), dDeltaT); @@ -475,17 +382,14 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, } } -Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { +Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) +{ // get current calibration histos LOG(info) << "CbmTofCalibrator:: update histos from " - << "file " - << CbmTofEventClusterizer::Instance()->GetCalParFileName() - << " with option " << iOpt; - TFile* fCalParFile = - new TFile(CbmTofEventClusterizer::Instance()->GetCalParFileName(), ""); + << "file " << CbmTofEventClusterizer::Instance()->GetCalParFileName() << " with option " << iOpt; + TFile* fCalParFile = new TFile(CbmTofEventClusterizer::Instance()->GetCalParFileName(), ""); if (NULL == fCalParFile) { - LOG(warn) - << "Could not open TofClusterizer calibration file, abort Update "; + LOG(warn) << "Could not open TofClusterizer calibration file, abort Update "; return kFALSE; } assert(fCalParFile); @@ -501,13 +405,12 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { if (5 == iSmType) { TH1* hBy = (TH1*) fhCalTOff[iDetIndx]->ProjectionY(); // Fit gaussian around peak value - Double_t dFMean = hBy->GetBinCenter(hBy->GetMaximumBin()); - 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); - dBeamTOff = fRes->Parameter(1); //overwrite mean + Double_t dFMean = hBy->GetBinCenter(hBy->GetMaximumBin()); + 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); + dBeamTOff = fRes->Parameter(1); //overwrite mean LOG(info) << "Found beam counter with average TOff = " << dBeamTOff; } } @@ -519,8 +422,7 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { Int_t iSm = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpc = CbmTofAddress::GetRpcId(iUniqueId); if (NULL == fhCorTOff[iDetIndx]) { - LOG(warn) << "hCorTOff for TSR " << iSmType << iSm << iRpc - << " not available"; + LOG(warn) << "hCorTOff for TSR " << iSmType << iSm << iRpc << " not available"; continue; } @@ -545,44 +447,34 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { Double_t dCorP = fhCorPos[iDetIndx]->GetBinContent(iBin + 1); if (dCts > MINCTS) { // Fit Gaussian around peak - TH1* hpPy = (TH1*) fhCalPos[iDetIndx]->ProjectionY( - Form("PosPy_%d_%d", iDetIndx, iBin), iBin + 1, iBin + 1); - Double_t dFMean = hpPy->GetBinCenter(hpPy->GetMaximumBin()); - Double_t dFLim = 0.5; // CAUTION, fixed numeric value - Double_t dBinSize = hpPy->GetBinWidth(1); - dFLim = TMath::Max(dFLim, 5. * dBinSize); - TFitResultPtr fRes = - hpPy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); - dDp = fRes->Parameter(1); //overwrite mean - - TH1* hpTy = (TH1*) fhCalTOff[iDetIndx]->ProjectionY( - Form("TOffPy_%d_%d", iDetIndx, iBin), iBin + 1, iBin + 1); + TH1* hpPy = (TH1*) fhCalPos[iDetIndx]->ProjectionY(Form("PosPy_%d_%d", iDetIndx, iBin), iBin + 1, iBin + 1); + Double_t dFMean = hpPy->GetBinCenter(hpPy->GetMaximumBin()); + Double_t dFLim = 0.5; // CAUTION, fixed numeric value + Double_t dBinSize = hpPy->GetBinWidth(1); + dFLim = TMath::Max(dFLim, 5. * dBinSize); + TFitResultPtr fRes = hpPy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); + dDp = fRes->Parameter(1); //overwrite mean + + TH1* hpTy = + (TH1*) fhCalTOff[iDetIndx]->ProjectionY(Form("TOffPy_%d_%d", iDetIndx, iBin), iBin + 1, iBin + 1); dFMean = hpTy->GetBinCenter(hpTy->GetMaximumBin()); dFLim = 0.5; // CAUTION, fixed numeric value dBinSize = hpTy->GetBinWidth(1); dFLim = TMath::Max(dFLim, 5. * dBinSize); - fRes = hpTy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); - dDt = fRes->Parameter(1); //overwrite mean + fRes = hpTy->Fit("gaus", "SQM", "", dFMean - dFLim, dFMean + dFLim); + dDt = fRes->Parameter(1); //overwrite mean // Double_t dDpRes = fRes->Parameter(2); if (iSmType == 5) // do not shift beam counter in time - fhCorTOff[iDetIndx]->SetBinContent(iBin + 1, - dCorT + dDt - dBeamTOff); + fhCorTOff[iDetIndx]->SetBinContent(iBin + 1, dCorT + dDt - dBeamTOff); else - fhCorTOff[iDetIndx]->SetBinContent(iBin + 1, - dCorT + dDt + dBeamTOff); + fhCorTOff[iDetIndx]->SetBinContent(iBin + 1, dCorT + dDt + dBeamTOff); if (0) fhCorPos[iDetIndx]->SetBinContent(iBin + 1, dCorP + dDp); if (iDetIndx > -1) { - LOG(info) << Form( - "Update %s: bin %02d, Cts: %d, Old %6.3f, dev %6.3f, beam %6.3f, new %6.3f", - fhCorTOff[iDetIndx]->GetName(), - iBin, - (Int_t) dCts, - dCorT, - dDt, - dBeamTOff, - dCorT + dDt + dBeamTOff ); + LOG(info) << Form("Update %s: bin %02d, Cts: %d, Old %6.3f, dev %6.3f, beam %6.3f, new %6.3f", + fhCorTOff[iDetIndx]->GetName(), iBin, (Int_t) dCts, dCorT, dDt, dBeamTOff, + dCorT + dDt + dBeamTOff); } } } @@ -594,35 +486,25 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { for (Int_t iCh = 0; iCh < iNbCh; iCh++) { for (Int_t iSide = 0; iSide < 2; iSide++) { //LOG(info) << "Get walk histo pointer for TSRCS " << iSmType<<iSm<<iRpc<<iCh<<iSide; - TProfile* hpW = - fhCalWalk[iDetIndx][iCh][iSide]->ProfileX(); // mean deviation - TH1* hCW = fhCalWalk[iDetIndx][iCh][iSide] - ->ProjectionX(); // contributing counts + TProfile* hpW = fhCalWalk[iDetIndx][iCh][iSide]->ProfileX(); // mean deviation + TH1* hCW = fhCalWalk[iDetIndx][iCh][iSide]->ProjectionX(); // contributing counts Double_t dCorT = 0; - for (Int_t iBin = 0; - iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); - iBin++) { + for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { Double_t dCts = hCW->GetBinContent(iBin + 1); - Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent( - iBin + 1); // current value + Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); // current value if (iBin > 0 && dCts == 0) - fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( - iBin + 1, - fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin)); + fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent(iBin + 1, + fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin)); if (dCts > MinCounts) { dCorT = hpW->GetBinContent(iBin + 1); } - fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( - iBin + 1, dWOff + dCorT); //set new value + fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent(iBin + 1, dWOff + dCorT); //set new value } // determine effective/count rate weighted mean Double_t dMean = 0; Double_t dCtsAll = 0.; - for (Int_t iBin = 0; - iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); - iBin++) { - Double_t dCts = hCW->GetBinContent(iBin + 1); - Double_t dWOff = - fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); + for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { + Double_t dCts = hCW->GetBinContent(iBin + 1); + Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); if (dCts > MinCounts) { dCtsAll += dCts; dMean += dCts * dWOff; @@ -634,20 +516,13 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { <<": "<<dMean; */ // keep mean value at 0 - for (Int_t iBin = 0; - iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); - iBin++) { - Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent( - iBin + 1); // current value - fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( - iBin + 1, dWOff - dMean); //set new value - if (iCh == 5 && iBin == 10) // debugging - LOG(info) << "New Walk for " - << fhCorWalk[iDetIndx][iCh][iSide]->GetName() - << " bin " << iBin << ": " - << fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin - + 1) - << ", Mean " << dMean << ", WOff " << dWOff; + for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { + Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); // current value + fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent(iBin + 1, dWOff - dMean); //set new value + if (iCh == 5 && iBin == 10) // debugging + LOG(info) << "New Walk for " << fhCorWalk[iDetIndx][iCh][iSide]->GetName() << " bin " << iBin << ": " + << fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1) << ", Mean " << dMean << ", WOff " + << dWOff; } } } @@ -657,15 +532,15 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { TString fFile = fCalParFile->GetName(); if (!fFile.Contains("/")) { - TFile* fCalParFileNew = - new TFile(Form("New_%s", fCalParFile->GetName()), "RECREATE"); + TFile* fCalParFileNew = new TFile(Form("New_%s", fCalParFile->GetName()), "RECREATE"); WriteHist(fCalParFileNew); fCalParFileNew->Close(); } return kTRUE; } -void CbmTofCalibrator::ReadHist(TFile* fHist) { +void CbmTofCalibrator::ReadHist(TFile* fHist) +{ LOG(info) << "Read Cor histos from file " << fHist->GetName(); if (0 == fhCorPos.size()) { Int_t iNbDet = fDigiBdfPar->GetNbDet(); @@ -686,18 +561,18 @@ void CbmTofCalibrator::ReadHist(TFile* fHist) { Int_t iRpc = CbmTofAddress::GetRpcId(iUniqueId); //LOG(info) << "Get histo pointer for TSR " << iSmType<<iSm<<iRpc; - fhCorPos[iDetIndx] = (TH1*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); + fhCorPos[iDetIndx] = + (TH1*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); if (NULL == fhCorPos[iDetIndx]) { LOG(error) << "hCorPos not found for TSR " << iSmType << iSm << iRpc; continue; } - fhCorTOff[iDetIndx] = (TH1*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); - fhCorTot[iDetIndx] = (TH1*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); - fhCorTotOff[iDetIndx] = (TH1*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); + fhCorTOff[iDetIndx] = + (TH1*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); + fhCorTot[iDetIndx] = + (TH1*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); + fhCorTotOff[iDetIndx] = + (TH1*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); fhCorWalk[iDetIndx].resize(iNbCh); @@ -706,21 +581,16 @@ void CbmTofCalibrator::ReadHist(TFile* fHist) { for (Int_t iSide = 0; iSide < 2; iSide++) { //LOG(info) << "Get walk histo pointer for TSRCS " << iSmType<<iSm<<iRpc<<iCh<<iSide; fhCorWalk[iDetIndx][iCh][iSide] = (TH1*) gDirectory->FindObjectAny( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_Walk_px", - iSmType, - iSm, - iRpc, - iCh, - iSide)); + Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_Walk_px", iSmType, iSm, iRpc, iCh, iSide)); if (NULL == fhCorWalk[iDetIndx][iCh][iSide]) - LOG(warn) << "No Walk histo for TSRCS " << iSmType << iSm << iRpc - << iCh << iSide; + LOG(warn) << "No Walk histo for TSRCS " << iSmType << iSm << iRpc << iCh << iSide; } } } } -void CbmTofCalibrator::WriteHist(TFile* fHist) { +void CbmTofCalibrator::WriteHist(TFile* fHist) +{ LOG(info) << "Write Cor histos to file " << fHist->GetName(); TDirectory* oldir = gDirectory; fHist->cd(); diff --git a/reco/detectors/tof/CbmTofEventClusterizer.cxx b/reco/detectors/tof/CbmTofEventClusterizer.cxx index 87198b8991..b9f75aa3f8 100644 --- a/reco/detectors/tof/CbmTofEventClusterizer.cxx +++ b/reco/detectors/tof/CbmTofEventClusterizer.cxx @@ -87,8 +87,8 @@ static TRandom3* fRndm = new TRandom3(); CbmTofEventClusterizer* CbmTofEventClusterizer::fInstance = 0; /************************************************************************************/ -CbmTofEventClusterizer::CbmTofEventClusterizer() - : CbmTofEventClusterizer("TestbeamClusterizer", 0, 0) { +CbmTofEventClusterizer::CbmTofEventClusterizer() : CbmTofEventClusterizer("TestbeamClusterizer", 0, 0) +{ // if ( !fInstance ) fInstance = this; } @@ -274,7 +274,8 @@ CbmTofEventClusterizer::CbmTofEventClusterizer(const char* name, Int_t verbose, if (!fInstance) fInstance = this; } -CbmTofEventClusterizer::~CbmTofEventClusterizer() { +CbmTofEventClusterizer::~CbmTofEventClusterizer() +{ if (fGeoHandler) delete fGeoHandler; if (fInstance == this) fInstance = 0; // DeleteHistos(); // <-- if needed ? @@ -282,9 +283,9 @@ CbmTofEventClusterizer::~CbmTofEventClusterizer() { /************************************************************************************/ // FairTasks inherited functions -InitStatus CbmTofEventClusterizer::Init() { - LOG(info) - << "CbmTofEventClusterizer initializing... expect Digis in ns units! "; +InitStatus CbmTofEventClusterizer::Init() +{ + LOG(info) << "CbmTofEventClusterizer initializing... expect Digis in ns units! "; if (kFALSE == RegisterInputs()) return kFATAL; @@ -301,20 +302,15 @@ InitStatus CbmTofEventClusterizer::Init() { case 0: fDutAddr = CbmTofAddress::GetUniqueAddress(fDutSm, fDutRpc, 0, 0, fDutId); fSelAddr = CbmTofAddress::GetUniqueAddress(fSelSm, fSelRpc, 0, 0, fSelId); - if (fSel2Id > -1) - fSel2Addr = - CbmTofAddress::GetUniqueAddress(fSel2Sm, fSel2Rpc, 0, 0, fSel2Id); - fiBeamRefAddr = CbmTofAddress::GetUniqueAddress( - fiBeamRefSm, fiBeamRefDet, 0, 0, fiBeamRefType); + if (fSel2Id > -1) fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, fSel2Rpc, 0, 0, fSel2Id); + fiBeamRefAddr = CbmTofAddress::GetUniqueAddress(fiBeamRefSm, fiBeamRefDet, 0, 0, fiBeamRefType); break; case 1: SelMask = ModMask; fDutAddr = CbmTofAddress::GetUniqueAddress(fDutSm, 0, 0, 0, fDutId); fSelAddr = CbmTofAddress::GetUniqueAddress(fSelSm, 0, 0, 0, fSelId); - if (fSel2Id > -1) - fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, 0, 0, 0, fSel2Id); - fiBeamRefAddr = - CbmTofAddress::GetUniqueAddress(fiBeamRefSm, 0, 0, 0, fiBeamRefType); + if (fSel2Id > -1) fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, 0, 0, 0, fSel2Id); + fiBeamRefAddr = CbmTofAddress::GetUniqueAddress(fiBeamRefSm, 0, 0, 0, fiBeamRefType); break; } iIndexDut = fDigiBdfPar->GetDetInd(fDutAddr); @@ -322,7 +318,8 @@ InitStatus CbmTofEventClusterizer::Init() { return kSUCCESS; } -void CbmTofEventClusterizer::SetParContainers() { +void CbmTofEventClusterizer::SetParContainers() +{ LOG(info) << "=> Get the digi parameters for tof"; //LOG(warning)<<"Return without action"; //return; @@ -336,14 +333,14 @@ void CbmTofEventClusterizer::SetParContainers() { fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar")); } -void CbmTofEventClusterizer::Exec(Option_t* option) { +void CbmTofEventClusterizer::Exec(Option_t* option) +{ if (nullptr != fTofDigiPointMatchesOut) fTofDigiPointMatchesOut->clear(); if (fTofCalDigiVecOut) fTofCalDigiVecOut->clear(); if (fEventsColl) { - LOG(info) << "CbmTofEventClusterizer::Exec => New timeslice " << iNbTs - << " with " << fEventsColl->GetEntriesFast() << " events, " - << fDigiMan->GetNofDigis(ECbmModuleId::kTof) << " TOF digis + " + LOG(info) << "CbmTofEventClusterizer::Exec => New timeslice " << iNbTs << " with " << fEventsColl->GetEntriesFast() + << " events, " << fDigiMan->GetNofDigis(ECbmModuleId::kTof) << " TOF digis + " << fDigiMan->GetNofDigis(ECbmModuleId::kT0) << " T0 digis "; iNbTs++; @@ -357,24 +354,18 @@ void CbmTofEventClusterizer::Exec(Option_t* option) { fTofDigiVec.clear(); //if (fTofDigisColl) fTofDigisColl->Clear("C"); //Int_t iNbDigis=0; (VF) not used - LOG(debug) << "TS event " << iEvent << " with " - << tEvent->GetNofData(ECbmDataType::kT0Digi) << " T0 and " + LOG(debug) << "TS event " << iEvent << " with " << tEvent->GetNofData(ECbmDataType::kT0Digi) << " T0 and " << tEvent->GetNofData(ECbmDataType::kTofDigi) << " Tof digis "; - for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kT0Digi); - iDigi++) { - Int_t iDigiIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kT0Digi, iDigi)); + for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kT0Digi); iDigi++) { + Int_t iDigiIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kT0Digi, iDigi)); const CbmTofDigi tDigi = fT0DigiVec->at(iDigiIndex); if (tDigi.GetType() != 5) - LOG(fatal) << "Wrong T0 type " << tDigi.GetType() << ", Addr 0x" - << std::hex << tDigi.GetAddress(); + LOG(fatal) << "Wrong T0 type " << tDigi.GetType() << ", Addr 0x" << std::hex << tDigi.GetAddress(); fTofDigiVec.push_back(CbmTofDigi(tDigi)); } - for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofDigi); - iDigi++) { - Int_t iDigiIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofDigi, iDigi)); + for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofDigi); iDigi++) { + Int_t iDigiIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofDigi, iDigi)); const CbmTofDigi* tDigi = fDigiMan->Get<CbmTofDigi>(iDigiIndex); fTofDigiVec.push_back(CbmTofDigi(*tDigi)); //new((*fTofDigisColl)[iNbDigis++]) CbmTofDigi(*tDigi); @@ -403,9 +394,7 @@ void CbmTofEventClusterizer::Exec(Option_t* option) { CbmMatch* pDigiMatch = (CbmMatch*) fTofDigiMatchColl->At(index); TString cstr = Form("Modify for hit %d, (%d", index, iNbHits); - cstr += Form(") %d links by iDigi0 %d: ", - (Int_t) pDigiMatch->GetNofLinks(), - iDigi0); + cstr += Form(") %d links by iDigi0 %d: ", (Int_t) pDigiMatch->GetNofLinks(), iDigi0); // update content of match object to TS array CbmMatch* mDigiMatch = new CbmMatch(); @@ -430,7 +419,8 @@ void CbmTofEventClusterizer::Exec(Option_t* option) { fTofHitsColl->Clear("C"); fTofDigiMatchColl->Delete(); //Clear("C"); } - } else { + } + else { // fTofDigisColl=fTofRawDigisColl; // (VF) This does not work here. The digi manager does not foresee to add // new data to the input array. So, I here copy the input digis into @@ -440,8 +430,7 @@ void CbmTofEventClusterizer::Exec(Option_t* option) { fTofDigiVec.clear(); //if (fTofDigisColl) fTofDigisColl->Clear("C"); // Int_t iNbDigis=0; (VF) not used - for (Int_t iDigi = 0; iDigi < fDigiMan->GetNofDigis(ECbmModuleId::kTof); - iDigi++) { + for (Int_t iDigi = 0; iDigi < fDigiMan->GetNofDigis(ECbmModuleId::kTof); iDigi++) { const CbmTofDigi* tDigi = fDigiMan->Get<CbmTofDigi>(iDigi); fTofDigiVec.push_back(CbmTofDigi(*tDigi)); //new((*fTofDigisColl)[iNbDigis++]) CbmTofDigi(*tDigi); @@ -450,7 +439,8 @@ void CbmTofEventClusterizer::Exec(Option_t* option) { } } -void CbmTofEventClusterizer::ExecEvent(Option_t* /*option*/) { +void CbmTofEventClusterizer::ExecEvent(Option_t* /*option*/) +{ // Clear output arrays //fTofCalDigisColl->Delete(); //otherwise memoryleak if 'CbmDigi::fMatch' points to valid MC match objects (simulation)! FIXME fTofCalDigiVec->clear(); @@ -459,13 +449,8 @@ void CbmTofEventClusterizer::ExecEvent(Option_t* /*option*/) { //for (Int_t i=0; i<fTofDigiMatchColl->GetEntries(); i++) ((CbmMatch *)(fTofDigiMatchColl->At(i)))->ClearLinks(); // FIXME, try to tamper memory leak (did not help) //fTofDigiMatchColl->Clear("C+L"); // leads to memory leak fTofDigiMatchColl->Delete(); - FairRootFileSink* bla = - (FairRootFileSink*) FairRootManager::Instance()->GetSink(); - if (bla) - fiOutputTreeEntry = - ((FairRootFileSink*) FairRootManager::Instance()->GetSink()) - ->GetOutTree() - ->GetEntries(); + FairRootFileSink* bla = (FairRootFileSink*) FairRootManager::Instance()->GetSink(); + if (bla) fiOutputTreeEntry = ((FairRootFileSink*) FairRootManager::Instance()->GetSink())->GetOutTree()->GetEntries(); fiNbHits = 0; @@ -484,7 +469,8 @@ void CbmTofEventClusterizer::ExecEvent(Option_t* /*option*/) { } /************************************************************************************/ -void CbmTofEventClusterizer::Finish() { +void CbmTofEventClusterizer::Finish() +{ if (fdEvent < 100) return; // don't save histos with insufficient statistics WriteHistos(); // Prevent them from being sucked in by the CbmHadronAnalysis WriteHistograms method @@ -493,7 +479,8 @@ void CbmTofEventClusterizer::Finish() { delete fDigiPar; } -void CbmTofEventClusterizer::Finish(Double_t calMode) { +void CbmTofEventClusterizer::Finish(Double_t calMode) +{ if (fdEvent < 100) return; // don't save histos with insufficient statistics SetCalMode(calMode); Finish(); @@ -501,7 +488,8 @@ void CbmTofEventClusterizer::Finish(Double_t calMode) { /************************************************************************************/ // Functions common for all clusters approximations -Bool_t CbmTofEventClusterizer::RegisterInputs() { +Bool_t CbmTofEventClusterizer::RegisterInputs() +{ FairRootManager* fManager = FairRootManager::Instance(); if (NULL == fManager) { @@ -516,11 +504,9 @@ Bool_t CbmTofEventClusterizer::RegisterInputs() { LOG(info) << "Found tof digi to point matches in the input file"; fEventsColl = dynamic_cast<TClonesArray*>(fManager->GetObject("Event")); - if (NULL == fEventsColl) - fEventsColl = dynamic_cast<TClonesArray*>(fManager->GetObject("CbmEvent")); + if (NULL == fEventsColl) fEventsColl = dynamic_cast<TClonesArray*>(fManager->GetObject("CbmEvent")); - if (NULL == fEventsColl) - LOG(info) << "CbmEvent not found in input file, assume eventwise input"; + if (NULL == fEventsColl) LOG(info) << "CbmEvent not found in input file, assume eventwise input"; fDigiMan = CbmDigiManager::Instance(); fDigiMan->Init(); @@ -528,11 +514,9 @@ Bool_t CbmTofEventClusterizer::RegisterInputs() { LOG(error) << GetName() << ": No Tof digi input!"; return kFALSE; } - if (fDigiMan->IsPresent(ECbmModuleId::kT0)) { - LOG(info) << GetName() << ": separate T0 digi input!"; - } else { - fT0DigiVec = - fManager->InitObjectAs<std::vector<CbmTofDigi> const*>("T0Digi"); + if (fDigiMan->IsPresent(ECbmModuleId::kT0)) { LOG(info) << GetName() << ": separate T0 digi input!"; } + else { + fT0DigiVec = fManager->InitObjectAs<std::vector<CbmTofDigi> const*>("T0Digi"); if (!fT0DigiVec) { LOG(info) << "No T0 digi input vector found."; } } // if( ! fT0DigiVec ) @@ -544,7 +528,8 @@ Bool_t CbmTofEventClusterizer::RegisterInputs() { if (NULL == fEventsColl) { //fTofDigisColl = new TClonesArray("CbmTofDigi"); - } else { + } + else { // time based input LOG(info) << "CbmEvent found in input file, assume time based input"; //fTofDigisColl = new TClonesArray("CbmTofDigi"); @@ -552,7 +537,8 @@ Bool_t CbmTofEventClusterizer::RegisterInputs() { return kTRUE; } -Bool_t CbmTofEventClusterizer::RegisterOutputs() { +Bool_t CbmTofEventClusterizer::RegisterOutputs() +{ FairRootManager* rootMgr = FairRootManager::Instance(); // FairRunAna* ana = FairRunAna::Instance(); (VF) not used @@ -571,7 +557,8 @@ Bool_t CbmTofEventClusterizer::RegisterOutputs() { if (fbAlternativeBranchNames) { tHitBranchName = "ATofHit"; tHitDigiMatchBranchName = "ATofDigiMatch"; - } else { + } + else { tHitBranchName = "TofHit"; tHitDigiMatchBranchName = "TofHitCalDigiMatch"; } @@ -584,14 +571,14 @@ Bool_t CbmTofEventClusterizer::RegisterOutputs() { // Flag check to control whether digis are written in output root file rootMgr->Register(tHitBranchName, "Tof", fTofHitsColl, fbWriteHitsInOut); - rootMgr->Register( - tHitDigiMatchBranchName, "Tof", fTofDigiMatchColl, fbWriteHitsInOut); + rootMgr->Register(tHitDigiMatchBranchName, "Tof", fTofDigiMatchColl, fbWriteHitsInOut); if (NULL != fTofDigiPointMatches) { fTofDigiPointMatchesOut = new std::vector<CbmMatch>(); rootMgr->RegisterAny("TofCalDigiMatch", fTofDigiPointMatchesOut, fbWriteDigisInOut); } - } else { // CbmEvent - mode + } + else { // CbmEvent - mode //fTofCalDigisCollOut = new TClonesArray("CbmTofDigi"); fTofCalDigiVecOut = new std::vector<CbmTofDigi>(); fTofHitsCollOut = new TClonesArray("CbmTofHit"); @@ -600,24 +587,22 @@ Bool_t CbmTofEventClusterizer::RegisterOutputs() { //rootMgr->Register( "TofCalDigi","Tof", fTofCalDigisCollOut, fbWriteDigisInOut); rootMgr->RegisterAny("TofCalDigi", fTofCalDigiVecOut, fbWriteDigisInOut); rootMgr->Register(tHitBranchName, "Tof", fTofHitsCollOut, fbWriteHitsInOut); - rootMgr->Register( - tHitDigiMatchBranchName, "Tof", fTofDigiMatchCollOut, fbWriteHitsInOut); + rootMgr->Register(tHitDigiMatchBranchName, "Tof", fTofDigiMatchCollOut, fbWriteHitsInOut); if (NULL != fTofDigiPointMatches) { fTofDigiPointMatchesOut = new std::vector<CbmMatch>(); rootMgr->RegisterAny("TofCalDigiMatch", fTofDigiPointMatchesOut, fbWriteDigisInOut); } } - LOG(info) << "out branches: " << tHitBranchName << ", " - << tHitDigiMatchBranchName; + LOG(info) << "out branches: " << tHitBranchName << ", " << tHitDigiMatchBranchName; return kTRUE; } -Bool_t CbmTofEventClusterizer::InitParameters() { +Bool_t CbmTofEventClusterizer::InitParameters() +{ // Initialize the TOF GeoHandler Bool_t isSimulation = kFALSE; - LOG(info) - << "CbmTofEventClusterizer::InitParameters - Geometry, Mapping, ... ??"; + LOG(info) << "CbmTofEventClusterizer::InitParameters - Geometry, Mapping, ... ??"; // Get Base Container FairRun* ana = FairRun::Instance(); @@ -629,14 +614,12 @@ Bool_t CbmTofEventClusterizer::InitParameters() { "with geometries after v14a !!!"; return kFALSE; } - if (iGeoVersion == k14a) - fTofId = new CbmTofDetectorId_v14a(); + if (iGeoVersion == k14a) fTofId = new CbmTofDetectorId_v14a(); else fTofId = new CbmTofDetectorId_v21a(); // 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(); @@ -656,21 +639,18 @@ Bool_t CbmTofEventClusterizer::InitParameters() { rtdb->initContainers(ana->GetRunId()); - LOG(info) << "CbmTofEventClusterizer::InitParameter: currently " - << fDigiPar->GetNrOfModules() << " digi cells "; + LOG(info) << "CbmTofEventClusterizer::InitParameter: currently " << fDigiPar->GetNrOfModules() << " digi cells "; fdMaxTimeDist = fDigiBdfPar->GetMaxTimeDist(); // in ns fdMaxSpaceDist = fDigiBdfPar->GetMaxDistAlongCh(); // in cm if (fMaxTimeDist != fdMaxTimeDist) { - fdMaxTimeDist = fMaxTimeDist; // modify default - fdMaxSpaceDist = - fdMaxTimeDist * fDigiBdfPar->GetSignalSpeed() - * 0.5; // cut consistently on positions (with default signal velocity) + fdMaxTimeDist = fMaxTimeDist; // modify default + fdMaxSpaceDist = fdMaxTimeDist * fDigiBdfPar->GetSignalSpeed() + * 0.5; // cut consistently on positions (with default signal velocity) } - LOG(info) << " BuildCluster with MaxTimeDist " << fdMaxTimeDist - << ", MaxSpaceDist " << fdMaxSpaceDist; + LOG(info) << " BuildCluster with MaxTimeDist " << fdMaxTimeDist << ", MaxSpaceDist " << fdMaxSpaceDist; if (fiCluMulMax == 0) fiCluMulMax = 100; if (fOutHstFileName == "") { fOutHstFileName = "./tofEventClust.hst.root"; } @@ -688,13 +668,14 @@ Bool_t CbmTofEventClusterizer::InitParameters() { } */ - LOG(info) << "<I> BeamRefType = " << fiBeamRefType << ", Sm " << fiBeamRefSm - << ", Det " << fiBeamRefDet << ", MulMax " << fiBeamRefMulMax; + LOG(info) << "<I> BeamRefType = " << fiBeamRefType << ", Sm " << fiBeamRefSm << ", Det " << fiBeamRefDet + << ", MulMax " << fiBeamRefMulMax; return kTRUE; } /************************************************************************************/ -Bool_t CbmTofEventClusterizer::InitCalibParameter() { +Bool_t CbmTofEventClusterizer::InitCalibParameter() +{ // dimension and initialize calib parameter // Int_t iNbDet = fDigiBdfPar->GetNbDet(); (VF) not used Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes(); @@ -723,8 +704,7 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { // LOG(info)<<Form(" fvCPDelTof for SmT %d, R %d, B %d",iSmType,iSm*iNbRpc+iRpc,iBx); fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx].resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] = - 0.; // initialize + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] = 0.; // initialize } Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc); @@ -739,14 +719,10 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide); fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide); for (Int_t iSide = 0; iSide < nbSide; iSide++) { - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 0.; //initialize - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 1.; //initialize - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - 0.; //initialize - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize( - nbClWalkBinX); + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.; //initialize + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 1.; //initialize + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.; //initialize + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize(nbClWalkBinX); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide][iWx] = 0.; } @@ -757,8 +733,7 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { } LOG(info) << "CbmTofEventClusterizer::InitCalibParameter: defaults set"; - TDirectory* oldir = - gDirectory; // <= 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 ! */ @@ -782,10 +757,9 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { fCalParFile->ls(); */ for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) { - Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType); - Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); - TProfile* hSvel = - (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iSmType)); + Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType); + Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); + TProfile* hSvel = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iSmType)); // copy Histo to memory TDirectory* curdir = gDirectory; @@ -793,13 +767,13 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { gDirectory->cd(oldir->GetPath()); // TProfile *hSvelmem = (TProfile *)hSvel->Clone(); (VF) not used gDirectory->cd(curdir->GetPath()); - } else { + } + else { LOG(info) << "Svel histogram not found for module type " << iSmType; } for (Int_t iPar = 0; iPar < 4; iPar++) { - TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny( - Form("cl_SmT%01d_Fpar%1d", iSmType, iPar)); + TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Fpar%1d", iSmType, iPar)); if (NULL != hFparcur) { gDirectory->cd(oldir->GetPath()); // TProfile *hFparmem = (TProfile *)hFparcur->Clone(); (VF) not used @@ -814,47 +788,33 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { if (NULL != hSvel) { Double_t Vscal = 1.; //hSvel->GetBinContent(iSm*iNbRpc+iRpc+1); if (Vscal == 0.) Vscal = 1.; - fDigiBdfPar->SetSigVel(iSmType, - iSm, - iRpc, - fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * Vscal); - LOG(info) << "Modify " << iSmType << iSm << iRpc << " Svel by " - << Vscal << " to " + fDigiBdfPar->SetSigVel(iSmType, iSm, iRpc, fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * Vscal); + LOG(info) << "Modify " << iSmType << iSm << iRpc << " Svel by " << Vscal << " to " << fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); } - TH2F* htempPos_pfx = (TH2F*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); - TH2F* htempTOff_pfx = (TH2F*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); - TH1D* htempTot_Mean = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); - TH1D* htempTot_Off = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); - if (NULL != htempPos_pfx && NULL != htempTOff_pfx - && NULL != htempTot_Mean && NULL != htempTot_Off) { + TH2F* htempPos_pfx = + (TH2F*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); + TH2F* htempTOff_pfx = + (TH2F*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); + TH1D* htempTot_Mean = + (TH1D*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); + TH1D* htempTot_Off = + (TH1D*) gDirectory->FindObjectAny(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); + if (NULL != htempPos_pfx && NULL != htempTOff_pfx && NULL != htempTot_Mean && NULL != htempTot_Off) { Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); Int_t iNbinTot = htempTot_Mean->GetNbinsX(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) { for (Int_t iSide = 0; iSide < 2; iSide++) { - Double_t TotMean = htempTot_Mean->GetBinContent( - iCh * 2 + 1 + iSide); //nh +1 empirical(?) - if (0.001 < TotMean) { - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= - fdTTotMean / TotMean; - } - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = - htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide); + Double_t TotMean = htempTot_Mean->GetBinContent(iCh * 2 + 1 + iSide); //nh +1 empirical(?) + if (0.001 < TotMean) { fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; } + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide); } - Double_t YMean = ((TProfile*) htempPos_pfx) - ->GetBinContent(iCh + 1); //nh +1 empirical(?) - Double_t TMean = - ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); + Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1); //nh +1 empirical(?) + Double_t TMean = ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); //Double_t dTYOff=YMean/fDigiBdfPar->GetSignalSpeed() ; - Double_t dTYOff = - YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean; /* @@ -865,121 +825,72 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { } */ if (5 == iSmType || 8 == iSmType) { // for PAD counters - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; } //if(iSmType==0 && iSm==4 && iRpc==2 && iCh==26) LOG(info) << "InitCalibParameter:" - << " TSRC " << iSmType << iSm << iRpc << iCh - << Form(": YMean %f, TMean %f", YMean, TMean) << " -> " - << Form( - " TOff %f, %f, TotG %f, %f ", - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + << " TSRC " << iSmType << iSm << iRpc << iCh << Form(": YMean %f, TMean %f", YMean, TMean) + << " -> " + << Form(" TOff %f, %f, TotG %f, %f ", fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]) << ", NbinTot " << iNbinTot; TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); - if (NULL != htempWalk0 - && NULL != htempWalk1) { // reinitialize Walk array + Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); + if (NULL != htempWalk0 && NULL != htempWalk1) { // reinitialize Walk array LOG(debug) << "Initialize Walk correction for " - << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d", - iSmType, - iSm, - iRpc, - iCh); + << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d", iSmType, iSm, iRpc, iCh); if (htempWalk0->GetNbinsX() != nbClWalkBinX) LOG(error) << "CbmTofEventClusterizer::InitCalibParameter: " "Inconsistent Walk histograms"; for (Int_t iBin = 0; iBin < nbClWalkBinX; iBin++) { - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] = - htempWalk0->GetBinContent(iBin + 1); - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = - htempWalk1->GetBinContent(iBin + 1); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] = htempWalk0->GetBinContent(iBin + 1); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = htempWalk1->GetBinContent(iBin + 1); if (iCh == 5 && iBin == 10) // debugging - LOG(info) << Form( - "Read New SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ", - iSmType, - iSm, - iRpc, - iCh, - iBin, - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]); + LOG(info) << Form("Read New SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ", iSmType, iSm, iRpc, iCh, + iBin, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]); if (5 == iSmType || 8 == iSmType) { // Pad structure fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]; } } - } else { - LOG(info) << "No Walk histograms for TSRC " << iSmType << iSm - << iRpc << iCh; + } + else { + LOG(info) << "No Walk histograms for TSRC " << iSmType << iSm << iRpc << iCh; } } - } else { - LOG(warning) << " Calibration histos " - << Form("cl_SmT%01d_sm%03d_rpc%03d_XXX", - iSmType, - iSm, - iRpc) + } + else { + LOG(warning) << " Calibration histos " << Form("cl_SmT%01d_sm%03d_rpc%03d_XXX", iSmType, iSm, iRpc) << " not found. "; } for (Int_t iSel = 0; iSel < iNSel; iSel++) { TH1D* htmpDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); if (NULL == htmpDelTof) { - LOG(debug) << " Histos " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel) + LOG(debug) << " Histos " << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel) << " not found. "; continue; } LOG(debug) << " Load DelTof from histos " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel) - << "."; + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel) << "."; for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) { - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += - htmpDelTof->GetBinContent(iBx + 1); + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += htmpDelTof->GetBinContent(iBx + 1); } // copy Histo to memory // TDirectory * curdir = gDirectory; gDirectory->cd(oldir->GetPath()); - TH1D* h1DelTof = (TH1D*) htmpDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* h1DelTof = + (TH1D*) htmpDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); - LOG(debug) << " copy histo " << h1DelTof->GetName() - << " to directory " << oldir->GetName(); + LOG(debug) << " copy histo " << h1DelTof->GetName() << " to directory " << oldir->GetName(); gDirectory->cd(curdir->GetPath()); } @@ -987,25 +898,21 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { } } // fCalParFile->Delete(); - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! - LOG(info) - << "CbmTofEventClusterizer::InitCalibParameter: initialization done"; + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + LOG(info) << "CbmTofEventClusterizer::InitCalibParameter: initialization done"; return kTRUE; } /************************************************************************************/ -Bool_t CbmTofEventClusterizer::LoadGeometry() { - LOG(info) << "CbmTofEventClusterizer::LoadGeometry starting for " - << fDigiBdfPar->GetNbDet() << " described detectors, " - << fDigiPar->GetNrOfModules() << " geometrically known cells "; +Bool_t CbmTofEventClusterizer::LoadGeometry() +{ + LOG(info) << "CbmTofEventClusterizer::LoadGeometry starting for " << fDigiBdfPar->GetNbDet() + << " described detectors, " << fDigiPar->GetNrOfModules() << " geometrically known cells "; Int_t iNrOfCells = fDigiPar->GetNrOfModules(); LOG(info) << "Digi Parameter container contains " << iNrOfCells << " cells."; for (Int_t icell = 0; icell < iNrOfCells; ++icell) { - Int_t cellId = - fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar + Int_t cellId = fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar fChannelInfo = fDigiPar->GetCell(cellId); Int_t smtype = fGeoHandler->GetSMType(cellId); @@ -1018,20 +925,14 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { Double_t z = fChannelInfo->GetZ(); Double_t dx = fChannelInfo->GetSizex(); Double_t dy = fChannelInfo->GetSizey(); - LOG(debug) << "-I- InitPar " << icell << " Id: " << Form("0x%08x", cellId) - << " " << cell << " tmcs: " << smtype << " " << smodule << " " - << module << " " << cell << " x=" << Form("%6.2f", x) - << " y=" << Form("%6.2f", y) << " z=" << Form("%6.2f", z) - << " dx=" << dx << " dy=" << dy; + LOG(debug) << "-I- InitPar " << icell << " Id: " << Form("0x%08x", cellId) << " " << cell << " tmcs: " << smtype + << " " << smodule << " " << module << " " << cell << " x=" << Form("%6.2f", x) + << " y=" << Form("%6.2f", y) << " z=" << Form("%6.2f", z) << " dx=" << dx << " dy=" << dy; TGeoNode* fNode = // prepare local->global trafo - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); - LOG(debug2) << Form(" Node at (%6.1f,%6.1f,%6.1f) : 0x%p", - fChannelInfo->GetX(), - fChannelInfo->GetY(), - fChannelInfo->GetZ(), - fNode); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + LOG(debug2) << Form(" Node at (%6.1f,%6.1f,%6.1f) : 0x%p", fChannelInfo->GetX(), fChannelInfo->GetY(), + fChannelInfo->GetZ(), fNode); if (icell == 0) { TGeoHMatrix* cMatrix = gGeoManager->GetCurrentMatrix(); fNode->Print(); @@ -1051,11 +952,9 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - LOG(info) << " DetIndx " << iDetIndx << "(" << iNbDet << "), SmType " - << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId - << " => UniqueId " << Form("0x%08x ", iUniqueId) - << Form(" Svel %6.6f, DeadStrips 0x%08x ", - fDigiBdfPar->GetSigVel(iSmType, iSmId, iRpcId), + LOG(info) << " DetIndx " << iDetIndx << "(" << iNbDet << "), SmType " << iSmType << ", SmId " << iSmId << ", RpcId " + << iRpcId << " => UniqueId " << Form("0x%08x ", iUniqueId) + << Form(" Svel %6.6f, DeadStrips 0x%08x ", fDigiBdfPar->GetSigVel(iSmType, iSmId, iRpcId), fvDeadStrips[iDetIndx]); Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpcId); fvTimeLastDigi[iDetIndx].resize(iNbChan * 2); @@ -1070,14 +969,11 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { Int_t iCell = -1; while (kTRUE) { - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, ++iCell, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, ++iCell, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) break; - LOG(debug3) << " Cell " << iCell << Form(" 0x%08x ", iUCellId) - << Form(", fCh 0x%p ", fChannelInfo) - << ", x: " << fChannelInfo->GetX() - << ", y: " << fChannelInfo->GetY() + LOG(debug3) << " Cell " << iCell << Form(" 0x%08x ", iUCellId) << Form(", fCh 0x%p ", fChannelInfo) + << ", x: " << fChannelInfo->GetX() << ", y: " << fChannelInfo->GetY() << ", z: " << fChannelInfo->GetZ(); } } @@ -1121,16 +1017,10 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { if (iNbChan == 0) { LOG(warning) << "CbmTofEventClusterizer::LoadGeometry: StoreDigi " "without channels " - << Form("SmTy %3d, Sm %3d, NbRpc %3d, Rpc, %3d ", - iSmType, - iSm, - iNbRpc, - iRpc); + << Form("SmTy %3d, Sm %3d, NbRpc %3d, Rpc, %3d ", iSmType, iSm, iNbRpc, iRpc); } - LOG(debug1) - << "CbmTofEventClusterizer::LoadGeometry: StoreDigi with " - << Form( - " %3d %3d %3d %3d %5d ", iSmType, iSm, iNbRpc, iRpc, iNbChan); + LOG(debug1) << "CbmTofEventClusterizer::LoadGeometry: StoreDigi with " + << Form(" %3d %3d %3d %3d %5d ", iSmType, iSm, iNbRpc, iRpc, iNbChan); fStorDigi[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan); fvLastHits[iSmType][iSm][iRpc].resize(iNbChan); @@ -1141,7 +1031,8 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { return kTRUE; } -Bool_t CbmTofEventClusterizer::DeleteGeometry() { +Bool_t CbmTofEventClusterizer::DeleteGeometry() +{ LOG(info) << "CbmTofEventClusterizer::DeleteGeometry starting"; return kTRUE; Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes(); @@ -1165,17 +1056,12 @@ Bool_t CbmTofEventClusterizer::DeleteGeometry() { } /************************************************************************************/ // Histogramming functions -Bool_t CbmTofEventClusterizer::CreateHistos() { - 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 ! +Bool_t CbmTofEventClusterizer::CreateHistos() +{ + 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 ! fhClustBuildTime = - new TH1I("TofEventClus_ClustBuildTime", - "Time needed to build clusters in each event; Time [s]", - 4000, - 0.0, - 4.0); + new TH1I("TofEventClus_ClustBuildTime", "Time needed to build clusters in each event; Time [s]", 4000, 0.0, 4.0); // RPC related distributions Int_t iNbDet = fDigiBdfPar->GetNbDet(); fviDetId.resize(iNbDet); @@ -1222,65 +1108,45 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { } if (NULL == fChannelInfo) { - LOG(warning) << "No DigiPar for SmType " - << Form("%d, 0x%08x", iS, iUCellId); + LOG(warning) << "No DigiPar for SmType " << Form("%d, 0x%08x", iS, iUCellId); continue; } Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; fhSmCluPosition[iS] = - new TH2F(Form("cl_SmT%01d_Pos", iS), - Form("Clu position of SmType %d; Sm+Rpc# []; ypos [cm]", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -YDMAX, - YDMAX); + new TH2F(Form("cl_SmT%01d_Pos", iS), Form("Clu position of SmType %d; Sm+Rpc# []; ypos [cm]", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -YDMAX, YDMAX); Double_t TSumMax = 1.E3; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; fhSmCluTOff[iS] = - new TH2F(Form("cl_SmT%01d_TOff", iS), - Form("Clu TimeZero in SmType %d; Sm+Rpc# []; TOff [ns]", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -TSumMax * 2., - TSumMax * 2.); - - TProfile* hSvelcur = - (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iS)); + new TH2F(Form("cl_SmT%01d_TOff", iS), Form("Clu TimeZero in SmType %d; Sm+Rpc# []; TOff [ns]", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -TSumMax * 2., TSumMax * 2.); + + TProfile* hSvelcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Svel", iS)); if (NULL == hSvelcur) { - fhSmCluSvel[iS] = new TProfile( - Form("cl_SmT%01d_Svel", iS), - Form("Clu Svel in SmType %d; Sm+Rpc# []; v/v_{nominal} ", iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0.8, - 1.2); + fhSmCluSvel[iS] = + new TProfile(Form("cl_SmT%01d_Svel", iS), Form("Clu Svel in SmType %d; Sm+Rpc# []; v/v_{nominal} ", iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0.8, 1.2); fhSmCluSvel[iS]->Sumw2(); - } else + } + else fhSmCluSvel[iS] = (TProfile*) hSvelcur->Clone(); fhSmCluFpar[iS].resize(4); for (Int_t iPar = 0; iPar < 4; iPar++) { - TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny( - Form("cl_SmT%01d_Fpar%1d", iS, iPar)); + TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(Form("cl_SmT%01d_Fpar%1d", iS, iPar)); if (NULL == hFparcur) { - LOG(info) << "Histo " << Form("cl_SmT%01d_Fpar%1d", iS, iPar) - << " not found, recreate ..."; - fhSmCluFpar[iS][iPar] = new TProfile( - Form("cl_SmT%01d_Fpar%1d", iS, iPar), - Form("Clu Fpar %d in SmType %d; Sm+Rpc# []; value ", iPar, iS), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - -100., - 100.); - } else + LOG(info) << "Histo " << Form("cl_SmT%01d_Fpar%1d", iS, iPar) << " not found, recreate ..."; + fhSmCluFpar[iS][iPar] = new TProfile(Form("cl_SmT%01d_Fpar%1d", iS, iPar), + Form("Clu Fpar %d in SmType %d; Sm+Rpc# []; value ", iPar, iS), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), -100., 100.); + } + else fhSmCluFpar[iS][iPar] = (TProfile*) hFparcur->Clone(); } @@ -1288,42 +1154,23 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { fhTSmCluTOff[iS].resize(iNSel); fhTSmCluTRun[iS].resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Loop over selectors - fhTSmCluPosition[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_Pos", iS, iSel), - Form("Clu position of SmType %d under Selector %02d; Sm+Rpc# " - "[]; ypos [cm]", - iS, - iSel), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -YDMAX, - YDMAX); - fhTSmCluTOff[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_TOff", iS, iSel), - Form("Clu TimeZero in SmType %d under Selector %02d; Sm+Rpc# " - "[]; TOff [ns]", - iS, - iSel), - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 0, - fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), - 99, - -TSumMax, - TSumMax); - fhTSmCluTRun[iS][iSel] = - new TH2F(Form("cl_TSmT%01d_Sel%02d_TRun", iS, iSel), - Form("Clu TimeZero in SmType %d under Selector %02d; Event# " - "[]; TMean [ns]", - iS, - iSel), - 100, - 0, - MaxNbEvent, - 99, - -TSumMax, - TSumMax); + fhTSmCluPosition[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_Pos", iS, iSel), + Form("Clu position of SmType %d under Selector %02d; Sm+Rpc# " + "[]; ypos [cm]", + iS, iSel), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -YDMAX, YDMAX); + fhTSmCluTOff[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_TOff", iS, iSel), + Form("Clu TimeZero in SmType %d under Selector %02d; Sm+Rpc# " + "[]; TOff [ns]", + iS, iSel), + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 0, + fDigiBdfPar->GetNbSm(iS) * fDigiBdfPar->GetNbRpc(iS), 99, -TSumMax, TSumMax); + fhTSmCluTRun[iS][iSel] = new TH2F(Form("cl_TSmT%01d_Sel%02d_TRun", iS, iSel), + Form("Clu TimeZero in SmType %d under Selector %02d; Event# " + "[]; TMean [ns]", + iS, iSel), + 100, 0, MaxNbEvent, 99, -TSumMax, TSumMax); } } @@ -1362,48 +1209,33 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) { Int_t iUniqueId = fDigiBdfPar->GetDetUId(iDetIndx); - Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); - Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); - Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); + Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); + Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) { LOG(warning) << "No DigiPar for Det " << Form("0x%08x", iUCellId); continue; } - LOG(info) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " - << iSmId << ", RpcId " << iRpcId << " => UniqueId " - << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " - << fChannelInfo->GetSizex() << ", dy " << fChannelInfo->GetSizey() - << ", z " << fChannelInfo->GetZ() - << Form(" ChPoi: %p ", fChannelInfo) << ", nbCh " - << fDigiBdfPar->GetNbChan(iSmType, 0); + LOG(info) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId + << " => UniqueId " << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " << fChannelInfo->GetSizex() + << ", dy " << fChannelInfo->GetSizey() << ", z " << fChannelInfo->GetZ() + << Form(" ChPoi: %p ", fChannelInfo) << ", nbCh " << fDigiBdfPar->GetNbChan(iSmType, 0); // check access to all channel infos for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { - Int_t iCCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, iCh, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iCCellId); - if (NULL == fChannelInfo) - LOG(warning) << Form( - "missing ChannelInfo for ch %d addr 0x%08x", iCh, iCCellId); + Int_t iCCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, iCh, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iCCellId); + if (NULL == fChannelInfo) LOG(warning) << Form("missing ChannelInfo for ch %d addr 0x%08x", iCh, iCCellId); } - fChannelInfo = fDigiPar->GetCell(iUCellId); - fhRpcDigiCor[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iSmType, iSmId, iRpcId), - Form( - "Digi Correlation of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + fChannelInfo = fDigiPar->GetCell(iUCellId); + fhRpcDigiCor[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iSmType, iSmId, iRpcId), + Form("Digi Correlation of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId)); fhRpcDigiMul[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiMul", iSmType, iSmId, iRpcId), @@ -1412,19 +1244,10 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { iRpcId, iSmId, iSmType), fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 20, 0, 20.); - fhRpcDigiStatus[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DigiStatus", iSmType, iSmId, iRpcId), - Form( - "Digi Status of Rpc #%03d in Sm %03d of type %d; strip #; digi status", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 10, - 0, - 10.); + fhRpcDigiStatus[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiStatus", iSmType, iSmId, iRpcId), + Form("Digi Status of Rpc #%03d in Sm %03d of type %d; strip #; digi status", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 10, 0, 10.); const Int_t NLogbin = 40; Double_t edge[NLogbin + 1]; @@ -1437,53 +1260,29 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, NLogbin, edge); - fhRpcDigiDTFD[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iSmType, iSmId, iRpcId), - Form("Time distance to first digi of Rpc #%03d in Sm %03d of type %d; " - "channel; t_{digi} - t_{first digi} (ns)", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 500., - 0., - 55.8); - - fhRpcDigiDTMul[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iSmType, iSmId, iRpcId), - Form("Multiplicity of digi of Rpc #%03d in Sm %03d of type %d; " - "channel; Multiplicity", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 20., - 0.5, - 20.5); - - fhRpcCluMul[iDetIndx] = new TH1F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Mul", iSmType, iSmId, iRpcId), - Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d; M []; Cnts", - iRpcId, - iSmId, - iSmType), - 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId)); - - fhRpcCluRate[iDetIndx] = new TH1D( - Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSmId, iRpcId), - Form("Clu rate of Rpc #%03d in Sm %03d of type %d; Time (s); Rate (Hz)", - iRpcId, - iSmId, - iSmType), - 36000., - 0., - 3600.); + fhRpcDigiDTFD[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iSmType, iSmId, iRpcId), + Form("Time distance to first digi of Rpc #%03d in Sm %03d of type %d; " + "channel; t_{digi} - t_{first digi} (ns)", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 500., 0., 55.8); + + fhRpcDigiDTMul[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iSmType, iSmId, iRpcId), + Form("Multiplicity of digi of Rpc #%03d in Sm %03d of type %d; " + "channel; Multiplicity", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 20., 0.5, 20.5); + + fhRpcCluMul[iDetIndx] = + new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Mul", iSmType, iSmId, iRpcId), + Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d; M []; Cnts", iRpcId, iSmId, iSmType), + 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2. + 2. * fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + + fhRpcCluRate[iDetIndx] = + new TH1D(Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSmId, iRpcId), + Form("Clu rate of Rpc #%03d in Sm %03d of type %d; Time (s); Rate (Hz)", iRpcId, iSmId, iSmType), 36000., + 0., 3600.); fhRpcCluRate10s[iDetIndx] = new TH1D(Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSmId, iRpcId), Form(" Clu rate of Rpc #%03d in Sm %03d of type %d in last " @@ -1491,254 +1290,118 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { iRpcId, iSmId, iSmType), 100000, 0., 10.); - fhRpcDTLastHits[iDetIndx] = new TH1F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iSmType, iSmId, iRpcId), - Form("Clu #DeltaT to last hits of Rpc #%03d in Sm %03d of type %d; log( " - "#DeltaT (ns)); counts", - iRpcId, - iSmId, - iSmType), - 100., - 0., - 10.); - - fhRpcDTLastHits_Tot[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Tot_DTLH", iSmType, iSmId, iRpcId), - Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); TOT " - "[a.u.]", - iRpcId, - iSmId, - iSmType), - 100, - 0., - 10., - 100, - fdTOTMin, - 4. * fdTOTMax); - - fhRpcDTLastHits_CluSize[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_CluSize_DTLH", iSmType, iSmId, iRpcId), - Form("Clu Size of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); " - "CluSize []", - iRpcId, - iSmId, - iSmType), - 100, - 0., - 10., - 16, - 0.5, - 16.5); + fhRpcDTLastHits[iDetIndx] = new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iSmType, iSmId, iRpcId), + Form("Clu #DeltaT to last hits of Rpc #%03d in Sm %03d of type %d; log( " + "#DeltaT (ns)); counts", + iRpcId, iSmId, iSmType), + 100., 0., 10.); + + fhRpcDTLastHits_Tot[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Tot_DTLH", iSmType, iSmId, iRpcId), + Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); TOT " + "[a.u.]", + iRpcId, iSmId, iSmType), + 100, 0., 10., 100, fdTOTMin, 4. * fdTOTMax); + + fhRpcDTLastHits_CluSize[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_CluSize_DTLH", iSmType, iSmId, iRpcId), + Form("Clu Size of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); " + "CluSize []", + iRpcId, iSmId, iSmType), + 100, 0., 10., 16, 0.5, 16.5); Double_t YSCAL = 50.; if (fPosYMaxScal != 0.) YSCAL = fPosYMaxScal; Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; - fhRpcCluPosition[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId), - Form( - "Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -YDMAX, - YDMAX); - - fhRpcCluPositionEvol[iDetIndx] = new TProfile( - Form("cl_SmT%01d_sm%03d_rpc%03d_PosEvol", iSmType, iSmId, iRpcId), - Form("Clu position of Rpc #%03d in Sm %03d of type %d; Analysis Time " - "[s]; ypos [cm]", - iRpcId, - iSmId, - iSmType), - 1000, - -1., - 1.E4, - -100., - 100.); - - fhRpcCluTimeEvol[iDetIndx] = new TProfile( - Form("cl_SmT%01d_sm%03d_rpc%03d_TimeEvol", iSmType, iSmId, iRpcId), - Form("Clu time of Rpc #%03d in Sm %03d of type %d; Analysis Time [s]; dT " - "[ns]", - iRpcId, - iSmId, - iSmType), - 1000, - -1., - 1.E4, - -10., - 10.); + fhRpcCluPosition[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId), + Form("Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -YDMAX, YDMAX); + + fhRpcCluPositionEvol[iDetIndx] = new TProfile(Form("cl_SmT%01d_sm%03d_rpc%03d_PosEvol", iSmType, iSmId, iRpcId), + Form("Clu position of Rpc #%03d in Sm %03d of type %d; Analysis Time " + "[s]; ypos [cm]", + iRpcId, iSmId, iSmType), + 1000, -1., 1.E4, -100., 100.); + + fhRpcCluTimeEvol[iDetIndx] = new TProfile(Form("cl_SmT%01d_sm%03d_rpc%03d_TimeEvol", iSmType, iSmId, iRpcId), + Form("Clu time of Rpc #%03d in Sm %03d of type %d; Analysis Time [s]; dT " + "[ns]", + iRpcId, iSmId, iSmType), + 1000, -1., 1.E4, -10., 10.); fhRpcCluDelPos[iDetIndx] = new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelPos", iSmType, iSmId, iRpcId), Form("Clu position difference of Rpc #%03d in Sm %03d of type " "%d; Strip []; #Deltaypos(clu) [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -10., - 10.); - - fhRpcCluDelMatPos[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatPos", iSmType, iSmId, iRpcId), - Form("Matched Clu position difference of Rpc #%03d in Sm %03d of type " - "%d; Strip []; #Deltaypos(mat) [cm]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -5., - 5.); + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -10., 10.); + + fhRpcCluDelMatPos[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatPos", iSmType, iSmId, iRpcId), + Form("Matched Clu position difference of Rpc #%03d in Sm %03d of type " + "%d; Strip []; #Deltaypos(mat) [cm]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -5., 5.); Double_t TSumMax = 1.E3; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; fhRpcCluTOff[iDetIndx] = new TH2F( Form("cl_SmT%01d_sm%03d_rpc%03d_TOff", iSmType, iSmId, iRpcId), - Form( - "Clu TimeZero of Rpc #%03d in Sm %03d of type %d; Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -TSumMax, - TSumMax); - - fhRpcCluDelTOff[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelTOff", iSmType, iSmId, iRpcId), - Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " - "[]; #DeltaTOff(clu) [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -0.6, - 0.6); - - fhRpcCluDelMatTOff[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatTOff", iSmType, iSmId, iRpcId), - Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " - "[]; #DeltaTOff(mat) [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - -0.6, - 0.6); - - fhRpcCluTrms[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Trms", iSmType, iSmId, iRpcId), - Form( - "Clu Time RMS of Rpc #%03d in Sm %03d of type %d; Strip []; Trms [ns]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 99, - 0., - 0.5); - - fhRpcCluTot[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId), - Form( - "Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [a.u.]", - iRpcId, - iSmId, - iSmType), - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - fdTOTMin, - fdTOTMax); - - fhRpcCluSize[iDetIndx] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Size", iSmType, iSmId, iRpcId), - Form( - "Clu size of Rpc #%03d in Sm %03d of type %d; Strip []; size [strips]", - iRpcId, - iSmId, - iSmType), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 16, - 0.5, - 16.5); + Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d; Strip []; TOff [ns]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -TSumMax, TSumMax); + + fhRpcCluDelTOff[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelTOff", iSmType, iSmId, iRpcId), + Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " + "[]; #DeltaTOff(clu) [ns]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -0.6, 0.6); + + fhRpcCluDelMatTOff[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_DelMatTOff", iSmType, iSmId, iRpcId), + Form("Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip " + "[]; #DeltaTOff(mat) [ns]", + iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, -0.6, 0.6); + + fhRpcCluTrms[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Trms", iSmType, iSmId, iRpcId), + Form("Clu Time RMS of Rpc #%03d in Sm %03d of type %d; Strip []; Trms [ns]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 99, 0., 0.5); + + fhRpcCluTot[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId), + Form("Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [a.u.]", iRpcId, iSmId, iSmType), + 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, 2 * fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, + fdTOTMin, fdTOTMax); + + fhRpcCluSize[iDetIndx] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Size", iSmType, iSmId, iRpcId), + Form("Clu size of Rpc #%03d in Sm %03d of type %d; Strip []; size [strips]", iRpcId, iSmId, iSmType), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 16, 0.5, 16.5); // Walk histos - fhRpcCluAvWalk[iDetIndx] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), - Form("Walk in SmT%01d_sm%03d_rpc%03d_AvWalk; Tot [a.u.]; #DeltaT [ns]", - iSmType, - iSmId, - iRpcId), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); - - fhRpcCluAvLnWalk[iDetIndx] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), - Form("Walk in SmT%01d_sm%03d_rpc%03d_AvLnWalk; log_{10}Tot [a.u.]; " - "#DeltaT [ns]", - iSmType, - iSmId, - iRpcId), - nbClWalkBinX, - TMath::Log10(fdTOTMax / 50.), - TMath::Log10(fdTOTMax), - nbClWalkBinY, - -TSumMax, - TSumMax); + fhRpcCluAvWalk[iDetIndx] = + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId), + Form("Walk in SmT%01d_sm%03d_rpc%03d_AvWalk; Tot [a.u.]; #DeltaT [ns]", iSmType, iSmId, iRpcId), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); + + fhRpcCluAvLnWalk[iDetIndx] = + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId), + Form("Walk in SmT%01d_sm%03d_rpc%03d_AvLnWalk; log_{10}Tot [a.u.]; " + "#DeltaT [ns]", + iSmType, iSmId, iRpcId), + nbClWalkBinX, TMath::Log10(fdTOTMax / 50.), TMath::Log10(fdTOTMax), nbClWalkBinY, -TSumMax, TSumMax); fhRpcCluWalk[iDetIndx].resize(fDigiBdfPar->GetNbChan(iSmType, iRpcId)); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { fhRpcCluWalk[iDetIndx][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { fhRpcCluWalk[iDetIndx][iCh][iSide] = - new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", iSmType, iSmId, iRpcId, iCh, iSide), Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk; Tot " "[a.u.]; #DeltaT [ns]", - iSmType, - iSmId, - iRpcId, - iCh, - iSide), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + iSmType, iSmId, iRpcId, iCh, iSide), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); } /* (fhRpcCluWalk[iDetIndx]).push_back( hTemp ); @@ -1750,120 +1413,56 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { LOG(info) << " Define Clusterizer monitoring histos "; - fhCluMulCorDutSel = - new TH2F(Form("hCluMulCorDutSel"), - Form("Cluster Multiplicity Correlation of Dut %d%d%d with Sel " - "%d%d%d; Mul(Sel); Mul(Dut)", - fDutId, - fDutSm, - fDutRpc, - fSelId, - fSelSm, - fSelRpc), - 32, - 0, - 32, - 32, - 0, - 32); - - fhEvCluMul = new TH2F( - Form("hEvCluMul"), - Form("Time Evolution of Cluster Multiplicity in Event; Time (s); Mul"), - 1800, - 0, - 1800, - 100, - 0, - 100); - - fhDigSpacDifClust = - new TH1I("Clus_DigSpacDifClust", - "Space difference along channel direction between Digi pairs on " - "adjacent channels; PosCh i - Pos Ch i+1 [cm]", - 5000, - -10.0, - 10.0); - fhDigTimeDifClust = - new TH1I("Clus_DigTimeDifClust", - "Time difference between Digi pairs on adjacent channels; " - "0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]", - 5000, - -5.0, - 5.0); - fhDigDistClust = new TH2I( - "Clus_DigDistClust", - "Distance between Digi pairs on adjacent channels; PosCh i - Pos Ch i+1 " - "[cm along ch]; 0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]", - 5000, - -10.0, - 10.0, - 2000, - -5.0, - 5.0); - fhClustSizeDifX = - new TH2I("Clus_ClustSizeDifX", - "Position difference between Point and Hit as function of Cluster " - "Size; Cluster Size [Strips]; dX [cm]", - 100, - 0.5, - 100.5, - 500, - -50, - 50); - fhClustSizeDifY = - new TH2I("Clus_ClustSizeDifY", - "Position difference between Point and Hit as function of Cluster " - "Size; Cluster Size [Strips]; dY [cm]", - 100, - 0.5, - 100.5, - 500, - -50, - 50); - fhChDifDifX = new TH2I("Clus_ChDifDifX", + fhCluMulCorDutSel = new TH2F(Form("hCluMulCorDutSel"), + Form("Cluster Multiplicity Correlation of Dut %d%d%d with Sel " + "%d%d%d; Mul(Sel); Mul(Dut)", + fDutId, fDutSm, fDutRpc, fSelId, fSelSm, fSelRpc), + 32, 0, 32, 32, 0, 32); + + fhEvCluMul = new TH2F(Form("hEvCluMul"), Form("Time Evolution of Cluster Multiplicity in Event; Time (s); Mul"), 1800, + 0, 1800, 100, 0, 100); + + fhDigSpacDifClust = new TH1I("Clus_DigSpacDifClust", + "Space difference along channel direction between Digi pairs on " + "adjacent channels; PosCh i - Pos Ch i+1 [cm]", + 5000, -10.0, 10.0); + fhDigTimeDifClust = new TH1I("Clus_DigTimeDifClust", + "Time difference between Digi pairs on adjacent channels; " + "0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]", + 5000, -5.0, 5.0); + fhDigDistClust = new TH2I("Clus_DigDistClust", + "Distance between Digi pairs on adjacent channels; PosCh i - Pos Ch i+1 " + "[cm along ch]; 0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]", + 5000, -10.0, 10.0, 2000, -5.0, 5.0); + fhClustSizeDifX = new TH2I("Clus_ClustSizeDifX", + "Position difference between Point and Hit as function of Cluster " + "Size; Cluster Size [Strips]; dX [cm]", + 100, 0.5, 100.5, 500, -50, 50); + fhClustSizeDifY = new TH2I("Clus_ClustSizeDifY", + "Position difference between Point and Hit as function of Cluster " + "Size; Cluster Size [Strips]; dY [cm]", + 100, 0.5, 100.5, 500, -50, 50); + fhChDifDifX = new TH2I("Clus_ChDifDifX", "Position difference between Point and Hit as " "function of Channel dif; Ch Dif [Strips]; dX [cm]", - 101, - -50.5, - 50.5, - 500, - -50, - 50); - fhChDifDifY = new TH2I("Clus_ChDifDifY", + 101, -50.5, 50.5, 500, -50, 50); + fhChDifDifY = new TH2I("Clus_ChDifDifY", "Position difference between Point and Hit as " "function of Channel Dif; Ch Dif [Strips]; dY [cm]", - 101, - -50.5, - 50.5, - 500, - -50, - 50); - fhNbSameSide = new TH1I("Clus_NbSameSide", + 101, -50.5, 50.5, 500, -50, 50); + fhNbSameSide = new TH1I("Clus_NbSameSide", "How many time per event the 2 digis on a channel " "were of the same side ; Counts/Event []", - 500, - 0.0, - 500.0); - fhNbDigiPerChan = new TH1I("Clus_NbDigiPerChan", - "Nb of Digis per channel; Nb Digis []", - 100, - 0.0, - 100.0); + 500, 0.0, 500.0); + fhNbDigiPerChan = new TH1I("Clus_NbDigiPerChan", "Nb of Digis per channel; Nb Digis []", 100, 0.0, 100.0); // Trigger selected histograms if (0 < iNSel) { fhSeldT.resize(iNSel); for (Int_t iSel = 0; iSel < iNSel; iSel++) { - fhSeldT[iSel] = new TH2F(Form("cl_dt_Sel%02d", iSel), - Form("Selector time %02d; dT [ns]", iSel), - 99, - -fdDelTofMax * 10., - fdDelTofMax * 10., - 16, - -0.5, - 15.5); + fhSeldT[iSel] = new TH2F(Form("cl_dt_Sel%02d", iSel), Form("Selector time %02d; dT [ns]", iSel), 99, + -fdDelTofMax * 10., fdDelTofMax * 10., 16, -0.5, 15.5); } fhTRpcCluMul.resize(iNbDet); @@ -1887,21 +1486,16 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); Int_t iSmId = CbmTofAddress::GetSmId(iUniqueId); Int_t iRpcId = CbmTofAddress::GetRpcId(iUniqueId); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); - fChannelInfo = fDigiPar->GetCell(iUCellId); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSmId, iRpcId, 0, 0, iSmType); + fChannelInfo = fDigiPar->GetCell(iUCellId); if (NULL == fChannelInfo) { LOG(warning) << "No DigiPar for Det " << Form("0x%08x", iUCellId); continue; } - LOG(debug1) << "DetIndx " << iDetIndx << ", SmType " << iSmType - << ", SmId " << iSmId << ", RpcId " << iRpcId - << " => UniqueId " - << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " - << fChannelInfo->GetSizex() << ", dy " - << fChannelInfo->GetSizey() - << Form(" poi: 0x%p ", fChannelInfo) << ", nbCh " - << fDigiBdfPar->GetNbChan(iSmType, iRpcId); + LOG(debug1) << "DetIndx " << iDetIndx << ", SmType " << iSmType << ", SmId " << iSmId << ", RpcId " << iRpcId + << " => UniqueId " << Form("(0x%08x, 0x%08x)", iUniqueId, iUCellId) << ", dx " + << fChannelInfo->GetSizex() << ", dy " << fChannelInfo->GetSizey() + << Form(" poi: 0x%p ", fChannelInfo) << ", nbCh " << fDigiBdfPar->GetNbChan(iSmType, iRpcId); fhTRpcCluMul[iDetIndx].resize(iNSel); fhTRpcCluPosition[iDetIndx].resize(iNSel); @@ -1921,466 +1515,199 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { for (Int_t iSel = 0; iSel < iNSel; iSel++) { fhTRpcCluMul[iDetIndx][iSel] = - new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Mul", - iSmType, - iSmId, - iRpcId, - iSel), + new TH1F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Mul", iSmType, iSmId, iRpcId, iSel), Form("Clu multiplicity of Rpc #%03d in Sm %03d of type %d " "under Selector %02d; M []; cnts", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId) + 2, - 0., - fDigiBdfPar->GetNbChan(iSmType, iRpcId) + 2); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId) + 2, 0., fDigiBdfPar->GetNbChan(iSmType, iRpcId) + 2); - if (NULL == fhTRpcCluMul[iDetIndx][iSel]) - LOG(fatal) << " Histo not generated !"; + if (NULL == fhTRpcCluMul[iDetIndx][iSel]) LOG(fatal) << " Histo not generated !"; Double_t YSCAL = 50.; if (fPosYMaxScal != 0.) YSCAL = fPosYMaxScal; - Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; - fhTRpcCluPosition[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Pos", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu position of Rpc #%03d in Sm %03d of type %d under " - "Selector %02d; Strip []; ypos [cm]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 100, - -YDMAX, - YDMAX); + Double_t YDMAX = TMath::Max(2., fChannelInfo->GetSizey()) * YSCAL; + fhTRpcCluPosition[iDetIndx][iSel] = new TH2F( + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Pos", iSmType, iSmId, iRpcId, iSel), + Form("Clu position of Rpc #%03d in Sm %03d of type %d under " + "Selector %02d; Strip []; ypos [cm]", + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 100, -YDMAX, YDMAX); Double_t TSumMax = 1.E4; if (fTRefDifMax != 0.) TSumMax = fTRefDifMax; if (iSmType == 5) TSumMax *= 2.; - fhTRpcCluTOff[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " - "Selector %02d; Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 999, - -TSumMax, - TSumMax); + fhTRpcCluTOff[iDetIndx][iSel] = new TH2F( + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff", iSmType, iSmId, iRpcId, iSel), + Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " + "Selector %02d; Strip []; TOff [ns]", + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 999, -TSumMax, TSumMax); fhTRpcCluTofOff[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TofOff", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TofOff", iSmType, iSmId, iRpcId, iSel), Form("Clu TimeDeviation of Rpc #%03d in Sm %03d of type %d " "under Selector %02d; Strip []; TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 999, - -TSumMax * 4., - TSumMax * 4.); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 999, + -TSumMax * 4., TSumMax * 4.); if (fTotMax != 0.) fdTOTMax = fTotMax; fhTRpcCluTot[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot", iSmType, iSmId, iRpcId, iSel), Form("Clu Tot of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; StripSide []; TOT [a.u.]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, - 100, - fdTOTMin, - fdTOTMax); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 100, + fdTOTMin, fdTOTMax); fhTRpcCluSize[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size", iSmType, iSmId, iRpcId, iSel), Form("Clu size of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; Strip []; size [strips]", - iRpcId, - iSmId, - iSmType, - iSel), - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 0, - fDigiBdfPar->GetNbChan(iSmType, iRpcId), - 16, - 0.5, - 16.5); + iRpcId, iSmId, iSmType, iSel), + fDigiBdfPar->GetNbChan(iSmType, iRpcId), 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId), 16, 0.5, 16.5); // Walk histos - fhTRpcCluAvWalk[iDetIndx][iSel] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk; TOT; T-TSel", - iSmType, - iSmId, - iRpcId, - iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + fhTRpcCluAvWalk[iDetIndx][iSel] = + new TH2D(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk", iSmType, iSmId, iRpcId, iSel), + Form("Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk; TOT; T-TSel", iSmType, iSmId, iRpcId, iSel), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); // Tof Histos - fhTRpcCluDelTof[iDetIndx][iSel] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSmId, - iRpcId, - iSel), - Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof; TRef-TSel; T-TSel", - iSmType, - iSmId, - iRpcId, - iSel), - nbClDelTofBinX, - -fdDelTofMax, - fdDelTofMax, - nbClDelTofBinY, - -TSumMax, - TSumMax); + fhTRpcCluDelTof[iDetIndx][iSel] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSmId, iRpcId, iSel), + Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof; TRef-TSel; T-TSel", iSmType, iSmId, iRpcId, iSel), + nbClDelTofBinX, -fdDelTofMax, fdDelTofMax, nbClDelTofBinY, -TSumMax, TSumMax); // Position deviation histos fhTRpcCludXdY[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY", iSmType, iSmId, iRpcId, iSel), Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY; #Delta x [cm]; " "#Delta y [cm];", - iSmType, - iSmId, - iRpcId, - iSel), - nbCldXdYBinX, - -dXdYMax, - dXdYMax, - nbCldXdYBinY, - -dXdYMax, - dXdYMax); + iSmType, iSmId, iRpcId, iSel), + nbCldXdYBinX, -dXdYMax, dXdYMax, nbCldXdYBinY, -dXdYMax, dXdYMax); fhTRpcCluWalk2[iDetIndx][iSel] = new TH3F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2", - iSmType, - iSmId, - iRpcId, - iSel), - Form( - "SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2; Tot_1; Tot_2; #Delta t[ns]", - iSmType, - iSmId, - iRpcId, - iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); - - fhTRpcCluWalk[iDetIndx][iSel].resize( - fDigiBdfPar->GetNbChan(iSmType, iRpcId)); - - for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); - iCh++) { + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2", iSmType, iSmId, iRpcId, iSel), + Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2; Tot_1; Tot_2; #Delta t[ns]", iSmType, iSmId, iRpcId, iSel), + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); + + fhTRpcCluWalk[iDetIndx][iSel].resize(fDigiBdfPar->GetNbChan(iSmType, iRpcId)); + + for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpcId); iCh++) { fhTRpcCluWalk[iDetIndx][iSel][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { fhTRpcCluWalk[iDetIndx][iSel][iCh][iSide] = new TH2D( - Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide, - iSel), - Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", - iSmType, - iSmId, - iRpcId, - iCh, - iSide, + Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", iSmType, iSmId, iRpcId, iCh, iSide, iSel), + Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk", iSmType, iSmId, iRpcId, iCh, iSide, iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + nbClWalkBinX, fdTOTMin, fdTOTMax, nbClWalkBinY, -TSumMax, TSumMax); } } fhTRpcCluTOffDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu TimeZero of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 99, - -TSumMax, - TSumMax); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 99, -TSumMax, TSumMax); fhTRpcCluTotDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu Tot of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); TOT [a.u.]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 100, - fdTOTMin, - fdTOTMax); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 100, fdTOTMin, fdTOTMax); fhTRpcCluSizeDTLastHits[iDetIndx][iSel] = - new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size_DTLH", iSmType, iSmId, iRpcId, iSel), Form("Clu size of Rpc #%03d in Sm %03d of type %d under " "Selector %02d; log(#DeltaT (ns)); size [strips]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 10, - 0.5, - 10.5); - - fhTRpcCluMemMulDTLastHits[iDetIndx][iSel] = new TH2F( - Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_MemMul_DTLH", - iSmType, - iSmId, - iRpcId, - iSel), - Form("Clu Memorized Multiplicity of Rpc #%03d in Sm %03d of type %d " - "under Selector %02d; log(#DeltaT (ns)); TOff [ns]", - iRpcId, - iSmId, - iSmType, - iSel), - 100, - 0., - 10., - 10, - 0, - 10); + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 10, 0.5, 10.5); + + fhTRpcCluMemMulDTLastHits[iDetIndx][iSel] = + new TH2F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_MemMul_DTLH", iSmType, iSmId, iRpcId, iSel), + Form("Clu Memorized Multiplicity of Rpc #%03d in Sm %03d of type %d " + "under Selector %02d; log(#DeltaT (ns)); TOff [ns]", + iRpcId, iSmId, iSmType, iSel), + 100, 0., 10., 10, 0, 10); } } } // MC reference fhHitsPerTracks = - new TH1I("Clus_TofHitPerTrk", - "Mean Number of TofHit per Mc Track; Nb TofHits/Nb MC Tracks []", - 2000, - 0.0, - 20.0); + new TH1I("Clus_TofHitPerTrk", "Mean Number of TofHit per Mc Track; Nb TofHits/Nb MC Tracks []", 2000, 0.0, 20.0); if (kFALSE == fDigiBdfPar->ClustUseTrackId()) fhPtsPerHit = new TH1I("Clus_TofPtsPerHit", "Distribution of the Number of MCPoints associated " "to each TofHit; Nb MCPoint []", - 20, - 0.0, - 20.0); + 20, 0.0, 20.0); if (kTRUE == fDigiBdfPar->ClustUseTrackId()) { - fhTimeResSingHits = - new TH1I("Clus_TofTimeResClust", - "Time resolution for TofHits containing Digis from a single MC " - "Track; t(1st Mc Point) -tTofHit [ns]", - 10000, - -25.0, - 25.0); - fhTimeResSingHitsB = - new TH2I("Clus_TofTimeResClustB", - "Time resolution for TofHits containing Digis from a single MC " - "Track; (1st Mc Point) -tTofHit [ns]", - 5000, - -25.0, - 25.0, - 6, - 0, - 6); - fhTimePtVsHits = - new TH2I("Clus_TofTimePtVsHit", - "Time resolution for TofHits containing Digis from a single MC " - "Track; t(1st Mc Point) -tTofHit [ns]", - 2000, - 0.0, - 50.0, - 2000, - 0.0, - 50.0); - } else { - fhTimeResSingHits = - new TH1I("Clus_TofTimeResClust", - "Time resolution for TofHits containing Digis from a single " - "TofPoint; tMcPoint -tTofHit [ns]", - 10000, - -25.0, - 25.0); - fhTimeResSingHitsB = - new TH2I("Clus_TofTimeResClustB", - "Time resolution for TofHits containing Digis from a single " - "TofPoint; tMcPoint -tTofHit [ns]", - 5000, - -25.0, - 25.0, - 6, - 0, - 6); - fhTimePtVsHits = new TH2I("Clus_TofTimePtVsHit", + fhTimeResSingHits = new TH1I("Clus_TofTimeResClust", + "Time resolution for TofHits containing Digis from a single MC " + "Track; t(1st Mc Point) -tTofHit [ns]", + 10000, -25.0, 25.0); + fhTimeResSingHitsB = new TH2I("Clus_TofTimeResClustB", + "Time resolution for TofHits containing Digis from a single MC " + "Track; (1st Mc Point) -tTofHit [ns]", + 5000, -25.0, 25.0, 6, 0, 6); + fhTimePtVsHits = new TH2I("Clus_TofTimePtVsHit", + "Time resolution for TofHits containing Digis from a single MC " + "Track; t(1st Mc Point) -tTofHit [ns]", + 2000, 0.0, 50.0, 2000, 0.0, 50.0); + } + else { + fhTimeResSingHits = new TH1I("Clus_TofTimeResClust", + "Time resolution for TofHits containing Digis from a single " + "TofPoint; tMcPoint -tTofHit [ns]", + 10000, -25.0, 25.0); + fhTimeResSingHitsB = new TH2I("Clus_TofTimeResClustB", + "Time resolution for TofHits containing Digis from a single " + "TofPoint; tMcPoint -tTofHit [ns]", + 5000, -25.0, 25.0, 6, 0, 6); + fhTimePtVsHits = new TH2I("Clus_TofTimePtVsHit", "Time resolution for TofHits containing Digis " "from a single TofPoint; tMcPoint -tTofHit [ps]", - 2000, - 0.0, - 50.0, - 2000, - 0.0, - 50.0); + 2000, 0.0, 50.0, 2000, 0.0, 50.0); } // else of if( kTRUE == fDigiBdfPar->ClustUseTrackId() ) - fhClusterSize = new TH1I("Clus_ClusterSize", - "Cluster Size distribution; Cluster Size [Strips]", - 100, - 0.5, - 100.5); + fhClusterSize = new TH1I("Clus_ClusterSize", "Cluster Size distribution; Cluster Size [Strips]", 100, 0.5, 100.5); fhClusterSizeType = new TH2I("Clus_ClusterSizeType", "Cluster Size distribution in each (SM type, Rpc) pair; Cluster " "Size [Strips]; 10*SM Type + Rpc Index []", - 100, - 0.5, - 100.5, - 40 * fDigiBdfPar->GetNbSmTypes(), - 0.0, - 40 * fDigiBdfPar->GetNbSmTypes()); + 100, 0.5, 100.5, 40 * fDigiBdfPar->GetNbSmTypes(), 0.0, 40 * fDigiBdfPar->GetNbSmTypes()); if (kTRUE == fDigiBdfPar->ClustUseTrackId()) { - fhTrackMul = new TH1I( - "Clus_TrackMul", - "Number of MC tracks generating the cluster; MC Tracks multiplicity []", - 100, - 0.5, - 100.5); - fhClusterSizeMulti = new TH2I( - "Clus_ClusterSizeMulti", - "Cluster Size distribution as function of Number of MC tracks generating " - "the cluster; Cluster Size [Strips]; MC tracks mul. []", - 100, - 0.5, - 100.5, - 100, - 0.5, - 100.5); - fhTrk1MulPos = new TH2D("Clus_Trk1MulPos", + fhTrackMul = new TH1I("Clus_TrackMul", "Number of MC tracks generating the cluster; MC Tracks multiplicity []", 100, + 0.5, 100.5); + fhClusterSizeMulti = new TH2I("Clus_ClusterSizeMulti", + "Cluster Size distribution as function of Number of MC tracks generating " + "the cluster; Cluster Size [Strips]; MC tracks mul. []", + 100, 0.5, 100.5, 100, 0.5, 100.5); + fhTrk1MulPos = new TH2D("Clus_Trk1MulPos", "Position of Clusters with only 1 MC tracks " "generating the cluster; X [cm]; Y [cm]", - 1500, - -750, - 750, - 1000, - -500, - 500); - fhHiTrkMulPos = new TH2D("Clus_HiTrkMulPos", + 1500, -750, 750, 1000, -500, 500); + fhHiTrkMulPos = new TH2D("Clus_HiTrkMulPos", "Position of Clusters with >1 MC tracks " "generating the cluster; X [cm]; Y [cm]", - 1500, - -750, - 750, - 1000, - -500, - 500); - fhAllTrkMulPos = new TH2D( - "Clus_AllTrkMulPos", - "Position of all clusters generating the cluster; X [cm]; Y [cm]", - 1500, - -750, - 750, - 1000, - -500, - 500); - fhMultiTrkProbPos = - new TH2D("Clus_MultiTrkProbPos", - "Probability of having a cluster with multiple tracks as " - "function of position; X [cm]; Y [cm]; Prob. [%]", - 1500, - -750, - 750, - 1000, - -500, - 500); + 1500, -750, 750, 1000, -500, 500); + fhAllTrkMulPos = new TH2D("Clus_AllTrkMulPos", "Position of all clusters generating the cluster; X [cm]; Y [cm]", + 1500, -750, 750, 1000, -500, 500); + fhMultiTrkProbPos = new TH2D("Clus_MultiTrkProbPos", + "Probability of having a cluster with multiple tracks as " + "function of position; X [cm]; Y [cm]; Prob. [%]", + 1500, -750, 750, 1000, -500, 500); } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() ) - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! return kTRUE; } -Bool_t CbmTofEventClusterizer::FillHistos() { - fhClustBuildTime->Fill(fStop.GetSec() - fStart.GetSec() - + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9); +Bool_t CbmTofEventClusterizer::FillHistos() +{ + fhClustBuildTime->Fill(fStop.GetSec() - fStart.GetSec() + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9); if (fDutId < 0) return kTRUE; @@ -2404,15 +1731,11 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (0 < iNSel) { // check software triggers - LOG(debug) << "CbmTofEventClusterizer::FillHistos() for " << iNSel - << " triggers" - << ", Dut " << fDutId << ", " << fDutSm << ", " << fDutRpc - << Form(", 0x%08x", fDutAddr) << ", Sel " << fSelId << ", " - << fSelSm << ", " << fSelRpc << Form(", 0x%08x", fSelAddr) - << ", Sel2 " << fSel2Id << ", " << fSel2Sm << ", " << fSel2Rpc - << Form(", 0x%08x", fSel2Addr); - LOG(debug) << "CbmTofEventClusterizer::FillHistos: Muls: " - << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " + LOG(debug) << "CbmTofEventClusterizer::FillHistos() for " << iNSel << " triggers" + << ", Dut " << fDutId << ", " << fDutSm << ", " << fDutRpc << Form(", 0x%08x", fDutAddr) << ", Sel " + << fSelId << ", " << fSelSm << ", " << fSelRpc << Form(", 0x%08x", fSelAddr) << ", Sel2 " << fSel2Id + << ", " << fSel2Sm << ", " << fSel2Rpc << Form(", 0x%08x", fSel2Addr); + LOG(debug) << "CbmTofEventClusterizer::FillHistos: Muls: " << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " << fviClusterMul[fSelId][fSelSm][fSelRpc]; // monitor multiplicities @@ -2427,14 +1750,12 @@ Bool_t CbmTofEventClusterizer::FillHistos() { // ; if (NULL != fhRpcCluMul[iDetIndx]) { if (fviClusterMul[iSmType][iSm][iRpc] > 0) iDetMul++; - dCluMul += fviClusterMul[iSmType][iSm] - [iRpc]; // total hit multiplicity in event + dCluMul += fviClusterMul[iSmType][iSm][iRpc]; // total hit multiplicity in event fhRpcCluMul[iDetIndx]->Fill(fviClusterMul[iSmType][iSm][iRpc]); // } } - fhCluMulCorDutSel->Fill(fviClusterMul[fSelId][fSelSm][fSelRpc], - fviClusterMul[fDutId][fDutSm][fDutRpc]); + fhCluMulCorDutSel->Fill(fviClusterMul[fSelId][fSelSm][fSelRpc], fviClusterMul[fDutId][fDutSm][fDutRpc]); // do input distributions first for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) { @@ -2442,16 +1763,14 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (NULL == pHit) continue; if (StartAnalysisTime == 0.) { StartAnalysisTime = pHit->GetTime(); - LOG(info) << "StartAnalysisTime set to " << StartAnalysisTime / 1.E9 - << " s. "; + LOG(info) << "StartAnalysisTime set to " << StartAnalysisTime / 1.E9 << " s. "; fdStartAna10s = StartAnalysisTime; } Int_t iDetId = (pHit->GetAddress() & DetMask); std::map<UInt_t, UInt_t>::iterator it = fDetIdIndexMap.find(iDetId); - if (it == fDetIdIndexMap.end()) - continue; // continue for invalid detector index - Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; + if (it == fDetIdIndexMap.end()) continue; // continue for invalid detector index + Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; Int_t iSmType = CbmTofAddress::GetSmType(iDetId); Int_t iSm = CbmTofAddress::GetSmId(iDetId); @@ -2460,27 +1779,23 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Double_t dTimeAna = (pHit->GetTime() - StartAnalysisTime) / 1.E9; //LOG(debug)<<"TimeAna "<<StartAnalysisTime<<", "<< pHit->GetTime()<<", "<<dTimeAna; - fhRpcCluRate[iDetIndx]->Fill( - dTimeAna, 1. / fhRpcCluRate[iDetIndx]->GetBinWidth(1)); + fhRpcCluRate[iDetIndx]->Fill(dTimeAna, 1. / fhRpcCluRate[iDetIndx]->GetBinWidth(1)); // deal with spill structure Double_t dTimeAna10s = pHit->GetTime() - fdStartAna10s; if (iHitInd == 0) { fhEvCluMul->Fill(dTimeAna, dCluMul); if (iDetMul > 5 - && fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] - > 0) { // FIXME: hardwired constants + && fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] > 0) { // FIXME: hardwired constants if (dTLEvt == 0) dTLEvt = pHit->GetTime(); Double_t dDTLEvt = pHit->GetTime() - dTLEvt; dTLEvt = pHit->GetTime(); - if (dDTLEvt > fdSpillBreak * 1.E9 - && dTimeAna10s > fdSpillDuration * 1.E9) { + if (dDTLEvt > fdSpillBreak * 1.E9 && dTimeAna10s > fdSpillDuration * 1.E9) { //if( dDTLEvt> 5.E8 && dTimeAna10s > 10.) { fdStartAna10s = pHit->GetTime(); iNSpill++; - LOG(info) << "Resetting 10s rate histo for spill " << iNSpill - << " at " << fdStartAna10s / 1.E9 << "s after " - << dDTLEvt / 1.E9 << " s without events"; + LOG(info) << "Resetting 10s rate histo for spill " << iNSpill << " at " << fdStartAna10s / 1.E9 + << "s after " << dDTLEvt / 1.E9 << " s without events"; for (Int_t iDet = 0; iDet < fDigiBdfPar->GetNbDet(); iDet++) { if (NULL == fhRpcCluRate10s[iDet]) continue; fhRpcCluRate10s[iDet]->Reset("ICES"); @@ -2490,22 +1805,15 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } } - if (fdStartAna10s > 0.) - fhRpcCluRate10s[iDetIndx]->Fill(dTimeAna10s / 1.E9, 1.); + if (fdStartAna10s > 0.) fhRpcCluRate10s[iDetIndx]->Fill(dTimeAna10s / 1.E9, 1.); // fhRpcCluRate10s[iDetIndx]->Fill(dTimeAna10s/1.E9,1./fhRpcCluRate10s[iDetIndx]->GetBinWidth(1)); - if (fdMemoryTime > 0. - && fvLastHits[iSmType][iSm][iRpc][iCh].size() == 0) - LOG(fatal) << Form(" <E> hit not stored in memory for TSRC %d%d%d%d", - iSmType, - iSm, - iRpc, - iCh); + if (fdMemoryTime > 0. && fvLastHits[iSmType][iSm][iRpc][iCh].size() == 0) + LOG(fatal) << Form(" <E> hit not stored in memory for TSRC %d%d%d%d", iSmType, iSm, iRpc, iCh); //CheckLHMemory(); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for outdated hits + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for outdated hits //std::list<CbmTofHit *>::iterator it0=fvLastHits[iSmType][iSm][iRpc][iCh].begin(); //std::list<CbmTofHit *>::iterator itL=fvLastHits[iSmType][iSm][iRpc][iCh].end(); //CbmTofHit* pH0 = *it0; @@ -2515,60 +1823,36 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (pH0->GetTime() > pHL->GetTime()) LOG(warning) << Form("Invalid time ordering in ev %8.0f in list of " "size %lu for TSRC %d%d%d%d: Delta t %f ", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, pHL->GetTime() - pH0->GetTime()); // while( (*((std::list<CbmTofHit *>::iterator) fvLastHits[iSmType][iSm][iRpc][iCh].begin()))->GetTime()+fdMemoryTime < pHit->GetTime() while (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 2. - || fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime() - + fdMemoryTime - < pHit->GetTime()) + || fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime() + fdMemoryTime < pHit->GetTime()) { - LOG(debug) - << " pop from list size " - << fvLastHits[iSmType][iSm][iRpc][iCh].size() - << Form(" outdated hits for ev %8.0f in TSRC %d%d%d%d", - fdEvent, - iSmType, - iSm, - iRpc, - iCh) - << Form( - " with tHit - tLast %f ", - pHit->GetTime() - - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()) + LOG(debug) << " pop from list size " << fvLastHits[iSmType][iSm][iRpc][iCh].size() + << Form(" outdated hits for ev %8.0f in TSRC %d%d%d%d", fdEvent, iSmType, iSm, iRpc, iCh) + << Form(" with tHit - tLast %f ", + pHit->GetTime() - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()) //(*((std::list<CbmTofHit *>::iterator) fvLastHits[iSmType][iSm][iRpc][iCh].begin()))->GetTime()) ; - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != pHit->GetAddress()) - LOG(fatal) << Form( - "Inconsistent address in list of size %lu for TSRC %d%d%d%d: " - "0x%08x, time %f", - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != pHit->GetAddress()) + LOG(fatal) << Form("Inconsistent address in list of size %lu for TSRC %d%d%d%d: " + "0x%08x, time %f", + fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete(); fvLastHits[iSmType][iSm][iRpc][iCh].pop_front(); } } //fvLastHits[iSmType][iSm][iRpc][iCh].size()>1) // plot remaining time difference to previous hits - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); Double_t dTotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis CbmLink L0 = digiMatch->GetLink(iLink); Int_t iDigInd0 = L0.GetIndex(); Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); @@ -2579,20 +1863,14 @@ Bool_t CbmTofEventClusterizer::FillHistos() { dTotSum += pDig0->GetTot() + pDig1->GetTot(); } - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (size_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (size_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhRpcDTLastHits[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime())); - fhRpcDTLastHits_CluSize[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - digiMatch->GetNofLinks() / 2.); - fhRpcDTLastHits_Tot[iDetIndx]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), dTotSum); + fhRpcDTLastHits[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime())); + fhRpcDTLastHits_CluSize[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + digiMatch->GetNofLinks() / 2.); + fhRpcDTLastHits_Tot[iDetIndx]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), dTotSum); } } } // iHitInd loop end @@ -2607,15 +1885,12 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Int_t iDetId = (pHit->GetAddress() & SelMask); if (fiBeamRefAddr == iDetId) { - if (fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] - > fiBeamRefMulMax) - break; + if (fviClusterMul[fiBeamRefType][fiBeamRefSm][fiBeamRefDet] > fiBeamRefMulMax) break; // Check Tot CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); Double_t TotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); UInt_t iDigInd0 = L0.GetIndex(); // if (iDigInd0 < fTofCalDigisColl->GetEntries()){ if (iDigInd0 < fTofCalDigiVec->size()) { @@ -2625,8 +1900,7 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } } TotSum /= (0.5 * digiMatch->GetNofLinks()); - if (TotSum > fhRpcCluTot[iIndexDut]->GetYaxis()->GetXmax()) - continue; // ignore too large clusters + if (TotSum > fhRpcCluTot[iIndexDut]->GetYaxis()->GetXmax()) continue; // ignore too large clusters fTRefHits = 1; if (pHit->GetTime() < dTRef) { @@ -2634,19 +1908,16 @@ Bool_t CbmTofEventClusterizer::FillHistos() { pBeamRef = pHit; } iBeamRefMul++; - } else { //additional reference type multiplicity - if (fiBeamRefType == CbmTofAddress::GetSmType(iDetId)) - iBeamAddRefMul++; + } + else { //additional reference type multiplicity + if (fiBeamRefType == CbmTofAddress::GetSmType(iDetId)) iBeamAddRefMul++; } } - LOG(debug) << "CbmTofEventClusterizer::FillHistos: BRefMul: " - << iBeamRefMul << ", " << iBeamAddRefMul; + LOG(debug) << "CbmTofEventClusterizer::FillHistos: BRefMul: " << iBeamRefMul << ", " << iBeamAddRefMul; - if (iBeamRefMul == 0) - return kFALSE; // don't fill histos without reference time - if (iBeamAddRefMul < fiBeamAddRefMul) - return kFALSE; // ask for confirmation by other beam counters - if (NULL == pBeamRef) return kFALSE; // should never happen + if (iBeamRefMul == 0) return kFALSE; // don't fill histos without reference time + if (iBeamAddRefMul < fiBeamAddRefMul) return kFALSE; // ask for confirmation by other beam counters + if (NULL == pBeamRef) return kFALSE; // should never happen for (Int_t iSel = 0; iSel < iNSel; iSel++) { BSel[iSel] = kFALSE; @@ -2669,11 +1940,9 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } for (Int_t iRpc = iR0; iRpc < iRl; iRpc++) iDutMul += fviClusterMul[fDutId][fDutSm][iRpc]; - LOG(debug) << "Selector 0: DutMul " - << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " - << iDutMul << ", BRefMul " << iBeamRefMul - << " TRef: " << dTRef << ", BeamAddRefMul " - << iBeamAddRefMul << ", " << fiBeamAddRefMul; + LOG(debug) << "Selector 0: DutMul " << fviClusterMul[fDutId][fDutSm][fDutRpc] << ", " << iDutMul + << ", BRefMul " << iBeamRefMul << " TRef: " << dTRef << ", BeamAddRefMul " << iBeamAddRefMul + << ", " << fiBeamAddRefMul; if (iDutMul > 0 && iDutMul < fiCluMulMax) { LOG(debug1) << "Found selector 0, NbHits " << iNbTofHits; @@ -2682,16 +1951,12 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (NULL == pHit) continue; Int_t iDetId = (pHit->GetAddress() & SelMask); - LOG(debug1) << Form(" Det 0x%08x, Dut 0x%08x, T %f, TTrig %f", - iDetId, - fDutAddr, - pHit->GetTime(), + LOG(debug1) << Form(" Det 0x%08x, Dut 0x%08x, T %f, TTrig %f", iDetId, fDutAddr, pHit->GetTime(), dTTrig[iSel]); //if( fDutId == CbmTofAddress::GetSmType( iDetId )) if (fDutAddr == iDetId) { if (pHit->GetTime() < dTTrig[iSel]) { - if (TMath::Abs(pBeamRef->GetTime() - pHit->GetTime()) - < fdDelTofMax) { + if (TMath::Abs(pBeamRef->GetTime() - pHit->GetTime()) < fdDelTofMax) { // < fhTRpcCluTOff[iIndexDut][iSel]->GetYaxis()->GetXmax()) { dTTrig[iSel] = pHit->GetTime(); pTrig[iSel] = pHit; @@ -2701,11 +1966,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } } if (BSel[iSel]) - LOG(debug) << Form( - "Found selector 0 with mul %d from 0x%08x at %f ", - iDutMul, - pTrig[iSel]->GetAddress(), - dTTrig[iSel]); + LOG(debug) << Form("Found selector 0 with mul %d from 0x%08x at %f ", iDutMul, + pTrig[iSel]->GetAddress(), dTTrig[iSel]); } break; @@ -2717,10 +1979,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } for (Int_t iRpc = iR0; iRpc < iRl; iRpc++) iRefMul += fviClusterMul[fSelId][fSelSm][iRpc]; - LOG(debug) - << "CbmTofEventClusterizer::FillHistos(): selector 1: RefMul " - << fviClusterMul[fSelId][fSelSm][fSelRpc] << ", " << iRefMul - << ", BRefMul " << iBeamRefMul; + LOG(debug) << "CbmTofEventClusterizer::FillHistos(): selector 1: RefMul " + << fviClusterMul[fSelId][fSelSm][fSelRpc] << ", " << iRefMul << ", BRefMul " << iBeamRefMul; if (iRefMul > 0 && iRefMul < fiCluMulMax) { LOG(debug1) << "CbmTofEventClusterizer::FillHistos(): Found " "selector 1, BeamRef at" @@ -2732,30 +1992,24 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Int_t iDetId = (pHit->GetAddress() & SelMask); if (fSelAddr == iDetId) { - LOG(debug1) - << "Check hit " << iHitInd << ", sel " << iSel - << ", t: " << pHit->GetTime() << ", TT " << dTTrig[iSel]; + LOG(debug1) << "Check hit " << iHitInd << ", sel " << iSel << ", t: " << pHit->GetTime() << ", TT " + << dTTrig[iSel]; if (pHit->GetTime() < dTTrig[iSel]) { - if (TMath::Abs(pBeamRef->GetTime() - pHit->GetTime()) - < fdDelTofMax) { + if (TMath::Abs(pBeamRef->GetTime() - pHit->GetTime()) < fdDelTofMax) { // < fhTRpcCluTOff[iIndexDut][iSel]->GetYaxis()->GetXmax()) { dTTrig[iSel] = pHit->GetTime(); pTrig[iSel] = pHit; BSel[iSel] = kTRUE; - LOG(debug1) << "Accept hit " << iHitInd << ", sel " - << iSel << ", t: " << pHit->GetTime() + LOG(debug1) << "Accept hit " << iHitInd << ", sel " << iSel << ", t: " << pHit->GetTime() << ", TT " << dTTrig[iSel]; } } } } if (BSel[iSel]) - LOG(debug) << Form( - "Found selector 1 with mul %d from 0x%08x at %f ", - iRefMul, - pTrig[iSel]->GetAddress(), - dTTrig[iSel]); + LOG(debug) << Form("Found selector 1 with mul %d from 0x%08x at %f ", iRefMul, + pTrig[iSel]->GetAddress(), dTTrig[iSel]); } break; @@ -2786,23 +2040,16 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Int_t iDetId = (pHit->GetAddress() & SelMask); if (fSel2Addr == iDetId) { Double_t dzscal = 1.; - if (fEnableMatchPosScaling) - dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); - Double_t dSEl2dXdz = (pHit->GetX() - pTrig[iSel]->GetX()) - / (pHit->GetZ() - pTrig[iSel]->GetZ()); - Double_t dSEl2dYdz = (pHit->GetY() - pTrig[iSel]->GetY()) - / (pHit->GetZ() - pTrig[iSel]->GetZ()); + if (fEnableMatchPosScaling) dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); + Double_t dSEl2dXdz = (pHit->GetX() - pTrig[iSel]->GetX()) / (pHit->GetZ() - pTrig[iSel]->GetZ()); + Double_t dSEl2dYdz = (pHit->GetY() - pTrig[iSel]->GetY()) / (pHit->GetZ() - pTrig[iSel]->GetZ()); if (iDetId == fiBeamRefAddr - || (TMath::Sqrt( - TMath::Power( - pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) - + TMath::Power( - pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) + || (TMath::Sqrt(TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) + + TMath::Power(pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) < fdCaldXdYMax)) { BSel[iSel] = kTRUE; - Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz - + dSEl2dYdz * dSEl2dYdz); + Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz + dSEl2dYdz * dSEl2dYdz); if (dX2Y2 < dSel2dXdYMin[iSel]) { ddXdZ[iSel] = dSEl2dXdz; ddYdZ[iSel] = dSEl2dYdz; @@ -2852,15 +2099,11 @@ Bool_t CbmTofEventClusterizer::FillHistos() { LOG(debug1) << "Generate trigger pattern"; UInt_t uTriggerPattern = 1; - if (NULL != fTrbHeader) - uTriggerPattern = fTrbHeader->GetTriggerPattern(); + if (NULL != fTrbHeader) uTriggerPattern = fTrbHeader->GetTriggerPattern(); else { for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - uTriggerPattern |= - (0x1 << (iSel * 3 - + CbmTofAddress::GetRpcId(pTrig[iSel]->GetAddress() - & DetMask))); + uTriggerPattern |= (0x1 << (iSel * 3 + CbmTofAddress::GetRpcId(pTrig[iSel]->GetAddress() & DetMask))); } } @@ -2869,9 +2112,7 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (BSel[iSel]) { if (dTRef != 0. && fTRefHits > 0) { for (UInt_t uChannel = 0; uChannel < 16; uChannel++) { - if (uTriggerPattern & (0x1 << uChannel)) { - fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); - } + if (uTriggerPattern & (0x1 << uChannel)) { fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); } } } } @@ -2888,9 +2129,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { LOG(debug1) << "Process Hit " << iHitInd << ", DetId " << iDetId; std::map<UInt_t, UInt_t>::iterator it = fDetIdIndexMap.find(iDetId); - if (it == fDetIdIndexMap.end()) - continue; // continue for invalid detector index - Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; + if (it == fDetIdIndexMap.end()) continue; // continue for invalid detector index + Int_t iDetIndx = it->second; //fDetIdIndexMap[iDetId]; Int_t iSmType = CbmTofAddress::GetSmType(iDetId); Int_t iSm = CbmTofAddress::GetSmId(iDetId); @@ -2900,41 +2140,29 @@ Bool_t CbmTofEventClusterizer::FillHistos() { for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { Double_t w = fviClusterMul[iSmType][iSm][iRpc]; - if (w == 0.) - w = 1.; + if (w == 0.) w = 1.; else w = 1. / w; - fhTRpcCluMul[iDetIndx][iSel]->Fill( - fviClusterMul[iSmType][iSm][iRpc], w); + fhTRpcCluMul[iDetIndx][iSel]->Fill(fviClusterMul[iSmType][iSm][iRpc], w); } } - if (fviClusterMul[iSmType][iSm][iRpc] > fiCluMulMax) - continue; // skip this event + if (fviClusterMul[iSmType][iSm][iRpc] > fiCluMulMax) continue; // skip this event if (iBeamRefMul == 0) break; Int_t iChId = pHit->GetAddress(); fChannelInfo = fDigiPar->GetCell(iChId); Int_t iCh = CbmTofAddress::GetChannelId(iChId); if (NULL == fChannelInfo) { - LOG(error) << "Invalid Channel Pointer for ChId " - << Form(" 0x%08x ", iChId) << ", Ch " << iCh; + LOG(error) << "Invalid Channel Pointer for ChId " << Form(" 0x%08x ", iChId) << ", Ch " << iCh; continue; } /*TGeoNode *fNode=*/ // prepare global->local trafo - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); LOG(debug1) << "Hit info: " - << Form(" 0x%08x %d %f %f %f %f %f %d", - iChId, - iCh, - pHit->GetX(), - pHit->GetY(), - pHit->GetTime(), - fChannelInfo->GetX(), - fChannelInfo->GetY(), - iHitInd); + << Form(" 0x%08x %d %f %f %f %f %f %d", iChId, iCh, pHit->GetX(), pHit->GetY(), pHit->GetTime(), + fChannelInfo->GetX(), fChannelInfo->GetY(), iHitInd); Double_t hitpos[3]; hitpos[0] = pHit->GetX(); @@ -2945,46 +2173,30 @@ Bool_t CbmTofEventClusterizer::FillHistos() { gGeoManager->MasterToLocal(hitpos, hitpos_local); LOG(debug1) << Form(" MasterToLocal for %d, %d%d%d, node %p: " "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)", - iDetIndx, - iSmType, - iSm, - iRpc, - cNode, - hitpos[0], - hitpos[1], - hitpos[2], - hitpos_local[0], - hitpos_local[1], - hitpos_local[2]); + iDetIndx, iSmType, iSm, iRpc, cNode, hitpos[0], hitpos[1], hitpos[2], hitpos_local[0], + hitpos_local[1], hitpos_local[2]); Bool_t bFillPos = kTRUE; //if( fCalMode/10 > 4 && pHit->GetClusterSize() < 3 ) bFillPos=kFALSE; if (bFillPos) { - fhRpcCluPosition[iDetIndx]->Fill( - (Double_t) iCh, - hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); - fhSmCluPosition[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), - hitpos_local[1]); + fhRpcCluPosition[iDetIndx]->Fill((Double_t) iCh, + hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); + fhSmCluPosition[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), hitpos_local[1]); } for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - fhTRpcCluPosition[iDetIndx][iSel]->Fill( - (Double_t) iCh, - hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); - fhTSmCluPosition[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), - hitpos_local[1]); + fhTRpcCluPosition[iDetIndx][iSel]->Fill((Double_t) iCh, + hitpos_local[1]); //pHit->GetY()-fChannelInfo->GetY()); + fhTSmCluPosition[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), hitpos_local[1]); } - if (TMath::Abs(hitpos_local[1]) > fChannelInfo->GetSizey() * fPosYMaxScal) - continue; + if (TMath::Abs(hitpos_local[1]) > fChannelInfo->GetSizey() * fPosYMaxScal) continue; Double_t dTimeAna = (pHit->GetTime() - StartAnalysisTime) / 1.E9; - if (dTRef != 0.) - fhRpcCluTimeEvol[iDetIndx]->Fill(dTimeAna, pHit->GetTime() - dTRef); + if (dTRef != 0.) fhRpcCluTimeEvol[iDetIndx]->Fill(dTimeAna, pHit->GetTime() - dTRef); fhRpcCluPositionEvol[iDetIndx]->Fill(dTimeAna, hitpos_local[1]); //LOG(info) << "Fill TEvol at " << dTimeAna ; - LOG(debug1) << " TofDigiMatchColl entries:" - << fTofDigiMatchColl->GetEntries(); + LOG(debug1) << " TofDigiMatchColl entries:" << fTofDigiMatchColl->GetEntries(); if (iHitInd > fTofDigiMatchColl->GetEntries()) { LOG(error) << " Inconsistent DigiMatches for Hitind " << iHitInd @@ -2992,36 +2204,27 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); - LOG(debug1) << " got " << digiMatch->GetNofLinks() << " matches for iCh " - << iCh << " at iHitInd " << iHitInd; + LOG(debug1) << " got " << digiMatch->GetNofLinks() << " matches for iCh " << iCh << " at iHitInd " << iHitInd; - fhRpcCluSize[iDetIndx]->Fill((Double_t) iCh, - digiMatch->GetNofLinks() / 2.); + fhRpcCluSize[iDetIndx]->Fill((Double_t) iCh, digiMatch->GetNofLinks() / 2.); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { - fhTRpcCluSize[iDetIndx][iSel]->Fill((Double_t) iCh, - digiMatch->GetNofLinks() / 2.); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + fhTRpcCluSize[iDetIndx][iSel]->Fill((Double_t) iCh, digiMatch->GetNofLinks() / 2.); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (size_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (size_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhTRpcCluSizeDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - digiMatch->GetNofLinks() / 2.); + fhTRpcCluSizeDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + digiMatch->GetNofLinks() / 2.); } } } Double_t TotSum = 0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink++) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink++) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); UInt_t iDigInd0 = L0.GetIndex(); // if (iDigInd0 < fTofCalDigisColl->GetEntries()){ if (iDigInd0 < fTofCalDigiVec->size()) { @@ -3040,17 +2243,14 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Double_t dzscal = 1.; //Double_t dDist=0.; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis + CbmLink L0 = digiMatch->GetLink(iLink); //vDigish.at(ivDigInd); UInt_t iDigInd0 = L0.GetIndex(); - UInt_t iDigInd1 = - (digiMatch->GetLink(iLink + 1)).GetIndex(); //vDigish.at(ivDigInd+1); + UInt_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); //vDigish.at(ivDigInd+1); //LOG(debug1)<<" " << iDigInd0<<", "<<iDigInd1; // if (iDigInd0 < fTofCalDigisColl->GetEntries() && iDigInd1 < fTofCalDigisColl->GetEntries()){ - if (iDigInd0 < fTofCalDigiVec->size() - && iDigInd1 < fTofCalDigiVec->size()) { + if (iDigInd0 < fTofCalDigiVec->size() && iDigInd1 < fTofCalDigiVec->size()) { // CbmTofDigi *pDig0 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd0)); // CbmTofDigi *pDig1 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd1)); CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); @@ -3058,26 +2258,16 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if ((Int_t) pDig0->GetType() != iSmType) { LOG(error) << Form(" Wrong Digi SmType for Tofhit %d in iDetIndx " "%d, Ch %d with %3.0f strips at Indx %d, %d", - iHitInd, - iDetIndx, - iCh, - dNstrips, - iDigInd0, - iDigInd1); + iHitInd, iDetIndx, iCh, dNstrips, iDigInd0, iDigInd1); } - LOG(debug1) << " fhRpcCluTot: Digi 0 " << iDigInd0 << ": Ch " - << pDig0->GetChannel() << ", Side " << pDig0->GetSide() - << ", StripSide " - << (Double_t) iCh * 2. + pDig0->GetSide() << " Digi 1 " - << iDigInd1 << ": Ch " << pDig1->GetChannel() << ", Side " - << pDig1->GetSide() << ", StripSide " - << (Double_t) iCh * 2. + pDig1->GetSide() << ", Tot0 " - << pDig0->GetTot() << ", Tot1 " << pDig1->GetTot(); - - fhRpcCluTot[iDetIndx]->Fill( - pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); - fhRpcCluTot[iDetIndx]->Fill( - pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); + LOG(debug1) << " fhRpcCluTot: Digi 0 " << iDigInd0 << ": Ch " << pDig0->GetChannel() << ", Side " + << pDig0->GetSide() << ", StripSide " << (Double_t) iCh * 2. + pDig0->GetSide() << " Digi 1 " + << iDigInd1 << ": Ch " << pDig1->GetChannel() << ", Side " << pDig1->GetSide() << ", StripSide " + << (Double_t) iCh * 2. + pDig1->GetSide() << ", Tot0 " << pDig0->GetTot() << ", Tot1 " + << pDig1->GetTot(); + + fhRpcCluTot[iDetIndx]->Fill(pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); + fhRpcCluTot[iDetIndx]->Fill(pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); Int_t iCh0 = pDig0->GetChannel(); Int_t iCh1 = pDig1->GetChannel(); @@ -3086,178 +2276,113 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (iCh0 != iCh1 || iS0 == iS1) { LOG(error) << Form(" MT2 for Tofhit %d in iDetIndx %d, Ch %d from " "in event %f, ", - iHitInd, - iDetIndx, - iCh, - fdEvent) - << Form(" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ", - iDigInd0, - iCh0, - iS0, - pDig0->GetTime()) - << Form(" Dig1: Ind %d, Ch %d, Side %d, T: %6.1f ", - iDigInd1, - iCh1, - iS1, - pDig1->GetTime()); + iHitInd, iDetIndx, iCh, fdEvent) + << Form(" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ", iDigInd0, iCh0, iS0, pDig0->GetTime()) + << Form(" Dig1: Ind %d, Ch %d, Side %d, T: %6.1f ", iDigInd1, iCh1, iS1, pDig1->GetTime()); continue; } if (0 > iCh0 || fDigiBdfPar->GetNbChan(iSmType, iRpc) <= iCh0) { - LOG(error) << Form( - " Wrong Digi for Tofhit %d in iDetIndx %d, Ch %d at Indx %d, %d " - "from %3.0f strips: %d, %d, %d, %d", - iHitInd, - iDetIndx, - iCh, - iDigInd0, - iDigInd1, - dNstrips, - iCh0, - iCh1, - iS0, - iS1); + LOG(error) << Form(" Wrong Digi for Tofhit %d in iDetIndx %d, Ch %d at Indx %d, %d " + "from %3.0f strips: %d, %d, %d, %d", + iHitInd, iDetIndx, iCh, iDigInd0, iDigInd1, dNstrips, iCh0, iCh1, iS0, iS1); continue; } - if ( - digiMatch->GetNofLinks() - > 2) //&& digiMatch->GetNofLinks()<8 ) // FIXME: hardcoded limits on CluSize + if (digiMatch->GetNofLinks() > 2) //&& digiMatch->GetNofLinks()<8 ) // FIXME: hardcoded limits on CluSize { dNstrips += 1.; - dMeanTimeSquared += TMath::Power( - 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime(), 2); + dMeanTimeSquared += TMath::Power(0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime(), 2); // fhRpcCluAvWalk[iDetIndx]->Fill(0.5*(pDig0->GetTot()+pDig1->GetTot()), // 0.5*(pDig0->GetTime()+pDig1->GetTime())-pHit->GetTime()); - fhRpcCluAvLnWalk[iDetIndx]->Fill( - TMath::Log10(0.5 * (pDig0->GetTot() + pDig1->GetTot())), - 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime()); + fhRpcCluAvLnWalk[iDetIndx]->Fill(TMath::Log10(0.5 * (pDig0->GetTot() + pDig1->GetTot())), + 0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime()); Double_t dTotWeigth = (pDig0->GetTot() + pDig1->GetTot()) / TotSum; Double_t dCorWeigth = 1. - dTotWeigth; fhRpcCluDelTOff[iDetIndx]->Fill( - pDig0->GetChannel(), - dCorWeigth - * (0.5 * (pDig0->GetTime() + pDig1->GetTime()) - - pHit->GetTime())); + pDig0->GetChannel(), dCorWeigth * (0.5 * (pDig0->GetTime() + pDig1->GetTime()) - pHit->GetTime())); - Double_t dDelPos = 0.5 * (pDig0->GetTime() - pDig1->GetTime()) - * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t dDelPos = 0.5 * (pDig0->GetTime() - pDig1->GetTime()) * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (0 == pDig0->GetSide()) dDelPos *= -1.; - fhRpcCluDelPos[iDetIndx]->Fill( - pDig0->GetChannel(), dCorWeigth * (dDelPos - hitpos_local[1])); + fhRpcCluDelPos[iDetIndx]->Fill(pDig0->GetChannel(), dCorWeigth * (dDelPos - hitpos_local[1])); fhRpcCluWalk[iDetIndx][iCh0][iS0]->Fill( pDig0->GetTot(), pDig0->GetTime() - (pHit->GetTime() - - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); fhRpcCluWalk[iDetIndx][iCh1][iS1]->Fill( pDig1->GetTot(), pDig1->GetTime() - (pHit->GetTime() - - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); - - fhRpcCluAvWalk[iDetIndx]->Fill( - pDig0->GetTot(), - pDig0->GetTime() - - (pHit->GetTime() - - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); - fhRpcCluAvWalk[iDetIndx]->Fill( - pDig1->GetTot(), - pDig1->GetTime() - - (pHit->GetTime() - - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + + fhRpcCluAvWalk[iDetIndx]->Fill(pDig0->GetTot(), pDig0->GetTime() + - (pHit->GetTime() + - (1. - 2. * pDig0->GetSide()) * hitpos_local[1] + / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); + fhRpcCluAvWalk[iDetIndx]->Fill(pDig1->GetTot(), pDig1->GetTime() + - (pHit->GetTime() + - (1. - 2. * pDig1->GetSide()) * hitpos_local[1] + / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc))); } // end of Clustersize > 1 condition - LOG(debug1) << " fhTRpcCluTot: Digi 0 " << iDigInd0 << ": Ch " - << pDig0->GetChannel() << ", Side " << pDig0->GetSide() - << ", StripSide " - << (Double_t) iCh * 2. + pDig0->GetSide() << " Digi 1 " - << iDigInd1 << ": Ch " << pDig1->GetChannel() << ", Side " - << pDig1->GetSide() << ", StripSide " + LOG(debug1) << " fhTRpcCluTot: Digi 0 " << iDigInd0 << ": Ch " << pDig0->GetChannel() << ", Side " + << pDig0->GetSide() << ", StripSide " << (Double_t) iCh * 2. + pDig0->GetSide() << " Digi 1 " + << iDigInd1 << ": Ch " << pDig1->GetChannel() << ", Side " << pDig1->GetSide() << ", StripSide " << (Double_t) iCh * 2. + pDig1->GetSide(); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { if (NULL == pHit || NULL == pTrig[iSel]) { - LOG(info) << " invalid pHit, iSel " << iSel << ", iDetIndx " - << iDetIndx; + LOG(info) << " invalid pHit, iSel " << iSel << ", iDetIndx " << iDetIndx; break; } if (pHit->GetAddress() == pTrig[iSel]->GetAddress()) continue; - fhTRpcCluTot[iDetIndx][iSel]->Fill( - pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); - fhTRpcCluTot[iDetIndx][iSel]->Fill( - pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + fhTRpcCluTot[iDetIndx][iSel]->Fill(pDig0->GetChannel() * 2. + pDig0->GetSide(), pDig0->GetTot()); + fhTRpcCluTot[iDetIndx][iSel]->Fill(pDig1->GetChannel() * 2. + pDig1->GetSide(), pDig1->GetTot()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (size_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (size_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - pDig0->GetTot()); - fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), - pDig1->GetTot()); + fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + pDig0->GetTot()); + fhTRpcCluTotDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(pHit->GetTime() - (*itL)->GetTime()), + pDig1->GetTot()); } } if (iLink == 0) { // Fill histo only once (for 1. digi entry) - if (fEnableMatchPosScaling) - dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); - fhTRpcCludXdY[iDetIndx][iSel]->Fill( - pHit->GetX() - dzscal * pTrig[iSel]->GetX(), - pHit->GetY() - dzscal * pTrig[iSel]->GetY()); + if (fEnableMatchPosScaling) dzscal = pHit->GetZ() / pTrig[iSel]->GetZ(); + fhTRpcCludXdY[iDetIndx][iSel]->Fill(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), + pHit->GetY() - dzscal * pTrig[iSel]->GetY()); dZsign[iSel] = 1.; if (pHit->GetZ() < pTrig[iSel]->GetZ()) dZsign[iSel] = -1.; } //// look for geometrical match with selector hit - if ( - iSmType - == fiBeamRefType // to get entries in diamond/BeamRef histos - || TMath::Sqrt( - TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), - 2.) - + TMath::Power(pHit->GetY() - dzscal * pTrig[iSel]->GetY(), - 2.)) - < fdCaldXdYMax) { + if (iSmType == fiBeamRefType // to get entries in diamond/BeamRef histos + || TMath::Sqrt(TMath::Power(pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) + + TMath::Power(pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) + < fdCaldXdYMax) { if (!fEnableMatchPosScaling && dSel2dXdYMin[iSel] < 1.E300) if (TMath::Sqrt( - TMath::Power( - pHit->GetX() - - (pTrig[iSel]->GetX() - + ddXdZ[iSel] - * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), - 2.) - + TMath::Power( - pHit->GetY() - - (pTrig[iSel]->GetY() - + ddYdZ[iSel] - * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), - 2.)) + TMath::Power(pHit->GetX() + - (pTrig[iSel]->GetX() + ddXdZ[iSel] * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), + 2.) + + TMath::Power(pHit->GetY() + - (pTrig[iSel]->GetY() + ddYdZ[iSel] * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), + 2.)) > 0.5 * fdCaldXdYMax) - continue; // refine position selection cut in cosmic measurement + continue; // refine position selection cut in cosmic measurement dTcor[iSel] = 0.; // precaution - if ( - dTRef != 0. - && TMath::Abs(dTRef - dTTrig[iSel]) - < fdDelTofMax) { // correct times for DelTof - velocity spread - if ( - iLink - == 0) { // do calculations only once (at 1. digi entry) // interpolate! + if (dTRef != 0. + && TMath::Abs(dTRef - dTTrig[iSel]) < fdDelTofMax) { // correct times for DelTof - velocity spread + if (iLink == 0) { // do calculations only once (at 1. digi entry) // interpolate! // calculate spatial distance to trigger hit /* dDist=TMath::Sqrt(TMath::Power(pHit->GetX()-pTrig[iSel]->GetX(),2.) @@ -3266,90 +2391,53 @@ Bool_t CbmTofEventClusterizer::FillHistos() { */ // determine correction value //if(fiBeamRefAddr != iDetId) // do not do this for reference counter itself - if (fTRefMode - < 11) // do not do this for trigger counter itself + if (fTRefMode < 11) // do not do this for trigger counter itself { Double_t dTentry = dTRef - dTTrig[iSel] + fdDelTofMax; - Int_t iBx = dTentry / 2. / fdDelTofMax * nbClDelTofBinX; + Int_t iBx = dTentry / 2. / fdDelTofMax * nbClDelTofBinX; if (iBx < 0) iBx = 0; if (iBx > nbClDelTofBinX - 1) iBx = nbClDelTofBinX - 1; Double_t dBinWidth = 2. * fdDelTofMax / nbClDelTofBinX; - Double_t dDTentry = - dTentry - ((Double_t) iBx) * dBinWidth; - Int_t iBx1 = 0; + Double_t dDTentry = dTentry - ((Double_t) iBx) * dBinWidth; + Int_t iBx1 = 0; dDTentry < 0 ? iBx1 = iBx - 1 : iBx1 = iBx + 1; Double_t w0 = 1. - TMath::Abs(dDTentry) / dBinWidth; Double_t w1 = 1. - w0; if (iBx1 < 0) iBx1 = 0; if (iBx1 > nbClDelTofBinX - 1) iBx1 = nbClDelTofBinX - 1; - dDelTof = - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * w0 - + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx1][iSel] - * w1; + dDelTof = fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * w0 + + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx1][iSel] * w1; //dDelTof *= dDist; // has to be consistent with fhTRpcCluDelTof filling - LOG(debug1) - << Form(" DelTof for SmT %d, Sm %d, R %d, T %d, dTRef " - "%6.1f, Bx %d, Bx1 %d, DTe %6.1f -> DelT %6.1f", - iSmType, - iSm, - iRpc, - iSel, - dTRef - dTTrig[iSel], - iBx, - iBx1, - dDTentry, - dDelTof); + LOG(debug1) << Form(" DelTof for SmT %d, Sm %d, R %d, T %d, dTRef " + "%6.1f, Bx %d, Bx1 %d, DTe %6.1f -> DelT %6.1f", + iSmType, iSm, iRpc, iSel, dTRef - dTTrig[iSel], iBx, iBx1, dDTentry, dDelTof); } dTTcor[iSel] = dDelTof * dZsign[iSel]; dTcor[iSel] = pHit->GetTime() - dDelTof - dTTrig[iSel]; // Double_t dAvTot=0.5*(pDig0->GetTot()+pDig1->GetTot()); (VF) not used } // if(iLink==0) if (dTcor[iSel] == 0.) continue; - LOG(debug) << Form( - " TRpcCluWalk for Ev %d, Link %d(%d), Sel %d, TSR %d%d%d, " - "Ch %d,%d, S %d,%d T %f, DelTof %6.1f, W-ent: %6.0f,%6.0f", - fiNevtBuild, - iLink, - (Int_t) digiMatch->GetNofLinks(), - iSel, - iSmType, - iSm, - iRpc, - iCh0, - iCh1, - iS0, - iS1, - dTTrig[iSel], - dDelTof, - fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries(), - fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()); + LOG(debug) << Form(" TRpcCluWalk for Ev %d, Link %d(%d), Sel %d, TSR %d%d%d, " + "Ch %d,%d, S %d,%d T %f, DelTof %6.1f, W-ent: %6.0f,%6.0f", + fiNevtBuild, iLink, (Int_t) digiMatch->GetNofLinks(), iSel, iSmType, iSm, iRpc, + iCh0, iCh1, iS0, iS1, dTTrig[iSel], dDelTof, + fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries(), + fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()); if (fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->GetEntries() != fhTRpcCluWalk[iDetIndx][iSel][iCh1][iS1]->GetEntries()) - LOG(error) - << Form(" Inconsistent walk histograms -> debugging " - "necessary ... for %d, %d, %d, %d, %d, %d, %d ", - fiNevtBuild, - iDetIndx, - iSel, - iCh0, - iCh1, - iS0, - iS1); + LOG(error) << Form(" Inconsistent walk histograms -> debugging " + "necessary ... for %d, %d, %d, %d, %d, %d, %d ", + fiNevtBuild, iDetIndx, iSel, iCh0, iCh1, iS0, iS1); LOG(debug1) << Form( - " TRpcCluWalk values side %d: %f, %f, side %d: %f, %f ", - iS0, - pDig0->GetTot(), + " TRpcCluWalk values side %d: %f, %f, side %d: %f, %f ", iS0, pDig0->GetTot(), pDig0->GetTime() - + ((1. - 2. * pDig0->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) + + ((1. - 2. * pDig0->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) - dTTcor[iSel] - dTTrig[iSel], - iS1, - pDig1->GetTot(), + iS1, pDig1->GetTot(), pDig1->GetTime() - + ((1. - 2. * pDig1->GetSide()) * hitpos_local[1] - / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) + + ((1. - 2. * pDig1->GetSide()) * hitpos_local[1] / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) - dTTcor[iSel] - dTTrig[iSel]); fhTRpcCluWalk[iDetIndx][iSel][iCh0][iS0]->Fill( @@ -3363,8 +2451,7 @@ Bool_t CbmTofEventClusterizer::FillHistos() { //dTcor[iSel]+(1.-2.*pDig1->GetSide())*hitpos_local[1]/fDigiBdfPar->GetSigVel(iSmType,iSm,iRpc)); dTcor[iSel]); - fhTRpcCluWalk2[iDetIndx][iSel]->Fill( - pDig0->GetTot(), pDig1->GetTot(), dTcor[iSel]); + fhTRpcCluWalk2[iDetIndx][iSel]->Fill(pDig0->GetTot(), pDig1->GetTot(), dTcor[iSel]); fhTRpcCluAvWalk[iDetIndx][iSel]->Fill( pDig0->GetTot(), @@ -3379,28 +2466,20 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (iLink == 0) { // Fill histo only once (for 1. digi entry) //fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef-dTTrig[iSel],dTcor[iSel]/dDist); - fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef - dTTrig[iSel], - dTcor[iSel]); - fhTSmCluTOff[iSmType][iSel]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), dTcor[iSel]); + fhTRpcCluDelTof[iDetIndx][iSel]->Fill(dTRef - dTTrig[iSel], dTcor[iSel]); + fhTSmCluTOff[iSmType][iSel]->Fill((Double_t)(iSm * iNbRpc + iRpc), dTcor[iSel]); fhTSmCluTRun[iSmType][iSel]->Fill(fdEvent, dTcor[iSel]); - if ( - iDetId - != (pTrig[iSel]->GetAddress() - & DetMask)) { // transform matched hit-pair back into detector frame - hitpos[0] = pHit->GetX() - dzscal * pTrig[iSel]->GetX() - + fChannelInfo->GetX(); - hitpos[1] = pHit->GetY() - dzscal * pTrig[iSel]->GetY() - + fChannelInfo->GetY(); + if (iDetId + != (pTrig[iSel]->GetAddress() + & DetMask)) { // transform matched hit-pair back into detector frame + hitpos[0] = pHit->GetX() - dzscal * pTrig[iSel]->GetX() + fChannelInfo->GetX(); + hitpos[1] = pHit->GetY() - dzscal * pTrig[iSel]->GetY() + fChannelInfo->GetY(); hitpos[2] = pHit->GetZ(); - gGeoManager->MasterToLocal( - hitpos, - hitpos_local); // transform into local frame - fhRpcCluDelMatPos[iDetIndx]->Fill((Double_t) iCh, - hitpos_local[1]); - fhRpcCluDelMatTOff[iDetIndx]->Fill( - (Double_t) iCh, - (pHit->GetTime() - dTTrig[iSel]) - dTTcor[iSel]); + gGeoManager->MasterToLocal(hitpos, + hitpos_local); // transform into local frame + fhRpcCluDelMatPos[iDetIndx]->Fill((Double_t) iCh, hitpos_local[1]); + fhRpcCluDelMatTOff[iDetIndx]->Fill((Double_t) iCh, + (pHit->GetTime() - dTTrig[iSel]) - dTTcor[iSel]); } } // iLink==0 condition end } // position condition end @@ -3408,12 +2487,11 @@ Bool_t CbmTofEventClusterizer::FillHistos() { } // closing of selector loop } // digi index range check condition end else { - LOG(error) - << "CbmTofEventClusterizer::FillHistos: invalid digi index " - << iDetIndx << " digi0,1" << iDigInd0 << ", " << iDigInd1 - << " - max:" - // << fTofCalDigisColl->GetEntries() - << fTofCalDigiVec->size() + LOG(error) << "CbmTofEventClusterizer::FillHistos: invalid digi index " << iDetIndx << " digi0,1" << iDigInd0 + << ", " << iDigInd1 + << " - max:" + // << fTofCalDigisColl->GetEntries() + << fTofCalDigiVec->size() // << " in event " << XXX ; } @@ -3426,53 +2504,38 @@ Bool_t CbmTofEventClusterizer::FillHistos() { Double_t dTrms = TMath::Sqrt(dVar); LOG(debug) << Form(" Trms for Tofhit %d in iDetIndx %d, Ch %d from " "%3.0f strips: %6.3f ns", - iHitInd, - iDetIndx, - iCh, - dNstrips, - dTrms); + iHitInd, iDetIndx, iCh, dNstrips, dTrms); fhRpcCluTrms[iDetIndx]->Fill((Double_t) iCh, dTrms); pHit->SetTimeError(dTrms); } LOG(debug1) << " Fill Time of iDetIndx " << iDetIndx << ", hitAddr " - << Form( - " %08x, y = %5.2f", pHit->GetAddress(), hitpos_local[1]) - << " for |y| <" + << Form(" %08x, y = %5.2f", pHit->GetAddress(), hitpos_local[1]) << " for |y| <" << fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax(); - if (TMath::Abs(hitpos_local[1]) - < (fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax())) { + if (TMath::Abs(hitpos_local[1]) < (fhRpcCluPosition[iDetIndx]->GetYaxis()->GetXmax())) { if (dTRef != 0. && fTRefHits == 1) { fhRpcCluTOff[iDetIndx]->Fill((Double_t) iCh, pHit->GetTime() - dTRef); - fhSmCluTOff[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), - pHit->GetTime() - dTRef); + fhSmCluTOff[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), pHit->GetTime() - dTRef); for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { LOG(debug1) << " TRpcCluTOff " << iDetIndx << ", Sel " << iSel - << Form(", Dt %7.3f, LHsize %lu ", - pHit->GetTime() - dTTrig[iSel], + << Form(", Dt %7.3f, LHsize %lu ", pHit->GetTime() - dTTrig[iSel], fvLastHits[iSmType][iSm][iRpc][iCh].size()); if (pHit->GetAddress() == pTrig[iSel]->GetAddress()) continue; - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; - for (size_t iH = 0; - iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; - iH++) { + for (size_t iH = 0; iH < fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1; iH++) { itL--; - LOG(debug1) - << Form(" %f,", pHit->GetTime() - (*itL)->GetTime()); + LOG(debug1) << Form(" %f,", pHit->GetTime() - (*itL)->GetTime()); } } // fill Time Offset histograms without velocity spread (DelTof) correction if (pBeamRef != NULL) - if (TMath::Abs(pBeamRef->GetTime() - pTrig[iSel]->GetTime()) - < fdDelTofMax) { + if (TMath::Abs(pBeamRef->GetTime() - pTrig[iSel]->GetTime()) < fdDelTofMax) { // if(TMath::Abs(pBeamRef->GetTime()-pTrig[iSel]->GetTime()) < fhTRpcCluTOff[iIndexDut][iSel]->GetYaxis()->GetXmax()) { /* if( iSmType==fiBeamRefType || @@ -3480,23 +2543,19 @@ Bool_t CbmTofEventClusterizer::FillHistos() { +TMath::Power(pHit->GetY()-dzscal*pTrig[iSel]->GetY(),2.))<fdCaldXdYMax * fhTRpcCluTOff[iIndexDut][iSel]->GetYaxis()->GetXmax()) */ - fhTRpcCluTOff[iDetIndx][iSel]->Fill( - (Double_t) iCh, - pHit->GetTime() - - dTTrig[iSel]); // -dTTcor[iSel] only valid for matches + fhTRpcCluTOff[iDetIndx][iSel]->Fill((Double_t) iCh, + pHit->GetTime() + - dTTrig[iSel]); // -dTTcor[iSel] only valid for matches if (digiMatch->GetNofLinks() > 0) - fhTRpcCluTofOff[iDetIndx][iSel]->Fill( - (Double_t) iCh, - pHit->GetTime() - - dTTrig[iSel]); // valid for beam experiments + fhTRpcCluTofOff[iDetIndx][iSel]->Fill((Double_t) iCh, + pHit->GetTime() + - dTTrig[iSel]); // valid for beam experiments // pHit->GetTime()-pBeamRef->GetTime()); // shift cluster time to beamcounter time // pHit->GetTime()-pBeamRef->GetTime()-fdToDAv*pTrig[iSel]->GetR());// valid for beam experiments } - if (fvLastHits[iSmType][iSm][iRpc][iCh].size() - > 1) { // check for previous hits in memory time interval - std::list<CbmTofHit*>::iterator itL = - fvLastHits[iSmType][iSm][iRpc][iCh].end(); + if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 1) { // check for previous hits in memory time interval + std::list<CbmTofHit*>::iterator itL = fvLastHits[iSmType][iSm][iRpc][iCh].end(); itL--; for (Int_t iH = 0; iH < 1; iH++) { // use only last hit // for(Int_t iH=0; iH<fvLastHits[iSmType][iSm][iRpc][iCh].size()-1; iH++){//fill for all memorized hits @@ -3505,18 +2564,12 @@ Bool_t CbmTofEventClusterizer::FillHistos() { if (dTsinceLast > fdMemoryTime) LOG(fatal) << Form("Invalid Time since last hit on channel " "TSRC %d%d%d%d: %f > %f", - iSmType, - iSm, - iRpc, - iCh, - dTsinceLast, - fdMemoryTime); - - fhTRpcCluTOffDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(dTsinceLast), pHit->GetTime() - dTTrig[iSel]); - fhTRpcCluMemMulDTLastHits[iDetIndx][iSel]->Fill( - TMath::Log10(dTsinceLast), - fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1); + iSmType, iSm, iRpc, iCh, dTsinceLast, fdMemoryTime); + + fhTRpcCluTOffDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(dTsinceLast), + pHit->GetTime() - dTTrig[iSel]); + fhTRpcCluMemMulDTLastHits[iDetIndx][iSel]->Fill(TMath::Log10(dTsinceLast), + fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1); } } } @@ -3527,46 +2580,31 @@ Bool_t CbmTofEventClusterizer::FillHistos() { for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { LOG(debug1) << "CbmTofEventClusterizer::FillHistos: " - << Form(" %3d %3d %3lu ", - iSmType, - iRpc, - fviClusterSize[iSmType][iRpc].size()); + << Form(" %3d %3d %3lu ", iSmType, iRpc, fviClusterSize[iSmType][iRpc].size()); - for (UInt_t uCluster = 0; - uCluster < fviClusterSize[iSmType][iRpc].size(); - uCluster++) { - LOG(debug2) << "CbmTofEventClusterizer::FillHistos: " - << Form(" %3d %3d %3d ", iSmType, iRpc, uCluster); + for (UInt_t uCluster = 0; uCluster < fviClusterSize[iSmType][iRpc].size(); uCluster++) { + LOG(debug2) << "CbmTofEventClusterizer::FillHistos: " << Form(" %3d %3d %3d ", iSmType, iRpc, uCluster); fhClusterSize->Fill(fviClusterSize[iSmType][iRpc][uCluster]); fhClusterSizeType->Fill(fviClusterSize[iSmType][iRpc][uCluster], - 40 * iSmType - + iRpc); //FIXME - hardwired constant - if (kFALSE) // kTRUE == fDigiBdfPar->ClustUseTrackId() ) + 40 * iSmType + iRpc); //FIXME - hardwired constant + if (kFALSE) // kTRUE == fDigiBdfPar->ClustUseTrackId() ) { fhTrackMul->Fill(fviTrkMul[iSmType][iRpc][uCluster]); - fhClusterSizeMulti->Fill(fviClusterSize[iSmType][iRpc][uCluster], - fviTrkMul[iSmType][iRpc][uCluster]); + fhClusterSizeMulti->Fill(fviClusterSize[iSmType][iRpc][uCluster], fviTrkMul[iSmType][iRpc][uCluster]); if (1 == fviTrkMul[iSmType][iRpc][uCluster]) - fhTrk1MulPos->Fill(fvdX[iSmType][iRpc][uCluster], - fvdY[iSmType][iRpc][uCluster]); + fhTrk1MulPos->Fill(fvdX[iSmType][iRpc][uCluster], fvdY[iSmType][iRpc][uCluster]); if (1 < fviTrkMul[iSmType][iRpc][uCluster]) - fhHiTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster], - fvdY[iSmType][iRpc][uCluster]); - fhAllTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster], - fvdY[iSmType][iRpc][uCluster]); + fhHiTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster], fvdY[iSmType][iRpc][uCluster]); + fhAllTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster], fvdY[iSmType][iRpc][uCluster]); } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() ) if (kFALSE) // 1 == fviTrkMul[iSmType][iRpc][uCluster] ) { - fhClustSizeDifX->Fill(fviClusterSize[iSmType][iRpc][uCluster], - fvdDifX[iSmType][iRpc][uCluster]); - fhClustSizeDifY->Fill(fviClusterSize[iSmType][iRpc][uCluster], - fvdDifY[iSmType][iRpc][uCluster]); + fhClustSizeDifX->Fill(fviClusterSize[iSmType][iRpc][uCluster], fvdDifX[iSmType][iRpc][uCluster]); + fhClustSizeDifY->Fill(fviClusterSize[iSmType][iRpc][uCluster], fvdDifY[iSmType][iRpc][uCluster]); if (1 == fviClusterSize[iSmType][iRpc][uCluster]) { - fhChDifDifX->Fill(fvdDifCh[iSmType][iRpc][uCluster], - fvdDifX[iSmType][iRpc][uCluster]); - fhChDifDifY->Fill(fvdDifCh[iSmType][iRpc][uCluster], - fvdDifY[iSmType][iRpc][uCluster]); + fhChDifDifX->Fill(fvdDifCh[iSmType][iRpc][uCluster], fvdDifX[iSmType][iRpc][uCluster]); + fhChDifDifY->Fill(fvdDifCh[iSmType][iRpc][uCluster], fvdDifY[iSmType][iRpc][uCluster]); } } } // for( UInt_t uCluster = 0; uCluster < fviClusterSize[iSmType][iRpc].size(); uCluster++ ) @@ -3585,7 +2623,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { return kTRUE; } -Bool_t CbmTofEventClusterizer::WriteHistos() { +Bool_t CbmTofEventClusterizer::WriteHistos() +{ if (fDutId < 0) return kTRUE; TDirectory* oldir = gDirectory; TFile* fHist; @@ -3611,8 +2650,7 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { LOG(debug) << "Write triggered Histos for Det Ind " << iDetIndx << Form(", UID 0x%08x", fDigiBdfPar->GetDetUId(iDetIndx)); - for (Int_t iSel = 0; iSel < iNSel; - iSel++) { // Save trigger selected histos + for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Save trigger selected histos if (NULL == fhTRpcCluMul[iDetIndx][iSel]) continue; // fhTRpcCluMul[iDetIndx][iSel]->Write(); // fhTRpcCluPosition[iDetIndx][iSel]->Write(); @@ -3632,7 +2670,8 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (fCalSel > -1) { if (NULL == fhTRpcCluAvWalk[iDetIndx][fCalSel]) continue; iNent = (Int_t) fhTRpcCluAvWalk[iDetIndx][fCalSel]->GetEntries(); - } else { + } + else { if (NULL == fhRpcCluAvWalk[iDetIndx]) continue; iNent = (Int_t) fhRpcCluAvWalk[iDetIndx]->GetEntries(); } @@ -3650,40 +2689,30 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { TH1* htempTOff_px = NULL; TProfile* hAvPos_pfx = NULL; TProfile* hAvTOff_pfx = NULL; - TH2* htempTOff = - NULL; // -> Comment to remove warning because set but never used - TH2* htempTot = NULL; - TProfile* htempTot_pfx = NULL; - TH1* htempTot_Mean = NULL; - TH1* htempTot_Off = NULL; + TH2* htempTOff = NULL; // -> Comment to remove warning because set but never used + TH2* htempTot = NULL; + TProfile* htempTot_pfx = NULL; + TH1* htempTot_Mean = NULL; + TH1* htempTot_Off = NULL; if (-1 < fCalSel) { - htempPos = fhRpcCluPosition - [iDetIndx]; // use untriggered distributions for position - htempPos_pfx = fhRpcCluPosition[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluPosition[iDetIndx]->GetNbinsY()); + htempPos = fhRpcCluPosition[iDetIndx]; // use untriggered distributions for position + htempPos_pfx = fhRpcCluPosition[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluPosition[iDetIndx]->GetNbinsY()); //htempPos = fhTRpcCluPosition[iDetIndx][fCalSel]; //htempPos_pfx = fhTRpcCluPosition[iDetIndx][fCalSel]->ProfileX("_pfx",1,fhTRpcCluPosition[iDetIndx][fCalSel]->GetNbinsY()); htempTOff = fhTRpcCluTOff[iDetIndx][fCalSel]; - if (fIdMode == 1) - htempTOff = - fhTRpcCluTofOff[iDetIndx][fCalSel]; //DEV! for init_calib_all - htempTOff_pfx = htempTOff->ProfileX( - "_pfx", 1, fhTRpcCluTOff[iDetIndx][fCalSel]->GetNbinsY()); - htempTOff_px = htempTOff->ProjectionX( - "_px", 1, fhTRpcCluTOff[iDetIndx][fCalSel]->GetNbinsY()); - for (Int_t iCh = 0; iCh < htempTOff->GetNbinsX(); - iCh++) { // use peak value to prevent out of update range + if (fIdMode == 1) htempTOff = fhTRpcCluTofOff[iDetIndx][fCalSel]; //DEV! for init_calib_all + htempTOff_pfx = htempTOff->ProfileX("_pfx", 1, fhTRpcCluTOff[iDetIndx][fCalSel]->GetNbinsY()); + htempTOff_px = htempTOff->ProjectionX("_px", 1, fhTRpcCluTOff[iDetIndx][fCalSel]->GetNbinsY()); + for (Int_t iCh = 0; iCh < htempTOff->GetNbinsX(); iCh++) { // use peak value to prevent out of update range TH1* htempTOff_py = htempTOff->ProjectionY("_py", iCh + 1, iCh + 1); Double_t Ymax = htempTOff_py->GetMaximum(); if (Ymax > 0.) { Int_t iBmax = htempTOff_py->GetMaximumBin(); Double_t dTOffmax = htempTOff_py->GetXaxis()->GetBinCenter(iBmax); - if (TMath::Abs(dTOffmax) - > 0.3 * htempTOff_py->GetXaxis()->GetXmax()) { - LOG(debug) << "Use Maximum of TOff in ch " << iCh << " of histo " - << htempTOff->GetName() << ": " << dTOffmax << ", " - << htempTOff_py->GetXaxis()->GetXmax() << " instead of " + if (TMath::Abs(dTOffmax) > 0.3 * htempTOff_py->GetXaxis()->GetXmax()) { + LOG(debug) << "Use Maximum of TOff in ch " << iCh << " of histo " << htempTOff->GetName() << ": " + << dTOffmax << ", " << htempTOff_py->GetXaxis()->GetXmax() << " instead of " << htempTOff_pfx->GetBinContent(iCh + 1); htempTOff_pfx->SetBinContent(iCh + 1, dTOffmax); htempTOff_pfx->SetBinEntries(iCh + 1, 1); @@ -3691,51 +2720,39 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { } } htempTot = fhTRpcCluTot[iDetIndx][fCalSel]; - htempTot_pfx = fhTRpcCluTot[iDetIndx][fCalSel]->ProfileX( - "_pfx", 1, fhTRpcCluTot[iDetIndx][fCalSel]->GetNbinsY()); - hAvPos_pfx = fhTSmCluPosition[iSmType][fCalSel]->ProfileX( - "_pfx", 1, fhTSmCluPosition[iSmType][fCalSel]->GetNbinsY()); - hAvTOff_pfx = fhTSmCluTOff[iSmType][fCalSel]->ProfileX( - "_pfx", 1, fhTSmCluTOff[iSmType][fCalSel]->GetNbinsY(), "s"); - } else // all triggers + htempTot_pfx = fhTRpcCluTot[iDetIndx][fCalSel]->ProfileX("_pfx", 1, fhTRpcCluTot[iDetIndx][fCalSel]->GetNbinsY()); + hAvPos_pfx = + fhTSmCluPosition[iSmType][fCalSel]->ProfileX("_pfx", 1, fhTSmCluPosition[iSmType][fCalSel]->GetNbinsY()); + hAvTOff_pfx = + fhTSmCluTOff[iSmType][fCalSel]->ProfileX("_pfx", 1, fhTSmCluTOff[iSmType][fCalSel]->GetNbinsY(), "s"); + } + else // all triggers { htempPos = fhRpcCluPosition[iDetIndx]; htempTot = fhRpcCluTot[iDetIndx]; - htempTot_pfx = fhRpcCluTot[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluTot[iDetIndx]->GetNbinsY()); - hAvPos_pfx = fhSmCluPosition[iSmType]->ProfileX( - "_pfx", 1, fhSmCluPosition[iSmType]->GetNbinsY()); - hAvTOff_pfx = fhSmCluTOff[iSmType]->ProfileX( - "_pfx", 1, fhSmCluTOff[iSmType]->GetNbinsY()); + htempTot_pfx = fhRpcCluTot[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluTot[iDetIndx]->GetNbinsY()); + hAvPos_pfx = fhSmCluPosition[iSmType]->ProfileX("_pfx", 1, fhSmCluPosition[iSmType]->GetNbinsY()); + hAvTOff_pfx = fhSmCluTOff[iSmType]->ProfileX("_pfx", 1, fhSmCluTOff[iSmType]->GetNbinsY()); switch (fCalSel) { case -1: // take corrections from untriggered distributions - htempPos_pfx = fhRpcCluPosition[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluPosition[iDetIndx]->GetNbinsY()); + htempPos_pfx = fhRpcCluPosition[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluPosition[iDetIndx]->GetNbinsY()); // htempTOff = fhRpcCluTOff[iDetIndx]; // -> Comment to remove warning because set but never used - htempTOff_pfx = fhRpcCluTOff[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluTOff[iDetIndx]->GetNbinsY(), "s"); - htempTOff_px = fhRpcCluTOff[iDetIndx]->ProjectionX( - "_px", 1, fhRpcCluTOff[iDetIndx]->GetNbinsY()); + htempTOff_pfx = fhRpcCluTOff[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluTOff[iDetIndx]->GetNbinsY(), "s"); + htempTOff_px = fhRpcCluTOff[iDetIndx]->ProjectionX("_px", 1, fhRpcCluTOff[iDetIndx]->GetNbinsY()); break; case -2: //take corrections from Cluster deviations - htempPos_pfx = fhRpcCluDelPos[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluDelPos[iDetIndx]->GetNbinsY()); + htempPos_pfx = fhRpcCluDelPos[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluDelPos[iDetIndx]->GetNbinsY()); // htempTOff = fhRpcCluDelTOff[iDetIndx]; // -> Comment to remove warning because set but never used - htempTOff_pfx = fhRpcCluDelTOff[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluDelTOff[iDetIndx]->GetNbinsY()); - htempTOff_px = fhRpcCluDelTOff[iDetIndx]->ProjectionX( - "_px", 1, fhRpcCluDelTOff[iDetIndx]->GetNbinsY()); + htempTOff_pfx = fhRpcCluDelTOff[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluDelTOff[iDetIndx]->GetNbinsY()); + htempTOff_px = fhRpcCluDelTOff[iDetIndx]->ProjectionX("_px", 1, fhRpcCluDelTOff[iDetIndx]->GetNbinsY()); break; case -3: // take corrections from deviations to matched trigger hit - htempPos_pfx = fhRpcCluDelMatPos[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluDelMatPos[iDetIndx]->GetNbinsY()); + htempPos_pfx = fhRpcCluDelMatPos[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluDelMatPos[iDetIndx]->GetNbinsY()); // htempTOff = fhRpcCluDelMatTOff[iDetIndx]; // -> Comment to remove warning because set but never used - htempTOff_pfx = fhRpcCluDelMatTOff[iDetIndx]->ProfileX( - "_pfx", 1, fhRpcCluDelMatTOff[iDetIndx]->GetNbinsY()); - htempTOff_px = fhRpcCluDelMatTOff[iDetIndx]->ProjectionX( - "_px", 1, fhRpcCluDelMatTOff[iDetIndx]->GetNbinsY()); + htempTOff_pfx = fhRpcCluDelMatTOff[iDetIndx]->ProfileX("_pfx", 1, fhRpcCluDelMatTOff[iDetIndx]->GetNbinsY()); + htempTOff_px = fhRpcCluDelMatTOff[iDetIndx]->ProjectionX("_px", 1, fhRpcCluDelMatTOff[iDetIndx]->GetNbinsY()); break; case -4: // shift all detectors without match requirement to beam counter times @@ -3743,10 +2760,10 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Int_t iCalSel = 0; htempPos_pfx = fhTRpcCluPosition[iDetIndx][iCalSel]->ProfileX( "_pfx", 1, fhTRpcCluPosition[iDetIndx][iCalSel]->GetNbinsY()); - htempTOff_pfx = fhTRpcCluTOff[iDetIndx][iCalSel]->ProfileX( - "_pfx", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY(), "s"); - htempTOff_px = fhTRpcCluTofOff[iDetIndx][iCalSel]->ProjectionX( - "_px", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY()); + htempTOff_pfx = + fhTRpcCluTOff[iDetIndx][iCalSel]->ProfileX("_pfx", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY(), "s"); + htempTOff_px = + fhTRpcCluTofOff[iDetIndx][iCalSel]->ProjectionX("_px", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY()); } break; case -5: // shift all detectors without match requirement to beam counter times @@ -3754,10 +2771,10 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Int_t iCalSel = 1; htempPos_pfx = fhTRpcCluPosition[iDetIndx][iCalSel]->ProfileX( "_pfx", 1, fhTRpcCluPosition[iDetIndx][iCalSel]->GetNbinsY()); - htempTOff_pfx = fhTRpcCluTOff[iDetIndx][iCalSel]->ProfileX( - "_pfx", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY(), "s"); - htempTOff_px = fhTRpcCluTofOff[iDetIndx][iCalSel]->ProjectionX( - "_px", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY()); + htempTOff_pfx = + fhTRpcCluTOff[iDetIndx][iCalSel]->ProfileX("_pfx", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY(), "s"); + htempTOff_px = + fhTRpcCluTofOff[iDetIndx][iCalSel]->ProjectionX("_px", 1, fhTRpcCluTofOff[iDetIndx][iCalSel]->GetNbinsY()); } break; } } @@ -3770,16 +2787,11 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Mean = htempTot_pfx->ProjectionX("_Mean"); htempTot_Off = htempTot_pfx->ProjectionX("_Off"); - htempPos_pfx->SetName( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); - htempTOff_pfx->SetName( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); - htempTot_pfx->SetName( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_pfx", iSmType, iSm, iRpc)); - htempTot_Mean->SetName( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); - htempTot_Off->SetName( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); + htempPos_pfx->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); + htempTOff_pfx->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc)); + htempTot_pfx->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_pfx", iSmType, iSm, iRpc)); + htempTot_Mean->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc)); + htempTot_Off->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc)); hAvPos_pfx->SetName(Form("cl_CorSmT%01d_Pos_pfx", iSmType)); hAvTOff_pfx->SetName(Form("cl_CorSmT%01d_TOff_pfx", iSmType)); @@ -3801,26 +2813,13 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Double_t Xmean = htempTot_Mean->GetBinContent(i + 1); if (Xmean < XOff) { LOG(warning) << "Inconsistent Tot numbers for " - << Form( - "SmT%01d_sm%03d_rpc%03d bin%d: mean %f, Off %f", - iSmType, - iSm, - iRpc, - i, - Xmean, - XOff); + << Form("SmT%01d_sm%03d_rpc%03d bin%d: mean %f, Off %f", iSmType, iSm, iRpc, i, Xmean, XOff); } htempTot_Mean->SetBinContent(i + 1, (Xmean - XOff)); if (htempTot_Mean->GetBinContent(i + 1) != (Xmean - XOff)) - LOG(warning) - << "Tot numbers not stored properly for " - << Form("SmT%01d_sm%03d_rpc%03d bin%d: mean %f, target %f", - iSmType, - iSm, - iRpc, - i, - htempTot_Mean->GetBinContent(i + 1), - Xmean - XOff); + LOG(warning) << "Tot numbers not stored properly for " + << Form("SmT%01d_sm%03d_rpc%03d bin%d: mean %f, target %f", iSmType, iSm, iRpc, i, + htempTot_Mean->GetBinContent(i + 1), Xmean - XOff); } htempPos_pfx->Write(); htempTOff_pfx->Write(); @@ -3833,40 +2832,32 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { { Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); - LOG(debug) - << "WriteHistos: restore Offsets and Gains and save Walk for " - << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc - << " and calSmAddr = " << Form(" 0x%08x ", TMath::Abs(fCalSmAddr)); + LOG(debug) << "WriteHistos: restore Offsets and Gains and save Walk for " + << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc + << " and calSmAddr = " << Form(" 0x%08x ", TMath::Abs(fCalSmAddr)); htempPos_pfx->Reset(); //reset to restore means of original histos htempTOff_pfx->Reset(); htempTot_Mean->Reset(); htempTot_Off->Reset(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) { - Double_t YMean = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); - Double_t TMean = 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t YMean = + fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 + * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t TMean = + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); htempPos_pfx->Fill(iCh, YMean); if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) { - LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh - << " got " << htempPos_pfx->GetBinContent(iCh) << "," - << htempPos_pfx->GetBinContent(iCh + 1) << "," - << htempPos_pfx->GetBinContent(iCh + 2) << ", expected " - << YMean; + LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh << " got " << htempPos_pfx->GetBinContent(iCh) + << "," << htempPos_pfx->GetBinContent(iCh + 1) << "," << htempPos_pfx->GetBinContent(iCh + 2) + << ", expected " << YMean; } htempTOff_pfx->Fill(iCh, TMean); for (Int_t iSide = 0; iSide < 2; iSide++) { htempTot_Mean->SetBinContent( iCh * 2 + 1 + iSide, - fdTTotMean - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh] - [iSide]); //nh +1 empirical(?) - htempTot_Off->SetBinContent( - iCh * 2 + 1 + iSide, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + fdTTotMean / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); //nh +1 empirical(?) + htempTot_Off->SetBinContent(iCh * 2 + 1 + iSide, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } } @@ -3882,57 +2873,45 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { TDirectory* curdir = gDirectory; gROOT->cd(); // TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); gDirectory->cd(curdir->GetPath()); if (NULL != hCorDelTof) { - TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* hCorDelTofout = + (TH1D*) hCorDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); hCorDelTofout->Write(); - } else { + } + else { LOG(debug) << " No CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); } } - if ( - (fCalSmAddr < 0 && TMath::Abs(fCalSmAddr) != iSmAddr) - || fCalSmAddr - == iSmAddr) // select detectors for determination of walk correction + if ((fCalSmAddr < 0 && TMath::Abs(fCalSmAddr) != iSmAddr) + || fCalSmAddr == iSmAddr) // select detectors for determination of walk correction { - LOG(debug) - << "WriteHistos: restore Offsets and Gains and update Walk for " - << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc - << " with " << fDigiBdfPar->GetNbChan(iSmType, iRpc) << " channels"; - for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); - iCh++) { + LOG(debug) << "WriteHistos: restore Offsets and Gains and update Walk for " + << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc << " with " + << fDigiBdfPar->GetNbChan(iSmType, iRpc) << " channels"; + for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) { TH2* h2tmp0; TH2* h2tmp1; if (!fEnableAvWalk) { if (-1 < fCalSel) { h2tmp0 = fhTRpcCluWalk[iDetIndx][fCalSel][iCh][0]; h2tmp1 = fhTRpcCluWalk[iDetIndx][fCalSel][iCh][1]; - } else { // take correction from deviation within clusters + } + else { // take correction from deviation within clusters h2tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]; h2tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]; } - } else { // go for averages (low statistics) + } + else { // go for averages (low statistics) if (-1 < fCalSel) { h2tmp0 = fhTRpcCluAvWalk[iDetIndx][fCalSel]; h2tmp1 = fhTRpcCluAvWalk[iDetIndx][fCalSel]; - } else { // take correction from deviation within clusters + } + else { // take correction from deviation within clusters h2tmp0 = fhRpcCluAvWalk[iDetIndx]; h2tmp1 = fhRpcCluAvWalk[iDetIndx]; } @@ -3940,36 +2919,24 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (NULL == h2tmp0) { LOG(debug) << Form("WriteHistos: Walk histo not available for " "SmT %d, Sm %d, Rpc %d, Ch %d", - iSmType, - iSm, - iRpc, - iCh); + iSmType, iSm, iRpc, iCh); continue; } Int_t iNEntries = h2tmp0->GetEntries(); if (iCh == 0) // condition to print message only once LOG(debug) << Form(" Update Walk correction for SmT %d, Sm %d, " "Rpc %d, Ch %d, Sel%d: Entries %d", - iSmType, - iSm, - iRpc, - iCh, - fCalSel, - iNEntries); + iSmType, iSm, iRpc, iCh, fCalSel, iNEntries); // h2tmp0->Write(); // h2tmp1->Write(); if (-1 < iNEntries) { // always done - TProfile* htmp0 = - h2tmp0->ProfileX("_pfx", 1, h2tmp0->GetNbinsY()); - TProfile* htmp1 = - h2tmp1->ProfileX("_pfx", 1, h2tmp1->GetNbinsY()); - TH1D* h1tmp0 = h2tmp0->ProjectionX("_px", 1, h2tmp0->GetNbinsY()); - TH1D* h1tmp1 = h2tmp1->ProjectionX("_px", 1, h2tmp1->GetNbinsY()); - TH1D* h1ytmp0 = - h2tmp0->ProjectionY("_py", - 1, - nbClWalkBinX); // preserve means + TProfile* htmp0 = h2tmp0->ProfileX("_pfx", 1, h2tmp0->GetNbinsY()); + TProfile* htmp1 = h2tmp1->ProfileX("_pfx", 1, h2tmp1->GetNbinsY()); + TH1D* h1tmp0 = h2tmp0->ProjectionX("_px", 1, h2tmp0->GetNbinsY()); + TH1D* h1tmp1 = h2tmp1->ProjectionX("_px", 1, h2tmp1->GetNbinsY()); + TH1D* h1ytmp0 = h2tmp0->ProjectionY("_py", 1, + nbClWalkBinX); // preserve means TH1D* h1ytmp1 = h2tmp1->ProjectionY("_py", 1, nbClWalkBinX); Double_t dWMean0 = h1ytmp0->GetMean(); Double_t dWMean1 = h1ytmp1->GetMean(); @@ -3977,74 +2944,46 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Int_t iWalkUpd = 2; // Walk update mode flag //if(5==iSmType || 8==iSmType || 2==iSmType) iWalkUpd=0; // keep both sides consistent for diamonds and pads if (5 == iSmType || 8 == iSmType) - iWalkUpd = - 0; // keep both sides consistent for diamonds and pads (Cern2016) + iWalkUpd = 0; // keep both sides consistent for diamonds and pads (Cern2016) for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { switch (iWalkUpd) { case 0: - if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin - && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { + if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { // preserve y - position (difference) on average Double_t dWcor = - (((TProfile*) htmp0)->GetBinContent(iWx + 1) - + ((TProfile*) htmp1)->GetBinContent(iWx + 1)) + (((TProfile*) htmp0)->GetBinContent(iWx + 1) + ((TProfile*) htmp1)->GetBinContent(iWx + 1)) * 0.5; - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += - dWcor - dWMean; - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += - dWcor - dWMean; - LOG(debug) << Form( - "Walk for TSR %d%d%d%d Tot %d set to %f", - iSmType, - iSm, - iRpc, - iCh, - iWx, - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += dWcor - dWMean; + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += dWcor - dWMean; + LOG(debug) << Form("Walk for TSR %d%d%d%d Tot %d set to %f", iSmType, iSm, iRpc, iCh, iWx, + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); } break; case 1: - if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin - && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { - Double_t dWcor0 = - ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0; - Double_t dWcor1 = - ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1; - Double_t dWcor = 0.5 * (dWcor0 + dWcor1); - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += - dWcor; //-dWMean0; - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += - dWcor; //-dWMean1; - - if (iCh == 0 && iSmType == 9 && iSm == 0 - && h1tmp0->GetBinContent(iWx + 1) > WalkNHmin) - LOG(debug) - << "Update Walk Sm = " << iSm << "(" << iNbRpc - << "), Rpc " << iRpc << ", Bin " << iWx << ", " - << h1tmp0->GetBinContent(iWx + 1) << " cts: " - << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] - << " + " - << ((TProfile*) htmp0)->GetBinContent(iWx + 1) - << " - " << dWMean0 << " -> " << dWcor - dWMean0 - << ", S1: " - << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] - << " + " - << ((TProfile*) htmp1)->GetBinContent(iWx + 1) - << " - " << dWMean1 << " -> " << dWcor - dWMean1; + if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { + Double_t dWcor0 = ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0; + Double_t dWcor1 = ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1; + Double_t dWcor = 0.5 * (dWcor0 + dWcor1); + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += dWcor; //-dWMean0; + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += dWcor; //-dWMean1; + + if (iCh == 0 && iSmType == 9 && iSm == 0 && h1tmp0->GetBinContent(iWx + 1) > WalkNHmin) + LOG(debug) << "Update Walk Sm = " << iSm << "(" << iNbRpc << "), Rpc " << iRpc << ", Bin " + << iWx << ", " << h1tmp0->GetBinContent(iWx + 1) + << " cts: " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] << " + " + << ((TProfile*) htmp0)->GetBinContent(iWx + 1) << " - " << dWMean0 << " -> " + << dWcor - dWMean0 << ", S1: " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] + << " + " << ((TProfile*) htmp1)->GetBinContent(iWx + 1) << " - " << dWMean1 << " -> " + << dWcor - dWMean1; } break; case 2: - if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin - && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { - Double_t dWcor0 = - ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0; - Double_t dWcor1 = - ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1; + if (h1tmp0->GetBinContent(iWx + 1) > WalkNHmin && h1tmp1->GetBinContent(iWx + 1) > WalkNHmin) { + Double_t dWcor0 = ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0; + Double_t dWcor1 = ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1; //Double_t dWcor = 0.5*(dWcor0 + dWcor1); - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += - dWcor0; - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += - dWcor1; + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] += dWcor0; + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] += dWcor1; } break; @@ -4054,97 +2993,57 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { h1tmp0->Reset(); h1tmp1->Reset(); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); Int_t iTry = 3; - while ( - iTry-- > 0 - && h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - h1tmp0->SetBinContent( - iWx + 1, - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + while (iTry-- > 0 + && h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); } if (iTry == 0) - LOG(error) - << "writing not successful for " << h1tmp0->GetName() - << ", attempts left: " << iTry << ", iWx " << iWx - << ", got " << h1tmp0->GetBinContent(iWx + 1) - << ", expected " - << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; + LOG(error) << "writing not successful for " << h1tmp0->GetName() << ", attempts left: " << iTry + << ", iWx " << iWx << ", got " << h1tmp0->GetBinContent(iWx + 1) << ", expected " + << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; iTry = 3; - while ( - iTry-- > 0 - && h1tmp1->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]) { - h1tmp1->SetBinContent( - iWx + 1, - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + while (iTry-- > 0 + && h1tmp1->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]) { + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); } if (iTry == 0) - LOG(error) - << "writing not successful for " << h1tmp1->GetName() - << ", attempts left: " << iTry << ", iWx " << iWx - << ", got " << h1tmp1->GetBinContent(iWx + 1) - << ", expected " - << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]; + LOG(error) << "writing not successful for " << h1tmp1->GetName() << ", attempts left: " << iTry + << ", iWx " << iWx << ", got " << h1tmp1->GetBinContent(iWx + 1) << ", expected " + << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]; } - h1tmp0->SetName( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); h1tmp0->Smooth(iNWalkSmooth); h1tmp0->Write(); - h1tmp1->SetName( - Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); h1tmp1->Smooth(iNWalkSmooth); h1tmp1->Write(); } } - } else { // preserve whatever is there for fCalSmAddr ! - for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); - iCh++) // restore old values + } + else { // preserve whatever is there for fCalSmAddr ! + for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) // restore old values { // TProfile *htmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used // TProfile *htmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used - TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX( - "_px", 1, nbClWalkBinY); - TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX( - "_px", 1, nbClWalkBinY); + TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); - if (h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - LOG(error) - << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " - << h1tmp0->GetBinContent(iWx + 1) << ", expected " - << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + if (h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " + << h1tmp0->GetBinContent(iWx + 1) << ", expected " + << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; } } - h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp0->Write(); h1tmp0->Write(); - h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp1->Write(); h1tmp1->Write(); } @@ -4156,30 +3055,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); - if ((fCalSmAddr < 0) - || (fCalSmAddr - != iSmAddr)) { // select detectors for updating offsets + if ((fCalSmAddr < 0) || (fCalSmAddr != iSmAddr)) { // select detectors for updating offsets LOG(debug) << "WriteHistos: (case 2) update Offsets and keep Gains, " "Walk and DELTOF for " - << Form(" 0x%08x ", TMath::Abs(fCalSmAddr)) << "Smtype" - << iSmType << ", Sm " << iSm << ", Rpc " << iRpc; + << Form(" 0x%08x ", TMath::Abs(fCalSmAddr)) << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " + << iRpc; Int_t iB = iSm * iNbRpc + iRpc; Double_t dVscal = 1.; if (0) //NULL != fhSmCluSvel[iSmType]) - dVscal = - fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1); + dVscal = fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1); if (dVscal == 0.) dVscal = 1.; - Double_t YMean = ((TProfile*) hAvPos_pfx) - ->GetBinContent(iB + 1); //nh +1 empirical(?) - htempPos_py = - htempPos->ProjectionY(Form("%s_py", htempPos->GetName()), 1, iNbCh); + Double_t YMean = ((TProfile*) hAvPos_pfx)->GetBinContent(iB + 1); //nh +1 empirical(?) + htempPos_py = htempPos->ProjectionY(Form("%s_py", htempPos->GetName()), 1, iNbCh); if (htempPos_py->GetEntries() > fdYFitMin && fPosYMaxScal < 1.1) { - LOG(debug1) << Form("Determine YMean in %s by fit to %d entries", - htempPos->GetName(), + LOG(debug1) << Form("Determine YMean in %s by fit to %d entries", htempPos->GetName(), (Int_t) htempPos_py->GetEntries()); - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, 0); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, 0); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { @@ -4189,42 +3081,27 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { fit_ybox(htempPos_py, fChannelInfo->GetSizey()); TF1* ff = htempPos_py->GetFunction("YBox"); if (NULL != ff) { - LOG(info) << "FRes YBox " << htempPos_py->GetEntries() - << " entries in TSR " << iSmType << iSm << iRpc + LOG(info) << "FRes YBox " << htempPos_py->GetEntries() << " entries in TSR " << iSmType << iSm << iRpc << ", chi2 " << ff->GetChisquare() / ff->GetNDF() - << Form( - ", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos " - "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", - fChannelInfo->GetSizey(), - dVscal, - 2. * ff->GetParameter(1), - 2. * ff->GetParError(1), - ff->GetParameter(2), - ff->GetParError(2), - ff->GetParameter(3), - ff->GetParError(3)); - - if (TMath::Abs(fChannelInfo->GetSizey() - - 2. * ff->GetParameter(1)) - / fChannelInfo->GetSizey() - < 0.2 + << Form(", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos " + "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", + fChannelInfo->GetSizey(), dVscal, 2. * ff->GetParameter(1), 2. * ff->GetParError(1), + ff->GetParameter(2), ff->GetParError(2), ff->GetParameter(3), ff->GetParError(3)); + + if (TMath::Abs(fChannelInfo->GetSizey() - 2. * ff->GetParameter(1)) / fChannelInfo->GetSizey() < 0.2 && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) < 0.2) // && ff->GetChisquare() < 500.) //FIXME - constants! { - if (TMath::Abs(ff->GetParameter(3) - YMean) - < 0.5 * fChannelInfo->GetSizey()) { + if (TMath::Abs(ff->GetParameter(3) - YMean) < 0.5 * fChannelInfo->GetSizey()) { YMean = ff->GetParameter(3); - Double_t dV = dVscal * fChannelInfo->GetSizey() - / (2. * ff->GetParameter(1)); - fhSmCluSvel[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), - dV); + Double_t dV = dVscal * fChannelInfo->GetSizey() / (2. * ff->GetParameter(1)); + fhSmCluSvel[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), dV); } } } } - TH1* hAvTOff_py = - fhSmCluTOff[iSmType]->ProjectionY("_py", iB + 1, iB + 1); + TH1* hAvTOff_py = fhSmCluTOff[iSmType]->ProjectionY("_py", iB + 1, iB + 1); Double_t Ymax = hAvTOff_py->GetMaximum(); Double_t dTOffmax = 0.; if (Ymax > 0.) { @@ -4234,22 +3111,16 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Double_t TMean = ((TProfile*) hAvTOff_pfx)->GetBinContent(iB + 1); if (TMath::Abs(dTOffmax - TMean) > 2. * TMean) { TMean = dTOffmax; - LOG(debug) << "Use peak position for TOff of TSR " << iSmType << iSm - << iRpc << ", B= " << iB << ": " << TMean; + LOG(debug) << "Use peak position for TOff of TSR " << iSmType << iSm << iRpc << ", B= " << iB << ": " + << TMean; } Double_t TWidth = ((TProfile*) hAvTOff_pfx)->GetBinError(iB + 1); Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); - if (fiBeamRefAddr == iUniqueId) - TMean = 0.; // don't shift reference counter + if (fiBeamRefAddr == iUniqueId) TMean = 0.; // don't shift reference counter LOG(debug) << Form("<ICor> Correct TSR %d%d%d by TMean=%8.2f, " "TYOff=%8.2f, TWidth=%8.2f, ", - iSmType, - iSm, - iRpc, - TMean, - dTYOff, - TWidth); + iSmType, iSm, iRpc, TMean, dTYOff, TWidth); for (Int_t iCh = 0; iCh < iNbCh; iCh++) // update Offset and Gain { @@ -4257,15 +3128,12 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean; LOG(debug) << "FillCalHist:" - << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc - << " Ch " << iCh << ": YMean " << YMean << ", TMean " - << TMean << " -> " - << Form( - " %f, %f, %f, %f ", - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc << " Ch " << iCh << ": YMean " << YMean + << ", TMean " << TMean << " -> " + << Form(" %f, %f, %f, %f ", fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ ) } htempPos_pfx->Reset(); //reset to store new values @@ -4274,31 +3142,24 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Off->Reset(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) // store new values { - Double_t YMean = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); - Double_t TMean = 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t YMean = + fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 + * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t TMean = + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); htempPos_pfx->Fill(iCh, YMean); if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) { - LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh - << " got " << htempPos_pfx->GetBinContent(iCh) << "," - << htempPos_pfx->GetBinContent(iCh + 1) << "," - << htempPos_pfx->GetBinContent(iCh + 2) << ", expected " - << YMean; + LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh << " got " << htempPos_pfx->GetBinContent(iCh) + << "," << htempPos_pfx->GetBinContent(iCh + 1) << "," << htempPos_pfx->GetBinContent(iCh + 2) + << ", expected " << YMean; } htempTOff_pfx->Fill(iCh, TMean); for (Int_t iSide = 0; iSide < 2; iSide++) { htempTot_Mean->SetBinContent( iCh * 2 + 1 + iSide, - fdTTotMean - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh] - [iSide]); //nh +1 empirical(?) - htempTot_Off->SetBinContent( - iCh * 2 + 1 + iSide, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + fdTTotMean / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); //nh +1 empirical(?) + htempTot_Off->SetBinContent(iCh * 2 + 1 + iSide, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ ) @@ -4310,35 +3171,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Off->Write(); // store old DELTOF histos - LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() - << " to file "; + LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() << " to file "; for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Store DelTof corrections TDirectory* curdir = gDirectory; gROOT->cd(); // TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); gDirectory->cd(curdir->GetPath()); if (NULL != hCorDelTof) { - TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* hCorDelTofout = + (TH1D*) hCorDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); hCorDelTofout->Write(); - } else { + } + else { LOG(debug) << " No CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); } } @@ -4347,35 +3196,21 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { { // TProfile *htmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used // TProfile *htmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used - TH1D* h1tmp0 = - fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); - TH1D* h1tmp1 = - fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); - if (h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx - << " got " << h1tmp0->GetBinContent(iWx + 1) - << ", expected " + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + if (h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " + << h1tmp0->GetBinContent(iWx + 1) << ", expected " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; } } - h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp0->Write(); h1tmp0->Write(); - h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp1->Write(); h1tmp1->Write(); } @@ -4385,14 +3220,11 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { { Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); - if ((fCalSmAddr < 0) - || (fCalSmAddr - != iSmAddr)) { // select detectors for updating offsets + 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)) << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " + << iRpc << " with " << iNbCh << " channels " << " using selector " << fCalSel; /* Double_t dTRefMean=0.; @@ -4404,28 +3236,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Double_t dVW = 1.; if (0) // NULL != fhSmCluSvel[iSmType]) { - dVscal = - fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1); + dVscal = fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1); if (dVscal == 0.) dVscal = 1.; - dVW = fhSmCluSvel[iSmType]->GetBinEffectiveEntries(iSm * iNbRpc - + iRpc + 1); + dVW = fhSmCluSvel[iSmType]->GetBinEffectiveEntries(iSm * iNbRpc + iRpc + 1); dVW *= 50.; //(Double_t)iNbCh; if (dVW < 0.1) dVW = 0.1; } // determine average values - htempPos_py = - htempPos->ProjectionY(Form("%s_py", htempPos->GetName()), 1, iNbCh); + htempPos_py = htempPos->ProjectionY(Form("%s_py", htempPos->GetName()), 1, iNbCh); Double_t dYMeanAv = 0.; Double_t dYMeanFit = 0.; Double_t dYLenFit = 0.; if (htempPos_py->GetEntries() > fdYFitMin && fPosYMaxScal < 1.1) { dYMeanAv = htempPos_py->GetMean(); - LOG(debug1) << Form("Determine YMeanAv in %s by fit to %d entries", - htempPos->GetName(), + LOG(debug1) << Form("Determine YMeanAv in %s by fit to %d entries", htempPos->GetName(), (Int_t) htempPos_py->GetEntries()); - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, 0); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, 0); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { @@ -4435,88 +3262,54 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { fit_ybox(htempPos_py, fChannelInfo->GetSizey()); TF1* ff = htempPos_py->GetFunction("YBox"); if (NULL != ff) { - if (TMath::Abs(fChannelInfo->GetSizey() - - 2. * ff->GetParameter(1)) - / fChannelInfo->GetSizey() - < 0.2 - && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) - < 0.2) { - Double_t dV = dVscal * fChannelInfo->GetSizey() - / (2. * ff->GetParameter(1)); - LOG(info) << "FAvRes YBox " << htempPos_py->GetEntries() - << " entries in TSR " << iSmType << iSm << iRpc + if (TMath::Abs(fChannelInfo->GetSizey() - 2. * ff->GetParameter(1)) / fChannelInfo->GetSizey() < 0.2 + && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) < 0.2) { + Double_t dV = dVscal * fChannelInfo->GetSizey() / (2. * ff->GetParameter(1)); + LOG(info) << "FAvRes YBox " << htempPos_py->GetEntries() << " entries in TSR " << iSmType << iSm << iRpc << ", stat: " << gMinuit->fCstatu << Form(", chi2 %6.2f, striplen (%5.2f): " "%7.2f+/-%5.2f, pos res " "%5.2f+/-%5.2f at y_cen = %5.2f+/-%5.2f", - ff->GetChisquare() / ff->GetNDF(), - fChannelInfo->GetSizey(), - 2. * ff->GetParameter(1), - 2. * ff->GetParError(1), - ff->GetParameter(2), - ff->GetParError(2), - ff->GetParameter(3), + ff->GetChisquare() / ff->GetNDF(), fChannelInfo->GetSizey(), 2. * ff->GetParameter(1), + 2. * ff->GetParError(1), ff->GetParameter(2), ff->GetParError(2), ff->GetParameter(3), ff->GetParError(3)); - if (TMath::Abs(ff->GetParameter(3) - dYMeanAv) - < 0.5 * fChannelInfo->GetSizey()) { + if (TMath::Abs(ff->GetParameter(3) - dYMeanAv) < 0.5 * fChannelInfo->GetSizey()) { dYMeanFit = ff->GetParameter(3); dYLenFit = 2. * ff->GetParameter(1); - fhSmCluSvel[iSmType]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), dV, dVW); + fhSmCluSvel[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), dV, dVW); for (Int_t iPar = 0; iPar < 4; iPar++) - fhSmCluFpar[iSmType][iPar]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), - ff->GetParameter(2 + iPar)); + fhSmCluFpar[iSmType][iPar]->Fill((Double_t)(iSm * iNbRpc + iRpc), ff->GetParameter(2 + iPar)); } - } else { - LOG(info) - << "FAvBad YBox " << htempPos_py->GetEntries() - << " entries in " << iSmType << iSm << iRpc << ", chi2 " - << ff->GetChisquare() - << Form(", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos res " - "%5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", - fChannelInfo->GetSizey(), - dVscal, - 2. * ff->GetParameter(1), - 2. * ff->GetParError(1), - ff->GetParameter(2), - ff->GetParError(2), - ff->GetParameter(3), - ff->GetParError(3)); } - } else { + else { + LOG(info) << "FAvBad YBox " << htempPos_py->GetEntries() << " entries in " << iSmType << iSm << iRpc + << ", chi2 " << ff->GetChisquare() + << Form(", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos res " + "%5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", + fChannelInfo->GetSizey(), dVscal, 2. * ff->GetParameter(1), 2. * ff->GetParError(1), + ff->GetParameter(2), ff->GetParError(2), ff->GetParameter(3), ff->GetParError(3)); + } + } + else { LOG(info) << "FAvFailed for TSR " << iSmType << iSm << iRpc; } } Double_t dYShift = dYMeanFit - dYMeanAv; - Double_t TWMean = - 0.; // weighted mean of all BeamRef counter channels - LOG(info) << Form( - "CalibY for TSR %d%d%d: DY %5.2f, Fit %5.2f, Av %5.2f ", - iSmType, - iSm, - iRpc, - dYShift, - dYMeanFit, - dYMeanAv); + Double_t TWMean = 0.; // weighted mean of all BeamRef counter channels + LOG(info) << 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 + Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1); //set default YMean += dYShift; if (fPosYMaxScal < 1.1) { //disable by adding "-" sign - htempPos_py = htempPos->ProjectionY( - Form("%s_py%02d", htempPos->GetName(), iCh), iCh + 1, iCh + 1); + htempPos_py = htempPos->ProjectionY(Form("%s_py%02d", htempPos->GetName(), iCh), iCh + 1, iCh + 1); if (htempPos_py->GetEntries() > fdYFitMin) { LOG(debug1) << Form("Determine YMean in %s of channel %d by " "length fit with %6.3f to %d entries", - htempPos->GetName(), - iCh, - dYLenFit, - (Int_t) htempPos_py->GetEntries()); - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + htempPos->GetName(), iCh, dYLenFit, (Int_t) htempPos_py->GetEntries()); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { @@ -4527,173 +3320,109 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (0) for (Int_t iPar = 2; iPar < 4; iPar++) if (NULL != fhSmCluFpar[iSmType][iPar]) - fp[iPar] = fhSmCluFpar[iSmType][iPar]->GetBinContent( - iSm * iNbRpc + iRpc + 1); + fp[iPar] = fhSmCluFpar[iSmType][iPar]->GetBinContent(iSm * iNbRpc + iRpc + 1); //LOG(info) << Form("Call yFit with %6.3f, %6.3f, %6.3f, %6.3f",fp[0],fp[1],fp[2],fp[3]) // ; Double_t* fpp = &fp[0]; fit_ybox(htempPos_py, dYLenFit, fpp); TF1* ff = htempPos_py->GetFunction("YBox"); if (NULL != ff) { - LOG(debug1) - << Form("FitPar1 %6.3f Err %6.3f, Par3 %6.3f Err %6.3f ", - ff->GetParameter(1), - ff->GetParError(1), - ff->GetParameter(3), - ff->GetParError(3)); - if (TMath::Abs(fChannelInfo->GetSizey() - - 2. * ff->GetParameter(1)) - / fChannelInfo->GetSizey() - < 0.1 - && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) - < 0.05) + LOG(debug1) << Form("FitPar1 %6.3f Err %6.3f, Par3 %6.3f Err %6.3f ", ff->GetParameter(1), + ff->GetParError(1), ff->GetParameter(3), ff->GetParError(3)); + if (TMath::Abs(fChannelInfo->GetSizey() - 2. * ff->GetParameter(1)) / fChannelInfo->GetSizey() < 0.1 + && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) < 0.05) //&& ff->GetChisquare() < 200.) //FIXME - constants! { - if (TMath::Abs(ff->GetParameter(3) - dYMeanFit) - < 0.5 * fChannelInfo->GetSizey()) { + if (TMath::Abs(ff->GetParameter(3) - dYMeanFit) < 0.5 * fChannelInfo->GetSizey()) { YMean = ff->GetParameter(3); - Double_t dV = dVscal * fChannelInfo->GetSizey() - / (2. * ff->GetParameter(1)); - fhSmCluSvel[iSmType]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), dV, dVW); - LOG(info) - << "FRes YBox " << htempPos_py->GetEntries() - << " entries in TSRC " << iSmType << iSm << iRpc << iCh - << ", chi2 " << ff->GetChisquare() - << Form(", striplen (%5.2f), %4.2f -> %4.2f, " - "%4.1f: %7.2f+/-%5.2f, pos res " - "%5.2f+/-%5.2f at y_cen = %5.2f+/-%5.2f", - fChannelInfo->GetSizey(), - dVscal, - dV, - dVW, - 2. * ff->GetParameter(1), - 2. * ff->GetParError(1), - ff->GetParameter(2), - ff->GetParError(2), - ff->GetParameter(3), - ff->GetParError(3)); + Double_t dV = dVscal * fChannelInfo->GetSizey() / (2. * ff->GetParameter(1)); + fhSmCluSvel[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc), dV, dVW); + LOG(info) << "FRes YBox " << htempPos_py->GetEntries() << " entries in TSRC " << iSmType << iSm + << iRpc << iCh << ", chi2 " << ff->GetChisquare() + << Form(", striplen (%5.2f), %4.2f -> %4.2f, " + "%4.1f: %7.2f+/-%5.2f, pos res " + "%5.2f+/-%5.2f at y_cen = %5.2f+/-%5.2f", + fChannelInfo->GetSizey(), dVscal, dV, dVW, 2. * ff->GetParameter(1), + 2. * ff->GetParError(1), ff->GetParameter(2), ff->GetParError(2), + ff->GetParameter(3), ff->GetParError(3)); for (Int_t iPar = 0; iPar < 4; iPar++) - fhSmCluFpar[iSmType][iPar]->Fill( - (Double_t)(iSm * iNbRpc + iRpc), - ff->GetParameter(2 + iPar)); + fhSmCluFpar[iSmType][iPar]->Fill((Double_t)(iSm * iNbRpc + iRpc), ff->GetParameter(2 + iPar)); } - } else { + } + else { YMean = dYMeanFit; // no new info available - LOG(info) - << "FBad YBox " << htempPos_py->GetEntries() - << " entries in TSRC " << iSmType << iSm << iRpc << iCh - << ", chi2 " << ff->GetChisquare() - << Form(", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos " - "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", - fChannelInfo->GetSizey(), - dVscal, - 2. * ff->GetParameter(1), - 2. * ff->GetParError(1), - ff->GetParameter(2), - ff->GetParError(2), - ff->GetParameter(3), - ff->GetParError(3)); + LOG(info) << "FBad YBox " << htempPos_py->GetEntries() << " entries in TSRC " << iSmType << iSm + << iRpc << iCh << ", chi2 " << ff->GetChisquare() + << Form(", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos " + "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f", + fChannelInfo->GetSizey(), dVscal, 2. * ff->GetParameter(1), + 2. * ff->GetParError(1), ff->GetParameter(2), ff->GetParError(2), + ff->GetParameter(3), ff->GetParError(3)); } } } } // ybox - fit end - Double_t TMean = - ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); + Double_t TMean = ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1); if (kTRUE) { // fit gaussian around most abundant bin - TH1* hTy = (TH1*) htempTOff->ProjectionY( - Form("%s_py%d", htempTOff->GetName(), iCh), iCh + 1, iCh + 1); + TH1* hTy = (TH1*) htempTOff->ProjectionY(Form("%s_py%d", htempTOff->GetName(), iCh), iCh + 1, iCh + 1); if (hTy->GetEntries() > WalkNHmin) { - Double_t dFMean = hTy->GetBinCenter(hTy->GetMaximumBin()); - Double_t dFLim = 2.0; // CAUTION, fixed numeric value - Double_t dBinSize = hTy->GetBinWidth(1); - dFLim = TMath::Max(dFLim, 5. * dBinSize); - TFitResultPtr fRes = - hTy->Fit("gaus", "SQM0", "", dFMean - dFLim, dFMean + dFLim); + Double_t dFMean = hTy->GetBinCenter(hTy->GetMaximumBin()); + Double_t dFLim = 2.0; // CAUTION, fixed numeric value + Double_t dBinSize = hTy->GetBinWidth(1); + dFLim = TMath::Max(dFLim, 5. * dBinSize); + TFitResultPtr fRes = hTy->Fit("gaus", "SQM0", "", dFMean - dFLim, dFMean + dFLim); if (TMath::Abs(TMean - fRes->Parameter(1)) > 5.) LOG(warn) << "CalibF " << Form("TSRC %d%d%d%d gaus %8.2f %8.2f %8.2f for " "TM %8.2f, YM %6.2f", - iSmType, - iSm, - iRpc, - iCh, - fRes->Parameter(0), - fRes->Parameter(1), - fRes->Parameter(2), - TMean, - YMean); + iSmType, iSm, iRpc, iCh, fRes->Parameter(0), fRes->Parameter(1), fRes->Parameter(2), + TMean, YMean); TMean = fRes->Parameter(1); //overwrite mean } } - Double_t dTYOff = - YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (fiBeamRefAddr == iUniqueId) { // don't shift time of reference counter on average if (iCh == 0) { Double_t dW = 0.; for (Int_t iRefCh = 0; iRefCh < iNbCh; iRefCh++) { - Double_t dWCh = - ((TH1*) htempTOff_px)->GetBinContent(iRefCh + 1); + Double_t dWCh = ((TH1*) htempTOff_px)->GetBinContent(iRefCh + 1); if (0 < dWCh) { dW += dWCh; if (dWCh > WalkNHmin) { - TH1* hTy = (TH1*) htempTOff->ProjectionY( - Form("%s_py%d", htempTOff->GetName(), iRefCh), - iRefCh + 1, - iRefCh + 1); - Double_t dFMean = hTy->GetBinCenter(hTy->GetMaximumBin()); - Double_t dFLim = 0.5; // CAUTION, fixed numeric value + TH1* hTy = (TH1*) htempTOff->ProjectionY(Form("%s_py%d", htempTOff->GetName(), iRefCh), + iRefCh + 1, iRefCh + 1); + Double_t dFMean = hTy->GetBinCenter(hTy->GetMaximumBin()); + Double_t dFLim = 0.5; // CAUTION, fixed numeric value 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)); + 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)); TWMean += fRes->Parameter(1) * dWCh; //overwrite mean - } else { - TWMean += - ((TProfile*) htempTOff_pfx)->GetBinContent(iRefCh + 1) - * dWCh; + } + else { + TWMean += ((TProfile*) htempTOff_pfx)->GetBinContent(iRefCh + 1) * dWCh; } TWMean += dWCh * // enforce <offset>=0 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]; } } - if (dW > 0.) - TWMean /= dW; + if (dW > 0.) TWMean /= dW; else TWMean = 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), - TWMean, - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + TMean - - TWMean); + 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), TWMean, + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + TMean - TWMean); // TMean-=((TProfile *)hAvTOff_pfx)->GetBinContent(iSm*iNbRpc+iRpc+1); TMean -= TWMean; } // beam counter end @@ -4704,24 +3433,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(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]); } /* Double_t TotMean=((TProfile *)htempTot_pfx)->GetBinContent(iCh+1); @@ -4734,72 +3451,43 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { for (Int_t iSide = 0; iSide < 2; iSide++) { Int_t ib = iCh * 2 + 1 + iSide; TH1* hbin = htempTot->ProjectionY(Form("bin%d", ib), ib, ib); - if (100 > hbin->GetEntries()) - continue; //request min number of entries + if (100 > hbin->GetEntries()) continue; //request min number of entries /* Double_t Ymax=hbin->GetMaximum();*/ - Int_t iBmax = hbin->GetMaximumBin(); - TAxis* xaxis = hbin->GetXaxis(); - Double_t Xmax = - xaxis->GetBinCenter(iBmax) - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; + Int_t iBmax = hbin->GetMaximumBin(); + TAxis* xaxis = hbin->GetXaxis(); + Double_t Xmax = xaxis->GetBinCenter(iBmax) / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; Double_t XOff = Xmax - fTotPreRange; - if ( - 0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ - LOG(warning) - << "XOff changed for " - << Form( - "SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", - iSmType, - iSm, - iRpc, - iSide, - XOff, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + if (0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ + LOG(warning) << "XOff changed for " + << Form("SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", iSmType, iSm, iRpc, iSide, + XOff, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } // Double_t TotMean=htempTot_Mean->GetBinContent(ib); Double_t TotMean = hbin->GetMean(); if (15 == iSmType) { - LOG(warning) - << "Gain for " - << Form( - "SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " - "gain %f, modg %f ", - iSmType, - iSm, - iRpc, - iSide, - TotMean, - htempTot_Mean->GetBinContent(ib), - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], - fdTTotMean / TotMean); - } - if (0.001 < TotMean) { - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= - fdTTotMean / TotMean; + LOG(warning) << "Gain for " + << Form("SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " + "gain %f, modg %f ", + iSmType, iSm, iRpc, iSide, TotMean, htempTot_Mean->GetBinContent(ib), + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], fdTTotMean / TotMean); } + if (0.001 < TotMean) { fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; } } if (5 == iSmType && fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] - != fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) { // diamond - LOG(warning) - << "CbmTofEventClusterizer::FillCalHist:" - << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc - << " Ch " << iCh << ": YMean " << YMean << ", TMean " << TMean - << " -> " - << Form(" %f %f %f %f ", - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + != fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]) { // diamond + LOG(warning) << "CbmTofEventClusterizer::FillCalHist:" + << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc << " Ch " << iCh << ": YMean " + << YMean << ", TMean " << TMean << " -> " + << Form(" %f %f %f %f ", fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); Double_t dTOff = - 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); - Double_t dGain = - 0.5 - * (fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] - + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + Double_t dGain = 0.5 + * (fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] + + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dTOff; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dTOff; fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dGain; @@ -4826,58 +3514,36 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { const Double_t TMaxDev = htempTOff->GetYaxis()->GetXmax(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) // remove outlyers { - if (TMath::Abs(TOff0_mean - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - > TMaxDev) + if (TMath::Abs(TOff0_mean - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]) > TMaxDev) fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = TOff0_mean; - if (TMath::Abs(TOff1_mean - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - > TMaxDev) + if (TMath::Abs(TOff1_mean - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]) > TMaxDev) fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = TOff1_mean; } for (Int_t iCh = 0; iCh < iNbCh; iCh++) // store new values { - Double_t YMean = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); - Double_t TMean = 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t YMean = + fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 + * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t TMean = + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); htempPos_pfx->Fill(iCh, YMean); if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) { - LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh - << " got " << htempPos_pfx->GetBinContent(iCh) << "," - << htempPos_pfx->GetBinContent(iCh + 1) << "," - << htempPos_pfx->GetBinContent(iCh + 2) << ", expected " - << YMean; + LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh << " got " << htempPos_pfx->GetBinContent(iCh) + << "," << htempPos_pfx->GetBinContent(iCh + 1) << "," << htempPos_pfx->GetBinContent(iCh + 2) + << ", expected " << YMean; } htempTOff_pfx->Fill(iCh, TMean); - LOG(debug) << Form( - "CalibU %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, YM %6.3f" - ", TM %8.3f, OffM %8.3f,%8.3f ", - fCalMode, - fCalSel, - fTRefMode, - iSmType, - iSm, - iRpc, - iCh, - htempTOff_px->GetBinContent(iCh + 1), - YMean, - TMean, - TOff0_mean, - TOff1_mean); + LOG(debug) << Form("CalibU %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, YM %6.3f" + ", TM %8.3f, OffM %8.3f,%8.3f ", + fCalMode, fCalSel, fTRefMode, iSmType, iSm, iRpc, iCh, + htempTOff_px->GetBinContent(iCh + 1), YMean, TMean, TOff0_mean, TOff1_mean); for (Int_t iSide = 0; iSide < 2; iSide++) { - htempTot_Mean->SetBinContent( - iCh * 2 + 1 + iSide, - fdTTotMean - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); - htempTot_Off->SetBinContent( - iCh * 2 + 1 + iSide, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + htempTot_Mean->SetBinContent(iCh * 2 + 1 + iSide, + fdTTotMean / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + htempTot_Off->SetBinContent(iCh * 2 + 1 + iSide, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } // htempTot_pfx->Fill(iCh,fdTTotMean/fvCPTotGain[iSmType][iSm*iNbRpc+iRpc][iCh][1]); } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ ) @@ -4890,35 +3556,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Off->Write(); // store old DELTOF histos - LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() - << " to file "; + LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() << " to file "; for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Store DelTof corrections TDirectory* curdir = gDirectory; gROOT->cd(); // TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); gDirectory->cd(curdir->GetPath()); if (NULL != hCorDelTof) { - TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* hCorDelTofout = + (TH1D*) hCorDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); hCorDelTofout->Write(); - } else { + } + else { LOG(debug) << " No CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); } } @@ -4929,35 +3583,21 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (NULL == fhRpcCluWalk[iDetIndx][iCh][0]) break; // TProfile *htmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used // TProfile *htmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used - TH1D* h1tmp0 = - fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); - TH1D* h1tmp1 = - fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); - if (h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx - << " got " << h1tmp0->GetBinContent(iWx + 1) - << ", expected " + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + if (h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " + << h1tmp0->GetBinContent(iWx + 1) << ", expected " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; } } - h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp0->Write(); h1tmp0->Write(); - h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp1->Write(); h1tmp1->Write(); } @@ -4966,39 +3606,31 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { { Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); - LOG(debug) - << "WriteHistos: restore Offsets, Gains and Walk, save DelTof for " - << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc; + LOG(debug) << "WriteHistos: restore Offsets, Gains and Walk, save DelTof for " + << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc; htempPos_pfx->Reset(); //reset to restore mean of original histos htempTOff_pfx->Reset(); htempTot_Mean->Reset(); htempTot_Off->Reset(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) { - Double_t YMean = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); - Double_t TMean = 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t YMean = + fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 + * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t TMean = + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); htempPos_pfx->Fill(iCh, YMean); if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) { - LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh - << " got " << htempPos_pfx->GetBinContent(iCh) << "," - << htempPos_pfx->GetBinContent(iCh + 1) << "," - << htempPos_pfx->GetBinContent(iCh + 2) << ", expected " - << YMean; + LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh << " got " << htempPos_pfx->GetBinContent(iCh) + << "," << htempPos_pfx->GetBinContent(iCh + 1) << "," << htempPos_pfx->GetBinContent(iCh + 2) + << ", expected " << YMean; } htempTOff_pfx->Fill(iCh, TMean); for (Int_t iSide = 0; iSide < 2; iSide++) { htempTot_Mean->SetBinContent( iCh * 2 + 1 + iSide, - fdTTotMean - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh] - [iSide]); //nh +1 empirical(?) - htempTot_Off->SetBinContent( - iCh * 2 + 1 + iSide, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + fdTTotMean / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); //nh +1 empirical(?) + htempTot_Off->SetBinContent(iCh * 2 + 1 + iSide, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } } @@ -5015,56 +3647,35 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (NULL == fhRpcCluWalk[iDetIndx][iCh][0]) break; // TProfile *htmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used // TProfile *htmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used - TH1D* h1tmp0 = - fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); - TH1D* h1tmp1 = - fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); - if (h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx - << " got " << h1tmp0->GetBinContent(iWx + 1) - << ", expected " + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + if (h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " + << h1tmp0->GetBinContent(iWx + 1) << ", expected " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; } } - h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp0->Write(); h1tmp0->Write(); - h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp1->Write(); h1tmp1->Write(); } // generate/update DelTof corrections - if ( - (fCalSmAddr < 0 && -fCalSmAddr != iSmAddr) - || (fCalSmAddr - == iSmAddr)) // select detectors for determination of DelTof correction + if ((fCalSmAddr < 0 && -fCalSmAddr != iSmAddr) + || (fCalSmAddr == iSmAddr)) // select detectors for determination of DelTof correction { - if (fiBeamRefAddr == iSmAddr) - continue; // no DelTof correction for Diamonds + if (fiBeamRefAddr == iSmAddr) continue; // no DelTof correction for Diamonds for (Int_t iSel = 0; iSel < iNSel; iSel++) { TH2* h2tmp = fhTRpcCluDelTof[iDetIndx][iSel]; if (NULL == h2tmp) { - LOG(debug) << Form( - "WriteHistos: histo not available for SmT %d, Sm %d, Rpc %d", - iSmType, - iSm, - iRpc); + LOG(debug) << Form("WriteHistos: histo not available for SmT %d, Sm %d, Rpc %d", iSmType, iSm, iRpc); break; } Int_t iNEntries = h2tmp->GetEntries(); @@ -5078,71 +3689,43 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { Double_t dNEntriesSum = 0.; for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) { Double_t dNEntries = h1tmp->GetBinContent(iBx + 1); - if (dNEntries - > WalkNHmin) // modify, request sufficient # of entries - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += - ((TProfile*) htmp)->GetBinContent(iBx + 1); - dDelMean += - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * dNEntries; + if (dNEntries > WalkNHmin) // modify, request sufficient # of entries + fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += ((TProfile*) htmp)->GetBinContent(iBx + 1); + dDelMean += fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * dNEntries; dNEntriesSum += dNEntries; } dDelMean /= dNEntriesSum; LOG(debug) << Form(" Update DelTof correction for SmT %d, Sm %d, " "Rpc %d, Sel%d: Entries %d, Mean shift %6.1f", - iSmType, - iSm, - iRpc, - iSel, - iNEntries, - dDelMean); + iSmType, iSm, iRpc, iSel, iNEntries, dDelMean); for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) { - h1tmp->SetBinContent( - iBx + 1, - fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] - dDelMean); + h1tmp->SetBinContent(iBx + 1, fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] - dDelMean); //h1tmp->SetBinContent(iBx+1,fvCPDelTof[iSmType][iSm*iNbRpc+iRpc][iBx][iSel]); } - h1tmp->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + h1tmp->SetName(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); h1tmp->Write(); } - } else { // copy existing histograms + } + else { // copy existing histograms for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Store DelTof corrections TDirectory* curdir = gDirectory; gROOT->cd(); // TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); gDirectory->cd(curdir->GetPath()); if (NULL != hCorDelTof) { TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); LOG(debug) << " Save existing CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); hCorDelTofout->Write(); - } else { + } + else { LOG(debug) << " No CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); } } } @@ -5151,36 +3734,25 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { { Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); - if ((fCalSmAddr < 0) - || (fCalSmAddr - != iSmAddr)) { // select detectors for updating offsets + if ((fCalSmAddr < 0) || (fCalSmAddr != iSmAddr)) { // select detectors for updating offsets LOG(debug) << "WriteHistos (calMode==5): update Offsets and Gains, " "keep Walk and DelTof for " - << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " - << iRpc << " with " << iNbCh << " channels " + << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc << " with " << iNbCh << " channels " << " using selector " << fCalSel; for (Int_t iCh = 0; iCh < iNbCh; iCh++) // update Offset and Gain { - Double_t YMean = ((TProfile*) htempPos_pfx) - ->GetBinContent(iCh + 1); //nh +1 empirical(?) - Double_t TMean = 0.; - Double_t dTYOff = - YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1); //nh +1 empirical(?) + Double_t TMean = 0.; + Double_t dTYOff = YMean / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); if (htempTOff_px->GetBinContent(iCh + 1) > WalkNHmin) { fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean; } - LOG(debug3) << Form( - "Calib: TSRC %d%d%d%d, hits %6.0f, new Off %8.0f,%8.0f ", - iSmType, - iSm, - iRpc, - iCh, - htempTOff_px->GetBinContent(iCh + 1), - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + LOG(debug3) << Form("Calib: TSRC %d%d%d%d, hits %6.0f, new Off %8.0f,%8.0f ", iSmType, iSm, iRpc, iCh, + htempTOff_px->GetBinContent(iCh + 1), fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); /* Double_t TotMean=((TProfile *)htempTot_pfx)->GetBinContent(iCh+1); //nh +1 empirical(!) @@ -5192,70 +3764,43 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { for (Int_t iSide = 0; iSide < 2; iSide++) { Int_t ib = iCh * 2 + 1 + iSide; TH1* hbin = htempTot->ProjectionY(Form("bin%d", ib), ib, ib); - if (100 > hbin->GetEntries()) - continue; //request min number of entries + if (100 > hbin->GetEntries()) continue; //request min number of entries /* Double_t Ymax=hbin->GetMaximum();*/ - Int_t iBmax = hbin->GetMaximumBin(); - TAxis* xaxis = hbin->GetXaxis(); - Double_t Xmax = - xaxis->GetBinCenter(iBmax) - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; + Int_t iBmax = hbin->GetMaximumBin(); + TAxis* xaxis = hbin->GetXaxis(); + Double_t Xmax = xaxis->GetBinCenter(iBmax) / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; Double_t XOff = Xmax - fTotPreRange; - if ( - 0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ - LOG(warning) - << "XOff changed for " - << Form("SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", - iSmType, - iSm, - iRpc, - iSide, - XOff, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + if (0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ + LOG(warning) << "XOff changed for " + << Form("SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", iSmType, iSm, iRpc, iSide, XOff, + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } // Double_t TotMean=htempTot_Mean->GetBinContent(ib); Double_t TotMean = hbin->GetMean(); if (15 == iSmType) { - LOG(warning) - << "Gain for " - << Form("SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " - "gain %f, modg %f ", - iSmType, - iSm, - iRpc, - iSide, - TotMean, - htempTot_Mean->GetBinContent(ib), - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], - fdTTotMean / TotMean); - } - if (0.001 < TotMean) { - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= - fdTTotMean / TotMean; + LOG(warning) << "Gain for " + << Form("SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " + "gain %f, modg %f ", + iSmType, iSm, iRpc, iSide, TotMean, htempTot_Mean->GetBinContent(ib), + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], fdTTotMean / TotMean); } + if (0.001 < TotMean) { fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; } } if (5 == iSmType && fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] - != fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) { // diamond - LOG(warning) - << "CbmTofEventClusterizer::FillCalHist:" - << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc - << " Ch " << iCh << ": YMean " << YMean << ", TMean " << TMean - << " -> " - << Form(" %f %f %f %f ", - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + != fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]) { // diamond + LOG(warning) << "CbmTofEventClusterizer::FillCalHist:" + << " SmT " << iSmType << " Sm " << iSm << " Rpc " << iRpc << " Ch " << iCh << ": YMean " + << YMean << ", TMean " << TMean << " -> " + << Form(" %f %f %f %f ", fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0], + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); Double_t dTOff = - 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); - Double_t dGain = - 0.5 - * (fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] - + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + Double_t dGain = 0.5 + * (fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] + + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]); fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dTOff; fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dTOff; fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dGain; @@ -5270,30 +3815,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Off->Reset(); for (Int_t iCh = 0; iCh < iNbCh; iCh++) // store new values { - Double_t YMean = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); - Double_t TMean = 0.5 - * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t YMean = + fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * 0.5 + * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] - fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); + Double_t TMean = + 0.5 * (fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] + fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]); htempPos_pfx->Fill(iCh, YMean); if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) { - LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh - << " got " << htempPos_pfx->GetBinContent(iCh) << "," - << htempPos_pfx->GetBinContent(iCh + 1) << "," - << htempPos_pfx->GetBinContent(iCh + 2) << ", expected " - << YMean; + LOG(error) << "WriteHistos: restore unsuccessful! ch " << iCh << " got " << htempPos_pfx->GetBinContent(iCh) + << "," << htempPos_pfx->GetBinContent(iCh + 1) << "," << htempPos_pfx->GetBinContent(iCh + 2) + << ", expected " << YMean; } htempTOff_pfx->Fill(iCh, TMean); for (Int_t iSide = 0; iSide < 2; iSide++) { - htempTot_Mean->SetBinContent( - iCh * 2 + 1 + iSide, - fdTTotMean - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); - htempTot_Off->SetBinContent( - iCh * 2 + 1 + iSide, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + htempTot_Mean->SetBinContent(iCh * 2 + 1 + iSide, + fdTTotMean / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + htempTot_Off->SetBinContent(iCh * 2 + 1 + iSide, fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); } // htempTot_pfx->Fill(iCh,fdTTotMean/fvCPTotGain[iSmType][iSm*iNbRpc+iRpc][iCh][1]); } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ ) @@ -5306,35 +3844,23 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { htempTot_Off->Write(); // store old DELTOF histos - LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() - << " to file "; + LOG(debug) << " Copy old DelTof histos from " << gDirectory->GetName() << " to file "; for (Int_t iSel = 0; iSel < iNSel; iSel++) { // Store DelTof corrections TDirectory* curdir = gDirectory; gROOT->cd(); // TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); gDirectory->cd(curdir->GetPath()); if (NULL != hCorDelTof) { - TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone( - Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel)); + TH1D* hCorDelTofout = + (TH1D*) hCorDelTof->Clone(Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)); hCorDelTofout->Write(); - } else { + } + else { LOG(debug) << " No CorDelTof histo " - << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", - iSmType, - iSm, - iRpc, - iSel); + << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel); } } @@ -5345,43 +3871,27 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { if (NULL == fhRpcCluWalk[iDetIndx][iCh][0]) break; // TProfile *htmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used // TProfile *htmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProfileX("_pfx",1,nbClWalkBinY); (VF) not used - TH1D* h1tmp0 = - fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); - TH1D* h1tmp1 = - fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp0 = fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX("_px", 1, nbClWalkBinY); + TH1D* h1tmp1 = fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX("_px", 1, nbClWalkBinY); for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) { - h1tmp0->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); - h1tmp1->SetBinContent( - iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); - if (h1tmp0->GetBinContent(iWx + 1) - != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { - LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx - << " got " << h1tmp0->GetBinContent(iWx + 1) - << ", expected " + h1tmp0->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]); + h1tmp1->SetBinContent(iWx + 1, fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]); + if (h1tmp0->GetBinContent(iWx + 1) != fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) { + LOG(error) << "WriteHistos: restore unsuccessful! iWx " << iWx << " got " + << h1tmp0->GetBinContent(iWx + 1) << ", expected " << fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]; } } - h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp0->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp0->Write(); h1tmp0->Write(); - h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType, - iSm, - iRpc, - iCh)); + h1tmp1->SetName(Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh)); // htmp1->Write(); h1tmp1->Write(); } } break; - default: - LOG(debug) << "WriteHistos: update mode " << fCalMode - << " not yet implemented"; + default: LOG(debug) << "WriteHistos: update mode " << fCalMode << " not yet implemented"; } } @@ -5440,7 +3950,8 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { return kTRUE; } -Bool_t CbmTofEventClusterizer::DeleteHistos() { +Bool_t CbmTofEventClusterizer::DeleteHistos() +{ delete fhClustBuildTime; delete fhHitsPerTracks; delete fhPtsPerHit; @@ -5474,7 +3985,8 @@ Bool_t CbmTofEventClusterizer::DeleteHistos() { return kTRUE; } /************************************************************************************/ -Bool_t CbmTofEventClusterizer::BuildClusters() { +Bool_t CbmTofEventClusterizer::BuildClusters() +{ Int_t iMess = 0; //gGeoManager->SetTopVolume( gGeoManager->FindVolumeFast("tof_v14a") ); gGeoManager->CdTop(); @@ -5485,10 +3997,9 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { return kFALSE; } fiNevtBuild++; - LOG(debug) - << "Build clusters from " - // <<fTofDigisColl->GetEntries()<<" digis in event "<<fiNevtBuild; - << fTofDigiVec.size() << " digis in event " << fiNevtBuild; + LOG(debug) << "Build clusters from " + // <<fTofDigisColl->GetEntries()<<" digis in event "<<fiNevtBuild; + << fTofDigiVec.size() << " digis in event " << fiNevtBuild; fTRefHits = 0.; @@ -5513,13 +4024,10 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { fTofDigiVec.push_back(CbmTofDigi(*pDigi)); CbmTofDigi* pDigiN = &(fTofDigiVec.back()); // CbmTofDigi *pDigiN = new((*fTofDigisColl)[iNbDigi++]) CbmTofDigi( *pDigi ); - pDigiN->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi->GetChannel(), - (0 == pDigi->GetSide()) ? 1 : 0, + pDigiN->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi->GetChannel(), (0 == pDigi->GetSide()) ? 1 : 0, pDigi->GetType()); - LOG(debug) << "Duplicated digi " << fTofDigiVec.size() - << " with address 0x" << std::hex << pDigiN->GetAddress(); + LOG(debug) << "Duplicated digi " << fTofDigiVec.size() << " with address 0x" << std::hex + << pDigiN->GetAddress(); if (NULL != fTofDigiPointMatches) { // copy MC Match Object const CbmMatch digiMatch = (CbmMatch) fTofDigiPointMatches->at(iDigInd); @@ -5542,18 +4050,15 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { CbmTofDigi* pDigi = &(fTofDigiVec.at(iDigInd)); Int_t iDetIndx = fDigiBdfPar->GetDetInd(pDigi->GetAddress() & DetMask); - LOG(debug) << "RawDigi" << iDigInd << " " << pDigi - << Form(" Address : 0x%08x ", pDigi->GetAddress()) << " TSRCS " - << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() - << pDigi->GetChannel() << pDigi->GetSide() << ", DetIndx " - << iDetIndx << " : " << pDigi->ToString() + LOG(debug) << "RawDigi" << iDigInd << " " << pDigi << Form(" Address : 0x%08x ", pDigi->GetAddress()) << " TSRCS " + << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() << pDigi->GetChannel() << pDigi->GetSide() + << ", DetIndx " << iDetIndx << " : " << pDigi->ToString() // <<" Time "<<pDigi->GetTime() // <<" Tot " <<pDigi->GetTot() ; if (fDigiBdfPar->GetNbDet() - 1 < iDetIndx || iDetIndx < 0) { - LOG(debug) << Form( - " Wrong DetIndx %d >< %d ", iDetIndx, fDigiBdfPar->GetNbDet()); + LOG(debug) << Form(" Wrong DetIndx %d >< %d ", iDetIndx, fDigiBdfPar->GetNbDet()); break; } @@ -5564,13 +4069,12 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { if (fhRpcDigiCor.size() > 0) { if (NULL == fhRpcDigiCor[iDetIndx]) { if (100 < iMess++) - LOG(warning) << Form( - " DigiCor Histo for DetIndx %d derived from 0x%08x not found", - iDetIndx, - pDigi->GetAddress()); + LOG(warning) << Form(" DigiCor Histo for DetIndx %d derived from 0x%08x not found", iDetIndx, + pDigi->GetAddress()); continue; } - } else + } + else break; size_t iDigiCh = pDigi->GetChannel() * 2 + pDigi->GetSide(); @@ -5585,10 +4089,10 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { fvTimeLastDigi[iDetIndx][iDigiCh] = pDigi->GetTime(); if (fvTimeFirstDigi[iDetIndx][iDigiCh] != 0.) { - fhRpcDigiDTFD[iDetIndx]->Fill( - iDigiCh, (pDigi->GetTime() - fvTimeFirstDigi[iDetIndx][iDigiCh])); + fhRpcDigiDTFD[iDetIndx]->Fill(iDigiCh, (pDigi->GetTime() - fvTimeFirstDigi[iDetIndx][iDigiCh])); fvMulDigi[iDetIndx][iDigiCh]++; - } else { + } + else { fvTimeFirstDigi[iDetIndx][iDigiCh] = pDigi->GetTime(); fvMulDigi[iDetIndx][iDigiCh]++; } @@ -5601,33 +4105,29 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { // Fill digi correlation histogram per counter if (iDetIndx == fDigiBdfPar->GetDetInd(pDigi2->GetAddress())) { if (0. == pDigi->GetSide() && 1. == pDigi2->GetSide()) { - fhRpcDigiCor[iDetIndx]->Fill(pDigi->GetChannel(), - pDigi2->GetChannel()); - } else { + fhRpcDigiCor[iDetIndx]->Fill(pDigi->GetChannel(), pDigi2->GetChannel()); + } + else { if (1. == pDigi->GetSide() && 0. == pDigi2->GetSide()) { - fhRpcDigiCor[iDetIndx]->Fill(pDigi2->GetChannel(), - pDigi->GetChannel()); + fhRpcDigiCor[iDetIndx]->Fill(pDigi2->GetChannel(), pDigi->GetChannel()); } } if (pDigi->GetSide() != pDigi2->GetSide()) { if (pDigi->GetChannel() == pDigi2->GetChannel()) { - Double_t dTDif = - TMath::Abs(pDigi->GetTime() - pDigi2->GetTime()); + Double_t dTDif = TMath::Abs(pDigi->GetTime() - pDigi2->GetTime()); if (dTDif < dTDifMin) { dTDifMin = dTDif; pDigi2Min = pDigi2; } - } else if ( - TMath::Abs(pDigi->GetChannel() - pDigi2->GetChannel()) - == 1) { // opposite side missing, neighbouring channel has hit on opposite side // FIXME + } + else if (TMath::Abs(pDigi->GetChannel() - pDigi2->GetChannel()) + == 1) { // opposite side missing, neighbouring channel has hit on opposite side // FIXME // check that same side digi of neighbouring channel is absent Int_t iDigI3 = 0; for (; iDigI3 < iNbTofDigi; iDigI3++) { CbmTofDigi* pDigi3 = &(fTofDigiVec.at(iDigI3)); // CbmTofDigi *pDigi3 = (CbmTofDigi*) fTofDigisColl->At( iDigI3 ); - if (pDigi3->GetSide() == pDigi->GetSide() - && pDigi2->GetChannel() == pDigi3->GetChannel()) - break; + if (pDigi3->GetSide() == pDigi->GetSide() && pDigi2->GetChannel() == pDigi3->GetChannel()) break; } if (iDigI3 == iNbTofDigi) // same side neighbour did not fire { @@ -5636,63 +4136,39 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { case 0: // no action break; case 1: // shift found hit - LOG(debug2) << Form("shift channel %d%d%d%d%d and ", - (Int_t) pDigi->GetType(), - (Int_t) pDigi->GetSm(), - (Int_t) pDigi->GetRpc(), - (Int_t) pDigi->GetChannel(), + LOG(debug2) << Form("shift channel %d%d%d%d%d and ", (Int_t) pDigi->GetType(), + (Int_t) pDigi->GetSm(), (Int_t) pDigi->GetRpc(), (Int_t) pDigi->GetChannel(), (Int_t) pDigi->GetSide()) - << Form(" %d%d%d%d%d ", - (Int_t) pDigi2->GetType(), - (Int_t) pDigi2->GetSm(), - (Int_t) pDigi2->GetRpc(), - (Int_t) pDigi2->GetChannel(), + << Form(" %d%d%d%d%d ", (Int_t) pDigi2->GetType(), (Int_t) pDigi2->GetSm(), + (Int_t) pDigi2->GetRpc(), (Int_t) pDigi2->GetChannel(), (Int_t) pDigi2->GetSide()); //if(pDigi->GetTime() < pDigi2->GetTime()) if (pDigi->GetSide() == 0) - pDigi2->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi->GetChannel(), - 1 - pDigi->GetSide(), + pDigi2->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi->GetChannel(), 1 - pDigi->GetSide(), pDigi->GetType()); else - pDigi->SetAddress(pDigi2->GetSm(), - pDigi2->GetRpc(), - pDigi2->GetChannel(), - 1 - pDigi2->GetSide(), - pDigi2->GetType()); + pDigi->SetAddress(pDigi2->GetSm(), pDigi2->GetRpc(), pDigi2->GetChannel(), + 1 - pDigi2->GetSide(), pDigi2->GetType()); - LOG(debug2) << Form("resultchannel %d%d%d%d%d and ", - (Int_t) pDigi->GetType(), - (Int_t) pDigi->GetSm(), - (Int_t) pDigi->GetRpc(), - (Int_t) pDigi->GetChannel(), + LOG(debug2) << Form("resultchannel %d%d%d%d%d and ", (Int_t) pDigi->GetType(), + (Int_t) pDigi->GetSm(), (Int_t) pDigi->GetRpc(), (Int_t) pDigi->GetChannel(), (Int_t) pDigi->GetSide()) - << Form(" %d%d%d%d%d ", - (Int_t) pDigi2->GetType(), - (Int_t) pDigi2->GetSm(), - (Int_t) pDigi2->GetRpc(), - (Int_t) pDigi2->GetChannel(), + << Form(" %d%d%d%d%d ", (Int_t) pDigi2->GetType(), (Int_t) pDigi2->GetSm(), + (Int_t) pDigi2->GetRpc(), (Int_t) pDigi2->GetChannel(), (Int_t) pDigi2->GetSide()); break; case 2: // insert missing hits fTofDigiVec.push_back(CbmTofDigi(*pDigi)); CbmTofDigi* pDigiN = &(fTofDigiVec.back()); // CbmTofDigi *pDigiN = new((*fTofDigisColl)[iNbTofDigi++]) CbmTofDigi( *pDigi ); - pDigiN->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi2->GetChannel(), - pDigi->GetSide(), + pDigiN->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi2->GetChannel(), pDigi->GetSide(), pDigi->GetType()); pDigiN->SetTot(pDigi2->GetTot()); fTofDigiVec.push_back(CbmTofDigi(*pDigi2)); CbmTofDigi* pDigiN2 = &(fTofDigiVec.back()); // CbmTofDigi *pDigiN2 = new((*fTofDigisColl)[iNbTofDigi++]) CbmTofDigi( *pDigi2 ); - pDigiN2->SetAddress(pDigi2->GetSm(), - pDigi2->GetRpc(), - pDigi->GetChannel(), - pDigi2->GetSide(), + pDigiN2->SetAddress(pDigi2->GetSm(), pDigi2->GetRpc(), pDigi->GetChannel(), pDigi2->GetSide(), pDigi2->GetType()); pDigiN2->SetTot(pDigi->GetTot()); @@ -5706,31 +4182,22 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { } if (pDigi2Min != NULL) { - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, - pDigi->GetType(), - pDigi->GetSm(), - pDigi->GetRpc(), - 0, + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc(), 0, pDigi->GetChannel()); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { - LOG(warning) << Form("BuildClusters: invalid ChannelInfo for 0x%08x", - iChId); + LOG(warning) << Form("BuildClusters: invalid ChannelInfo for 0x%08x", iChId); continue; } - if (fDigiBdfPar->GetSigVel( - pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc()) - * dTDifMin * 0.5 + if (fDigiBdfPar->GetSigVel(pDigi->GetType(), pDigi->GetSm(), pDigi->GetRpc()) * dTDifMin * 0.5 < fPosYMaxScal * fChannelInfo->GetSizey()) { //check consistency if (8 == pDigi->GetType() || 5 == pDigi->GetType()) { if (pDigi->GetTime() != pDigi2Min->GetTime()) { if (fiMsgCnt-- > 0) { - LOG(warning) - << " BuildClusters: Inconsistent duplicated digis in event " - << fiNevtBuild << ", Ind: " - << iDigInd; // << "CTyp: " << pDigi->GetCounterType; + LOG(warning) << " BuildClusters: Inconsistent duplicated digis in event " << fiNevtBuild + << ", Ind: " << iDigInd; // << "CTyp: " << pDigi->GetCounterType; LOG(warning) << " " << pDigi->ToString(); LOG(warning) << " " << pDigi2Min->ToString(); } @@ -5753,8 +4220,7 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { } for (UInt_t iDetIndx = 0; iDetIndx < fvTimeFirstDigi.size(); iDetIndx++) for (UInt_t iCh = 0; iCh < fvTimeFirstDigi[iDetIndx].size(); iCh++) { - if (fvTimeFirstDigi[iDetIndx][iCh] != 0.) - fhRpcDigiDTMul[iDetIndx]->Fill(iCh, fvMulDigi[iDetIndx][iCh]); + if (fvTimeFirstDigi[iDetIndx][iCh] != 0.) fhRpcDigiDTMul[iDetIndx]->Fill(iCh, fvMulDigi[iDetIndx][iCh]); } } // kTRUE end @@ -5773,34 +4239,26 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { // pDigi = (CbmTofDigi*) fTofCalDigisColl->At( iDigInd ); pDigi = &(fTofCalDigiVec->at(iDigInd)); LOG(debug1) << "AC " // After Calibration - << Form("0x%08x", pDigi->GetAddress()) << " TSRC " - << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() - << Form("%2d", (Int_t) pDigi->GetChannel()) << " " - << pDigi->GetSide() << " " << Form("%f", pDigi->GetTime()) - << " " << pDigi->GetTot(); - - if (fDigiBdfPar->GetNbSmTypes() - > pDigi->GetType() // prevent crash due to misconfiguration + << Form("0x%08x", pDigi->GetAddress()) << " TSRC " << pDigi->GetType() << pDigi->GetSm() + << pDigi->GetRpc() << Form("%2d", (Int_t) pDigi->GetChannel()) << " " << pDigi->GetSide() << " " + << Form("%f", pDigi->GetTime()) << " " << pDigi->GetTot(); + + if (fDigiBdfPar->GetNbSmTypes() > pDigi->GetType() // prevent crash due to misconfiguration && fDigiBdfPar->GetNbSm(pDigi->GetType()) > pDigi->GetSm() && fDigiBdfPar->GetNbRpc(pDigi->GetType()) > pDigi->GetRpc() - && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) - > pDigi->GetChannel()) { - fStorDigi[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] + && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { + fStorDigi[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()] + [pDigi->GetChannel()] .push_back(pDigi); - fStorDigiInd[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] + fStorDigiInd[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()] + [pDigi->GetChannel()] .push_back(iDigInd); - } else { + } + else { LOG(info) << "Skip2 Digi " - << " Type " << pDigi->GetType() << " " - << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() - << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " - << pDigi->GetRpc() << " " - << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " - << pDigi->GetChannel() << " " + << " Type " << pDigi->GetType() << " " << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() + << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " << pDigi->GetRpc() << " " + << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " << pDigi->GetChannel() << " " << fDigiBdfPar->GetNbChan(pDigi->GetType(), 0); } } // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ ) @@ -5815,46 +4273,27 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { Int_t iRpc = CbmTofAddress::GetRpcId(iDetId); Int_t iNbStrips = fDigiBdfPar->GetNbChan(iSmType, iRpc); for (Int_t iStrip = 0; iStrip < iNbStrips; iStrip++) { - Int_t iDigiMul = - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc] - [iStrip] - .size(); + Int_t iDigiMul = fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip].size(); //LOG(info)<<"Inspect TSRC "<<iSmType<<iSm<<iRpc<<iStrip<<" with "<<iNbStrips<<" strips: Mul "<<iDigiMul; if (iDigiMul > 0) { fhRpcDigiMul[iDetIndx]->Fill(iStrip, iDigiMul); if (iDigiMul == 1) { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 0); if (iStrip > 0) - if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip - 1] - .size() - > 1) { + if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip - 1].size() > 1) { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 1); if (TMath::Abs( - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip][0] - ->GetTime() - - fStorDigi[iSmType] - [iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc] - [iStrip - 1][0] - ->GetTime()) + fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip][0]->GetTime() + - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip - 1][0]->GetTime()) < fMaxTimeDist) fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 3); } if (iStrip < iNbStrips - 2) { - if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip + 1] - .size() - > 1) { + if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip + 1].size() > 1) { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 2); if (TMath::Abs( - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip][0] - ->GetTime() - - fStorDigi[iSmType] - [iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc] - [iStrip + 1][0] - ->GetTime()) + fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip][0]->GetTime() + - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc][iStrip + 1][0]->GetTime()) < fMaxTimeDist) fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 4); } @@ -5871,7 +4310,8 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { return kTRUE; } -Bool_t CbmTofEventClusterizer::MergeClusters() { +Bool_t CbmTofEventClusterizer::MergeClusters() +{ // Merge clusters from neigbouring Rpc within a (Super)Module if (NULL == fTofHitsColl) { LOG(info) << " No Hits defined ! Check! "; @@ -5886,8 +4326,7 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { Int_t iSmType = CbmTofAddress::GetSmType(iDetId); Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); if (iSmType != 5 && iSmType != 8) continue; // only merge diamonds and Pad - LOG(debug) << "MergeClusters: in SmT " << iSmType << " for " << iNbRpc - << " Rpcs"; + LOG(debug) << "MergeClusters: in SmT " << iSmType << " for " << iNbRpc << " Rpcs"; if (iNbRpc > 1) { // check for possible mergers Int_t iSm = CbmTofAddress::GetSmId(iDetId); @@ -5896,14 +4335,8 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { fChannelInfo = fDigiPar->GetCell(iChId); Int_t iCh = CbmTofAddress::GetChannelId(iChId); LOG(debug) << "MergeClusters: Check for mergers in " - << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d", - iSmType, - iSm, - iRpc, - iCh, - iHitInd); - for (Int_t iHitInd2 = iHitInd + 1; iHitInd2 < fTofHitsColl->GetEntries(); - iHitInd2++) { + << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d", iSmType, iSm, iRpc, iCh, iHitInd); + for (Int_t iHitInd2 = iHitInd + 1; iHitInd2 < fTofHitsColl->GetEntries(); iHitInd2++) { CbmTofHit* pHit2 = (CbmTofHit*) fTofHitsColl->At(iHitInd2); if (NULL == pHit2) continue; Int_t iDetId2 = (pHit2->GetAddress() & DetMask); @@ -5912,8 +4345,7 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { Int_t iSm2 = CbmTofAddress::GetSmId(iDetId2); if (iSm2 == iSm || iSmType == 5) { Int_t iRpc2 = CbmTofAddress::GetRpcId(iDetId2); - if (TMath::Abs(iRpc - iRpc2) == 1 - || iSm2 != iSm) { // Found neighbour + if (TMath::Abs(iRpc - iRpc2) == 1 || iSm2 != iSm) { // Found neighbour Int_t iChId2 = pHit2->GetAddress(); // CbmTofCell *fChannelInfo2 = fDigiPar->GetCell( iChId2 ); (VF) not used Int_t iCh2 = CbmTofAddress::GetChannelId(iChId2); @@ -5924,32 +4356,20 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { Double_t yPos2 = pHit2->GetY(); Double_t tof2 = pHit2->GetTime(); LOG(debug) << "MergeClusters: Found hit in neighbour " - << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d", - iSmType2, - iSm2, - iRpc2, - iCh2, - iHitInd2) - << Form(" DX %6.1f, DY %6.1f, DT %6.1f", - xPos - xPos2, - yPos - yPos2, - tof - tof2); - - if (TMath::Abs(xPos - xPos2) < fdCaldXdYMax * 2. - && TMath::Abs(yPos - yPos2) < fdCaldXdYMax * 2. + << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d", iSmType2, iSm2, iRpc2, iCh2, iHitInd2) + << Form(" DX %6.1f, DY %6.1f, DT %6.1f", xPos - xPos2, yPos - yPos2, tof - tof2); + + if (TMath::Abs(xPos - xPos2) < fdCaldXdYMax * 2. && TMath::Abs(yPos - yPos2) < fdCaldXdYMax * 2. && TMath::Abs(tof - tof2) < fMaxTimeDist) { - CbmMatch* digiMatch = - (CbmMatch*) fTofDigiMatchColl->At(iHitInd); - Double_t dTot = 0; - for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); - iLink += 2) { // loop over digis + CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iHitInd); + Double_t dTot = 0; + for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis CbmLink L0 = digiMatch->GetLink(iLink); UInt_t iDigInd0 = L0.GetIndex(); UInt_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); // if (iDigInd0 < fTofCalDigisColl->GetEntries() && iDigInd1 < fTofCalDigisColl->GetEntries()){ - if (iDigInd0 < fTofCalDigiVec->size() - && iDigInd1 < fTofCalDigiVec->size()) { + if (iDigInd0 < fTofCalDigiVec->size() && iDigInd1 < fTofCalDigiVec->size()) { // CbmTofDigi *pDig0 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd0)); // CbmTofDigi *pDig1 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd1)); CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); @@ -5959,45 +4379,28 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { } } - CbmMatch* digiMatch2 = - (CbmMatch*) fTofDigiMatchColl->At(iHitInd2); - Double_t dTot2 = 0; - for (Int_t iLink = 0; iLink < digiMatch2->GetNofLinks(); - iLink += 2) { // loop over digis + CbmMatch* digiMatch2 = (CbmMatch*) fTofDigiMatchColl->At(iHitInd2); + Double_t dTot2 = 0; + for (Int_t iLink = 0; iLink < digiMatch2->GetNofLinks(); iLink += 2) { // loop over digis CbmLink L0 = digiMatch2->GetLink(iLink); UInt_t iDigInd0 = L0.GetIndex(); UInt_t iDigInd1 = (digiMatch2->GetLink(iLink + 1)).GetIndex(); // if (iDigInd0 < fTofCalDigisColl->GetEntries() && iDigInd1 < fTofCalDigisColl->GetEntries()){ - if (iDigInd0 < fTofCalDigiVec->size() - && iDigInd1 < fTofCalDigiVec->size()) { + if (iDigInd0 < fTofCalDigiVec->size() && iDigInd1 < fTofCalDigiVec->size()) { // CbmTofDigi *pDig0 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd0)); // CbmTofDigi *pDig1 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd1)); CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); CbmTofDigi* pDig1 = &(fTofCalDigiVec->at(iDigInd1)); dTot2 += pDig0->GetTot(); dTot2 += pDig1->GetTot(); - digiMatch->AddLink(CbmLink(pDig0->GetTot(), - iDigInd0, - fiOutputTreeEntry, - fiFileIndex)); - digiMatch->AddLink(CbmLink(pDig1->GetTot(), - iDigInd1, - fiOutputTreeEntry, - fiFileIndex)); + digiMatch->AddLink(CbmLink(pDig0->GetTot(), iDigInd0, fiOutputTreeEntry, fiFileIndex)); + digiMatch->AddLink(CbmLink(pDig1->GetTot(), iDigInd1, fiOutputTreeEntry, fiFileIndex)); } } LOG(debug) << "MergeClusters: Found merger in neighbour " - << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d(%d)", - iSmType2, - iSm2, - iRpc2, - iCh2, - iHitInd2, + << Form(" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d(%d)", iSmType2, iSm2, iRpc2, iCh2, iHitInd2, fTofHitsColl->GetEntries()) - << Form(" DX %6.1f, DY %6.1f, DT %6.1f", - xPos - xPos2, - yPos - yPos2, - tof - tof2) + << Form(" DX %6.1f, DY %6.1f, DT %6.1f", xPos - xPos2, yPos - yPos2, tof - tof2) << Form(" Tots %6.1f - %6.1f", dTot, dTot2); Double_t dTotSum = dTot + dTot2; Double_t dxPosM = (xPos * dTot + xPos2 * dTot2) / dTotSum; @@ -6013,8 +4416,7 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { fTofDigiMatchColl->RemoveAt(iHitInd2); fTofDigiMatchColl->Compress(); fTofHitsColl->Compress(); - LOG(debug) << "MergeClusters: Compress TClonesArrays to " - << fTofHitsColl->GetEntries() << ", " + LOG(debug) << "MergeClusters: Compress TClonesArrays to " << fTofHitsColl->GetEntries() << ", " << fTofDigiMatchColl->GetEntries(); /* for(Int_t i=iHitInd2; i<fTofHitsColl->GetEntries(); i++){ // update RefLinks @@ -6034,29 +4436,30 @@ Bool_t CbmTofEventClusterizer::MergeClusters() { return kTRUE; } -static Double_t f1_xboxe(double* x, double* par) { +static Double_t f1_xboxe(double* x, double* par) +{ double xx = x[0]; double wx = 1. - par[4] * TMath::Power(xx + par[5], 2); - double xboxe = par[0] * 0.25 - * (1. + TMath::Erf((xx + par[1] - par[3]) / par[2])) + double xboxe = par[0] * 0.25 * (1. + TMath::Erf((xx + par[1] - par[3]) / par[2])) * (1. + TMath::Erf((-xx + par[1] + par[3]) / par[2])); return xboxe * wx; } -void CbmTofEventClusterizer::fit_ybox(const char* hname) { +void CbmTofEventClusterizer::fit_ybox(const char* hname) +{ TH1* h1; h1 = (TH1*) gROOT->FindObjectAny(hname); if (NULL != h1) { fit_ybox(h1, 0.); } } -void CbmTofEventClusterizer::fit_ybox(TH1* h1, Double_t ysize) { +void CbmTofEventClusterizer::fit_ybox(TH1* h1, Double_t ysize) +{ Double_t* fpar = NULL; fit_ybox(h1, ysize, fpar); } -void CbmTofEventClusterizer::fit_ybox(TH1* h1, - Double_t ysize, - Double_t* fpar = NULL) { +void CbmTofEventClusterizer::fit_ybox(TH1* h1, Double_t ysize, Double_t* fpar = NULL) +{ TAxis* xaxis = h1->GetXaxis(); Double_t Ymin = xaxis->GetXmin(); Double_t Ymax = xaxis->GetXmax(); @@ -6089,67 +4492,40 @@ void CbmTofEventClusterizer::fit_ybox(TH1* h1, err[i] = f1->GetParError(i); //cout << " FPar "<< i << ": " << res[i] << ", " << err[i] << endl; } - LOG(debug) << "YBox Fit of " << h1->GetName() - << " ended with chi2 = " << res[9] + LOG(debug) << "YBox Fit of " << h1->GetName() << " ended with chi2 = " << res[9] << Form(", strip length %7.2f +/- %5.2f, position resolution " "%7.2f +/- %5.2f at y_cen = %7.2f +/- %5.2f", - 2. * res[1], - 2. * err[1], - res[2], - err[2], - res[3], - err[3]); + 2. * res[1], 2. * err[1], res[2], err[2], res[3], err[3]); } -void CbmTofEventClusterizer::CheckLHMemory() { +void CbmTofEventClusterizer::CheckLHMemory() +{ if (fvLastHits.size() != static_cast<size_t>(fDigiBdfPar->GetNbSmTypes())) - LOG(fatal) << Form("Inconsistent LH Smtype size %lu, %d ", - fvLastHits.size(), - fDigiBdfPar->GetNbSmTypes()); + LOG(fatal) << Form("Inconsistent LH Smtype size %lu, %d ", fvLastHits.size(), fDigiBdfPar->GetNbSmTypes()); for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { - if (fvLastHits[iSmType].size() - != static_cast<size_t>(fDigiBdfPar->GetNbSm(iSmType))) - LOG(fatal) << Form("Inconsistent LH Sm size %lu, %d T %d", - fvLastHits[iSmType].size(), - fDigiBdfPar->GetNbSm(iSmType), - iSmType); + if (fvLastHits[iSmType].size() != static_cast<size_t>(fDigiBdfPar->GetNbSm(iSmType))) + LOG(fatal) << Form("Inconsistent LH Sm size %lu, %d T %d", fvLastHits[iSmType].size(), + fDigiBdfPar->GetNbSm(iSmType), iSmType); for (Int_t iSm = 0; iSm < fDigiBdfPar->GetNbSm(iSmType); iSm++) { - if (fvLastHits[iSmType][iSm].size() - != static_cast<size_t>(fDigiBdfPar->GetNbRpc(iSmType))) - LOG(fatal) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", - fvLastHits[iSmType][iSm].size(), - fDigiBdfPar->GetNbRpc(iSmType), - iSmType, - iSm); + if (fvLastHits[iSmType][iSm].size() != static_cast<size_t>(fDigiBdfPar->GetNbRpc(iSmType))) + LOG(fatal) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", fvLastHits[iSmType][iSm].size(), + fDigiBdfPar->GetNbRpc(iSmType), iSmType, iSm); for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { - if (fvLastHits[iSmType][iSm][iRpc].size() - != static_cast<size_t>(fDigiBdfPar->GetNbChan(iSmType, iRpc))) - LOG(fatal) << Form( - "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", - fvLastHits[iSmType][iSm][iRpc].size(), - fDigiBdfPar->GetNbChan(iSmType, iRpc), - iSmType, - iSm, - iRpc); + if (fvLastHits[iSmType][iSm][iRpc].size() != static_cast<size_t>(fDigiBdfPar->GetNbChan(iSmType, iRpc))) + LOG(fatal) << Form("Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", + fvLastHits[iSmType][iSm][iRpc].size(), fDigiBdfPar->GetNbChan(iSmType, iRpc), iSmType, iSm, + iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != iAddr) - LOG(fatal) << Form( - "Inconsistent address for Ev %8.0f in list of size %lu for " - "TSRC %d%d%d%d: 0x%08x, time %f", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) + LOG(fatal) << Form("Inconsistent address for Ev %8.0f in list of size %lu for " + "TSRC %d%d%d%d: 0x%08x, time %f", + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); } } } @@ -6157,54 +4533,33 @@ void CbmTofEventClusterizer::CheckLHMemory() { LOG(debug) << Form("LH check passed for event %8.0f", fdEvent); } -void CbmTofEventClusterizer::CleanLHMemory() { +void CbmTofEventClusterizer::CleanLHMemory() +{ if (fvLastHits.size() != static_cast<size_t>(fDigiBdfPar->GetNbSmTypes())) - LOG(fatal) << Form("Inconsistent LH Smtype size %lu, %d ", - fvLastHits.size(), - fDigiBdfPar->GetNbSmTypes()); + LOG(fatal) << Form("Inconsistent LH Smtype size %lu, %d ", fvLastHits.size(), fDigiBdfPar->GetNbSmTypes()); for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++) { - if (fvLastHits[iSmType].size() - != static_cast<size_t>(fDigiBdfPar->GetNbSm(iSmType))) - LOG(fatal) << Form("Inconsistent LH Sm size %lu, %d T %d", - fvLastHits[iSmType].size(), - fDigiBdfPar->GetNbSm(iSmType), - iSmType); + if (fvLastHits[iSmType].size() != static_cast<size_t>(fDigiBdfPar->GetNbSm(iSmType))) + LOG(fatal) << Form("Inconsistent LH Sm size %lu, %d T %d", fvLastHits[iSmType].size(), + fDigiBdfPar->GetNbSm(iSmType), iSmType); for (Int_t iSm = 0; iSm < fDigiBdfPar->GetNbSm(iSmType); iSm++) { - if (fvLastHits[iSmType][iSm].size() - != static_cast<size_t>(fDigiBdfPar->GetNbRpc(iSmType))) - LOG(fatal) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", - fvLastHits[iSmType][iSm].size(), - fDigiBdfPar->GetNbRpc(iSmType), - iSmType, - iSm); + if (fvLastHits[iSmType][iSm].size() != static_cast<size_t>(fDigiBdfPar->GetNbRpc(iSmType))) + LOG(fatal) << Form("Inconsistent LH Rpc size %lu, %d TS %d%d ", fvLastHits[iSmType][iSm].size(), + fDigiBdfPar->GetNbRpc(iSmType), iSmType, iSm); for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) { - if (fvLastHits[iSmType][iSm][iRpc].size() - != static_cast<size_t>(fDigiBdfPar->GetNbChan(iSmType, iRpc))) - LOG(fatal) << Form( - "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", - fvLastHits[iSmType][iSm][iRpc].size(), - fDigiBdfPar->GetNbChan(iSmType, iRpc), - iSmType, - iSm, - iRpc); + if (fvLastHits[iSmType][iSm][iRpc].size() != static_cast<size_t>(fDigiBdfPar->GetNbChan(iSmType, iRpc))) + LOG(fatal) << Form("Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ", + fvLastHits[iSmType][iSm][iRpc].size(), fDigiBdfPar->GetNbChan(iSmType, iRpc), iSmType, iSm, + iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) while (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); - if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() - != iAddr) - LOG(fatal) << Form( - "Inconsistent address for Ev %8.0f in list of size %lu for " - "TSRC %d%d%d%d: 0x%08x, time %f", - fdEvent, - fvLastHits[iSmType][iSm][iRpc][iCh].size(), - iSmType, - iSm, - iRpc, - iCh, - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), - fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); + if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) + LOG(fatal) << Form("Inconsistent address for Ev %8.0f in list of size %lu for " + "TSRC %d%d%d%d: 0x%08x, time %f", + fdEvent, fvLastHits[iSmType][iSm][iRpc][iCh].size(), iSmType, iSm, iRpc, iCh, + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress(), + fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()); fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete(); fvLastHits[iSmType][iSm][iRpc][iCh].pop_front(); } @@ -6214,14 +4569,9 @@ void CbmTofEventClusterizer::CleanLHMemory() { LOG(info) << Form("LH cleaning done after %8.0f events", fdEvent); } -Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, - Int_t iSm, - Int_t iRpc, - Int_t iLastChan, - Double_t dLastPosX, - Double_t dLastPosY, - Double_t dLastTime, - Double_t dLastTotS) { +Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iLastChan, Double_t dLastPosX, + Double_t dLastPosY, Double_t dLastTime, Double_t dLastTotS) +{ // Int_t iNbSm = fDigiBdfPar->GetNbSm( iSmType); (VF) not used Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType); Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); @@ -6233,35 +4583,24 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, Int_t iChId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); while (fvDeadStrips[iDetIndx] & (1 << iCh)) { - LOG(debug) << "Skip channel " << iCh << " of detector " - << Form("0x%08x", iDetId); + LOG(debug) << "Skip channel " << iCh << " of detector " << Form("0x%08x", iDetId); iCh++; iLastChan++; if (iCh >= iNbCh) return kFALSE; } - LOG(debug1) << Form("Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ", - iSmType, - iSm, - iRpc, - iCh, - dLastTime, + LOG(debug1) << Form("Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ", iSmType, iSm, iRpc, iCh, dLastTime, dLastPosY) << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (iCh == iNbCh) return kFALSE; if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) return kFALSE; if (0 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - if (fDutId > -1) - fhNbDigiPerChan->Fill( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + if (fDutId > -1) fhNbDigiPerChan->Fill(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); if (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { Bool_t AddedHit = kFALSE; - for (size_t i1 = 0; - i1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; - i1++) { + for (size_t i1 = 0; i1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; i1++) { if (AddedHit) break; size_t i2 = i1 + 1; - while (!AddedHit - && i2 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (!AddedHit && i2 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { LOG(debug1) << "check digi pair " << i1 << "," << i2 << " with size " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); @@ -6275,73 +4614,57 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist) { - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); - gGeoManager->FindNode( - fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); Double_t dTimeDif = xDigiA->GetTime() - xDigiB->GetTime(); Double_t dPosY = 0.; - if (1 == xDigiA->GetSide()) - dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + if (1 == xDigiA->GetSide()) dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; else - dPosY = - -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; - if (TMath::Abs(dPosY - dLastPosY) - < fdMaxSpaceDist) { // append digi pair to current cluster + if (TMath::Abs(dPosY - dLastPosY) < fdMaxSpaceDist) { // append digi pair to current cluster Double_t dNClHits = (Double_t)(vDigiIndRef.size() / 2); - Double_t dPosX = - ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); + Double_t dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); Double_t dTotS = xDigiA->GetTot() + xDigiB->GetTot(); Double_t dNewTotS = (dLastTotS + dTotS); - dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS; - dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS; - dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS; - dLastTotS = dNewTotS; + dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS; + dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS; + dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS; + dLastTotS = dNewTotS; // attach selected digis from pool Int_t Ind1 = fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; Int_t Ind2 = fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; vDigiIndRef.push_back(Ind1); vDigiIndRef.push_back(Ind2); // remove selected digis from pool - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + i1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1); std::vector<int>::iterator it; it = find(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(), - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end(), - Ind2); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end(), Ind2); if (it != fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end()) { - auto ipos = - it - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(); - LOG(debug1) << "Found i2 " << i2 << " with Ind2 " << Ind2 - << " at position " << ipos; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos); + auto ipos = it - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(); + LOG(debug1) << "Found i2 " << i2 << " with Ind2 " << Ind2 << " at position " << ipos; + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + ipos); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos); - } else { + } + else { LOG(fatal) << " Did not find i2 " << i2 << " with Ind2 " << Ind2; } //if(iCh == iNbCh-1) break; //Last strip reached if (iCh != (iNbCh - 1) - && AddNextChan(iSmType, - iSm, - iRpc, - iCh, - dLastPosX, - dLastPosY, - dLastTime, - dLastTotS)) { - LOG(debug1) << "Added Strip " << iCh << " to cluster of size " - << dNClHits; + && AddNextChan(iSmType, iSm, iRpc, iCh, dLastPosX, dLastPosY, dLastTime, dLastTotS)) { + LOG(debug1) << "Added Strip " << iCh << " to cluster of size " << dNClHits; return kTRUE; // signal hit was already added } AddedHit = kTRUE; @@ -6378,45 +4701,38 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, TString cstr = "Save A-Hit "; cstr += Form(" %3d %3d 0x%08x %3d 0x%08x %8.2f %6.2f", // %3d %3d - fiNbHits, - iNbChanInHit, - iDetId, - iLastChan, + fiNbHits, iNbChanInHit, iDetId, iLastChan, 0, //vPtsRef.size(),vPtsRef[0]) - dLastTime, - dLastPosY); + dLastTime, dLastPosY); cstr += Form(", DigiSize: %lu ", vDigiIndRef.size()); cstr += ", DigiInds: "; fviClusterMul[iSmType][iSm][iRpc]++; for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - cstr += - Form(" %d (M,%d)", vDigiIndRef.at(i), fviClusterMul[iSmType][iSm][iRpc]); + cstr += Form(" %d (M,%d)", vDigiIndRef.at(i), fviClusterMul[iSmType][iSm][iRpc]); } LOG(debug) << cstr; - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dLastTime, - vDigiIndRef.size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dLastTotS * 10.)); //channel -> Tot + CbmTofHit* pHit = new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dLastTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dLastTotS * 10.)); //channel -> Tot // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); if (fdMemoryTime > 0.) { // memorize hit LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + } + else { pHit->Delete(); } CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (size_t i = 0; i < vDigiIndRef.size(); i++) { Double_t dTot = (fTofCalDigiVec->at(vDigiIndRef.at(i))).GetTot(); - digiMatch->AddLink( - CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; vDigiIndRef.clear(); @@ -6424,69 +4740,44 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, return kTRUE; } -void CbmTofEventClusterizer::LH_store(Int_t iSmType, - Int_t iSm, - Int_t iRpc, - Int_t iChm, - CbmTofHit* pHit) { +void CbmTofEventClusterizer::LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit) +{ - if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) - fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); + if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); else { Double_t dLastTime = pHit->GetTime(); if (dLastTime >= fvLastHits[iSmType][iSm][iRpc][iChm].back()->GetTime()) { fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); - LOG(debug) << Form( - " Store LH from Ev %8.0f for TSRC %d%d%d%d, size %lu, addr 0x%08x, " - "time %f, dt %f", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - dLastTime, - dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()); - } else { + LOG(debug) << Form(" Store LH from Ev %8.0f for TSRC %d%d%d%d, size %lu, addr 0x%08x, " + "time %f, dt %f", + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), dLastTime, + dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()); + } + else { if (dLastTime - >= fvLastHits[iSmType][iSm][iRpc][iChm] - .front() - ->GetTime()) { // hit has to be inserted in the proper place + >= fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime()) { // hit has to be inserted in the proper place std::list<CbmTofHit*>::iterator it; - for (it = fvLastHits[iSmType][iSm][iRpc][iChm].begin(); - it != fvLastHits[iSmType][iSm][iRpc][iChm].end(); - ++it) + for (it = fvLastHits[iSmType][iSm][iRpc][iChm].begin(); it != fvLastHits[iSmType][iSm][iRpc][iChm].end(); ++it) if ((*it)->GetTime() > dLastTime) break; fvLastHits[iSmType][iSm][iRpc][iChm].insert(--it, pHit); Double_t deltaTime = dLastTime - (*it)->GetTime(); LOG(debug) << Form("Hit inserted into LH from Ev %8.0f for TSRC " "%d%d%d%d, size %lu, addr 0x%08x, delta time %f ", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - deltaTime); - } else { // this hit is first - Double_t deltaTime = - dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime(); + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), deltaTime); + } + else { // this hit is first + Double_t deltaTime = dLastTime - fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime(); LOG(debug) << Form("first LH from Ev %8.0f for TSRC %d%d%d%d, size " "%lu, addr 0x%08x, delta time %f ", - fdEvent, - iSmType, - iSm, - iRpc, - iChm, - fvLastHits[iSmType][iSm][iRpc][iChm].size(), - pHit->GetAddress(), - deltaTime); + fdEvent, iSmType, iSm, iRpc, iChm, fvLastHits[iSmType][iSm][iRpc][iChm].size(), + pHit->GetAddress(), deltaTime); if (deltaTime == 0.) { // remove hit, otherwise double entry? pHit->Delete(); - } else { + } + else { fvLastHits[iSmType][iSm][iRpc][iChm].push_front(pHit); } } @@ -6494,7 +4785,8 @@ void CbmTofEventClusterizer::LH_store(Int_t iSmType, } } -Bool_t CbmTofEventClusterizer::BuildHits() { +Bool_t CbmTofEventClusterizer::BuildHits() +{ // Then build clusters inside each RPC module // Assume only 0 or 1 Digi per channel/side in each event // Use simplest method possible, scan direction independent: @@ -6524,9 +4816,8 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // Int_t iTrafoCell=-1; (VF) not used Int_t iNbChanInHit = 0; // Last Channel Temp variables - Int_t iLastChan = -1; - Double_t dLastPosX = - 0.0; // -> Comment to remove warning because set but never used + Int_t iLastChan = -1; + Double_t dLastPosX = 0.0; // -> Comment to remove warning because set but never used Double_t dLastPosY = 0.0; Double_t dLastTime = 0.0; // Channel Temp variables @@ -6545,12 +4836,10 @@ Bool_t CbmTofEventClusterizer::BuildHits() { for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) { Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); Int_t iChType = fDigiBdfPar->GetChanType(iSmType, iRpc); - LOG(debug2) << "RPC - Loop " - << Form(" %3d %3d %3d %3d ", iSmType, iSm, iRpc, iChType); + LOG(debug2) << "RPC - Loop " << Form(" %3d %3d %3d %3d ", iSmType, iSm, iRpc, iChType); fviClusterMul[iSmType][iSm][iRpc] = 0; Int_t iChId = 0; - Int_t iDetId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); + Int_t iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); ; Int_t iDetIndx = fDetIdIndexMap[iDetId]; // Detector Index if (0 == iChType) { @@ -6568,11 +4857,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { dLastPosY = 0.0; dLastTime = 0.0; LOG(debug2) << "ChanOrient " - << Form(" %3d %3d %3d %3d %3d ", - iSmType, - iSm, - iRpc, - fDigiBdfPar->GetChanOrient(iSmType, iRpc), + << Form(" %3d %3d %3d %3d %3d ", iSmType, iSm, iRpc, fDigiBdfPar->GetChanOrient(iSmType, iRpc), iNbCh); if (1 == fDigiBdfPar->GetChanOrient(iSmType, iRpc)) { @@ -6580,196 +4865,110 @@ Bool_t CbmTofEventClusterizer::BuildHits() { } // if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) ) else { // Vertical strips => Y comes from bottom top time difference for (Int_t iCh = 0; iCh < iNbCh; iCh++) { - LOG(debug3) - << "VDigisize " - << Form(" T %3d Sm %3d R %3d Ch %3d Size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); - if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc].size()) - continue; - if (fvDeadStrips[iDetIndx] & (1 << iCh)) - continue; // skip over dead channels + LOG(debug3) << "VDigisize " + << Form(" T %3d Sm %3d R %3d Ch %3d Size %3lu ", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc].size()) continue; + if (fvDeadStrips[iDetIndx] & (1 << iCh)) continue; // skip over dead channels if (0 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - if (fDutId > -1) - fhNbDigiPerChan->Fill( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + if (fDutId > -1) fhNbDigiPerChan->Fill(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); - while (1 - < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - while ( - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetSide()) { + while ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetSide()) { // Not one Digi of each end! fiNbSameSide++; - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - > 2) { - LOG(debug) - << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc - << iCh << ", Times: " - << Form( - "%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime()) - << ", " - << Form( - "%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime()) - << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime() - << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetSide() - == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetSide()) { - LOG(debug) - << "3 consecutive SameSide Digis! on TSRC " << iSmType - << iSm << iRpc << iCh << ", Times: " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetTime() - << ", " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) - ->GetTime() - << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size(); + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() > 2) { + LOG(debug) << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " + << Form("%f", (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()) << ", " + << Form("%f", (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime()) + << ", DeltaT " + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetSide() + == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide()) { + LOG(debug) << "3 consecutive SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh + << ", Times: " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + << ", DeltaT " + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime() + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime() + << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { - if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetTime() - > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] - ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1] - ->GetTime()) { + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { + if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetTime() + > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]->GetTime()) { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { - LOG(debug) << Form( - "Ev %8.0f, digis not properly time ordered, TSRCS " - "%d%d%d%d%d ", - fdEvent, - iSmType, - iSm, - iRpc, - iCh, - (Int_t) - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] - ->GetSide()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { + LOG(debug) << Form("Ev %8.0f, digis not properly time ordered, TSRCS " + "%d%d%d%d%d ", + fdEvent, iSmType, iSm, iRpc, iCh, + (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() - + 1); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); } } - } else { - LOG(debug2) - << "SameSide Erase fStor entries(d) " << iSmType - << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; + } + else { + LOG(debug2) << "SameSide Erase fStor entries(d) " << iSmType << ", SR " << iSm * iNbRpc + iRpc + << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); } - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - break; + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) break; continue; } // same condition side end - LOG(debug2) - << "digis processing for " - << Form( - " SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + LOG(debug2) << "digis processing for " + << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - LOG(debug) << Form( - "Leaving digi processing for TSRC %d%d%d%d, size %3lu", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + LOG(debug) << Form("Leaving digi processing for TSRC %d%d%d%d, size %3lu", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); break; } /* Int_t iLastChId = iChId; // Save Last hit channel*/ // 2 Digis = both sides present - CbmTofDetectorInfo xDetInfo( - ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); - iChId = fTofId->SetDetectorInfo(xDetInfo); - Int_t iUCellId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); - LOG(debug1) - << Form(" TSRC %d%d%d%d size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); + CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + iChId = fTofId->SetDetectorInfo(xDetInfo); + Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); + LOG(debug1) << Form(" TSRC %d%d%d%d size %3lu ", iSmType, iSm, iRpc, iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) + << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { LOG(error) << "CbmTofEventClusterizer::BuildClusters: no " "geometry info! " - << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ", - iSmType, - iSm, - iRpc, - iCh, - iChId, - iUCellId); + << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ", iSmType, iSm, iRpc, iCh, iChId, iUCellId); break; } TGeoNode* fNode = // prepare local->global trafo - gGeoManager->FindNode(fChannelInfo->GetX(), - fChannelInfo->GetY(), - fChannelInfo->GetZ()); - LOG(debug2) << Form(" Node at (%6.1f,%6.1f,%6.1f) : %p", - fChannelInfo->GetX(), - fChannelInfo->GetY(), - fChannelInfo->GetZ(), - fNode); + gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ()); + LOG(debug2) << Form(" Node at (%6.1f,%6.1f,%6.1f) : %p", fChannelInfo->GetX(), fChannelInfo->GetY(), + fChannelInfo->GetZ(), fNode); // fNode->Print(); - CbmTofDigi* xDigiA = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]; - CbmTofDigi* xDigiB = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]; + CbmTofDigi* xDigiA = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]; + CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]; LOG(debug2) << " " << xDigiA->ToString(); LOG(debug2) << " " << xDigiB->ToString(); @@ -6779,51 +4978,38 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // FIXME -> Overflow treatment in calib/tdc/TMbsCalibTdcTof.cxx LOG(debug) << "CbmTofEventClusterizer::BuildClusters: " "Diamond hit in " - << iSm << " with inconsistent digits " - << xDigiA->GetTime() << ", " << xDigiB->GetTime() + << iSm << " with inconsistent digits " << xDigiA->GetTime() << ", " << xDigiB->GetTime() << " -> " << dTimeDif; LOG(debug) << " " << xDigiA->ToString(); LOG(debug) << " " << xDigiB->ToString(); } if (1 == xDigiA->GetSide()) // 0 is the top side, 1 is the bottom side - dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDif * 0.5; + dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; else // 0 is the bottom side, 1 is the top side - dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDif * 0.5; - - while (TMath::Abs(dPosY) - > fChannelInfo->GetSizey() * fPosYMaxScal - && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - > 2) { - LOG(debug) - << "Hit candidate outside correlation window, check for " - "better possible digis, " - << " mul " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); - - CbmTofDigi* xDigiC = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]; + dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + + while (TMath::Abs(dPosY) > fChannelInfo->GetSizey() * fPosYMaxScal + && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() > 2) { + LOG(debug) << "Hit candidate outside correlation window, check for " + "better possible digis, " + << " mul " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); + + CbmTofDigi* xDigiC = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]; Double_t dPosYN = 0.; Double_t dTimeDifN = 0; - if (xDigiC->GetSide() == xDigiA->GetSide()) - dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); + if (xDigiC->GetSide() == xDigiA->GetSide()) dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); else dTimeDifN = xDigiA->GetTime() - xDigiC->GetTime(); - if (1 == xDigiA->GetSide()) - dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDifN * 0.5; + if (1 == xDigiA->GetSide()) dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; else - dPosYN = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) - * dTimeDifN * 0.5; + dPosYN = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; if (TMath::Abs(dPosYN) < TMath::Abs(dPosY)) { - LOG(debug) - << "Replace digi on side " << xDigiC->GetSide() - << ", yPosNext " << dPosYN << " old: " << dPosY; + LOG(debug) << "Replace digi on side " << xDigiC->GetSide() << ", yPosNext " << dPosYN + << " old: " << dPosY; dTimeDif = dTimeDifN; dPosY = dPosYN; if (xDigiC->GetSide() == xDigiA->GetSide()) { @@ -6831,35 +5017,27 @@ Bool_t CbmTofEventClusterizer::BuildHits() { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); - } else { + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); + } + else { xDigiB = xDigiC; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(++( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() - + 1)); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( + ++(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1)); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1)); + ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1)); } - } else + } + else break; } //while loop end if (xDigiA->GetSide() == xDigiB->GetSide()) { - LOG(fatal) - << "Wrong combinations of digis " - << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0] - << "," - << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]; + LOG(fatal) << "Wrong combinations of digis " << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0] + << "," << fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]; } - if (TMath::Abs(dPosY) - > fChannelInfo->GetSizey() - * fPosYMaxScal) { // remove both digis - LOG(debug1) << "Remove digis on TSRC " << iSmType << iSm - << iRpc << iCh << " with dPosY " << dPosY + if (TMath::Abs(dPosY) > fChannelInfo->GetSizey() * fPosYMaxScal) { // remove both digis + LOG(debug1) << "Remove digis on TSRC " << iSmType << iSm << iRpc << iCh << " with dPosY " << dPosY << " > " << fChannelInfo->GetSizey(); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); @@ -6874,25 +5052,14 @@ Bool_t CbmTofEventClusterizer::BuildHits() { dTotS = xDigiA->GetTot() + xDigiB->GetTot(); // use local coordinates, (0,0,0) is in the center of counter ? - dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) - * fChannelInfo->GetSizex(); + dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5) * fChannelInfo->GetSizex(); dPosZ = 0.; - LOG(debug1) - << "NbChanInHit " - << Form(" %3d %3d %3d %3d %3d 0x%p %1.0f Time %f PosX %f " - "PosY %f Svel %f ", - iNbChanInHit, - iSmType, - iRpc, - iCh, - iLastChan, - xDigiA, - xDigiA->GetSide(), - dTime, - dPosX, - dPosY, - fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) + LOG(debug1) << "NbChanInHit " + << Form(" %3d %3d %3d %3d %3d 0x%p %1.0f Time %f PosX %f " + "PosY %f Svel %f ", + iNbChanInHit, iSmType, iRpc, iCh, iLastChan, xDigiA, xDigiA->GetSide(), dTime, + dPosX, dPosY, fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)) // << Form( ", Offs %f, %f ",fvCPTOff[iSmType][iSm*iNbRpc+iRpc][iCh][0], // fvCPTOff[iSmType][iSm*iNbRpc+iRpc][iCh][1]) ; @@ -6903,16 +5070,14 @@ Bool_t CbmTofEventClusterizer::BuildHits() { if (fDutId > -1) { fhDigTimeDifClust->Fill(dTime - dLastTime); fhDigSpacDifClust->Fill(dPosY - dLastPosY); - fhDigDistClust->Fill(dPosY - dLastPosY, - dTime - dLastTime); + fhDigDistClust->Fill(dPosY - dLastPosY, dTime - dLastTime); } } // if( iLastChan == iCh - 1 ) // a cluster is already started => check distance in space/time // For simplicity, just check along strip direction for now // and break cluster when a not fired strip is found - if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist - && iLastChan == iCh - 1 + if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist && iLastChan == iCh - 1 && TMath::Abs(dPosY - dLastPosY) < fdMaxSpaceDist) { // Add to cluster/hit dWeightedTime += dTime * dTotS; @@ -6922,26 +5087,20 @@ Bool_t CbmTofEventClusterizer::BuildHits() { dWeightsSum += dTotS; iNbChanInHit += 1; - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); - LOG(debug1) - << " Add Digi and erase fStor entries(a): NbChanInHit " - << iNbChanInHit << ", " << iSmType << ", SR " - << iSm * iNbRpc + iRpc << ", Ch" << iCh; + LOG(debug1) << " Add Digi and erase fStor entries(a): NbChanInHit " << iNbChanInHit << ", " + << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); } // if current Digis compatible with last fired chan else { @@ -6965,8 +5124,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { Double_t hitpos[3] = {3 * 0.}; if (5 != iSmType) { /*TGeoNode* cNode =*/gGeoManager->GetCurrentNode(); - /*TGeoHMatrix* cMatrix =*/gGeoManager - ->GetCurrentMatrix(); + /*TGeoHMatrix* cMatrix =*/gGeoManager->GetCurrentMatrix(); //cNode->Print(); //cMatrix->Print(); @@ -6974,11 +5132,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { } LOG(debug1) << Form(" LocalToMaster: (%6.1f,%6.1f,%6.1f) " "->(%6.1f,%6.1f,%6.1f)", - hitpos_local[0], - hitpos_local[1], - hitpos_local[2], - hitpos[0], - hitpos[1], + hitpos_local[0], hitpos_local[1], hitpos_local[2], hitpos[0], hitpos[1], hitpos[2]); TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]); @@ -6986,8 +5140,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // Simple errors, not properly done at all for now // Right way of doing it should take into account the weight distribution // and real system time resolution - TVector3 hitPosErr( - 0.5, 0.5, 0.5); // including positioning uncertainty + TVector3 hitPosErr(0.5, 0.5, 0.5); // including positioning uncertainty /* TVector3 hitPosErr( fChannelInfo->GetSizex()/TMath::Sqrt(12.0), // Single strips approximation 0.5, // Use generic value @@ -7000,143 +5153,101 @@ Bool_t CbmTofEventClusterizer::BuildHits() { //TMath::Sqrt(12.0) ); // Use full RPC thickness as "Channel" Z size // Int_t iDetId = vPtsRef[0]->GetDetectorID();// detID = pt->GetDetectorID() <= from TofPoint // calc mean ch from dPosX=((Double_t)(-iNbCh/2 + iCh)+0.5)*fChannelInfo->GetSizex(); - Int_t iChm = - floor(dWeightedPosX / fChannelInfo->GetSizex()) - + iNbCh / 2; + Int_t iChm = floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; if (iChm < 0) iChm = 0; if (iChm > iNbCh - 1) iChm = iNbCh - 1; - iDetId = CbmTofAddress::GetUniqueAddress( - iSm, iRpc, iChm, 0, iSmType); + iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); Int_t iRefId = 0; // Index of the correspondng TofPoint // if(NULL != fTofPointsColl) { //iRefId = fTofPointsColl->IndexOf( vPtsRef[0] ); //} TString sRef = ""; for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - sRef += Form(" %d, (M%d)", - vDigiIndRef.at(i), - fviClusterMul[iSmType][iSm][iRpc]); + sRef += Form(" %d, (M%d)", vDigiIndRef.at(i), fviClusterMul[iSmType][iSm][iRpc]); } LOG(debug) << "Save Hit " - << Form(" %3d %3d 0x%08x %3d %3d %3d %f %f", - fiNbHits, - iNbChanInHit, - iDetId, - iChm, - iLastChan, - iRefId, - dWeightedTime, - dWeightedPosY) - << ", DigiSize: " << vDigiIndRef.size() - << ", DigiInds: " << sRef; + << Form(" %3d %3d 0x%08x %3d %3d %3d %f %f", fiNbHits, iNbChanInHit, iDetId, iChm, + iLastChan, iRefId, dWeightedTime, dWeightedPosY) + << ", DigiSize: " << vDigiIndRef.size() << ", DigiInds: " << sRef; fviClusterMul[iSmType][iSm][iRpc]++; if (vDigiIndRef.size() < 2) { - LOG(warning) << "Digi refs for Hit " << fiNbHits - << ": vDigiIndRef.size()"; + LOG(warning) << "Digi refs for Hit " << fiNbHits << ": vDigiIndRef.size()"; } if (fiNbHits > 0) { - CbmTofHit* pHitL = - (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); - if (iDetId == pHitL->GetAddress() - && dWeightedTime == pHitL->GetTime()) { - LOG(debug) - << "Store Hit twice? " - << " fiNbHits " << fiNbHits << ", " - << Form("0x%08x, MatchCollSize %d, IndRefSize %lu ", - iDetId, - fTofDigiMatchColl->GetEntriesFast(), - vDigiIndRef.size()); + CbmTofHit* pHitL = (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); + if (iDetId == pHitL->GetAddress() && dWeightedTime == pHitL->GetTime()) { + LOG(debug) << "Store Hit twice? " + << " fiNbHits " << fiNbHits << ", " + << Form("0x%08x, MatchCollSize %d, IndRefSize %lu ", iDetId, + fTofDigiMatchColl->GetEntriesFast(), vDigiIndRef.size()); for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - if (vDigiIndRef.at(i) - < (Int_t) fTofCalDigiVec->size()) { - CbmTofDigi* pDigiC = - &(fTofCalDigiVec->at(vDigiIndRef.at(i))); - LOG(debug) - << " Digi " << i << " " << pDigiC->ToString(); - } else { - LOG(fatal) - << "Insufficient CalDigiVec size for i " << i - << ", Ind " << vDigiIndRef.at(i); + if (vDigiIndRef.at(i) < (Int_t) fTofCalDigiVec->size()) { + CbmTofDigi* pDigiC = &(fTofCalDigiVec->at(vDigiIndRef.at(i))); + LOG(debug) << " Digi " << i << " " << pDigiC->ToString(); + } + else { + LOG(fatal) << "Insufficient CalDigiVec size for i " << i << ", Ind " << vDigiIndRef.at(i); } } - if (NULL == fTofDigiMatchColl) - assert("No DigiMatchColl"); + if (NULL == fTofDigiMatchColl) assert("No DigiMatchColl"); CbmMatch* digiMatchL = NULL; - if (fTofDigiMatchColl->GetEntriesFast() - >= fiNbHits - 1) { - digiMatchL = - (CbmMatch*) fTofDigiMatchColl->At(fiNbHits - 1); - } else { - LOG(fatal) << "DigiMatchColl has insufficient size " - << fTofDigiMatchColl->GetEntriesFast(); + if (fTofDigiMatchColl->GetEntriesFast() >= fiNbHits - 1) { + digiMatchL = (CbmMatch*) fTofDigiMatchColl->At(fiNbHits - 1); + } + else { + LOG(fatal) << "DigiMatchColl has insufficient size " << fTofDigiMatchColl->GetEntriesFast(); } if (NULL != digiMatchL) - for (Int_t i = 0; i < digiMatchL->GetNofLinks(); - i++) { + for (Int_t i = 0; i < digiMatchL->GetNofLinks(); i++) { CbmLink L0 = digiMatchL->GetLink(i); - LOG(debug) << "report link " << i << "(" - << digiMatchL->GetNofLinks() - << "), ind " << L0.GetIndex(); + LOG(debug) << "report link " << i << "(" << digiMatchL->GetNofLinks() << "), ind " + << L0.GetIndex(); Int_t iDigIndL = L0.GetIndex(); if (iDigIndL >= (Int_t) vDigiIndRef.size()) { if (iDetId != fiBeamRefAddr) { - LOG(warn) - << Form("Invalid DigiRefInd for det 0x%08x", - iDetId); + LOG(warn) << Form("Invalid DigiRefInd for det 0x%08x", iDetId); continue; } } - if (vDigiIndRef.at(iDigIndL) - >= (Int_t) fTofCalDigiVec->size()) { + if (vDigiIndRef.at(iDigIndL) >= (Int_t) fTofCalDigiVec->size()) { LOG(warn) << "Invalid CalDigiInd"; continue; } - CbmTofDigi* pDigiC = - &(fTofCalDigiVec->at(vDigiIndRef.at(iDigIndL))); + CbmTofDigi* pDigiC = &(fTofCalDigiVec->at(vDigiIndRef.at(iDigIndL))); LOG(debug) << " DigiL " << pDigiC->ToString(); } else { - LOG(warn) << "Invalid digMatch Link at Index " - << fiNbHits - 1; + LOG(warn) << "Invalid digMatch Link at Index " << fiNbHits - 1; } } - LOG(debug) << "Current HitsColl length " - << fTofHitsColl->GetEntriesFast(); + LOG(debug) << "Current HitsColl length " << fTofHitsColl->GetEntriesFast(); } - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dWeightedTime, - vDigiIndRef - .size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dWeightsSum * 10.)); //channel -> Tot + CbmTofHit* pHit = + new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dWeightedTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dWeightsSum * 10.)); //channel -> Tot //0) ; //channel // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { - LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + else { pHit->Delete(); } - CbmMatch* digiMatch = - new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); + CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (size_t i = 0; i < vDigiIndRef.size(); i++) { - Double_t dTot = - (fTofCalDigiVec->at(vDigiIndRef.at(i))).GetTot(); - digiMatch->AddLink(CbmLink(dTot, - vDigiIndRef.at(i), - fiOutputTreeEntry, - fiFileIndex)); + Double_t dTot = (fTofCalDigiVec->at(vDigiIndRef.at(i))).GetTot(); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; @@ -7163,30 +5274,22 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // Save pointer on CbmTofPoint // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) ); // Save next digi address - LOG(debug2) - << " Next fStor Digi " << iSmType << ", SR " - << iSm * iNbRpc + iRpc << ", Ch" << iCh << ", Dig0 " - << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - << ", Dig1 " - << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]); - - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); - LOG(debug2) - << " Erase fStor entries(b) " << iSmType << ", SR " - << iSm * iNbRpc + iRpc << ", Ch" << iCh; + LOG(debug2) << " Next fStor Digi " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh + << ", Dig0 " << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]) << ", Dig1 " + << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]); + + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + LOG(debug2) << " Erase fStor entries(b) " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" + << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); if (kTRUE == fDigiBdfPar->ClustUseTrackId()) { // if( ((CbmTofPoint*)(xDigiA->GetLinks()))->GetTrackID() != @@ -7202,15 +5305,8 @@ Bool_t CbmTofEventClusterizer::BuildHits() { } // else of if current Digis compatible with last fired chan } // if( 0 < iNbChanInHit) else { - LOG(debug) << Form( - "1.Hit on TSRC %d%d%d%d, time: %f, PosY %f, Tdif %f ", - iSmType, - iSm, - iRpc, - iCh, - dTime, - dPosY, - dTimeDif); + LOG(debug) << Form("1.Hit on TSRC %d%d%d%d, time: %f, PosY %f, Tdif %f ", iSmType, iSm, iRpc, iCh, + dTime, dPosY, dTimeDif); // first fired strip in this RPC dWeightedTime = dTime * dTotS; @@ -7222,14 +5318,11 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // Save pointer on CbmTofPoint //if(NULL != fTofPointsColl) // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) ); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); - vDigiIndRef.push_back((Int_t)( - fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); - - LOG(debug2) - << " Erase fStor entries(c) " << iSmType << ", SR " - << iSm * iNbRpc + iRpc << ", Ch" << iCh; + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])); + vDigiIndRef.push_back((Int_t)(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1])); + + LOG(debug2) << " Erase fStor entries(c) " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" + << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( @@ -7255,14 +5348,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { dLastPosX = dPosX; dLastPosY = dPosY; dLastTime = dTime; - if (AddNextChan(iSmType, - iSm, - iRpc, - iLastChan, - dLastPosX, - dLastPosY, - dLastTime, - dWeightsSum)) { + if (AddNextChan(iSmType, iSm, iRpc, iLastChan, dLastPosX, dLastPosY, dLastTime, dWeightsSum)) { iNbChanInHit = 0; // cluster already stored } } // while( 1 < fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ) @@ -7270,20 +5356,13 @@ Bool_t CbmTofEventClusterizer::BuildHits() { fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].clear(); } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ ) LOG(debug2) << "finished V-RPC" - << Form(" %3d %3d %3d %d %f %fx", - iSmType, - iSm, - iRpc, - fTofHitsColl->GetEntries(), - dLastPosX, + << Form(" %3d %3d %3d %d %f %fx", iSmType, iSm, iRpc, fTofHitsColl->GetEntries(), dLastPosX, dLastPosY); } // else of if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) ) } // if( 0 == iChType) else { - LOG(error) - << "=> Cluster building " - << "from digis to hits not implemented for pads, Sm type " - << iSmType << " Rpc " << iRpc; + LOG(error) << "=> Cluster building " + << "from digis to hits not implemented for pads, Sm type " << iSmType << " Rpc " << iRpc; return kFALSE; } // else of if( 0 == iChType) @@ -7325,19 +5404,13 @@ Bool_t CbmTofEventClusterizer::BuildHits() { } LOG(debug1) << Form(" LocalToMaster for V-node: " "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)", - hitpos_local[0], - hitpos_local[1], - hitpos_local[2], - hitpos[0], - hitpos[1], - hitpos[2]); + hitpos_local[0], hitpos_local[1], hitpos_local[2], hitpos[0], hitpos[1], hitpos[2]); TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]); // Event errors, not properly done at all for now // Right way of doing it should take into account the weight distribution // and real system time resolution - TVector3 hitPosErr( - 0.5, 0.5, 0.5); // including positioning uncertainty + TVector3 hitPosErr(0.5, 0.5, 0.5); // including positioning uncertainty /* TVector3 hitPosErr( fChannelInfo->GetSizex()/TMath::Sqrt(12.0), // Single strips approximation 0.5, // Use generic value @@ -7352,81 +5425,58 @@ Bool_t CbmTofEventClusterizer::BuildHits() { // cout<<"c "<<vPtsRef[0]->GetDetectorID()<<endl; // Int_t iDetId = vPtsRef[0]->GetDetectorID();// detID = pt->GetDetectorID() <= from TofPoint // Int_t iDetId = iChId; - Int_t iChm = - floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; + Int_t iChm = floor(dWeightedPosX / fChannelInfo->GetSizex()) + iNbCh / 2; if (iChm < 0) iChm = 0; if (iChm > iNbCh - 1) iChm = iNbCh - 1; - iDetId = - CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); + iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType); //Int_t iRefId = 0; // Index of the correspondng TofPoint //if(NULL != fTofPointsColl) iRefId = fTofPointsColl->IndexOf( vPtsRef[0] ); TString cstr = "Save V-Hit "; - cstr += Form( - " %3d %3d 0x%08x TSR %d%d%d Ch %2d %8.2f %6.2f", // %3d %3d - fiNbHits, - iNbChanInHit, - iDetId, - iSmType, - iSm, - iRpc, - iChm, - dWeightedTime, - dWeightedPosY); - - cstr += Form(", DigiSize: %lu (%3lu)", - vDigiIndRef.size(), - fTofCalDigiVec->size()); + cstr += Form(" %3d %3d 0x%08x TSR %d%d%d Ch %2d %8.2f %6.2f", // %3d %3d + fiNbHits, iNbChanInHit, iDetId, iSmType, iSm, iRpc, iChm, dWeightedTime, dWeightedPosY); + + cstr += Form(", DigiSize: %lu (%3lu)", vDigiIndRef.size(), fTofCalDigiVec->size()); cstr += ", DigiInds: "; fviClusterMul[iSmType][iSm][iRpc]++; for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - cstr += Form(" %3d (M,%2d)", - vDigiIndRef.at(i), - fviClusterMul[iSmType][iSm][iRpc]); + cstr += Form(" %3d (M,%2d)", vDigiIndRef.at(i), fviClusterMul[iSmType][iSm][iRpc]); } LOG(debug) << cstr; if (vDigiIndRef.size() < 2) { - LOG(warning) << "Digi refs for Hit " << fiNbHits - << ": vDigiIndRef.size()"; + LOG(warning) << "Digi refs for Hit " << fiNbHits << ": vDigiIndRef.size()"; } if (fiNbHits > 0) { CbmTofHit* pHitL = (CbmTofHit*) fTofHitsColl->At(fiNbHits - 1); - if (iDetId == pHitL->GetAddress() - && dWeightedTime == pHitL->GetTime()) + if (iDetId == pHitL->GetAddress() && dWeightedTime == pHitL->GetTime()) LOG(debug) << "Store Hit twice? " - << " fiNbHits " << fiNbHits << ", " - << Form("0x%08x", iDetId); + << " fiNbHits " << fiNbHits << ", " << Form("0x%08x", iDetId); } - CbmTofHit* pHit = new CbmTofHit( - iDetId, - hitPos, - hitPosErr, //local detector coordinates - fiNbHits, // this number is used as reference!! - dWeightedTime, - vDigiIndRef.size(), // number of linked digis = 2*CluSize - //vPtsRef.size(), // flag = number of TofPoints generating the cluster - Int_t(dWeightsSum * 10.)); //channel -> Tot + CbmTofHit* pHit = new CbmTofHit(iDetId, hitPos, + hitPosErr, //local detector coordinates + fiNbHits, // this number is used as reference!! + dWeightedTime, + vDigiIndRef.size(), // number of linked digis = 2*CluSize + //vPtsRef.size(), // flag = number of TofPoints generating the cluster + Int_t(dWeightsSum * 10.)); //channel -> Tot // 0) ; //channel // vDigiIndRef); // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { - LH_store(iSmType, iSm, iRpc, iChm, pHit); - } else { + if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + else { pHit->Delete(); } - CbmMatch* digiMatch = - new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); + CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (size_t i = 0; i < vDigiIndRef.size(); i++) { Double_t dTot = fTofCalDigiVec->at(vDigiIndRef.at(i)).GetTot(); - digiMatch->AddLink(CbmLink( - dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); + digiMatch->AddLink(CbmLink(dTot, vDigiIndRef.at(i), fiOutputTreeEntry, fiFileIndex)); } fiNbHits++; @@ -7444,12 +5494,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { vDigiIndRef.clear(); } // else of if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) ) } // if( 0 < iNbChanInHit) - LOG(debug2) << " Fini-A " - << Form(" %3d %3d %3d M%3d", - iSmType, - iSm, - iRpc, - fviClusterMul[iSmType][iSm][iRpc]); + LOG(debug2) << " Fini-A " << Form(" %3d %3d %3d M%3d", iSmType, iSm, iRpc, fviClusterMul[iSmType][iSm][iRpc]); } // for each sm/rpc pair LOG(debug2) << " Fini-B " << Form(" %3d ", iSmType); } // for( Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++ ) @@ -7457,7 +5502,8 @@ Bool_t CbmTofEventClusterizer::BuildHits() { return kTRUE; } -Bool_t CbmTofEventClusterizer::CalibRawDigis() { +Bool_t CbmTofEventClusterizer::CalibRawDigis() +{ CbmTofDigi* pDigi; CbmTofDigi* pCalDigi = NULL; Int_t iDigIndCal = -1; @@ -7471,21 +5517,16 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { //pDigi = (CbmTofDigi*) fTofDigisColl->At( iDigInd ); if (fbSwapChannelSides && 5 != pDigi->GetType() && 8 != pDigi->GetType()) { - pDigi->SetAddress(pDigi->GetSm(), - pDigi->GetRpc(), - pDigi->GetChannel(), - (0 == pDigi->GetSide()) ? 1 : 0, + pDigi->SetAddress(pDigi->GetSm(), pDigi->GetRpc(), pDigi->GetChannel(), (0 == pDigi->GetSide()) ? 1 : 0, pDigi->GetType()); } Int_t iAddr = pDigi->GetAddress(); LOG(debug1) << "BC " // Before Calibration - << Form("0x%08x", pDigi->GetAddress()) << " TSRC " - << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() - << Form("%2d", (Int_t) pDigi->GetChannel()) << " " - << pDigi->GetSide() << " " << Form("%f", pDigi->GetTime()) - << " " << pDigi->GetTot(); + << Form("0x%08x", pDigi->GetAddress()) << " TSRC " << pDigi->GetType() << pDigi->GetSm() + << pDigi->GetRpc() << Form("%2d", (Int_t) pDigi->GetChannel()) << " " << pDigi->GetSide() << " " + << Form("%f", pDigi->GetTime()) << " " << pDigi->GetTot(); /* if (pDigi->GetType() == 5 || pDigi->GetType() @@ -7497,18 +5538,17 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { std::map<Int_t, Double_t>::iterator it; it = mChannelDeadTime.find(iAddr); if (it != mChannelDeadTime.end()) { - LOG(debug1) << "CCT found valid ChannelDeadtime entry " - << mChannelDeadTime[iAddr] << ", DeltaT " + LOG(debug1) << "CCT found valid ChannelDeadtime entry " << mChannelDeadTime[iAddr] << ", DeltaT " << pDigi->GetTime() - mChannelDeadTime[iAddr]; - if ((bValid = (pDigi->GetTime() - > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { + if ((bValid = (pDigi->GetTime() > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { // pCalDigi = new((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi( *pDigi ); fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); pCalDigi = &(fTofCalDigiVec->back()); iDigIndCal++; } - } else { + } + else { fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); pCalDigi = &(fTofCalDigiVec->back()); iDigIndCal++; @@ -7518,88 +5558,66 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { if (!bValid) continue; LOG(debug1) << "DC " // After deadtime check. before Calibration - << Form("0x%08x", pDigi->GetAddress()) << " TSRC " - << pDigi->GetType() << pDigi->GetSm() << pDigi->GetRpc() - << Form("%2d", (Int_t) pDigi->GetChannel()) << " " - << pDigi->GetSide() << " " << Form("%f", pDigi->GetTime()) - << " " << pDigi->GetTot(); + << Form("0x%08x", pDigi->GetAddress()) << " TSRC " << pDigi->GetType() << pDigi->GetSm() + << pDigi->GetRpc() << Form("%2d", (Int_t) pDigi->GetChannel()) << " " << pDigi->GetSide() << " " + << Form("%f", pDigi->GetTime()) << " " << pDigi->GetTot(); if (fbPs2Ns) { - pCalDigi->SetTime(pCalDigi->GetTime() - / 1000.); // for backward compatibility - pCalDigi->SetTot(pCalDigi->GetTot() - / 1000.); // for backward compatibility + pCalDigi->SetTime(pCalDigi->GetTime() / 1000.); // for backward compatibility + pCalDigi->SetTot(pCalDigi->GetTot() / 1000.); // for backward compatibility } - if (fDigiBdfPar->GetNbSmTypes() - > pDigi->GetType() // prevent crash due to misconfiguration + if (fDigiBdfPar->GetNbSmTypes() > pDigi->GetType() // prevent crash due to misconfiguration && fDigiBdfPar->GetNbSm(pDigi->GetType()) > pDigi->GetSm() && fDigiBdfPar->GetNbRpc(pDigi->GetType()) > pDigi->GetRpc() - && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) - > pDigi->GetChannel()) { + && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { LOG(debug2) << " CluCal-Init: " << pDigi->ToString(); // apply calibration vectors - pCalDigi->SetTime( - pCalDigi->GetTime() - // calibrate Digi Time - fvCPTOff[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); + pCalDigi->SetTime(pCalDigi->GetTime() - // calibrate Digi Time + fvCPTOff[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); LOG(debug2) << " CluCal-TOff: " << pCalDigi->ToString(); - Double_t dTot = - pCalDigi->GetTot() + fRndm->Uniform(0, 1) - // subtract Offset - fvCPTotOff[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]; + Double_t dTot = pCalDigi->GetTot() + fRndm->Uniform(0, 1) - // subtract Offset + fvCPTotOff[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]; if (dTot < 0.001) dTot = 0.001; - pCalDigi->SetTot( - dTot * // calibrate Digi ToT - fvCPTotGain[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); + pCalDigi->SetTot(dTot * // calibrate Digi ToT + fvCPTotGain[pDigi->GetType()][pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]); // walk correction Double_t dTotBinSize = (fdTOTMax - fdTOTMin) / nbClWalkBinX; - Int_t iWx = (Int_t)((pCalDigi->GetTot() - fdTOTMin) / dTotBinSize); + Int_t iWx = (Int_t)((pCalDigi->GetTot() - fdTOTMin) / dTotBinSize); if (0 > iWx) iWx = 0; if (iWx >= nbClWalkBinX) iWx = nbClWalkBinX - 1; - Double_t dDTot = - (pCalDigi->GetTot() - fdTOTMin) / dTotBinSize - (Double_t) iWx - 0.5; + Double_t dDTot = (pCalDigi->GetTot() - fdTOTMin) / dTotBinSize - (Double_t) iWx - 0.5; Double_t dWT = - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]; + fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]; if (dDTot > 0) { // linear interpolation to next bin if (iWx < nbClWalkBinX - 1) { // linear interpolation to next bin - dWT += dDTot - * (fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx + 1] - - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]); //memory leak??? + dWT += + dDTot + * (fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx + 1] + - fvCPWalk[pCalDigi->GetType()] + [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + pCalDigi->GetRpc()] + [pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]); //memory leak??? } - } else // dDTot < 0, linear interpolation to next bin + } + else // dDTot < 0, linear interpolation to next bin { if (0 < iWx) { // linear interpolation to next bin - dWT -= dDTot - * (fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx - 1] - - fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]); //memory leak??? + dWT -= + dDTot + * (fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx - 1] + - fvCPWalk[pCalDigi->GetType()] + [pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + pCalDigi->GetRpc()] + [pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]); //memory leak??? } } @@ -7607,96 +5625,61 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { LOG(debug2) << " CluCal-Walk: " << pCalDigi->ToString(); if (1) { //pDigi->GetType()==7 && pDigi->GetSm()==0){ - LOG(debug) << "BuildClusters: CalDigi " - << Form("%02d TSRCS ", iDigIndCal) << pCalDigi->GetType() - << pCalDigi->GetSm() << pCalDigi->GetRpc() - << Form("%02d", Int_t(pCalDigi->GetChannel())) - << pCalDigi->GetSide() - << Form(", T %15.3f", pCalDigi->GetTime()) << ", Tot " - << pCalDigi->GetTot() << ", TotGain " - << fvCPTotGain[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()] - << ", TotOff " - << fvCPTotOff[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()] - << ", Walk " << iWx << ": " - << fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx]; - - LOG(debug1) << " dDTot " << dDTot << " BinSize: " << dTotBinSize - << ", CPWalk " - << fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx - 1] - << ", " - << fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx] - << ", " - << fvCPWalk[pCalDigi->GetType()] - [pCalDigi->GetSm() - * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) - + pCalDigi->GetRpc()][pCalDigi->GetChannel()] - [pCalDigi->GetSide()][iWx + 1] - << " -> dWT = " << dWT; + LOG(debug) + << "BuildClusters: CalDigi " << Form("%02d TSRCS ", iDigIndCal) << pCalDigi->GetType() << pCalDigi->GetSm() + << pCalDigi->GetRpc() << Form("%02d", Int_t(pCalDigi->GetChannel())) << pCalDigi->GetSide() + << Form(", T %15.3f", pCalDigi->GetTime()) << ", Tot " << pCalDigi->GetTot() << ", TotGain " + << fvCPTotGain[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()] + << ", TotOff " + << fvCPTotOff[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()] + << ", Walk " << iWx << ": " + << fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx]; + + LOG(debug1) + << " dDTot " << dDTot << " BinSize: " << dTotBinSize << ", CPWalk " + << fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx - 1] + << ", " + << fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx] + << ", " + << fvCPWalk[pCalDigi->GetType()][pCalDigi->GetSm() * fDigiBdfPar->GetNbRpc(pCalDigi->GetType()) + + pCalDigi->GetRpc()][pCalDigi->GetChannel()][pCalDigi->GetSide()][iWx + 1] + << " -> dWT = " << dWT; } - } else { + } + else { LOG(info) << "Skip1 Digi " - << " Type " << pDigi->GetType() << " " - << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() - << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " - << pDigi->GetRpc() << " " - << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " - << pDigi->GetChannel() << " " + << " Type " << pDigi->GetType() << " " << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm() << " " + << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc " << pDigi->GetRpc() << " " + << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch " << pDigi->GetChannel() << " " << fDigiBdfPar->GetNbChan(pDigi->GetType(), 0); } if (0) // (bAddBeamCounterSideDigi) if (pCalDigi->GetType() == 5 - || pCalDigi->GetType() - == 8) { // for Pad counters generate fake digi to mockup a strip - LOG(debug) << "add Pad counter 2. Side digi for 0x" << std::hex - << pCalDigi->GetAddress(); + || pCalDigi->GetType() == 8) { // for Pad counters generate fake digi to mockup a strip + LOG(debug) << "add Pad counter 2. Side digi for 0x" << std::hex << pCalDigi->GetAddress(); fTofCalDigiVec->push_back(CbmTofDigi(*pCalDigi)); CbmTofDigi* pCalDigi2 = &(fTofCalDigiVec->back()); iDigIndCal++; // CbmTofDigi *pCalDigi2 = new((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi( *pCalDigi ); if (pCalDigi->GetSide() == 0) - pCalDigi2->SetAddress(pCalDigi->GetSm(), - pCalDigi->GetRpc(), - pCalDigi->GetChannel(), - 1, - pCalDigi->GetType()); + pCalDigi2->SetAddress(pCalDigi->GetSm(), pCalDigi->GetRpc(), pCalDigi->GetChannel(), 1, pCalDigi->GetType()); else - pCalDigi2->SetAddress(pCalDigi->GetSm(), - pCalDigi->GetRpc(), - pCalDigi->GetChannel(), - 0, - pCalDigi->GetType()); + pCalDigi2->SetAddress(pCalDigi->GetSm(), pCalDigi->GetRpc(), pCalDigi->GetChannel(), 0, pCalDigi->GetType()); } } // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ ) // iNbTofDigi = fTofCalDigisColl->GetEntries(); // update because of added duplicted digis - iNbTofDigi = - fTofCalDigiVec->size(); // update because of added duplicted digis + iNbTofDigi = fTofCalDigiVec->size(); // update because of added duplicted digis //if(fTofCalDigisColl->IsSortable()) // LOG(debug)<<"CbmTofEventClusterizer::BuildClusters: Sort "<<fTofCalDigisColl->GetEntries()<<" calibrated digis "; - LOG(debug) << "CbmTofEventClusterizer::BuildClusters: Sort " - << fTofCalDigiVec->size() << " calibrated digis "; + LOG(debug) << "CbmTofEventClusterizer::BuildClusters: Sort " << fTofCalDigiVec->size() << " calibrated digis "; if (iNbTofDigi > 1) { std::vector<CbmTofDigi>* tTofCalDigiVec = nullptr; if (NULL != fTofDigiPointMatches) { // temporary copy @@ -7705,25 +5688,18 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { // fTofCalDigisColl->Sort(iNbTofDigi); // Time order again, in case modified by the calibration /// Sort the buffers of hits due to the time offsets applied - std::sort(fTofCalDigiVec->begin(), - fTofCalDigiVec->end(), - [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { - return a.GetTime() < b.GetTime(); - }); + std::sort(fTofCalDigiVec->begin(), fTofCalDigiVec->end(), + [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); }); // std::sort(fTofCalDigiVec->begin(), fTofCalDigiVec->end()); // if(!fTofCalDigisColl->IsSorted()){ // if ( ! std::is_sorted(fTofCalDigiVec->begin(), fTofCalDigiVec->end())) - if (!std::is_sorted(fTofCalDigiVec->begin(), - fTofCalDigiVec->end(), - [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { - return a.GetTime() < b.GetTime(); - })) - LOG(warning) - << "CbmTofEventClusterizer::BuildClusters: Sorting not successful "; + if (!std::is_sorted(fTofCalDigiVec->begin(), fTofCalDigiVec->end(), + [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); })) + LOG(warning) << "CbmTofEventClusterizer::BuildClusters: Sorting not successful "; if (NULL != fTofDigiPointMatches) { // generate updated MC point Match Collection UInt_t iDigiOrg = 0; - LOG(info) << Form("Fill MC Point Matches for %3lu, %3lu digis ", fTofCalDigiVec->size(), tTofCalDigiVec->size()); + //LOG(info)<<Form("Fill MC Point Matches for %3lu, %3lu digis ",fTofCalDigiVec->size(),tTofCalDigiVec->size()); for (UInt_t iDigi = 0; iDigi < fTofCalDigiVec->size(); iDigi++) { // find original Digi CbmTofDigi* outDigi = &(fTofCalDigiVec->at(iDigi)); @@ -7750,8 +5726,8 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { return kTRUE; } -void CbmTofEventClusterizer::SetDeadStrips(Int_t iDet, Int_t ival) { - if (fvDeadStrips.size() < static_cast<size_t>(iDet + 1)) - fvDeadStrips.resize(iDet + 1); +void CbmTofEventClusterizer::SetDeadStrips(Int_t iDet, Int_t ival) +{ + if (fvDeadStrips.size() < static_cast<size_t>(iDet + 1)) fvDeadStrips.resize(iDet + 1); fvDeadStrips[iDet] = ival; } diff --git a/reco/detectors/tof/CbmTofEventClusterizer.h b/reco/detectors/tof/CbmTofEventClusterizer.h index d91206f5e3..a5dfd338e8 100644 --- a/reco/detectors/tof/CbmTofEventClusterizer.h +++ b/reco/detectors/tof/CbmTofEventClusterizer.h @@ -65,9 +65,7 @@ public: /** ** @brief Constructor. **/ - CbmTofEventClusterizer(const char* name, - Int_t verbose = 1, - Bool_t writeDataInOut = kTRUE); + CbmTofEventClusterizer(const char* name, Int_t verbose = 1, Bool_t writeDataInOut = kTRUE); /** ** @brief Destructor. **/ @@ -97,11 +95,10 @@ public: inline void SetCalMode(Int_t iMode) { fCalMode = iMode; } inline void SetCalSel(Int_t iSel) { fCalSel = iSel; } - inline void SetCalSmType(Int_t iCalSmType) { - fCalSmAddr = CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, iCalSmType); - } + inline void SetCalSmType(Int_t iCalSmType) { fCalSmAddr = CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, iCalSmType); } inline void SetCalSmAddr(Int_t iCalSmAddr) { fCalSmAddr = iCalSmAddr; } - inline void SetCalRpc(Int_t iCalRpc) { + inline void SetCalRpc(Int_t iCalRpc) + { if (iCalRpc != 0) { Int_t iSign = iCalRpc / TMath::Abs(iCalRpc); iCalRpc *= iSign; // always a positive number @@ -110,15 +107,13 @@ public: Int_t iSm = iCalRpc % 10; iCalRpc = (iCalRpc - iSm) / 10; if (fIdMode == 1) iRpc = 0; // ignore RPC number - fCalSmAddr = - iSign * CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iCalRpc); - } else { + fCalSmAddr = iSign * CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iCalRpc); + } + else { fCalSmAddr = 0; } } - inline void SetCaldXdYMax(Double_t dCaldXdYMax) { - fdCaldXdYMax = dCaldXdYMax; - } + inline void SetCaldXdYMax(Double_t dCaldXdYMax) { fdCaldXdYMax = dCaldXdYMax; } inline void SetCalCluMulMax(Int_t ival) { fiCluMulMax = ival; } inline void SetTRefId(Int_t Id) { fTRefMode = Id; } inline void SetIdMode(Int_t Id) { fIdMode = Id; } @@ -151,17 +146,11 @@ public: inline void SetSel2Rpc(Int_t ival) { fSel2Rpc = ival; } inline void SetSel2MulMax(Int_t Id) { fSel2MulMax = Id; } - inline void SetOutHstFileName(TString OutHstFileName) { - fOutHstFileName = OutHstFileName; - } - inline void SetCalParFileName(TString CalParFileName) { - fCalParFileName = CalParFileName; - } + inline void SetOutHstFileName(TString OutHstFileName) { fOutHstFileName = OutHstFileName; } + inline void SetCalParFileName(TString CalParFileName) { fCalParFileName = CalParFileName; } inline TString GetCalParFileName() { return fCalParFileName; } - inline void SetEnableMatchPosScaling(Bool_t bval) { - fEnableMatchPosScaling = bval; - } + inline void SetEnableMatchPosScaling(Bool_t bval) { fEnableMatchPosScaling = bval; } inline void SetEnableAvWalk(Bool_t bval) { fEnableAvWalk = bval; } inline void SetPs2Ns(Bool_t bval) { fbPs2Ns = bval; } @@ -169,26 +158,18 @@ public: virtual void fit_ybox(const char* hname); // Fit virtual void fit_ybox(TH1* h, Double_t dy); // Fit virtual void fit_ybox(TH1* h, Double_t dy, Double_t* fpar); // Fit - virtual void CheckLHMemory(); // Check consistency of stored last hits - virtual void CleanLHMemory(); // Cleanup - virtual Bool_t AddNextChan(Int_t iSmType, - Int_t iSm, - Int_t iRpc, - Int_t iLastChan, - Double_t dLastPosX, - Double_t dLastPosY, - Double_t dLastTime, + virtual void CheckLHMemory(); // Check consistency of stored last hits + virtual void CleanLHMemory(); // Cleanup + virtual Bool_t AddNextChan(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iLastChan, Double_t dLastPosX, + Double_t dLastPosY, Double_t dLastTime, Double_t dLastTot); // needed for time based data - virtual void - LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit); + virtual void LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit); void SwapChannelSides(Bool_t bSwap) { fbSwapChannelSides = bSwap; } void SetFileIndex(Int_t iIndex) { fiFileIndex = iIndex; } void SetWriteDigisInOut(Bool_t bDigis) { fbWriteDigisInOut = bDigis; } void SetWriteHitsInOut(Bool_t bHits) { fbWriteHitsInOut = bHits; } - void SetAlternativeBranchNames(Bool_t bNames) { - fbAlternativeBranchNames = bNames; - } + void SetAlternativeBranchNames(Bool_t bNames) { fbAlternativeBranchNames = bNames; } void SetDeadStrips(Int_t iDet, Int_t ival); protected: @@ -259,7 +240,7 @@ private: std::vector<CbmTofDigi> fTofDigiVec {}; //! TOF Digis const std::vector<CbmTofDigi>* fT0DigiVec = nullptr; //! T0 Digis CbmDigiManager* fDigiMan; // TOF Input Digis - TClonesArray* fEventsColl; // CBMEvents (time based) + TClonesArray* fEventsColl; // CBMEvents (time based) // Output variables Bool_t fbWriteHitsInOut; @@ -279,28 +260,18 @@ private: Int_t fVerbose; // Intermediate storage variables - std::vector<std::vector<std::vector<std::vector<CbmTofDigi*>>>> - fStorDigi; //[nbType][nbSm*nbRpc][nbCh][nDigis] - std::vector<std::vector<std::vector<std::vector<Int_t>>>> - fStorDigiInd; //[nbType][nbSm*nbRpc][nbCh][nDigis] + std::vector<std::vector<std::vector<std::vector<CbmTofDigi*>>>> fStorDigi; //[nbType][nbSm*nbRpc][nbCh][nDigis] + std::vector<std::vector<std::vector<std::vector<Int_t>>>> fStorDigiInd; //[nbType][nbSm*nbRpc][nbCh][nDigis] std::vector<Int_t> vDigiIndRef; - std::vector<std::vector<std::vector<Int_t>>> - fviClusterMul; //[nbType][nbSm][nbRpc] - std::vector<std::vector<std::vector<Int_t>>> - fviClusterSize; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Int_t>>> - fviTrkMul; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Double_t>>> - fvdX; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Double_t>>> - fvdY; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Double_t>>> - fvdDifX; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Double_t>>> - fvdDifY; //[nbType][nbRpc][nClusters] - std::vector<std::vector<std::vector<Double_t>>> - fvdDifCh; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Int_t>>> fviClusterMul; //[nbType][nbSm][nbRpc] + std::vector<std::vector<std::vector<Int_t>>> fviClusterSize; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Int_t>>> fviTrkMul; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Double_t>>> fvdX; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Double_t>>> fvdY; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Double_t>>> fvdDifX; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Double_t>>> fvdDifY; //[nbType][nbRpc][nClusters] + std::vector<std::vector<std::vector<Double_t>>> fvdDifCh; //[nbType][nbRpc][nClusters] // Histograms TH1* fhClustBuildTime; @@ -327,31 +298,30 @@ private: TH2* fhCluMulCorDutSel; TH2* fhEvCluMul; - std::vector<TH2*> fhRpcDigiCor; //[nbDet] - std::vector<TH2*> fhRpcDigiMul; //[nbDet] - std::vector<TH2*> fhRpcDigiStatus; //[nbDet] - std::vector<TH2*> fhRpcDigiDTLD; //[nbDet] - std::vector<TH2*> fhRpcDigiDTFD; //[nbDet] - std::vector<TH2*> fhRpcDigiDTMul; //[nbDet] - std::vector<TH1*> fhRpcCluMul; //[nbDet] - std::vector<TH1*> fhRpcCluRate; //[nbDet] - std::vector<TH1*> fhRpcCluRate10s; //[nbDet] - std::vector<TH2*> fhRpcCluPosition; //[nbDet] - std::vector<TProfile*> fhRpcCluPositionEvol; //[nbDet] - std::vector<TProfile*> fhRpcCluTimeEvol; //[nbDet] - std::vector<TH2*> fhRpcCluDelPos; //[nbDet] - std::vector<TH2*> fhRpcCluDelMatPos; //[nbDet] - std::vector<TH2*> fhRpcCluTOff; //[nbDet] - std::vector<TH2*> fhRpcCluDelTOff; //[nbDet] - std::vector<TH2*> fhRpcCluDelMatTOff; //[nbDet] - std::vector<TH2*> fhRpcCluTrms; //[nbDet] - std::vector<TH2*> fhRpcCluTot; //[nbDet] - std::vector<TH2*> fhRpcCluSize; //[nbDet] - std::vector<TH2*> fhRpcCluAvWalk; //[nbDet] - std::vector<TH2*> fhRpcCluAvLnWalk; //[nbDet] - std::vector<std::vector<std::vector<TH2*>>> - fhRpcCluWalk; // [nbDet][nbCh][nSide] - std::vector<TH2*> fhSmCluPosition; //[nbSmTypes] + std::vector<TH2*> fhRpcDigiCor; //[nbDet] + std::vector<TH2*> fhRpcDigiMul; //[nbDet] + std::vector<TH2*> fhRpcDigiStatus; //[nbDet] + std::vector<TH2*> fhRpcDigiDTLD; //[nbDet] + std::vector<TH2*> fhRpcDigiDTFD; //[nbDet] + std::vector<TH2*> fhRpcDigiDTMul; //[nbDet] + std::vector<TH1*> fhRpcCluMul; //[nbDet] + std::vector<TH1*> fhRpcCluRate; //[nbDet] + std::vector<TH1*> fhRpcCluRate10s; //[nbDet] + std::vector<TH2*> fhRpcCluPosition; //[nbDet] + std::vector<TProfile*> fhRpcCluPositionEvol; //[nbDet] + std::vector<TProfile*> fhRpcCluTimeEvol; //[nbDet] + std::vector<TH2*> fhRpcCluDelPos; //[nbDet] + std::vector<TH2*> fhRpcCluDelMatPos; //[nbDet] + std::vector<TH2*> fhRpcCluTOff; //[nbDet] + std::vector<TH2*> fhRpcCluDelTOff; //[nbDet] + std::vector<TH2*> fhRpcCluDelMatTOff; //[nbDet] + std::vector<TH2*> fhRpcCluTrms; //[nbDet] + std::vector<TH2*> fhRpcCluTot; //[nbDet] + std::vector<TH2*> fhRpcCluSize; //[nbDet] + std::vector<TH2*> fhRpcCluAvWalk; //[nbDet] + std::vector<TH2*> fhRpcCluAvLnWalk; //[nbDet] + std::vector<std::vector<std::vector<TH2*>>> fhRpcCluWalk; // [nbDet][nbCh][nSide] + std::vector<TH2*> fhSmCluPosition; //[nbSmTypes] std::vector<TH2*> fhSmCluTOff; std::vector<TProfile*> fhSmCluSvel; std::vector<std::vector<TProfile*>> fhSmCluFpar; @@ -359,18 +329,17 @@ private: std::vector<TH1*> fhRpcDTLastHits_Tot; //[nbDet] std::vector<TH1*> fhRpcDTLastHits_CluSize; //[nbDet] - std::vector<std::vector<TH1*>> fhTRpcCluMul; //[nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluPosition; //[nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluTOff; //[nbDet] [nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluTofOff; //[nbDet] [nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluTot; // [nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluSize; // [nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluAvWalk; // [nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCluDelTof; // [nbDet][nbSel] - std::vector<std::vector<TH2*>> fhTRpcCludXdY; // [nbDet][nbSel] - std::vector<std::vector<std::vector<std::vector<TH2*>>>> - fhTRpcCluWalk; // [nbDet][nbSel][nbCh][nSide] - std::vector<std::vector<TH3*>> fhTRpcCluWalk2; // [nbDet][nbSel] + std::vector<std::vector<TH1*>> fhTRpcCluMul; //[nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluPosition; //[nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluTOff; //[nbDet] [nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluTofOff; //[nbDet] [nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluTot; // [nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluSize; // [nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluAvWalk; // [nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCluDelTof; // [nbDet][nbSel] + std::vector<std::vector<TH2*>> fhTRpcCludXdY; // [nbDet][nbSel] + std::vector<std::vector<std::vector<std::vector<TH2*>>>> fhTRpcCluWalk; // [nbDet][nbSel][nbCh][nSide] + std::vector<std::vector<TH3*>> fhTRpcCluWalk2; // [nbDet][nbSel] std::vector<std::vector<TH2*>> fhTSmCluPosition; //[nbSmTypes][nbSel] std::vector<std::vector<TH2*>> fhTSmCluTOff; //[nbSmTypes][nbSel] @@ -382,23 +351,18 @@ private: std::vector<TH1*> fhSeldT; //[nbSel] - std::vector<std::vector<std::vector<std::vector<Double_t>>>> - fvCPDelTof; //[nSMT][nRpc][nbClDelTofBinX][nbSel] - std::vector<std::vector<std::vector<std::vector<Double_t>>>> - fvCPTOff; //[nSMT][nRpc][nCh][nbSide] - std::vector<std::vector<std::vector<std::vector<Double_t>>>> - fvCPTotGain; //[nSMT][nRpc][nCh][nbSide] - std::vector<std::vector<std::vector<std::vector<Double_t>>>> - fvCPTotOff; //[nSMT][nRpc][nCh][nbSide] + std::vector<std::vector<std::vector<std::vector<Double_t>>>> fvCPDelTof; //[nSMT][nRpc][nbClDelTofBinX][nbSel] + std::vector<std::vector<std::vector<std::vector<Double_t>>>> fvCPTOff; //[nSMT][nRpc][nCh][nbSide] + std::vector<std::vector<std::vector<std::vector<Double_t>>>> fvCPTotGain; //[nSMT][nRpc][nCh][nbSide] + std::vector<std::vector<std::vector<std::vector<Double_t>>>> fvCPTotOff; //[nSMT][nRpc][nCh][nbSide] std::vector<std::vector<std::vector<std::vector<std::vector<Double_t>>>>> fvCPWalk; //[nSMT][nRpc][nCh][nbSide][nbWalkBins] - std::vector<std::vector<std::vector<std::vector<std::list<CbmTofHit*>>>>> - fvLastHits; //[nSMT[nSm][nRpc][nCh][NHits] - std::vector<Int_t> fvDeadStrips; //[nbDet] - std::vector<std::vector<Double_t>> fvTimeLastDigi; //[nbDet][nChannel*2] - std::vector<std::vector<Double_t>> fvTimeFirstDigi; //[nbDet][nChannel*2] - std::vector<std::vector<Double_t>> fvMulDigi; //[nbDet][nChannel*2] + std::vector<std::vector<std::vector<std::vector<std::list<CbmTofHit*>>>>> fvLastHits; //[nSMT[nSm][nRpc][nCh][NHits] + std::vector<Int_t> fvDeadStrips; //[nbDet] + std::vector<std::vector<Double_t>> fvTimeLastDigi; //[nbDet][nChannel*2] + std::vector<std::vector<Double_t>> fvTimeFirstDigi; //[nbDet][nChannel*2] + std::vector<std::vector<Double_t>> fvMulDigi; //[nbDet][nChannel*2] // Digis quality Int_t fiNbSameSide; @@ -462,9 +426,8 @@ private: Bool_t fbPs2Ns; // convert input raw digis from ps to ns TString fCalParFileName; // name of the file name with Calibration Parameters - TString - fOutHstFileName; // name of the histogram output file name with Calibration Parameters - TFile* fCalParFile; // pointer to Calibration Parameter file + TString fOutHstFileName; // name of the histogram output file name with Calibration Parameters + TFile* fCalParFile; // pointer to Calibration Parameter file // Constants or setting parameters Int_t fiNevtBuild; @@ -474,10 +437,8 @@ private: Double_t fdTOTMin; Double_t fdTTotMean; - Double_t - fdMaxTimeDist; // Isn't this just a local variable? Why make it global and preset?!? - Double_t - fdMaxSpaceDist; // Isn't this just a local variable? Why make it global and preset?!? + Double_t fdMaxTimeDist; // Isn't this just a local variable? Why make it global and preset?!? + Double_t fdMaxSpaceDist; // Isn't this just a local variable? Why make it global and preset?!? Double_t fdEvent; diff --git a/reco/detectors/tof/CbmTofExtendTracks.cxx b/reco/detectors/tof/CbmTofExtendTracks.cxx index 0b2ad86212..93743e71f6 100644 --- a/reco/detectors/tof/CbmTofExtendTracks.cxx +++ b/reco/detectors/tof/CbmTofExtendTracks.cxx @@ -4,11 +4,11 @@ // ------------------------------------------------------------------------- #include "CbmTofExtendTracks.h" -#include "CbmDefs.h" -#include "CbmTofAddress.h" // in cbmdata/tof +#include "CbmDefs.h" #include "CbmEvent.h" #include "CbmMatch.h" +#include "CbmTofAddress.h" // in cbmdata/tof #include "CbmTofCalibrator.h" #include "CbmTofCell.h" // in tof/TofData #include "CbmTofCreateDigiPar.h" // in tof/TofTools @@ -26,7 +26,6 @@ #include "CbmTofTrackletParam.h" #include "CbmTofTrackletTools.h" #include "CbmVertex.h" -#include "LKFMinuit.h" #include "FairLogger.h" #include "FairRootFileSink.h" @@ -53,6 +52,8 @@ #include <iostream> #include <vector> +#include "LKFMinuit.h" + using std::cout; using std::endl; using std::vector; @@ -67,17 +68,15 @@ ClassImp(CbmTofExtendTracks); CbmTofExtendTracks* CbmTofExtendTracks::fInstance = 0; // ----- Default constructor ------------------------------------------- -CbmTofExtendTracks::CbmTofExtendTracks() - : CbmTofExtendTracks::CbmTofExtendTracks("TofExtendTracks", "Main", NULL) { +CbmTofExtendTracks::CbmTofExtendTracks() : CbmTofExtendTracks::CbmTofExtendTracks("TofExtendTracks", "Main", NULL) +{ if (!fInstance) fInstance = this; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ -CbmTofExtendTracks::CbmTofExtendTracks(const char* name, - const char* /*title*/, - CbmTofTrackFinder* finder) +CbmTofExtendTracks::CbmTofExtendTracks(const char* name, const char* /*title*/, CbmTofTrackFinder* finder) : FairTask(name) , fFinder(finder) , fFitter(NULL) @@ -162,21 +161,24 @@ CbmTofExtendTracks::CbmTofExtendTracks(const char* name, , fiStationUT(-1) , fiCutStationMaxHitMul(1000) , fiNTrkTofMax(1000) - , fiEvent(0) { + , fiEvent(0) +{ if (!fInstance) fInstance = this; } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- -CbmTofExtendTracks::~CbmTofExtendTracks() { +CbmTofExtendTracks::~CbmTofExtendTracks() +{ if (fInstance == this) fInstance = 0; } // ------------------------------------------------------------------------- // ----- Public method Init (abstract in base class) -------------------- -InitStatus CbmTofExtendTracks::Init() { +InitStatus CbmTofExtendTracks::Init() +{ fTrackletTools = new CbmTofTrackletTools(); // initialize tools @@ -191,8 +193,7 @@ InitStatus CbmTofExtendTracks::Init() { ioman->InitSink(); fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("Event")); - if (!fEventsColl) - fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); + if (!fEventsColl) fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent")); if (!fEventsColl) { LOG(fatal) << "CbmEvent not found in input file"; } // Get TOF hit Array @@ -203,7 +204,8 @@ InitStatus CbmTofExtendTracks::Init() { LOG(fatal) << "-W- CbmTofExtendTracks::Init: No TofHit array!"; return kERROR; } - } else { + } + else { LOG(info) << "-I- CbmTofExtendTracks::Init: TofCalHit array!"; } @@ -246,7 +248,8 @@ InitStatus CbmTofExtendTracks::Init() { } // ------------------------------------------------------------------------- /************************************************************************************/ -Bool_t CbmTofExtendTracks::LoadCalParameter() { +Bool_t CbmTofExtendTracks::LoadCalParameter() +{ UInt_t NSt = fMapStationZ.size(); fvToff.resize(NSt); for (uint i = 0; i < NSt; i++) @@ -344,7 +347,8 @@ Bool_t CbmTofExtendTracks::LoadCalParameter() { //------------------------------------------------------------------------------------------------- Bool_t CbmTofExtendTracks::InitParameters() { return kTRUE; } // ----- SetParContainers ------------------------------------------------- -void CbmTofExtendTracks::SetParContainers() { +void CbmTofExtendTracks::SetParContainers() +{ /* FairRunAna* ana = FairRunAna::Instance(); FairRuntimeDb* rtdb = ana->GetRuntimeDb(); @@ -352,22 +356,20 @@ void CbmTofExtendTracks::SetParContainers() { } // ------------------------------------------------------------------------- -Bool_t CbmTofExtendTracks::UpdateCalHistos() { +Bool_t CbmTofExtendTracks::UpdateCalHistos() +{ if (fiEvent <= NDefSetup) return kTRUE; - while (fiCorMode > 0) { Int_t iCorMode = fiCorMode % 10; fiCorMode /= 10; Int_t iLev = fiCorSrc / 10; - LOG(info) << "UpdateCalHist on level " << iLev << " from src " << fiCorSrc - << " in mode " << iCorMode; + LOG(info) << "UpdateCalHist on level " << iLev << " from src " << fiCorSrc << " in mode " << iCorMode; switch (iCorMode) { case 0: { // T TH2* hCorDT = NULL; - if (fiCorSrc % 10 == 0) - hCorDT = fhTrkStationDT[iLev]; + if (fiCorSrc % 10 == 0) hCorDT = fhTrkStationDT[iLev]; else hCorDT = fhTrkPullDT[iLev]; if (NULL != hCorDT) { @@ -381,18 +383,15 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { LOG(warn) << "Created " << fhExt_Tsig->GetName(); } for (Int_t ix = 0; ix < nx; ix++) { - Double_t dVal = fhExt_Toff->GetBinContent(ix + 1); - TH1D* hpy = hCorDT->ProjectionY( - Form("%s_py%d", hCorDT->GetName(), ix), ix + 1, ix + 1, ""); + Double_t dVal = fhExt_Toff->GetBinContent(ix + 1); + TH1D* hpy = hCorDT->ProjectionY(Form("%s_py%d", hCorDT->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn) << "TOff Entries for station " << ix << ": " - << hpy->GetEntries(); + LOG(warn) << "TOff Entries for station " << ix << ": " << hpy->GetEntries(); 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 dLim = 1. * hpy->GetRMS(); + Double_t dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Double_t dLim = 1. * hpy->GetRMS(); //Double_t dLim = 5. * hpy->GetBinWidth(1); if (dLim > 0.) { //TF1 * f = new TF1 ("f","gaus"); @@ -408,16 +407,16 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { dFMean = fRes->Parameter(1); dVal -= dFMean; fhExt_Tsig->SetBinContent(ix + 1, fRes->Parameter(2)); - } else + } + else dVal -= dMean; - LOG(warn) << "Update hExt_Toff Ind " << ix << ": Old " - << fhExt_Toff->GetBinContent(ix + 1) << ", FitMean " - << dFMean << " => " << dVal << ", width " + LOG(warn) << "Update hExt_Toff Ind " << ix << ": Old " << fhExt_Toff->GetBinContent(ix + 1) + << ", FitMean " << dFMean << " => " << dVal << ", width " << fhExt_Tsig->GetBinContent(ix + 1); } - } else { - LOG(warn) << "Update hExt_Toff " << ix - << ": insufficient counts: " << hpy->GetEntries(); + } + else { + LOG(warn) << "Update hExt_Toff " << ix << ": insufficient counts: " << hpy->GetEntries(); } fhExt_Toff->SetBinContent(ix + 1, dVal); } @@ -425,8 +424,7 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { } break; case 1: { // X TH2* hCorDX = NULL; - if (fiCorSrc % 10 == 0) - hCorDX = fhTrkStationDX[iLev]; + if (fiCorSrc % 10 == 0) hCorDX = fhTrkStationDX[iLev]; else hCorDX = fhTrkPullDX[iLev]; if (NULL != hCorDX) { @@ -440,17 +438,14 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { LOG(warn) << "Created " << fhExt_Xsig->GetName(); } for (Int_t ix = 0; ix < nx; ix++) { - Double_t dVal = fhExt_Xoff->GetBinContent(ix + 1); - TH1D* hpy = hCorDX->ProjectionY( - Form("%s_py%d", hCorDX->GetName(), ix), ix + 1, ix + 1, ""); + Double_t dVal = fhExt_Xoff->GetBinContent(ix + 1); + TH1D* hpy = hCorDX->ProjectionY(Form("%s_py%d", hCorDX->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn) << "XOff Entries for station " << ix << ": " - << hpy->GetEntries(); + LOG(warn) << "XOff Entries for station " << ix << ": " << hpy->GetEntries(); 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 dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content //Double_t dLim = 1. * hpy->GetRMS(); Double_t dLim = 5. * hpy->GetBinWidth(1); if (dLim > 0.) { @@ -466,16 +461,16 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { dFMean = fRes->Parameter(1); dVal -= dFMean; fhExt_Xsig->SetBinContent(ix + 1, fRes->Parameter(2)); - } else + } + else dVal -= dMean; - LOG(warn) << "Update hExt_Xoff Ind " << ix << ": Old " - << fhExt_Xoff->GetBinContent(ix + 1) << ", FitMean " - << dFMean << " => " << dVal << ", width " + LOG(warn) << "Update hExt_Xoff Ind " << ix << ": Old " << fhExt_Xoff->GetBinContent(ix + 1) + << ", FitMean " << dFMean << " => " << dVal << ", width " << fhExt_Xsig->GetBinContent(ix + 1); } - } else { - LOG(warn) << "Update hExt_Xoff " << ix - << ": insufficient counts: " << hpy->GetEntries(); + } + else { + LOG(warn) << "Update hExt_Xoff " << ix << ": insufficient counts: " << hpy->GetEntries(); } fhExt_Xoff->SetBinContent(ix + 1, dVal); } @@ -483,8 +478,7 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { } break; case 2: { // Y TH2* hCorDY = NULL; - if (fiCorSrc % 10 == 0) - hCorDY = fhTrkStationDY[iLev]; + if (fiCorSrc % 10 == 0) hCorDY = fhTrkStationDY[iLev]; else hCorDY = fhTrkPullDY[iLev]; if (NULL != hCorDY) { @@ -498,17 +492,14 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { LOG(warn) << "Created " << fhExt_Ysig->GetName(); } for (Int_t ix = 0; ix < nx; ix++) { - Double_t dVal = fhExt_Yoff->GetBinContent(ix + 1); - TH1D* hpy = hCorDY->ProjectionY( - Form("%s_py%d", hCorDY->GetName(), ix), ix + 1, ix + 1, ""); + Double_t dVal = fhExt_Yoff->GetBinContent(ix + 1); + TH1D* hpy = hCorDY->ProjectionY(Form("%s_py%d", hCorDY->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn) << "YOff Entries for station " << ix << ": " - << hpy->GetEntries(); + LOG(warn) << "YOff Entries for station " << ix << ": " << hpy->GetEntries(); 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 dMean = xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content //Double_t dLim = 1. * hpy->GetRMS(); Double_t dLim = 5. * hpy->GetBinWidth(1); if (dLim > 0.) { @@ -526,17 +517,17 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { dFMean = fRes->Parameter(1); dVal -= dFMean; fhExt_Ysig->SetBinContent(ix + 1, fRes->Parameter(2)); - } else + } + else dVal -= dMean; - LOG(warn) << "Update hExt_Yoff Ind " << ix << ": Old " - << fhExt_Yoff->GetBinContent(ix + 1) << ", FitMean " - << dFMean << " => " << dVal << ", width " + LOG(warn) << "Update hExt_Yoff Ind " << ix << ": Old " << fhExt_Yoff->GetBinContent(ix + 1) + << ", FitMean " << dFMean << " => " << dVal << ", width " << fhExt_Ysig->GetBinContent(ix + 1); } - } else { - LOG(warn) << "Update hExt_Yoff " << ix - << ": insufficient counts: " << hpy->GetEntries(); + } + else { + LOG(warn) << "Update hExt_Yoff " << ix << ": insufficient counts: " << hpy->GetEntries(); } fhExt_Yoff->SetBinContent(ix + 1, dVal); } @@ -547,7 +538,8 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { } return kTRUE; } -Bool_t CbmTofExtendTracks::WriteHistos() { +Bool_t CbmTofExtendTracks::WriteHistos() +{ if (fiCorMode < 0) return kTRUE; // Write calibration histogramms to the file TDirectory* oldir = gDirectory; @@ -566,31 +558,30 @@ Bool_t CbmTofExtendTracks::WriteHistos() { // ----- Public method Exec -------------------------------------------- -void CbmTofExtendTracks::Exec(Option_t* opt) { +void CbmTofExtendTracks::Exec(Option_t* opt) +{ if (!fEventsColl) { // fTofHitArray = (TClonesArray*)fTofHitArrayIn->Clone(); LOG(fatal) << "Analysis needs EventsColl "; // ExecExtend(opt); - } else { - LOG(info) << "ExtExec TS " << fiTS << " with " - << fEventsColl->GetEntriesFast() << " evts"; + } + else { + LOG(info) << "ExtExec TS " << fiTS << " with " << fEventsColl->GetEntriesFast() << " evts"; fiTS++; for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) { CbmEvent* tEvent = dynamic_cast<CbmEvent*>(fEventsColl->At(iEvent)); - LOG(info) << "Process TS event " << iEvent << " with " - << tEvent->GetNofData(ECbmDataType::kT0Hit) << " T0, " - << tEvent->GetNofData(ECbmDataType::kTofHit) << " TOF, " - << tEvent->GetNofData(ECbmDataType::kStsHit) << " STS, " - << tEvent->GetNofData(ECbmDataType::kMuchPixelHit) - << " MUCH hits"; + LOG(info) << "Process TS event " << iEvent << " with " << tEvent->GetNofData(ECbmDataType::kT0Hit) << " T0, " + << tEvent->GetNofData(ECbmDataType::kTofHit) << " TOF, " << tEvent->GetNofData(ECbmDataType::kStsHit) + << " STS, " << tEvent->GetNofData(ECbmDataType::kMuchPixelHit) << " MUCH hits"; ExecExtend(opt, tEvent); } } } -void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { +void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) +{ fiEvent++; if (fiEvent == NDefSetup) CreateHistograms(); @@ -631,19 +622,11 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iNbTofStations = 1; fvTofStationZ.resize(iNbTofStations); fvTofHitIndex.resize(iNbTofStations); - for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kTofHit); - iHit++) { - Int_t iHitIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofHit, iHit)); + 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)); - LOG(debug) << Form( - "Inspect Ev %d, TofHit %d, Ind %d at %6.1f in %lu (%u) stations", - fiEvent, - iHit, - iHitIndex, - tHit->GetZ(), - fvTofStationZ.size(), - iNbAllStations); + LOG(debug) << Form("Inspect Ev %d, TofHit %d, Ind %d at %6.1f in %lu (%u) stations", fiEvent, iHit, iHitIndex, + tHit->GetZ(), fvTofStationZ.size(), iNbAllStations); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); @@ -654,30 +637,19 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvTofStationZ[iSt] = tHit->GetZ(); fvTofHitIndex[iSt].resize(1); fvTofHitIndex[iSt][0] = iHitIndex; - LOG(debug) << Form( - "Ev %d, init TofSt %d, Mul %lu at z %8.1f from Ind %d", - fiEvent, - iSt, - fvTofHitIndex[iSt].size(), - fvTofStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, init TofSt %d, Mul %lu at z %8.1f from Ind %d", fiEvent, iSt, + fvTofHitIndex[iSt].size(), fvTofStationZ[iSt], iHitIndex); break; - } else { - if (TMath::Abs(fvTofStationZ[iSt] - tHit->GetZ()) - < STATION_TOF_ZWIDTH) { + } + else { + if (TMath::Abs(fvTofStationZ[iSt] - tHit->GetZ()) < STATION_TOF_ZWIDTH) { // update average z position of station fvTofStationZ[iSt] = - (fvTofStationZ[iSt] * fvTofHitIndex[iSt].size() + tHit->GetZ()) - / (fvTofHitIndex[iSt].size() + 1); + (fvTofStationZ[iSt] * fvTofHitIndex[iSt].size() + tHit->GetZ()) / (fvTofHitIndex[iSt].size() + 1); fvTofHitIndex[iSt].resize(fvTofHitIndex[iSt].size() + 1); fvTofHitIndex[iSt][fvTofHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form( - "Ev %d, upd TofSt %d, Mul %lu at z %8.1f from Ind %d", - fiEvent, - iSt, - fvTofHitIndex[iSt].size(), - fvTofStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, upd TofSt %d, Mul %lu at z %8.1f from Ind %d", fiEvent, iSt, + fvTofHitIndex[iSt].size(), fvTofStationZ[iSt], iHitIndex); break; } } @@ -690,33 +662,23 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvTofStationZ[iSt] = tHit->GetZ(); fvTofHitIndex[iSt].resize(1); fvTofHitIndex[iSt][0] = iHitIndex; - LOG(debug) << Form( - "Ev %d, add TofSt %d (%d), Mul %lu at z %8.1f from Ind %d", - fiEvent, - iSt, - iNbTofStations, - fvTofHitIndex[iSt].size(), - fvTofStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, add TofSt %d (%d), Mul %lu at z %8.1f from Ind %d", fiEvent, iSt, iNbTofStations, + fvTofHitIndex[iSt].size(), fvTofStationZ[iSt], iHitIndex); } if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { - LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kTof) * 100 + iSt - << " at z=" << iStZ; + LOG(debug) << "Insert new tracking station " << Int_t(ECbmModuleId::kTof) * 100 + iSt << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kTof) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kTof) * 100; for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { Int_t iSysId = itMapStationZ->second / 100; - if (iSysId == Int_t(ECbmModuleId::kTof)) { - itMapStationZ->second = iStId++; - } - LOG(info) << "MapStationZ: " << itMapStationZ->first << " " - << itMapStationZ->second; + if (iSysId == Int_t(ECbmModuleId::kTof)) { itMapStationZ->second = iStId++; } + LOG(info) << "MapStationZ: " << itMapStationZ->first << " " << itMapStationZ->second; } } - } else { // Define Setup end + } + else { // Define Setup end // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { Int_t iAllSt = (itMapStationZ->second) % 100; @@ -742,12 +704,9 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvStsStationZ.resize(iNbStsStations); fvStsHitIndex.resize(iNbStsStations); - for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kStsHit); - iHit++) { - Int_t iHitIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kStsHit, iHit)); - CbmPixelHit* tHit = - dynamic_cast<CbmPixelHit*>(fStsHitArrayIn->At(iHitIndex)); + for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kStsHit); iHit++) { + Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kStsHit, iHit)); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fStsHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); @@ -758,25 +717,18 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvStsStationZ[iSt] = tHit->GetZ(); fvStsHitIndex[iSt].resize(1); fvStsHitIndex[iSt][0] = iHitIndex; - LOG(debug) << Form("Ev %d, init StsSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvStsStationZ[iSt], + LOG(debug) << Form("Ev %d, init StsSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvStsStationZ[iSt], iHitIndex); break; - } else { - if (TMath::Abs(fvStsStationZ[iSt] - tHit->GetZ()) - < STATION_STS_ZWIDTH) { + } + else { + if (TMath::Abs(fvStsStationZ[iSt] - tHit->GetZ()) < STATION_STS_ZWIDTH) { // update average z position of station fvStsStationZ[iSt] = - (fvStsStationZ[iSt] * fvStsHitIndex[iSt].size() + tHit->GetZ()) - / (fvStsHitIndex[iSt].size() + 1); + (fvStsStationZ[iSt] * fvStsHitIndex[iSt].size() + tHit->GetZ()) / (fvStsHitIndex[iSt].size() + 1); fvStsHitIndex[iSt].resize(fvStsHitIndex[iSt].size() + 1); fvStsHitIndex[iSt][fvStsHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, upd StsSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvStsStationZ[iSt], + LOG(debug) << Form("Ev %d, upd StsSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvStsStationZ[iSt], iHitIndex); break; } @@ -789,31 +741,23 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvStsStationZ[iSt] = tHit->GetZ(); fvStsHitIndex[iSt].resize(fvStsHitIndex[iSt].size() + 1); fvStsHitIndex[iSt][fvStsHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, add StsSt %d (%d) at z %8.1f from Ind %d", - fiEvent, - iSt, - iNbStsStations, - fvStsStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, add StsSt %d (%d) at z %8.1f from Ind %d", fiEvent, iSt, iNbStsStations, + fvStsStationZ[iSt], iHitIndex); } if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { - LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kSts) * 100 + iSt - << " at z=" << iStZ; + LOG(debug) << "Insert new tracking station " << Int_t(ECbmModuleId::kSts) * 100 + iSt << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kSts) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kSts) * 100; for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { Int_t iSysId = itMapStationZ->second / 100; - if (iSysId == Int_t(ECbmModuleId::kSts)) { - itMapStationZ->second = iStId++; - } - LOG(info) << "MapStationZ: " << itMapStationZ->first << " " - << itMapStationZ->second; + if (iSysId == Int_t(ECbmModuleId::kSts)) { itMapStationZ->second = iStId++; } + LOG(info) << "MapStationZ: " << itMapStationZ->first << " " << itMapStationZ->second; } } - } else { // Define Setup end + } + else { // Define Setup end // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { Int_t iAllSt = (itMapStationZ->second) % 100; @@ -834,12 +778,9 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iNbMuchStations = 1; fvMuchStationZ.resize(iNbMuchStations); fvMuchHitIndex.resize(iNbMuchStations); - for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kMuchPixelHit); - iHit++) { - Int_t iHitIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kMuchPixelHit, iHit)); - CbmPixelHit* tHit = - dynamic_cast<CbmPixelHit*>(fMuchHitArrayIn->At(iHitIndex)); + for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kMuchPixelHit); iHit++) { + Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kMuchPixelHit, iHit)); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fMuchHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); @@ -850,25 +791,18 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvMuchStationZ[iSt] = tHit->GetZ(); fvMuchHitIndex[iSt].resize(1); fvMuchHitIndex[iSt][0] = iHitIndex; - LOG(info) << Form("Ev %d, init MuchSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvMuchStationZ[iSt], + LOG(info) << Form("Ev %d, init MuchSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvMuchStationZ[iSt], iHitIndex); break; - } else { - if (TMath::Abs(fvMuchStationZ[iSt] - tHit->GetZ()) - < STATION_MUCH_ZWIDTH) { + } + else { + if (TMath::Abs(fvMuchStationZ[iSt] - tHit->GetZ()) < STATION_MUCH_ZWIDTH) { // update average z position of station fvMuchStationZ[iSt] = - (fvMuchStationZ[iSt] * fvMuchHitIndex[iSt].size() + tHit->GetZ()) - / (fvMuchHitIndex[iSt].size() + 1); + (fvMuchStationZ[iSt] * fvMuchHitIndex[iSt].size() + tHit->GetZ()) / (fvMuchHitIndex[iSt].size() + 1); fvMuchHitIndex[iSt].resize(fvMuchHitIndex[iSt].size() + 1); fvMuchHitIndex[iSt][fvMuchHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, upd MuchSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvMuchStationZ[iSt], + LOG(debug) << Form("Ev %d, upd MuchSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvMuchStationZ[iSt], iHitIndex); break; } @@ -881,32 +815,24 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvMuchStationZ[iSt] = tHit->GetZ(); fvMuchHitIndex[iSt].resize(fvMuchHitIndex[iSt].size() + 1); fvMuchHitIndex[iSt][fvMuchHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, add MuchSt %d (%d) at z %8.1f from Ind %d", - fiEvent, - iSt, - iNbMuchStations, - fvMuchStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, add MuchSt %d (%d) at z %8.1f from Ind %d", fiEvent, iSt, iNbMuchStations, + fvMuchStationZ[iSt], iHitIndex); } if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { - LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kMuch) * 100 + iSt - << " at z=" << iStZ; + LOG(debug) << "Insert new tracking station " << Int_t(ECbmModuleId::kMuch) * 100 + iSt << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kMuch) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kMuch) * 100; for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { Int_t iSysId = itMapStationZ->second / 100; - if (iSysId == Int_t(ECbmModuleId::kMuch)) { - itMapStationZ->second = iStId++; - } - LOG(info) << "MapStationZ: " << itMapStationZ->first << " " - << itMapStationZ->second; + if (iSysId == Int_t(ECbmModuleId::kMuch)) { itMapStationZ->second = iStId++; } + LOG(info) << "MapStationZ: " << itMapStationZ->first << " " << itMapStationZ->second; } } - } else { // Define Setup end + } + else { // Define Setup end // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { Int_t iAllSt = (itMapStationZ->second) % 100; @@ -928,12 +854,11 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { assert(iAllSt == fMapStationZ[(Int_t)(pHit->GetZ())] % 100); - LOG(info) << Form( - "Proc ev %d, MuchIn St %d, H %d, MpHit: ", fiEvent, iAllSt, iH) - << tHit->ToString(); + LOG(info) << Form("Proc ev %d, MuchIn St %d, H %d, MpHit: ", fiEvent, iAllSt, iH) << tHit->ToString(); //delete(pHit); - } else { + } + else { LOG(warn) << "Undefined station for Much "; } } @@ -945,12 +870,9 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iNbRichStations = 1; fvRichStationZ.resize(iNbRichStations); fvRichHitIndex.resize(iNbRichStations); - for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kRichHit); - iHit++) { - Int_t iHitIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kRichHit, iHit)); - CbmPixelHit* tHit = - dynamic_cast<CbmPixelHit*>(fRichHitArrayIn->At(iHitIndex)); + for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kRichHit); iHit++) { + Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kRichHit, iHit)); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fRichHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); @@ -961,25 +883,18 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvRichStationZ[iSt] = tHit->GetZ(); fvRichHitIndex[iSt].resize(1); fvRichHitIndex[iSt][0] = iHitIndex; - LOG(debug) << Form("Ev %d, init RichSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvRichStationZ[iSt], + LOG(debug) << Form("Ev %d, init RichSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvRichStationZ[iSt], iHitIndex); break; - } else { - if (TMath::Abs(fvRichStationZ[iSt] - tHit->GetZ()) - < STATION_RICH_ZWIDTH) { + } + else { + if (TMath::Abs(fvRichStationZ[iSt] - tHit->GetZ()) < STATION_RICH_ZWIDTH) { // update average z position of station fvRichStationZ[iSt] = - (fvRichStationZ[iSt] * fvRichHitIndex[iSt].size() + tHit->GetZ()) - / (fvRichHitIndex[iSt].size() + 1); + (fvRichStationZ[iSt] * fvRichHitIndex[iSt].size() + tHit->GetZ()) / (fvRichHitIndex[iSt].size() + 1); fvRichHitIndex[iSt].resize(fvRichHitIndex[iSt].size() + 1); fvRichHitIndex[iSt][fvRichHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, upd RichSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvRichStationZ[iSt], + LOG(debug) << Form("Ev %d, upd RichSt %d at z %8.1f from Ind %d", fiEvent, iSt, fvRichStationZ[iSt], iHitIndex); break; } @@ -992,32 +907,24 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvRichStationZ[iSt] = tHit->GetZ(); fvRichHitIndex[iSt].resize(fvRichHitIndex[iSt].size() + 1); fvRichHitIndex[iSt][fvRichHitIndex[iSt].size() - 1] = iHitIndex; - LOG(debug) << Form("Ev %d, add RichSt %d (%d) at z %8.1f from Ind %d", - fiEvent, - iSt, - iNbRichStations, - fvRichStationZ[iSt], - iHitIndex); + LOG(debug) << Form("Ev %d, add RichSt %d (%d) at z %8.1f from Ind %d", fiEvent, iSt, iNbRichStations, + fvRichStationZ[iSt], iHitIndex); } if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { - LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kRich) * 100 + iSt - << " at z=" << iStZ; + LOG(debug) << "Insert new tracking station " << Int_t(ECbmModuleId::kRich) * 100 + iSt << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kRich) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kRich) * 100; for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { Int_t iSysId = itMapStationZ->second / 100; - if (iSysId == Int_t(ECbmModuleId::kRich)) { - itMapStationZ->second = iStId++; - } - LOG(info) << "MapStationZ: " << itMapStationZ->first << " " - << itMapStationZ->second; + if (iSysId == Int_t(ECbmModuleId::kRich)) { itMapStationZ->second = iStId++; } + LOG(info) << "MapStationZ: " << itMapStationZ->first << " " << itMapStationZ->second; } } - } else { // Define Setup end + } + else { // Define Setup end // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { Int_t iAllSt = (itMapStationZ->second) % 100; @@ -1059,10 +966,8 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvTrkCalHits.resize(iNTrks); fvTrkPar.clear(); for (Int_t iTr = 0; iTr < iNTrks; iTr++) { - Int_t iTrkIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); - CbmTofTracklet* pTrk = - dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); + Int_t iTrkIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); + CbmTofTracklet* pTrk = dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); //CbmTofTrackletParam* pTrkPar=new CbmTofTrackletParam(*pTrk->GetTrackParameter()); //fvTrkPar.push_back(pTrkPar); fvTrkPar.push_back((CbmTofTrackletParam*) (pTrk->GetTrackParameter())); @@ -1076,18 +981,12 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { // apply recalibration if necessary fvTrkCalHits[iTr].push_back(dynamic_cast<CbmPixelHit*>(pHitIn)); - LOG(debug) << Form( - "Added PixHit %d, ind %d: x %6.3f, y %6.3f, z %6.3f, t %9.2f " - ", dx %6.3f, dy %6.3f, dz %6.3f ", - iHit, - pTrk->GetTofHitIndex(iHit), - (fvTrkCalHits[iTr][iHit])->GetX(), - (fvTrkCalHits[iTr][iHit])->GetY(), - (fvTrkCalHits[iTr][iHit])->GetZ(), - (fvTrkCalHits[iTr][iHit])->GetTime(), - (fvTrkCalHits[iTr][iHit])->GetDx(), - (fvTrkCalHits[iTr][iHit])->GetDy(), - (fvTrkCalHits[iTr][iHit])->GetDz()); + LOG(debug) << Form("Added PixHit %d, ind %d: x %6.3f, y %6.3f, z %6.3f, t %9.2f " + ", dx %6.3f, dy %6.3f, dz %6.3f ", + iHit, pTrk->GetTofHitIndex(iHit), (fvTrkCalHits[iTr][iHit])->GetX(), + (fvTrkCalHits[iTr][iHit])->GetY(), (fvTrkCalHits[iTr][iHit])->GetZ(), + (fvTrkCalHits[iTr][iHit])->GetTime(), (fvTrkCalHits[iTr][iHit])->GetDx(), + (fvTrkCalHits[iTr][iHit])->GetDy(), (fvTrkCalHits[iTr][iHit])->GetDz()); } Line3Dfit(fvTrkCalHits[iTr], fvTrkPar[iTr]); fvTrkPar[iTr]->SetTt(pTrk->GetTt()); @@ -1095,8 +994,7 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { // compare to input LOG(debug) << "CompareTrk " << iTr - << Form(": DTx %10.8f, DTy %10.8f", - pTrk->GetTrackTx() - fvTrkPar[iTr]->GetTx(), + << Form(": DTx %10.8f, DTy %10.8f", pTrk->GetTrackTx() - fvTrkPar[iTr]->GetTx(), pTrk->GetTrackTy() - fvTrkPar[iTr]->GetTy()); } // Tracklet loop end if (fiEvent > NDefSetup) { @@ -1116,7 +1014,8 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { // ----- Public method Finish ------------------------------------------ -void CbmTofExtendTracks::Finish() { +void CbmTofExtendTracks::Finish() +{ UpdateCalHistos(); @@ -1139,89 +1038,32 @@ void CbmTofExtendTracks::Finish() { } // ------------------------------------------------------------------------- -void CbmTofExtendTracks::CreateHistograms() { +void CbmTofExtendTracks::CreateHistograms() +{ if (fiEvent < NDefSetup) return; - 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 // Correlation with Tof Tracklets // fhMulCorTrkTof = - new TH2F("hMulCorTrkTof", - Form("Multiplicity correlation ; N_{Track}; N_{TofHits}"), - 50, - 0, - 50, - 150, - 0, - 150); + new TH2F("hMulCorTrkTof", Form("Multiplicity correlation ; N_{Track}; N_{TofHits}"), 50, 0, 50, 150, 0, 150); fhMulCorTrkSts = - new TH2F("hMulCorTrkSts", - Form("Multiplicity correlation ; N_{Track}; N_{StsHits}"), - 50, - 0, - 50, - 150, - 0, - 150); + new TH2F("hMulCorTrkSts", Form("Multiplicity correlation ; N_{Track}; N_{StsHits}"), 50, 0, 50, 150, 0, 150); fhMulCorTrkMuch = - new TH2F("hMulCorTrkMuch", - Form("Multiplicity correlation ; N_{Track}; N_{MuchHits}"), - 50, - 0, - 50, - 150, - 0, - 150); + new TH2F("hMulCorTrkMuch", Form("Multiplicity correlation ; N_{Track}; N_{MuchHits}"), 50, 0, 50, 150, 0, 150); fhMulCorTrkRich = - new TH2F("hMulCorTrkRich", - Form("Multiplicity correlation ; N_{Track}; N_{RichHits}"), - 50, - 0, - 50, - 150, - 0, - 150); - fhPosCorTrkTof = - new TH2F("hPosCorTrkTof", - Form("Tof position correlation ; #DeltaX (cm); #DeltaY (cm)"), - 100, - -10, - 10, - 100, - -10, - 10); - fhPosCorTrkSts = - new TH2F("hPosCorTrkSts", - Form("Sts position correlation ; #DeltaX (cm); #DeltaY (cm)"), - 100, - -10, - 10, - 100, - -10, - 10); - fhPosCorTrkMuch = - new TH2F("hPosCorTrkMuch", - Form("Much position correlation ; #DeltaX (cm); #DeltaY (cm)"), - 100, - -10, - 10, - 100, - -10, - 10); - fhPosCorTrkRich = - new TH2F("hPosCorTrkRich", - Form("Rich position correlation ; #DeltaX (cm); #DeltaY (cm)"), - 100, - -10, - 10, - 100, - -10, - 10); + new TH2F("hMulCorTrkRich", Form("Multiplicity correlation ; N_{Track}; N_{RichHits}"), 50, 0, 50, 150, 0, 150); + fhPosCorTrkTof = new TH2F("hPosCorTrkTof", Form("Tof position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, -10, + 10, 100, -10, 10); + fhPosCorTrkSts = new TH2F("hPosCorTrkSts", Form("Sts position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, -10, + 10, 100, -10, 10); + fhPosCorTrkMuch = new TH2F("hPosCorTrkMuch", Form("Much position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, + -10, 10, 100, -10, 10); + fhPosCorTrkRich = new TH2F("hPosCorTrkRich", Form("Rich position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, + -10, 10, 100, -10, 10); // Correlation with extended tracks @@ -1232,10 +1074,7 @@ void CbmTofExtendTracks::CreateHistograms() { for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { Int_t iSysId = itMapStationZ->second / 100; itMapStationZ->second = iSysId * 100 + iStNum++; - LOG(info) << Form(" station %2d, z %3d, Id %4d ", - iStNum, - itMapStationZ->first, - itMapStationZ->second); + LOG(info) << Form(" station %2d, z %3d, Id %4d ", iStNum, itMapStationZ->first, itMapStationZ->second); } UInt_t NSt = fMapStationZ.size(); @@ -1255,108 +1094,35 @@ void CbmTofExtendTracks::CreateHistograms() { fhExt_TrkSizChiSq.resize(NLev); for (Int_t iLev = 0; iLev < NLev; iLev++) { - fhExt_TrkSizVel[iLev] = new TH2F(Form("hExt_TrkSizVel%d", iLev), - ";TrkSize;v (cm/ns)", - 15, - 0, - 15, - 100, - 0., - 50.); - fhExt_TrkSizChiSq[iLev] = new TH2F(Form("hExt_TrkSizChiSq%d", iLev), - ";TrkSize;#chi^2", - 15, - 0, - 15, - 50, - 0., - 5.); - - fhTrkStationDX[iLev] = - new TH2F(Form("hTrkStationDX%d", iLev), - Form("TrkStationDX; StationNr ; #DeltaX (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkStationDY[iLev] = - new TH2F(Form("hTrkStationDY%d", iLev), - Form("TrkStationDY; StationNr ; #DeltaY (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkStationDZ[iLev] = - new TH2F(Form("hTrkStationDZ%d", iLev), - Form("TrkStationDZ; StationNr ; #DeltaZ (cm)"), - NSt, - 0, - NSt, - 100, - -20., - 20.); - fhTrkStationDT[iLev] = - new TH2F(Form("hTrkStationDT%d", iLev), - Form("TrkStationDT; StationNr ; #DeltaT (ns)"), - NSt, - 0, - NSt, - 100, - -50., - 50.); + fhExt_TrkSizVel[iLev] = new TH2F(Form("hExt_TrkSizVel%d", iLev), ";TrkSize;v (cm/ns)", 15, 0, 15, 100, 0., 50.); + fhExt_TrkSizChiSq[iLev] = new TH2F(Form("hExt_TrkSizChiSq%d", iLev), ";TrkSize;#chi^2", 15, 0, 15, 50, 0., 5.); + + fhTrkStationDX[iLev] = new TH2F(Form("hTrkStationDX%d", iLev), Form("TrkStationDX; StationNr ; #DeltaX (cm)"), NSt, + 0, NSt, 100, -10., 10.); + fhTrkStationDY[iLev] = new TH2F(Form("hTrkStationDY%d", iLev), Form("TrkStationDY; StationNr ; #DeltaY (cm)"), NSt, + 0, NSt, 100, -10., 10.); + fhTrkStationDZ[iLev] = new TH2F(Form("hTrkStationDZ%d", iLev), Form("TrkStationDZ; StationNr ; #DeltaZ (cm)"), NSt, + 0, NSt, 100, -20., 20.); + fhTrkStationDT[iLev] = new TH2F(Form("hTrkStationDT%d", iLev), Form("TrkStationDT; StationNr ; #DeltaT (ns)"), NSt, + 0, NSt, 100, -50., 50.); fhTrkStationNHits[iLev] = - new TH2F(Form("hTrkStationNHits%d", iLev), - Form("TrkStationNHits; StationNr ; Number of Hits"), - NSt, - 0, - NSt, - 100, - 0., - 100.); - - fhTrkPullDX[iLev] = new TH2F(Form("hTrkPullDX%d", iLev), - Form("TrkPullDX; StationNr ; #DeltaX (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkPullDY[iLev] = new TH2F(Form("hTrkPullDY%d", iLev), - Form("TrkPullDY; StationNr ; #DeltaY (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkPullDT[iLev] = new TH2F(Form("hTrkPullDT%d", iLev), - Form("TrkPullDT; StationNr ; #DeltaT (ns)"), - NSt, - 0, - NSt, - 100, - -50., - 50.); + new TH2F(Form("hTrkStationNHits%d", iLev), Form("TrkStationNHits; StationNr ; Number of Hits"), NSt, 0, NSt, 100, + 0., 100.); + + fhTrkPullDX[iLev] = + new TH2F(Form("hTrkPullDX%d", iLev), Form("TrkPullDX; StationNr ; #DeltaX (cm)"), NSt, 0, NSt, 100, -10., 10.); + fhTrkPullDY[iLev] = + new TH2F(Form("hTrkPullDY%d", iLev), Form("TrkPullDY; StationNr ; #DeltaY (cm)"), NSt, 0, NSt, 100, -10., 10.); + fhTrkPullDT[iLev] = + new TH2F(Form("hTrkPullDT%d", iLev), Form("TrkPullDT; StationNr ; #DeltaT (ns)"), NSt, 0, NSt, 100, -50., 50.); fhTrkStationDXDY[iLev].resize(NSt); for (UInt_t iSt = 0; iSt < NSt; iSt++) { - fhTrkStationDXDY[iLev][iSt] = - new TH2F(Form("hTrkPosCor%d_St%d", iLev, iSt), - Form("Lev%d-St%d position correlation ; " - "#DeltaX (cm); #DeltaY (cm)", - iLev, - iSt), - 100, - -10, - 10, - 100, - -10, - 10); + fhTrkStationDXDY[iLev][iSt] = new TH2F(Form("hTrkPosCor%d_St%d", iLev, iSt), + Form("Lev%d-St%d position correlation ; " + "#DeltaX (cm); #DeltaY (cm)", + iLev, iSt), + 100, -10, 10, 100, -10, 10); } } if (fiStationUT > -1) { @@ -1365,8 +1131,7 @@ void CbmTofExtendTracks::CreateHistograms() { for (Int_t iSt = 0; iSt < fiStationUT; iSt++) itMapStationZ++; dSUT_z = itMapStationZ->first; - LOG(info) << "Create SUT histos for station " << fiStationUT - << " at distance " << dSUT_z; + LOG(info) << "Create SUT histos for station " << fiStationUT << " at distance " << dSUT_z; const Double_t dSUT_RefDx = 0.15; const Double_t dSUT_RefDy = 0.3; const Double_t dNbinX = 100; @@ -1375,73 +1140,29 @@ void CbmTofExtendTracks::CreateHistograms() { Double_t dSUT_dx = dSUT_RefDx * dSUT_z; Double_t dSUT_dy = dSUT_RefDy * dSUT_z; - fhExtSutXY_Found = new TH2F( - "hExtSutXY_Found", - Form("StationUnderTest %d found hits ; X (cm); Y (cm)", fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy); - fhExtSutXY_Missed = new TH2F( - "hExtSutXY_Missed", - Form("StationUnderTest %d missed hits ; X (cm); Y (cm)", fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy); - fhExtSutXY_DX = new TH3F( - "hExtSutXY_DX", - Form("StationUnderTest %d #DeltaX ; X (cm); Y (cm); #DeltaX (cm)", - fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -10., - 10.); - fhExtSutXY_DY = new TH3F( - "hExtSutXY_DY", - Form("StationUnderTest %d #DeltaY ; X (cm); Y (cm); #DeltaY (cm)", - fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -10., - 10.); - fhExtSutXY_DT = new TH3F( - "hExtSutXY_DT", - Form("StationUnderTest %d #DeltaT ; X (cm); Y (cm); #DeltaT (ns)", - fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -50., - 50.); + fhExtSutXY_Found = new TH2F("hExtSutXY_Found", Form("StationUnderTest %d found hits ; X (cm); Y (cm)", fiStationUT), + dNbinX, -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy); + fhExtSutXY_Missed = + new TH2F("hExtSutXY_Missed", Form("StationUnderTest %d missed hits ; X (cm); Y (cm)", fiStationUT), dNbinX, + -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy); + fhExtSutXY_DX = + new TH3F("hExtSutXY_DX", Form("StationUnderTest %d #DeltaX ; X (cm); Y (cm); #DeltaX (cm)", fiStationUT), dNbinX, + -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -10., 10.); + fhExtSutXY_DY = + new TH3F("hExtSutXY_DY", Form("StationUnderTest %d #DeltaY ; X (cm); Y (cm); #DeltaY (cm)", fiStationUT), dNbinX, + -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -10., 10.); + fhExtSutXY_DT = + new TH3F("hExtSutXY_DT", Form("StationUnderTest %d #DeltaT ; X (cm); Y (cm); #DeltaT (ns)", fiStationUT), dNbinX, + -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -50., 50.); } // StationUT end - gDirectory->cd( - oldir - ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! + gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! LoadCalParameter(); } -void CbmTofExtendTracks::FindVertex() { +void CbmTofExtendTracks::FindVertex() +{ fVTX_T = 0.; //reset fVTX_X = 0.; fVTX_Y = 0.; @@ -1454,8 +1175,7 @@ void CbmTofExtendTracks::FindVertex() { if (NULL == pTrk) continue; Double_t w = pTrk->GetNofHits(); - if (w > (Double_t) - fMinNofHits) { // for further analysis request minimum number of hits + 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.); @@ -1470,21 +1190,17 @@ void CbmTofExtendTracks::FindVertex() { } LOG(debug) << Form("CbmTofExtendTracks::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); + fVTXNorm, fVTX_T, fVTX_X, fVTX_Y, fVTX_Z); } -void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { +void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) +{ // event selection: limit number of hits per added station Int_t iAddStations = fiAddStations; while (iAddStations > 0) { Int_t iAddNextStation = iAddStations % 100; iAddStations /= 100; - if ((Int_t) fvAllHitPointer[iAddNextStation].size() > fiCutStationMaxHitMul) - return; + if ((Int_t) fvAllHitPointer[iAddNextStation].size() > fiCutStationMaxHitMul) return; } // limit track multiplicity @@ -1493,25 +1209,19 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { Int_t iLev = 0; // - fhMulCorTrkTof->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), - tEvent->GetNofData(ECbmDataType::kTofHit)); + fhMulCorTrkTof->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), tEvent->GetNofData(ECbmDataType::kTofHit)); - fhMulCorTrkSts->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), - tEvent->GetNofData(ECbmDataType::kStsHit)); + fhMulCorTrkSts->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), tEvent->GetNofData(ECbmDataType::kStsHit)); - fhMulCorTrkMuch->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), - tEvent->GetNofData(ECbmDataType::kMuchPixelHit)); + fhMulCorTrkMuch->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), tEvent->GetNofData(ECbmDataType::kMuchPixelHit)); - fhMulCorTrkRich->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), - tEvent->GetNofData(ECbmDataType::kRichHit)); + fhMulCorTrkRich->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), tEvent->GetNofData(ECbmDataType::kRichHit)); // correlation with TOF Tracklets for (Int_t iTr = 0; iTr < NTrkTof; iTr++) { - Int_t iTrkIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); - CbmTofTracklet* tTrk = - dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); + Int_t iTrkIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); + CbmTofTracklet* tTrk = dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); // tTrk->PrintInfo(); @@ -1520,15 +1230,10 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { // correlation with all TofHits for (UInt_t iSt = 0; iSt < fvTofHitIndex.size(); iSt++) { for (UInt_t iHit = 0; iHit < fvTofHitIndex[iSt].size(); iHit++) { - CbmTofHit* tHit = dynamic_cast<CbmTofHit*>( - fTofHitArrayIn->At(fvTofHitIndex[iSt][iHit])); + CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(fvTofHitIndex[iSt][iHit])); if (NULL == tHit) { - LOG(warn) << Form("Invalid TofHit %d(%lu) ind %d in station %d(%lu)", - iHit, - fvTofHitIndex[iSt].size(), - fvTofHitIndex[iSt][iHit], - iSt, - fvTofHitIndex.size()); + LOG(warn) << Form("Invalid TofHit %d(%lu) ind %d in station %d(%lu)", iHit, fvTofHitIndex[iSt].size(), + fvTofHitIndex[iSt][iHit], iSt, fvTofHitIndex.size()); assert(tHit); } Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; @@ -1537,14 +1242,11 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { continue; } - Double_t dDX = - tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + Double_t dDX = tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); if (TMath::Abs(dDX) > fdTrkCutDX) continue; - Double_t dDY = - tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + Double_t dDY = tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); if (TMath::Abs(dDY) > fdTrkCutDY) continue; - Double_t dDT = - tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + Double_t dDT = tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); if (TMath::Abs(dDT) > fdTrkCutDT) continue; fhPosCorTrkTof->Fill(dDX, dDY); @@ -1552,35 +1254,26 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fhTrkStationDX[iLev]->Fill(iTrSt, dDX); fhTrkStationDY[iLev]->Fill(iTrSt, dDY); fhTrkStationDT[iLev]->Fill(iTrSt, dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt, - (Double_t) fvTofHitIndex[iSt].size()); + fhTrkStationNHits[iLev]->Fill(iTrSt, (Double_t) fvTofHitIndex[iSt].size()); } } // Tof Station loop end // correlation with all StsHits for (UInt_t iSt = 0; iSt < fvStsHitIndex.size(); iSt++) { for (UInt_t iHit = 0; iHit < fvStsHitIndex[iSt].size(); iHit++) { - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>( - fStsHitArrayIn->At(fvStsHitIndex[iSt][iHit])); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fStsHitArrayIn->At(fvStsHitIndex[iSt][iHit])); if (NULL == tHit) { - LOG(warn) << Form("Invalid StsHit %d(%lu) ind %d in station %d(%lu)", - iHit, - fvStsHitIndex[iSt].size(), - fvStsHitIndex[iSt][iHit], - iSt, - fvStsHitIndex.size()); + LOG(warn) << Form("Invalid StsHit %d(%lu) ind %d in station %d(%lu)", iHit, fvStsHitIndex[iSt].size(), + fvStsHitIndex[iSt][iHit], iSt, fvStsHitIndex.size()); assert(tHit); } Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; - Double_t dDX = - tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + Double_t dDX = tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); if (TMath::Abs(dDX) > fdTrkCutDX) continue; - Double_t dDY = - tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + Double_t dDY = tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); if (TMath::Abs(dDY) > fdTrkCutDY) continue; - Double_t dDT = - tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + Double_t dDT = tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); if (TMath::Abs(dDT) > fdTrkCutDT) continue; fhPosCorTrkSts->Fill(dDX, dDY); @@ -1588,39 +1281,28 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fhTrkStationDX[iLev]->Fill(iTrSt, dDX); fhTrkStationDY[iLev]->Fill(iTrSt, dDY); fhTrkStationDT[iLev]->Fill(iTrSt, dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt, - (Double_t) fvStsHitIndex[iSt].size()); + fhTrkStationNHits[iLev]->Fill(iTrSt, (Double_t) fvStsHitIndex[iSt].size()); } } // Sts Station loop end // correlation with all MuchHits for (UInt_t iSt = 0; iSt < fvMuchHitIndex.size(); iSt++) { for (UInt_t iHit = 0; iHit < fvMuchHitIndex[iSt].size(); iHit++) { - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>( - fMuchHitArrayIn->At(fvMuchHitIndex[iSt][iHit])); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fMuchHitArrayIn->At(fvMuchHitIndex[iSt][iHit])); if (NULL == tHit) { - LOG(warn) << Form("Invalid MuchHit %d(%lu) ind %d in station %d(%lu)", - iHit, - fvMuchHitIndex[iSt].size(), - fvMuchHitIndex[iSt][iHit], - iSt, - fvMuchHitIndex.size()); + LOG(warn) << Form("Invalid MuchHit %d(%lu) ind %d in station %d(%lu)", iHit, fvMuchHitIndex[iSt].size(), + fvMuchHitIndex[iSt][iHit], iSt, fvMuchHitIndex.size()); assert(tHit); } Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; - LOG(info) << Form( - "Proc ev %d, Trk %d, St %d, iLe%d MtHit: ", fiEvent, iTr, iTrSt, iLev) - << tHit->ToString(); + LOG(info) << Form("Proc ev %d, Trk %d, St %d, iLe%d MtHit: ", fiEvent, iTr, iTrSt, iLev) << tHit->ToString(); - Double_t dDX = - tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + Double_t dDX = tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); if (TMath::Abs(dDX) > fdTrkCutDX) continue; - Double_t dDY = - tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + Double_t dDY = tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); if (TMath::Abs(dDY) > fdTrkCutDY) continue; - Double_t dDT = - tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + Double_t dDT = tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); if (TMath::Abs(dDT) > fdTrkCutDT) continue; /* LOG(info)<<"Got MuchCorI Tr "<<iTr @@ -1630,49 +1312,35 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { <<", dx " << dDX <<", dy " << dDY; */ - LOG(info) << Form( - "Proc ev %d, Trk %d, St %d, iLe%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, - iTr, - iTrSt, - iLev, - dDX, - dDY) << tHit->ToString(); + LOG(info) << Form("Proc ev %d, Trk %d, St %d, iLe%d, DX %6.3f, dY %6.3f, MtHit: ", fiEvent, iTr, iTrSt, iLev, + dDX, dDY) + << tHit->ToString(); fhPosCorTrkMuch->Fill(dDX, dDY); // fill tracking station histos fhTrkStationDX[iLev]->Fill(iTrSt, dDX); fhTrkStationDY[iLev]->Fill(iTrSt, dDY); fhTrkStationDT[iLev]->Fill(iTrSt, dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt, - (Double_t) fvMuchHitIndex[iSt].size()); + fhTrkStationNHits[iLev]->Fill(iTrSt, (Double_t) fvMuchHitIndex[iSt].size()); } } // Much Station loop end // correlation with all RichHits for (UInt_t iSt = 0; iSt < fvRichHitIndex.size(); iSt++) { for (UInt_t iHit = 0; iHit < fvRichHitIndex[iSt].size(); iHit++) { - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>( - fRichHitArrayIn->At(fvRichHitIndex[iSt][iHit])); + CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fRichHitArrayIn->At(fvRichHitIndex[iSt][iHit])); if (NULL == tHit) { - LOG(warn) << Form("Invalid RichHit %d(%lu) ind %d in station %d(%lu)", - iHit, - fvRichHitIndex[iSt].size(), - fvRichHitIndex[iSt][iHit], - iSt, - fvRichHitIndex.size()); + LOG(warn) << Form("Invalid RichHit %d(%lu) ind %d in station %d(%lu)", iHit, fvRichHitIndex[iSt].size(), + fvRichHitIndex[iSt][iHit], iSt, fvRichHitIndex.size()); assert(tHit); } Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; - Double_t dDX = - tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + Double_t dDX = tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); if (TMath::Abs(dDX) > fdTrkCutDX) continue; - Double_t dDY = - tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + Double_t dDY = tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); if (TMath::Abs(dDY) > fdTrkCutDY) continue; - Double_t dDT = - tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + Double_t dDT = tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); if (TMath::Abs(dDT) > fdTrkCutDT) continue; fhPosCorTrkRich->Fill(dDX, dDY); @@ -1680,8 +1348,7 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fhTrkStationDX[iLev]->Fill(iTrSt, dDX); fhTrkStationDY[iLev]->Fill(iTrSt, dDY); fhTrkStationDT[iLev]->Fill(iTrSt, dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt, - (Double_t) fvRichHitIndex[iSt].size()); + fhTrkStationNHits[iLev]->Fill(iTrSt, (Double_t) fvRichHitIndex[iSt].size()); } } // Rich Station loop end @@ -1699,9 +1366,7 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { // minimal number of TOF hits Int_t NTofHits = 0; for (UInt_t iH = 0; iH < fvTrkCalHits[iTr].size(); iH++) { - if (fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iH]->GetZ())] / 100 - == Int_t(ECbmModuleId::kTof)) - NTofHits++; + if (fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iH]->GetZ())] / 100 == Int_t(ECbmModuleId::kTof)) NTofHits++; } if (NTofHits < fiTrkHitsMin) continue; // contain requested stations @@ -1717,8 +1382,7 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { // <<fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())]%100; iReqStations /= 100; for (; iHit > 0; iHit--) - if (iReqStation - == fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100) { + if (iReqStation == fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100) { // if (iReqStations ==0 ) // LOG(info)<<"Check tr "<<iTr<<" accepted for analysis"; break; @@ -1734,15 +1398,12 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { LOG(info) << "CheckIII accepted tr " << iTr << " with " << fiReqStations; for (UInt_t iHit = 0; iHit < fvTrkCalHits[iTr].size(); iHit++) { - LOG(info) << " Hit " << iHit << ", station " - << fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100; + LOG(info) << " Hit " << iHit << ", station " << fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100; } - fhExt_TrkSizChiSq[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), - fvTrkPar[iTr]->GetChiSq()); + fhExt_TrkSizChiSq[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), fvTrkPar[iTr]->GetChiSq()); - fhExt_TrkSizVel[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), - 1. / (fvTrkPar[iTr]->GetTt())); + fhExt_TrkSizVel[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), 1. / (fvTrkPar[iTr]->GetTt())); // Pulls CbmTofTrackletParam* tTrkPar = fvTrkPar[iTr]; @@ -1772,31 +1433,21 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { } // pulls against original tracklets - Int_t iTrkInd = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); - CbmTofTracklet* pTrk = - dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkInd)); - dDX = tHit->GetX() - pTrk->GetFitX(tHit->GetZ()); - dDY = tHit->GetY() - pTrk->GetFitY(tHit->GetZ()); - dDT = tHit->GetTime() - pTrk->GetFitT(tHit->GetZ()); + Int_t iTrkInd = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); + CbmTofTracklet* pTrk = dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkInd)); + dDX = tHit->GetX() - pTrk->GetFitX(tHit->GetZ()); + dDY = tHit->GetY() - pTrk->GetFitY(tHit->GetZ()); + dDT = tHit->GetTime() - pTrk->GetFitT(tHit->GetZ()); fhTrkPullDX[0]->Fill(iTrSt, dDX); fhTrkPullDY[0]->Fill(iTrSt, dDY); fhTrkPullDT[0]->Fill(iTrSt, dDT); fhTrkStationDXDY[0][iTrSt]->Fill(dDX, dDY); - LOG(info) << Form( - "Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, - iTr, - iTrSt, - 0, - dDX, - dDY) << tHit->ToString(); + LOG(info) << Form("Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", fiEvent, iTr, iTrSt, 0, dDX, + dDY) + << tHit->ToString(); } // fvTrkCalHits loop end - if (bSUT_Found == kFALSE) { - fhExtSutXY_Missed->Fill(GetFitX(dSUT_z, tTrkPar), - GetFitY(dSUT_z, tTrkPar)); - } + if (bSUT_Found == kFALSE) { fhExtSutXY_Missed->Fill(GetFitX(dSUT_z, tTrkPar), GetFitY(dSUT_z, tTrkPar)); } //Deviations to all hits in all stations for (UInt_t iSt = 0; iSt < NSt; iSt++) { @@ -1818,21 +1469,15 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { Double_t dDT = tHit->GetTime() - GetFitT(tHit->GetZ(), tTrkPar); if (TMath::Abs(dDT) > fdTrkCutDT) continue; - LOG(info) << Form( - "Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, - iTr, - iSt, - iLev, - dDX, - dDY) << tHit->ToString(); + LOG(info) << Form("Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", fiEvent, iTr, iSt, iLev, dDX, + dDY) + << tHit->ToString(); // fill tracking station histos fhTrkStationDX[iLev]->Fill(iSt, dDX); fhTrkStationDY[iLev]->Fill(iSt, dDY); fhTrkStationDT[iLev]->Fill(iSt, dDT); - fhTrkStationNHits[iLev]->Fill(iSt, - (Double_t) fvAllHitPointer[iSt].size()); + fhTrkStationNHits[iLev]->Fill(iSt, (Double_t) fvAllHitPointer[iSt].size()); fhTrkStationDXDY[iLev][iSt]->Fill(dDX, dDY); } } @@ -1840,8 +1485,8 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { } // FillHist end -void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, - CbmTofTrackletParam* pTrkPar) { +void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, CbmTofTrackletParam* pTrkPar) +{ TGraph2DErrors* gr = new TGraph2DErrors(); // Fill the 2D graph // generate graph with the 3d points @@ -1856,8 +1501,8 @@ void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, dy = pHits[N]->GetDy(); dz = pHits[N]->GetDz(); //FIXME gr->SetPointError(N, dx, dy, dz); - LOG(debug) << "Line3Dfit add N = " << N << ",\t" << x << ",\t" << y << ",\t" - << z << ",\t" << dx << ",\t" << dy << ",\t" << dz; + LOG(debug) << "Line3Dfit add N = " << N << ",\t" << x << ",\t" << y << ",\t" << z << ",\t" << dx << ",\t" << dy + << ",\t" << dz; } // fit the graph now @@ -1866,21 +1511,16 @@ void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, pStart[1] = pTrkPar->GetTx(); pStart[2] = pTrkPar->GetY(); pStart[3] = pTrkPar->GetTy(); - LOG(debug) << "Line3Dfit init: X0 " << pStart[0] << ", TX " << pStart[1] - << ", Y0 " << pStart[2] << ", TY " << pStart[3]; + LOG(debug) << "Line3Dfit init: X0 " << pStart[0] << ", TX " << pStart[1] << ", Y0 " << pStart[2] << ", TY " + << pStart[3]; fMinuit.DoFit(gr, pStart); //gr->Draw("err p0"); gr->Delete(); Double_t* dRes; dRes = fMinuit.GetParFit(); - LOG(debug) << "Line3Dfit result(" << pHits.size() << ") " << gMinuit->fCstatu - << " : X0 " - << Form(" %7.4f, TX %7.4f, Y0 %7.4f, TY %7.4f, Chi2DoF %7.4f ", - dRes[0], - dRes[1], - dRes[2], - dRes[3], + LOG(debug) << "Line3Dfit result(" << pHits.size() << ") " << gMinuit->fCstatu << " : X0 " + << Form(" %7.4f, TX %7.4f, Y0 %7.4f, TY %7.4f, Chi2DoF %7.4f ", dRes[0], dRes[1], dRes[2], dRes[3], fMinuit.GetChi2DoF()); pTrkPar->SetX(dRes[0]); @@ -1892,29 +1532,28 @@ void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, pTrkPar->SetChiSq(fMinuit.GetChi2DoF()); // / (Double_t)pHits.size()); } -Double_t CbmTofExtendTracks::GetFitX(Double_t dZ, - CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitX(Double_t dZ, CbmTofTrackletParam* fTrkPar) +{ return fTrkPar->GetX() + fTrkPar->GetTx() * (dZ - fTrkPar->GetZ()); } -Double_t CbmTofExtendTracks::GetFitY(Double_t dZ, - CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitY(Double_t dZ, CbmTofTrackletParam* fTrkPar) +{ return fTrkPar->GetY() + fTrkPar->GetTy() * (dZ - fTrkPar->GetZ()); } -Double_t CbmTofExtendTracks::GetFitT(Double_t dZ, - CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitT(Double_t dZ, CbmTofTrackletParam* fTrkPar) +{ return fTrkPar->GetT() + fTrkPar->GetTt() * (dZ - fTrkPar->GetZ()) - * TMath::Sqrt(1. + fTrkPar->GetTx() * fTrkPar->GetTx() - + fTrkPar->GetTy() * fTrkPar->GetTy()); + * TMath::Sqrt(1. + fTrkPar->GetTx() * fTrkPar->GetTx() + fTrkPar->GetTy() * fTrkPar->GetTy()); } -void CbmTofExtendTracks::TrkAddStation(Int_t iStation) { +void CbmTofExtendTracks::TrkAddStation(Int_t iStation) +{ - LOG(debug) << "Add " << fvAllHitPointer[iStation].size() - << " hits from station " << iStation << " to " << fvTrkPar.size() - << " tracks "; + LOG(debug) << "Add " << fvAllHitPointer[iStation].size() << " hits from station " << iStation << " to " + << fvTrkPar.size() << " tracks "; const Int_t NCand = 100; // tbd: get matching width from histos !! @@ -1930,30 +1569,19 @@ void CbmTofExtendTracks::TrkAddStation(Int_t iStation) { for (UInt_t iTr = 0; iTr < NTr; iTr++) { for (UInt_t iHit = 0; iHit < fvAllHitPointer[iStation].size(); iHit++) { CbmPixelHit* tHit = fvAllHitPointer[iStation][iHit]; - LOG(debug) << " Hit " << iHit << ": X " << tHit->GetX() << ", Y " - << tHit->GetY() << ", Z " << tHit->GetZ() << ", T " - << tHit->GetTime(); + LOG(debug) << " Hit " << iHit << ": X " << tHit->GetX() << ", Y " << tHit->GetY() << ", Z " << tHit->GetZ() + << ", T " << tHit->GetTime(); Double_t MatchChi2 = - TMath::Power((tHit->GetX() + fvXoff[iStation] - - GetFitX(tHit->GetZ(), fvTrkPar[iTr])) - / tSIGX, - 2) - + TMath::Power((tHit->GetY() + fvYoff[iStation] - - GetFitY(tHit->GetZ(), fvTrkPar[iTr])) - / tSIGY, - 2); - TMath::Power((tHit->GetTime() + fvToff[iStation] - - GetFitT(tHit->GetZ(), fvTrkPar[iTr])) - / tSIGT, - 2); + TMath::Power((tHit->GetX() + fvXoff[iStation] - GetFitX(tHit->GetZ(), fvTrkPar[iTr])) / tSIGX, 2) + + TMath::Power((tHit->GetY() + fvYoff[iStation] - GetFitY(tHit->GetZ(), fvTrkPar[iTr])) / tSIGY, 2); + TMath::Power((tHit->GetTime() + fvToff[iStation] - GetFitT(tHit->GetZ(), fvTrkPar[iTr])) / tSIGT, 2); MatchChi2 /= 3.; LOG(debug) << "Match Tr " << iTr << ", Hit " << iHit << ": " << MatchChi2; if (MatchChi2 < fdChi2Max) { Int_t iCand = 0; for (; iCand < iMatch + 1; iCand++) { if (MatchChi2 < MatchChi2Min[iCand]) { - LOG(debug) << "Better Match found for iTr " << iTr << " Chi2 " - << MatchChi2; + LOG(debug) << "Better Match found for iTr " << iTr << " Chi2 " << MatchChi2; for (Int_t i = iMatch - 1; i >= iCand; i--) { MatchChi2Min[i + 1] = MatchChi2Min[i]; MatchHit[i + 1] = MatchHit[i]; @@ -1967,8 +1595,8 @@ void CbmTofExtendTracks::TrkAddStation(Int_t iStation) { } // end candidate loop iMatch++; if (iMatch == NCand) iMatch--; // cutoff - LOG(debug) << "New Match " << iMatch << " stored as candidate " << iCand - << " for Tr " << iTr << " with hit " << iHit; + LOG(debug) << "New Match " << iMatch << " stored as candidate " << iCand << " for Tr " << iTr << " with hit " + << iHit; } } // station hit loop end } // track loop end @@ -1988,8 +1616,7 @@ void CbmTofExtendTracks::TrkAddStation(Int_t iStation) { fvTrkCalHits[MatchTrk[iCand]].push_back(dynamic_cast<CbmPixelHit*>(tHit)); // prevent match with other tracks for (Int_t i = iCand + 1; i < iMatch; i++) { - if (MatchHit[i] == MatchHit[iCand] || MatchTrk[i] == MatchTrk[iCand]) - MatchHit[i] = -1; + if (MatchHit[i] == MatchHit[iCand] || MatchTrk[i] == MatchTrk[iCand]) MatchHit[i] = -1; } // refit track, update TrkPar fvTrkPar[MatchTrk[iCand]]->SetX(0.); -- GitLab