diff --git a/analysis/detectors/mvd/CbmMvdReadout.cxx b/analysis/detectors/mvd/CbmMvdReadout.cxx index f64ef8e7c53ea769ce59216deea51cc58fe06079..e6b379f6de287a0dd164bdf513e22a7517cad500 100644 --- a/analysis/detectors/mvd/CbmMvdReadout.cxx +++ b/analysis/detectors/mvd/CbmMvdReadout.cxx @@ -17,11 +17,6 @@ #include <FairRootManager.h> // for FairRootManager #include <Logger.h> // for LOG -#include <iostream> // for operator<<, endl - -using std::cout; -using std::endl; - // ----- Default constructor ------------------------------------------ CbmMvdReadout::CbmMvdReadout() : CbmMvdReadout("MVDClusterfinder") {} // ------------------------------------------------------------------------- @@ -47,8 +42,8 @@ void CbmMvdReadout::Exec(Option_t* /*opt*/) { if (fDigiMan->GetNofDigis(ECbmModuleId::kMvd) > 0) { - if (fVerbose) cout << "//----------------------------------------//"; - if (fVerbose) cout << endl << "Send Input" << endl; + if (fVerbose) LOG(info) << "//----------------------------------------//"; + if (fVerbose) LOG(info) << "Send Input"; Int_t nTargetPlugin = fDetector->DetectPlugin(200); CbmMvdDigi* digi = 0; @@ -60,9 +55,9 @@ void CbmMvdReadout::Exec(Option_t* /*opt*/) fDetector->SendInputToSensorPlugin(digi->GetDetectorId(), nTargetPlugin, static_cast<TObject*>(digi)); } - if (fVerbose) cout << "Execute ReadoutPlugin Nr. " << fPluginNr << endl; + if (fVerbose) LOG(info) << "Execute ReadoutPlugin Nr. " << fPluginNr; fDetector->Exec(fPluginNr); - if (fVerbose) cout << "End Chain" << endl; + if (fVerbose) LOG(info) << "End Chain"; } } // ----------------------------------------------------------------------------- @@ -70,15 +65,12 @@ void CbmMvdReadout::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdReadout::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -95,7 +87,7 @@ InitStatus CbmMvdReadout::Init() fDetector = CbmMvdDetector::Instance(); if (fDetector->GetSensorArraySize() > 1) { - if (fVerbose) cout << endl << "-I- succesfully loaded Geometry from file -I-" << endl; + if (fVerbose) LOG(info) << "succesfully loaded Geometry from file"; } else { LOG(fatal) << "Geometry couldn't be loaded from file. No MVD digitizer available."; @@ -122,10 +114,8 @@ InitStatus CbmMvdReadout::Init() // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; - return kSUCCESS; } @@ -155,11 +145,10 @@ void CbmMvdReadout::Reset() void CbmMvdReadout::PrintParameters() const { - //cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters Readout ===== ====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; + LOG(info) << "============================================================"; + LOG(info) << "============== Parameters Readout ===== ===================="; + LOG(info) << "============================================================"; + LOG(info) << "=============== End Task ==================================="; } // ------------------------------------------------------------------------- diff --git a/analysis/detectors/mvd/CbmMvdReadoutCluster.cxx b/analysis/detectors/mvd/CbmMvdReadoutCluster.cxx index b39550af07aff640e3be0a02419a2e22a843bb94..29e907c6c1d7f49c7c18499fcc0cb98566352818 100644 --- a/analysis/detectors/mvd/CbmMvdReadoutCluster.cxx +++ b/analysis/detectors/mvd/CbmMvdReadoutCluster.cxx @@ -19,12 +19,9 @@ #include <TH1.h> // for TH1F #include <TString.h> // for Form -#include <iostream> // for cout, endl -#include <map> // for allocator, map, operator!=, __map_iterator -#include <utility> // for pair +#include <map> // for allocator, map, operator!=, __map_iterator +#include <utility> // for pair -using std::cout; -using std::endl; using std::map; using std::pair; diff --git a/analysis/detectors/mvd/CbmMvdReadoutSimple.cxx b/analysis/detectors/mvd/CbmMvdReadoutSimple.cxx index b5474d44846897a8ae4b48a6455de08a8e3f0b20..d222b1d83a733267f8a98f8f26e782a90c2a82ef 100644 --- a/analysis/detectors/mvd/CbmMvdReadoutSimple.cxx +++ b/analysis/detectors/mvd/CbmMvdReadoutSimple.cxx @@ -22,11 +22,6 @@ #include <TH2.h> // for TH2F, TH2I #include <TString.h> // for Form -#include <iostream> // for operator<<, basic_ostream, endl, cout - -using std::cout; -using std::endl; - // ----- Default constructor ------------------------------------------- CbmMvdReadoutSimple::CbmMvdReadoutSimple() : CbmMvdReadoutSimple::CbmMvdReadoutSimple("MvdReadoutSimple", 0) {} // ------------------------------------------------------------------------- @@ -278,8 +273,8 @@ void CbmMvdReadoutSimple::WriteHistograms() Double_t param1 = func->GetParameter(1); Double_t param2 = func->GetParameter(2); Double_t chi2 = func->GetChisquare(); - cout << " // - " << i << " -- param 0 = " << param0 << " -- param 1 = " << param1 << " -- param 2 = " << param2 - << " -- chi2 = " << chi2 << endl; + LOG(info) << " // - " << i << " -- param 0 = " << param0 << " -- param 1 = " << param1 << " -- param 2 = " << param2 + << " -- chi2 = " << chi2; fWordsPerRegion2->Fill(i, param1); fWordsPerRegion2->SetBinError(i, 0, param1, param2); fMvdDataPerRegion[i]->Write(); @@ -326,7 +321,7 @@ for(Int_t pad = 0; pad < 63; pad++) mcCanvas4->cd(pad+1); fMvdMCBank[pad]->Draw("COL"); fMvdMCBank[pad]->Write(); - cout << "Bank " << pad << " avarage Entries " << fMvdMCBank[pad]->GetEntries()/fEventNumber << endl; + LOG(info) << "Bank " << pad << " avarage Entries " << fMvdMCBank[pad]->GetEntries()/fEventNumber; fMvdBankDist->Fill(pad, fMvdMCBank[pad]->GetEntries()/fEventNumber); } TCanvas* mcCanvas5 = new TCanvas(); diff --git a/analysis/detectors/mvd/plugins/tasks/CbmMvdSensorReadoutTask.cxx b/analysis/detectors/mvd/plugins/tasks/CbmMvdSensorReadoutTask.cxx index 3c61c97ac39d180f50ec4db9f2745e30a4d2edcd..542f22a25ef6250f5b0fd7aa721584c4a40fc3b1 100644 --- a/analysis/detectors/mvd/plugins/tasks/CbmMvdSensorReadoutTask.cxx +++ b/analysis/detectors/mvd/plugins/tasks/CbmMvdSensorReadoutTask.cxx @@ -10,14 +10,11 @@ #include "CbmMvdDigi.h" // for CbmMvdDigi +#include <Logger.h> + #include <TClonesArray.h> // for TClonesArray #include <TH1.h> // for TH1I -#include <iostream> // for operator<<, basic_ostream, endl, cout, ost... - -using std::cout; -using std::endl; - // ----- Default constructor ------------------------------------------- CbmMvdSensorReadoutTask::CbmMvdSensorReadoutTask() : CbmMvdSensorTask() @@ -122,7 +119,7 @@ void CbmMvdSensorReadoutTask::Reset() {} void CbmMvdSensorReadoutTask::Finish() { for (Int_t iBank = 0; iBank < maxBanks; ++iBank) { - cout << "Number of fired pixels in bank : " << iBank << " is " << fSensorBanks[iBank] << endl; + LOG(info) << "Number of fired pixels in bank : " << iBank << " is " << fSensorBanks[iBank]; TH1I* hist = (TH1I*) fOutputBuffer->ConstructedAt(0); hist->Fill(iBank, fSensorBanks[iBank]); } diff --git a/analysis/detectors/mvd/qa/CbmMvdClusterAna.cxx b/analysis/detectors/mvd/qa/CbmMvdClusterAna.cxx index ac55debc288ea5583ea763e253ff1a92fa0138ec..ca47a91ec0253aa000c3b071c1d3245b61fddbd8 100644 --- a/analysis/detectors/mvd/qa/CbmMvdClusterAna.cxx +++ b/analysis/detectors/mvd/qa/CbmMvdClusterAna.cxx @@ -47,10 +47,7 @@ //-- Include from C++ --// #include <iomanip> -#include <iostream> -using namespace std; -using std::cout; -using std::endl; + using std::flush; // ----- Default constructor ------------------------------------------- @@ -115,19 +112,11 @@ CbmMvdClusterAna::~CbmMvdClusterAna() { ; } // ------------------------------------------------------------------------- InitStatus CbmMvdClusterAna::Init() { - cout << "--------------------------------------------------------------------" - "-----" - << endl - << "-I- " << GetName() << "::Init: " - << " Start Initilisation " << endl - << "--------------------------------------------------------------------" - "-----" - << endl; + LOG(info) << GetName() << "::Init: Start Initilisation "; FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: " - << "RootManager not instantised!" << endl; + LOG(error) << GetName() << "::Init: RootManager not instantised!"; return kFATAL; } @@ -221,14 +210,7 @@ InitStatus CbmMvdClusterAna::Init() fMvdHisto2[15] = new TH2F("mom_cha", "mom_cha", 100, 0, 3, 1000, 0, 10000); fMvdHisto2[16] = new TH2F("ang_cha", "ang_cha", 200, 0, 2, 1000, 0, 10000); fMvdHisto2[17] = new TH2F("mom_chacut", "mom_chacut", 100, 0, 3, 1000, 0, 10000); - cout << "--------------------------------------------------------------------" - "-----" - << endl - << "-I- " << GetName() << "::Init: " - << " Finished Initilisation " << endl - << "--------------------------------------------------------------------" - "-----" - << endl; + LOG(info) << GetName() << "::Init: Finished Initilisation "; fNrMcPointsAll = 0; fNrHitsAll = 0; @@ -260,16 +242,16 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) // Int_t nMcTracks = fListMCTracks ->GetEntriesFast(); // Int_t nTracks = fStsTrackArray ->GetEntriesFast(); // Number of Tracks - // cout<<"MC Points : "<< nMcpoints <<endl; - // cout<<"Hits : "<< nHits <<endl; - // cout<<"HitMatchs : "<< nHitsMatch <<endl; - // cout<<"Clusters : "<< nClusters <<endl; - // cout<<"ClusterMatch : "<< nClustersMatch<<endl; - // cout<<"Digis : "<< nDigis <<endl; - // cout<<"DigiMatchs : "<< nDigisMatch <<endl; - // cout<<"MC Tracks : "<< nMcTracks <<endl; - // cout<<"Tracks : "<< nTracks <<endl; - // cout<<"------"<<endl; + // LOG(debug)<<"MC Points : "<< nMcpoints; + // LOG(debug)<<"Hits : "<< nHits; + // LOG(debug)<<"HitMatchs : "<< nHitsMatch; + // LOG(debug)<<"Clusters : "<< nClusters; + // LOG(debug)<<"ClusterMatch : "<< nClustersMatch; + // LOG(debug)<<"Digis : "<< nDigis; + // LOG(debug)<<"DigiMatchs : "<< nDigisMatch; + // LOG(debug)<<"MC Tracks : "<< nMcTracks; + // LOG(debug)<<"Tracks : "<< nTracks; + // LOG(debug)<<"------"; // ------------------- CbmMvdPoint* mvdPoint; // Monte Carlo Point CbmMvdDigi* mvdDigi; // Digi @@ -400,7 +382,7 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) // Analyze Hits and Clusters for (Int_t iHit = 0; iHit < nHits; iHit++) { - cout << endl << "run next Hit " << iHit << " of " << nHits << " Hits" << endl; + LOG(info) << "run next Hit " << iHit << " of " << nHits << " Hits"; mvdHit = (CbmMvdHit*) fMvdHits->At(iHit); mvdCluster = (CbmMvdCluster*) fMvdClusters->At(iHit); mvdHitMatch = (CbmMvdHitMatch*) fMvdHitsMatch->At(iHit); @@ -443,7 +425,6 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) McInHit.clear(); McContrToHitList.clear(); - cout << endl << "ping" << endl; for (it_type iterator = digiMap.begin(); iterator != digiMap.end(); iterator++) { digiCoor = iterator->first; digiCharge = iterator->second; @@ -479,7 +460,6 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) // if (it != DigisMap.end()) // { fMcperDigi[McContrList.size()]++; // Number of MC Points contributing to a Digi - cout << endl << "ping 2" << endl; for (Int_t iMc = 0; iMc < McContrList.size(); iMc++) { if (std::find(McContrToHitList.begin(), McContrToHitList.end(), McContrList[iMc]) == McContrToHitList.end()) { McContrToHitList.push_back(McContrList[iMc]); @@ -505,7 +485,6 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) fMcperHit[10]++; } count = 0; - cout << endl << "ping 3" << endl; for (std::map<Int_t, Int_t>::iterator iterator = McInHit.begin(); iterator != McInHit.end(); iterator++) { DigisInMc[iterator->first] += iterator->second; count++; @@ -523,7 +502,6 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) HitsInMc[iterator->first] = McContrList; } - cout << endl << "ping 4" << endl; if ((xaxismax - xaxismin) < 4 && (yaxismax - yaxismin) < 4) { shape = 0; @@ -566,7 +544,6 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) else { shape = 9; } - cout << endl << "ping 5" << endl; ARR_momentum[iHit] = mcTrack->GetP(); ARR_angle[iHit] = cVect.Angle(cOrth); ARR_digis[iHit] = mvdCluster->GetNofDigis(); @@ -579,12 +556,11 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) + (double) (((locMC[1] + VolumeShape->GetDY()) / (1 * pitchy)) - 0.5); ARR_shape[iHit] = shape; ARR_charge[iHit] = charge; - cout << endl << "finished this hit" << endl; } // ------------------- for (Int_t iHit = 0; iHit < nHits; iHit++) { - cout << endl << "fill stuff" << endl; + LOG(debug) << "fill stuff"; fMvdHisto1[0]->Fill(ARR_momentum[iHit]); fMvdHisto1[1]->Fill(ARR_angle[iHit]); fMvdHisto1[2]->Fill(ARR_digis[iHit]); @@ -665,18 +641,18 @@ void CbmMvdClusterAna::Exec(Option_t* /*opt*/) // ------------------------------------------------------------------------- void CbmMvdClusterAna::Finish() { - cout << "======================" << endl; - cout << "'Mvd QA Output' Start!" << endl; - cout << "======================" << endl; + LOG(info) << "======================"; + LOG(info) << "'Mvd QA Output' Start!"; + LOG(info) << "======================"; // ------------------- - cout << "----------------------" << endl; - cout << "Pixelpitch: " << endl; - cout << "x: " << fPixelpitch[0] << endl; - cout << "y: " << fPixelpitch[1] << endl; + LOG(info) << "----------------------"; + LOG(info) << "Pixelpitch: "; + LOG(info) << "x: " << fPixelpitch[0]; + LOG(info) << "y: " << fPixelpitch[1]; // ------------------- int sum; - cout << "----------------------" << endl; - cout << "MC points per Digi:" << endl; + LOG(info) << "----------------------"; + LOG(info) << "MC points per Digi:"; sum = 0; for (Int_t i = 0; i < 6; i++) { sum += fMcperDigi[i]; @@ -686,37 +662,37 @@ void CbmMvdClusterAna::Finish() printf(" %2i %10i %6.5f \n", i, fMcperDigi[i], 1. * fMcperDigi[i] / sum); } // ------------------- - cout << "----------------------" << endl; - cout << "Digis per MC Point:" << endl; + LOG(info) << "----------------------"; + LOG(info) << "Digis per MC Point:"; for (Int_t i = 0; i < 11; i++) { if (fMvdHisto1[30]->GetBinCenter(i) >= 0) printf(" %2i %10i %6.5f \n", (int) (fMvdHisto1[30]->GetBinCenter(i)), (int) (fMvdHisto1[30]->GetBinContent(i)), 1. * (int) (fMvdHisto1[30]->GetBinContent(i)) * 1. / fMvdHisto1[30]->GetEntries()); } - cout << " .." << endl; + LOG(info) << " .."; // ------------------- - cout << "----------------------" << endl; - cout << "Digis per Hit:" << endl; + LOG(info) << "----------------------"; + LOG(info) << "Digis per Hit:"; for (Int_t i = 0; i < 11; i++) { if (fMvdHisto1[2]->GetBinCenter(i) >= 0) printf(" %2i %10i %6.5f \n", (int) (fMvdHisto1[2]->GetBinCenter(i)), (int) (fMvdHisto1[2]->GetBinContent(i)), 1. * (int) (fMvdHisto1[2]->GetBinContent(i)) * 1. / fMvdHisto1[2]->GetEntries()); } - cout << " .." << endl; + LOG(info) << " .."; // ------------------- - cout << "----------------------" << endl; - cout << "Hits per MC Point:" << endl; + LOG(info) << "----------------------"; + LOG(info) << "Hits per MC Point:"; for (Int_t i = 0; i < 11; i++) { if (fMvdHisto1[31]->GetBinCenter(i) >= 0) printf(" %2i %10i %6.5f \n", (int) (fMvdHisto1[31]->GetBinCenter(i)), (int) (fMvdHisto1[31]->GetBinContent(i)), 1. * (int) (fMvdHisto1[31]->GetBinContent(i)) * 1. / fMvdHisto1[31]->GetEntries()); } - cout << " .." << endl; + LOG(info) << " .."; // ------------------- - cout << "----------------------" << endl; - cout << "MC Points per Hit:" << endl; + LOG(info) << "----------------------"; + LOG(info) << "MC Points per Hit:"; sum = 0; for (Int_t i = 0; i < 11; i++) { sum += fMcperHit[i]; @@ -726,17 +702,17 @@ void CbmMvdClusterAna::Finish() printf(" %2i %10i %6.5f \n", i, fMcperHit[i], 1. * fMcperHit[i] / sum); } // ------------------- - cout << "----------------------" << endl; - cout << "MC Points per Hit (merged Clusters):" << endl; + LOG(info) << "----------------------"; + LOG(info) << "MC Points per Hit (merged Clusters):"; for (Int_t i = 0; i < 11; i++) { if (fMvdHisto1[32]->GetBinCenter(i) >= 0) printf(" %2i %10i %6.5f \n", (int) (fMvdHisto1[32]->GetBinCenter(i)), (int) (fMvdHisto1[32]->GetBinContent(i)), 1. * (int) (fMvdHisto1[32]->GetBinContent(i)) * 1. / fMvdHisto1[32]->GetEntries()); } - cout << " .." << endl; + LOG(info) << " .."; // ------------------- - cout << "----------------------" << endl; + LOG(info) << "----------------------"; // ------------------- Double_t xpar[3]; Double_t ypar[3]; @@ -750,51 +726,51 @@ void CbmMvdClusterAna::Finish() gFitx->GetParameters(&xpar[0]); gFity->GetParameters(&ypar[0]); - cout << setw(40) << "---------------------------------------------------------------------" << endl; - cout << "Resolution:" << endl; - cout << setw(40) << "---------------------------------------------------------------------" << endl; - cout << setw(9) << " Shape"; - cout << setw(10) << " Mean(x)"; - cout << setw(10) << " RMS(x)"; - cout << setw(10) << " Mean(y)"; - cout << setw(10) << " RMS(y)"; - cout << setw(10) << " Mean(z)"; - cout << setw(10) << " RMS(z)"; - cout << endl; - cout << setw(40) << "---------------------------------------------------------------------"; - cout << endl; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; + LOG(info) << "Resolution:"; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; + LOG(info) << setw(9) << " Shape"; + LOG(info) << setw(10) << " Mean(x)"; + LOG(info) << setw(10) << " RMS(x)"; + LOG(info) << setw(10) << " Mean(y)"; + LOG(info) << setw(10) << " RMS(y)"; + LOG(info) << setw(10) << " Mean(z)"; + LOG(info) << setw(10) << " RMS(z)"; + LOG(info); + LOG(info) << setw(40) << "---------------------------------------------------------------------"; + LOG(info); for (int i = 0; i < 10; i++) { printf("%6i %+5.4f %+5.4f %+5.4f %+5.4f \n", i, fMvdHisto1[10 + i]->GetMean(), fMvdHisto1[10 + i]->GetRMS(), fMvdHisto1[20 + i]->GetMean(), fMvdHisto1[20 + i]->GetRMS()); } - cout << setw(40) << "---------------------------------------------------------------------" << endl; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; printf("%10s%+5.4f %+5.4f %+5.4f %+5.4f %+5.4f %+5.4f \n", "All ", fMvdHisto1[3]->GetMean(), fMvdHisto1[3]->GetRMS(), fMvdHisto1[4]->GetMean(), fMvdHisto1[4]->GetRMS(), fMvdHisto1[5]->GetMean(), fMvdHisto1[5]->GetRMS()); printf("%10s%+5.4f %+5.4f %+5.4f %+5.4f \n", "All (Fit) ", xpar[1], xpar[2], ypar[1], ypar[2]); - cout << setw(40) << "---------------------------------------------------------------------" << endl; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; fMvdHisto1[33]->Fit(gFitx, "QRN0"); fMvdHisto1[34]->Fit(gFity, "QRN0"); gFitx->GetParameters(&xpar[0]); gFity->GetParameters(&ypar[0]); - cout << "Pulls:" << endl; + LOG(info) << "Pulls:"; printf("%10s%+5.4f %+5.4f %+5.4f %+5.4f \n", "All ", fMvdHisto1[33]->GetMean(), fMvdHisto1[33]->GetRMS(), fMvdHisto1[34]->GetMean(), fMvdHisto1[34]->GetRMS()); printf("%10s%+5.4f %+5.4f %+5.4f %+5.4f \n", "All (Fit) ", xpar[1], xpar[2], ypar[1], ypar[2]); - cout << "(Using 3.8(x) and 4.8(y) as nominal resolution!)" << endl; - cout << setw(40) << "---------------------------------------------------------------------" << endl; - cout << setw(40) << "---------------------------------------------------------------------" << endl; + LOG(info) << "(Using 3.8(x) and 4.8(y) as nominal resolution!)"; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; // ------------------- - cout << "Hit Reco Efficiency: " << float(1. * fNrHitsAll / fNrMcPointsAll) << "\t( " << fNrHitsAll << "\t" - << fNrMcPointsAll << " )" << endl; - cout << setw(40) << "---------------------------------------------------------------------" << endl; + LOG(info) << "Hit Reco Efficiency: " << float(1. * fNrHitsAll / fNrMcPointsAll) << "\t( " << fNrHitsAll << "\t" + << fNrMcPointsAll << " )"; + LOG(info) << setw(40) << "---------------------------------------------------------------------"; // ------------------- - cout << "======================" << endl; - cout << "'Mvd QA Output' End!" << endl; - cout << "======================" << endl; + LOG(info) << "======================"; + LOG(info) << "'Mvd QA Output' End!"; + LOG(info) << "======================"; // ------------------- TCanvas* a = new TCanvas("Residuals", "Residuals"); diff --git a/analysis/detectors/mvd/qa/CbmMvdQa.cxx b/analysis/detectors/mvd/qa/CbmMvdQa.cxx index 70ca6495356cfb6351dab2de43a254a9fa254e2c..411296cf9277e940d4ad164a32db2b2c23ae84cf 100644 --- a/analysis/detectors/mvd/qa/CbmMvdQa.cxx +++ b/analysis/detectors/mvd/qa/CbmMvdQa.cxx @@ -38,12 +38,8 @@ #include <TObject.h> // for TObject #include <TStyle.h> // for TStyle, gStyle -#include <iostream> // for operator<<, basic_ostream, char_traits - #include <cmath> // for sqrt, fabs -using std::cout; -using std::endl; using std::flush; // ----- Default constructor ------------------------------------------- @@ -113,19 +109,11 @@ CbmMvdQa::~CbmMvdQa() { ; } // ------------------------------------------------------------------------- InitStatus CbmMvdQa::Init() { - cout << "--------------------------------------------------------------------" - "-----" - << endl - << "-I- " << GetName() << "::Init: " - << " Start Initilisation " << endl - << "--------------------------------------------------------------------" - "-----" - << endl; + LOG(info) << GetName() << "::Init: Start Initilisation "; FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: " - << "RootManager not instantised!" << endl; + LOG(error) << GetName() << "::Init: RootManager not instantised!"; return kFATAL; } fBadTracks = new TClonesArray("CbmStsTrack", 5000); @@ -145,7 +133,7 @@ InitStatus CbmMvdQa::Init() fMvdDigiMatchArray = (TClonesArray*) ioman->GetObject("MvdDigiMatch"); if (fMvdHits->GetEntriesFast() != fMvdHitMatchArray->GetEntriesFast()) - cout << endl << "MvdHit and MvdHitMatch Arrays do not have the same size" << endl; + LOG(error) << "MvdHit and MvdHitMatch Arrays do not have the same size"; // fPrimVtx = (CbmVertex*) ioman->GetObject("PrimaryVertex"); // Get pointer to PrimaryVertex object from IOManager if it exists @@ -160,7 +148,7 @@ InitStatus CbmMvdQa::Init() fListMCTracks = (TClonesArray*) ioman->GetObject("MCTrack"); if (!fMcPoints) { - cout << endl << "Mvd Pile Up Mc array missing"; + LOG(error) << "Mvd Pile Up Mc array missing"; return kFATAL; } fDetector = CbmMvdDetector::Instance(); @@ -177,14 +165,7 @@ InitStatus CbmMvdQa::Init() SetupHistograms(); - cout << "--------------------------------------------------------------------" - "-----" - << endl - << "-I- " << GetName() << "::Init: " - << " Finished Initialisation " << endl - << "--------------------------------------------------------------------" - "-----" - << endl; + LOG(info) << GetName() << "::Init: Finished Initialisation "; return kSUCCESS; } @@ -1299,7 +1280,7 @@ Double_t CbmMvdQa::GetAngle( CbmLitTrackParam t ){ Float_t angle_rad = std::atan(GetTransverseMomentum(t) / GetMomentumZ(t)); Float_t rad_to_grad = ( 180 / TMath::Pi() ); Float_t angle_grad = angle_rad * rad_to_grad; -//cout << endl << "calc angle of " << angle_grad << " from rad angle " << angle_rad << endl; + //LOG(debug) << "calc angle of " << angle_grad << " from rad angle " << angle_rad; return angle_grad; } //----------------------------------------------------------------------------------------- diff --git a/core/detectors/mvd/CbmMvdPileupManager.cxx b/core/detectors/mvd/CbmMvdPileupManager.cxx index ec086d0924001623dbe8b350ca6dee40f01be4dd..a719f33ecfce72d9b5b03c2edf691112e11d690e 100644 --- a/core/detectors/mvd/CbmMvdPileupManager.cxx +++ b/core/detectors/mvd/CbmMvdPileupManager.cxx @@ -20,7 +20,6 @@ #include <iostream> // for operator<<, endl, basic_ostream, char_traits #include <memory> // for allocator -using std::cout; using std::endl; // ----- Default constructor ------------------------------------------- @@ -54,15 +53,15 @@ TClonesArray* CbmMvdPileupManager::GetEvent(Int_t iEvent) if (!fBuffer) Fatal("CbmMvdPileupManager::GetEvent", "No event buffer!"); if (iEvent > fBuffer->GetEntriesFast()) { - cout << "-W- CbmMvdPileupManager::GetEvent: Event " << iEvent << " not present in buffer! " << endl; - cout << " Returning nullptr pointer! " << endl; + LOG(warning) << "CbmMvdPileupManager::GetEvent: Event " << iEvent << " not present in buffer! "; + LOG(warning) << " Returning nullptr pointer! "; return nullptr; } TClonesArray* pArray = (TClonesArray*) fBuffer->At(iEvent); if (!pArray) { - cout << "-W CbmMvdPileupManager::GetEvent: Returning nullptr pointer!" << endl; + LOG(warning) << "CbmMvdPileupManager::GetEvent: Returning nullptr pointer!"; return nullptr; } @@ -91,8 +90,7 @@ Int_t CbmMvdPileupManager::FillBuffer(TString fileName, TString branchName, Int_ << endl; return 0; } - cout << "-I- CbmMvdPileupManager::FillBuffer: Opening file " << endl; - cout << fileName << endl; + LOG(info) << "CbmMvdPileupManager::FillBuffer: Opening file " << fileName; TTree* bgtree = bgfile->Get<TTree>("cbmsim"); if (!bgtree) { @@ -102,13 +100,13 @@ Int_t CbmMvdPileupManager::FillBuffer(TString fileName, TString branchName, Int_ } Int_t nEventsInFile = bgtree->GetEntries(); - cout << "-I- CbmMvdPileupManager::FillBuffer: " << nEventsInFile << " events in file" << endl; + LOG(info) << "CbmMvdPileupManager::FillBuffer: " << nEventsInFile << " events in file"; Int_t nBuffer = TMath::Min(nEvents, nEventsInFile); - cout << "-I- CbmMvdPileupManager::FillBuffer: Buffering " << nBuffer << " events" << endl; + LOG(info) << "CbmMvdPileupManager::FillBuffer: Buffering " << nBuffer << " events"; if (nBuffer < 100) - cout << "-W- CbmMvdPileupManager::FillBuffer: " - << "Number of events may not be sufficient for appropriate " - << "presentation of background pattern!" << endl; + LOG(warning) << "CbmMvdPileupManager::FillBuffer: " + << "Number of events may not be sufficient for appropriate " + << "presentation of background pattern!"; bgtree->SetBranchAddress(branchName, &pointArray); diff --git a/core/detectors/mvd/CbmMvdSensor.cxx b/core/detectors/mvd/CbmMvdSensor.cxx index f84b3271cc000749b8ee4677431d2569a85454d0..ca9c480304c3ecd80ed62f009746522bb430581a 100644 --- a/core/detectors/mvd/CbmMvdSensor.cxx +++ b/core/detectors/mvd/CbmMvdSensor.cxx @@ -27,10 +27,7 @@ /// includes from C -#include <iostream> - -using std::cout; -using std::endl; +#include <ostream> // for operator<<, stringstream, basic_ostream // ----- Default constructor ------------------------------------------- CbmMvdSensor::CbmMvdSensor() @@ -45,15 +42,6 @@ CbmMvdSensor::CbmMvdSensor() , fClusterPlugin(-1) , fVolName("") , fNodeName("") - /* - , foutputDigis(nullptr) - , foutputCluster(nullptr) - , //not needed khun - foutputDigiMatch(nullptr) - , foutputBuffer(nullptr) - - , fcurrentPoints(nullptr) - */ , fcurrentEventTime(0.) , epsilon() , fShape(nullptr) @@ -68,14 +56,11 @@ CbmMvdSensor::CbmMvdSensor() , fSensorStartTime(0.) , initialized(kFALSE) { - cout << "-W- " << GetName() << ": MVD-Sensor initialized without technical data."; - cout << " Assuming default sensor." << endl; + LOG(warning) << "MVD-Sensor initialized without technical data. Assuming default sensor."; - cout << "-W- " << GetName() << ": MVD-Sensor initialized without geometry data. "; - cout << " Must be added manually before using this class." << endl; + LOG(warning) << "MVD-Sensor initialized without geometry data. Must be added manually before using this class."; - cout << "-W- " << GetName() << ": MVD-Sensor initialized without valid start time. "; - cout << " Must be added manually before using this class." << endl; + LOG(warning) << "MVD-Sensor initialized without valid start time. Must be added manually before using this class."; } // ------------------------------------------------------------------------- @@ -94,15 +79,6 @@ CbmMvdSensor::CbmMvdSensor(const char* name, CbmMvdSensorDataSheet* dataSheet, T , fClusterPlugin(-1) , fVolName(volName) , fNodeName(nodeName) - /* - , foutputDigis(nullptr) - , foutputCluster(nullptr) - , //not needed khun - foutputDigiMatch(nullptr) - , foutputBuffer(nullptr) - - , fcurrentPoints(nullptr) - */ , fcurrentEventTime(0.) , epsilon() , fShape(nullptr) @@ -251,8 +227,7 @@ void CbmMvdSensor::ShowDebugHistos() { CbmMvdSensorPlugin* pluginLast; pluginLast = (CbmMvdSensorPlugin*) fPluginArray->At(fPluginArray->GetEntriesFast() - 1); - cout << endl - << "Set debug mode on Plugin " << fPluginArray->GetEntriesFast() - 1 << " at sensor " << GetName() << endl; + LOG(info) << "Set debug mode on Plugin " << fPluginArray->GetEntriesFast() - 1 << " at sensor " << GetName(); pluginLast->ShowDebugHistos(); } } @@ -334,7 +309,7 @@ void CbmMvdSensor::ExecTo(UInt_t nPlugin) } } else { - cout << endl << "nPlugin to large" << endl; + LOG(info) << "nPlugin to large"; } } @@ -354,18 +329,18 @@ void CbmMvdSensor::ExecFrom(UInt_t nPlugin) plugin = (CbmMvdSensorPlugin*) fPluginArray->At(nPlugin); if (nPlugin <= maxPlugin) { plugin->ExecChain(); - //cout << endl << "is plugin ready? "<< plugin->PluginReady() << " on sensor "<< this->GetName() << endl; + //LOG(info) << "is plugin ready? "<< plugin->PluginReady() << " on sensor "<< this->GetName(); if (plugin->PluginReady()) { - //cout << endl << "exec chain on sensor "<< this->GetName() << endl; + //LOG(info) << "exec chain on sensor "<< this->GetName(); for (UInt_t i = nPlugin + 1; i < maxPlugin; i++) { - //cout << endl << "exec plugin " << i << " on sensor "<< this->GetName() << endl; + //LOG(info) << "exec plugin " << i << " on sensor "<< this->GetName(); plugin = (CbmMvdSensorPlugin*) fPluginArray->At(i); plugin->ExecChain(); } } } else { - cout << endl << "nPlugin to large" << endl; + LOG(info) << "nPlugin to large"; } } @@ -405,7 +380,7 @@ TClonesArray* CbmMvdSensor::GetOutputBuffer() const CbmMvdSensorPlugin* plugin = (CbmMvdSensorPlugin*) fPluginArray->At(fPluginArray->GetLast()); - cout << "-W- CbmMvdSensor::GetOutputBuffer: Warning - Use of method depreciated." << endl; + LOG(warning) << "CbmMvdSensor::GetOutputBuffer: Warning - Use of method depreciated."; return (plugin->GetOutputArray()); } // ------------------------------------------------------------------------- @@ -421,8 +396,8 @@ void CbmMvdSensor::LocalToTop(Double_t* local, Double_t* lab) { fMCMatrix->Local void CbmMvdSensor::TopToLocal(Double_t* lab, Double_t* local) { fMCMatrix->MasterToLocal(lab, local); - //cout << endl << "local 0 nach TopToLocal " << local[0] << endl; - //cout << endl << "local 1 nach TopToLocal " << local[1] << endl; + //LOG(info) << "local 0 nach TopToLocal " << local[0]; + //LOG(info) << "local 1 nach TopToLocal " << local[1]; }; // ------------------------------------------------------------------------- @@ -434,15 +409,15 @@ void CbmMvdSensor::LocalToPixel(Double_t* local, Int_t& pixelNumberX, Int_t& pix //Compute position of the frame relativ to the border of the matrix //which contains the pixel (0/0) Double_t x = local[0] + (fSensorData->GetPixelSignX() * GetDX()); - //cout << "From " << local[0] << " to Double_t x " << x << endl; + //LOG(info) << "From " << local[0] << " to Double_t x " << x; Double_t y = local[1] + (fSensorData->GetPixelSignY() * GetDY()); - //cout << "From " << local[1] << " to Double_t y " << y << endl; + //LOG(info) << "From " << local[1] << " to Double_t y " << y; //Compute the number of the pixel hit. //Note: substract 0.5 to move from border to center of pixel pixelNumberX = Int_t(x / fSensorData->GetPixelPitchX() - 0.5); - //if (pixelNumberX < 0) cout << "pixelNumberX = " << pixelNumberX << " on Sensor " << this->GetName() << endl; + //if (pixelNumberX < 0) LOG(info)<< "pixelNumberX = " << pixelNumberX << " on Sensor " << this->GetName(); pixelNumberY = Int_t(y / fSensorData->GetPixelPitchY() - 0.5); - //if (pixelNumberY < 0) cout << "pixelNumberY = " << pixelNumberY << " on Sensor " << this->GetName() << endl; + //if (pixelNumberY < 0) LOG(info) << "pixelNumberY = " << pixelNumberY << " on Sensor " << this->GetName(); }; // ------------------------------------------------------------------------- @@ -526,19 +501,23 @@ Double_t CbmMvdSensor::GetReadoutTime(Double_t absoluteTime) const // ------------------------------------------------------------------------- +void CbmMvdSensor::Print(Option_t* /*opt*/) const { LOG(info) << ToString(); } + // ----- Public method Print ------------------------------------------- -void CbmMvdSensor::Print(Option_t* /*opt*/) const +std::string CbmMvdSensor::ToString() const { - cout << " --- " << GetName() << ", sensor name" << fVolName << endl; - cout << " MC - ID: " << fVolumeId << endl; - cout << "---------------------------------------------------------" << endl; - cout << " Position information: " << endl; + std::stringstream ss; + ss << " --- " << GetName() << ", sensor name" << fVolName << std::endl; + ss << " MC - ID: " << fVolumeId << std::endl; + ss << "---------------------------------------------------------" << std::endl; + ss << " Position information: " << std::endl; fRecoMatrix->Print(); - cout << " --------------------------------------------------------" << endl; - cout << " Technical information: " << endl; - fSensorData->Print(""); - cout << " , MC Id " << fVolumeId << endl; - cout << "---------------------------------------------------------" << endl; + ss << " --------------------------------------------------------" << std::endl; + ss << " Technical information: " << std::endl; + ss << fSensorData->ToString(); + ss << " , MC Id " << fVolumeId << std::endl; + ss << "---------------------------------------------------------" << std::endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/core/detectors/mvd/CbmMvdSensor.h b/core/detectors/mvd/CbmMvdSensor.h index 6e0e7d09e454b42471716a2ba295f3204a88ee18..62d0f38eacedc09b3688682ed26632dd2536843b 100644 --- a/core/detectors/mvd/CbmMvdSensor.h +++ b/core/detectors/mvd/CbmMvdSensor.h @@ -30,7 +30,8 @@ #include <TObjArray.h> // for TObjArray #include <TString.h> // for TString -#include <map> // for map +#include <map> // for map +#include <string> // for string class TBuffer; class TClass; @@ -121,7 +122,7 @@ public: /** Output to screen **/ virtual void Print(Option_t* opt = "") const; - + std::string ToString() const; /** Run control */ diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosa34.cxx b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosa34.cxx index 5b7fdb329c5db79007683d9108109f2a74a94e22..cee6ecd72405e91f9792c99e744de722a2277717 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosa34.cxx +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosa34.cxx @@ -13,8 +13,6 @@ #include <TMath.h> // for Power #include <TString.h> // for TString -#include <iostream> // for cout, endl - // ----- Default constructor ------------------------------------------- CbmMvdMimosa34::CbmMvdMimosa34() { diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx index 135afcdc3ce2dcf8760cd7290b56f8efeb385400..38e82e57cad328f4c37e176570a184431cbdba97 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.cxx @@ -9,12 +9,11 @@ #include "CbmMvdSensorDataSheet.h" -#include "TMath.h" - -#include <iostream> +#include <Logger.h> +#include "TMath.h" -using std::cout; +#include <ostream> // for operator<<, stringstream, basic_ostream using std::endl; @@ -64,37 +63,41 @@ CbmMvdSensorDataSheet::~CbmMvdSensorDataSheet() {} // ----- Public method Print ------------------------------------------- -void CbmMvdSensorDataSheet::Print(Option_t* /*opt*/) const +void CbmMvdSensorDataSheet::Print(Option_t* /*opt*/) const { LOG(info) << ToString(); } + +std::string CbmMvdSensorDataSheet::ToString() const { - cout << " --- " << GetName() << "--------------------------------" << endl; - cout << " Technical Data:" << endl; - cout << "--------------------------" << endl; - cout << "Name of the sensor: " << fMimosaName << endl; - cout << "Pixel pitch (x/y) [µm]: " << fPixelPitchY * 1e4 << "/" << fPixelPitchY * 1e-4 << endl; - cout << "N Pixels (rows/cols): " << fNPixelsX << "/" << fNPixelsY << endl; - cout << "Thickness of active volume[µm]: " << fEpiTh * 1e4 << endl; - cout << "Integration time [µs]: " << fIntegrationTime * 1e6 << endl; - cout << "ADC resolution: " << fAdcBits << "bit ADC (1 = discriminator)" << endl; - cout << "Default noise [e ENC]: " << fNoise << endl; - cout << "Matrix size (x/y) [cm]: " << fPixelPitchX * fNPixelsX << " / " << fPixelPitchY * fNPixelsY << endl; - cout << endl; - cout << "Readout system: " << endl; - cout << "----------------" << endl; - cout << "PixelNmb X from left to right?: " << fPixelSignX << endl; - cout << "PixelNmb Y from up to down?: " << fPixelSignY << endl; - cout << "Rolling shutter from up to down?: " << fShutterSign << endl; - cout << endl; - cout << "ADC / SUZE -Settings: " << endl; - cout << "----------------" << endl; - cout << "ADC Range [e]: " << fAdcDynamic << endl; - cout << "ADC offset [e]: " << fAdcOffset << endl; - cout << "ADC stepsize [e]: " << fAdcStepSize << endl; - cout << "SUZE states per banks: " << fStatesPerBank << endl; - cout << "SUZE states per line : " << fStatesPerLine << endl; - cout << "SUZE states per frame: " << fStatesPerFrame << endl; - cout << "SUZE pixels per bank: " << fPixelsPerBank << endl; - cout << endl; - cout << "Data card properly initialized: " << fValidData << endl; + std::stringstream ss; + ss << " --- " << GetName() << "--------------------------------" << endl; + ss << " Technical Data:" << endl; + ss << "--------------------------" << endl; + ss << "Name of the sensor: " << fMimosaName << endl; + ss << "Pixel pitch (x/y) [µm]: " << fPixelPitchY * 1e4 << "/" << fPixelPitchY * 1e-4 << endl; + ss << "N Pixels (rows/cols): " << fNPixelsX << "/" << fNPixelsY << endl; + ss << "Thickness of active volume[µm]: " << fEpiTh * 1e4 << endl; + ss << "Integration time [µs]: " << fIntegrationTime * 1e6 << endl; + ss << "ADC resolution: " << fAdcBits << "bit ADC (1 = discriminator)" << endl; + ss << "Default noise [e ENC]: " << fNoise << endl; + ss << "Matrix size (x/y) [cm]: " << fPixelPitchX * fNPixelsX << " / " << fPixelPitchY * fNPixelsY << endl; + ss << endl; + ss << "Readout system: " << endl; + ss << "----------------" << endl; + ss << "PixelNmb X from left to right?: " << fPixelSignX << endl; + ss << "PixelNmb Y from up to down?: " << fPixelSignY << endl; + ss << "Rolling shutter from up to down?: " << fShutterSign << endl; + ss << endl; + ss << "ADC / SUZE -Settings: " << endl; + ss << "----------------" << endl; + ss << "ADC Range [e]: " << fAdcDynamic << endl; + ss << "ADC offset [e]: " << fAdcOffset << endl; + ss << "ADC stepsize [e]: " << fAdcStepSize << endl; + ss << "SUZE states per banks: " << fStatesPerBank << endl; + ss << "SUZE states per line : " << fStatesPerLine << endl; + ss << "SUZE states per frame: " << fStatesPerFrame << endl; + ss << "SUZE pixels per bank: " << fPixelsPerBank << endl; + ss << endl; + ss << "Data card properly initialized: " << fValidData << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h index cd584c4c11c568cb38baadc32b267f7b6d5f4f86..66628adc0148be82d328941561285465752939d8 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdSensorDataSheet.h @@ -24,6 +24,7 @@ #include <TNamed.h> // for TNamed #include <TString.h> // for TString +#include <string> // for string class TBuffer; class TClass; class TMemberInspector; @@ -34,6 +35,7 @@ public: /** Default constructor **/ CbmMvdSensorDataSheet(); virtual void Print(Option_t* opt = "") const; + std::string ToString() const; /** Destructor **/ ~CbmMvdSensorDataSheet(); diff --git a/core/detectors/mvd/plugins/buffers/CbmMvdSensorFrameBuffer.cxx b/core/detectors/mvd/plugins/buffers/CbmMvdSensorFrameBuffer.cxx index 93395abab2e44fda8b0855949123271710b6f2b9..57ea91ebc852fd44d67737044b007c51e83461a9 100644 --- a/core/detectors/mvd/plugins/buffers/CbmMvdSensorFrameBuffer.cxx +++ b/core/detectors/mvd/plugins/buffers/CbmMvdSensorFrameBuffer.cxx @@ -166,10 +166,10 @@ void CbmMvdSensorFrameBuffer::BuildMimosaFrame(Int_t frameNumber) myEvent = (CbmMvdPoint*) fCurrentEvent->At(nPoints); myEvent->SetTime(((pixelY * (115e3 / 576)) + (115000 * (frameNumber)))); myEvent->SetFrameNr(frameNumber); - // cout << endl << "new Point in frame " << frameNumber << " in row " << pixelY << endl; - // cout << "at time " << point->GetAbsTime() << endl; - // cout << "readouttime is " << myEvent->GetTime() << " ns" << endl; - // cout << "at station " << point->GetStationNr() << endl << endl; + // LOG(info) << "new Point in frame " << frameNumber << " in row " << pixelY; + // LOG(info) << "at time " << point->GetAbsTime(); + // LOG(info) << "readouttime is " << myEvent->GetTime() << " ns"; + // LOG(info) << "at station " << point->GetStationNr(); } }; }; @@ -208,7 +208,7 @@ void CbmMvdSensorFrameBuffer::ClearFrame(Int_t frameNumber) if (pointFrameNumber == frameNumber) { fBuffer->RemoveAt(i); - //cout << endl << "new Point in frame " << frameNumber << " removed from Buffer" << endl; + //LOG(info) << "new Point in frame " << frameNumber << " removed from Buffer"; }; }; diff --git a/core/detectors/mvd/plugins/buffers/CbmMvdSensorTrackingBuffer.cxx b/core/detectors/mvd/plugins/buffers/CbmMvdSensorTrackingBuffer.cxx index 2ee48ecc7d2f5106283787404890cf97cf66305d..cfc7ed68279ace6b8f890f3c8777004bcac13604 100644 --- a/core/detectors/mvd/plugins/buffers/CbmMvdSensorTrackingBuffer.cxx +++ b/core/detectors/mvd/plugins/buffers/CbmMvdSensorTrackingBuffer.cxx @@ -8,6 +8,7 @@ // ------------------------------------------------------------------------- #include "CbmMvdSensorTrackingBuffer.h" +#include <Logger.h> // ----- Default constructor ------------------------------------------- CbmMvdSensorTrackingBuffer::CbmMvdSensorTrackingBuffer() @@ -50,7 +51,7 @@ void CbmMvdSensorTrackingBuffer::ExecChain() Int_t lastEntrie = fBuffer->GetLast(); CbmMvdHit* myHit; Int_t time; - // cout << endl << "exec output buffer" << endl; + // LOG(debug)<< "exec output buffer"; if (lastEntrie > -1) { myHit = (CbmMvdHit*) fBuffer->At(lastEntrie); time = myHit->GetTimeStamp(); @@ -64,7 +65,7 @@ void CbmMvdSensorTrackingBuffer::ExecChain() if (fCurrentEvent->GetEntriesFast() > 0) { SetPluginReady(true); - cout << endl << "OutputBuffer is ready for readout on sensor " << fSensor->GetName() << endl; + LOG(info) << "OutputBuffer is ready for readout on sensor " << fSensor->GetName(); //fCurrentEvent->Print(); } } @@ -87,7 +88,7 @@ void CbmMvdSensorTrackingBuffer::BuildTimeSlice(Double_t tStart, Double_t tStop) { nHits = fCurrentEvent->GetEntriesFast(); new ((*fCurrentEvent)[nHits]) CbmMvdHit(*myHit); - //cout << endl << "new Hits in Output" << endl; + //LOG(debug) << "new Hits in Output"; } } ClearTimeSlice(tStart, tStop); @@ -119,7 +120,7 @@ void CbmMvdSensorTrackingBuffer::SetInputArray(TClonesArray* inputStream) fBuffer->AbsorbObjects(inputStream); fBuffer->Compress(); - //cout << endl << "new Objects in Output buffer" << endl; + //LOG(debug) << "new Objects in Output buffer"; }; //-------------------------------------------------------------------------- diff --git a/core/detectors/mvd/tools/CbmMvdGeoHandler.cxx b/core/detectors/mvd/tools/CbmMvdGeoHandler.cxx index fbdb43b3a4b004ff56991b964e4253571003eb4b..db64de1ab0c9cc0067dd657049f2f961c81babfc 100644 --- a/core/detectors/mvd/tools/CbmMvdGeoHandler.cxx +++ b/core/detectors/mvd/tools/CbmMvdGeoHandler.cxx @@ -191,7 +191,7 @@ Int_t CbmMvdGeoHandler::GetStation(const TString& path) //-------------------------------------------------------------------------- void CbmMvdGeoHandler::NavigateTo(const TString& path) { - // cout << "path : " << path.Data() << endl; + // LOG(info) << "path : " << path.Data(); if (fIsSimulation) { LOG(fatal) << "This method is not supported in simulation mode"; } else { gGeoManager->cd(path.Data()); @@ -614,15 +614,15 @@ void CbmMvdGeoHandler::FillStationMap() fQuadrantName = Form("/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr); fSensorHolding = Form("/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr); fSensorName = Form("MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr); - //cout << endl << "try to find: " << fSensorName << endl; + //LOG(debug) << "try to find: " << fSensorName; fVolId = gGeoManager->GetUID(fSensorName); if (fVolId > -1) { fnodeName = fMother + fDetectorName + fStationName + fQuadrantName + fSensorHolding + "/" + fSensorName + "_1"; - //cout << endl << "sensorfound check for node " << fnodeName << endl; + //LOG(debug) << "sensorfound check for node " << fnodeName; Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data()); if (nodeFound) { - //cout << endl << "node found " << fnodeName << endl; + //LOG(debug) << "node found " << fnodeName; fStationMap[fVolId] = iStation; iStation++; } diff --git a/reco/detectors/mvd/CbmMvdClusterfinder.cxx b/reco/detectors/mvd/CbmMvdClusterfinder.cxx index 04aba54a4e01888c07908035a28a7e33b0f03a9d..70f62ab9d6af2b007f656c3f4bbf5aa40ba75033 100644 --- a/reco/detectors/mvd/CbmMvdClusterfinder.cxx +++ b/reco/detectors/mvd/CbmMvdClusterfinder.cxx @@ -26,7 +26,6 @@ #include <utility> // for pair -using std::cout; using std::endl; using std::fixed; using std::setprecision; @@ -78,18 +77,18 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/) { // --- Start timer fTimer.Start(); - if (gDebug > 0) { cout << "CbmMvdClusterfinder::Exec : Starting Exec " << endl; } + LOG(debug) << "CbmMvdClusterfinder::Exec : Starting Exec "; fCluster->Delete(); if (fDigiMan->GetNofDigis(ECbmModuleId::kMvd)) { - if (fVerbose) cout << "//----------------------------------------//"; - if (fVerbose) cout << endl << "Send Input" << endl; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; + if (fVerbose) LOG(debug) << "Send Input"; Int_t nTargetPlugin = fDetector->DetectPlugin(200); CbmMvdDigi* digi = 0; Int_t nDigis = fDigiMan->GetNofDigis(ECbmModuleId::kMvd); - if (gDebug > 0) { cout << "CbmMvdClusterfinder::Exec - nDigis= " << nDigis << endl; } + LOG(debug) << "CbmMvdClusterfinder::Exec - nDigis= " << nDigis; for (Int_t i = 0; i < nDigis; i++) { digi = new CbmMvdDigi(*(fDigiMan->Get<CbmMvdDigi>(i))); @@ -99,21 +98,21 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/) } - if (gDebug > 0) { cout << "CbmMvdClusterfinder::Exec : Communicating with Plugin: " << nTargetPlugin << endl; } + LOG(debug) << "CbmMvdClusterfinder::Exec : Communicating with Plugin: " << nTargetPlugin; //fDetector->SendInputDigis(fDigiMan); - if (fVerbose) cout << "Execute ClusterPlugin Nr. " << fClusterPluginNr << endl; + if (fVerbose) LOG(debug) << "Execute ClusterPlugin Nr. " << fClusterPluginNr; fDetector->Exec(nTargetPlugin); - if (fVerbose) cout << "End Chain" << endl; - if (fVerbose) cout << "Start writing Cluster" << endl; + if (fVerbose) LOG(debug) << "End Chain"; + if (fVerbose) LOG(debug) << "Start writing Cluster"; fDetector->GetOutputArray(nTargetPlugin, fCluster); //fDetector->GetMatchArray (nTargetPlugin, fTmpMatch); //fCluster->AbsorbObjects(fDetector->GetOutputCluster(), 0, fDetector->GetOutputCluster()->GetEntriesFast() - 1); - if (fVerbose) cout << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event" << endl; - if (fVerbose) cout << "//----------------------------------------//" << endl; + if (fVerbose) LOG(debug) << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event"; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " << fixed << setprecision(6) << fTimer.RealTime() << " s"; } @@ -125,15 +124,12 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdClusterfinder::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -153,7 +149,7 @@ InitStatus CbmMvdClusterfinder::Init() fDetector = CbmMvdDetector::Instance(); if (fDetector->GetSensorArraySize() > 1) { - if (fVerbose) cout << endl << "-I- succesfully loaded Geometry from file -I-" << endl; + if (fVerbose) LOG(info) << "succesfully loaded Geometry from file"; } else { LOG(fatal) << "Geometry couldn't be loaded from file. No MVD digitizer available."; @@ -178,9 +174,8 @@ InitStatus CbmMvdClusterfinder::Init() // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; return kSUCCESS; @@ -208,15 +203,18 @@ void CbmMvdClusterfinder::Reset() { fCluster->Delete(); } void CbmMvdClusterfinder::GetMvdGeometry() {} // ------------------------------------------------------------------------- - // ----- Private method PrintParameters -------------------------------- -void CbmMvdClusterfinder::PrintParameters() -{ +void CbmMvdClusterfinder::PrintParameters() const { LOG(info) << ParametersToString(); } - cout << "============================================================" << endl; - cout << "============== Parameters Clusterfinder ====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +// ----- Private method ParametersToString ----------------------------- +std::string CbmMvdClusterfinder::ParametersToString() const +{ + std::stringstream ss; + ss << "============================================================" << endl; + ss << "============== Parameters Clusterfinder ====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdClusterfinder.h b/reco/detectors/mvd/CbmMvdClusterfinder.h index c2299108d9d950503e084d1f6ff398502bbd8a15..1eb9793710c23828d9a28cae70c6cf47bc997b39 100644 --- a/reco/detectors/mvd/CbmMvdClusterfinder.h +++ b/reco/detectors/mvd/CbmMvdClusterfinder.h @@ -88,7 +88,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdClusterfinder(const CbmMvdClusterfinder&); diff --git a/reco/detectors/mvd/CbmMvdClusterfinderTB.cxx b/reco/detectors/mvd/CbmMvdClusterfinderTB.cxx index 1a6d1afcbae9adaec2286da5f8f81484bf0ff1ce..8e25d185817caf2c60a5f0a343f60f2010979ee6 100644 --- a/reco/detectors/mvd/CbmMvdClusterfinderTB.cxx +++ b/reco/detectors/mvd/CbmMvdClusterfinderTB.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt +@ /* Copyright (C) 2017-2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt SPDX-License-Identifier: GPL-3.0-only Authors: Philipp Sitzmann [committer] */ @@ -32,8 +32,7 @@ #include <iomanip> #include <iostream> -using std::cout; -using std::endl; + using std::endl; using std::fixed; using std::setprecision; using std::setw; @@ -109,15 +108,12 @@ void CbmMvdClusterfinderTB::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdClusterfinderTB::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -190,15 +186,18 @@ void CbmMvdClusterfinderTB::Reset() { fCluster->Delete(); } void CbmMvdClusterfinderTB::GetMvdGeometry() {} // ------------------------------------------------------------------------- - // ----- Private method PrintParameters -------------------------------- -void CbmMvdClusterfinderTB::PrintParameters() -{ +void CbmMvdClusterfinderTB::PrintParameters() const { LOG(info) << ParametersToString(); } - cout << "============================================================" << endl; - cout << "============== Parameters Clusterfinder ====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +// ----- Private method ParametersToString ----------------------------- +void CbmMvdClusterfinderTB::ParametersToString() const +{ + std::stringstream ss; + ss << "============================================================" << endl; + ss << "============== Parameters Clusterfinder ====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdClusterfinderTB.h b/reco/detectors/mvd/CbmMvdClusterfinderTB.h index 4ea522f54fd56c9bbccaeae5ca15459b47370ee1..cb9d293149c21639dd74f2422a2fa3e81584cde7 100644 --- a/reco/detectors/mvd/CbmMvdClusterfinderTB.h +++ b/reco/detectors/mvd/CbmMvdClusterfinderTB.h @@ -16,6 +16,8 @@ #include "TStopwatch.h" +#include <string>; + class CbmMvdDetector; class TClonesArray; class TString; @@ -87,7 +89,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdClusterfinderTB(const CbmMvdClusterfinderTB&); diff --git a/reco/detectors/mvd/CbmMvdDigiToHit.cxx b/reco/detectors/mvd/CbmMvdDigiToHit.cxx index 9a03f9db0532d1f52e005c48610367cefc3b3acb..b0a66b341fa7f8b86cc314e4ccb6cf7c53741d55 100644 --- a/reco/detectors/mvd/CbmMvdDigiToHit.cxx +++ b/reco/detectors/mvd/CbmMvdDigiToHit.cxx @@ -36,7 +36,6 @@ #include <iomanip> #include <iostream> -using std::cout; using std::endl; using std::fixed; using std::setprecision; @@ -93,16 +92,16 @@ void CbmMvdDigiToHit::Exec(Option_t* /*opt*/) fHit->Delete(); if (fInputDigis && fInputDigis->GetEntriesFast() > 0) { - if (fVerbose) cout << "//----------------------------------------//"; - if (fVerbose) cout << endl << "Send Input" << endl; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; + if (fVerbose) LOG(debug) << "Send Input"; fDetector->SendInputDigisToHits(fInputDigis); //Version for DigisToHits - if (fVerbose) cout << "Execute HitPlugin Nr. " << fHitPluginNr << endl; + if (fVerbose) LOG(debug) << "Execute HitPlugin Nr. " << fHitPluginNr; fDetector->Exec(fHitPluginNr); - if (fVerbose) cout << "End Chain" << endl; - if (fVerbose) cout << "Start writing Hit" << endl; + if (fVerbose) LOG(debug) << "End Chain"; + if (fVerbose) LOG(debug) << "Start writing Hit"; fHit->AbsorbObjects(fDetector->GetOutputHits(), 0, fDetector->GetOutputHits()->GetEntriesFast() - 1); - if (fVerbose) cout << "Total of " << fHit->GetEntriesFast() << " Hit in this Event" << endl; - if (fVerbose) cout << "//----------------------------------------//" << endl; + if (fVerbose) LOG(debug) << "Total of " << fHit->GetEntriesFast() << " Hit in this Event"; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fHit->GetEntriesFast() << " Hit in " << fixed << setprecision(6) << fTimer.RealTime() << " s"; } @@ -114,15 +113,12 @@ void CbmMvdDigiToHit::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdDigiToHit::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..." << endl; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -142,7 +138,7 @@ InitStatus CbmMvdDigiToHit::Init() fDetector = CbmMvdDetector::Instance(); if (fDetector->GetSensorArraySize() > 1) { - if (fVerbose) cout << endl << "-I- succesfully loaded Geometry from file -I-" << endl; + if (fVerbose) LOG(info) << "succesfully loaded Geometry from file"; } else { LOG(fatal) << "Geometry couldn't be loaded from file. No MVD digitizer available."; @@ -167,9 +163,8 @@ InitStatus CbmMvdDigiToHit::Init() // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; return kSUCCESS; @@ -197,15 +192,18 @@ void CbmMvdDigiToHit::Reset() { fHit->Delete(); } void CbmMvdDigiToHit::GetMvdGeometry() {} // ------------------------------------------------------------------------- - // ----- Private method PrintParameters -------------------------------- -void CbmMvdDigiToHit::PrintParameters() -{ +void CbmMvdDigiToHit::PrintParameters() const { LOG(info) << ParametersToString(); } - cout << "============================================================" << endl; - cout << "============== Parameters DigiToHit ====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +// ----- Private method ParametersToString ----------------------------- +void CbmMvdDigiToHit::ParametersToString() const +{ + std::stringstream ss; + ss << "============================================================" << endl; + ss << "============== Parameters DigiToHit ====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str() } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdDigiToHit.h b/reco/detectors/mvd/CbmMvdDigiToHit.h index 39726b1501968bcd0bf803e7e63916f03909c01f..69306dccac81ef90bbe2703c6ddf80f1ff9d7180 100644 --- a/reco/detectors/mvd/CbmMvdDigiToHit.h +++ b/reco/detectors/mvd/CbmMvdDigiToHit.h @@ -16,6 +16,8 @@ #include "TStopwatch.h" +#include <string> + class CbmMvdDetector; class TClonesArray; class TString; @@ -83,7 +85,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdDigiToHit(const CbmMvdDigiToHit&); diff --git a/reco/detectors/mvd/CbmMvdDigiToHitTB.cxx b/reco/detectors/mvd/CbmMvdDigiToHitTB.cxx index a98d082f1d7c5ac4815cee1b67ba6eac88b0144e..1f6ce3cf5a43076ba05c4801de7f34c53cc170ed 100644 --- a/reco/detectors/mvd/CbmMvdDigiToHitTB.cxx +++ b/reco/detectors/mvd/CbmMvdDigiToHitTB.cxx @@ -31,7 +31,6 @@ #include <iomanip> #include <iostream> -using std::cout; using std::endl; using std::fixed; using std::setprecision; @@ -107,15 +106,12 @@ void CbmMvdDigiToHitTB::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdDigiToHitTB::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -187,15 +183,18 @@ void CbmMvdDigiToHitTB::Reset() { fCluster->Delete(); } void CbmMvdDigiToHitTB::GetMvdGeometry() {} // ------------------------------------------------------------------------- - // ----- Private method PrintParameters -------------------------------- -void CbmMvdDigiToHitTB::PrintParameters() -{ +void CbmMvdDigiToHitTB::PrintParameters() const { LOG(info) << ParametersToString(); } - cout << "============================================================" << endl; - cout << "============== Parameters DigiToHit ====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +// ----- Private method ParametersTo String ----------------------------- +std::string CbmMvdDigiToHitTB::ParametersToString() const +{ + std::stringstream ss; + ss << "============================================================" << endl; + ss << "============== Parameters DigiToHit ====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdDigiToHitTB.h b/reco/detectors/mvd/CbmMvdDigiToHitTB.h index 628822b4e8ce42eabcd2a893581719cce99bde49..da4100c48dee95ee15ec2760f3e78be5c98f8c41 100644 --- a/reco/detectors/mvd/CbmMvdDigiToHitTB.h +++ b/reco/detectors/mvd/CbmMvdDigiToHitTB.h @@ -16,6 +16,8 @@ #include "TStopwatch.h" +#include <string> + class CbmMvdDetector; class TClonesArray; class TString; @@ -86,7 +88,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdDigiToHitTB(const CbmMvdDigiToHitTB&); diff --git a/reco/detectors/mvd/CbmMvdHitfinder.cxx b/reco/detectors/mvd/CbmMvdHitfinder.cxx index 3bc46033538fbfd94b17a1dc6c31ab59538d7098..9412709be6dae3006182deaa5796af7615f02692 100644 --- a/reco/detectors/mvd/CbmMvdHitfinder.cxx +++ b/reco/detectors/mvd/CbmMvdHitfinder.cxx @@ -28,7 +28,6 @@ #include <map> // for allocator, __map_i... #include <utility> // for pair -using std::cout; using std::endl; using std::fixed; using std::ios_base; @@ -109,7 +108,7 @@ void CbmMvdHitfinder::Exec(Option_t* /*opt*/) CbmMvdCluster* cluster = 0; if (fDigiMan->IsPresent(ECbmModuleId::kMvd) || fInputCluster) { //checks if data sources are available - if (fVerbose) cout << endl << "//----------------------------------------//" << endl; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; if (!fUseClusterfinder) { /* fDigiMan->GetNofDigis(ECbmModuleId::kMvd); @@ -144,20 +143,20 @@ void CbmMvdHitfinder::Exec(Option_t* /*opt*/) //fDetector->SendInputCluster(fInputCluster); - if (fVerbose) cout << "Execute HitfinderPlugin Nr. " << fHitfinderPluginNr << endl; + if (fVerbose) LOG(debug) << "Execute HitfinderPlugin Nr. " << fHitfinderPluginNr; fDetector->Exec(fHitfinderPluginNr); - if (fVerbose) cout << "End Chain" << endl; - if (fVerbose) cout << "Start writing Hits" << endl; + if (fVerbose) LOG(debug) << "End Chain"; + if (fVerbose) LOG(debug) << "Start writing Hits"; fDetector->GetOutputArray(nTargetPlugin, fHits); //fDetector->GetMatchArray (nTargetPlugin, fTmpMatch); //fHits->AbsorbObjects(fDetector->GetOutputHits(), 0, fDetector->GetOutputHits()->GetEntriesFast() - 1); - //cout << "Total of " << fHits->GetEntriesFast() << " hits found" << endl; - if (fVerbose) cout << "Finished writing Hits" << endl; - if (fVerbose) cout << "//----------------------------------------//" << endl << endl; + //LOG(debug) << "Total of " << fHits->GetEntriesFast() << " hits found"; + if (fVerbose) LOG(debug) << "Finished writing Hits"; + if (fVerbose) LOG(debug) << "//----------------------------------------//"; LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fHits->GetEntriesFast() << " hits in " << fixed << setprecision(6) << fTimer.RealTime() << " s"; } @@ -171,15 +170,12 @@ InitStatus CbmMvdHitfinder::Init() using namespace std; - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -247,10 +243,8 @@ InitStatus CbmMvdHitfinder::Init() // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; - return kSUCCESS; } @@ -273,18 +267,19 @@ void CbmMvdHitfinder::Reset() { fHits->Delete(); } void CbmMvdHitfinder::GetMvdGeometry() {} // ------------------------------------------------------------------------- - // ----- Private method PrintParameters -------------------------------- -void CbmMvdHitfinder::PrintParameters() -{ +void CbmMvdHitfinder::PrintParameters() const { LOG(info) << ParametersToString(); } - using namespace std; - - cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters MvdHitfinder =====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +// ----- Private method ParametersToString ----------------------------- +std::string CbmMvdHitfinder::ParametersToString() const +{ + std::stringstream ss; + ss.setf(std::ios_base::fixed, std::ios_base::floatfield); + ss << "============================================================" << endl; + ss << "============== Parameters MvdHitfinder =====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdHitfinder.h b/reco/detectors/mvd/CbmMvdHitfinder.h index d9f1fd820fdc3afe25c1017d1a595b9677fb7cfa..682d649739fe747026e270e463d71acf4b45c877 100644 --- a/reco/detectors/mvd/CbmMvdHitfinder.h +++ b/reco/detectors/mvd/CbmMvdHitfinder.h @@ -17,6 +17,8 @@ #include <RtypesCore.h> // for Int_t, Bool_t, Option_t, UInt_t, kTRUE #include <TStopwatch.h> // for TStopwatch +#include <string> + class CbmDigiManager; class CbmMvdDetector; class TBuffer; @@ -87,7 +89,8 @@ private: void GetMvdGeometry(); /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdHitfinder(const CbmMvdHitfinder&); diff --git a/reco/detectors/mvd/CbmMvdHitfinderTB.cxx b/reco/detectors/mvd/CbmMvdHitfinderTB.cxx index 830e0027303a5cb732ad9b1944dd3ff6d0b6ccf1..8c116d30252b5009fecaca9163ecf806edc3e39b 100644 --- a/reco/detectors/mvd/CbmMvdHitfinderTB.cxx +++ b/reco/detectors/mvd/CbmMvdHitfinderTB.cxx @@ -27,7 +27,6 @@ #include <iomanip> #include <iostream> -using std::cout; using std::endl; using std::fixed; using std::ios_base; @@ -125,15 +124,12 @@ InitStatus CbmMvdHitfinderTB::Init() using namespace std; - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; + LOG(error) << GetName() << "::Init: No FairRootManager!"; return kFATAL; } @@ -171,9 +167,8 @@ InitStatus CbmMvdHitfinderTB::Init() fDetector->Init(); // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; return kSUCCESS; @@ -197,18 +192,19 @@ void CbmMvdHitfinderTB::Reset() { fHits->Delete(); } void CbmMvdHitfinderTB::GetMvdGeometry() {} // ------------------------------------------------------------------------- +void CbmMvdHitfinderTB::PrintParameters() const { LOG(info) << ParametersToString(); } // ----- Private method PrintParameters -------------------------------- -void CbmMvdHitfinderTB::PrintParameters() +std::string CbmMvdHitfinderTB::ParametersToString() const { - using namespace std; - - cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters MvdHitfinder =====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; + std::stringstream ss; + ss.setf(std::ios_base::fixed, std::ios_base::floatfield); + ss << "============================================================" << endl; + ss << "============== Parameters MvdHitfinder =====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/detectors/mvd/CbmMvdHitfinderTB.h b/reco/detectors/mvd/CbmMvdHitfinderTB.h index 5d22d293ba599f5f16fefe3a398043a4189eeab0..38245565c3318b0ccc36360980343d11b27eaa0b 100644 --- a/reco/detectors/mvd/CbmMvdHitfinderTB.h +++ b/reco/detectors/mvd/CbmMvdHitfinderTB.h @@ -15,6 +15,8 @@ #include "TStopwatch.h" +#include <string> + class CbmMvdDetector; @@ -79,7 +81,8 @@ private: void GetMvdGeometry(); /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdHitfinderTB(const CbmMvdHitfinderTB&); diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx index 01f5386f08557b360aa1d6214011474e1ca20044..20b81813e9021c2dbb2056ada8b1310b2649f54b 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorClusterfinderTask.cxx @@ -14,7 +14,6 @@ #include "TClonesArray.h" #include "TObjArray.h" -using std::cout; using std::endl; using std::pair; using std::vector; @@ -94,9 +93,7 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) fSensor = mysensor; - if (gDebug > 0) { - cout << "-Start- CbmMvdSensorClusterfinderTask : Initialisation of sensor " << fSensor->GetName() << endl; - } + LOG(debug) << "CbmMvdSensorClusterfinderTask : Initialisation of sensor " << fSensor->GetName(); fInputBuffer = new TClonesArray("CbmMvdDigi", 100); fOutputBuffer = new TClonesArray("CbmMvdCluster", 100); @@ -170,15 +167,14 @@ void CbmMvdSensorClusterfinderTask::InitTask(CbmMvdSensor* mysensor) histo = new TH1F("ChargePixel49of49Sorted", "ChargePixel 49 Of 49 Sorted", 49, 0.5, 49.5); fPixelChargeHistos->AddLast(histo); } - //cout << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + //LOG(debug) << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName(); } // ------------------------------------------------------------------------- // ----- Virtual public method Reinit ---------------------------------- Bool_t CbmMvdSensorClusterfinderTask::ReInit() { - cout << "-I- " - << "CbmMvdSensorClusterfinderTask::ReInt---------------" << endl; + LOG(info) << "CbmMvdSensorClusterfinderTask::ReInt---------------"; return kTRUE; } // ------------------------------------------------------------------------- @@ -190,10 +186,9 @@ void CbmMvdSensorClusterfinderTask::ExecChain() { Exec(); } // ----- Public method Exec -------------- void CbmMvdSensorClusterfinderTask::Exec() { - if (gDebug > 0) { - cout << "CbmMvdSensorClusterfinderTask::Exec - Running Sensor " << fSensor->GetName() << endl; - cout << "CbmMvdSensorClusterfinderTask::Exec - InputBufferSize " << fInputBuffer->GetEntriesFast() << endl; - } + LOG(debug) << "CbmMvdSensorClusterfinderTask::Exec - Running Sensor " << fSensor->GetName(); + LOG(debug) << "CbmMvdSensorClusterfinderTask::Exec - InputBufferSize " << fInputBuffer->GetEntriesFast(); + if (fInputBuffer->GetEntriesFast() > 0) { fOutputBuffer->Delete(); inputSet = kFALSE; @@ -205,14 +200,10 @@ void CbmMvdSensorClusterfinderTask::Exec() digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); - if (!digi) { - cout << "-E- : CbmMvdSensorFindHitTask - Fatal: No Digits found in this " - "event." - << endl; - } + if (!digi) { LOG(error) << "CbmMvdSensorFindHitTask - Fatal: No Digits found in this event."; } Int_t nDigis = fInputBuffer->GetEntriesFast(); - //cout << " -I- CbmMvdClusterTrask::Exec(): Received following number of digis: " << nDigis << endl; + //LOG(debug) << "CbmMvdClusterTrask::Exec(): Received following number of digis: " << nDigis; TArrayS* pixelUsed = new TArrayS(nDigis); for (iDigi = 0; iDigi < nDigis; iDigi++) { @@ -231,21 +222,21 @@ void CbmMvdSensorClusterfinderTask::Exec() if (GetAdcCharge(digi->GetCharge()) < fNeighThreshold) continue; pair<Int_t, Int_t> a(digi->GetPixelX(), digi->GetPixelY()); - //cout << endl << "registerde pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY() << endl; + //LOG(debug) << "registerde pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY(); fDigiMap[a] = k; }; - if (gDebug > 0) { cout << "\n-I- " << GetName() << ": VolumeId " << fSensor->GetVolumeId() << endl; } + LOG(debug) << GetName() << ": VolumeId " << fSensor->GetVolumeId(); - //cout<<"CbmMvdSensorClusterfinderTask: Working with " << nDigis << " digis" << endl; + //LOG(debug) <<"CbmMvdSensorClusterfinderTask: Working with " << nDigis << " digis"; for (iDigi = 0; iDigi < nDigis; iDigi++) { - if (gDebug > 0 && iDigi % 10000 == 0) { cout << "-I- " << GetName() << " Digi:" << iDigi << endl; }; + LOG_IF(debug, iDigi % 10000 == 0) << GetName() << " Digi:" << iDigi; digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); - //cout << endl << "working with pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY() << endl; + //LOG(debug) << "working with pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY(); /* @@ -258,10 +249,7 @@ void CbmMvdSensorClusterfinderTask::Exec() --------------------------------------------------------- */ - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorClusterfinderTask: Checking for seed pixels..." << endl; - } + LOG(debug) << "CbmMvdSensorClusterfinderTask: Checking for seed pixels..."; if ((GetAdcCharge(digi->GetCharge()) >= fSeedThreshold) && (pixelUsed->At(iDigi) == kFALSE)) { clusterArray->clear(); @@ -275,15 +263,10 @@ void CbmMvdSensorClusterfinderTask::Exec() for (ULong64_t iCluster = 0; iCluster < clusterArray->size(); iCluster++) { - if (gDebug > 0) { - cout << "-I- " - << " CbmMvdSensorClusterfinderTask: Calling method " - "CheckForNeighbours()..." - << endl; - } + LOG(debug) << " CbmMvdSensorClusterfinderTask: Calling method CheckForNeighbours()..."; CheckForNeighbours(clusterArray, iCluster, pixelUsed); - //cout << endl << "checked for neighbours, create cluster" << endl; + //LOG(debug) << "checked for neighbours, create cluster"; } Int_t i = 0; @@ -293,7 +276,7 @@ void CbmMvdSensorClusterfinderTask::Exec() pair<Int_t, Int_t> pixelCoords; Int_t clusterSize = clusterArray->size(); Int_t nClusters = fOutputBuffer->GetEntriesFast(); - //cout << endl << "new cluster: " << nClusters << endl; + //LOG(debug) << "new cluster: " << nClusters; CbmMvdCluster* clusterNew = new ((*fOutputBuffer)[nClusters]) CbmMvdCluster(); clusterNew->SetAddress(fAddress); @@ -310,7 +293,7 @@ void CbmMvdSensorClusterfinderTask::Exec() if (fShowDebugHistos) UpdateDebugHistos(clusterNew); } // if AdcCharge>threshold - else { //cout << endl << "pixel is with " << digi->GetCharge() << " under Threshold or used" << endl; + else { //LOG(debug) << "pixel is with " << digi->GetCharge() << " under Threshold or used"; } } // loop on digis @@ -322,7 +305,7 @@ void CbmMvdSensorClusterfinderTask::Exec() fDigiMap.clear(); } - else { //cout << endl << "No input found." << endl; + else { //LOG(debug) << "No input found."; } fInputBuffer->Clear(); } @@ -333,7 +316,7 @@ void CbmMvdSensorClusterfinderTask::CheckForNeighbours(vector<Int_t>* clusterArr TArrayS* pixelUsed) { CbmMvdDigi* seed = (CbmMvdDigi*) fInputBuffer->At(clusterArray->at(clusterDigi)); - //cout << endl << "pixel nr. " << clusterDigi << " is seed" << endl ; + //LOG(debug) << "pixel nr. " << clusterDigi << " is seed"; // Remove Seed Pixel from list of non-used pixels @@ -348,7 +331,7 @@ void CbmMvdSensorClusterfinderTask::CheckForNeighbours(vector<Int_t>* clusterArr if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digis depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); @@ -361,7 +344,7 @@ void CbmMvdSensorClusterfinderTask::CheckForNeighbours(vector<Int_t>* clusterArr if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digits depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner @@ -373,7 +356,7 @@ void CbmMvdSensorClusterfinderTask::CheckForNeighbours(vector<Int_t>* clusterArr if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; // Only digits depassing fNeighThreshold are in the map, no cut required - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner fDigiMap.erase(fDigiMapIt); // block pixel for the neighbour pixel scanner @@ -384,7 +367,7 @@ void CbmMvdSensorClusterfinderTask::CheckForNeighbours(vector<Int_t>* clusterArr if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digis depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner @@ -434,13 +417,13 @@ void CbmMvdSensorClusterfinderTask::UpdateDebugHistos(CbmMvdCluster* cluster) seedIndexY = iter->first.second; } } - //cout << endl << "seed pixel with " << seedCharge << " charge" << endl; + //LOG(debug) << "seed pixel with " << seedCharge << " charge"; for (std::map<std::pair<Int_t, Int_t>, Int_t>::iterator iter = clusterMap.begin(); iter != clusterMap.end(); iter++) { Int_t relativeX = iter->first.first + seedPixelOffset - seedIndexX; Int_t relativeY = iter->first.second + seedPixelOffset - seedIndexY; - if (fVerbose > 1) cout << relativeX << " " << relativeY << " " << iter->first.first << " " << seedIndexX << endl; + if (fVerbose > 1) LOG(debug) << relativeX << " " << relativeY << " " << iter->first.first << " " << seedIndexX; if (relativeX >= 0 && relativeX < fChargeArraySize && relativeY >= 0 && relativeY < fChargeArraySize) { @@ -452,12 +435,14 @@ void CbmMvdSensorClusterfinderTask::UpdateDebugHistos(CbmMvdCluster* cluster) } if (fVerbose > 1) { + std::stringstream ss; for (Int_t i = 0; i < fChargeArraySize; i++) { for (Int_t j = 0; j < fChargeArraySize; j++) { - cout << chargeArray3D[i][j] << " "; + ss << chargeArray3D[i][j] << " "; } - cout << endl; + ss << endl; } + LOG(info) << ss.str(); } fFullClusterHisto->Fill(clusterCharge); @@ -480,11 +465,11 @@ void CbmMvdSensorClusterfinderTask::UpdateDebugHistos(CbmMvdCluster* cluster) if (fChargeArraySize <= 7) { for (Int_t i = 0; i < (fChargeArraySize * fChargeArraySize); i++) { ((TH1F*) fPixelChargeHistos->At(i))->Fill(chargeArray[i]); - //cout << counter++<<" Charge: " << chargeArray[i]<< endl; + //LOG(debug) << counter++<<" Charge: " << chargeArray[i]; }; }; - //cout << "End of Cluster: "<<fChargeArraySize*fChargeArraySize << endl; + //LOG(debug) << "End of Cluster: "<<fChargeArraySize*fChargeArraySize; Int_t q25 = 0; Int_t q49 = 0; @@ -543,18 +528,18 @@ void CbmMvdSensorClusterfinderTask::Finish() { if (fShowDebugHistos) { - cout << "\n============================================================" << endl; - cout << "-I- " << GetName() << "::Finish: Total events skipped: " << fCounter << endl; - cout << "============================================================" << endl; - cout << "-I- Parameters used" << endl; - cout << "Gaussian noise [electrons] : " << fSigmaNoise << endl; - cout << "Noise simulated [Bool] : " << fAddNoise << endl; - cout << "Threshold seed [ADC] : " << fSeedThreshold << endl; - cout << "Threshold neighbours [ADC] : " << fNeighThreshold << endl; - cout << "ADC - Bits : " << fAdcBits << endl; - cout << "ADC - Dynamic [electrons] : " << fAdcDynamic << endl; - cout << "ADC - Offset [electrons] : " << fAdcOffset << endl; - cout << "============================================================" << endl; + LOG(info) << "============================================================"; + LOG(info) << GetName() << "::Finish: Total events skipped: " << fCounter; + LOG(info) << "============================================================"; + LOG(info) << "Parameters used"; + LOG(info) << "Gaussian noise [electrons] : " << fSigmaNoise; + LOG(info) << "Noise simulated [Bool] : " << fAddNoise; + LOG(info) << "Threshold seed [ADC] : " << fSeedThreshold; + LOG(info) << "Threshold neighbours [ADC] : " << fNeighThreshold; + LOG(info) << "ADC - Bits : " << fAdcBits; + LOG(info) << "ADC - Dynamic [electrons] : " << fAdcDynamic; + LOG(info) << "ADC - Offset [electrons] : " << fAdcOffset; + LOG(info) << "============================================================"; TH1F* histo; @@ -568,7 +553,7 @@ void CbmMvdSensorClusterfinderTask::Finish() for (Int_t i = 0; i < fChargeArraySize * fChargeArraySize; i++) { histo = (TH1F*) fPixelChargeHistos->At(i); Float_t charge = histo->GetMean(); - //cout <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize << endl; + //LOG(debug) <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize; //histo->Fit("landau"); //TF1* fitFunction= histo->GetFunction("landau"); //Double_t MPV=fitFunction->GetParameter(1); diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorDigiToHitTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorDigiToHitTask.cxx index 8b98b55cd2259ffdcb9afdbfd7728e76fab41611..ea8db785d99a183698b33bf6365a31e3226e1619 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorDigiToHitTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorDigiToHitTask.cxx @@ -16,9 +16,6 @@ #include <cstring> - -using std::cout; -using std::endl; using std::map; using std::pair; using std::vector; @@ -132,8 +129,7 @@ void CbmMvdSensorDigiToHitTask::InitTask(CbmMvdSensor* mysensor) // ----- Virtual public method Reinit ---------------------------------- Bool_t CbmMvdSensorDigiToHitTask::ReInit() { - cout << "-I- " - << "CbmMvdSensorDigiToHitTask::ReInt---------------" << endl; + LOG(info) << "CbmMvdSensorDigiToHitTask::ReInt---------------"; return kTRUE; } // ------------------------------------------------------------------------- @@ -154,11 +150,7 @@ void CbmMvdSensorDigiToHitTask::Exec() CbmMvdDigi* digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); - if (!digi) { - cout << "-E- : CbmMvdSensorFindHitTask - Fatal: No Digits found in this " - "event." - << endl; - } + if (!digi) { LOG(error) << "CbmMvdSensorFindHitTask - Fatal: No Digits found in this event."; } dth_clusterArray.reserve(nDigis); @@ -406,7 +398,7 @@ void CbmMvdSensorDigiToHitTask::Exec() fHitPosY += shiftOut[1]; fHitPosZ += shiftOut[2]; - // pos = center of gravity (labframe), dpos uncertaintycout<<setw(10)<<setprecision(2)<< VolumeShape->GetDX(); + // pos = center of gravity (labframe), dpos uncertainty LOG(info)<<setw(10)<<setprecision(2)<< VolumeShape->GetDX(); pos.SetXYZ(fHitPosX, fHitPosY, fHitPosZ); dpos.SetXYZ(TMath::Abs(sigmaOut[0]), TMath::Abs(sigmaOut[1]), TMath::Abs(sigmaOut[2])); @@ -463,18 +455,18 @@ float CbmMvdSensorDigiToHitTask::GetAdcCharge(Float_t curr_charge) void CbmMvdSensorDigiToHitTask::Finish() { if (fShowDebugHistos) { - cout << "\n============================================================" << endl; - cout << "-I- " << GetName() << "::Finish: Total events skipped: " << fCounter << endl; - cout << "============================================================" << endl; - cout << "-I- Parameters used" << endl; - cout << "Gaussian noise [electrons] : " << fSigmaNoise << endl; - cout << "Noise simulated [Bool] : " << fAddNoise << endl; - cout << "Threshold seed [ADC] : " << dth_fSeedThreshold << endl; - cout << "Threshold neighbours [ADC] : " << dth_fNeighThreshold << endl; - cout << "ADC - Bits : " << fAdcBits << endl; - cout << "ADC - Dynamic [electrons] : " << fAdcDynamic << endl; - cout << "ADC - Offset [electrons] : " << fAdcOffset << endl; - cout << "============================================================" << endl; + LOG(info) << "============================================================"; + LOG(info) << GetName() << "::Finish: Total events skipped: " << fCounter; + LOG(info) << "============================================================"; + LOG(info) << "Parameters used"; + LOG(info) << "Gaussian noise [electrons] : " << fSigmaNoise; + LOG(info) << "Noise simulated [Bool] : " << fAddNoise; + LOG(info) << "Threshold seed [ADC] : " << dth_fSeedThreshold; + LOG(info) << "Threshold neighbours [ADC] : " << dth_fNeighThreshold; + LOG(info) << "ADC - Bits : " << fAdcBits; + LOG(info) << "ADC - Dynamic [electrons] : " << fAdcDynamic; + LOG(info) << "ADC - Offset [electrons] : " << fAdcOffset; + LOG(info) << "============================================================"; TH1F* histo; @@ -488,7 +480,7 @@ void CbmMvdSensorDigiToHitTask::Finish() for (Int_t i = 0; i < fChargeArraySize * fChargeArraySize; i++) { histo = dth_fPixelChargeHistos[i]; Float_t curr_charge = histo->GetMean(); - //cout <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize << endl; + //LOG(debug) <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize; //histo->Fit("landau"); //TF1* fitFunction= histo->GetFunction("landau"); //Double_t MPV=fitFunction->GetParameter(1); diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx index 34f274d7800d71150ee4589c1dda0f4a802f7430..8399577312d67ab6ac9bdf2bed41187744d8aefe 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorFindHitTask.cxx @@ -46,8 +46,6 @@ #include <map> #include <vector> -using std::cout; -using std::endl; using std::fixed; using std::ios_base; using std::left; @@ -203,7 +201,7 @@ void CbmMvdSensorFindHitTask::InitTask(CbmMvdSensor* mysensor) fSensor = mysensor; - //cout << "-Start- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + //LOG(debug) << GetName() << ": Initialisation of sensor " << fSensor->GetName(); fInputBuffer = new TClonesArray("CbmMvdDigi", 100); fOutputBuffer = new TClonesArray("CbmMvdHit", 100); fHits = new TClonesArray("CbmMvdHit", 100); @@ -226,15 +224,14 @@ void CbmMvdSensorFindHitTask::InitTask(CbmMvdSensor* mysensor) initialized = kTRUE; - //cout << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + //LOG(debug) << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName(); } // ------------------------------------------------------------------------- // ----- Virtual public method Reinit ---------------------------------- InitStatus CbmMvdSensorFindHitTask::ReInit() { - cout << "-I- " - << "CbmMvdSensorFindHitTask::ReInt---------------" << endl; + LOG(info) << "CbmMvdSensorFindHitTask::ReInt---------------"; return kSUCCESS; } // ------------------------------------------------------------------------- @@ -246,13 +243,11 @@ void CbmMvdSensorFindHitTask::ExecChain() { Exec(); } // ----- Virtual public method Exec -------------- void CbmMvdSensorFindHitTask::Exec() { - cout << "Ich lebe auch" << endl; - // if(!inputSet) // { // fInputBuffer->Clear(); // fInputBuffer->AbsorbObjects(fPreviousPlugin->GetOutputArray()); - // cout << endl << "absorbt object from previous plugin at " << fSensor->GetName() << " got " << fInputBuffer->GetEntriesFast() << " entrys" << endl; + // LOG(debug) << "absorbt object from previous plugin at " << fSensor->GetName() << " got " << fInputBuffer->GetEntriesFast() << " entrys"; // } if (fInputBuffer->GetEntriesFast() > 0) { fHits->Clear("C"); @@ -267,26 +262,21 @@ void CbmMvdSensorFindHitTask::Exec() digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); - if (!digi) { - cout << "-E- : CbmMvdSensorFindHitTask - Fatal: No Digits found in this " - "event." - << endl; - } + if (!digi) { LOG(error) << "CbmMvdSensorFindHitTask - Fatal: No Digits found in this event."; } Int_t nDigis = fInputBuffer->GetEntriesFast(); - //cout << endl << "working with " << nDigis << " entries" << endl; + //LOG(debug) << "working with " << nDigis << " entries"; if (fAddNoise == kTRUE) { // Generate random number and call it noise // add the noise to the charge of the digis - cout << "-I- " - << "CbmMvdSensorFindHitTask: Calling method AddNoiseToDigis()...\n" - << endl; + LOG(info) << "CbmMvdSensorFindHitTask: Calling method AddNoiseToDigis()..." - for (iDigi = 0; iDigi < nDigis; iDigi++) { + for (iDigi = 0; iDigi < nDigis; iDigi++) + { digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); AddNoiseToDigis(digi); @@ -295,7 +285,7 @@ void CbmMvdSensorFindHitTask::Exec() if (fMode == 1) { // GenerateFakeDigis(pixelSizeX, pixelSizeY); // -------- Create Fake Digis - - cout << endl << "generate fake digis" << endl; + //LOG(debug) << "generate fake digis"; } @@ -318,19 +308,19 @@ void CbmMvdSensorFindHitTask::Exec() if (GetAdcCharge(digi->GetCharge()) < fNeighThreshold) continue; pair<Int_t, Int_t> a(digi->GetPixelX(), digi->GetPixelY()); - // cout << endl << "registerde pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY() << endl; + // LOG(debug) << "registerde pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY(); fDigiMap[a] = k; }; - if (gDebug > 0) { cout << "\n-I- " << GetName() << ": VolumeId " << fSensor->GetVolumeId() << endl; } + LOG(debug) << GetName() << ": VolumeId " << fSensor->GetVolumeId(); for (iDigi = 0; iDigi < nDigis; iDigi++) { - if (gDebug > 0 && iDigi % 10000 == 0) { cout << "-I- " << GetName() << " Digi:" << iDigi << endl; }; + LOG_If(debug, iDigi % 10000 == 0) << GetName() << " Digi:" << iDigi; digi = (CbmMvdDigi*) fInputBuffer->At(iDigi); - //cout << endl << "working with pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY() << endl; + //LOG(debug) << "working with pixel x:" << digi->GetPixelX() << " y:" << digi->GetPixelY(); /* @@ -343,10 +333,7 @@ void CbmMvdSensorFindHitTask::Exec() --------------------------------------------------------- */ - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorFindHitTask: Checking for seed pixels..." << endl; - } + LOG(debug) << "CbmMvdSensorFindHitTask: Checking for seed pixels..."; if ((GetAdcCharge(digi->GetCharge()) >= fSeedThreshold) && (pixelUsed->At(iDigi) == kFALSE)) { clusterArray->clear(); @@ -361,12 +348,7 @@ void CbmMvdSensorFindHitTask::Exec() for (ULong64_t iCluster = 0; iCluster < clusterArray->size(); iCluster++) { - if (gDebug > 0) { - cout << "-I- " - << " CbmMvdSensorFindHitTask: Calling method " - "CheckForNeighbours()..." - << endl; - } + LOG(debug) << " CbmMvdSensorFindHitTask: Calling method CheckForNeighbours()..."; CheckForNeighbours(clusterArray, iCluster, pixelUsed); } @@ -375,16 +357,13 @@ void CbmMvdSensorFindHitTask::Exec() TVector3 pos(0, 0, 0); TVector3 dpos(0, 0, 0); - if (gDebug > 0) { - cout << "-I- " - << " CbmMvdSensorFindHitTask: Calling method CreateHit()..." << endl; - } + LOG(debug) << " CbmMvdSensorFindHitTask: Calling method CreateHit()..."; CreateHit(clusterArray, pos, dpos); } // if AdcCharge>threshold - else { //cout << endl << "pixel is with " << digi->GetCharge() << " under Threshold or used" << endl; + else { //LOG(debug) << "pixel is with " << digi->GetCharge() << " under Threshold or used"; } } // loop on digis @@ -393,13 +372,13 @@ void CbmMvdSensorFindHitTask::Exec() //------------- End of Detector Loops ---------------------------------------------- //---------------------------------------------------------------------------------- - // cout << endl << "-I- End of task " << GetName() << ": Event Nr: " << fNEvent << ", nDIGIS: "<<nDigis << ", nHits:"<<fHits->GetEntriesFast()<<endl; + // LOG(debug) << "End of task " << GetName() << ": Event Nr: " << fNEvent << ", nDIGIS: "<<nDigis << ", nHits:"<<fHits->GetEntriesFast(); - /*cout << "registered " << fHits->GetEntriesFast() - << " new hits out of " << fInputBuffer->GetEntriesFast() - << " Digis on sensor " - << fSensor->GetName() << endl; */ + /*LOG(debug) << "registered " << fHits->GetEntriesFast() + << " new hits out of " << fInputBuffer->GetEntriesFast() + << " Digis on sensor " + << fSensor->GetName(); */ delete pixelUsed; clusterArray->clear(); @@ -408,7 +387,7 @@ void CbmMvdSensorFindHitTask::Exec() fDigiMap.clear(); } - else { //cout << endl << "No input found." << endl; + else { //LOG(debug) << "No input found."; } } //-------------------------------------------------------------------------- @@ -487,7 +466,7 @@ void CbmMvdSensorFindHitTask::AddNoiseToDigis(CbmMvdDigi* digi) void CbmMvdSensorFindHitTask::CheckForNeighbours(vector<Int_t>* clusterArray, Int_t clusterDigi, TArrayS* pixelUsed) { CbmMvdDigi* seed = (CbmMvdDigi*) fInputBuffer->At(clusterArray->at(clusterDigi)); - //cout << endl << "pixel nr. " << clusterDigi << " is seed" << endl ; + //LOG(debug) << "pixel nr. " << clusterDigi << " is seed"; // Remove Seed Pixel from list of non-used pixels Int_t channelX = seed->GetPixelX(); Int_t channelY = seed->GetPixelY(); @@ -500,7 +479,7 @@ void CbmMvdSensorFindHitTask::CheckForNeighbours(vector<Int_t>* clusterArray, In if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digis depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); @@ -513,7 +492,7 @@ void CbmMvdSensorFindHitTask::CheckForNeighbours(vector<Int_t>* clusterArray, In if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digits depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner @@ -525,7 +504,7 @@ void CbmMvdSensorFindHitTask::CheckForNeighbours(vector<Int_t>* clusterArray, In if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; // Only digits depassing fNeighThreshold are in the map, no cut required - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner fDigiMap.erase(fDigiMapIt); // block pixel for the neighbour pixel scanner @@ -536,7 +515,7 @@ void CbmMvdSensorFindHitTask::CheckForNeighbours(vector<Int_t>* clusterArray, In if (!(fDigiMapIt == fDigiMap.end())) { Int_t i = fDigiMap[a]; - //cout << endl << "pixel nr. " << i << " is used" << endl ; + //LOG(debug) << "pixel nr. " << i << " is used"; // Only digis depassing fNeighThreshold are in the map, no cut required clusterArray->push_back(i); pixelUsed->AddAt(1, i); // block pixel for the seed pixel scanner @@ -554,7 +533,7 @@ void CbmMvdSensorFindHitTask::CreateHit(vector<Int_t>* clusterArray, TVector3& p Int_t clusterSize = clusterArray->size(); Int_t digiIndex = 0; - //cout << endl << "try to create hit from " << clusterSize << " pixels" << endl; + //LOG(debug) << "try to create hit from " << clusterSize << " pixels"; CbmMvdDigi* pixelInCluster = (CbmMvdDigi*) fInputBuffer->At(clusterArray->at(digiIndex)); Int_t thisRefID = pixelInCluster->GetRefId(); while (thisRefID < 0 && digiIndex < clusterSize) { @@ -575,11 +554,11 @@ void CbmMvdSensorFindHitTask::CreateHit(vector<Int_t>* clusterArray, TVector3& p Double_t local[2]; local[0] = pos.X(); local[1] = pos.Y(); - //cout << endl << "found center of gravity at: " << local[0] << " , " << local[1] << endl; + //LOG(debug) << "found center of gravity at: " << local[0] << " , " << local[1]; fSensor->TopToPixel(local, indexX, indexY); - //cout << endl << "Center is on pixel: " << indexX << " , " << indexY << endl; + //LOG(debug) << "Center is on pixel: " << indexX << " , " << indexY; //Fill HitClusters Int_t i = 0; @@ -623,7 +602,7 @@ void CbmMvdSensorFindHitTask::CreateHit(vector<Int_t>* clusterArray, TVector3& p // Save hit into array Int_t nHits = fHits->GetEntriesFast(); - //cout << endl << "adding new hit to fHits at X: " << pos.X() << " , Y: "<< pos.Y() << " , Z: " << pos.Z() << " , " ; + //LOG(debug) << "adding new hit to fHits at X: " << pos.X() << " , Y: "<< pos.Y() << " , Z: " << pos.Z() << " , "; new ((*fHits)[nHits]) CbmMvdHit(fSensor->GetStationNr(), pos, dpos, indexX, indexY, nClusters, 0); CbmMvdHit* currentHit = new CbmMvdHit; currentHit = (CbmMvdHit*) fHits->At(nHits); @@ -631,7 +610,7 @@ void CbmMvdSensorFindHitTask::CreateHit(vector<Int_t>* clusterArray, TVector3& p currentHit->SetTimeError(fSensor->GetIntegrationtime() / 2); currentHit->SetRefId(thisRefID); if (pixelInCluster->GetRefId() < 0) - cout << endl << "new hit with refID " << pixelInCluster->GetRefId() << " to hit " << nHits << endl; + LOG(info) << "new hit with refID " << pixelInCluster->GetRefId() << " to hit " << nHits; nHits = fOutputBuffer->GetEntriesFast(); new ((*fOutputBuffer)[nHits]) CbmMvdHit(fSensor->GetStationNr(), pos, dpos, indexX, indexY, nClusters, 0); @@ -677,7 +656,7 @@ void CbmMvdSensorFindHitTask::UpdateDebugHistos(vector<Int_t>* clusterArray, Int Int_t relativeY = digi->GetPixelY() + seedPixelOffset - seedIndexY; //for debugging - //cout << relativeX << " " << relativeY << " " <<digi->GetPixelX()<< " " << seedIndexX << endl; + //LOG(debug) << relativeX << " " << relativeY << " " <<digi->GetPixelX()<< " " << seedIndexX; if (relativeX >= 0 && relativeX < fChargeArraySize && relativeY >= 0 && relativeY < fChargeArraySize) { @@ -690,13 +669,9 @@ void CbmMvdSensorFindHitTask::UpdateDebugHistos(vector<Int_t>* clusterArray, Int //for debugging //for(Int_t i=0;i<fChargeArraySize;i++) - //{for (Int_t j=0;j<fChargeArraySize;j++) {cout << chargeArray3D[i][j] << " " ;} - // cout << endl; + //{for (Int_t j=0;j<fChargeArraySize;j++) {LOG(debug) << chargeArray3D[i][j] << " " ;} //} - //cout << endl; - //Fatal("Break","Break"); - fFullClusterHisto->Fill(clusterCharge); for (Int_t k = 0; k < fChargeArraySize; k++) { @@ -717,11 +692,11 @@ void CbmMvdSensorFindHitTask::UpdateDebugHistos(vector<Int_t>* clusterArray, Int if (fChargeArraySize <= 7) { for (Int_t i = 0; i < (fChargeArraySize * fChargeArraySize); i++) { ((TH1F*) fPixelChargeHistos->At(i))->Fill(chargeArray[i]); - //cout << counter++<<" Charge: " << chargeArray[i]<< endl; + //LOG(debug) << counter++<<" Charge: " << chargeArray[i]; }; }; - //cout << "End of Cluster: "<<fChargeArraySize*fChargeArraySize << endl; + //LOG(debug) << "End of Cluster: "<<fChargeArraySize*fChargeArraySize; Int_t q25 = 0; Int_t q49 = 0; @@ -811,66 +786,52 @@ void CbmMvdSensorFindHitTask::ComputeCenterOfGravity(vector<Int_t>* clusterArray pixelSizeX = pixelInCluster->GetPixelSizeX(); pixelSizeY = pixelInCluster->GetPixelSizeY(); - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorFindHitTask:: iCluster= " << iCluster << " , clusterSize= " << clusterSize << endl; - cout << "-I- " - << "CbmMvdSensorFindHitTask::xIndex " << xIndex << " , yIndex " << yIndex - << " , charge = " << pixelInCluster->GetAdcCharge(fAdcDynamic, fAdcOffset, fAdcBits) << endl; - } + LOG(debug) << "CbmMvdSensorFindHitTask:: iCluster= " << iCluster << " , clusterSize= " << clusterSize; + LOG(debug) << "CbmMvdSensorFindHitTask::xIndex " << xIndex << " , yIndex " << yIndex + << " , charge = " << pixelInCluster->GetAdcCharge(fAdcDynamic, fAdcOffset, fAdcBits); + } - fSensor->PixelToTop(xIndex, yIndex, lab); + fSensor->PixelToTop(xIndex, yIndex, lab); - x = lab[0]; - y = lab[1]; + x = lab[0]; + y = lab[1]; - //cout << endl << "x = " << x << " y = " << y << endl; - //Calculate x,y coordinates of the pixel in the detector ref frame - //Double_t x = ( 0.5+double(xIndex) )*pixelSizeX; - //Double_t y = ( 0.5+double(yIndex) )*pixelSizeY; + //LOG(debug) << "x = " << x << " y = " << y; + //Calculate x,y coordinates of the pixel in the detector ref frame + //Double_t x = ( 0.5+double(xIndex) )*pixelSizeX; + //Double_t y = ( 0.5+double(yIndex) )*pixelSizeY; - Double_t xc = x * charge; - Double_t yc = y * charge; + Double_t xc = x * charge; + Double_t yc = y * charge; - numeratorX += xc; - numeratorY += yc; - denominator += charge; - } + numeratorX += xc; + numeratorY += yc; + denominator += charge; +} - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorFindHitTask::=========================\n " << endl; - cout << "-I- " - << "CbmMvdSensorFindHitTask::numeratorX: " << numeratorX << " , numeratorY: " << numeratorY - << ", denominator: " << denominator << endl; - } +LOG(debug) << "CbmMvdSensorFindHitTask::========================="; +LOG(debug) << "CbmMvdSensorFindHitTask::numeratorX: " << numeratorX << " , numeratorY: " << numeratorY + << ", denominator: " << denominator; - //Calculate x,y coordinates of the pixel in the laboratory ref frame - if (denominator != 0) { - fHitPosX = (numeratorX / denominator); - fHitPosY = (numeratorY / denominator); - fHitPosZ = layerPosZ; - } - else { - fHitPosX = 0; - fHitPosY = 0; - fHitPosZ = 0; - } - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorFindHitTask::-----------------------------------" << endl; - cout << "-I- " - << "CbmMvdSensorFindHitTask::X hit= " << fHitPosX << " Y hit= " << fHitPosY << " Z hit= " << fHitPosZ << endl; - - cout << "-I- " - << "CbmMvdSensorFindHitTask::-----------------------------------\n" - << endl; - } +//Calculate x,y coordinates of the pixel in the laboratory ref frame +if (denominator != 0) { + fHitPosX = (numeratorX / denominator); + fHitPosY = (numeratorY / denominator); + fHitPosZ = layerPosZ; +} +else { + fHitPosX = 0; + fHitPosY = 0; + fHitPosZ = 0; +} +LOG(debug) << "CbmMvdSensorFindHitTask::-----------------------------------"; +LOG(debug) << "CbmMvdSensorFindHitTask::X hit= " << fHitPosX << " Y hit= " << fHitPosY << " Z hit= " << fHitPosZ; +LOG(debug) << "CbmMvdSensorFindHitTask::-----------------------------------"; - // pos = center of gravity (labframe), dpos uncertainty - pos.SetXYZ(fHitPosX, fHitPosY, fHitPosZ); - dpos.SetXYZ(fHitPosErrX, fHitPosErrY, fHitPosErrZ); +// pos = center of gravity (labframe), dpos uncertainty +pos.SetXYZ(fHitPosX, fHitPosY, fHitPosZ); +dpos.SetXYZ(fHitPosErrX, fHitPosErrY, fHitPosErrZ); } //-------------------------------------------------------------------------- @@ -880,18 +841,18 @@ void CbmMvdSensorFindHitTask::ComputeCenterOfGravity(vector<Int_t>* clusterArray void CbmMvdSensorFindHitTask::Finish() { if (fShowDebugHistos) { - cout << "\n============================================================" << endl; - cout << "-I- " << GetName() << "::Finish: Total events skipped: " << fCounter << endl; - cout << "============================================================" << endl; - cout << "-I- Parameters used" << endl; - cout << "Gaussian noise [electrons] : " << fSigmaNoise << endl; - cout << "Noise simulated [Bool] : " << fAddNoise << endl; - cout << "Threshold seed [ADC] : " << fSeedThreshold << endl; - cout << "Threshold neighbours [ADC] : " << fNeighThreshold << endl; - cout << "ADC - Bits : " << fAdcBits << endl; - cout << "ADC - Dynamic [electrons] : " << fAdcDynamic << endl; - cout << "ADC - Offset [electrons] : " << fAdcOffset << endl; - cout << "============================================================" << endl; + LOG(info) << "============================================================"; + LOG(info) << GetName() << "::Finish: Total events skipped: " << fCounter; + LOG(info) << "============================================================"; + LOG(info) << "Parameters used"; + LOG(info) << "Gaussian noise [electrons] : " << fSigmaNoise; + LOG(info) << "Noise simulated [Bool] : " << fAddNoise; + LOG(info) << "Threshold seed [ADC] : " << fSeedThreshold; + LOG(info) << "Threshold neighbours [ADC] : " << fNeighThreshold; + LOG(info) << "ADC - Bits : " << fAdcBits; + LOG(info) << "ADC - Dynamic [electrons] : " << fAdcDynamic; + LOG(info) << "ADC - Offset [electrons] : " << fAdcOffset; + LOG(info) << "============================================================"; TH1F* histo; @@ -899,7 +860,7 @@ void CbmMvdSensorFindHitTask::Finish() TCanvas* canvas2 = new TCanvas("HitFinderCharge", "HitFinderCharge"); - //cout <<fChargeArraySize << endl; + //LOG(debug) <<fChargeArraySize; canvas2->Divide(2, 2); canvas2->cd(1); @@ -911,7 +872,7 @@ void CbmMvdSensorFindHitTask::Finish() for (Int_t i = 0; i < fChargeArraySize * fChargeArraySize; i++) { histo = (TH1F*) fPixelChargeHistos->At(i); Float_t charge = histo->GetMean(); - //cout <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize << endl; + //LOG(debug) <<i << " Charge " << charge << " xCluster: " << i%fChargeArraySize << " yCluster: " << i/fChargeArraySize; //histo->Fit("landau"); //TF1* fitFunction= histo->GetFunction("landau"); // Double_t MPV=fitFunction->GetParameter(1); @@ -925,7 +886,7 @@ void CbmMvdSensorFindHitTask::Finish() canvas2->cd(2); histo = (TH1F*) fPixelChargeHistos->At(24); histo->Draw(); - //cout <<"Mean charge" << histo->GetMean() << endl; + //LOG(debug) <<"Mean charge" << histo->GetMean(); /* TCanvas* canvas=new TCanvas("HitFinderCanvas","HitFinderCanvas"); canvas->Divide (2,3); diff --git a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx index 6a4f864584c1162f837fa3708f64e79e9c8ed66a..a384d8e7a62cefbee054ed6a4b45bf5c0c4a862f 100644 --- a/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx +++ b/reco/detectors/mvd/plugins/tasks/CbmMvdSensorHitfinderTask.cxx @@ -27,7 +27,6 @@ #include <map> // for map, __map_iterator, operator!=, operator== #include <vector> // for vector -using std::cout; using std::endl; using std::fixed; using std::ios_base; @@ -180,9 +179,8 @@ void CbmMvdSensorHitfinderTask::InitTask(CbmMvdSensor* mysensor) fSensor = mysensor; - if (gDebug > 0) { - cout << "-Start- CbmMvdSensorHitfinderTask: Initialisation of sensor " << fSensor->GetName() << endl; - } + LOG(debug) << "CbmMvdSensorHitfinderTask: Initialisation of sensor " << fSensor->GetName(); + fInputBuffer = new TClonesArray("CbmMvdCluster", 100); fOutputBuffer = new TClonesArray("CbmMvdHit", 100); @@ -204,15 +202,14 @@ void CbmMvdSensorHitfinderTask::InitTask(CbmMvdSensor* mysensor) initialized = kTRUE; - //cout << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + //LOG(debug) << "-Finished- " << GetName() << ": Initialisation of sensor " << fSensor->GetName(); } // ------------------------------------------------------------------------- // ----- Virtual public method Reinit ---------------------------------- InitStatus CbmMvdSensorHitfinderTask::ReInit() { - cout << "-I- " - << "CbmMvdSensorHitfinderTask::ReInt---------------" << endl; + LOG(info) << "CbmMvdSensorHitfinderTask::ReInt---------------"; return kSUCCESS; } // ------------------------------------------------------------------------- @@ -229,7 +226,7 @@ void CbmMvdSensorHitfinderTask::Exec() // { // fInputBuffer->Clear(); // fInputBuffer->AbsorbObjects(fPreviousPlugin->GetOutputArray()); - // cout << endl << "absorbt object from previous plugin at " << fSensor->GetName() << " got " << fInputBuffer->GetEntriesFast() << " entrys" << endl; + // LOG(debug) << "absorbt object from previous plugin at " << fSensor->GetName() << " got " << fInputBuffer->GetEntriesFast() << " entrys"; // } if (fInputBuffer->GetEntriesFast() > 0) { @@ -260,16 +257,16 @@ void CbmMvdSensorHitfinderTask::CreateHit(CbmMvdCluster* cluster, TVector3& pos, Double_t local[2]; local[0] = pos.X(); local[1] = pos.Y(); - //cout << endl << "found center of gravity at: " << local[0] << " , " << local[1] << endl; + //LOG(debug)<< "found center of gravity at: " << local[0] << " , " << local[1]; fSensor->TopToPixel(local, indexX, indexY); - //cout << endl << "Center is on pixel: " << indexX << " , " << indexY << endl; + //LOG(debug) << "Center is on pixel: " << indexX << " , " << indexY; // Save hit into array - //cout << endl << "adding new hit to fHits at X: " << pos.X() << " , Y: "<< pos.Y() << " , Z: " << pos.Z() << " , from cluster nr " << cluster->GetRefId() ; + //LOG(debug) << "adding new hit to fHits at X: " << pos.X() << " , Y: "<< pos.Y() << " , Z: " << pos.Z() << " , from cluster nr " << cluster->GetRefId(); Int_t nHits = fOutputBuffer->GetEntriesFast(); new ((*fOutputBuffer)[nHits]) CbmMvdHit(fSensor->GetStationNr(), pos, dpos, indexX, indexY, cluster->GetRefId(), 0); CbmMvdHit* currentHit = (CbmMvdHit*) fOutputBuffer->At(nHits); @@ -324,14 +321,8 @@ void CbmMvdSensorHitfinderTask::ComputeCenterOfGravity(CbmMvdCluster* cluster, T shape += TMath::Power(2, (4 * (yIndex - yIndex0 + 3)) + (xIndex - xIndex0)); } - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorHitfinderTask:: iCluster= " << cluster->GetRefId() << " , clusterSize= " << clusterSize - << endl; - cout << "-I- " - << "CbmMvdSensorHitfinderTask::xIndex " << xIndex << " , yIndex " << yIndex << " , charge = " << charge - << endl; - } + LOG(debug) << "CbmMvdSensorHitfinderTask:: iCluster= " << cluster->GetRefId() << " , clusterSize= " << clusterSize; + LOG(debug) << "CbmMvdSensorHitfinderTask::xIndex " << xIndex << " , yIndex " << yIndex << " , charge = " << charge; fSensor->PixelToTop(xIndex, yIndex, lab); @@ -346,13 +337,9 @@ void CbmMvdSensorHitfinderTask::ComputeCenterOfGravity(CbmMvdCluster* cluster, T denominator += charge; } - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorHitfinderTask::=========================\n " << endl; - cout << "-I- " - << "CbmMvdSensorHitfinderTask::numeratorX: " << numeratorX << " , numeratorY: " << numeratorY - << ", denominator: " << denominator << endl; - } + LOG(debug) << "CbmMvdSensorHitfinderTask::========================="; + LOG(debug) << "CbmMvdSensorHitfinderTask::numeratorX: " << numeratorX << " , numeratorY: " << numeratorY + << ", denominator: " << denominator; //Calculate x,y coordinates of the pixel in the laboratory ref frame if (denominator != 0) { @@ -366,16 +353,9 @@ void CbmMvdSensorHitfinderTask::ComputeCenterOfGravity(CbmMvdCluster* cluster, T fHitPosZ = 0; } - if (gDebug > 0) { - cout << "-I- " - << "CbmMvdSensorHitfinderTask::-----------------------------------" << endl; - cout << "-I- " - << "CbmMvdSensorHitfinderTask::X hit= " << fHitPosX << " Y hit= " << fHitPosY << " Z hit= " << fHitPosZ - << endl; - cout << "-I- " - << "CbmMvdSensorHitfinderTask::-----------------------------------\n" - << endl; - } + LOG(debug) << "CbmMvdSensorHitfinderTask::-----------------------------------"; + LOG(debug) << "CbmMvdSensorHitfinderTask::X hit= " << fHitPosX << " Y hit= " << fHitPosY << " Z hit= " << fHitPosZ; + LOG(debug) << "CbmMvdSensorHitfinderTask::-----------------------------------"; // Treat Sigma/Shift of the Cluster according to the Shape if (shape == 12288) { @@ -474,7 +454,7 @@ void CbmMvdSensorHitfinderTask::ComputeCenterOfGravity(CbmMvdCluster* cluster, T fHitPosY += shiftOut[1]; fHitPosZ += shiftOut[2]; - // pos = center of gravity (labframe), dpos uncertaintycout<<setw(10)<<setprecision(2)<< VolumeShape->GetDX(); + // pos = center of gravity (labframe), dpos uncertainty LOG(info)<<setw(10)<<setprecision(2)<< VolumeShape->GetDX(); pos.SetXYZ(fHitPosX, fHitPosY, fHitPosZ); dpos.SetXYZ(fHitPosErrX, fHitPosErrY, fHitPosErrZ); } diff --git a/sim/detectors/mvd/CbmMvdDigitizer.cxx b/sim/detectors/mvd/CbmMvdDigitizer.cxx index 0f605737048821c31ac8fa4d79c245d000806607..f7817b432da0a051b21a84e8fd480d88db17af39 100644 --- a/sim/detectors/mvd/CbmMvdDigitizer.cxx +++ b/sim/detectors/mvd/CbmMvdDigitizer.cxx @@ -31,7 +31,6 @@ #include <string> // for allocator, char_traits #include <vector> // for vector -using std::cout; using std::endl; using std::vector; @@ -158,13 +157,13 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) //fTmpMatch = fDetector->GetOutputDigiMatchs(); fDetector->GetOutputArray(nTargetPlugin, fTmpDigi); - //cout << "CbmMvdDigitizer::Exec() - GetOutputArray completed" << endl; + //LOG(debug) << "CbmMvdDigitizer::Exec() - GetOutputArray completed"; fDetector->GetMatchArray(nTargetPlugin, fTmpMatch); - //cout << "CbmMvdDigitizer::Exec() - GetMatchArray data completed" << endl; + //LOG(debug) << "CbmMvdDigitizer::Exec() - GetMatchArray data completed"; - //cout << "Length of Digi Array " << fTmpDigi->GetEntriesFast() << endl; - //cout << "Length of Digi Match Array " << fTmpMatch->GetEntriesFast() << endl; + //LOG(debug) << "Length of Digi Array " << fTmpDigi->GetEntriesFast(); + //LOG(debug) << "Length of Digi Match Array " << fTmpMatch->GetEntriesFast(); Int_t nEntries = fTmpDigi->GetEntriesFast(); for (Int_t index = 0; index < nEntries; index++) { @@ -215,9 +214,9 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) //fDigis->AbsorbObjects(fDetector->GetOutputDigis(),0,fDetector->GetOutputArray(fDigiPluginNr)->GetEntriesFast()-1); //LOG(debug) << "Total of " << fDigis->GetEntriesFast() << " digis in this Event"; - //if(fVerbose) cout << "Start writing DigiMatchs" << endl; + //LOG(dfVerbose) << "Start writing DigiMatchs"; //fDigiMatch->AbsorbObjects(fDetector->GetOutputDigiMatchs(),0,fDetector->GetOutputDigiMatchs()->GetEntriesFast()-1); - //if(fVerbose) cout << "Total of " << fDigiMatch->GetEntriesFast() << " digisMatch in this Event" << endl; + //if(fVerbose) LOG(debug) << "Total of " << fDigiMatch->GetEntriesFast() << " digisMatch in this Event"; LOG(debug) << "//----------------------------------------//"; //LOG(info) << "+ " << setw(20) << GetName() << ": Created: " // << fDigis->GetEntriesFast() << " digis in " @@ -235,10 +234,7 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdDigitizer::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); @@ -327,9 +323,8 @@ InitStatus CbmMvdDigitizer::Init() } // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; return kSUCCESS; @@ -343,8 +338,8 @@ InitStatus CbmMvdDigitizer::ReInit() { return kSUCCESS; } // ----- Virtual method Finish ----------------------------------------- void CbmMvdDigitizer::Finish() { //Int_t i = DetectPlugin (100); - //cout << "CbmMvdDigitizer::Finish() Autodetect: " << i <<" Manual Detect " << fDigiPluginNr << endl; - // cout<< endl << "finishing" << endl; + //LOG(debug) << "CbmMvdDigitizer::Finish() Autodetect: " << i <<" Manual Detect " << fDigiPluginNr; + // LOG(debug) << "finishing"; fDetector->Finish(); PrintParameters(); } @@ -379,17 +374,19 @@ Int_t CbmMvdDigitizer::DetectPlugin(Int_t pluginID) return detector->DetectPlugin(pluginID); } -// ----- Private method PrintParameters -------------------------------- -void CbmMvdDigitizer::PrintParameters() -{ +void CbmMvdDigitizer::PrintParameters() const { LOG(info) << ParametersToString(); } - using namespace std; +// ----- Private method PrintParameters -------------------------------- - cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters MvdDigitizer =====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; +std::string CbmMvdDigitizer::ParametersToString() const +{ + std::stringstream ss; + ss.setf(std::ios_base::fixed, std::ios_base::floatfield); + ss << "============================================================" << endl; + ss << "============== Parameters MvdDigitizer =====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/sim/detectors/mvd/CbmMvdDigitizer.h b/sim/detectors/mvd/CbmMvdDigitizer.h index ce43e7579295922bc532f6c19481b2bc9d3576d5..b973b0a9158622b6a9e3ab09106f52b27c93cd2e 100644 --- a/sim/detectors/mvd/CbmMvdDigitizer.h +++ b/sim/detectors/mvd/CbmMvdDigitizer.h @@ -147,7 +147,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdDigitizer(const CbmMvdDigitizer&); diff --git a/sim/detectors/mvd/CbmMvdDigitizerTB.cxx b/sim/detectors/mvd/CbmMvdDigitizerTB.cxx index cac9803b6f28fd1a2ee31c08754cfb3c4654c029..b6cd32069326cc8be24b1315bb521aad95f10ed9 100644 --- a/sim/detectors/mvd/CbmMvdDigitizerTB.cxx +++ b/sim/detectors/mvd/CbmMvdDigitizerTB.cxx @@ -102,18 +102,17 @@ void CbmMvdDigitizerTB::Exec(Option_t* /*opt*/) // ----- Init -------------------------------------------------------------- InitStatus CbmMvdDigitizerTB::Init() { - cout << "-I- " << GetName() << ": Initialisation..." << endl; - cout << endl; - cout << "---------------------------------------------" << endl; - cout << "-I- Initialising " << GetName() << " ...." << endl; + LOG(info) << GetName() << ": Initialisation..."; eventNumber = 0; // ********** RootManager FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { - cout << "-E- " << GetName() << "::Init: No FairRootManager!" << endl; - return kFATAL; + LOG(error) + " << GetName() << " ::Init : + No FairRootManager !"; + return kFATAL; } // ********** Get input arrays @@ -153,9 +152,8 @@ InitStatus CbmMvdDigitizerTB::Init() fDetector->Init(); // Screen output - cout << GetName() << " initialised with parameters: " << endl; + LOG(info) << GetName() << " initialised with parameters: "; //PrintParameters(); - cout << "---------------------------------------------" << endl; return kSUCCESS; @@ -169,7 +167,7 @@ InitStatus CbmMvdDigitizerTB::ReInit() { return kSUCCESS; } // ----- Virtual method Finish ----------------------------------------- void CbmMvdDigitizerTB::Finish() { - // cout<< endl << "finishing" << endl; + // LOG(debug) << "finishing"; fDetector->Finish(); PrintParameters(); } @@ -184,18 +182,19 @@ void CbmMvdDigitizerTB::Reset() { fDigis->Delete(); } void CbmMvdDigitizerTB::GetMvdGeometry() {} // ------------------------------------------------------------------------- +void CbmMvdDigitizerTB::PrintParameters() const { LOG(info) << ParametersToString(); } // ----- Private method PrintParameters -------------------------------- -void CbmMvdDigitizerTB::PrintParameters() +void CbmMvdDigitizerTB::ParametersToString() const { - using namespace std; - - cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters MvdDigitizer =====================" << endl; - cout << "============================================================" << endl; - cout << "=============== End Task ===================================" << endl; + std::stringstream ss; + ss.setf(std::ios_base::fixed, std::ios_base::floatfield); + ss << "============================================================" << endl; + ss << "============== Parameters MvdDigitizer =====================" << endl; + ss << "============================================================" << endl; + ss << "=============== End Task ===================================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/sim/detectors/mvd/CbmMvdDigitizerTB.h b/sim/detectors/mvd/CbmMvdDigitizerTB.h index 3e2d2981ff666fe14255df165541ea3dc85770f7..4b046c36c53a39bbbaf91c1a38edd0579093c7f1 100644 --- a/sim/detectors/mvd/CbmMvdDigitizerTB.h +++ b/sim/detectors/mvd/CbmMvdDigitizerTB.h @@ -15,6 +15,8 @@ #include "TStopwatch.h" #include "TString.h" +#include <string> + class FairTask; class CbmMvdDetector; class CbmMvdPileupManager; @@ -99,7 +101,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); + void PrintParameters() const; + std::string ParametersToString() const; private: CbmMvdDigitizerTB(const CbmMvdDigitizerTB&); diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.cxx b/sim/detectors/mvd/CbmMvdPixelCharge.cxx index 07bd47ee24a441543936564fec8a379441408089..c18a3c8ab09c1b70a9056d5c4b6cddad04dc3796 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.cxx +++ b/sim/detectors/mvd/CbmMvdPixelCharge.cxx @@ -6,12 +6,6 @@ #include <Logger.h> -#include <iostream> - - -using std::cout; -using std::endl; - // ------------------------------------------------------------------------- Bool_t CbmMvdPixelCharge::TestXY(Int_t channelNrX, Int_t channelNrY) { diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.h b/sim/detectors/mvd/CbmMvdPixelCharge.h index cb74164c0f309fca4230732a458f0ad0d6d7da96..72b92da7cbb7cffcff07fa7ef623ac4f4cf05a53 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.h +++ b/sim/detectors/mvd/CbmMvdPixelCharge.h @@ -1,4 +1,4 @@ -/* Copyright (C) 20236 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Christina Dritsa [committer], Philipp Sitzmann, Florian Uhlig */ diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTBTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTBTask.cxx index 96c312137e06aebc734c1b379dd17f4764e9256c..6ce019c3057c3077fd7f6af0adf9ed63e7bed8cd 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTBTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTBTask.cxx @@ -44,7 +44,6 @@ #include <map> #include <vector> -using std::cout; using std::endl; using std::fixed; using std::ios_base; @@ -262,13 +261,13 @@ void CbmMvdSensorDigitizerTBTask::Exec() CbmMvdPoint* point = (CbmMvdPoint*) fInputPoints->At(iPoint); if (!point) { - cout << "-W-" << GetName() << ":: Exec:" << endl; - cout << " -received bad MC-Point. Ignored." << endl; + LOG(warning) << GetName() << ":: Exec:"; + LOG(warning << " -received bad MC-Point. Ignored."; continue; } if (point->GetStationNr() != fSensor->GetSensorNr()) { - cout << "-W-" << GetName() << ":: Exec:" << endl; - cout << " -received bad MC-Point which doesn't belong here. Ignored." << endl; + LOG(warning) << GetName() << ":: Exec:"; + LOG(warning) << " -received bad MC-Point which doesn't belong here. Ignored."; continue; } //The digitizer acts only on particles, which crossed the station. @@ -454,7 +453,7 @@ void CbmMvdSensorDigitizerTBTask::ProduceIonisationPoints(CbmMvdPoint* point) if (rawLength < 1.0e+3) { trackLength = rawLength; } else { - cout << "-W- " << GetName() << " : rawlength > 1.0e+3 : " << rawLength << endl; + LOG(warning) << GetName() << " : rawlength > 1.0e+3 : " << rawLength; trackLength = 1.0e+3; } @@ -464,9 +463,9 @@ void CbmMvdSensorDigitizerTBTask::ProduceIonisationPoints(CbmMvdPoint* point) if (charge > (12000 / fLandauMPV)) { charge = 12000 / fLandauMPV; } //limit Random generator behaviour //Translate the charge to normalized energy - // cout << endl << "charge after random generator " << charge << endl; + // LOG(debug) << "charge after random generator " << charge; Double_t dEmean = charge / (fElectronsPerKeV * 1e6); - // cout << endl << "dEmean " << dEmean << endl; + // LOG(debug) << "dEmean " << dEmean; fNumberOfSegments = int(trackLength / fSegmentLength) + 1; dEmean = dEmean * ((Double_t) trackLength / fEpiTh); //scale the energy to the track length @@ -489,7 +488,7 @@ void CbmMvdSensorDigitizerTBTask::ProduceIonisationPoints(CbmMvdPoint* point) } else { //condition added 05/08/08 fSegmentDepth = 0; - cout << "-W- " << GetName() << " Length of track in detector (z-direction) is 0!!!" << endl; + LOG(warning) << GetName() << " Length of track in detector (z-direction) is 0!!!"; } @@ -520,7 +519,7 @@ void CbmMvdSensorDigitizerTBTask::ProduceIonisationPoints(CbmMvdPoint* point) sPoint->y = y; sPoint->z = z; charge = 1.0e+6 * dEmean * fElectronsPerKeV; - //cout << endl << "charge " << charge << endl; + //LOG(debug) << "charge " << charge; sPoint->sigmaX = fPixelSize; sPoint->sigmaY = fPixelSize; sPoint->charge = charge; @@ -672,7 +671,7 @@ void CbmMvdSensorDigitizerTBTask::ProducePixelCharge(CbmMvdPoint* point) point->GetTrackID()); } else { - cout << endl << "Warning working on broken pixel " << endl; + LOG(warning) << "Warning working on broken pixel "; } } @@ -690,7 +689,7 @@ void CbmMvdSensorDigitizerTBTask::InitTask(CbmMvdSensor* mySensor) //Read information on the sensor von data base fSensor = mySensor; - // cout << "-I- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + // LOG(info) << GetName() << ": Initialisation of sensor " << fSensor->GetName(); fDigis = new TClonesArray("CbmMvdDigi", 10000); fDigiMatch = new TClonesArray("CbmMatch", 10000); diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index bfc9edf7b819da3bef1e814a794e88b2577c60c5..adb8d65f87bc872dce18218c126a66c8f18c7115 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx @@ -45,15 +45,14 @@ #include <TRefArray.h> // for TRefArray #include <TVector3.h> // for TVector3, operator*, operator+ -#include <iomanip> // for operator<<, setprecision, setw -#include <iostream> // for operator<<, basic_ostream, endl -#include <map> // for map, operator==, __map_iterator -#include <vector> // for allocator, vector +#include <iomanip> // for operator<<, setprecision, setw +#include <map> // for map, operator==, __map_iterator +#include <ostream> // for operator<<, basic_ostream, endl +#include <vector> // for allocator, vector #include <cmath> // for sqrt -using std::cout; using std::endl; using std::ios_base; using std::pair; @@ -262,7 +261,7 @@ CbmMvdSensorDigitizerTask::CbmMvdSensorDigitizerTask(Int_t iMode) { fPluginIDNumber = 100; - if (gDebug > 0) { cout << "Starting CbmMvdSensorDigitizerTask::CbmMvdSensorDigitizerTask() " << endl; } + LOG(debug) << "Starting CbmMvdSensorDigitizerTask::CbmMvdSensorDigitizerTask() "; fRandGen.SetSeed(2736); fEvent = 0; @@ -355,17 +354,16 @@ InitStatus CbmMvdSensorDigitizerTask::ReadSensorInformation() fPar0 = sensorData->GetLorentzPar0(); fPar1 = sensorData->GetLorentzPar1(); - fPar2 = sensorData->GetLorentzPar2(); //cout<< endl << " LorentzPar2 is now set to " << fPar2 << endl; + fPar2 = sensorData->GetLorentzPar2(); //LOG(debug) << " LorentzPar2 is now set to " << fPar2; - fLandauMPV = sensorData->GetLandauMPV(); //cout << endl << " Landau MPV is now set to " << fLandauMPV << endl; - fLandauSigma = - sensorData->GetLandauSigma(); //cout << endl << " Landau Sigma is now set to " << fLandauSigma << endl; - fLandauGain = sensorData->GetLandauGain(); //cout << endl << " Landau Gain is now set to " << fLandauGain << endl; - fEpiTh = sensorData->GetEpiThickness(); //cout << endl << " Epitaxial thickness is now set to " << fEpiTh << endl; + fLandauMPV = sensorData->GetLandauMPV(); //LOG(debug)<< " Landau MPV is now set to " << fLandauMPV; + fLandauSigma = sensorData->GetLandauSigma(); //LOG(debug) << " Landau Sigma is now set to " << fLandauSigma; + fLandauGain = sensorData->GetLandauGain(); //LOG(debug) << " Landau Gain is now set to " << fLandauGain; + fEpiTh = sensorData->GetEpiThickness(); //LOG(debug) << " Epitaxial thickness is now set to " << fEpiTh; fCompression = fPixelSizeX / fPixelSizeY; if (fCompression != 1) - //cout << endl << "working with non uniform pixels" << endl; + //LOG(debug) << "working with non uniform pixels"; if (fCompression <= 0) fCompression = 1; return kSUCCESS; } @@ -381,7 +379,7 @@ void CbmMvdSensorDigitizerTask::SetInputArray(TClonesArray* inputStream) while (nInputs > i) { new ((*fInputPoints)[fInputPoints->GetEntriesFast()]) CbmMvdPoint(*((CbmMvdPoint*) inputStream->At(i))); - //cout << endl << "New Input registered" << endl; + //LOG(debug) << "New Input registered"; i++; } } @@ -398,7 +396,7 @@ void CbmMvdSensorDigitizerTask::SetInput(TObject* point) void CbmMvdSensorDigitizerTask::ExecChain() { - // cout << endl << "start Digitizer on sensor " << fSensor->GetName() << endl; + // LOG(debug) << "start Digitizer on sensor " << fSensor->GetName(); Exec(); @@ -440,7 +438,7 @@ void CbmMvdSensorDigitizerTask::Exec() // Reject for the time being light nuclei (no digitization modell yet) if (point->GetPdgCode() > 100000) { continue; } // Digitize the point - //cout << endl << " found point make digi" << endl; + //LOG(debug) << " found point make digi"; ProduceIonisationPoints(point); ProducePixelCharge(point); } //loop on MCpoints @@ -475,7 +473,7 @@ void CbmMvdSensorDigitizerTask::Exec() } } else { - //cout << endl << "charge under threshold, digi rejected" << endl; + //LOG(debug) << "charge under threshold, digi rejected"; } } //LOG(debug) << nDigis <<" new Digis at on Sensor " << fSensor->GetSensorNr() << " from " << fInputPoints->GetEntriesFast()<< " McPoints"; @@ -575,7 +573,7 @@ void CbmMvdSensorDigitizerTask::ProduceIonisationPoints(CbmMvdPoint* point) **/ //Option_t* opt1; - //cout << endl << "Computing Point " << endl; + //LOG(debug) << "Computing Point "; //point->Print(opt1); // Int_t pdgCode = point->GetPdgCode(); @@ -675,23 +673,23 @@ void CbmMvdSensorDigitizerTask::ProduceIonisationPoints(CbmMvdPoint* point) if (rawLength < 1.0e+3) { trackLength = rawLength; } else { - cout << "-W- " << GetName() << " : rawlength > 1.0e+3 : " << rawLength << endl; + LOG(warning) << GetName() << " : rawlength > 1.0e+3 : " << rawLength; trackLength = 1.0e+3; } //Smear the energy on each track segment Double_t charge = fLandauRandom->Landau(fLandauGain, fLandauSigma / fLandauMPV); - //if (fShowDebugHistos ) cout << endl << "charge " << charge << endl; + //if (fShowDebugHistos ) LOG(debug) << "charge " << charge << endl; if (charge > (12000 / fLandauMPV)) { charge = 12000 / fLandauMPV; } //limit Random generator behaviour if (fShowDebugHistos) { fRandomGeneratorTestHisto->Fill(charge * fLandauMPV); } //Translate the charge to normalized energy - // cout << endl << "charge after random generator " << charge << endl; + // LOG(debug) << "charge after random generator " << charge; Double_t dEmean = charge / (fElectronsPerKeV * 1e6); - // cout << endl << "dEmean " << dEmean << endl; + // LOG(debug) << "dEmean " << dEmean; fNumberOfSegments = int(trackLength / fSegmentLength) + 1; dEmean = dEmean * ((Double_t) trackLength / fEpiTh); //scale the energy to the track length @@ -714,7 +712,7 @@ void CbmMvdSensorDigitizerTask::ProduceIonisationPoints(CbmMvdPoint* point) } else { //condition added 05/08/08 fSegmentDepth = 0; - cout << "-W- " << GetName() << " Length of track in detector (z-direction) is 0!!!" << endl; + LOG(warning) << GetName() << " Length of track in detector (z-direction) is 0!!!"; } @@ -745,13 +743,13 @@ void CbmMvdSensorDigitizerTask::ProduceIonisationPoints(CbmMvdPoint* point) sPoint->y = y; sPoint->z = z; charge = 1.0e+6 * dEmean * fElectronsPerKeV; - //cout << endl << "charge " << charge << endl; + //LOG(debug) << "charge " << charge; sPoint->sigmaX = fPixelSize; sPoint->sigmaY = fPixelSize; sPoint->charge = charge; totalSegmentCharge = totalSegmentCharge + charge; } - //if (fShowDebugHistos )cout << endl << "totalSegmentCharge " << totalSegmentCharge << endl; + //if (fShowDebugHistos ) LOG(debug) << "totalSegmentCharge " << totalSegmentCharge << endl; if (fShowDebugHistos) { fTotalSegmentChargeHisto->Fill(totalSegmentCharge * fLandauMPV); fSegResolutionHistoX->Fill(xDebug / fNumberOfSegments - (point->GetX() + point->GetXOut()) / 2 - fSensor->GetX()); @@ -851,7 +849,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) } - //cout << "Scanning from x= " << ixLo << " to " <<ixUp <<" and y= "<<iyLo<< " to " << iyUp << endl; + //LOG(debug) << "Scanning from x= " << ixLo << " to " <<ixUp <<" and y= "<<iyLo<< " to " << iyUp; // loop over all pads of interest. fPixelChargeShort.clear(); @@ -870,14 +868,14 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) //loop over segments, check if the pad received some charge for (Int_t i = 0; i < fNumberOfSegments; ++i) { - // cout << endl << "check segment nr. " << i << " from " << fNumberOfSegments << endl; + // LOG(debug) << "check segment nr. " << i << " from " << fNumberOfSegments; // ignore pads, which are out of reach for this segments if (ix < lowerXArray[i]) { continue; } if (iy < lowerYArray[i]) { continue; } if (ix > upperXArray[i]) { continue; } if (iy > upperYArray[i]) { continue; } - // cout << endl << "found vallied pad " << i << endl; + // LOG(debug) << "found vallied pad " << i; sPoint = &fSignalPoints[i]; xCentre = sPoint->x; //of segment @@ -898,25 +896,25 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) if (totCharge < 1) { - // cout << endl << "charge is " << totCharge << " < 1 electron thus charge is negligible" << endl; + // LOG(debug) << "charge is " << totCharge << " < 1 electron thus charge is negligible"; continue; } //ignore negligible charge (< 1 electron) if (!pixel) { - // cout << endl << "charge is " << totCharge << " > 1 electron thus pixel is firred at "<< ix << " " << iy << endl; + // LOG(debug) << "charge is " << totCharge << " > 1 electron thus pixel is firred at "<< ix << " " << iy; // Look for pixel in charge map if not yet linked. thispoint = std::make_pair(ix, iy); - // cout << endl << "creat pair at "<< ix << " " << iy << endl; + // LOG(debug) << "creat pair at "<< ix << " " << iy; fChargeMapIt = fChargeMap.find(thispoint); - // cout << endl << "found pair at "<< ix << " " << iy << endl; - // cout << endl << "Map size is now " << fChargeMap.size() << endl; + // LOG(debug) << "found pair at "<< ix << " " << iy; + // LOG(debug) << "Map size is now " << fChargeMap.size(); // Pixel not yet in map -> Add new pixel if (fChargeMapIt == fChargeMap.end()) { pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge( totCharge, ix, iy, point->GetPointId(), point->GetTrackID(), (point->GetX() + point->GetXOut()) / 2, (point->GetY() + point->GetXOut()) / 2, point->GetTime(), point->GetFrame()); - //cout << endl << "new charched pixel with charge " << totCharge << " at " << ix << " " << iy << endl; + //LOG(debug) << "new charched pixel with charge " << totCharge << " at " << ix << " " << iy; // fPixelChargeShort.push_back(pixel); - // cout << endl << "added pixel to ChargeShort vector " << endl; + // LOG(debug) << "added pixel to ChargeShort vector "; fChargeMap[thispoint] = pixel; } @@ -927,13 +925,13 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) //if ( ! pixel ) Fatal("AddChargeToPixel", "Zero pointer in charge map!"); pixel->AddCharge(totCharge); // if(pixel->GetCharge()>150) - // {cout << endl << "added charge to pixel summing up to "<< pixel->GetCharge() << endl;} + // {LOG(debug) << "added charge to pixel summing up to "<< pixel->GetCharge();} } fPixelChargeShort.push_back(pixel); } else { //pixel already linked => add charge only pixel->AddCharge(totCharge); - // cout<<"put charge" << endl; + // LOG(debug) <<"put charge"; } @@ -947,7 +945,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) } //for y } // for x - // cout << endl << "End of loops " << endl; + // LOG(debug) << "End of loops "; std::vector<CbmMvdPixelCharge*>::size_type vectorSize = fPixelChargeShort.size(); for (ULong64_t f = 0; f < vectorSize; f++) { @@ -958,12 +956,12 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) point->GetPointId(), point->GetTrackID()); } else { - cout << endl << "Warning working on broken pixel " << endl; + LOG(warning) << "Warning working on broken pixel "; } } if (fShowDebugHistos) { - //cout << endl << "produced " << fPixelChargeShort.size() << " Digis with total charge of " << totClusterCharge << endl; + //LOG(debug) << "produced " << fPixelChargeShort.size() << " Digis with total charge of " << totClusterCharge; TVector3 momentum, position; if (totClusterCharge > 0) fTotalChargeHisto->Fill(totClusterCharge); point->Position(position); @@ -1038,7 +1036,7 @@ void CbmMvdSensorDigitizerTask::InitTask(CbmMvdSensor* mySensor) //Read information on the sensor von data base fSensor = mySensor; - // cout << "-I- " << GetName() << ": Initialisation of sensor " << fSensor->GetName() << endl; + // LOG(info) << GetName() << ": Initialisation of sensor " << fSensor->GetName(); fDigis = new TClonesArray("CbmMvdDigi", 100); fDigiMatch = new TClonesArray("CbmMatch", 100); @@ -1053,7 +1051,7 @@ void CbmMvdSensorDigitizerTask::InitTask(CbmMvdSensor* mySensor) // Initialize histogramms used for debugging if (fShowDebugHistos) { - cout << endl << "Show debug histos in this Plugin" << endl; + LOG(info) << "Show debug histos in this Plugin"; fRandomGeneratorTestHisto = new TH1F("TestHisto", "TestHisto", 1000, 0, 12000); fResolutionHistoX = new TH1F("DigiResolutionX", "DigiResolutionX", 1000, -.005, .005); fResolutionHistoY = new TH1F("DigiResolutionY", "DigiResolutionY", 1000, -.005, .005); @@ -1068,10 +1066,9 @@ void CbmMvdSensorDigitizerTask::InitTask(CbmMvdSensor* mySensor) fTotalSegmentChargeHisto = new TH1F("TotalSegmentChargeHisto", "TotalSegmentChargeHisto", 1000, 0, 12000); } - /** Screen output - cout << GetName() << " initialised with parameters: " << endl; + /** Screen output **/ + LOG(info) << GetName() << " initialised with parameters: "; PrintParameters(); - cout << "---------------------------------------------" << endl;**/ fPreviousPlugin = nullptr; initialized = kTRUE; @@ -1132,9 +1129,8 @@ void CbmMvdSensorDigitizerTask::Finish() c->cd(9); fTotalChargeHisto->Draw(); fTotalChargeHisto->Write(); - cout << "-I- CbmMvdDigitizerL::Finish - Fit of the total cluster charge" << endl; + LOG(info) << "CbmMvdDigitizerL::Finish - Fit of the total cluster charge"; fTotalChargeHisto->Fit("landau"); - cout << "==============================================================" << endl; // new TCanvas(); //fTotalChargeHisto->Draw(); }; @@ -1146,30 +1142,33 @@ void CbmMvdSensorDigitizerTask::Finish() void CbmMvdSensorDigitizerTask::Reset() {} // ------------------------------------------------------------------------- +void CbmMvdSensorDigitizerTask::PrintParameters() const { LOG(info) << ToString(); } // ----- Private method PrintParameters -------------------------------- -void CbmMvdSensorDigitizerTask::PrintParameters() +std::string CbmMvdSensorDigitizerTask::ToString() const { - cout.setf(ios_base::fixed, ios_base::floatfield); - cout << "============================================================" << endl; - cout << "============== Parameters of the Lorentz - Digitizer =======" << endl; - cout << "============================================================" << endl; - - - cout << "Pixel Size X : " << setw(8) << setprecision(2) << fPixelSizeX * 10000. << " mum" << endl; - cout << "Pixel Size Y : " << setw(8) << setprecision(2) << fPixelSizeY * 10000. << " mum" << endl; - cout << "Epitaxial layer thickness : " << setw(8) << setprecision(2) << fEpiTh * 10000. << " mum" << endl; - cout << "Segment Length : " << setw(8) << setprecision(2) << fSegmentLength * 10000. << " mum" << endl; - cout << "Diffusion Coefficient : " << setw(8) << setprecision(2) << fDiffusionCoefficient * 10000. << " mum" - << endl; - cout << "Width of Cluster : " << setw(8) << setprecision(2) << fWidthOfCluster << " * sigma " << endl; - cout << "ElectronsPerKeV 3.62 eV/eh : " << setw(8) << setprecision(2) << fElectronsPerKeV << endl; - cout << "CutOnDeltaRays : " << setw(8) << setprecision(8) << fCutOnDeltaRays << " MeV " << endl; - cout << "ChargeThreshold : " << setw(8) << setprecision(2) << fChargeThreshold << endl; - cout << "Pileup: " << fNPileup << endl; - cout << "Delta - Pileup: " << fNDeltaElect << endl; - cout << "=============== End Parameters Digitizer ===================" << endl; + std::stringstream ss; + ss.setf(ios_base::fixed, ios_base::floatfield); + ss << "============================================================" << endl; + ss << "============== Parameters of the Lorentz - Digitizer =======" << endl; + ss << "============================================================" << endl; + + + ss << "Pixel Size X : " << setw(8) << setprecision(2) << fPixelSizeX * 10000. << " mum" << endl; + ss << "Pixel Size Y : " << setw(8) << setprecision(2) << fPixelSizeY * 10000. << " mum" << endl; + ss << "Epitaxial layer thickness : " << setw(8) << setprecision(2) << fEpiTh * 10000. << " mum" << endl; + ss << "Segment Length : " << setw(8) << setprecision(2) << fSegmentLength * 10000. << " mum" << endl; + ss << "Diffusion Coefficient : " << setw(8) << setprecision(2) << fDiffusionCoefficient * 10000. << " mum" + << endl; + ss << "Width of Cluster : " << setw(8) << setprecision(2) << fWidthOfCluster << " * sigma " << endl; + ss << "ElectronsPerKeV 3.62 eV/eh : " << setw(8) << setprecision(2) << fElectronsPerKeV << endl; + ss << "CutOnDeltaRays : " << setw(8) << setprecision(8) << fCutOnDeltaRays << " MeV " << endl; + ss << "ChargeThreshold : " << setw(8) << setprecision(2) << fChargeThreshold << endl; + ss << "Pileup: " << fNPileup << endl; + ss << "Delta - Pileup: " << fNDeltaElect << endl; + ss << "=============== End Parameters Digitizer ===================" << endl; + return ss.str(); } // ------------------------------------------------------------------------- diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.h b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.h index edeecb689e0c121142f5fe87388ed6fc70c4ffb7..27c4f6d5e12297b531c283cc21b1793fd36779b4 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.h +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.h @@ -263,8 +263,8 @@ private: /** Print digitisation parameters **/ - void PrintParameters(); - + void PrintParameters() const; + std::string ToString() const; /** Get MVD geometry parameters from database **@value Number of MVD stations