From 0d1821389cd1b8932a2fa9e191af5716009aefb8 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Fri, 28 Aug 2020 18:37:53 +0200 Subject: [PATCH] Apply clang format --- MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx | 252 +-- MQ/hitbuilder/CbmDeviceHitBuilderTof.h | 16 +- MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx | 11 +- MQ/unpacker/CbmTbDaqBuffer.cxx | 45 +- MQ/unpacker/CbmTbDaqBuffer.h | 68 +- MQ/unpacker/runUnpackTofMcbm2018.cxx | 18 +- analysis/PWGHAD/hadron/CbmHadronAnalysis.cxx | 93 +- core/data/tof/CbmTofAddress.cxx | 3 +- core/data/tof/CbmTofAddress.h | 8 +- core/data/tof/CbmTofDetectorId.h | 99 +- core/data/tof/CbmTofDetectorId_v21a.cxx | 121 +- core/data/tof/CbmTofDetectorId_v21a.h | 29 +- core/data/tof/CbmTofTracklet.h | 9 +- core/detectors/tof/CbmTofCreateDigiPar.cxx | 25 +- core/detectors/tof/CbmTofDigiBdfPar.cxx | 2 +- core/detectors/tof/CbmTofGeoHandler.cxx | 148 +- core/detectors/tof/CbmTofGeoHandler.h | 2 +- .../unpacker/CbmMcbm2018UnpackerAlgoTof.cxx | 46 +- ...AnalyseTimeCoincidenceBugAllCases2elinks.C | 4 +- ...AnalyseTimeCoincidenceBugAllCases5elinks.C | 4 +- ...nalyseTimeCoincidenceBugAllCasesMoreCond.C | 4 +- macro/beamtime/mcbm2018/ana_trks.C | 20 +- macro/beamtime/mcbm2020/ana_trks.C | 24 +- macro/beamtime/mcbm2020/ana_trks_eval.C | 20 +- macro/beamtime/mcbm2020/ana_trksi.C | 20 +- macro/beamtime/mcbm2020/dis_trks.C | 20 +- macro/beamtime/mcbm2020/mtof_reco.C | 4 +- macro/beamtime/mcbm2020/pl_all_DigiDTFD.C | 150 +- macro/beamtime/pl_pull_trk.C | 14 +- macro/mcbm/eventDisplay.C | 289 ++- macro/mcbm/eventDisplay_reco.C | 347 +-- .../tof/Create_TOF_Geometry_v20a_cosmicHD.C | 1913 +++++++++-------- .../tof/Create_TOF_Geometry_v20b_cosmicHD.C | 1913 +++++++++-------- .../tof/Create_TOF_Geometry_v20b_mcbm.C | 2 +- .../tof/Create_TOF_Geometry_v21b_mcbm.C | 31 +- macro/mcbm/geometry/tof/create_digipar.C | 26 +- macro/mcbm/mcbm_Ana.C | 426 ++-- macro/mcbm/mcbm_digi_nh.C | 54 +- macro/mcbm/mcbm_display_event.C | 506 ++--- macro/mcbm/mcbm_mc_nh.C | 263 ++- macro/mcbm/mcbm_reco.C | 80 +- macro/mcbm/mcbm_reco_event_tb_nh.C | 607 +++--- macro/mcbm/mcbm_reco_nh.C | 86 +- macro/mcbm/mcbm_transport.C | 219 +- macro/mcbm/mcbm_transport_nh.C | 161 +- macro/mcbm/pl_lambda.C | 489 +++-- macro/mcbm/save_hst.C | 35 +- reco/detectors/tof/CbmTofCalibrator.cxx | 123 +- reco/detectors/tof/CbmTofCalibrator.h | 2 +- reco/detectors/tof/CbmTofClusterizersDef.h | 4 +- reco/detectors/tof/CbmTofEventClusterizer.cxx | 471 ++-- reco/detectors/tof/CbmTofEventClusterizer.h | 8 +- reco/detectors/tof/CbmTofFindTracks.cxx | 52 +- sim/detectors/tof/CbmTofDigitize.cxx | 20 +- 54 files changed, 4866 insertions(+), 4540 deletions(-) mode change 100755 => 100644 macro/mcbm/eventDisplay_reco.C mode change 100755 => 100644 macro/mcbm/geometry/tof/create_digipar.C mode change 100755 => 100644 macro/mcbm/mcbm_digi_nh.C mode change 100755 => 100644 macro/mcbm/mcbm_mc_nh.C mode change 100755 => 100644 macro/mcbm/mcbm_reco_event_tb_nh.C mode change 100755 => 100644 macro/mcbm/pl_lambda.C mode change 100755 => 100644 macro/mcbm/save_hst.C diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx index a4b0d033cd..54b9a72733 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx @@ -421,7 +421,7 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { FairMQMessagePtr req(NewSimpleMessage(message)); //FairMQMessagePtr req(NewSimpleMessage( "CbmTofDigiBdfPar,111" )); //original format FairMQMessagePtr rep(NewMessage()); - CbmTofCreateDigiPar* tofDigiPar=NULL; + CbmTofCreateDigiPar* tofDigiPar = NULL; if (Send(req, Channel) > 0) { if (Receive(rep, Channel) >= 0) { @@ -461,31 +461,30 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() { LOG(info) << "GeoMan: " << fGeoMan << " " << gGeoManager; iGeoVersion = fGeoHandler->Init(isSimulation); if (k21a > iGeoVersion) { - LOG(error) << "Incompatible geometry !!!"; - //ChangeState(STOP); - ChangeState(fair::mq::Transition(STOP)); + LOG(error) << "Incompatible geometry !!!"; + //ChangeState(STOP); + ChangeState(fair::mq::Transition(STOP)); } - switch(iGeoVersion) { - case k14a: - fTofId = new CbmTofDetectorId_v14a(); - break; - case k21a: - fTofId = new CbmTofDetectorId_v21a(); - break; + switch (iGeoVersion) { + case k14a: fTofId = new CbmTofDetectorId_v14a(); break; + case k21a: fTofId = new CbmTofDetectorId_v21a(); break; } - if (NULL == fDigiPar){ + if (NULL == fDigiPar) { if (NULL == fRtdb) { - LOG(info)<<"Instantiate FairRunDb"; - fRtdb = FairRuntimeDb::instance(); - assert(fRtdb); + LOG(info) << "Instantiate FairRunDb"; + fRtdb = FairRuntimeDb::instance(); + assert(fRtdb); } // create digitization parameters from geometry file - tofDigiPar = new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); + tofDigiPar = + new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); LOG(info) << "Create DigiPar "; tofDigiPar->Init(); - fDigiPar = (CbmTofDigiPar*) (fRtdb->getContainer("CbmTofDigiPar")); + fDigiPar = + (CbmTofDigiPar*) (fRtdb->getContainer("CbmTofDigiPar")); if (NULL == fDigiPar) { - LOG(error) << "CbmTofEventClusterizer::InitParameters => Could not obtain " + LOG(error) << "CbmTofEventClusterizer::InitParameters => " + "Could not obtain " "the CbmTofDigiPar "; return kFALSE; } @@ -1962,7 +1961,7 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { continue; } - Double_t dTDifMin = dDoubleMax; + Double_t dTDifMin = dDoubleMax; CbmTofDigi* pDigi2Min = NULL; // for (Int_t iDigI2 =iDigInd+1; iDigI2<iNbTofDigi;iDigI2++){ for (Int_t iDigI2 = 0; iDigI2 < iNbTofDigi; iDigI2++) { @@ -2108,9 +2107,9 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { for (Int_t iDigInd = 0; iDigInd < fiNDigiIn; iDigInd++) { CbmTofDigi* pDigi = &fvDigiIn[iDigInd]; - Int_t iAddr = pDigi->GetAddress() & DetMask; - Int_t iDet = fDetIdIndexMap[iAddr]; // Detector Index - Int_t iSide = pDigi->GetSide(); + Int_t iAddr = pDigi->GetAddress() & DetMask; + Int_t iDet = fDetIdIndexMap[iAddr]; // Detector Index + Int_t iSide = pDigi->GetSide(); fhDigiTimesRaw->Fill(iDet * 2 + iSide, pDigi->GetTime() - pRef->GetTime()); } @@ -2122,7 +2121,7 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() { Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { CbmTofDigi* pDigi; CbmTofDigi* pCalDigi = NULL; - Int_t iDigIndCal = -1; + Int_t iDigIndCal = -1; // channel deadtime map std::map<Int_t, Double_t> mChannelDeadTime; fTofCalDigiVec->clear(); @@ -2156,20 +2155,19 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { LOG(debug)<<"CCT found valid ChannelDeadtime entry "<<mChannelDeadTime[iAddr] <<", DeltaT "<<pDigi->GetTime()-mChannelDeadTime[iAddr]; */ - if ((bValid = - (pDigi->GetTime() > mChannelDeadTime[iAddr] + fdChannelDeadtime))) - { - // pCalDigi = + if ((bValid = (pDigi->GetTime() + > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { + // pCalDigi = // new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pDigi); - fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); - pCalDigi = &(fTofCalDigiVec->back()); - iDigIndCal++; - } - } else { - // pCalDigi = new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pDigi); fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); pCalDigi = &(fTofCalDigiVec->back()); iDigIndCal++; + } + } else { + // pCalDigi = new ((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi(*pDigi); + fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); + pCalDigi = &(fTofCalDigiVec->back()); + iDigIndCal++; } mChannelDeadTime[iAddr] = pDigi->GetTime(); if (!bValid) continue; @@ -2299,8 +2297,8 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { iNbTofDigi = fTofCalDigiVec->size(); // fTofCalDigisColl->GetEntries(); // update because of added duplicted digis - LOG(debug) << "CbmTofHitBuilder: Sort " - << fTofCalDigiVec->size() << " calibrated digis "; + LOG(debug) << "CbmTofHitBuilder: Sort " << fTofCalDigiVec->size() + << " calibrated digis "; if (iNbTofDigi > 1) { // fTofCalDigisColl->Sort(iNbTofDigi); // Time order again, in case modified by the calibration /// Sort the buffers of hits due to the time offsets applied @@ -2317,8 +2315,7 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); })) - LOG(warning) - << "CbmTofHitBuilder: Digi sorting not successful "; + LOG(warning) << "CbmTofHitBuilder: Digi sorting not successful "; } if (NULL != pRef) { @@ -2326,7 +2323,7 @@ Bool_t CbmDeviceHitBuilderTof::CalibRawDigis() { for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) { // pDigi = (CbmTofDigi*) fTofCalDigisColl->At(iDigInd); - pDigi = &(fTofCalDigiVec->at(iDigInd)); + pDigi = &(fTofCalDigiVec->at(iDigInd)); Int_t iAddr = pDigi->GetAddress() & DetMask; Int_t iDet = fDetIdIndexMap[iAddr]; // Detector Index Int_t iSide = pDigi->GetSide(); @@ -2420,13 +2417,13 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { //if( 0 < fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ) // fhNbDigiPerChan->Fill( fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ); - while ( - 1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (1 + < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - while ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetSide()) { + while ( + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + ->GetSide()) { // Not one Digi of each end! fiNbSameSide++; if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() @@ -2434,24 +2431,22 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { LOG(debug) << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " - << Form("%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) - ->GetTime()) + << Form( + "%f", + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) + ->GetTime()) << ", " - << Form("%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) - ->GetTime()) + << Form( + "%f", + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + ->GetTime()) << ", DeltaT " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) ->GetTime() << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size(); + << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetSide() == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] @@ -2459,40 +2454,35 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { LOG(debug) << "3 consecutive SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) ->GetTime() << ", " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc] - [iCh][0]) + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] + [0]) ->GetTime() << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] .size(); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } else { if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0] - ->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] + ->GetTime() > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc] - [iCh][1] - ->GetTime()) { + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] + [1] + ->GetTime()) { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -2512,8 +2502,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] ->GetSide()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] @@ -2526,28 +2515,25 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { << "SameSide Erase fStor entries(d) " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()) + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) break; continue; } // same condition side end LOG(debug) << "digis processing for " - << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()); - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()) { + << Form( + " SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", + iSmType, + iSm, + iRpc, + iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { LOG(debug) << Form( "Leaving digi processing for TSRC %d%d%d%d, size %3lu", iSmType, @@ -2560,18 +2546,19 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { /* Int_t iLastChId = iChId; // Save Last hit channel*/ // 2 Digis = both sides present - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo( + ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); iChId = fTofId->SetDetectorInfo(xDetInfo); Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); - LOG(debug) << Form( - "TSRC %d%d%d%d size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); + LOG(debug) + << Form("TSRC %d%d%d%d size %3lu ", + iSmType, + iSm, + iRpc, + iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) + << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { @@ -2663,17 +2650,15 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { if (xDigiC->GetSide() == xDigiA->GetSide()) { xDigiA = xDigiC; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } else { xDigiB = xDigiC; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - ++(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1)); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(++( + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + 1)); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin() @@ -2745,11 +2730,9 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -2869,7 +2852,7 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(); for (UInt_t i = 0; i < vDigiIndRef.size(); i++) { - Double_t dTot = ((CbmTofDigi*) ( &(fTofCalDigiVec->at( + Double_t dTot = ((CbmTofDigi*) (&(fTofCalDigiVec->at( vDigiIndRef.at(i))))) ->GetTot(); digiMatch->AddLink(CbmLink(dTot, @@ -2910,11 +2893,9 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() { //LOG(debug2)<<"Erase fStor entries(b) "<<iSmType<<", SR "<<iSm*iNbRpc+iRpc<<", Ch"<<iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -3229,7 +3210,8 @@ void CbmDeviceHitBuilderTof::CheckLHMemory() { iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) if (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo( + ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) @@ -3282,7 +3264,8 @@ void CbmDeviceHitBuilderTof::CleanLHMemory() { iRpc); for (Int_t iCh = 0; iCh < fDigiBdfPar->GetNbChan(iSmType, iRpc); iCh++) while (fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) { - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo( + ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iAddr = fTofId->SetDetectorInfo(xDetInfo); if (fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetAddress() != iAddr) @@ -3329,38 +3312,33 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, dLastPosY) << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (iCh == iNbCh) return kFALSE; - if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - return kFALSE; + if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) return kFALSE; //if( 0 < fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ) // fhNbDigiPerChan->Fill( fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size() ); if (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { Bool_t AddedHit = kFALSE; for (Int_t i1 = 0; - i1 - < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; + i1 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; i1++) { if (AddedHit) break; Int_t i2 = i1 + 1; while ( !AddedHit - && i2 - < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + && i2 < (Int_t) fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { // LOG(debug)<<"check digi pair "<<i1<<","<<i2<<" with size "<<fStorDigi[iSmType][iSm*iNbRpc+iRpc][iCh].size(); if ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1])->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]) - ->GetSide()) { + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2])->GetSide()) { i2++; continue; } // endif same side // 2 Digis, both sides present - CbmTofDigi* xDigiA = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; - CbmTofDigi* xDigiB = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; - Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); + CbmTofDigi* xDigiA = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; + CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; + Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist) { - CbmTofDetectorInfo xDetInfo(ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); + CbmTofDetectorInfo xDetInfo( + ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); Int_t iChId = fTofId->SetDetectorInfo(xDetInfo); fChannelInfo = fDigiPar->GetCell(iChId); gGeoManager->FindNode( @@ -3746,7 +3724,7 @@ Bool_t CbmDeviceHitBuilderTof::FillDigiStor() { //fTofCalDigisColl->GetEntriesFast(); for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) { //pDigi = (CbmTofDigi*) fTofCalDigisColl->At(iDigInd); - pDigi = &(fTofCalDigiVec->at(iDigInd)); + pDigi = &(fTofCalDigiVec->at(iDigInd)); /* LOG(info)<<"AC " // After Calibration @@ -3766,9 +3744,9 @@ Bool_t CbmDeviceHitBuilderTof::FillDigiStor() { && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { fStorDigi[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] - .push_back(pDigi); + [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()] + .push_back(pDigi); fStorDigiInd[pDigi->GetType()] [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()][pDigi->GetChannel()] @@ -3982,13 +3960,11 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() { Double_t dTotSum = 0.; for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink += 2) { // loop over digis - CbmLink L0 = digiMatch->GetLink(iLink); - Int_t iDigInd0 = L0.GetIndex(); - Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); - CbmTofDigi* pDig0 = - (CbmTofDigi*) ( &(fTofCalDigiVec->at(iDigInd0))); - CbmTofDigi* pDig1 = - (CbmTofDigi*) ( &(fTofCalDigiVec->at(iDigInd1))); + CbmLink L0 = digiMatch->GetLink(iLink); + Int_t iDigInd0 = L0.GetIndex(); + Int_t iDigInd1 = (digiMatch->GetLink(iLink + 1)).GetIndex(); + CbmTofDigi* pDig0 = (CbmTofDigi*) (&(fTofCalDigiVec->at(iDigInd0))); + CbmTofDigi* pDig1 = (CbmTofDigi*) (&(fTofCalDigiVec->at(iDigInd1))); dTotSum += pDig0->GetTot() + pDig1->GetTot(); } diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h index 30095af650..2f5e0b3bcc 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h @@ -132,14 +132,14 @@ private: // Output variables // TClonesArray* fTofCalDigisColl; // Calibrated TOF Digis - std::vector<CbmTofDigi>* fTofCalDigiVec = nullptr; // Calibrated TOF Digis - std::vector<CbmTofDigi>* fTofCalDigiVecOut = nullptr; // Calibrated TOF Digis - TClonesArray* fTofHitsColl; // TOF hits - TClonesArray* fTofDigiMatchColl; // TOF Digi Links - TClonesArray* fTofCalDigisCollOut; // Calibrated TOF Digis - TClonesArray* fTofHitsCollOut; // TOF hits - TClonesArray* fTofDigiMatchCollOut; // TOF Digi Links - Int_t fiNbHits; // Index of the CbmTofHit TClonesArray + std::vector<CbmTofDigi>* fTofCalDigiVec = nullptr; // Calibrated TOF Digis + std::vector<CbmTofDigi>* fTofCalDigiVecOut = nullptr; // Calibrated TOF Digis + TClonesArray* fTofHitsColl; // TOF hits + TClonesArray* fTofDigiMatchColl; // TOF Digi Links + TClonesArray* fTofCalDigisCollOut; // Calibrated TOF Digis + TClonesArray* fTofHitsCollOut; // TOF hits + TClonesArray* fTofDigiMatchCollOut; // TOF Digi Links + Int_t fiNbHits; // Index of the CbmTofHit TClonesArray // Constants or setting parameters Int_t fiNevtBuild; diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx index d8cade4265..08c8bfd895 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx @@ -457,7 +457,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { fviRpcChUId.resize(uNrOfChannels); UInt_t iCh = 0; for (UInt_t iGbtx = 0; iGbtx < uNrOfGbtx; iGbtx++) { - Int_t iModuleIdMap = fviModuleId[iGbtx]; + Int_t iModuleIdMap = fviModuleId[iGbtx]; switch (fviRpcType[iGbtx]) { case 0: // CBM modules @@ -568,8 +568,8 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { } } } - [[fallthrough]]; // fall through is intended - case 8: // ceramics + [[fallthrough]]; // fall through is intended + case 8: // ceramics { Int_t iModuleId = 0; Int_t iModuleType = 8; @@ -666,13 +666,12 @@ Bool_t CbmDeviceUnpackTofMcbm2018::ReInitContainers() { case 1: iRpcMap = 1; break; } if (iFeet > 2) iModuleIdMap = 1; - } - break; + } break; default:; } if (iSideMap > -1) fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); + iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; diff --git a/MQ/unpacker/CbmTbDaqBuffer.cxx b/MQ/unpacker/CbmTbDaqBuffer.cxx index 56327c7f9b..f905e27ebe 100644 --- a/MQ/unpacker/CbmTbDaqBuffer.cxx +++ b/MQ/unpacker/CbmTbDaqBuffer.cxx @@ -5,40 +5,35 @@ #include "CbmTbDaqBuffer.h" -#include <FairLogger.h> // for Logger, LOG -#include <stddef.h> // for NULL -#include <iomanip> // for setprecision, __iom_t5 -#include <sstream> // for basic_stringstream<>::string_type +#include <FairLogger.h> // for Logger, LOG #include <boost/any.hpp> +#include <iomanip> // for setprecision, __iom_t5 +#include <sstream> // for basic_stringstream<>::string_type +#include <stddef.h> // for NULL // ----- Initialisation of static variables ------------------------------ CbmTbDaqBuffer* CbmTbDaqBuffer::fgInstance = nullptr; // --------------------------------------------------------------------------- - // ----- Constructor ----------------------------------------------------- -CbmTbDaqBuffer::CbmTbDaqBuffer() : fData() { -} +CbmTbDaqBuffer::CbmTbDaqBuffer() : fData() {} // --------------------------------------------------------------------------- // ----- Destructor ------------------------------------------------------ -CbmTbDaqBuffer::~CbmTbDaqBuffer() { -} +CbmTbDaqBuffer::~CbmTbDaqBuffer() {} // --------------------------------------------------------------------------- -Double_t CbmTbDaqBuffer::GetTimeFirst() const -{ - if ( ! GetSize() ) return -1.; +Double_t CbmTbDaqBuffer::GetTimeFirst() const { + if (!GetSize()) return -1.; // Return the key from the first element in the map // The key of the map is the time of digi return fData.begin()->first; } -Double_t CbmTbDaqBuffer::GetTimeLast() const -{ - if ( ! GetSize() ) return -1.; +Double_t CbmTbDaqBuffer::GetTimeLast() const { + if (!GetSize()) return -1.; // Return the key from the last element in the map // The key of the map is the time of digi return (--fData.end())->first; @@ -48,14 +43,16 @@ Double_t CbmTbDaqBuffer::GetTimeLast() const CbmTbDaqBuffer::Data CbmTbDaqBuffer::GetNextData(Double_t time) { // --- Check for empty buffer - if ( ! fData.size() ) return std::make_pair(boost::any(), ECbmModuleId::kNotExist); + if (!fData.size()) + return std::make_pair(boost::any(), ECbmModuleId::kNotExist); // --- Get data from buffer - std::multimap<Double_t, std::pair<boost::any, ECbmModuleId>>::iterator it = fData.begin(); + std::multimap<Double_t, std::pair<boost::any, ECbmModuleId>>::iterator it = + fData.begin(); Double_t digi_time = it->first; - if ( digi_time < time ) { - boost::any digi = it->second.first; + if (digi_time < time) { + boost::any digi = it->second.first; ECbmModuleId sysID = it->second.second; fData.erase(it); return std::make_pair(digi, sysID); @@ -66,7 +63,7 @@ CbmTbDaqBuffer::Data CbmTbDaqBuffer::GetNextData(Double_t time) { // ----- Instance -------------------------------------------------------- CbmTbDaqBuffer* CbmTbDaqBuffer::Instance() { - if ( ! fgInstance ) fgInstance = new CbmTbDaqBuffer(); + if (!fgInstance) fgInstance = new CbmTbDaqBuffer(); return fgInstance; } // --------------------------------------------------------------------------- @@ -76,12 +73,12 @@ void CbmTbDaqBuffer::PrintStatus() const { Int_t size = GetSize(); std::stringstream ss; ss << "CbmTbDaqBuffer: Status "; - if ( ! size ) { + if (!size) { LOG(info) << ss.str() << "empty"; return; } - LOG(info) << ss.str() << GetSize() << " digis from " - << std::fixed << std::setprecision(9) << GetTimeFirst() * 1.e-9 << " s to " - << GetTimeLast() *1.e-9 << " s"; + LOG(info) << ss.str() << GetSize() << " digis from " << std::fixed + << std::setprecision(9) << GetTimeFirst() * 1.e-9 << " s to " + << GetTimeLast() * 1.e-9 << " s"; } // --------------------------------------------------------------------------- diff --git a/MQ/unpacker/CbmTbDaqBuffer.h b/MQ/unpacker/CbmTbDaqBuffer.h index a66952b285..3e06092a94 100644 --- a/MQ/unpacker/CbmTbDaqBuffer.h +++ b/MQ/unpacker/CbmTbDaqBuffer.h @@ -6,11 +6,11 @@ #ifndef CBMTBDAQBUFFER_H #define CBMTBDAQBUFFER_H 1 +#include "CbmDefs.h" #include <RtypesCore.h> // for Double_t, Int_t -#include <map> // for multimap, __map_const_iterator, multimap<>::... -#include <utility> // for pair #include <boost/any.hpp> -#include "CbmDefs.h" +#include <map> // for multimap, __map_const_iterator, multimap<>::... +#include <utility> // for pair /** @class CbmTbDaqBuffer ** @author Volker Friese <v.friese@gsi.de> @@ -29,15 +29,13 @@ ** to be instantiated by the sending task (digitiser) and ** deleted by the receiving class (CbmDaq). **/ -class CbmTbDaqBuffer -{ - public: - +class CbmTbDaqBuffer { +public: typedef std::pair<boost::any, ECbmModuleId> Data; - + /** Destructor **/ ~CbmTbDaqBuffer(); - + /** Pointer to next raw data object ** up to given time ** @param time maximal time [ns] @@ -48,70 +46,66 @@ class CbmTbDaqBuffer **/ // boost::any GetNextData(Double_t time); Data GetNextData(Double_t time); - - + + /** Current buffer size ** @return number of objects in buffer */ Int_t GetSize() const { return fData.size(); } - - + + /** Get first digi time **/ Double_t GetTimeFirst() const; - + /** Get last digi time **/ Double_t GetTimeLast() const; - + /** Access to singleton instance ** @return pointer to instance **/ static CbmTbDaqBuffer* Instance(); - + /** Print buffer status **/ void PrintStatus() const; /** Insert digi of any type into the buffer */ - template <class Digi> - void InsertData(Digi* digi) - { - Double_t digi_time = digi->GetTime(); - ECbmModuleId systemID = Digi::GetSystem(); - InsertData(digi, digi_time, systemID); - } - - private: - + template<class Digi> + void InsertData(Digi* digi) { + Double_t digi_time = digi->GetTime(); + ECbmModuleId systemID = Digi::GetSystem(); + InsertData(digi, digi_time, systemID); + } +private: /** Buffer management **/ std::multimap<Double_t, Data> fData; - + /** Pointer to singleton instance **/ static CbmTbDaqBuffer* fgInstance; - + /** Default constructor ** Declared private to prevent instantiation. **/ CbmTbDaqBuffer(); - - + + /** Copy constructor. Defined private to prevent usage. **/ CbmTbDaqBuffer(const CbmTbDaqBuffer&); - - + + /** Assignment operator. Defined private to prevent usage. **/ CbmTbDaqBuffer& operator=(const CbmTbDaqBuffer&); - + /** Insert data into the buffer ** @param digi pointer to data object to be inserted **/ // void InsertData(boost::any digi); - void InsertData(boost::any digi, Double_t time, ECbmModuleId systemID) - { - fData.insert(std::make_pair(time, std::make_pair(std::move(digi), systemID))); + void InsertData(boost::any digi, Double_t time, ECbmModuleId systemID) { + fData.insert( + std::make_pair(time, std::make_pair(std::move(digi), systemID))); } - }; diff --git a/MQ/unpacker/runUnpackTofMcbm2018.cxx b/MQ/unpacker/runUnpackTofMcbm2018.cxx index e4f61dd1ca..593d708d4d 100644 --- a/MQ/unpacker/runUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/runUnpackTofMcbm2018.cxx @@ -17,9 +17,9 @@ void addCustomOptions(bpo::options_description& options) { options.add_options()("ReqTint", bpo::value<uint64_t>()->default_value(100), "Time intervall length in ns"); - options.add_options() ("ReqBeam", - bpo::value<uint64_t>()->default_value(-1), - "Mandatory beam counter in event"); + options.add_options()("ReqBeam", + bpo::value<uint64_t>()->default_value(-1), + "Mandatory beam counter in event"); options.add_options()("PulserMode", bpo::value<int64_t>()->default_value(0), "Choose pulser configuration"); @@ -29,12 +29,12 @@ void addCustomOptions(bpo::options_description& options) { options.add_options()("PulTotMin", bpo::value<uint64_t>()->default_value(0), "Min pulser TimeOverThreshold"); - options.add_options() ("PulTotMax", - bpo::value<uint64_t>()->default_value(1000), - "Max pulser TimeOverThreshold"); - options.add_options() ("ToffTof", - bpo::value<double_t>()->default_value(0.), - "Time offset of Tof digis with respect to T0"); + options.add_options()("PulTotMax", + bpo::value<uint64_t>()->default_value(1000), + "Max pulser TimeOverThreshold"); + options.add_options()("ToffTof", + bpo::value<double_t>()->default_value(0.), + "Time offset of Tof digis with respect to T0"); options.add_options()("RefModType", bpo::value<int64_t>()->default_value(5), "Module type of reference counter"); diff --git a/analysis/PWGHAD/hadron/CbmHadronAnalysis.cxx b/analysis/PWGHAD/hadron/CbmHadronAnalysis.cxx index 8816cebe62..4cb095ad2c 100644 --- a/analysis/PWGHAD/hadron/CbmHadronAnalysis.cxx +++ b/analysis/PWGHAD/hadron/CbmHadronAnalysis.cxx @@ -480,18 +480,18 @@ CbmHadronAnalysis::~CbmHadronAnalysis() { void CbmHadronAnalysis::CreateHistogramms() { // Create histogramms // gROOT->cd(); - FairRunAna *fRun= FairRunAna::Instance(); - fHist = fRun->GetOutputFile(); + FairRunAna* fRun = FairRunAna::Instance(); + fHist = fRun->GetOutputFile(); LOG(info) << "CreateHistograms in " << fHist->GetName(); // gSystem->cd(fHist->GetName()); fHist->ReOpen("Update"); - fhTofHitMul = new TH1F(Form("hTofHitMul"), + fhTofHitMul = new TH1F(Form("hTofHitMul"), Form("TofHit Multiplicity; M_{TofHit} "), fiTofHitMulMax, 0., (Double_t) fiTofHitMulMax); - fhStsHitMul = new TH1F(Form("hStsHitMul"), + fhStsHitMul = new TH1F(Form("hStsHitMul"), Form("StsHit Multiplicity; M_{StsHit} "), fiTofHitMulMax, 0., @@ -3310,7 +3310,7 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { } else { mfrag = (pdgCode % 1000) / 10 * .931494028; // ignoring binding energies ... - // where is the proper mass stored ? + // where is the proper mass stored ? } Float_t Phip = RADDEG * atan2(MCTrack->GetPy(), MCTrack->GetPx()); @@ -3502,8 +3502,9 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { break; }; - default: { // intermediate mass fragments - //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< + default: + { // intermediate mass fragments + //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< //" Mass " << MCTrack->GetMass()<<","<<mfrag<<" Y " << MCTrack->GetRapidity() << //" Pt " << MCTrack->GetPt() <<endl; fa_ptm_rap_gen_imf->Fill(MCTrack->GetRapidity(), @@ -3838,8 +3839,9 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { } break; }; - default: { // intermediate mass fragments - //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< + default: + { // intermediate mass fragments + //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< //" Mass " << MCTrack->GetMass()<<","<<mfrag<<" Y " << MCTrack->GetRapidity() << //" Pt " << MCTrack->GetPt() <<endl; fa_ptm_rap_poi_imf->Fill(MCTrack->GetRapidity(), @@ -4378,8 +4380,9 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { break; }; - default: { // intermediate mass fragments - //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< + default: + { // intermediate mass fragments + //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< //" Mass " << MCTrack->GetMass()<<","<<MCTrack->GetMass()<<" Y " << MCTrack->GetRapidity() << //" Pt " << MCTrack->GetPt() <<endl; fa_ptm_rap_hit_imf->Fill(MCTrack->GetRapidity(), @@ -4770,11 +4773,8 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { Bthi = thi; // best TofHit index Btt = tt; // best TofTrack index if (verbose > 5) { - cout << Form("<DMin> gt %d, hit %d, tt %d, w: %6.2f", - i, - Bthi, - Btt, - w) + cout << Form( + "<DMin> gt %d, hit %d, tt %d, w: %6.2f", i, Bthi, Btt, w) << endl; } } @@ -4904,10 +4904,8 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { } // decide now! - if (Weight_THMUL[i][0] - < Weight_THMUL - [io] - [0]) { // new assignment better than old one -> change + if (Weight_THMUL[i][0] < Weight_THMUL + [io][0]) { // new assignment better than old one -> change if (verbose > 1) { //nh-debug cout << "<D> New cand. is better, invalidate entry for gt " << io << endl; @@ -4920,13 +4918,12 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { GlobTrack2->SetLength(0.); // signal entry invalid } else { // old assignment better than current candidate if (verbose > 0) { //nh-debug - cout - << Form( - "<D> Stick to old assignment, Bthi %d, TM %d, THM %d", - Bthi, - NTofHitTMul[Bthi], - NTHMUL[i]) - << endl; + cout << Form( + "<D> Stick to old assignment, Bthi %d, TM %d, THM %d", + Bthi, + NTofHitTMul[Bthi], + NTHMUL[i]) + << endl; } NTofHitTMul[Bthi]--; // deregister toftrack if (NTHMUL[i] > 1) { // take next one from list @@ -5218,8 +5215,9 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { MCTrack->GetPt() / MCTrack->GetMass()); break; }; - default: { // intermediate mass fragments - //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< + default: + { // intermediate mass fragments + //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< //" Mass " << MCTrack->GetMass()<<","<<MCTrack->GetMass()<<" Y " << MCTrack->GetRapidity() << //" Pt " << MCTrack->GetPt() <<endl; fa_ptm_rap_sts_imf->Fill(MCTrack->GetRapidity(), @@ -5617,8 +5615,9 @@ void CbmHadronAnalysis::ExecEvent(Option_t*) { } break; }; - default: { // intermediate mass fragments - //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< + default: + { // intermediate mass fragments + //cout << " Track k="<<k<<", pdgCode = "<<pdgCode<< //" Mass " << MCTrack->GetMass()<<","<<MCTrack->GetMass()<<" Y " << MCTrack->GetRapidity() << //" Pt " << MCTrack->GetPt() <<endl; fa_ptm_rap_glo_imf->Fill(MCTrack->GetRapidity(), @@ -5783,8 +5782,7 @@ void CbmHadronAnalysis::Finish() { // ------------------------------------------------------------------ void CbmHadronAnalysis::WriteHistogramms() { // Write histogramms to the file - if (NULL != fHist) - { + if (NULL != fHist) { TIter next(gDirectory->GetList()); TH1* h; TObject* obj; @@ -5850,13 +5848,13 @@ void CbmHadronAnalysis::ReconstructSecondaries() { */ - const Int_t fiNMixClasses = 10; - const Double_t beamRotY = -25.; - const Double_t MLAM = 1.1156; - const Double_t DMLAM = 0.015; - const Int_t NSECMASS = 2; // pi-minus, proton, he3, alpha - const Int_t iMode = 0; - Float_t secMass[NSECMASS] = {0.139, 0.938}; + const Int_t fiNMixClasses = 10; + const Double_t beamRotY = -25.; + const Double_t MLAM = 1.1156; + const Double_t DMLAM = 0.015; + const Int_t NSECMASS = 2; // pi-minus, proton, he3, alpha + const Int_t iMode = 0; + Float_t secMass[NSECMASS] = {0.139, 0.938}; switch (iMode) { case 0: // Lambda break; @@ -5881,7 +5879,7 @@ void CbmHadronAnalysis::ReconstructSecondaries() { // define some histograms Double_t MinvMin = secMass[0] + secMass[1]; cout << "Add secondary histos to " << fHist->GetName() << endl; - fhTofChi = new TH1F( + fhTofChi = new TH1F( Form("hTofChi"), Form("TofHit Merger; #chi "), 100, 0., dChiTofLim * 2.); fhDperp = new TH1F(Form("hDperp"), Form("transverse matching distance; d [cm]"), @@ -6248,10 +6246,8 @@ void CbmHadronAnalysis::ReconstructSecondaries() { << " < " << fdDistTRD; fhDTRDprim->Fill(dDtrans); if (dDtrans < fdDistTRD - && dDtrans - < dTrdDistMin - [i] - [iTrdLayer]) { // check if acceptable and take best match + && dDtrans < dTrdDistMin + [i][iTrdLayer]) { // check if acceptable and take best match Int_t iMul = iTRD[i].size(); if (dTrdDistMin[i][iTrdLayer] < 1.E3) { // modify previous entry //find old entry in vector @@ -6426,10 +6422,9 @@ void CbmHadronAnalysis::ReconstructSecondaries() { << " < " << fdDistTRD; if ( dDtrans < fdDistTRD - && dDtrans - < dTrdDistMin - [i] - [iTrdLayer]) { // check if acceptable and take best match + && dDtrans < dTrdDistMin + [i] + [iTrdLayer]) { // check if acceptable and take best match Int_t iMul = iTRD[i].size(); if (dTrdDistMin[i][iTrdLayer] < 1.E3) { // modify previous entry //find old entry in vector diff --git a/core/data/tof/CbmTofAddress.cxx b/core/data/tof/CbmTofAddress.cxx index a078dbbfec..fb15257623 100644 --- a/core/data/tof/CbmTofAddress.cxx +++ b/core/data/tof/CbmTofAddress.cxx @@ -28,8 +28,7 @@ const Int_t CbmTofAddress::fgkRpcTypeOffset = CbmTofAddress::fgkChannelIdBits + CbmTofAddress::fgkChannelIdOffset; const Int_t CbmTofAddress::fgkiModFullIdMask = - (((1 << fgkSystemBits) - 1)) - + (((1 << fgkSmIdBits) - 1) << fgkSmIdOffset) + (((1 << fgkSystemBits) - 1)) + (((1 << fgkSmIdBits) - 1) << fgkSmIdOffset) + (((1 << fgkSmTypeBits) - 1) << fgkSmTypeOffset) + (((1 << fgkRpcIdBits) - 1) << fgkRpcIdOffset) + (((1 << fgkRpcTypeBits) - 1) << fgkRpcTypeOffset); diff --git a/core/data/tof/CbmTofAddress.h b/core/data/tof/CbmTofAddress.h index 34ea4bdfaa..73854c28a1 100644 --- a/core/data/tof/CbmTofAddress.h +++ b/core/data/tof/CbmTofAddress.h @@ -126,15 +126,15 @@ public: UInt_t Channel, UInt_t Side = 0, UInt_t SmType = 0, - UInt_t RpcType = 0) { + UInt_t RpcType = 0) { return (UInt_t)( ((ToIntegralType(ECbmModuleId::kTof) & ((1 << fgkSystemBits) - 1))) + ((Sm & ((1 << fgkSmIdBits) - 1)) << fgkSmIdOffset) + ((SmType & ((1 << fgkSmTypeBits) - 1)) << fgkSmTypeOffset) + ((Side & ((1 << fgkChannelSideBits) - 1)) << fgkChannelSideOffset) - + ((Rpc & ((1 << fgkRpcIdBits) - 1)) << fgkRpcIdOffset) + + ((Rpc & ((1 << fgkRpcIdBits) - 1)) << fgkRpcIdOffset) + ((Channel & ((1 << fgkChannelIdBits) - 1)) << fgkChannelIdOffset) - + ((RpcType & ((1 << fgkRpcTypeBits) - 1)) << fgkRpcTypeOffset)); + + ((RpcType & ((1 << fgkRpcTypeBits) - 1)) << fgkRpcTypeOffset)); }; static Bool_t SameModule(UInt_t addressA, UInt_t addressB) { @@ -152,7 +152,7 @@ public: infoInput.fCell, 0, infoInput.fSMtype, - infoInput.fCounterType); + infoInput.fCounterType); }; static UInt_t ConvertCbmTofDetectorId(Int_t detIdInput) { // For now assume that the system ID will always be correct diff --git a/core/data/tof/CbmTofDetectorId.h b/core/data/tof/CbmTofDetectorId.h index acb1033673..802d2a3d3c 100644 --- a/core/data/tof/CbmTofDetectorId.h +++ b/core/data/tof/CbmTofDetectorId.h @@ -9,7 +9,7 @@ ** the information about TOF modules from a unique detetcor ID ** @author F. Uhlig <f.uhlig@gsi.de> **/ - + #ifndef CBMTOFDETECTORID_H #define CBMTOFDETECTORID_H 1 @@ -17,29 +17,61 @@ #include "CbmDefs.h" -class CbmTofDetectorInfo -{ - - public: - - CbmTofDetectorInfo() : fDetectorSystem(0), fSMtype(0), fSModule(0), - fCounter(0), fGap(0), fCell(0), fCounterType(0) {}; - - CbmTofDetectorInfo(Int_t detsystem, Int_t smtype, Int_t smodule, - Int_t counter, Int_t gap, Int_t cell) - : fDetectorSystem(detsystem), fSMtype(smtype), fSModule(smodule), - fCounter(counter), fGap(gap), fCell(cell) {}; - - CbmTofDetectorInfo(ECbmModuleId detsystem, Int_t smtype, Int_t smodule, - Int_t counter, Int_t gap, Int_t cell) - : fDetectorSystem(ToIntegralType(detsystem)), fSMtype(smtype), fSModule(smodule), - fCounter(counter), fGap(gap), fCell(cell) {fCounterType=0;}; - - CbmTofDetectorInfo(ECbmModuleId detsystem, Int_t smtype, Int_t smodule, - Int_t counter, Int_t gap, Int_t cell, Int_t counterType) - : fDetectorSystem(ToIntegralType(detsystem)), fSMtype(smtype), fSModule(smodule), - fCounter(counter), fGap(gap), fCell(cell), fCounterType(counterType) {}; - +class CbmTofDetectorInfo { + +public: + CbmTofDetectorInfo() + : fDetectorSystem(0) + , fSMtype(0) + , fSModule(0) + , fCounter(0) + , fGap(0) + , fCell(0) + , fCounterType(0) {}; + + CbmTofDetectorInfo(Int_t detsystem, + Int_t smtype, + Int_t smodule, + Int_t counter, + Int_t gap, + Int_t cell) + : fDetectorSystem(detsystem) + , fSMtype(smtype) + , fSModule(smodule) + , fCounter(counter) + , fGap(gap) + , fCell(cell) {}; + + CbmTofDetectorInfo(ECbmModuleId detsystem, + Int_t smtype, + Int_t smodule, + Int_t counter, + Int_t gap, + Int_t cell) + : fDetectorSystem(ToIntegralType(detsystem)) + , fSMtype(smtype) + , fSModule(smodule) + , fCounter(counter) + , fGap(gap) + , fCell(cell) { + fCounterType = 0; + }; + + CbmTofDetectorInfo(ECbmModuleId detsystem, + Int_t smtype, + Int_t smodule, + Int_t counter, + Int_t gap, + Int_t cell, + Int_t counterType) + : fDetectorSystem(ToIntegralType(detsystem)) + , fSMtype(smtype) + , fSModule(smodule) + , fCounter(counter) + , fGap(gap) + , fCell(cell) + , fCounterType(counterType) {}; + Int_t fDetectorSystem; Int_t fSMtype; Int_t fSModule; @@ -50,18 +82,16 @@ class CbmTofDetectorInfo }; -class CbmTofDetectorId -{ +class CbmTofDetectorId { - public: - +public: /** Constructor **/ - CbmTofDetectorId() {;} - - + CbmTofDetectorId() { ; } + + /** Destructor **/ - virtual ~CbmTofDetectorId() {;} - + virtual ~CbmTofDetectorId() { ; } + /** Get System identifier from detector ID **/ // Int_t GetSystemId(const Int_t detectorId); @@ -103,8 +133,7 @@ class CbmTofDetectorId // char* itoa(int value, char* result, int base); - private: - +private: }; #endif diff --git a/core/data/tof/CbmTofDetectorId_v21a.cxx b/core/data/tof/CbmTofDetectorId_v21a.cxx index e87afab70c..741dfbe45b 100644 --- a/core/data/tof/CbmTofDetectorId_v21a.cxx +++ b/core/data/tof/CbmTofDetectorId_v21a.cxx @@ -7,122 +7,109 @@ #include "CbmTofDetectorId_v21a.h" -#include <iostream> -#include <iomanip> +#include <iomanip> +#include <iostream> using namespace std; -const Int_t CbmTofDetectorId_v21a::shiftarray[] = {0,4,11,15,21,22,28}; -const Int_t CbmTofDetectorId_v21a::bitarray[] = {4,7, 4, 6, 1, 6, 4}; +const Int_t CbmTofDetectorId_v21a::shiftarray[] = {0, 4, 11, 15, 21, 22, 28}; +const Int_t CbmTofDetectorId_v21a::bitarray[] = {4, 7, 4, 6, 1, 6, 4}; CbmTofDetectorId_v21a::CbmTofDetectorId_v21a() - : CbmTofDetectorId(), - result_array(), - maskarray(), - modulemask(0) -{ - for (Int_t i=0; i < array_length; i++) { - maskarray[i]=(1 << bitarray[i]) - 1; + : CbmTofDetectorId(), result_array(), maskarray(), modulemask(0) { + for (Int_t i = 0; i < array_length; i++) { + maskarray[i] = (1 << bitarray[i]) - 1; } - for (Int_t i=0; i < array_length -1; i++) { - if(i==4) continue; // ignore side bit + for (Int_t i = 0; i < array_length - 1; i++) { + if (i == 4) continue; // ignore side bit modulemask |= (maskarray[i] << shiftarray[i]); } - cout << "<I> V21a module mask 0x" << setfill('0') - << setw(8) << right << hex << modulemask << endl; + cout << "<I> V21a module mask 0x" << setfill('0') << setw(8) << right << hex + << modulemask << endl; } -CbmTofDetectorInfo CbmTofDetectorId_v21a::GetDetectorInfo(const Int_t detectorId) -{ - for (Int_t i=0; i < array_length; i++) { - result_array[i] = (( detectorId >> shiftarray[i] ) & maskarray[i] ); +CbmTofDetectorInfo +CbmTofDetectorId_v21a::GetDetectorInfo(const Int_t detectorId) { + for (Int_t i = 0; i < array_length; i++) { + result_array[i] = ((detectorId >> shiftarray[i]) & maskarray[i]); } - return CbmTofDetectorInfo( (ECbmModuleId)result_array[0], result_array[2], result_array[1], - result_array[3], result_array[4], result_array[5], result_array[6]); - + return CbmTofDetectorInfo((ECbmModuleId) result_array[0], + result_array[2], + result_array[1], + result_array[3], + result_array[4], + result_array[5], + result_array[6]); } -Int_t CbmTofDetectorId_v21a::GetSystemId(Int_t detectorId) -{ +Int_t CbmTofDetectorId_v21a::GetSystemId(Int_t detectorId) { return (detectorId & maskarray[0]); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetSMType(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[2] ) & maskarray[2] ); +Int_t CbmTofDetectorId_v21a::GetSMType(const Int_t detectorId) { + return ((detectorId >> shiftarray[2]) & maskarray[2]); } -Int_t CbmTofDetectorId_v21a::GetModuleType(const Int_t detectorId) -{ +Int_t CbmTofDetectorId_v21a::GetModuleType(const Int_t detectorId) { return GetSMType(detectorId); } -Int_t CbmTofDetectorId_v21a::GetCounterType(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[6] ) & maskarray[6] ); +Int_t CbmTofDetectorId_v21a::GetCounterType(const Int_t detectorId) { + return ((detectorId >> shiftarray[6]) & maskarray[6]); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetSModule(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[1] ) & maskarray[1] ); +Int_t CbmTofDetectorId_v21a::GetSModule(const Int_t detectorId) { + return ((detectorId >> shiftarray[1]) & maskarray[1]); } -Int_t CbmTofDetectorId_v21a::GetModuleId(const Int_t detectorId) -{ +Int_t CbmTofDetectorId_v21a::GetModuleId(const Int_t detectorId) { return GetSModule(detectorId); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetCounter(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[3] ) & maskarray[3] ); +Int_t CbmTofDetectorId_v21a::GetCounter(const Int_t detectorId) { + return ((detectorId >> shiftarray[3]) & maskarray[3]); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetSide(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[4] ) & maskarray[4] ); +Int_t CbmTofDetectorId_v21a::GetSide(const Int_t detectorId) { + return ((detectorId >> shiftarray[4]) & maskarray[4]); } -Int_t CbmTofDetectorId_v21a::GetGap(const Int_t detectorId) -{ - return GetSide(detectorId); +Int_t CbmTofDetectorId_v21a::GetGap(const Int_t detectorId) { + return GetSide(detectorId); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetCell(const Int_t detectorId) -{ - return (( detectorId >> shiftarray[5] ) & maskarray[5] ); +Int_t CbmTofDetectorId_v21a::GetCell(const Int_t detectorId) { + return ((detectorId >> shiftarray[5]) & maskarray[5]); } -Int_t CbmTofDetectorId_v21a::GetStrip(const Int_t detectorId) -{ - return GetCell(detectorId); +Int_t CbmTofDetectorId_v21a::GetStrip(const Int_t detectorId) { + return GetCell(detectorId); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a::GetRegion(const Int_t /*detectorId*/) -{ +Int_t CbmTofDetectorId_v21a::GetRegion(const Int_t /*detectorId*/) { return -1; } -Int_t CbmTofDetectorId_v21a::GetCellId(const Int_t detectorId) -{ +Int_t CbmTofDetectorId_v21a::GetCellId(const Int_t detectorId) { return (detectorId & modulemask); } //----------------------------------------------------------- -Int_t CbmTofDetectorId_v21a ::SetDetectorInfo(const CbmTofDetectorInfo detInfo) -{ -/* +Int_t CbmTofDetectorId_v21a ::SetDetectorInfo( + const CbmTofDetectorInfo detInfo) { + /* std::cout << "SetDetectorInfo for " << "Mtype " << detInfo.fSMtype << ", MId " << detInfo.fSModule << " " @@ -132,13 +119,11 @@ Int_t CbmTofDetectorId_v21a ::SetDetectorInfo(const CbmTofDetectorInfo detInfo) << ", Strip " << detInfo.fCell << std::endl; */ - return ( (((detInfo.fDetectorSystem) & maskarray[0]) << shiftarray[0]) | - (((detInfo.fSMtype) & maskarray[2]) << shiftarray[2]) | - (((detInfo.fSModule) & maskarray[1]) << shiftarray[1]) | - (((detInfo.fCounter) & maskarray[3]) << shiftarray[3]) | - (((detInfo.fGap) & maskarray[4]) << shiftarray[4]) | - (((detInfo.fCell) & maskarray[5]) << shiftarray[5]) | - (((detInfo.fCounterType) & maskarray[6]) << shiftarray[6]) - ); + return ((((detInfo.fDetectorSystem) & maskarray[0]) << shiftarray[0]) + | (((detInfo.fSMtype) & maskarray[2]) << shiftarray[2]) + | (((detInfo.fSModule) & maskarray[1]) << shiftarray[1]) + | (((detInfo.fCounter) & maskarray[3]) << shiftarray[3]) + | (((detInfo.fGap) & maskarray[4]) << shiftarray[4]) + | (((detInfo.fCell) & maskarray[5]) << shiftarray[5]) + | (((detInfo.fCounterType) & maskarray[6]) << shiftarray[6])); } - diff --git a/core/data/tof/CbmTofDetectorId_v21a.h b/core/data/tof/CbmTofDetectorId_v21a.h index bb46f9efc0..fc4a79d5d1 100644 --- a/core/data/tof/CbmTofDetectorId_v21a.h +++ b/core/data/tof/CbmTofDetectorId_v21a.h @@ -16,7 +16,7 @@ ** of this class ** @author F. Uhlig <f.uhlig@gsi.de> **/ - + // 3 2 1 shift length /** Current definition: 10987654321098765432109876543210 ** System ID (kTOF=6) on bits 0-3 00000000000000000000000000001111 15 @@ -32,19 +32,17 @@ #ifndef CBMTOFDETECTORID_V21A_H #define CBMTOFDETECTORID_V21A_H 1 -#include"CbmTofDetectorId.h" +#include "CbmTofDetectorId.h" -class CbmTofDetectorId_v21a : public CbmTofDetectorId -{ +class CbmTofDetectorId_v21a : public CbmTofDetectorId { - public: - +public: /** Constructor **/ CbmTofDetectorId_v21a(); /** Destructor **/ ~CbmTofDetectorId_v21a() {}; - + /** Get complete system info from detector ID ** This will return a pointer to an integer ** array of length array_length @@ -58,25 +56,25 @@ class CbmTofDetectorId_v21a : public CbmTofDetectorId Int_t GetSMType(const Int_t detectorId); Int_t GetModuleType(const Int_t detectorId); Int_t GetCounterType(const Int_t detectorId); - - /** Get Module ID from detector ID **/ + + /** Get Module ID from detector ID **/ Int_t GetSModule(const Int_t detectorId); Int_t GetModuleId(const Int_t detectorId); - + /** Get counter ID from detector ID **/ Int_t GetCounter(const Int_t detectorId); - + /** Get sector number from detector ID **/ Int_t GetGap(const Int_t detectorId); /** Get sector number from detector ID **/ Int_t GetSide(const Int_t detectorId); - + /** Get cell number from detector ID **/ Int_t GetCell(const Int_t detectorId); /** Get Strip ID from detector ID **/ Int_t GetStrip(const Int_t detectorId); - + /** Get region number from detector ID **/ Int_t GetRegion(const Int_t detectorId); @@ -91,9 +89,8 @@ class CbmTofDetectorId_v21a : public CbmTofDetectorId ** array of length array_length **/ Int_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo); - - private: - + +private: static const Int_t array_length = 7; static const Int_t shiftarray[]; static const Int_t bitarray[]; diff --git a/core/data/tof/CbmTofTracklet.h b/core/data/tof/CbmTofTracklet.h index 0852817c1b..f2cad23c2e 100644 --- a/core/data/tof/CbmTofTracklet.h +++ b/core/data/tof/CbmTofTracklet.h @@ -268,11 +268,10 @@ private: Double_t fChiSq; // Chi2 of fit Int_t fNDF; // # of degrees of freedom CbmTofTrackletParam fTrackPar; // Track parameters at z of TofHit - FairTrackParam - fParamFirst; // Track parameters at first and last fitted hit - FairTrackParam fParamLast; // - std::vector<Int_t> fTofHit; // Index of TofHit - std::vector<Int_t> fTofDet; // DetLayer of TofHit + FairTrackParam fParamFirst; // Track parameters at first and last fitted hit + FairTrackParam fParamLast; // + std::vector<Int_t> fTofHit; // Index of TofHit + std::vector<Int_t> fTofDet; // DetLayer of TofHit std::vector<Double_t> fMatChi; // Matching Chi2 of TofHit std::vector<CbmTofHit> fhit; // vector of TofHit objects Double_t fP[4]; // transient (transfer) space point to Eve diff --git a/core/detectors/tof/CbmTofCreateDigiPar.cxx b/core/detectors/tof/CbmTofCreateDigiPar.cxx index c55304cec8..0c647f195b 100644 --- a/core/detectors/tof/CbmTofCreateDigiPar.cxx +++ b/core/detectors/tof/CbmTofCreateDigiPar.cxx @@ -441,16 +441,11 @@ void CbmTofCreateDigiPar::FillCellInfoFromGeoHandler(TString FullPath) { fZ = fGeoHandler->GetZ(FullPath); LOG(debug2) << "FCI: " << FullPath.Data(); - LOG(debug2) << "FCI: X: " << fX - << " Y: " << fY - << " Z: " << fZ - << " SizeX: " << fSizex - << " SizeY: " << fSizey; - LOG(debug2) << Form(" DetID: 0x%08x", fDetID) - << " Region: " << fRegion - << " Counter: " << fCounter - << " Gap: " << fGap - << " Cell: " << fCell; + LOG(debug2) << "FCI: X: " << fX << " Y: " << fY << " Z: " << fZ + << " SizeX: " << fSizex << " SizeY: " << fSizey; + LOG(debug2) << Form(" DetID: 0x%08x", fDetID) << " Region: " << fRegion + << " Counter: " << fCounter << " Gap: " << fGap + << " Cell: " << fCell; fCellID = fGeoHandler->GetCellId(fDetID); @@ -464,11 +459,11 @@ void CbmTofCreateDigiPar::FillCellInfoFromGeoHandler(TString FullPath) { LOG(debug2) << "FCI: Cell ID: " << Form("0x%08x", fCellID) << " detId " << Form("0x%08x", fDetID); LOG(debug2) << " Region: " << fGeoHandler->GetRegion(fCellID) - << " SMTYP: " << fGeoHandler->GetSMType(fCellID) - << " SModule: " << fGeoHandler->GetSModule(fCellID) - << " Module: " << fGeoHandler->GetCounter(fCellID) - << " Gap: " << fGeoHandler->GetGap(fCellID) - << " Cell: " << fGeoHandler->GetCell(fCellID); + << " SMTYP: " << fGeoHandler->GetSMType(fCellID) + << " SModule: " << fGeoHandler->GetSModule(fCellID) + << " Module: " << fGeoHandler->GetCounter(fCellID) + << " Gap: " << fGeoHandler->GetGap(fCellID) + << " Cell: " << fGeoHandler->GetCell(fCellID); } diff --git a/core/detectors/tof/CbmTofDigiBdfPar.cxx b/core/detectors/tof/CbmTofDigiBdfPar.cxx index 96dada9acc..d791c27b18 100644 --- a/core/detectors/tof/CbmTofDigiBdfPar.cxx +++ b/core/detectors/tof/CbmTofDigiBdfPar.cxx @@ -878,7 +878,7 @@ Int_t CbmTofDigiBdfPar::GetNbDet() const { return fiDetUId.GetSize(); } Int_t CbmTofDigiBdfPar::GetDetInd(Int_t iAddr) { //const Int_t DetMask = 0x3fffff; // v14a - const Int_t DetMask = 0x1fffff; // v21a + const Int_t DetMask = 0x1fffff; // v21a return fMapDetInd[(iAddr & DetMask)]; } diff --git a/core/detectors/tof/CbmTofGeoHandler.cxx b/core/detectors/tof/CbmTofGeoHandler.cxx index b351e24d8f..a10775ed69 100644 --- a/core/detectors/tof/CbmTofGeoHandler.cxx +++ b/core/detectors/tof/CbmTofGeoHandler.cxx @@ -113,32 +113,32 @@ Int_t CbmTofGeoHandler::CheckGeometryVersion() { || (TString(node->GetName()).Contains("v17c")) || (TString(node->GetName()).Contains("v18")) || (TString(node->GetName()).Contains("v19"))) { - LOG(info) - << "CbmTofGeoHandler::CheckGeometryVersion: Found TOF geometry " - << TString(node->GetName()) << ", treat as Id 14a "; - // if(nullptr!=fTofId) fTofId->Delete(); - fTofId = new CbmTofDetectorId_v14a(); - fGeoVersion = k14a; - - if (TString(node->GetName()).Contains("v14a_n")) { - if (fIsSimulation && 0 != fMCVersion) { - LOG(fatal) << "Using node names instead of volume names to extract " - "the module type " - << "in a MC simulation only works with GEANT3 VMC!"; - } - - fUseNodeName = kTRUE; + LOG(info) + << "CbmTofGeoHandler::CheckGeometryVersion: Found TOF geometry " + << TString(node->GetName()) << ", treat as Id 14a "; + // if(nullptr!=fTofId) fTofId->Delete(); + fTofId = new CbmTofDetectorId_v14a(); + fGeoVersion = k14a; + + if (TString(node->GetName()).Contains("v14a_n")) { + if (fIsSimulation && 0 != fMCVersion) { + LOG(fatal) << "Using node names instead of volume names to extract " + "the module type " + << "in a MC simulation only works with GEANT3 VMC!"; } - return fGeoVersion; + + fUseNodeName = kTRUE; + } + return fGeoVersion; } else if ((TString(node->GetName()).Contains("v21")) - || (TString(node->GetName()).Contains("v20"))) { - LOG(info) - << "CbmTofGeoHandler::CheckGeometryVersion: Found TOF geometry " - << TString(node->GetName()) << ", treat as Id 21a "; - // if(nullptr!=fTofId) fTofId->Delete(); - fTofId = new CbmTofDetectorId_v21a(); - fGeoVersion = k21a; - return fGeoVersion; + || (TString(node->GetName()).Contains("v20"))) { + LOG(info) + << "CbmTofGeoHandler::CheckGeometryVersion: Found TOF geometry " + << TString(node->GetName()) << ", treat as Id 21a "; + // if(nullptr!=fTofId) fTofId->Delete(); + fTofId = new CbmTofDetectorId_v21a(); + fGeoVersion = k21a; + return fGeoVersion; } else { LOG(fatal) << "Found an unknown TOF geometry."; fGeoVersion = -1; @@ -159,12 +159,12 @@ Int_t CbmTofGeoHandler::GetUniqueDetectorId(TString volName) { Int_t CbmTofGeoHandler::GetUniqueDetectorId() { - Int_t smtype = 0; - Int_t smodule = 0; - Int_t counter = 0; + Int_t smtype = 0; + Int_t smodule = 0; + Int_t counter = 0; Int_t countertype = 0; - Int_t gap = 0; - Int_t cell = 0; + Int_t gap = 0; + Int_t cell = 0; TString Volname; @@ -217,16 +217,13 @@ Int_t CbmTofGeoHandler::GetUniqueDetectorId() { << CurrentVolOffName(2) << ", " << CurrentVolOffName(1) << ", " << CurrentVolOffName(0); - TString cTemp=CurrentVolOffName(2); - TString cType=cTemp(8,2); // 1 character only - countertype=cType.Atoi(); + TString cTemp = CurrentVolOffName(2); + TString cType = cTemp(8, 2); // 1 character only + countertype = cType.Atoi(); - LOG(debug1) << " SMtype: " << smtype - << " SModule: " << smodule - << " CounterType: " << countertype - << " Counter: " << counter - << " Gap: " << gap - << " Strip: " << cell; + LOG(debug1) << " SMtype: " << smtype << " SModule: " << smodule + << " CounterType: " << countertype << " Counter: " << counter + << " Gap: " << gap << " Strip: " << cell; CbmTofDetectorInfo detInfo( ECbmModuleId::kTof, smtype, smodule, counter, gap, cell, countertype); @@ -240,12 +237,12 @@ Int_t CbmTofGeoHandler::GetUniqueDetectorId() { Int_t CbmTofGeoHandler::GetUniqueCounterId() { - Int_t smtype = 0; - Int_t smodule = 0; + Int_t smtype = 0; + Int_t smodule = 0; Int_t countertype = 0; - Int_t counter = 0; - Int_t gap = 0; - Int_t cell = 0; + Int_t counter = 0; + Int_t gap = 0; + Int_t cell = 0; TString Volname; @@ -263,38 +260,38 @@ Int_t CbmTofGeoHandler::GetUniqueCounterId() { CurrentVolOffID(1, gap); CurrentVolID(cell); } else if (fGeoVersion == k14a) { // test beam - if (fUseNodeName) { - Volname = CurrentNodeOffName(4); - } else { - Volname = CurrentVolOffName(4); - } - smtype = Volname[7] - '0'; - CurrentVolOffID(4, smodule); - CurrentVolOffID(2, counter); - CurrentVolOffID(1, gap); - CurrentVolID(cell); - // counter=smodule; // necessary for plastics - // smodule=smtype; // for test beam setup - } else if (fGeoVersion == k21a) { // test beam - if (fUseNodeName) { - Volname = CurrentNodeOffName(4); - } else { - Volname = CurrentVolOffName(4); - } - smtype = Volname[7] - '0'; - CurrentVolOffID(4, smodule); - TString cTemp=CurrentVolOffName(2); - TString cType=cTemp(8,2); // 1 character only - countertype=cType.Atoi(); - CurrentVolOffID(2, counter); - CurrentVolOffID(1, gap); - CurrentVolID(cell); + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { + Volname = CurrentVolOffName(4); + } + smtype = Volname[7] - '0'; + CurrentVolOffID(4, smodule); + CurrentVolOffID(2, counter); + CurrentVolOffID(1, gap); + CurrentVolID(cell); + // counter=smodule; // necessary for plastics + // smodule=smtype; // for test beam setup + } else if (fGeoVersion == k21a) { // test beam + if (fUseNodeName) { + Volname = CurrentNodeOffName(4); + } else { + Volname = CurrentVolOffName(4); + } + smtype = Volname[7] - '0'; + CurrentVolOffID(4, smodule); + TString cTemp = CurrentVolOffName(2); + TString cType = cTemp(8, 2); // 1 character only + countertype = cType.Atoi(); + CurrentVolOffID(2, counter); + CurrentVolOffID(1, gap); + CurrentVolID(cell); } cell = 0; - fDetectorInfoArray = - CbmTofDetectorInfo(ECbmModuleId::kTof, smtype, smodule, counter, gap, cell, countertype); + fDetectorInfoArray = CbmTofDetectorInfo( + ECbmModuleId::kTof, smtype, smodule, counter, gap, cell, countertype); gap = 0; @@ -302,12 +299,9 @@ Int_t CbmTofGeoHandler::GetUniqueCounterId() { LOG(debug1) << " Volname: " << Volname << ", " << CurrentVolOffName(3) << ", " << CurrentVolOffName(2) << ", " << CurrentVolOffName(1) << ", " << CurrentVolOffName(0); - LOG(debug1) << " SMtype: " << smtype - << " SModule: " << smodule - << " CounterType: " << countertype - << " Counter: " << counter - << " Gap: " << gap - << " Cell: " << cell; + LOG(debug1) << " SMtype: " << smtype << " SModule: " << smodule + << " CounterType: " << countertype << " Counter: " << counter + << " Gap: " << gap << " Cell: " << cell; CbmTofDetectorInfo detInfo( ECbmModuleId::kTof, smtype, smodule, counter, gap, cell, countertype); diff --git a/core/detectors/tof/CbmTofGeoHandler.h b/core/detectors/tof/CbmTofGeoHandler.h index 84d3f8477d..0ed67fe366 100644 --- a/core/detectors/tof/CbmTofGeoHandler.h +++ b/core/detectors/tof/CbmTofGeoHandler.h @@ -14,7 +14,7 @@ #ifndef CBMTOFGEOHANDLER_H #define CBMTOFGEOHANDLER_H 1 -enum TofGeometryVersions { k07a, k12a, k12b, k14a, k21a}; +enum TofGeometryVersions { k07a, k12a, k12b, k14a, k21a }; #include <Rtypes.h> // for THashConsistencyHolder, ClassDef #include <RtypesCore.h> // for Int_t, Float_t, Bool_t, kFALSE, Double_t diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx index 19c2de577f..d369b25998 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoTof.cxx @@ -30,7 +30,7 @@ #include <vector> -static Int_t NMappingWarnings=100; +static Int_t NMappingWarnings = 100; /* static uint32_t pat_mess[8]={8*0}; std::vector< std::vector <uint32_t> > Pat_Request; @@ -317,10 +317,12 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { iCh, fviRpcChUId[iCh]); break; - } // Valid T0 channel - default: { fviRpcChUId[iCh] = 0; } // Invalid T0 channel - } // switch( uCh % 4 ) - } // if( 0 == uFee ) + } // Valid T0 channel + default: { + fviRpcChUId[iCh] = 0; + } // Invalid T0 channel + } // switch( uCh % 4 ) + } // if( 0 == uFee ) iCh++; } // for( UInt_t uCh = 0; uCh < fUnpackPar->GetNrOfChannelsPerFee(); ++uCh ) @@ -382,15 +384,15 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { switch (fviRpcSide[iGbtx]) { case 0:; break; case 1:; - iRpcMap = 1 - iRpcMap; // swap counters - break; + iRpcMap = 1 - iRpcMap; // swap counters + break; case 2: switch (iFeet) { case 1: iRpcMap = iRpc[4]; iSideMap = iSide[4]; - iStrMap = 31-iStrMap; - break; + iStrMap = 31 - iStrMap; + break; case 4: iRpcMap = iRpc[1]; iSideMap = iSide[1]; @@ -450,13 +452,15 @@ Bool_t CbmMcbm2018UnpackerAlgoTof::InitParameters() { case 0: iRpcMap = 0; break; case 1: iRpcMap = 1; break; } - if (iFeet > 2) iModuleIdMap = 1; - else iModuleIdMap = 0; + if (iFeet > 2) + iModuleIdMap = 1; + else + iModuleIdMap = 0; } break; } if (iSideMap > -1) fviRpcChUId[iCh] = CbmTofAddress::GetUniqueAddress( - iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); + iModuleIdMap, iRpcMap, iStrMap, iSideMap, fviRpcType[iGbtx]); else fviRpcChUId[iCh] = 0; @@ -1162,17 +1166,13 @@ void CbmMcbm2018UnpackerAlgoTof::ProcessHit(const gdpbv100::FullMessage& mess) { << ", GBTx " << uGbtxNrInSys; */ - if( 0 == uChanUId ) { - if( 0 < NMappingWarnings-- ) - LOG(warning) << "Unused data item at " << uRemappedChannelNrInSys - << ", from GdpbNr " << fuCurrDpbIdx - << ", Get4 " << fuGet4Id - << ", Ch " << uChannel - << ", ChNr " << uChannelNr - << ", ChNrIF " << uChannelNrInFee - << ", FiS " << uFeeNrInSys - ; - return; // Hit not mapped to digi + if (0 == uChanUId) { + if (0 < NMappingWarnings--) + LOG(warning) << "Unused data item at " << uRemappedChannelNrInSys + << ", from GdpbNr " << fuCurrDpbIdx << ", Get4 " << fuGet4Id + << ", Ch " << uChannel << ", ChNr " << uChannelNr + << ", ChNrIF " << uChannelNrInFee << ", FiS " << uFeeNrInSys; + return; // Hit not mapped to digi } /// Apply offset to T0 only to TOF digis diff --git a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases2elinks.C b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases2elinks.C index db234b8b51..c0c6df76d8 100644 --- a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases2elinks.C +++ b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases2elinks.C @@ -18,7 +18,7 @@ void save_plot_to_pdf(TH1* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); plot->GetXaxis()->SetRangeUser(-1000, 996); @@ -44,7 +44,7 @@ void save_plotstack_to_pdf(THStack* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); //plot->GetXaxis()->SetRangeUser(-1000, 996); diff --git a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases5elinks.C b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases5elinks.C index 4aee241aae..7298a1fe9d 100644 --- a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases5elinks.C +++ b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCases5elinks.C @@ -18,7 +18,7 @@ void save_plot_to_pdf(TH1* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); plot->GetXaxis()->SetRangeUser(-1000, 996); @@ -44,7 +44,7 @@ void save_plotstack_to_pdf(THStack* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); //plot->GetXaxis()->SetRangeUser(-1000, 996); diff --git a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCasesMoreCond.C b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCasesMoreCond.C index f8dd4bde86..36996a26ed 100644 --- a/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCasesMoreCond.C +++ b/macro/beamtime/cosy2018/AnalyseTimeCoincidenceBugAllCasesMoreCond.C @@ -18,7 +18,7 @@ void save_plot_to_pdf(TH1* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); plot->GetXaxis()->SetRangeUser(-1000, 996); @@ -44,7 +44,7 @@ void save_plotstack_to_pdf(THStack* plot, + TString(Form("_%uch_%uch", uNbChanFixed[uFile], uNbChanScan[uFile])), canv->GetTitle() + TString( - Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); + Form(", %u ch, %u ch", uNbChanFixed[uFile], uNbChanScan[uFile]))); gStyle->SetOptStat(0); gStyle->SetPalette(105); //plot->GetXaxis()->SetRangeUser(-1000, 996); diff --git a/macro/beamtime/mcbm2018/ana_trks.C b/macro/beamtime/mcbm2018/ana_trks.C index 955db30d8b..08b1e823e1 100644 --- a/macro/beamtime/mcbm2018/ana_trks.C +++ b/macro/beamtime/mcbm2018/ana_trks.C @@ -35,16 +35,16 @@ void ana_trks(Int_t nEvents = 10000, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cCalId.Data()); diff --git a/macro/beamtime/mcbm2020/ana_trks.C b/macro/beamtime/mcbm2020/ana_trks.C index 8dcff37820..2985d9318c 100644 --- a/macro/beamtime/mcbm2020/ana_trks.C +++ b/macro/beamtime/mcbm2020/ana_trks.C @@ -47,16 +47,16 @@ void ana_trks(Int_t nEvents = 10000, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data()); @@ -76,8 +76,8 @@ void ana_trks(Int_t nEvents = 10000, TofGeo = "v20b_mcbm"; cout << "Geometry version " << TofGeo << endl; - TObjString* tofDigiBdfFile = - new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par"); + TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_" + + TofGeo + ".digibdf.par"); parFileList->Add(tofDigiBdfFile); TString geoDir = gSystem->Getenv("VMCWORKDIR"); diff --git a/macro/beamtime/mcbm2020/ana_trks_eval.C b/macro/beamtime/mcbm2020/ana_trks_eval.C index 8ebdeaafc5..71d8156c5e 100644 --- a/macro/beamtime/mcbm2020/ana_trks_eval.C +++ b/macro/beamtime/mcbm2020/ana_trks_eval.C @@ -47,16 +47,16 @@ void ana_trks_eval(Int_t nEvents = 10000, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data()); diff --git a/macro/beamtime/mcbm2020/ana_trksi.C b/macro/beamtime/mcbm2020/ana_trksi.C index 2572839904..f0f0ef6e86 100644 --- a/macro/beamtime/mcbm2020/ana_trksi.C +++ b/macro/beamtime/mcbm2020/ana_trksi.C @@ -37,16 +37,16 @@ void ana_trks(Int_t nEvents = 10000, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data()); diff --git a/macro/beamtime/mcbm2020/dis_trks.C b/macro/beamtime/mcbm2020/dis_trks.C index cb69f4f126..a6772864a3 100644 --- a/macro/beamtime/mcbm2020/dis_trks.C +++ b/macro/beamtime/mcbm2020/dis_trks.C @@ -36,16 +36,16 @@ void dis_trks(Int_t nEvents = 10, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cCalId.Data()); diff --git a/macro/beamtime/mcbm2020/mtof_reco.C b/macro/beamtime/mcbm2020/mtof_reco.C index b4795e11a9..83181e7bc7 100644 --- a/macro/beamtime/mcbm2020/mtof_reco.C +++ b/macro/beamtime/mcbm2020/mtof_reco.C @@ -241,7 +241,9 @@ void mtof_reco(Int_t nEvents = 100, // number of Timeslices std::cout << "-I- " << myName << ": Added task " << tofCluster->GetName() << std::endl; } break; - default: { ; } + default: { + ; + } } } // ------------------------------------------------------------------------- diff --git a/macro/beamtime/mcbm2020/pl_all_DigiDTFD.C b/macro/beamtime/mcbm2020/pl_all_DigiDTFD.C index f348a6e23f..692ed7c5ca 100644 --- a/macro/beamtime/mcbm2020/pl_all_DigiDTFD.C +++ b/macro/beamtime/mcbm2020/pl_all_DigiDTFD.C @@ -1,8 +1,8 @@ -void pl_all_DigiDTFD( Int_t iOpt = 0, Double_t dYmax = 0., Int_t iNDet = 2) { - Int_t iOpt1 = iOpt%10; - Int_t iOpt2 = (iOpt - iOpt1)/10 % 10; - Int_t iOpt3 = (iOpt - iOpt2*10 - iOpt1)/100 % 10; - Int_t iOpt4 = (iOpt - iOpt3*100 - iOpt2*10 - iOpt1)/1000 % 10; +void pl_all_DigiDTFD(Int_t iOpt = 0, Double_t dYmax = 0., Int_t iNDet = 2) { + Int_t iOpt1 = iOpt % 10; + Int_t iOpt2 = (iOpt - iOpt1) / 10 % 10; + Int_t iOpt3 = (iOpt - iOpt2 * 10 - iOpt1) / 100 % 10; + Int_t iOpt4 = (iOpt - iOpt3 * 100 - iOpt2 * 10 - iOpt1) / 1000 % 10; // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); @@ -11,19 +11,11 @@ void pl_all_DigiDTFD( Int_t iOpt = 0, Double_t dYmax = 0., Int_t iNDet = 2) { //can->Divide(4,4,0.01,0.01); // can->Divide(2,3,0.01,0.01); //can->Divide(5, 7, 0.01, 0.01); - switch ( iOpt3 ) { - case 0: - can->Divide(5, 7, 0.01, 0.01); - break; - case 1: - can->Divide(5, 4, 0.01, 0.01); - break; - case 3: - can->Divide(1, 4, 0.01, 0.01); - break; - case 4: - can->Divide(1, 1, 0.01, 0.01); - break; + switch (iOpt3) { + case 0: can->Divide(5, 7, 0.01, 0.01); break; + case 1: can->Divide(5, 4, 0.01, 0.01); break; + case 3: can->Divide(1, 4, 0.01, 0.01); break; + case 4: can->Divide(1, 1, 0.01, 0.01); break; } Float_t lsize = 0.07; @@ -53,89 +45,93 @@ void pl_all_DigiDTFD( Int_t iOpt = 0, Double_t dYmax = 0., Int_t iNDet = 2) { Int_t jRp = 0; // if (h!=NULL) h->Delete(); - Int_t iCol=1; + Int_t iCol = 1; for (Int_t iCh = 0; iCh < iNDet; iCh++) { for (Int_t iSm = 0; iSm < iSmNum[iCh]; iSm++) { - if (iOpt3==1) { + if (iOpt3 == 1) { can->cd(iCanv + 1); iCanv++; gROOT->cd(); - iCol=1; + iCol = 1; } else { - if(iOpt3==4 ){ - iCol=1; - if (iCh != iOpt4 ) continue; - } + if (iOpt3 == 4) { + iCol = 1; + if (iCh != iOpt4) continue; + } } for (Int_t iRpc = 0; iRpc < iRpcNum[iCh]; iRpc++) { - if (iOpt3==0) { - can->cd(iCanv + 1); - iCanv++; - gROOT->cd(); - iCol=4; - } + if (iOpt3 == 0) { + can->cd(iCanv + 1); + iCanv++; + gROOT->cd(); + iCol = 4; + } - TString hname =""; + TString hname = ""; switch (iOpt1) { case 0: - hname=Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iType[iCh], iSm, iRpc); - break; - - case 1: - hname=Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iType[iCh], iSm, iRpc); - break; - + hname = + Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iType[iCh], iSm, iRpc); + break; + + case 1: + hname = Form( + "cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iType[iCh], iSm, iRpc); + break; + default:; } iCol++; - if (iCol==5) iCol++; + if (iCol == 5) iCol++; h2 = (TH2*) gROOT->FindObjectAny(hname); TH1D* hx; TH1D* hy; TH1* hp; if (h2 != NULL) { - switch(iOpt2) { - case 0: + switch (iOpt2) { + case 0: h2->Draw("colz"); gPad->SetLogz(); - break; - case 1: - hp=(TH1*)h2->ProjectionY(); - hp->SetLineColor(iCol); - switch (iOpt3) { - case 0: - hp->Draw(); - break; - case 1: - case 4: - if (iRpc==0) { - if(dYmax>0.) hp->SetMaximum(dYmax); - hp->Draw(); - } - else - hp->Draw("same"); - } - cout << "plot " << hp->GetName() << " into canv " << iCanv << " with col " << iCol << endl; - //gPad->SetLogy(); - break; + break; + case 1: + hp = (TH1*) h2->ProjectionY(); + hp->SetLineColor(iCol); + switch (iOpt3) { + case 0: hp->Draw(); break; + case 1: + case 4: + if (iRpc == 0) { + if (dYmax > 0.) hp->SetMaximum(dYmax); + hp->Draw(); + } else + hp->Draw("same"); + } + cout << "plot " << hp->GetName() << " into canv " << iCanv + << " with col " << iCol << endl; + //gPad->SetLogy(); + break; - case 2: - h2->SetMarkerSize(5); - h2->ProfileX()->Draw(); - //gPad->SetLogz(); - break; + case 2: + h2->SetMarkerSize(5); + h2->ProfileX()->Draw(); + //gPad->SetLogz(); + break; - case 3: - for(Int_t iCh=0; iCh<h2->GetNbinsX(); iCh++) { - if(iCh==0) - h2->ProjectionY(Form("%s_py%d",h2->GetName(),iCh),iCh+1,iCh+1)->Draw(); - else { - h2->ProjectionY(Form("%s_py%d",h2->GetName(),iCh),iCh+1,iCh+1)->Draw("same"); - } - } - break; - } + case 3: + for (Int_t iCh = 0; iCh < h2->GetNbinsX(); iCh++) { + if (iCh == 0) + h2->ProjectionY( + Form("%s_py%d", h2->GetName(), iCh), iCh + 1, iCh + 1) + ->Draw(); + else { + h2->ProjectionY( + Form("%s_py%d", h2->GetName(), iCh), iCh + 1, iCh + 1) + ->Draw("same"); + } + } + break; + } } else { cout << "Histogram " << hname << " not existing. " << endl; } diff --git a/macro/beamtime/pl_pull_trk.C b/macro/beamtime/pl_pull_trk.C index 57e4ac4e5c..41368e5dcd 100644 --- a/macro/beamtime/pl_pull_trk.C +++ b/macro/beamtime/pl_pull_trk.C @@ -158,13 +158,13 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { for (Int_t i = 0; i < NSt; i++) cout << Form( - "GMean %6.3f +/- %6.5f, GSig: %6.3f +/- %6.5f => ResC %d: %6.3f ", - vMean[i], - vMeanErr[i], - vSig[i], - vSigErr[i], - i, - vRes[i]) + "GMean %6.3f +/- %6.5f, GSig: %6.3f +/- %6.5f => ResC %d: %6.3f ", + vMean[i], + vMeanErr[i], + vSig[i], + vSigErr[i], + i, + vRes[i]) << endl; cout << "Res-summary " << iVar << ": Nall, sigs = " << Nall; diff --git a/macro/mcbm/eventDisplay.C b/macro/mcbm/eventDisplay.C index d1f6ab2096..c92a34acd1 100644 --- a/macro/mcbm/eventDisplay.C +++ b/macro/mcbm/eventDisplay.C @@ -1,19 +1,20 @@ -void eventDisplay( - TString cSys="lam", - TString cEbeam="2.5gev", - TString cCentr="-", - Int_t iRun=0, - const char* setup = "sis18_mcbm") -{ +void eventDisplay(TString cSys = "lam", + TString cEbeam = "2.5gev", + TString cCentr = "-", + Int_t iRun = 0, + const char* setup = "sis18_mcbm") { - TString dataDir = "data/"; + TString dataDir = "data/"; - TString InputFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; - TString RecoFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".eds." + Form("%05d",iRun) + ".root"; - TString ParFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; + TString InputFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".mc." + Form("%05d", iRun) + ".root"; + TString RecoFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".eds." + Form("%05d", iRun) + ".root"; + TString ParFile = dataDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".params." + Form("%05d", iRun) + ".root"; // ----- Reconstruction run ------------------------------------------- - FairRunAna *fRun= new FairRunAna(); + FairRunAna* fRun = new FairRunAna(); fRun->SetInputFile(InputFile.Data()); fRun->AddFriend(RecoFile.Data()); @@ -24,139 +25,191 @@ void eventDisplay( FairLogger::GetLogger()->SetLogScreenLevel("DEBUG1"); FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); - CbmHadronAnalysis *HadronAna = new CbmHadronAnalysis(); // interpret event - HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction - Int_t parSet=0; - switch(parSet){ - case 0: // with background - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + CbmHadronAnalysis* HadronAna = new CbmHadronAnalysis(); // interpret event + HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction + Int_t parSet = 0; + switch (parSet) { + case 0: // with background + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 1: // signal with background Ni+Ni - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 1: // signal with background Ni+Ni + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 2: // signal with background Au+Au - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(8.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 2: // signal with background Au+Au + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 8.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 10: // "0" with TRD Mul 1 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(1.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 10: // "0" with TRD Mul 1 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 1.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 20: // "0" with TRD Mul 2 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(2.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 20: // "0" with TRD Mul 2 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 2.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; default: - cout << "Cut value set " <<parSet<<" not existing, stop macro "<< endl; + cout << "Cut value set " << parSet << " not existing, stop macro " + << endl; return; } fRun->AddTask(HadronAna); - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); + FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(ParFile.Data()); rtdb->setFirstInput(parInput1); - FairEventManager *fMan = new FairEventManager(); - FairMCTracks *Track = new FairMCTracks ("Monte-Carlo Tracks"); - - FairMCPointDraw *MvdPoint = new FairMCPointDraw ("MvdPoint", kBlack, kFullSquare); - FairMCPointDraw *StsPoint = new FairMCPointDraw ("StsPoint", kGreen, kFullSquare); - FairMCPointDraw *MuchPoint = new FairMCPointDraw ("MuchPoint", kOrange, kFullSquare); - FairMCPointDraw *RichPoint = new FairMCPointDraw ("RichPoint", kGreen, kFullSquare); - FairMCPointDraw *TrdPoint = new FairMCPointDraw ("TrdPoint", kBlue, kFullSquare); - FairMCPointDraw *TofPoint = new FairMCPointDraw ("TofPoint", kRed, kFullSquare); - FairMCPointDraw *EcalPoint = new FairMCPointDraw ("EcalPoint", kYellow, kFullSquare); - FairMCPointDraw *RefPlanePoint = new FairMCPointDraw ("RefPlanePoint", kPink, kFullSquare); - + FairEventManager* fMan = new FairEventManager(); + FairMCTracks* Track = new FairMCTracks("Monte-Carlo Tracks"); + + FairMCPointDraw* MvdPoint = + new FairMCPointDraw("MvdPoint", kBlack, kFullSquare); + FairMCPointDraw* StsPoint = + new FairMCPointDraw("StsPoint", kGreen, kFullSquare); + FairMCPointDraw* MuchPoint = + new FairMCPointDraw("MuchPoint", kOrange, kFullSquare); + FairMCPointDraw* RichPoint = + new FairMCPointDraw("RichPoint", kGreen, kFullSquare); + FairMCPointDraw* TrdPoint = + new FairMCPointDraw("TrdPoint", kBlue, kFullSquare); + FairMCPointDraw* TofPoint = + new FairMCPointDraw("TofPoint", kRed, kFullSquare); + FairMCPointDraw* EcalPoint = + new FairMCPointDraw("EcalPoint", kYellow, kFullSquare); + FairMCPointDraw* RefPlanePoint = + new FairMCPointDraw("RefPlanePoint", kPink, kFullSquare); + fMan->AddTask(Track); - + fMan->AddTask(MvdPoint); fMan->AddTask(StsPoint); fMan->AddTask(MuchPoint); fMan->AddTask(RichPoint); fMan->AddTask(TrdPoint); - fMan->AddTask(TofPoint); - fMan->AddTask(EcalPoint); + fMan->AddTask(TofPoint); + fMan->AddTask(EcalPoint); fMan->AddTask(RefPlanePoint); - CbmPixelHitSetDraw *StsHits = new CbmPixelHitSetDraw ("StsHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(StsHits); - CbmPixelHitSetDraw *TrdHits = new CbmPixelHitSetDraw ("TrdHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TrdHits); - CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TofHits); - CbmPixelHitSetDraw *TofUHits = new CbmPixelHitSetDraw ("TofUHit", kRed, kOpenCross ); - fMan->AddTask(TofUHits); - CbmEvDisTracks *Tracks = new CbmEvDisTracks ("Tof Tracks",1); + CbmPixelHitSetDraw* StsHits = + new CbmPixelHitSetDraw("StsHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(StsHits); + CbmPixelHitSetDraw* TrdHits = + new CbmPixelHitSetDraw("TrdHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TrdHits); + CbmPixelHitSetDraw* TofHits = + new CbmPixelHitSetDraw("TofHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TofHits); + CbmPixelHitSetDraw* TofUHits = + new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); + fMan->AddTask(TofUHits); + CbmEvDisTracks* Tracks = new CbmEvDisTracks("Tof Tracks", 1); Tracks->SetVerbose(4); fMan->AddTask(Tracks); - + // fMan->Init(1,4,10000); // fMan->Init(1,5,10000); // make STS visible by default // fMan->Init(1,6,10000); // make MVD visible by default - fMan->Init(1,7,10000); // make MVD visible by default - - cout << "gEve "<< gEve << endl; - gEve->GetDefaultGLViewer()->SetClearColor(kYellow-10); - { // from readCurrentCamera(const char* fname) - TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); - const char* fname="Cam.sav"; - TFile* f = TFile::Open(fname, "READ"); - if (!f) - return; - if (f->GetKey(c.ClassName())) { - f->GetKey(c.ClassName())->Read(&c); - c.IncTimeStamp(); - gEve->GetDefaultGLViewer()->RequestDraw(); - } + fMan->Init(1, 7, 10000); // make MVD visible by default + + cout << "gEve " << gEve << endl; + gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); + { // from readCurrentCamera(const char* fname) + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + const char* fname = "Cam.sav"; + TFile* f = TFile::Open(fname, "READ"); + if (!f) return; + if (f->GetKey(c.ClassName())) { + f->GetKey(c.ClassName())->Read(&c); + c.IncTimeStamp(); + gEve->GetDefaultGLViewer()->RequestDraw(); + } } } diff --git a/macro/mcbm/eventDisplay_reco.C b/macro/mcbm/eventDisplay_reco.C old mode 100755 new mode 100644 index 23d01941df..6ed4e48b32 --- a/macro/mcbm/eventDisplay_reco.C +++ b/macro/mcbm/eventDisplay_reco.C @@ -17,14 +17,12 @@ // // -------------------------------------------------------------------------- -void eventDisplay_reco( - TString cSys="lam", - TString cEbeam="2.5gev", - TString cCentr="-", - Int_t iRun=0, - Int_t parSet=0, - const char* setupName = "sis18_mcbm") -{ +void eventDisplay_reco(TString cSys = "lam", + TString cEbeam = "2.5gev", + TString cCentr = "-", + Int_t iRun = 0, + Int_t parSet = 0, + const char* setupName = "sis18_mcbm") { // ----- Environment -------------------------------------------------- TString myName = "run_reco_nh"; // this macro's name for screen output TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory @@ -34,10 +32,16 @@ void eventDisplay_reco( // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; - TString outDir = "data/"; - TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; // Input file (MC events) - TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; // Parameter file - TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".evt." + Form("%05d",iRun) + ".root"; // Output file + TString outDir = "data/"; + TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + + ".mc." + Form("%05d", iRun) + + ".root"; // Input file (MC events) + TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + ".params." + Form("%05d", iRun) + + ".root"; // Parameter file + TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + ".evt." + Form("%05d", iRun) + + ".root"; // Output file //FairLogger::GetLogger()->SetLogScreenLevel("WARNING"); //FairLogger::GetLogger()->SetLogScreenLevel("INFO"); @@ -48,9 +52,9 @@ void eventDisplay_reco( // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- mcbm_reco: Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); @@ -61,27 +65,30 @@ void eventDisplay_reco( // ----- Parameter files as input to the runtime database ------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList *parFileList = new TList(); + TList* parFileList = new TList(); TString geoTag; // - TRD digitisation parameters - if ( setup->GetGeoTag(kTrd, geoTag) ) { - TObjString* trdFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); + if (setup->GetGeoTag(kTrd, geoTag)) { + TObjString* trdFile = + new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); + parFileList->Add(trdFile); std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; + << trdFile->GetString() << std::endl; } // - TOF digitisation parameters - if ( setup->GetGeoTag(kTof, geoTag) ) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); + if (setup->GetGeoTag(kTof, geoTag)) { + TObjString* tofFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); + parFileList->Add(tofFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofFile->GetString() << std::endl; - TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); + << tofFile->GetString() << std::endl; + TObjString* tofBdfFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); + parFileList->Add(tofBdfFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; + << tofBdfFile->GetString() << std::endl; } // ------------------------------------------------------------------------ @@ -107,7 +114,7 @@ void eventDisplay_reco( // ----- FairRunAna --------------------------------------------------- - FairRunAna *run = new FairRunAna(); + FairRunAna* run = new FairRunAna(); run->SetInputFile(inFile); run->SetOutputFile(outFile); run->SetGenerateRunInfo(kTRUE); @@ -117,11 +124,11 @@ void eventDisplay_reco( // ------------------------------------------------------------------------ // ----- MC Data Manager ------------------------------------------------ - CbmMCDataManager* mcManager=new CbmMCDataManager("MCManager", 1); + CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); mcManager->AddFile(inFile); run->AddTask(mcManager); // ------------------------------------------------------------------------ - + // ----- Digitisers --------------------------------------------------- std::cout << std::endl; @@ -139,10 +146,10 @@ void eventDisplay_reco( std::cout << "Loading macro " << macroName << std::endl; gROOT->LoadMacro(macroName); Bool_t recoSuccess = gROOT->ProcessLine("reconstruct()"); - if ( ! recoSuccess ) { - std::cerr << "-E-" << myName << ": error in executing " << macroName - << std::endl; - return; + if (!recoSuccess) { + std::cerr << "-E-" << myName << ": error in executing " << macroName + << std::endl; + return; } // ========================================================================= @@ -156,76 +163,117 @@ void eventDisplay_reco( run->AddTask(tofQa); - CbmHadronAnalysis *HadronAna = new CbmHadronAnalysis(); // interpret event - HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction - switch(parSet){ - case 0: // with background - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + CbmHadronAnalysis* HadronAna = new CbmHadronAnalysis(); // interpret event + HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction + switch (parSet) { + case 0: // with background + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 1: // signal with background Ni+Ni - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 1: // signal with background Ni+Ni + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 2: // signal with background Au+Au - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(8.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 2: // signal with background Au+Au + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 8.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 10: // "0" with TRD Mul 1 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(1.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 10: // "0" with TRD Mul 1 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 1.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 20: // "0" with TRD Mul 2 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(2.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 20: // "0" with TRD Mul 2 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 2.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; default: - cout << "Cut value set " <<parSet<<" not existing, stop macro "<< endl; + cout << "Cut value set " << parSet << " not existing, stop macro " + << endl; return; } run->AddTask(HadronAna); @@ -233,8 +281,8 @@ void eventDisplay_reco( // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data()); parIo2->open(parFileList, "in"); @@ -242,71 +290,82 @@ void eventDisplay_reco( rtdb->setSecondInput(parIo2); rtdb->setOutput(parIo1); rtdb->saveOutput(); - // ------------------------------------------------------------------------ - - FairEventManager *fMan = new FairEventManager(); - FairMCTracks *Track = new FairMCTracks ("Monte-Carlo Tracks"); - - FairMCPointDraw *MvdPoint = new FairMCPointDraw ("MvdPoint", kBlack, kFullSquare); - FairMCPointDraw *StsPoint = new FairMCPointDraw ("StsPoint", kGreen, kFullSquare); - FairMCPointDraw *MuchPoint = new FairMCPointDraw ("MuchPoint", kOrange, kFullSquare); - FairMCPointDraw *RichPoint = new FairMCPointDraw ("RichPoint", kRed, kFullSquare); - FairMCPointDraw *TrdPoint = new FairMCPointDraw ("TrdPoint", kBlue, kFullSquare); - FairMCPointDraw *TofPoint = new FairMCPointDraw ("TofPoint", kGreen, kFullSquare); - FairMCPointDraw *EcalPoint = new FairMCPointDraw ("EcalPoint", kYellow, kFullSquare); - FairMCPointDraw *RefPlanePoint = new FairMCPointDraw ("RefPlanePoint", kPink, kFullSquare); - + // ------------------------------------------------------------------------ + + FairEventManager* fMan = new FairEventManager(); + FairMCTracks* Track = new FairMCTracks("Monte-Carlo Tracks"); + + FairMCPointDraw* MvdPoint = + new FairMCPointDraw("MvdPoint", kBlack, kFullSquare); + FairMCPointDraw* StsPoint = + new FairMCPointDraw("StsPoint", kGreen, kFullSquare); + FairMCPointDraw* MuchPoint = + new FairMCPointDraw("MuchPoint", kOrange, kFullSquare); + FairMCPointDraw* RichPoint = + new FairMCPointDraw("RichPoint", kRed, kFullSquare); + FairMCPointDraw* TrdPoint = + new FairMCPointDraw("TrdPoint", kBlue, kFullSquare); + FairMCPointDraw* TofPoint = + new FairMCPointDraw("TofPoint", kGreen, kFullSquare); + FairMCPointDraw* EcalPoint = + new FairMCPointDraw("EcalPoint", kYellow, kFullSquare); + FairMCPointDraw* RefPlanePoint = + new FairMCPointDraw("RefPlanePoint", kPink, kFullSquare); + fMan->AddTask(Track); - + fMan->AddTask(MvdPoint); fMan->AddTask(StsPoint); fMan->AddTask(MuchPoint); fMan->AddTask(RichPoint); fMan->AddTask(TrdPoint); - fMan->AddTask(TofPoint); - fMan->AddTask(EcalPoint); + fMan->AddTask(TofPoint); + fMan->AddTask(EcalPoint); fMan->AddTask(RefPlanePoint); - CbmPixelHitSetDraw *StsHits = new CbmPixelHitSetDraw ("StsHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(StsHits); - CbmPixelHitSetDraw *TrdHits = new CbmPixelHitSetDraw ("TrdHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TrdHits); - CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TofHits); - CbmPixelHitSetDraw *TofUHits = new CbmPixelHitSetDraw ("TofUHit", kRed, kOpenCross ); - fMan->AddTask(TofUHits); - CbmEvDisTracks *Tracks = new CbmEvDisTracks ("Tof Tracks",1); + CbmPixelHitSetDraw* StsHits = + new CbmPixelHitSetDraw("StsHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(StsHits); + CbmPixelHitSetDraw* TrdHits = + new CbmPixelHitSetDraw("TrdHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TrdHits); + CbmPixelHitSetDraw* TofHits = + new CbmPixelHitSetDraw("TofHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TofHits); + CbmPixelHitSetDraw* TofUHits = + new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); + fMan->AddTask(TofUHits); + CbmEvDisTracks* Tracks = new CbmEvDisTracks("Tof Tracks", 1); Tracks->SetVerbose(4); fMan->AddTask(Tracks); - + // fMan->Init(1,4,10000); // fMan->Init(1,5,10000); // make STS visible by default - fMan->Init(1,6,10000); // make MVD visible by default + fMan->Init(1, 6, 10000); // make MVD visible by default //TGeoVolume* top = gGeoManager->GetTopVolume(); //gGeoManager->SetVisOption(1); //gGeoManager->SetVisLevel(5); TObjArray* allvolumes = gGeoManager->GetListOfVolumes(); //cout<<"GeoVolumes " << gGeoManager->GetListOfVolumes()->GetEntries()<<endl; - for(Int_t i=0; i<allvolumes->GetEntries(); i++){ - TGeoVolume* vol = (TGeoVolume*)allvolumes->At(i); - TString name = vol->GetName(); - cout << " GeoVolume "<<i<<" Name: "<< name << endl; + for (Int_t i = 0; i < allvolumes->GetEntries(); i++) { + TGeoVolume* vol = (TGeoVolume*) allvolumes->At(i); + TString name = vol->GetName(); + cout << " GeoVolume " << i << " Name: " << name << endl; vol->SetTransparency(99); } - cout << "gEve "<< gEve << endl; - gEve->GetDefaultGLViewer()->SetClearColor(kYellow-10); - { // from readCurrentCamera(const char* fname) - TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); - const char* fname="Cam.sav"; - TFile* f = TFile::Open(fname, "READ"); - if (!f) - return; - if (f->GetKey(c.ClassName())) { - f->GetKey(c.ClassName())->Read(&c); - c.IncTimeStamp(); - gEve->GetDefaultGLViewer()->RequestDraw(); - } + cout << "gEve " << gEve << endl; + gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); + { // from readCurrentCamera(const char* fname) + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + const char* fname = "Cam.sav"; + TFile* f = TFile::Open(fname, "READ"); + if (!f) return; + if (f->GetKey(c.ClassName())) { + f->GetKey(c.ClassName())->Read(&c); + c.IncTimeStamp(); + gEve->GetDefaultGLViewer()->RequestDraw(); + } } // ----- Finish ------------------------------------------------------- diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_cosmicHD.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_cosmicHD.C index a3f0fb99eb..b355523c05 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_cosmicHD.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_cosmicHD.C @@ -1,42 +1,42 @@ -/// +/// /// \file derived from Create_TOF_Geometry_v18m_mCbm.C /// \brief Generates TOF geometry in Root format. -/// +/// // Changelog // // in root all sizes are given in cm -#include "TSystem.h" +#include "TFile.h" +#include "TGeoCompositeShape.h" #include "TGeoManager.h" -#include "TGeoVolume.h" #include "TGeoMaterial.h" +#include "TGeoMatrix.h" #include "TGeoMedium.h" #include "TGeoPgon.h" -#include "TGeoMatrix.h" -#include "TGeoCompositeShape.h" -#include "TFile.h" -#include "TString.h" +#include "TGeoVolume.h" #include "TList.h" -#include "TROOT.h" #include "TMath.h" +#include "TROOT.h" +#include "TString.h" +#include "TSystem.h" #include <iostream> // Name of geometry version and output file -const TString geoVersion = "tof_v20a"; // do not change +const TString geoVersion = "tof_v20a"; // do not change const TString geoVersionStand = geoVersion + "Stand"; // -const TString fileTag = "tof_v20a"; +const TString fileTag = "tof_v20a"; const TString FileNameSim = fileTag + "_cosmicHD.root"; const TString FileNameGeo = fileTag + "_cosmicHD.geo.root"; const TString FileNameInfo = fileTag + "_cosmicHD.info"; // TOF_Z_Front corresponds to front cover of outer super module towers -const Float_t TOF_Z_Front_Stand = 30; // = z=298 mCBM@SIS18 -const Float_t TOF_Z_Front = 30; +const Float_t TOF_Z_Front_Stand = 30; // = z=298 mCBM@SIS18 +const Float_t TOF_Z_Front = 30; //const Float_t TOF_Z_Front = 130; // = z=225 mCBM@SIS18 //const Float_t TOF_Z_Front = 250; // SIS 100 hadron //const Float_t TOF_Z_Front = 450; // SIS 100 hadron @@ -49,57 +49,73 @@ const Float_t TOF_Z_Front = 30; // Names of the different used materials which are used to build the modules -// The materials are defined in the global media.geo file -const TString KeepingVolumeMedium = "air"; -const TString BoxVolumeMedium = "aluminium"; -const TString NoActivGasMedium = "RPCgas_noact"; -const TString ActivGasMedium = "RPCgas"; -const TString GlasMedium = "RPCglass"; -const TString ElectronicsMedium = "carbon"; - -// Counters: +// The materials are defined in the global media.geo file +const TString KeepingVolumeMedium = "air"; +const TString BoxVolumeMedium = "aluminium"; +const TString NoActivGasMedium = "RPCgas_noact"; +const TString ActivGasMedium = "RPCgas"; +const TString GlasMedium = "RPCglass"; +const TString ElectronicsMedium = "carbon"; + +// Counters: // 0 MRPC3a // 1 MRPC3b -// 2 -// 3 -// 4 Diamond -// +// 2 +// 3 +// 4 Diamond +// // 6 Buc 2019 // 7 CERN 20gap -// 8 Ceramic Pad +// 8 Ceramic Pad const Int_t NumberOfDifferentCounterTypes = 9; -const Float_t Glass_X[NumberOfDifferentCounterTypes] = {32. , 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t Glass_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; -const Float_t Glass_Z[NumberOfDifferentCounterTypes] = {0.1, 0.1,0.1, 0.1,0.01 ,0.1,0.1, 0.1, 0.1}; - -const Float_t GasGap_X[NumberOfDifferentCounterTypes] = {32. , 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; -const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = {0.025,0.025,0.025,0.025,0.01,0.02,0.02,0.02,0.025}; - -const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {8,8,8,8,1,8,10,20,4}; +const Float_t Glass_X[NumberOfDifferentCounterTypes] = + {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t Glass_Y[NumberOfDifferentCounterTypes] = + {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; +const Float_t Glass_Z[NumberOfDifferentCounterTypes] = + {0.1, 0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1}; + +const Float_t GasGap_X[NumberOfDifferentCounterTypes] = + {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = + {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; +const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = + {0.025, 0.025, 0.025, 0.025, 0.01, 0.02, 0.02, 0.02, 0.025}; + +const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = + {8, 8, 8, 8, 1, 8, 10, 20, 4}; //const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {32,32,32,32,80,32,32,20,1}; +const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = + {32, 32, 32, 32, 80, 32, 32, 20, 1}; //const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = {-0.6,-0.6,-0.6,-0.6,-0.1,-0.6,-0.6,-0.6,-1.}; +const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = + {-0.6, -0.6, -0.6, -0.6, -0.1, -0.6, -0.6, -0.6, -1.}; -const Float_t Electronics_X[NumberOfDifferentCounterTypes] = {34.0,53.0,32.0,32.,0.3,0.1, 28.8,20.,0.1}; -const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = { 5.0, 5.0, 1.0, 1.,0.1,0.1,1.0,1.0,0.1}; -const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = { 0.3, 0.3, 0.3, 0.3,0.1,0.1,0.1,0.1,0.1}; +const Float_t Electronics_X[NumberOfDifferentCounterTypes] = + {34.0, 53.0, 32.0, 32., 0.3, 0.1, 28.8, 20., 0.1}; +const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = + {5.0, 5.0, 1.0, 1., 0.1, 0.1, 1.0, 1.0, 0.1}; +const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = + {0.3, 0.3, 0.3, 0.3, 0.1, 0.1, 0.1, 0.1, 0.1}; const Int_t NofModuleTypes = 10; -// 0 mCBM module +// 0 mCBM module // 1 STAR module // 5 Diamond // 6 Buc // 7 CERN 20 gap // 8 Ceramic -// 9 Star2 +// 9 Star2 // Aluminum box for all module types -const Float_t Module_Size_X[NofModuleTypes] = {180.,102.15,180.,180.,180.,5., 40., 30., 22.5, 100.}; -const Float_t Module_Size_Y[NofModuleTypes] = { 49., 48.3, 74., 28., 18., 5., 12., 30., 11., 49.}; -const Float_t Module_Over_Y[NofModuleTypes] = {11.5, 11., 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; -const Float_t Module_Size_Z[NofModuleTypes] = {11., 11.1, 13., 11., 11., 1., 12., 6., 6.2, 11.2}; +const Float_t Module_Size_X[NofModuleTypes] = + {180., 102.15, 180., 180., 180., 5., 40., 30., 22.5, 100.}; +const Float_t Module_Size_Y[NofModuleTypes] = + {49., 48.3, 74., 28., 18., 5., 12., 30., 11., 49.}; +const Float_t Module_Over_Y[NofModuleTypes] = + {11.5, 11., 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; +const Float_t Module_Size_Z[NofModuleTypes] = + {11., 11.1, 13., 11., 11., 1., 12., 6., 6.2, 11.2}; const Float_t Module_Thick_Alu_X_left = 0.1; const Float_t Module_Thick_Alu_X_right = 1.0; const Float_t Module_Thick_Alu_Y = 0.1; @@ -107,30 +123,38 @@ const Float_t Module_Thick_Alu_Z = 0.1; // Distance to the center of the TOF wall [cm]; const Float_t Wall_Z_Position = 400.; -const Float_t MeanTheta = 0.; +const Float_t MeanTheta = 0.; -//Type of Counter for module -const Int_t CounterTypeInModule[NofModuleTypes] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 0}; -const Int_t NCounterInModule[NofModuleTypes] = {5, 3, 3, 5, 5, 1, 2, 1, 8, 2}; +//Type of Counter for module +const Int_t CounterTypeInModule[NofModuleTypes] = + {0, 0, 1, 2, 3, 4, 6, 7, 8, 0}; +const Int_t NCounterInModule[NofModuleTypes] = {5, 3, 3, 5, 5, 1, 2, 1, 8, 2}; // Placement of the counter inside the module -const Float_t CounterXStartPosition[NofModuleTypes] = {-60., -27.74, -56.0,-60.0,-60.0, 0.0, 0., 0., -7., 0.}; -const Float_t CounterXDistance[NofModuleTypes] = { 30., 30.5, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., 0.}; -const Float_t CounterYStartPosition[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; -const Float_t CounterYDistance[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 0.}; -const Float_t CounterZDistance[NofModuleTypes] = { -2.5, 0.0, 0.0, 2.5, 2.5, 0., 6., 0., 0.1, 4.}; -const Float_t CounterZStartPosition[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -2.}; -const Float_t CounterRotationAngle[NofModuleTypes] = { 0., 10.0, 7.0, 0., 0., 0., 0., 0., 0., 0.}; +const Float_t CounterXStartPosition[NofModuleTypes] = + {-60., -27.74, -56.0, -60.0, -60.0, 0.0, 0., 0., -7., 0.}; +const Float_t CounterXDistance[NofModuleTypes] = + {30., 30.5, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., 0.}; +const Float_t CounterYStartPosition[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; +const Float_t CounterYDistance[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 0.}; +const Float_t CounterZDistance[NofModuleTypes] = + {-2.5, 0.0, 0.0, 2.5, 2.5, 0., 6., 0., 0.1, 4.}; +const Float_t CounterZStartPosition[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -2.}; +const Float_t CounterRotationAngle[NofModuleTypes] = + {0., 10.0, 7.0, 0., 0., 0., 0., 0., 0., 0.}; // Pole (support structure) -const Int_t MaxNumberOfPoles=20; +const Int_t MaxNumberOfPoles = 20; Float_t Pole_ZPos[MaxNumberOfPoles]; Float_t Pole_Col[MaxNumberOfPoles]; -Int_t NumberOfPoles=0; +Int_t NumberOfPoles = 0; -const Float_t Pole_Size_X = 20.; -const Float_t Pole_Size_Y = 300.; -const Float_t Pole_Size_Z = 10.; +const Float_t Pole_Size_X = 20.; +const Float_t Pole_Size_Y = 300.; +const Float_t Pole_Size_Z = 10.; const Float_t Pole_Thick_X = 5.; const Float_t Pole_Thick_Y = 5.; const Float_t Pole_Thick_Z = 5.; @@ -138,109 +162,114 @@ const Float_t Pole_Thick_Z = 5.; // Bars (support structure) const Float_t Bar_Size_X = 20.; const Float_t Bar_Size_Y = 20.; -Float_t Bar_Size_Z = 100.; +Float_t Bar_Size_Z = 100.; -const Int_t MaxNumberOfBars=20; +const Int_t MaxNumberOfBars = 20; Float_t Bar_ZPos[MaxNumberOfBars]; Float_t Bar_XPos[MaxNumberOfBars]; -Int_t NumberOfBars=0; +Int_t NumberOfBars = 0; -const Float_t ChamberOverlap=40; -const Float_t DxColl=158.0; //Module_Size_X-ChamberOverlap; +const Float_t ChamberOverlap = 40; +const Float_t DxColl = 158.0; //Module_Size_X-ChamberOverlap; //const Float_t Pole_Offset=Module_Size_X/2.+Pole_Size_X/2.; -const Float_t Pole_Offset=90.0+Pole_Size_X/2.; +const Float_t Pole_Offset = 90.0 + Pole_Size_X / 2.; // Position for module placement -const Float_t Inner_Module_First_Y_Position=16.; -const Float_t Inner_Module_Last_Y_Position=480.; -const Float_t Inner_Module_X_Offset=0.; // centered position in x/y +const Float_t Inner_Module_First_Y_Position = 16.; +const Float_t Inner_Module_Last_Y_Position = 480.; +const Float_t Inner_Module_X_Offset = 0.; // centered position in x/y //const Float_t Inner_Module_X_Offset=18; // shift by 16 cm in x -const Int_t Inner_Module_NTypes = 3; -const Float_t Inner_Module_Types[Inner_Module_NTypes] = {4.,3.,0.}; +const Int_t Inner_Module_NTypes = 3; +const Float_t Inner_Module_Types[Inner_Module_NTypes] = {4., 3., 0.}; //const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2.,2.,6.}; //V13_3a -const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2.,2.,1.}; //V13_3a +const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2., 2., 1.}; //V13_3a //const Float_t Inner_Module_Number[Inner_Module_NTypes] = {0.,0.,0.}; //debugging -const Float_t InnerSide_Module_X_Offset=51.; -const Float_t InnerSide_Module_NTypes = 1; +const Float_t InnerSide_Module_X_Offset = 51.; +const Float_t InnerSide_Module_NTypes = 1; const Float_t InnerSide_Module_Types[Inner_Module_NTypes] = {5.}; const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {2.}; //v13_3a //const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {0.}; //debug -const Float_t Outer_Module_First_Y_Position=0.; -const Float_t Outer_Module_Last_Y_Position=480.; -const Float_t Outer_Module_X_Offset=3.; -const Int_t Outer_Module_Col = 4; -const Int_t Outer_Module_NTypes = 2; -const Float_t Outer_Module_Types [Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,1.,1., 2.,2.,2.,2.}; -const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {9.,9.,2.,0., 0.,0.,3.,4.};//V13_3a +const Float_t Outer_Module_First_Y_Position = 0.; +const Float_t Outer_Module_Last_Y_Position = 480.; +const Float_t Outer_Module_X_Offset = 3.; +const Int_t Outer_Module_Col = 4; +const Int_t Outer_Module_NTypes = 2; +const Float_t Outer_Module_Types[Outer_Module_NTypes][Outer_Module_Col] = + {1., 1., 1., 1., 2., 2., 2., 2.}; +const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = + {9., 9., 2., 0., 0., 0., 3., 4.}; //V13_3a //const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,0.,0., 0.,0.,0.,0.};//debug -const Float_t Star2_First_Z_Position=TOF_Z_Front + 0.; -const Float_t Star2_Delta_Z_Position[3]={0.,25.,35.}; -const Float_t Star2_First_Y_Position=0.; // -const Float_t Star2_Delta_Y_Position=0.; // -const Float_t Star2_rotate_Z=0.; -const Int_t Star2_NTypes = 1; -const Float_t Star2_Types[Star2_NTypes] = {9.}; -const Float_t Star2_Number[Star2_NTypes] = {3.}; //debugging, V16b -const Float_t Star2_X_Offset[Star2_NTypes]={0.}; //{62.}; - -const Float_t Buc_First_Z_Position=TOF_Z_Front + 48.4; -const Float_t Buc_Delta_Z_Position=0.; -const Float_t Buc_First_Y_Position=0.; // -const Float_t Buc_Delta_Y_Position=0.; // -const Float_t Buc_rotate_Z=180.; -const Float_t Buc_rotate_X=180.; -const Int_t Buc_NTypes = 1; -const Float_t Buc_Types[Buc_NTypes] = {6.}; -const Float_t Buc_Number[Buc_NTypes] = {1.}; //debugging, V16b -const Float_t Buc_X_Offset[Buc_NTypes]={1.}; - -const Int_t Cer_NTypes = 3; -const Float_t Cer_Z_Position[Cer_NTypes]={(float)(TOF_Z_Front+13.2),(float)(TOF_Z_Front+15.),(float)(TOF_Z_Front+15.)}; -const Float_t Cer_X_Position[Cer_NTypes]={0.,0.,0.}; -const Float_t Cer_Y_Position[Cer_NTypes]={-1.,0.,0.}; -const Float_t Cer_rotate_Z[Cer_NTypes]={0.,0.,0.}; -const Float_t Cer_Types[Cer_NTypes] = {5.,8.,8.}; -const Float_t Cer_Number[Cer_NTypes] = {1.,1.,1.}; //V16b - -const Float_t CERN_Z_Position=TOF_Z_Front+35.; // 20 gap -const Float_t CERN_First_Y_Position=0.; -const Float_t CERN_X_Offset=3.2; //65.5; -const Float_t CERN_rotate_Z=-90.; -const Int_t CERN_NTypes = 1; -const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType! -const Float_t CERN_Number[CERN_NTypes] = {1.}; // evtl. double for split signals - -const Float_t Star_First_Z_Position=TOF_Z_Front-12.; -const Float_t Star_Delta_Z_Position=0; //20.; -const Float_t Star_First_Y_Position=0.; // -const Float_t Star_Delta_Y_Position=0.; // -const Float_t Star_rotate_Y=0; //-6.8; -const Float_t Star_rotate_Z=0.; -const Int_t Star_NTypes = 1; -const Float_t Star_Types[Star2_NTypes] = {1.}; -const Float_t Star_Number[Star2_NTypes] = {1.}; -const Float_t Star_X_Offset[Star2_NTypes]= {-5.}; +const Float_t Star2_First_Z_Position = TOF_Z_Front + 0.; +const Float_t Star2_Delta_Z_Position[3] = {0., 25., 35.}; +const Float_t Star2_First_Y_Position = 0.; // +const Float_t Star2_Delta_Y_Position = 0.; // +const Float_t Star2_rotate_Z = 0.; +const Int_t Star2_NTypes = 1; +const Float_t Star2_Types[Star2_NTypes] = {9.}; +const Float_t Star2_Number[Star2_NTypes] = {3.}; //debugging, V16b +const Float_t Star2_X_Offset[Star2_NTypes] = {0.}; //{62.}; + +const Float_t Buc_First_Z_Position = TOF_Z_Front + 48.4; +const Float_t Buc_Delta_Z_Position = 0.; +const Float_t Buc_First_Y_Position = 0.; // +const Float_t Buc_Delta_Y_Position = 0.; // +const Float_t Buc_rotate_Z = 180.; +const Float_t Buc_rotate_X = 180.; +const Int_t Buc_NTypes = 1; +const Float_t Buc_Types[Buc_NTypes] = {6.}; +const Float_t Buc_Number[Buc_NTypes] = {1.}; //debugging, V16b +const Float_t Buc_X_Offset[Buc_NTypes] = {1.}; + +const Int_t Cer_NTypes = 3; +const Float_t Cer_Z_Position[Cer_NTypes] = {(float) (TOF_Z_Front + 13.2), + (float) (TOF_Z_Front + 15.), + (float) (TOF_Z_Front + 15.)}; +const Float_t Cer_X_Position[Cer_NTypes] = {0., 0., 0.}; +const Float_t Cer_Y_Position[Cer_NTypes] = {-1., 0., 0.}; +const Float_t Cer_rotate_Z[Cer_NTypes] = {0., 0., 0.}; +const Float_t Cer_Types[Cer_NTypes] = {5., 8., 8.}; +const Float_t Cer_Number[Cer_NTypes] = {1., 1., 1.}; //V16b + +const Float_t CERN_Z_Position = TOF_Z_Front + 35.; // 20 gap +const Float_t CERN_First_Y_Position = 0.; +const Float_t CERN_X_Offset = 3.2; //65.5; +const Float_t CERN_rotate_Z = -90.; +const Int_t CERN_NTypes = 1; +const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType! +const Float_t CERN_Number[CERN_NTypes] = { + 1.}; // evtl. double for split signals + +const Float_t Star_First_Z_Position = TOF_Z_Front - 12.; +const Float_t Star_Delta_Z_Position = 0; //20.; +const Float_t Star_First_Y_Position = 0.; // +const Float_t Star_Delta_Y_Position = 0.; // +const Float_t Star_rotate_Y = 0; //-6.8; +const Float_t Star_rotate_Z = 0.; +const Int_t Star_NTypes = 1; +const Float_t Star_Types[Star2_NTypes] = {1.}; +const Float_t Star_Number[Star2_NTypes] = {1.}; +const Float_t Star_X_Offset[Star2_NTypes] = {-5.}; // some global variables -TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance -TGeoVolume* gModules[NofModuleTypes]; // Global storage for module types +TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance +TGeoVolume* gModules[NofModuleTypes]; // Global storage for module types TGeoVolume* gCounter[NumberOfDifferentCounterTypes]; TGeoVolume* gPole; TGeoVolume* gBar[MaxNumberOfBars]; -const Float_t Dia_Z_Position=-0.5-TOF_Z_Front_Stand; -const Float_t Dia_First_Y_Position=0.; -const Float_t Dia_X_Offset=0.; -const Float_t Dia_rotate_Z=0.; -const Int_t Dia_NTypes = 1; +const Float_t Dia_Z_Position = -0.5 - TOF_Z_Front_Stand; +const Float_t Dia_First_Y_Position = 0.; +const Float_t Dia_X_Offset = 0.; +const Float_t Dia_rotate_Z = 0.; +const Int_t Dia_NTypes = 1; const Float_t Dia_Types[Dia_NTypes] = {5.}; const Float_t Dia_Number[Dia_NTypes] = {1.}; -Float_t Last_Size_Y=0.; -Float_t Last_Over_Y=0.; +Float_t Last_Size_Y = 0.; +Float_t Last_Over_Y = 0.; // Forward declarations void create_materials_from_media_file(); @@ -259,28 +288,28 @@ void position_Dia(Int_t); void position_Star2(Int_t); void position_Star(Int_t); void position_Buc(Int_t); -void position_cer_modules(Int_t); +void position_cer_modules(Int_t); void position_CERN(Int_t); void dump_info_file(); void Create_TOF_Geometry_v20a_cosmicHD() { - // Load the necessary FairRoot libraries -// gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); -// basiclibs(); -// gSystem->Load("libGeoBase"); -// gSystem->Load("libParBase"); -// gSystem->Load("libBase"); + // Load the necessary FairRoot libraries + // gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); + // basiclibs(); + // gSystem->Load("libGeoBase"); + // gSystem->Load("libParBase"); + // gSystem->Load("libBase"); // Load needed material definition from media.geo file create_materials_from_media_file(); // Get the GeoManager for later usage gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom"); - gGeoMan->SetVisLevel(5); // 2 = super modules - gGeoMan->SetVisOption(0); + gGeoMan->SetVisLevel(5); // 2 = super modules + gGeoMan->SetVisOption(0); - // Create the top volume + // Create the top volume /* TGeoBBox* topbox= new TGeoBBox("", 1000., 1000., 1000.); TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air")); @@ -289,10 +318,10 @@ void Create_TOF_Geometry_v20a_cosmicHD() { TGeoVolume* top = new TGeoVolumeAssembly("TOP"); gGeoMan->SetTopVolume(top); - + TGeoRotation* tof_rotation = new TGeoRotation(); - tof_rotation->RotateY( 0. ); // angle with respect to beam axis - //tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x + tof_rotation->RotateY(0.); // angle with respect to beam axis + //tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x // tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x // tof_rotation->RotateZ( 90 ); // electronics on 12 o'clock position (top) // tof_rotation->RotateZ( 180 ); // electronics on 3 o'clock position = -x @@ -302,94 +331,95 @@ void Create_TOF_Geometry_v20a_cosmicHD() { top->AddNode(tof, 1, tof_rotation); TGeoVolume* tofstand = new TGeoVolumeAssembly(geoVersionStand); - TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); + TGeoTranslation* stand_trans = + new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); TGeoRotation* stand_rot = new TGeoRotation(); stand_rot->RotateY(0.); - TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot); + TGeoCombiTrans* stand_combi_trans = + new TGeoCombiTrans(*stand_trans, *stand_rot); tof->AddNode(tofstand, 1, stand_combi_trans); - for(Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; counterType++) { + for (Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; + counterType++) { gCounter[counterType] = create_new_counter(counterType); } - for(Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) { + for (Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) { gModules[moduleType] = create_new_tof_module(moduleType); - gModules[moduleType]->SetVisContainers(1); - } + gModules[moduleType]->SetVisContainers(1); + } // no pole // gPole = create_tof_pole(); - + // position_side_tof_modules(1); // keep order !! // position_inner_tof_modules(2); // position_inner_tof_modules(3); // position_Dia(1); - position_Star2(1); + position_Star2(1); //position_cer_modules(3); // position_CERN(1); position_Buc(1); //position_Star(1); - cout << "Outer Types "<<Outer_Module_Types[0][0]<<", "<<Outer_Module_Types[1][0] - <<", col=1: "<<Outer_Module_Types[0][1]<<", "<<Outer_Module_Types[1][1] - <<endl; - cout << "Outer Number "<<Outer_Module_Number[0][0]<<", "<<Outer_Module_Number[1][0] - <<", col=1: "<<Outer_Module_Number[0][1]<<", "<<Outer_Module_Number[1][1] - <<endl; + cout << "Outer Types " << Outer_Module_Types[0][0] << ", " + << Outer_Module_Types[1][0] << ", col=1: " << Outer_Module_Types[0][1] + << ", " << Outer_Module_Types[1][1] << endl; + cout << "Outer Number " << Outer_Module_Number[0][0] << ", " + << Outer_Module_Number[1][0] << ", col=1: " << Outer_Module_Number[0][1] + << ", " << Outer_Module_Number[1][1] << endl; // position_outer_tof_modules(4); // position_tof_poles(0); // position_tof_bars(0); - + gGeoMan->CloseGeometry(); gGeoMan->CheckOverlaps(0.001); gGeoMan->PrintOverlaps(); gGeoMan->Test(); - TFile* outfile1 = new TFile(FileNameSim,"RECREATE"); + TFile* outfile1 = new TFile(FileNameSim, "RECREATE"); top->Write(); //gGeoMan->Write(); outfile1->Close(); - TFile* outfile2 = new TFile(FileNameGeo,"RECREATE"); + TFile* outfile2 = new TFile(FileNameGeo, "RECREATE"); gGeoMan->Write(); outfile2->Close(); dump_info_file(); - top->SetVisContainers(1); - gGeoMan->SetVisLevel(5); + top->SetVisContainers(1); + gGeoMan->SetVisLevel(5); top->Draw("ogl"); //top->Draw(); //gModules[0]->Draw("ogl"); // gModules[0]->Draw(""); - gModules[0]->SetVisContainers(1); + gModules[0]->SetVisContainers(1); // gModules[1]->Draw(""); - gModules[1]->SetVisContainers(1); + gModules[1]->SetVisContainers(1); //gModules[5]->Draw(""); // top->Raytrace(); - } -void create_materials_from_media_file() -{ +void create_materials_from_media_file() { // Use the FairRoot geometry interface to load the media which are already defined - FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader"); + FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader"); FairGeoInterface* geoFace = geoLoad->getGeoInterface(); - TString geoPath = gSystem->Getenv("VMCWORKDIR"); - TString geoFile = geoPath + "/geometry/media.geo"; + TString geoPath = gSystem->Getenv("VMCWORKDIR"); + TString geoFile = geoPath + "/geometry/media.geo"; geoFace->setMediaFile(geoFile); geoFace->readMedia(); // Read the required media and create them in the GeoManager - FairGeoMedia* geoMedia = geoFace->getMedia(); + FairGeoMedia* geoMedia = geoFace->getMedia(); FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder(); - FairGeoMedium* air = geoMedia->getMedium("air"); - FairGeoMedium* aluminium = geoMedia->getMedium("aluminium"); - FairGeoMedium* RPCgas = geoMedia->getMedium("RPCgas"); - FairGeoMedium* RPCgas_noact = geoMedia->getMedium("RPCgas_noact"); - FairGeoMedium* RPCglass = geoMedia->getMedium("RPCglass"); - FairGeoMedium* carbon = geoMedia->getMedium("carbon"); + FairGeoMedium* air = geoMedia->getMedium("air"); + FairGeoMedium* aluminium = geoMedia->getMedium("aluminium"); + FairGeoMedium* RPCgas = geoMedia->getMedium("RPCgas"); + FairGeoMedium* RPCgas_noact = geoMedia->getMedium("RPCgas_noact"); + FairGeoMedium* RPCglass = geoMedia->getMedium("RPCglass"); + FairGeoMedium* carbon = geoMedia->getMedium("carbon"); // include check if all media are found @@ -401,65 +431,64 @@ void create_materials_from_media_file() geoBuild->createMedium(carbon); } -TGeoVolume* create_counter(Int_t modType) -{ +TGeoVolume* create_counter(Int_t modType) { //glass - Float_t gdx=Glass_X[modType]; - Float_t gdy=Glass_Y[modType]; - Float_t gdz=Glass_Z[modType]; + Float_t gdx = Glass_X[modType]; + Float_t gdy = Glass_Y[modType]; + Float_t gdz = Glass_Z[modType]; //gas gap - Int_t nstrips=NumberOfReadoutStrips[modType]; - Int_t ngaps=NumberOfGaps[modType]; + Int_t nstrips = NumberOfReadoutStrips[modType]; + Int_t ngaps = NumberOfGaps[modType]; - Float_t ggdx=GasGap_X[modType]; - Float_t ggdy=GasGap_Y[modType]; - Float_t ggdz=GasGap_Z[modType]; - Float_t gsdx=ggdx/float(nstrips); + Float_t ggdx = GasGap_X[modType]; + Float_t ggdy = GasGap_Y[modType]; + Float_t ggdz = GasGap_Z[modType]; + Float_t gsdx = ggdx / float(nstrips); //single stack - Float_t dzpos=gdz+ggdz; - Float_t startzpos=SingleStackStartPosition_Z[modType]; + Float_t dzpos = gdz + ggdz; + Float_t startzpos = SingleStackStartPosition_Z[modType]; // electronics - //pcb dimensions - Float_t dxe=Electronics_X[modType]; - Float_t dye=Electronics_Y[modType]; - Float_t dze=Electronics_Z[modType]; - Float_t yele=(gdy+0.1)/2.+dye/2.; - + //pcb dimensions + Float_t dxe = Electronics_X[modType]; + Float_t dye = Electronics_Y[modType]; + Float_t dze = Electronics_Z[modType]; + Float_t yele = (gdy + 0.1) / 2. + dye / 2.; + // needed materials - TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); - TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); - TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); + TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); + TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // Single glass plate - TGeoBBox* glass_plate = new TGeoBBox("", gdx/2., gdy/2., gdz/2.); - TGeoVolume* glass_plate_vol = + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* glass_plate_trans - = new TGeoTranslation("", 0., 0., 0.); + glass_plate_vol->SetLineColor( + kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., 0.); // Single gas gap - TGeoBBox* gas_gap = new TGeoBBox("", ggdx/2., ggdy/2., ggdz/2.); - //TGeoVolume* gas_gap_vol = + TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); + //TGeoVolume* gas_gap_vol = //new TGeoVolume("tof_gas_gap", gas_gap, noActiveGasVolMed); - TGeoVolume* gas_gap_vol = + TGeoVolume* gas_gap_vol = new TGeoVolume("tof_gas_active", gas_gap, activeGasVolMed); - gas_gap_vol->Divide("Strip",1,nstrips,-ggdx/2.,0); + gas_gap_vol->Divide("Strip", 1, nstrips, -ggdx / 2., 0); - gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap - gas_gap_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_gap_trans - = new TGeoTranslation("", 0., 0., (gdz+ggdz)/2.); + gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap + gas_gap_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* gas_gap_trans = + new TGeoTranslation("", 0., 0., (gdz + ggdz) / 2.); - - // Single subdivided active gas gap + + // Single subdivided active gas gap /* TGeoBBox* gas_active = new TGeoBBox("", gsdx/2., ggdy/2., ggdz/2.); TGeoVolume* gas_active_vol = @@ -480,264 +509,264 @@ TGeoVolume* create_counter(Int_t modType) gas_gap_vol->AddNode(gas_active_vol, l, gas_active_trans); // single_stack->AddNode(gas_active_vol, l, gas_active_trans); } - */ + */ // Add 8 single stacks + one glass plate at the e09.750nd to a multi stack TGeoVolume* multi_stack = new TGeoVolumeAssembly("multi_stack"); Int_t l; - for (l=0; l<ngaps; l++){ - TGeoTranslation* single_stack_trans - = new TGeoTranslation("", 0., 0., startzpos + l*dzpos); + for (l = 0; l < ngaps; l++) { + TGeoTranslation* single_stack_trans = + new TGeoTranslation("", 0., 0., startzpos + l * dzpos); multi_stack->AddNode(single_stack, l, single_stack_trans); } - TGeoTranslation* single_glass_back_trans - = new TGeoTranslation("", 0., 0., startzpos + ngaps*dzpos); + TGeoTranslation* single_glass_back_trans = + new TGeoTranslation("", 0., 0., startzpos + ngaps * dzpos); multi_stack->AddNode(glass_plate_vol, l, single_glass_back_trans); - + // Add electronics above and below the glass stack to build a complete counter - TGeoVolume* counter = new TGeoVolumeAssembly("counter"); - TGeoTranslation* multi_stack_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoVolume* counter = new TGeoVolumeAssembly("counter"); + TGeoTranslation* multi_stack_trans = new TGeoTranslation("", 0., 0., 0.); counter->AddNode(multi_stack, l, multi_stack_trans); - TGeoBBox* pcb = new TGeoBBox("", dxe/2., dye/2., dze/2.); - TGeoVolume* pcb_vol = - new TGeoVolume("pcb", pcb, electronicsVolMed); - pcb_vol->SetLineColor(kCyan); // set line color for the gas gap - pcb_vol->SetTransparency(10); // set transparency for the TOF - for (Int_t l=0; l<2; l++){ + TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.); + TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed); + pcb_vol->SetLineColor(kCyan); // set line color for the gas gap + pcb_vol->SetTransparency(10); // set transparency for the TOF + for (Int_t l = 0; l < 2; l++) { yele *= -1.; - TGeoTranslation* pcb_trans - = new TGeoTranslation("", 0., yele, 0.); + TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.); counter->AddNode(pcb_vol, l, pcb_trans); } return counter; - } -TGeoVolume* create_new_counter(Int_t modType) -{ +TGeoVolume* create_new_counter(Int_t modType) { //glass - Float_t gdx=Glass_X[modType]; - Float_t gdy=Glass_Y[modType]; - Float_t gdz=Glass_Z[modType]; + Float_t gdx = Glass_X[modType]; + Float_t gdy = Glass_Y[modType]; + Float_t gdz = Glass_Z[modType]; //gas gap - Int_t nstrips=NumberOfReadoutStrips[modType]; - Int_t ngaps=NumberOfGaps[modType]; + Int_t nstrips = NumberOfReadoutStrips[modType]; + Int_t ngaps = NumberOfGaps[modType]; - Float_t ggdx=GasGap_X[modType]; - Float_t ggdy=GasGap_Y[modType]; - Float_t ggdz=GasGap_Z[modType]; - Float_t gsdx=ggdx/(Float_t)(nstrips); + Float_t ggdx = GasGap_X[modType]; + Float_t ggdy = GasGap_Y[modType]; + Float_t ggdz = GasGap_Z[modType]; + Float_t gsdx = ggdx / (Float_t)(nstrips); // electronics - //pcb dimensions - Float_t dxe=Electronics_X[modType]; - Float_t dye=Electronics_Y[modType]; - Float_t dze=Electronics_Z[modType]; - Float_t yele=gdy/2.+dye/2.; - + //pcb dimensions + Float_t dxe = Electronics_X[modType]; + Float_t dye = Electronics_Y[modType]; + Float_t dze = Electronics_Z[modType]; + Float_t yele = gdy / 2. + dye / 2.; + // counter size (calculate from glas, gap and electronics sizes) Float_t cdx = TMath::Max(gdx, ggdx); - cdx = TMath::Max(cdx, dxe)+ 0.2; - Float_t cdy = TMath::Max(gdy, ggdy) + 2*dye + 0.2; - Float_t cdz = ngaps * ggdz + (ngaps+1) * gdz + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok + cdx = TMath::Max(cdx, dxe) + 0.2; + Float_t cdy = TMath::Max(gdy, ggdy) + 2 * dye + 0.2; + Float_t cdz = ngaps * ggdz + (ngaps + 1) * gdz + + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok //calculate thickness and first position in counter of single stack - Float_t dzpos = gdz+ggdz; - Float_t startzposglas= -ngaps * (gdz + ggdz) /2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok - Float_t startzposgas = startzposglas + gdz/2. + ggdz/2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok + Float_t dzpos = gdz + ggdz; + Float_t startzposglas = + -ngaps * (gdz + ggdz) + / 2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok + Float_t startzposgas = + startzposglas + gdz / 2. + ggdz / 2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok // needed materials - TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); - TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); - TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); + TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); + TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // define counter volume - TGeoBBox* counter_box = new TGeoBBox("", cdx/2., cdy/2., cdz/2.); - TGeoVolume* counter = + TGeoBBox* counter_box = new TGeoBBox("", cdx / 2., cdy / 2., cdz / 2.); + TGeoVolume* counter = new TGeoVolume("counter", counter_box, noActiveGasVolMed); - counter->SetLineColor(kCyan); // set line color for the counter - counter->SetTransparency(70); // set transparency for the TOF + counter->SetLineColor(kCyan); // set line color for the counter + counter->SetTransparency(70); // set transparency for the TOF // define single glass plate volume - TGeoBBox* glass_plate = new TGeoBBox("", gdx/2., gdy/2., gdz/2.); - TGeoVolume* glass_plate_vol = + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF + glass_plate_vol->SetLineColor( + kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF // define single gas gap volume - TGeoBBox* gas_gap = new TGeoBBox("", ggdx/2., ggdy/2., ggdz/2.); - TGeoVolume* gas_gap_vol = - new TGeoVolume("Gap", gas_gap, activeGasVolMed); - gas_gap_vol->Divide("Cell",1,nstrips,-ggdx/2.,0); - gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap - gas_gap_vol->SetTransparency(99); // set transparency for the TOF - + TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); + TGeoVolume* gas_gap_vol = new TGeoVolume("Gap", gas_gap, activeGasVolMed); + gas_gap_vol->Divide("Cell", 1, nstrips, -ggdx / 2., 0); + gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap + gas_gap_vol->SetTransparency(99); // set transparency for the TOF + // place 8 gas gaps and 9 glas plates in the counter - for( Int_t igap = 0; igap <= ngaps; igap++) { + for (Int_t igap = 0; igap <= ngaps; igap++) { // place (ngaps+1) glass plates - Float_t zpos_glas = startzposglas + igap*dzpos; - TGeoTranslation* glass_plate_trans - = new TGeoTranslation("", 0., 0., zpos_glas); + Float_t zpos_glas = startzposglas + igap * dzpos; + TGeoTranslation* glass_plate_trans = + new TGeoTranslation("", 0., 0., zpos_glas); counter->AddNode(glass_plate_vol, igap, glass_plate_trans); // place ngaps gas gaps - if (igap < ngaps) - { - Float_t zpos_gas = startzposgas + igap*dzpos; - TGeoTranslation* gas_gap_trans - = new TGeoTranslation("", 0., 0., zpos_gas); + if (igap < ngaps) { + Float_t zpos_gas = startzposgas + igap * dzpos; + TGeoTranslation* gas_gap_trans = + new TGeoTranslation("", 0., 0., zpos_gas); counter->AddNode(gas_gap_vol, igap, gas_gap_trans); } -// cout <<"Zpos(Glas): "<< zpos_glas << endl; -// cout <<"Zpos(Gas): "<< zpos_gas << endl; + // cout <<"Zpos(Glas): "<< zpos_glas << endl; + // cout <<"Zpos(Gas): "<< zpos_gas << endl; } - + // create and place the electronics above and below the glas stack - TGeoBBox* pcb = new TGeoBBox("", dxe/2., dye/2., dze/2.); - TGeoVolume* pcb_vol = - new TGeoVolume("pcb", pcb, electronicsVolMed); + TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.); + TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed); pcb_vol->SetLineColor(kYellow); // kCyan); // set line color for electronics - pcb_vol->SetTransparency(10); // set transparency for the TOF - for (Int_t l=0; l<2; l++){ + pcb_vol->SetTransparency(10); // set transparency for the TOF + for (Int_t l = 0; l < 2; l++) { yele *= -1.; - TGeoTranslation* pcb_trans - = new TGeoTranslation("", 0., yele, 0.); + TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.); counter->AddNode(pcb_vol, l, pcb_trans); } - - return counter; + return counter; } -TGeoVolume* create_tof_module(Int_t modType) -{ - Int_t cType = CounterTypeInModule[modType]; - Float_t dx=Module_Size_X[modType]; - Float_t dy=Module_Size_Y[modType]; - Float_t dz=Module_Size_Z[modType]; - Float_t width_aluxl=Module_Thick_Alu_X_left; - Float_t width_aluxr=Module_Thick_Alu_X_right; - Float_t width_aluy=Module_Thick_Alu_Y; - Float_t width_aluz=Module_Thick_Alu_Z; +TGeoVolume* create_tof_module(Int_t modType) { + Int_t cType = CounterTypeInModule[modType]; + Float_t dx = Module_Size_X[modType]; + Float_t dy = Module_Size_Y[modType]; + Float_t dz = Module_Size_Z[modType]; + Float_t width_aluxl = Module_Thick_Alu_X_left; + Float_t width_aluxr = Module_Thick_Alu_X_right; + Float_t width_aluy = Module_Thick_Alu_Y; + Float_t width_aluz = Module_Thick_Alu_Z; - Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left)/2; + Float_t shift_gas_box = + (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; - Float_t dxpos=CounterXDistance[modType]; - Float_t startxpos=CounterXStartPosition[modType]; - Float_t dzoff=CounterZDistance[modType]; - Float_t rotangle=CounterRotationAngle[modType]; + Float_t dxpos = CounterXDistance[modType]; + Float_t startxpos = CounterXStartPosition[modType]; + Float_t dzoff = CounterZDistance[modType]; + Float_t rotangle = CounterRotationAngle[modType]; - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TString moduleName = Form("module_%d", modType); TGeoVolume* module = new TGeoVolumeAssembly(moduleName); - TGeoBBox* alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* alu_box_vol = - new TGeoVolume("alu_box", alu_box, boxVolMed); - alu_box_vol->SetLineColor(kGreen); // set line color for the alu box - alu_box_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* alu_box_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoBBox* alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* alu_box_vol = new TGeoVolume("alu_box", alu_box, boxVolMed); + alu_box_vol->SetLineColor(kGreen); // set line color for the alu box + alu_box_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* alu_box_trans = new TGeoTranslation("", 0., 0., 0.); module->AddNode(alu_box_vol, 0, alu_box_trans); - TGeoBBox* gas_box = new TGeoBBox("", (dx-(width_aluxl+width_aluxr))/2., (dy-2*width_aluy)/2., (dz-2*width_aluz)/2.); - TGeoVolume* gas_box_vol = + TGeoBBox* gas_box = new TGeoBBox("", + (dx - (width_aluxl + width_aluxr)) / 2., + (dy - 2 * width_aluy) / 2., + (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); - gas_box_vol->SetLineColor(kYellow); // set line color for the gas box - gas_box_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_box_trans - = new TGeoTranslation("", shift_gas_box, 0., 0.); + gas_box_vol->SetLineColor(kYellow); // set line color for the gas box + gas_box_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* gas_box_trans = + new TGeoTranslation("", shift_gas_box, 0., 0.); alu_box_vol->AddNode(gas_box_vol, 0, gas_box_trans); - - for (Int_t j=0; j<5; j++){ //loop over counters (modules) + + for (Int_t j = 0; j < 5; j++) { //loop over counters (modules) Float_t zpos; if (0 == modType) { - zpos = dzoff *=-1; + zpos = dzoff *= -1; } else { zpos = 0.; } - //cout << "counter z position " << zpos << endl; - TGeoTranslation* counter_trans - = new TGeoTranslation("", startxpos+ j*dxpos , 0.0 , zpos); + //cout << "counter z position " << zpos << endl; + TGeoTranslation* counter_trans = + new TGeoTranslation("", startxpos + j * dxpos, 0.0, zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = + new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } return module; } -TGeoVolume* create_new_tof_module(Int_t modType) -{ - Int_t cType = CounterTypeInModule[modType]; - Float_t dx=Module_Size_X[modType]; - Float_t dy=Module_Size_Y[modType]; - Float_t dz=Module_Size_Z[modType]; - Float_t width_aluxl=Module_Thick_Alu_X_left; - Float_t width_aluxr=Module_Thick_Alu_X_right; - Float_t width_aluy=Module_Thick_Alu_Y; - Float_t width_aluz=Module_Thick_Alu_Z; - - Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left)/2; - - Float_t dxpos=CounterXDistance[modType]; - Float_t startxpos=CounterXStartPosition[modType]; - Float_t dypos=CounterYDistance[modType]; - Float_t startypos=CounterYStartPosition[modType]; - Float_t dzoff=CounterZDistance[modType]; - Float_t rotangle=CounterRotationAngle[modType]; - - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); +TGeoVolume* create_new_tof_module(Int_t modType) { + Int_t cType = CounterTypeInModule[modType]; + Float_t dx = Module_Size_X[modType]; + Float_t dy = Module_Size_Y[modType]; + Float_t dz = Module_Size_Z[modType]; + Float_t width_aluxl = Module_Thick_Alu_X_left; + Float_t width_aluxr = Module_Thick_Alu_X_right; + Float_t width_aluy = Module_Thick_Alu_Y; + Float_t width_aluz = Module_Thick_Alu_Z; + + Float_t shift_gas_box = + (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; + + Float_t dxpos = CounterXDistance[modType]; + Float_t startxpos = CounterXStartPosition[modType]; + Float_t dypos = CounterYDistance[modType]; + Float_t startypos = CounterYStartPosition[modType]; + Float_t dzoff = CounterZDistance[modType]; + Float_t rotangle = CounterRotationAngle[modType]; + + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TString moduleName = Form("module_%d", modType); - TGeoBBox* module_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* module = - new TGeoVolume(moduleName, module_box, boxVolMed); - module->SetLineColor(kGreen); // set line color for the alu box - module->SetTransparency(20); // set transparency for the TOF + TGeoBBox* module_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* module = new TGeoVolume(moduleName, module_box, boxVolMed); + module->SetLineColor(kGreen); // set line color for the alu box + module->SetTransparency(20); // set transparency for the TOF - TGeoBBox* gas_box = new TGeoBBox("", (dx-(width_aluxl+width_aluxr))/2., (dy-2*width_aluy)/2., (dz-2*width_aluz)/2.); - TGeoVolume* gas_box_vol = + TGeoBBox* gas_box = new TGeoBBox("", + (dx - (width_aluxl + width_aluxr)) / 2., + (dy - 2 * width_aluy) / 2., + (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); - gas_box_vol->SetLineColor(kBlue); // set line color for the alu box - gas_box_vol->SetTransparency(50); // set transparency for the TOF - TGeoTranslation* gas_box_trans - = new TGeoTranslation("", shift_gas_box, 0., 0.); + gas_box_vol->SetLineColor(kBlue); // set line color for the alu box + gas_box_vol->SetTransparency(50); // set transparency for the TOF + TGeoTranslation* gas_box_trans = + new TGeoTranslation("", shift_gas_box, 0., 0.); module->AddNode(gas_box_vol, 0, gas_box_trans); - - for (Int_t j=0; j< NCounterInModule[modType]; j++){ //loop over counters (modules) - //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) - Float_t xpos,ypos,zpos; + + for (Int_t j = 0; j < NCounterInModule[modType]; + j++) { //loop over counters (modules) + //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) + Float_t xpos, ypos, zpos; if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { - zpos = dzoff *=-1; + zpos = dzoff *= -1; } else { - zpos = CounterZStartPosition[modType]+j*dzoff; + zpos = CounterZStartPosition[modType] + j * dzoff; } //cout << "counter z position " << zpos << endl; - xpos=startxpos + j*dxpos; - ypos=startypos + j*dypos; + xpos = startxpos + j * dxpos; + ypos = startypos + j * dypos; - TGeoTranslation* counter_trans - = new TGeoTranslation("", xpos , ypos , zpos); + TGeoTranslation* counter_trans = new TGeoTranslation("", xpos, ypos, zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = + new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } @@ -745,265 +774,257 @@ TGeoVolume* create_new_tof_module(Int_t modType) } -TGeoVolume* create_tof_pole() -{ +TGeoVolume* create_tof_pole() { // needed materials - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); - - Float_t dx=Pole_Size_X; - Float_t dy=Pole_Size_Y; - Float_t dz=Pole_Size_Z; - Float_t width_alux=Pole_Thick_X; - Float_t width_aluy=Pole_Thick_Y; - Float_t width_aluz=Pole_Thick_Z; - - TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); - TGeoBBox* pole_alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* pole_alu_vol = + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); + + Float_t dx = Pole_Size_X; + Float_t dy = Pole_Size_Y; + Float_t dz = Pole_Size_Z; + Float_t width_alux = Pole_Thick_X; + Float_t width_aluy = Pole_Thick_Y; + Float_t width_aluz = Pole_Thick_Z; + + TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); + TGeoBBox* pole_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* pole_alu_vol = new TGeoVolume("pole_alu", pole_alu_box, boxVolMed); - pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box - pole_alu_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* pole_alu_trans - = new TGeoTranslation("", 0., 0., 0.); + pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box + pole_alu_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* pole_alu_trans = new TGeoTranslation("", 0., 0., 0.); pole->AddNode(pole_alu_vol, 0, pole_alu_trans); - Float_t air_dx = dx/2. - width_alux; - Float_t air_dy = dy/2. - width_aluy; - Float_t air_dz = dz/2. - width_aluz; + Float_t air_dx = dx / 2. - width_alux; + Float_t air_dy = dy / 2. - width_aluy; + Float_t air_dz = dz / 2. - width_aluz; // cout << "My pole." << endl; if (air_dx <= 0.) - cout << "ERROR - No air volume in pole X, size: "<< air_dx << endl; + cout << "ERROR - No air volume in pole X, size: " << air_dx << endl; if (air_dy <= 0.) - cout << "ERROR - No air volume in pole Y, size: "<< air_dy << endl; + cout << "ERROR - No air volume in pole Y, size: " << air_dy << endl; if (air_dz <= 0.) - cout << "ERROR - No air volume in pole Z, size: "<< air_dz << endl; + cout << "ERROR - No air volume in pole Z, size: " << air_dz << endl; - if ((air_dx > 0.) && (air_dy > 0.) && (air_dz > 0.)) // crate air volume only, if larger than zero + if ((air_dx > 0.) && (air_dy > 0.) + && (air_dz > 0.)) // crate air volume only, if larger than zero { TGeoBBox* pole_air_box = new TGeoBBox("", air_dx, air_dy, air_dz); // TGeoBBox* pole_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz); - TGeoVolume* pole_air_vol = + TGeoVolume* pole_air_vol = new TGeoVolume("pole_air", pole_air_box, airVolMed); - pole_air_vol->SetLineColor(kYellow); // set line color for the alu box - pole_air_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* pole_air_trans - = new TGeoTranslation("", 0., 0., 0.); + pole_air_vol->SetLineColor(kYellow); // set line color for the alu box + pole_air_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* pole_air_trans = new TGeoTranslation("", 0., 0., 0.); pole_alu_vol->AddNode(pole_air_vol, 0, pole_air_trans); - } - else - cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy << " " << air_dz << endl; + } else + cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy + << " " << air_dz << endl; return pole; } -TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) -{ +TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) { // needed materials TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); - - Float_t width_alux=Pole_Thick_X; - Float_t width_aluy=Pole_Thick_Y; - Float_t width_aluz=Pole_Thick_Z; - - TGeoVolume* bar = new TGeoVolumeAssembly("Bar"); - TGeoBBox* bar_alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* bar_alu_vol = - new TGeoVolume("bar_alu", bar_alu_box, boxVolMed); - bar_alu_vol->SetLineColor(kGreen); // set line color for the alu box - bar_alu_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* bar_alu_trans - = new TGeoTranslation("", 0., 0., 0.); + + Float_t width_alux = Pole_Thick_X; + Float_t width_aluy = Pole_Thick_Y; + Float_t width_aluz = Pole_Thick_Z; + + TGeoVolume* bar = new TGeoVolumeAssembly("Bar"); + TGeoBBox* bar_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* bar_alu_vol = new TGeoVolume("bar_alu", bar_alu_box, boxVolMed); + bar_alu_vol->SetLineColor(kGreen); // set line color for the alu box + bar_alu_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* bar_alu_trans = new TGeoTranslation("", 0., 0., 0.); bar->AddNode(bar_alu_vol, 0, bar_alu_trans); - TGeoBBox* bar_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz); - TGeoVolume* bar_air_vol = - new TGeoVolume("bar_air", bar_air_box, airVolMed); - bar_air_vol->SetLineColor(kYellow); // set line color for the alu box - bar_air_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* bar_air_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoBBox* bar_air_box = new TGeoBBox( + "", dx / 2. - width_alux, dy / 2. - width_aluy, dz / 2. - width_aluz); + TGeoVolume* bar_air_vol = new TGeoVolume("bar_air", bar_air_box, airVolMed); + bar_air_vol->SetLineColor(kYellow); // set line color for the alu box + bar_air_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* bar_air_trans = new TGeoTranslation("", 0., 0., 0.); bar_alu_vol->AddNode(bar_air_vol, 0, bar_air_trans); return bar; } -void position_tof_poles(Int_t modType) -{ +void position_tof_poles(Int_t modType) { - TGeoTranslation* pole_trans=NULL; - - Int_t numPoles=0; - for (Int_t i=0; i<NumberOfPoles; i++){ - if(i<2) { - pole_trans - = new TGeoTranslation("", -Pole_Offset+2.0, 0., Pole_ZPos[i]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; - }else{ - Float_t xPos=Pole_Offset+Pole_Size_X/2.+Pole_Col[i]*DxColl; - Float_t zPos=Pole_ZPos[i]; - pole_trans - = new TGeoTranslation("", xPos, 0., zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; - - pole_trans - = new TGeoTranslation("", -xPos, 0., zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; + TGeoTranslation* pole_trans = NULL; + + Int_t numPoles = 0; + for (Int_t i = 0; i < NumberOfPoles; i++) { + if (i < 2) { + pole_trans = + new TGeoTranslation("", -Pole_Offset + 2.0, 0., Pole_ZPos[i]); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; + } else { + Float_t xPos = Pole_Offset + Pole_Size_X / 2. + Pole_Col[i] * DxColl; + Float_t zPos = Pole_ZPos[i]; + pole_trans = new TGeoTranslation("", xPos, 0., zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; + + pole_trans = new TGeoTranslation("", -xPos, 0., zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; } - cout << " Position Pole "<< numPoles<<" at z="<< Pole_ZPos[i] << endl; + cout << " Position Pole " << numPoles << " at z=" << Pole_ZPos[i] << endl; } } -void position_tof_bars(Int_t modType) -{ +void position_tof_bars(Int_t modType) { - TGeoTranslation* bar_trans=NULL; + TGeoTranslation* bar_trans = NULL; - Int_t numBars=0; + Int_t numBars = 0; Int_t i; Float_t xPos; Float_t yPos; Float_t zPos; - for (i=0; i<NumberOfBars; i++){ + for (i = 0; i < NumberOfBars; i++) { - xPos=Bar_XPos[i]; - zPos=Bar_ZPos[i]; - yPos=Pole_Size_Y/2.+Bar_Size_Y/2.; + xPos = Bar_XPos[i]; + zPos = Bar_ZPos[i]; + yPos = Pole_Size_Y / 2. + Bar_Size_Y / 2.; - bar_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", xPos,-yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", -xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", -xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", -xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; - - } - cout << " Position Bar "<< numBars<<" at z="<< Bar_ZPos[i] << endl; + bar_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; + } + cout << " Position Bar " << numBars << " at z=" << Bar_ZPos[i] << endl; + + // horizontal frame bars + i = NumberOfBars; + NumberOfBars++; + // no bar + // gBar[i]=create_tof_bar(2.*xPos+Pole_Size_X,Bar_Size_Y,Bar_Size_Y); + + zPos = Pole_ZPos[0] + Pole_Size_Z / 2.; + bar_trans = new TGeoTranslation("", 0., yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; + + bar_trans = new TGeoTranslation("", 0., -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; +} - // horizontal frame bars - i = NumberOfBars; - NumberOfBars++; - // no bar - // gBar[i]=create_tof_bar(2.*xPos+Pole_Size_X,Bar_Size_Y,Bar_Size_Y); +void position_inner_tof_modules(Int_t modNType) { + TGeoTranslation* module_trans = NULL; - zPos = Pole_ZPos[0]+Pole_Size_Z/2.; - bar_trans = new TGeoTranslation("", 0., yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = Inner_Module_First_Y_Position; + Int_t ii = 0; + Float_t xPos = Inner_Module_X_Offset; + Float_t zPos = Wall_Z_Position; - bar_trans = new TGeoTranslation("", 0., -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + Pole_ZPos[NumberOfPoles] = zPos; + Pole_Col[NumberOfPoles] = 0; + NumberOfPoles++; -} + Float_t DzPos = 0.; + for (Int_t j = 0; j < modNType; j++) { + if (Module_Size_Z[j] > DzPos) { DzPos = Module_Size_Z[j]; } + } + Pole_ZPos[NumberOfPoles] = zPos + DzPos; + Pole_Col[NumberOfPoles] = 0; + NumberOfPoles++; + + // for (Int_t j=0; j<modNType; j++){ + // for (Int_t j=1; j<modNType; j++){ + Int_t modType; + Int_t modNum; + for (Int_t j = 2; j < modNType; + j++) { // place only M4 type modules (modNType == 2) + //DEDE + modType = Inner_Module_Types[j]; + modNum = 0; + // for(Int_t i=0; i<Inner_Module_Number[j]; i++) { + // for(Int_t i=0; i<1; i++) { // place 1x2 modules in the top and same in the bottom + for (Int_t i = 0; i < 2; + i++) { // place 2x2 modules in the top and same in the bottom + ii++; + cout << "Inner ii " << ii << " Last " << Last_Size_Y << ", " + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + // DeltaY = 1.5; + cout << "DeltaY " << DeltaY << endl; + yPos += DeltaY; + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + cout << "Position Inner Module " << i << " of " << Inner_Module_Number[j] + << " Type " << modType << " at Y = " << yPos + << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY + << endl; + + /// module_trans = new TGeoTranslation("", xPos, yPos, zPos); + /// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + /// modNum++; + /// module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + /// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + /// modNum++; + // // if (ii>0) { + // if (ii>1) { + // module_trans + // = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); + // gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + // modNum++; + // module_trans + // = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); + // gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + // modNum++; + // } + } + } + // module_trans = new TGeoTranslation("", xPos, -49-3, zPos); + + // Mar2019 setup + const Int_t NModules = 5; + xPos = 0.; + yPos = 0.; + zPos = TOF_Z_Front; + const Double_t ModDx[NModules] = {0., 0., 1.5, 49.8, 49.8}; + //const Double_t ModDx[NModules]= { 1.5, 0., -1.5, 49.8, 55.8}; + const Double_t ModDy[NModules] = {0., 0., 0., 0., 0.}; + const Double_t ModDz[NModules] = {0., 16.5, 34., 0., 16.5}; + const Double_t ModAng[NModules] = {-90., -90., -90., -90., -90.0}; + TGeoRotation* module_rot = NULL; + TGeoCombiTrans* module_combi_trans = NULL; -void position_inner_tof_modules(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=Inner_Module_First_Y_Position; - Int_t ii=0; - Float_t xPos = Inner_Module_X_Offset; - Float_t zPos = Wall_Z_Position; - - Pole_ZPos[NumberOfPoles] = zPos; - Pole_Col[NumberOfPoles] = 0; - NumberOfPoles++; - - Float_t DzPos =0.; - for (Int_t j=0; j<modNType; j++){ - if (Module_Size_Z[j]>DzPos){ - DzPos = Module_Size_Z[j]; - } - } - Pole_ZPos[NumberOfPoles]=zPos+DzPos; - Pole_Col[NumberOfPoles] = 0; - NumberOfPoles++; - - // for (Int_t j=0; j<modNType; j++){ - // for (Int_t j=1; j<modNType; j++){ - Int_t modType; - Int_t modNum; - for (Int_t j=2; j<modNType; j++){ // place only M4 type modules (modNType == 2) - //DEDE - modType = Inner_Module_Types[j]; - modNum = 0; - // for(Int_t i=0; i<Inner_Module_Number[j]; i++) { - // for(Int_t i=0; i<1; i++) { // place 1x2 modules in the top and same in the bottom - for(Int_t i=0; i<2; i++) { // place 2x2 modules in the top and same in the bottom - ii++; - cout << "Inner ii "<<ii<<" Last "<<Last_Size_Y<<", "<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - // DeltaY = 1.5; - cout << "DeltaY " << DeltaY << endl; - yPos += DeltaY; - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - cout <<"Position Inner Module "<<i<<" of "<<Inner_Module_Number[j]<<" Type "<<modType - <<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; - -/// module_trans = new TGeoTranslation("", xPos, yPos, zPos); -/// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -/// modNum++; -/// module_trans = new TGeoTranslation("", xPos, -yPos, zPos); -/// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -/// modNum++; -// // if (ii>0) { -// if (ii>1) { -// module_trans -// = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); -// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -// modNum++; -// module_trans -// = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); -// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -// modNum++; -// } + for (Int_t iMod = 0; iMod < NModules; iMod++) { + module_trans = new TGeoTranslation( + "", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]); + module_rot = new TGeoRotation(); + module_rot->RotateZ(ModAng[iMod]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; } - } - // module_trans = new TGeoTranslation("", xPos, -49-3, zPos); - - // Mar2019 setup - const Int_t NModules=5; - xPos=0.; - yPos=0.; - zPos=TOF_Z_Front; - const Double_t ModDx[NModules]= { 0., 0., 1.5, 49.8, 49.8}; - //const Double_t ModDx[NModules]= { 1.5, 0., -1.5, 49.8, 55.8}; - const Double_t ModDy[NModules]= { 0., 0., 0., 0., 0. }; - const Double_t ModDz[NModules]= { 0., 16.5, 34., 0., 16.5}; - const Double_t ModAng[NModules]={-90.,-90.,-90., -90.,-90.0}; - TGeoRotation* module_rot = NULL; - TGeoCombiTrans* module_combi_trans = NULL; - - for (Int_t iMod=0; iMod<NModules; iMod++) { - module_trans = new TGeoTranslation("", xPos+ModDx[iMod], yPos+ModDy[iMod], zPos+ModDz[iMod]); - module_rot = new TGeoRotation(); - module_rot->RotateZ(ModAng[iMod]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - } - - - /* + + + /* module_trans = new TGeoTranslation("", xPos, 0, zPos+16.5); gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; @@ -1026,417 +1047,419 @@ void position_inner_tof_modules(Int_t modNType) } -void position_Dia(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(Dia_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=Dia_First_Y_Position; - Int_t ii=0; - Float_t xPos = Dia_X_Offset; - Float_t zPos = Dia_Z_Position; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Dia_Types[j]; - for(Int_t i=0; i<Dia_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; +void position_Dia(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(Dia_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; + + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = Dia_First_Y_Position; + Int_t ii = 0; + Float_t xPos = Dia_X_Offset; + Float_t zPos = Dia_Z_Position; + + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Dia_Types[j]; + for (Int_t i = 0; i < Dia_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } } - } } -void position_Star2(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); +void position_Star2(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(Star2_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Star2_First_Y_Position; - Float_t zPos = Star2_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Star2_Types[j]; - Float_t xPos = Star2_X_Offset[j]; - for(Int_t i=0; i<Star2_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Star2_Delta_Y_Position; - zPos += Star2_Delta_Z_Position[modNum]; - } + TGeoCombiTrans* module_combi_trans = NULL; - } -} + Float_t yPos = Star2_First_Y_Position; + Float_t zPos = Star2_First_Z_Position; + Int_t ii = 0; -void position_Buc(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation("Buc2018",Buc_rotate_Z,Buc_rotate_X,0.); - //TGeoRotation* module_rot = new TGeoRotation(); - // module_rot->RotateZ(Buc_rotate_Z); - // module_rot->RotateX(Buc_rotate_X); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Buc_First_Y_Position; - Float_t zPos = Buc_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Buc_Types[j]; - Float_t xPos = Buc_X_Offset[j]; - for(Int_t i=0; i<Buc_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Buc_Delta_Y_Position; - zPos += Buc_Delta_Z_Position; + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Star2_Types[j]; + Float_t xPos = Star2_X_Offset[j]; + for (Int_t i = 0; i < Star2_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Star2_Delta_Y_Position; + zPos += Star2_Delta_Z_Position[modNum]; + } } - } } -void position_cer_modules(Int_t modNType) -{ - Int_t ii=0; - Int_t modNum = 0; - for (Int_t j=1; j<modNType; j++){ - Int_t modType= Cer_Types[j]; - Float_t xPos = Cer_X_Position[j]; - Float_t yPos = Cer_Y_Position[j]; - Float_t zPos = Cer_Z_Position[j]; - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(Form("Cer%d",j),Cer_rotate_Z[j],-MeanTheta,0.); - // module_rot->RotateZ(Cer_rotate_Z[j]); +void position_Buc(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = + new TGeoRotation("Buc2018", Buc_rotate_Z, Buc_rotate_X, 0.); + //TGeoRotation* module_rot = new TGeoRotation(); + // module_rot->RotateZ(Buc_rotate_Z); + // module_rot->RotateX(Buc_rotate_X); TGeoCombiTrans* module_combi_trans = NULL; - for(Int_t i=0; i<Cer_Number[j]; i++) { - ii++; - cout <<"Position Ceramic Module "<<i<<" of "<<Cer_Number[j]<<" Type "<<modType - <<" at X = "<<xPos - <<", Y = "<<yPos - <<", Z = "<<zPos - <<endl; - // Front staggered module (Top if pair), top - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - // modNum++; - } - } -} + Float_t yPos = Buc_First_Y_Position; + Float_t zPos = Buc_First_Z_Position; + Int_t ii = 0; -void position_CERN(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(CERN_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=CERN_First_Y_Position; - Int_t ii=0; - Float_t xPos = CERN_X_Offset; - Float_t zPos = CERN_Z_Position; - - for (Int_t j=0; j<modNType; j++){ - Int_t modType= CERN_Types[j]; Int_t modNum = 0; - for(Int_t i=0; i<CERN_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Buc_Types[j]; + Float_t xPos = Buc_X_Offset[j]; + for (Int_t i = 0; i < Buc_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Buc_Delta_Y_Position; + zPos += Buc_Delta_Z_Position; + } } - } } -void position_Star(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - // TGeoRotation* module_rot = new TGeoRotation("Star",Star_rotate_Z,Star_rotate_Y,0.); - TGeoRotation* module_rot = new TGeoRotation("Star"); - module_rot->RotateY(Star_rotate_Y); - // module_rot->RotateZ(Star_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Star_First_Y_Position; - Float_t zPos = Star_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Star_Types[j]; - Float_t xPos = Star_X_Offset[j]; - for(Int_t i=0; i<Star_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Star_Delta_Y_Position; - zPos += Star_Delta_Z_Position; +void position_cer_modules(Int_t modNType) { + Int_t ii = 0; + Int_t modNum = 0; + for (Int_t j = 1; j < modNType; j++) { + Int_t modType = Cer_Types[j]; + Float_t xPos = Cer_X_Position[j]; + Float_t yPos = Cer_Y_Position[j]; + Float_t zPos = Cer_Z_Position[j]; + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = + new TGeoRotation(Form("Cer%d", j), Cer_rotate_Z[j], -MeanTheta, 0.); + // module_rot->RotateZ(Cer_rotate_Z[j]); + TGeoCombiTrans* module_combi_trans = NULL; + + for (Int_t i = 0; i < Cer_Number[j]; i++) { + ii++; + cout << "Position Ceramic Module " << i << " of " << Cer_Number[j] + << " Type " << modType << " at X = " << xPos << ", Y = " << yPos + << ", Z = " << zPos << endl; + // Front staggered module (Top if pair), top + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + // modNum++; + } } - } } -void position_side_tof_modules(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(180.); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=0.; //Inner_Module_First_Y_Position; - Int_t ii=0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= InnerSide_Module_Types[j]; - Int_t modNum = 0; - for(Int_t i=0; i<InnerSide_Module_Number[j]; i++) { - ii++; - cout << "InnerSide ii "<<ii<<" Last "<<Last_Size_Y<<","<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - if (ii>1){yPos += DeltaY;} - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - Float_t xPos = InnerSide_Module_X_Offset; - Float_t zPos = Wall_Z_Position; - cout <<"Position InnerSide Module "<<i<<" of "<<InnerSide_Module_Number[j]<<" Type "<<modType - <<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; - - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; +void position_CERN(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(CERN_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", -xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = CERN_First_Y_Position; + Int_t ii = 0; + Float_t xPos = CERN_X_Offset; + Float_t zPos = CERN_Z_Position; + + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = CERN_Types[j]; + Int_t modNum = 0; + for (Int_t i = 0; i < CERN_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } + } +} - if (ii>1) { - module_trans - = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; +void position_Star(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + // TGeoRotation* module_rot = new TGeoRotation("Star",Star_rotate_Z,Star_rotate_Y,0.); + TGeoRotation* module_rot = new TGeoRotation("Star"); + module_rot->RotateY(Star_rotate_Y); + // module_rot->RotateZ(Star_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", -xPos, -yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + Float_t yPos = Star_First_Y_Position; + Float_t zPos = Star_First_Z_Position; + Int_t ii = 0; - module_trans - = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Star_Types[j]; + Float_t xPos = Star_X_Offset[j]; + for (Int_t i = 0; i < Star_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Star_Delta_Y_Position; + zPos += Star_Delta_Z_Position; + } + } +} - module_trans - = new TGeoTranslation("", -xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; +void position_side_tof_modules(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(180.); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = 0.; //Inner_Module_First_Y_Position; + Int_t ii = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = InnerSide_Module_Types[j]; + Int_t modNum = 0; + for (Int_t i = 0; i < InnerSide_Module_Number[j]; i++) { + ii++; + cout << "InnerSide ii " << ii << " Last " << Last_Size_Y << "," + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + if (ii > 1) { yPos += DeltaY; } + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + Float_t xPos = InnerSide_Module_X_Offset; + Float_t zPos = Wall_Z_Position; + cout << "Position InnerSide Module " << i << " of " + << InnerSide_Module_Number[j] << " Type " << modType + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] + << " DeltaY = " << DeltaY << endl; - module_trans - = new TGeoTranslation("", -xPos,-(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + module_trans = new TGeoTranslation("", -xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + if (ii > 1) { + module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", -xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", -xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } } } - } } -void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) +void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) { - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(180.); TGeoCombiTrans* module_combi_trans = NULL; // Int_t numModules=(Int_t)( (Outer_Module_Last_Y_Position-Outer_Module_First_Y_Position)/Module_Size_Y[modType])+1; - + Int_t modNum[NofModuleTypes]; - for (Int_t k=0; k<NofModuleTypes; k++){ - modNum[k]=0; + for (Int_t k = 0; k < NofModuleTypes; k++) { + modNum[k] = 0; } Float_t zPos = Wall_Z_Position; - for(Int_t j=0; j<nCol; j++){ - Float_t xPos = Outer_Module_X_Offset + ((j+1)*DxColl); - Last_Size_Y=0.; - Last_Over_Y=0.; - Float_t yPos = 0.; - Int_t ii=0; - Float_t DzPos =0.; - for(Int_t k=0; k<Outer_Module_NTypes; k++){ - Int_t modType= Outer_Module_Types[k][j]; - if(Module_Size_Z[modType]>DzPos){ - if(Outer_Module_Number[k][j]>0){ - DzPos = Module_Size_Z[modType]; + for (Int_t j = 0; j < nCol; j++) { + Float_t xPos = Outer_Module_X_Offset + ((j + 1) * DxColl); + Last_Size_Y = 0.; + Last_Over_Y = 0.; + Float_t yPos = 0.; + Int_t ii = 0; + Float_t DzPos = 0.; + for (Int_t k = 0; k < Outer_Module_NTypes; k++) { + Int_t modType = Outer_Module_Types[k][j]; + if (Module_Size_Z[modType] > DzPos) { + if (Outer_Module_Number[k][j] > 0) { DzPos = Module_Size_Z[modType]; } } - } - } - - zPos -= 2.*DzPos; //((j+1)*2*Module_Size_Z[modType]); - - Pole_ZPos[NumberOfPoles] = zPos; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; - Pole_ZPos[NumberOfPoles] = zPos+DzPos; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; - //if (j+1==nCol) { - if (1) { - Pole_ZPos[NumberOfPoles] = Pole_ZPos[0]; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; + } - Bar_Size_Z = Pole_ZPos[0] - zPos; - gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); - Bar_ZPos[NumberOfBars] = zPos+Bar_Size_Z/2.-Pole_Size_Z/2.; - Bar_XPos[NumberOfBars] = xPos + Pole_Offset; - NumberOfBars++; - } - - for (Int_t k=0; k<Outer_Module_NTypes; k++) { - Int_t modType = Outer_Module_Types[k][j]; - Int_t numModules = Outer_Module_Number[k][j]; - - cout <<" Outer: position "<<numModules<<" of type "<<modType<<" in col "<<j - <<" at z = "<<zPos<<", DzPos = "<<DzPos<<endl; - for(Int_t i=0; i<numModules; i++) { - ii++; - cout << "Outer ii "<<ii<<" Last "<<Last_Size_Y<<","<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - if (ii>1){yPos += DeltaY;} - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - cout <<"Position Outer Module "<<i<<" of "<<Outer_Module_Number[k][j]<<" Type "<<modType - <<"(#"<<modNum[modType]<<") "<<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; + zPos -= 2. * DzPos; //((j+1)*2*Module_Size_Z[modType]); - module_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - - module_trans = new TGeoTranslation("", -xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - if (ii>1) { - module_trans - = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, -yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - // second layer - module_trans - = new TGeoTranslation("", xPos, yPos-DeltaY/2., zPos+DzPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, yPos-DeltaY/2., zPos+DzPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - module_trans - = new TGeoTranslation("", xPos, -(yPos-DeltaY/2.), zPos+DzPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, -(yPos-DeltaY/2.), zPos+DzPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; + Pole_ZPos[NumberOfPoles] = zPos; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + Pole_ZPos[NumberOfPoles] = zPos + DzPos; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + //if (j+1==nCol) { + if (1) { + Pole_ZPos[NumberOfPoles] = Pole_ZPos[0]; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + + Bar_Size_Z = Pole_ZPos[0] - zPos; + gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); + Bar_ZPos[NumberOfBars] = zPos + Bar_Size_Z / 2. - Pole_Size_Z / 2.; + Bar_XPos[NumberOfBars] = xPos + Pole_Offset; + NumberOfBars++; + } + for (Int_t k = 0; k < Outer_Module_NTypes; k++) { + Int_t modType = Outer_Module_Types[k][j]; + Int_t numModules = Outer_Module_Number[k][j]; + + cout << " Outer: position " << numModules << " of type " << modType + << " in col " << j << " at z = " << zPos << ", DzPos = " << DzPos + << endl; + for (Int_t i = 0; i < numModules; i++) { + ii++; + cout << "Outer ii " << ii << " Last " << Last_Size_Y << "," + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + if (ii > 1) { yPos += DeltaY; } + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + cout << "Position Outer Module " << i << " of " + << Outer_Module_Number[k][j] << " Type " << modType << "(#" + << modNum[modType] << ") " + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] + << " DeltaY = " << DeltaY << endl; + + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + + module_trans = new TGeoTranslation("", -xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + if (ii > 1) { + module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + // second layer + module_trans = + new TGeoTranslation("", xPos, yPos - DeltaY / 2., zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = + new TGeoTranslation("", -xPos, yPos - DeltaY / 2., zPos + DzPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + module_trans = + new TGeoTranslation("", xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = + new TGeoTranslation("", -xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + } } } - } } } -void dump_info_file() -{ - TDatime datetime; // used to get timestamp +void dump_info_file() { + TDatime datetime; // used to get timestamp printf("writing info file: %s\n", FileNameInfo.Data()); - FILE *ifile; - ifile = fopen(FileNameInfo.Data(),"w"); + FILE* ifile; + ifile = fopen(FileNameInfo.Data(), "w"); - if (ifile == NULL) - { - printf("error opening %s\n", FileNameInfo.Data()); - exit(1); - } + if (ifile == NULL) { + printf("error opening %s\n", FileNameInfo.Data()); + exit(1); + } - fprintf(ifile,"#\n## %s information file\n#\n\n", geoVersion.Data()); + fprintf(ifile, "#\n## %s information file\n#\n\n", geoVersion.Data()); - fprintf(ifile,"# created %d\n\n", datetime.GetDate()); + fprintf(ifile, "# created %d\n\n", datetime.GetDate()); - fprintf(ifile,"# TOF setup\n"); - if (TOF_Z_Front == 450) - fprintf(ifile,"SIS 100 hadron setup\n"); - if (TOF_Z_Front == 600) - fprintf(ifile,"SIS 100 electron\n"); - if (TOF_Z_Front == 650) - fprintf(ifile,"SIS 100 muon\n"); - if (TOF_Z_Front == 880) - fprintf(ifile,"SIS 300 electron\n"); - if (TOF_Z_Front == 1020) - fprintf(ifile,"SIS 300 muon\n"); - fprintf(ifile,"\n"); + fprintf(ifile, "# TOF setup\n"); + if (TOF_Z_Front == 450) fprintf(ifile, "SIS 100 hadron setup\n"); + if (TOF_Z_Front == 600) fprintf(ifile, "SIS 100 electron\n"); + if (TOF_Z_Front == 650) fprintf(ifile, "SIS 100 muon\n"); + if (TOF_Z_Front == 880) fprintf(ifile, "SIS 300 electron\n"); + if (TOF_Z_Front == 1020) fprintf(ifile, "SIS 300 muon\n"); + fprintf(ifile, "\n"); - const Float_t TOF_Z_Back = Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall + const Float_t TOF_Z_Back = + Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall - fprintf(ifile,"# envelope\n"); + fprintf(ifile, "# envelope\n"); // Show extension of TRD - fprintf(ifile,"%7.2f cm start of TOF (z)\n", TOF_Z_Front); - fprintf(ifile,"%7.2f cm end of TOF (z)\n", TOF_Z_Back); - fprintf(ifile,"\n"); + fprintf(ifile, "%7.2f cm start of TOF (z)\n", TOF_Z_Front); + fprintf(ifile, "%7.2f cm end of TOF (z)\n", TOF_Z_Back); + fprintf(ifile, "\n"); // Layer thickness - fprintf(ifile,"# central tower position\n"); - fprintf(ifile,"%7.2f cm center of staggered, front RPC cell at x=0\n", Wall_Z_Position); - fprintf(ifile,"\n"); + fprintf(ifile, "# central tower position\n"); + fprintf(ifile, + "%7.2f cm center of staggered, front RPC cell at x=0\n", + Wall_Z_Position); + fprintf(ifile, "\n"); fclose(ifile); } diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_cosmicHD.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_cosmicHD.C index 74baf9bb7f..5fd6fcbb96 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_cosmicHD.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_cosmicHD.C @@ -1,42 +1,42 @@ -/// +/// /// \file derived from Create_TOF_Geometry_v18m_mCbm.C /// \brief Generates TOF geometry in Root format. -/// +/// // Changelog // Aug.10,2020 HD setup with 2 Buc modules // in root all sizes are given in cm -#include "TSystem.h" +#include "TFile.h" +#include "TGeoCompositeShape.h" #include "TGeoManager.h" -#include "TGeoVolume.h" #include "TGeoMaterial.h" +#include "TGeoMatrix.h" #include "TGeoMedium.h" #include "TGeoPgon.h" -#include "TGeoMatrix.h" -#include "TGeoCompositeShape.h" -#include "TFile.h" -#include "TString.h" +#include "TGeoVolume.h" #include "TList.h" -#include "TROOT.h" #include "TMath.h" +#include "TROOT.h" +#include "TString.h" +#include "TSystem.h" #include <iostream> // Name of geometry version and output file -const TString geoVersion = "tof_v20b"; // do not change +const TString geoVersion = "tof_v20b"; // do not change const TString geoVersionStand = geoVersion + "Stand"; // -const TString fileTag = "tof_v20b"; +const TString fileTag = "tof_v20b"; const TString FileNameSim = fileTag + "_cosmicHD.geo.root"; const TString FileNameGeo = fileTag + "_cosmicHD_geo.root"; const TString FileNameInfo = fileTag + "_cosmicHD.info"; // TOF_Z_Front corresponds to front cover of outer super module towers -const Float_t TOF_Z_Front_Stand = 30; // = z=298 mCBM@SIS18 -const Float_t TOF_Z_Front = 30; +const Float_t TOF_Z_Front_Stand = 30; // = z=298 mCBM@SIS18 +const Float_t TOF_Z_Front = 30; //const Float_t TOF_Z_Front = 130; // = z=225 mCBM@SIS18 //const Float_t TOF_Z_Front = 250; // SIS 100 hadron //const Float_t TOF_Z_Front = 450; // SIS 100 hadron @@ -49,57 +49,73 @@ const Float_t TOF_Z_Front = 30; // Names of the different used materials which are used to build the modules -// The materials are defined in the global media.geo file -const TString KeepingVolumeMedium = "air"; -const TString BoxVolumeMedium = "aluminium"; -const TString NoActivGasMedium = "RPCgas_noact"; -const TString ActivGasMedium = "RPCgas"; -const TString GlasMedium = "RPCglass"; -const TString ElectronicsMedium = "carbon"; - -// Counters: +// The materials are defined in the global media.geo file +const TString KeepingVolumeMedium = "air"; +const TString BoxVolumeMedium = "aluminium"; +const TString NoActivGasMedium = "RPCgas_noact"; +const TString ActivGasMedium = "RPCgas"; +const TString GlasMedium = "RPCglass"; +const TString ElectronicsMedium = "carbon"; + +// Counters: // 0 MRPC3a // 1 MRPC3b -// 2 -// 3 -// 4 Diamond -// +// 2 +// 3 +// 4 Diamond +// // 6 Buc 2019 // 7 CERN 20gap -// 8 Ceramic Pad +// 8 Ceramic Pad const Int_t NumberOfDifferentCounterTypes = 9; -const Float_t Glass_X[NumberOfDifferentCounterTypes] = {32. , 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t Glass_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; -const Float_t Glass_Z[NumberOfDifferentCounterTypes] = {0.1, 0.1,0.1, 0.1,0.01 ,0.1,0.1, 0.1, 0.1}; - -const Float_t GasGap_X[NumberOfDifferentCounterTypes] = {32. , 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; -const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; -const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = {0.025,0.025,0.025,0.025,0.01,0.02,0.02,0.02,0.025}; - -const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {8,8,8,8,1,8,10,20,4}; +const Float_t Glass_X[NumberOfDifferentCounterTypes] = + {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t Glass_Y[NumberOfDifferentCounterTypes] = + {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; +const Float_t Glass_Z[NumberOfDifferentCounterTypes] = + {0.1, 0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1}; + +const Float_t GasGap_X[NumberOfDifferentCounterTypes] = + {32., 52., 32., 32., 0.2, 32., 28.8, 20., 2.4}; +const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = + {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4}; +const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = + {0.025, 0.025, 0.025, 0.025, 0.01, 0.02, 0.02, 0.02, 0.025}; + +const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = + {8, 8, 8, 8, 1, 8, 10, 20, 4}; //const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {32,32,32,32,80,32,32,20,1}; +const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = + {32, 32, 32, 32, 80, 32, 32, 20, 1}; //const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb -const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = {-0.6,-0.6,-0.6,-0.6,-0.1,-0.6,-0.6,-0.6,-1.}; +const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = + {-0.6, -0.6, -0.6, -0.6, -0.1, -0.6, -0.6, -0.6, -1.}; -const Float_t Electronics_X[NumberOfDifferentCounterTypes] = {34.0,53.0,32.0,32.,0.3,0.1, 28.8,20.,0.1}; -const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = { 5.0, 5.0, 1.0, 1.,0.1,0.1,1.0,1.0,0.1}; -const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = { 0.3, 0.3, 0.3, 0.3,0.1,0.1,0.1,0.1,0.1}; +const Float_t Electronics_X[NumberOfDifferentCounterTypes] = + {34.0, 53.0, 32.0, 32., 0.3, 0.1, 28.8, 20., 0.1}; +const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = + {5.0, 5.0, 1.0, 1., 0.1, 0.1, 1.0, 1.0, 0.1}; +const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = + {0.3, 0.3, 0.3, 0.3, 0.1, 0.1, 0.1, 0.1, 0.1}; const Int_t NofModuleTypes = 10; -// 0 mCBM module +// 0 mCBM module // 1 STAR module // 5 Diamond // 6 Buc // 7 CERN 20 gap // 8 Ceramic -// 9 Star2 +// 9 Star2 // Aluminum box for all module types -const Float_t Module_Size_X[NofModuleTypes] = {180.,102.15,180.,180.,180.,5., 40., 30., 22.5, 100.}; -const Float_t Module_Size_Y[NofModuleTypes] = { 49., 48.3, 74., 28., 18., 5., 12., 30., 11., 49.}; -const Float_t Module_Over_Y[NofModuleTypes] = {11.5, 11., 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; -const Float_t Module_Size_Z[NofModuleTypes] = {11., 11.1, 13., 11., 11., 1., 12., 6., 6.2, 11.2}; +const Float_t Module_Size_X[NofModuleTypes] = + {180., 102.15, 180., 180., 180., 5., 40., 30., 22.5, 100.}; +const Float_t Module_Size_Y[NofModuleTypes] = + {49., 48.3, 74., 28., 18., 5., 12., 30., 11., 49.}; +const Float_t Module_Over_Y[NofModuleTypes] = + {11.5, 11., 11., 4.5, 4.5, 0., 0., 0., 0., 0.}; +const Float_t Module_Size_Z[NofModuleTypes] = + {11., 11.1, 13., 11., 11., 1., 12., 6., 6.2, 11.2}; const Float_t Module_Thick_Alu_X_left = 0.1; const Float_t Module_Thick_Alu_X_right = 1.0; const Float_t Module_Thick_Alu_Y = 0.1; @@ -107,30 +123,38 @@ const Float_t Module_Thick_Alu_Z = 0.1; // Distance to the center of the TOF wall [cm]; const Float_t Wall_Z_Position = 400.; -const Float_t MeanTheta = 0.; +const Float_t MeanTheta = 0.; -//Type of Counter for module -const Int_t CounterTypeInModule[NofModuleTypes] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 0}; -const Int_t NCounterInModule[NofModuleTypes] = {5, 3, 3, 5, 5, 1, 2, 1, 8, 2}; +//Type of Counter for module +const Int_t CounterTypeInModule[NofModuleTypes] = + {0, 0, 1, 2, 3, 4, 6, 7, 8, 0}; +const Int_t NCounterInModule[NofModuleTypes] = {5, 3, 3, 5, 5, 1, 2, 1, 8, 2}; // Placement of the counter inside the module -const Float_t CounterXStartPosition[NofModuleTypes] = {-60., -27.74, -56.0,-60.0,-60.0, 0.0, 0., 0., -7., 0.}; -const Float_t CounterXDistance[NofModuleTypes] = { 30., 30.5, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., 0.}; -const Float_t CounterYStartPosition[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; -const Float_t CounterYDistance[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 0.}; -const Float_t CounterZDistance[NofModuleTypes] = { -2.5, 0.0, 0.0, 2.5, 2.5, 0., 4., 0., 0.1, 4.}; -const Float_t CounterZStartPosition[NofModuleTypes] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -1.5}; -const Float_t CounterRotationAngle[NofModuleTypes] = { 0., 10.0, 7.0, 0., 0., 0., 0., 0., 0., 0.}; +const Float_t CounterXStartPosition[NofModuleTypes] = + {-60., -27.74, -56.0, -60.0, -60.0, 0.0, 0., 0., -7., 0.}; +const Float_t CounterXDistance[NofModuleTypes] = + {30., 30.5, 51.0, 30.0, 30.0, 0.0, 0., 0., 2., 0.}; +const Float_t CounterYStartPosition[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.}; +const Float_t CounterYDistance[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 0.}; +const Float_t CounterZDistance[NofModuleTypes] = + {-2.5, 0.0, 0.0, 2.5, 2.5, 0., 4., 0., 0.1, 4.}; +const Float_t CounterZStartPosition[NofModuleTypes] = + {0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -1.5}; +const Float_t CounterRotationAngle[NofModuleTypes] = + {0., 10.0, 7.0, 0., 0., 0., 0., 0., 0., 0.}; // Pole (support structure) -const Int_t MaxNumberOfPoles=20; +const Int_t MaxNumberOfPoles = 20; Float_t Pole_ZPos[MaxNumberOfPoles]; Float_t Pole_Col[MaxNumberOfPoles]; -Int_t NumberOfPoles=0; +Int_t NumberOfPoles = 0; -const Float_t Pole_Size_X = 20.; -const Float_t Pole_Size_Y = 300.; -const Float_t Pole_Size_Z = 10.; +const Float_t Pole_Size_X = 20.; +const Float_t Pole_Size_Y = 300.; +const Float_t Pole_Size_Z = 10.; const Float_t Pole_Thick_X = 5.; const Float_t Pole_Thick_Y = 5.; const Float_t Pole_Thick_Z = 5.; @@ -138,109 +162,114 @@ const Float_t Pole_Thick_Z = 5.; // Bars (support structure) const Float_t Bar_Size_X = 20.; const Float_t Bar_Size_Y = 20.; -Float_t Bar_Size_Z = 100.; +Float_t Bar_Size_Z = 100.; -const Int_t MaxNumberOfBars=20; +const Int_t MaxNumberOfBars = 20; Float_t Bar_ZPos[MaxNumberOfBars]; Float_t Bar_XPos[MaxNumberOfBars]; -Int_t NumberOfBars=0; +Int_t NumberOfBars = 0; -const Float_t ChamberOverlap=40; -const Float_t DxColl=158.0; //Module_Size_X-ChamberOverlap; +const Float_t ChamberOverlap = 40; +const Float_t DxColl = 158.0; //Module_Size_X-ChamberOverlap; //const Float_t Pole_Offset=Module_Size_X/2.+Pole_Size_X/2.; -const Float_t Pole_Offset=90.0+Pole_Size_X/2.; +const Float_t Pole_Offset = 90.0 + Pole_Size_X / 2.; // Position for module placement -const Float_t Inner_Module_First_Y_Position=16.; -const Float_t Inner_Module_Last_Y_Position=480.; -const Float_t Inner_Module_X_Offset=0.; // centered position in x/y +const Float_t Inner_Module_First_Y_Position = 16.; +const Float_t Inner_Module_Last_Y_Position = 480.; +const Float_t Inner_Module_X_Offset = 0.; // centered position in x/y //const Float_t Inner_Module_X_Offset=18; // shift by 16 cm in x -const Int_t Inner_Module_NTypes = 3; -const Float_t Inner_Module_Types[Inner_Module_NTypes] = {4.,3.,0.}; +const Int_t Inner_Module_NTypes = 3; +const Float_t Inner_Module_Types[Inner_Module_NTypes] = {4., 3., 0.}; //const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2.,2.,6.}; //V13_3a -const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2.,2.,1.}; //V13_3a +const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2., 2., 1.}; //V13_3a //const Float_t Inner_Module_Number[Inner_Module_NTypes] = {0.,0.,0.}; //debugging -const Float_t InnerSide_Module_X_Offset=51.; -const Float_t InnerSide_Module_NTypes = 1; +const Float_t InnerSide_Module_X_Offset = 51.; +const Float_t InnerSide_Module_NTypes = 1; const Float_t InnerSide_Module_Types[Inner_Module_NTypes] = {5.}; const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {2.}; //v13_3a //const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {0.}; //debug -const Float_t Outer_Module_First_Y_Position=0.; -const Float_t Outer_Module_Last_Y_Position=480.; -const Float_t Outer_Module_X_Offset=3.; -const Int_t Outer_Module_Col = 4; -const Int_t Outer_Module_NTypes = 2; -const Float_t Outer_Module_Types [Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,1.,1., 2.,2.,2.,2.}; -const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {9.,9.,2.,0., 0.,0.,3.,4.};//V13_3a +const Float_t Outer_Module_First_Y_Position = 0.; +const Float_t Outer_Module_Last_Y_Position = 480.; +const Float_t Outer_Module_X_Offset = 3.; +const Int_t Outer_Module_Col = 4; +const Int_t Outer_Module_NTypes = 2; +const Float_t Outer_Module_Types[Outer_Module_NTypes][Outer_Module_Col] = + {1., 1., 1., 1., 2., 2., 2., 2.}; +const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = + {9., 9., 2., 0., 0., 0., 3., 4.}; //V13_3a //const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,0.,0., 0.,0.,0.,0.};//debug -const Float_t Star2_First_Z_Position=TOF_Z_Front + 0.; -const Float_t Star2_Delta_Z_Position[3]={0.,22.3,37.8}; -const Float_t Star2_First_Y_Position=0.; // -const Float_t Star2_Delta_Y_Position=0.; // -const Float_t Star2_rotate_Z=0.; -const Int_t Star2_NTypes = 1; -const Float_t Star2_Types[Star2_NTypes] = {9.}; -const Float_t Star2_Number[Star2_NTypes] = {3.}; //debugging, V16b -const Float_t Star2_X_Offset[Star2_NTypes]={0.}; //{62.}; - -const Float_t Buc_First_Z_Position=TOF_Z_Front + 46.3; -const Float_t Buc_Delta_Z_Position=0.; -const Float_t Buc_First_Y_Position=-9.; // -const Float_t Buc_Delta_Y_Position=12.; // -const Float_t Buc_rotate_Z=180.; -const Float_t Buc_rotate_X=180.; -const Int_t Buc_NTypes = 2; -const Float_t Buc_Types[Buc_NTypes] = {6.,6.}; -const Float_t Buc_Number[Buc_NTypes] = {1.,1.}; //debugging, V16b -const Float_t Buc_X_Offset[Buc_NTypes]={1.,1.}; - -const Int_t Cer_NTypes = 3; -const Float_t Cer_Z_Position[Cer_NTypes]={(float)(TOF_Z_Front+13.2),(float)(TOF_Z_Front+15.),(float)(TOF_Z_Front+15.)}; -const Float_t Cer_X_Position[Cer_NTypes]={0.,0.,0.}; -const Float_t Cer_Y_Position[Cer_NTypes]={-1.,0.,0.}; -const Float_t Cer_rotate_Z[Cer_NTypes]={0.,0.,0.}; -const Float_t Cer_Types[Cer_NTypes] = {5.,8.,8.}; -const Float_t Cer_Number[Cer_NTypes] = {1.,1.,1.}; //V16b - -const Float_t CERN_Z_Position=TOF_Z_Front+35.; // 20 gap -const Float_t CERN_First_Y_Position=0.; -const Float_t CERN_X_Offset=3.2; //65.5; -const Float_t CERN_rotate_Z=-90.; -const Int_t CERN_NTypes = 1; -const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType! -const Float_t CERN_Number[CERN_NTypes] = {1.}; // evtl. double for split signals - -const Float_t Star_First_Z_Position=TOF_Z_Front-12.; -const Float_t Star_Delta_Z_Position=0; //20.; -const Float_t Star_First_Y_Position=0.; // -const Float_t Star_Delta_Y_Position=0.; // -const Float_t Star_rotate_Y=0; //-6.8; -const Float_t Star_rotate_Z=0.; -const Int_t Star_NTypes = 1; -const Float_t Star_Types[Star2_NTypes] = {1.}; -const Float_t Star_Number[Star2_NTypes] = {1.}; -const Float_t Star_X_Offset[Star2_NTypes]= {-5.}; +const Float_t Star2_First_Z_Position = TOF_Z_Front + 0.; +const Float_t Star2_Delta_Z_Position[3] = {0., 22.3, 37.8}; +const Float_t Star2_First_Y_Position = 0.; // +const Float_t Star2_Delta_Y_Position = 0.; // +const Float_t Star2_rotate_Z = 0.; +const Int_t Star2_NTypes = 1; +const Float_t Star2_Types[Star2_NTypes] = {9.}; +const Float_t Star2_Number[Star2_NTypes] = {3.}; //debugging, V16b +const Float_t Star2_X_Offset[Star2_NTypes] = {0.}; //{62.}; + +const Float_t Buc_First_Z_Position = TOF_Z_Front + 46.3; +const Float_t Buc_Delta_Z_Position = 0.; +const Float_t Buc_First_Y_Position = -9.; // +const Float_t Buc_Delta_Y_Position = 12.; // +const Float_t Buc_rotate_Z = 180.; +const Float_t Buc_rotate_X = 180.; +const Int_t Buc_NTypes = 2; +const Float_t Buc_Types[Buc_NTypes] = {6., 6.}; +const Float_t Buc_Number[Buc_NTypes] = {1., 1.}; //debugging, V16b +const Float_t Buc_X_Offset[Buc_NTypes] = {1., 1.}; + +const Int_t Cer_NTypes = 3; +const Float_t Cer_Z_Position[Cer_NTypes] = {(float) (TOF_Z_Front + 13.2), + (float) (TOF_Z_Front + 15.), + (float) (TOF_Z_Front + 15.)}; +const Float_t Cer_X_Position[Cer_NTypes] = {0., 0., 0.}; +const Float_t Cer_Y_Position[Cer_NTypes] = {-1., 0., 0.}; +const Float_t Cer_rotate_Z[Cer_NTypes] = {0., 0., 0.}; +const Float_t Cer_Types[Cer_NTypes] = {5., 8., 8.}; +const Float_t Cer_Number[Cer_NTypes] = {1., 1., 1.}; //V16b + +const Float_t CERN_Z_Position = TOF_Z_Front + 35.; // 20 gap +const Float_t CERN_First_Y_Position = 0.; +const Float_t CERN_X_Offset = 3.2; //65.5; +const Float_t CERN_rotate_Z = -90.; +const Int_t CERN_NTypes = 1; +const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType! +const Float_t CERN_Number[CERN_NTypes] = { + 1.}; // evtl. double for split signals + +const Float_t Star_First_Z_Position = TOF_Z_Front - 12.; +const Float_t Star_Delta_Z_Position = 0; //20.; +const Float_t Star_First_Y_Position = 0.; // +const Float_t Star_Delta_Y_Position = 0.; // +const Float_t Star_rotate_Y = 0; //-6.8; +const Float_t Star_rotate_Z = 0.; +const Int_t Star_NTypes = 1; +const Float_t Star_Types[Star2_NTypes] = {1.}; +const Float_t Star_Number[Star2_NTypes] = {1.}; +const Float_t Star_X_Offset[Star2_NTypes] = {-5.}; // some global variables -TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance -TGeoVolume* gModules[NofModuleTypes]; // Global storage for module types +TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance +TGeoVolume* gModules[NofModuleTypes]; // Global storage for module types TGeoVolume* gCounter[NumberOfDifferentCounterTypes]; TGeoVolume* gPole; TGeoVolume* gBar[MaxNumberOfBars]; -const Float_t Dia_Z_Position=-0.5-TOF_Z_Front_Stand; -const Float_t Dia_First_Y_Position=0.; -const Float_t Dia_X_Offset=0.; -const Float_t Dia_rotate_Z=0.; -const Int_t Dia_NTypes = 1; +const Float_t Dia_Z_Position = -0.5 - TOF_Z_Front_Stand; +const Float_t Dia_First_Y_Position = 0.; +const Float_t Dia_X_Offset = 0.; +const Float_t Dia_rotate_Z = 0.; +const Int_t Dia_NTypes = 1; const Float_t Dia_Types[Dia_NTypes] = {5.}; const Float_t Dia_Number[Dia_NTypes] = {1.}; -Float_t Last_Size_Y=0.; -Float_t Last_Over_Y=0.; +Float_t Last_Size_Y = 0.; +Float_t Last_Over_Y = 0.; // Forward declarations void create_materials_from_media_file(); @@ -259,28 +288,28 @@ void position_Dia(Int_t); void position_Star2(Int_t); void position_Star(Int_t); void position_Buc(Int_t); -void position_cer_modules(Int_t); +void position_cer_modules(Int_t); void position_CERN(Int_t); void dump_info_file(); void Create_TOF_Geometry_v20b_cosmicHD() { - // Load the necessary FairRoot libraries -// gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); -// basiclibs(); -// gSystem->Load("libGeoBase"); -// gSystem->Load("libParBase"); -// gSystem->Load("libBase"); + // Load the necessary FairRoot libraries + // gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); + // basiclibs(); + // gSystem->Load("libGeoBase"); + // gSystem->Load("libParBase"); + // gSystem->Load("libBase"); // Load needed material definition from media.geo file create_materials_from_media_file(); // Get the GeoManager for later usage gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom"); - gGeoMan->SetVisLevel(5); // 2 = super modules - gGeoMan->SetVisOption(0); + gGeoMan->SetVisLevel(5); // 2 = super modules + gGeoMan->SetVisOption(0); - // Create the top volume + // Create the top volume /* TGeoBBox* topbox= new TGeoBBox("", 1000., 1000., 1000.); TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air")); @@ -289,10 +318,10 @@ void Create_TOF_Geometry_v20b_cosmicHD() { TGeoVolume* top = new TGeoVolumeAssembly("TOP"); gGeoMan->SetTopVolume(top); - + TGeoRotation* tof_rotation = new TGeoRotation(); - tof_rotation->RotateY( 0. ); // angle with respect to beam axis - //tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x + tof_rotation->RotateY(0.); // angle with respect to beam axis + //tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x // tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x // tof_rotation->RotateZ( 90 ); // electronics on 12 o'clock position (top) // tof_rotation->RotateZ( 180 ); // electronics on 3 o'clock position = -x @@ -302,50 +331,53 @@ void Create_TOF_Geometry_v20b_cosmicHD() { top->AddNode(tof, 1, tof_rotation); TGeoVolume* tofstand = new TGeoVolumeAssembly(geoVersionStand); - TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); + TGeoTranslation* stand_trans = + new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); TGeoRotation* stand_rot = new TGeoRotation(); stand_rot->RotateY(0.); - TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot); + TGeoCombiTrans* stand_combi_trans = + new TGeoCombiTrans(*stand_trans, *stand_rot); tof->AddNode(tofstand, 1, stand_combi_trans); - for(Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; counterType++) { + for (Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; + counterType++) { gCounter[counterType] = create_new_counter(counterType); } - for(Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) { + for (Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) { gModules[moduleType] = create_new_tof_module(moduleType); - gModules[moduleType]->SetVisContainers(1); - } + gModules[moduleType]->SetVisContainers(1); + } // no pole // gPole = create_tof_pole(); - + // position_side_tof_modules(1); // keep order !! // position_inner_tof_modules(2); // position_inner_tof_modules(3); // position_Dia(1); - position_Star2(1); + position_Star2(1); //position_cer_modules(3); // position_CERN(1); position_Buc(2); //position_Star(1); - cout << "Outer Types "<<Outer_Module_Types[0][0]<<", "<<Outer_Module_Types[1][0] - <<", col=1: "<<Outer_Module_Types[0][1]<<", "<<Outer_Module_Types[1][1] - <<endl; - cout << "Outer Number "<<Outer_Module_Number[0][0]<<", "<<Outer_Module_Number[1][0] - <<", col=1: "<<Outer_Module_Number[0][1]<<", "<<Outer_Module_Number[1][1] - <<endl; + cout << "Outer Types " << Outer_Module_Types[0][0] << ", " + << Outer_Module_Types[1][0] << ", col=1: " << Outer_Module_Types[0][1] + << ", " << Outer_Module_Types[1][1] << endl; + cout << "Outer Number " << Outer_Module_Number[0][0] << ", " + << Outer_Module_Number[1][0] << ", col=1: " << Outer_Module_Number[0][1] + << ", " << Outer_Module_Number[1][1] << endl; // position_outer_tof_modules(4); // position_tof_poles(0); // position_tof_bars(0); - + gGeoMan->CloseGeometry(); gGeoMan->CheckOverlaps(0.001); gGeoMan->PrintOverlaps(); gGeoMan->Test(); - + tof->Export(FileNameSim); TFile* geoFile = new TFile(FileNameSim, "UPDATE"); stand_combi_trans->Write(); @@ -356,46 +388,44 @@ void Create_TOF_Geometry_v20b_cosmicHD() { //gGeoMan->Write(); outfile1->Close(); */ - TFile* outfile2 = new TFile(FileNameGeo,"RECREATE"); + TFile* outfile2 = new TFile(FileNameGeo, "RECREATE"); gGeoMan->Write(); outfile2->Close(); dump_info_file(); - top->SetVisContainers(1); - gGeoMan->SetVisLevel(5); + top->SetVisContainers(1); + gGeoMan->SetVisLevel(5); top->Draw("ogl"); //top->Draw(); //gModules[0]->Draw("ogl"); // gModules[0]->Draw(""); - gModules[0]->SetVisContainers(1); + gModules[0]->SetVisContainers(1); // gModules[1]->Draw(""); - gModules[1]->SetVisContainers(1); + gModules[1]->SetVisContainers(1); //gModules[5]->Draw(""); // top->Raytrace(); - } -void create_materials_from_media_file() -{ +void create_materials_from_media_file() { // Use the FairRoot geometry interface to load the media which are already defined - FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader"); + FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader"); FairGeoInterface* geoFace = geoLoad->getGeoInterface(); - TString geoPath = gSystem->Getenv("VMCWORKDIR"); - TString geoFile = geoPath + "/geometry/media.geo"; + TString geoPath = gSystem->Getenv("VMCWORKDIR"); + TString geoFile = geoPath + "/geometry/media.geo"; geoFace->setMediaFile(geoFile); geoFace->readMedia(); // Read the required media and create them in the GeoManager - FairGeoMedia* geoMedia = geoFace->getMedia(); + FairGeoMedia* geoMedia = geoFace->getMedia(); FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder(); - FairGeoMedium* air = geoMedia->getMedium("air"); - FairGeoMedium* aluminium = geoMedia->getMedium("aluminium"); - FairGeoMedium* RPCgas = geoMedia->getMedium("RPCgas"); - FairGeoMedium* RPCgas_noact = geoMedia->getMedium("RPCgas_noact"); - FairGeoMedium* RPCglass = geoMedia->getMedium("RPCglass"); - FairGeoMedium* carbon = geoMedia->getMedium("carbon"); + FairGeoMedium* air = geoMedia->getMedium("air"); + FairGeoMedium* aluminium = geoMedia->getMedium("aluminium"); + FairGeoMedium* RPCgas = geoMedia->getMedium("RPCgas"); + FairGeoMedium* RPCgas_noact = geoMedia->getMedium("RPCgas_noact"); + FairGeoMedium* RPCglass = geoMedia->getMedium("RPCglass"); + FairGeoMedium* carbon = geoMedia->getMedium("carbon"); // include check if all media are found @@ -407,65 +437,64 @@ void create_materials_from_media_file() geoBuild->createMedium(carbon); } -TGeoVolume* create_counter(Int_t modType) -{ +TGeoVolume* create_counter(Int_t modType) { //glass - Float_t gdx=Glass_X[modType]; - Float_t gdy=Glass_Y[modType]; - Float_t gdz=Glass_Z[modType]; + Float_t gdx = Glass_X[modType]; + Float_t gdy = Glass_Y[modType]; + Float_t gdz = Glass_Z[modType]; //gas gap - Int_t nstrips=NumberOfReadoutStrips[modType]; - Int_t ngaps=NumberOfGaps[modType]; + Int_t nstrips = NumberOfReadoutStrips[modType]; + Int_t ngaps = NumberOfGaps[modType]; - Float_t ggdx=GasGap_X[modType]; - Float_t ggdy=GasGap_Y[modType]; - Float_t ggdz=GasGap_Z[modType]; - Float_t gsdx=ggdx/float(nstrips); + Float_t ggdx = GasGap_X[modType]; + Float_t ggdy = GasGap_Y[modType]; + Float_t ggdz = GasGap_Z[modType]; + Float_t gsdx = ggdx / float(nstrips); //single stack - Float_t dzpos=gdz+ggdz; - Float_t startzpos=SingleStackStartPosition_Z[modType]; + Float_t dzpos = gdz + ggdz; + Float_t startzpos = SingleStackStartPosition_Z[modType]; // electronics - //pcb dimensions - Float_t dxe=Electronics_X[modType]; - Float_t dye=Electronics_Y[modType]; - Float_t dze=Electronics_Z[modType]; - Float_t yele=(gdy+0.1)/2.+dye/2.; - + //pcb dimensions + Float_t dxe = Electronics_X[modType]; + Float_t dye = Electronics_Y[modType]; + Float_t dze = Electronics_Z[modType]; + Float_t yele = (gdy + 0.1) / 2. + dye / 2.; + // needed materials - TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); - TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); - TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); + TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); + TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // Single glass plate - TGeoBBox* glass_plate = new TGeoBBox("", gdx/2., gdy/2., gdz/2.); - TGeoVolume* glass_plate_vol = + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* glass_plate_trans - = new TGeoTranslation("", 0., 0., 0.); + glass_plate_vol->SetLineColor( + kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., 0.); // Single gas gap - TGeoBBox* gas_gap = new TGeoBBox("", ggdx/2., ggdy/2., ggdz/2.); - //TGeoVolume* gas_gap_vol = + TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); + //TGeoVolume* gas_gap_vol = //new TGeoVolume("tof_gas_gap", gas_gap, noActiveGasVolMed); - TGeoVolume* gas_gap_vol = + TGeoVolume* gas_gap_vol = new TGeoVolume("tof_gas_active", gas_gap, activeGasVolMed); - gas_gap_vol->Divide("Strip",1,nstrips,-ggdx/2.,0); + gas_gap_vol->Divide("Strip", 1, nstrips, -ggdx / 2., 0); - gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap - gas_gap_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_gap_trans - = new TGeoTranslation("", 0., 0., (gdz+ggdz)/2.); + gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap + gas_gap_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* gas_gap_trans = + new TGeoTranslation("", 0., 0., (gdz + ggdz) / 2.); - - // Single subdivided active gas gap + + // Single subdivided active gas gap /* TGeoBBox* gas_active = new TGeoBBox("", gsdx/2., ggdy/2., ggdz/2.); TGeoVolume* gas_active_vol = @@ -486,264 +515,264 @@ TGeoVolume* create_counter(Int_t modType) gas_gap_vol->AddNode(gas_active_vol, l, gas_active_trans); // single_stack->AddNode(gas_active_vol, l, gas_active_trans); } - */ + */ // Add 8 single stacks + one glass plate at the e09.750nd to a multi stack TGeoVolume* multi_stack = new TGeoVolumeAssembly("multi_stack"); Int_t l; - for (l=0; l<ngaps; l++){ - TGeoTranslation* single_stack_trans - = new TGeoTranslation("", 0., 0., startzpos + l*dzpos); + for (l = 0; l < ngaps; l++) { + TGeoTranslation* single_stack_trans = + new TGeoTranslation("", 0., 0., startzpos + l * dzpos); multi_stack->AddNode(single_stack, l, single_stack_trans); } - TGeoTranslation* single_glass_back_trans - = new TGeoTranslation("", 0., 0., startzpos + ngaps*dzpos); + TGeoTranslation* single_glass_back_trans = + new TGeoTranslation("", 0., 0., startzpos + ngaps * dzpos); multi_stack->AddNode(glass_plate_vol, l, single_glass_back_trans); - + // Add electronics above and below the glass stack to build a complete counter - TGeoVolume* counter = new TGeoVolumeAssembly("counter"); - TGeoTranslation* multi_stack_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoVolume* counter = new TGeoVolumeAssembly("counter"); + TGeoTranslation* multi_stack_trans = new TGeoTranslation("", 0., 0., 0.); counter->AddNode(multi_stack, l, multi_stack_trans); - TGeoBBox* pcb = new TGeoBBox("", dxe/2., dye/2., dze/2.); - TGeoVolume* pcb_vol = - new TGeoVolume("pcb", pcb, electronicsVolMed); - pcb_vol->SetLineColor(kCyan); // set line color for the gas gap - pcb_vol->SetTransparency(10); // set transparency for the TOF - for (Int_t l=0; l<2; l++){ + TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.); + TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed); + pcb_vol->SetLineColor(kCyan); // set line color for the gas gap + pcb_vol->SetTransparency(10); // set transparency for the TOF + for (Int_t l = 0; l < 2; l++) { yele *= -1.; - TGeoTranslation* pcb_trans - = new TGeoTranslation("", 0., yele, 0.); + TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.); counter->AddNode(pcb_vol, l, pcb_trans); } return counter; - } -TGeoVolume* create_new_counter(Int_t modType) -{ +TGeoVolume* create_new_counter(Int_t modType) { //glass - Float_t gdx=Glass_X[modType]; - Float_t gdy=Glass_Y[modType]; - Float_t gdz=Glass_Z[modType]; + Float_t gdx = Glass_X[modType]; + Float_t gdy = Glass_Y[modType]; + Float_t gdz = Glass_Z[modType]; //gas gap - Int_t nstrips=NumberOfReadoutStrips[modType]; - Int_t ngaps=NumberOfGaps[modType]; + Int_t nstrips = NumberOfReadoutStrips[modType]; + Int_t ngaps = NumberOfGaps[modType]; - Float_t ggdx=GasGap_X[modType]; - Float_t ggdy=GasGap_Y[modType]; - Float_t ggdz=GasGap_Z[modType]; - Float_t gsdx=ggdx/(Float_t)(nstrips); + Float_t ggdx = GasGap_X[modType]; + Float_t ggdy = GasGap_Y[modType]; + Float_t ggdz = GasGap_Z[modType]; + Float_t gsdx = ggdx / (Float_t)(nstrips); // electronics - //pcb dimensions - Float_t dxe=Electronics_X[modType]; - Float_t dye=Electronics_Y[modType]; - Float_t dze=Electronics_Z[modType]; - Float_t yele=gdy/2.+dye/2.; - + //pcb dimensions + Float_t dxe = Electronics_X[modType]; + Float_t dye = Electronics_Y[modType]; + Float_t dze = Electronics_Z[modType]; + Float_t yele = gdy / 2. + dye / 2.; + // counter size (calculate from glas, gap and electronics sizes) Float_t cdx = TMath::Max(gdx, ggdx); - cdx = TMath::Max(cdx, dxe)+ 0.2; - Float_t cdy = TMath::Max(gdy, ggdy) + 2*dye + 0.2; - Float_t cdz = ngaps * ggdz + (ngaps+1) * gdz + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok + cdx = TMath::Max(cdx, dxe) + 0.2; + Float_t cdy = TMath::Max(gdy, ggdy) + 2 * dye + 0.2; + Float_t cdz = ngaps * ggdz + (ngaps + 1) * gdz + + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok //calculate thickness and first position in counter of single stack - Float_t dzpos = gdz+ggdz; - Float_t startzposglas= -ngaps * (gdz + ggdz) /2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok - Float_t startzposgas = startzposglas + gdz/2. + ggdz/2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok + Float_t dzpos = gdz + ggdz; + Float_t startzposglas = + -ngaps * (gdz + ggdz) + / 2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok + Float_t startzposgas = + startzposglas + gdz / 2. + ggdz / 2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok // needed materials - TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); - TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); - TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); + TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); + TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // define counter volume - TGeoBBox* counter_box = new TGeoBBox("", cdx/2., cdy/2., cdz/2.); - TGeoVolume* counter = + TGeoBBox* counter_box = new TGeoBBox("", cdx / 2., cdy / 2., cdz / 2.); + TGeoVolume* counter = new TGeoVolume("counter", counter_box, noActiveGasVolMed); - counter->SetLineColor(kCyan); // set line color for the counter - counter->SetTransparency(70); // set transparency for the TOF + counter->SetLineColor(kCyan); // set line color for the counter + counter->SetTransparency(70); // set transparency for the TOF // define single glass plate volume - TGeoBBox* glass_plate = new TGeoBBox("", gdx/2., gdy/2., gdz/2.); - TGeoVolume* glass_plate_vol = + TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.); + TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); - glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate - glass_plate_vol->SetTransparency(20); // set transparency for the TOF + glass_plate_vol->SetLineColor( + kMagenta); // set line color for the glass plate + glass_plate_vol->SetTransparency(20); // set transparency for the TOF // define single gas gap volume - TGeoBBox* gas_gap = new TGeoBBox("", ggdx/2., ggdy/2., ggdz/2.); - TGeoVolume* gas_gap_vol = - new TGeoVolume("Gap", gas_gap, activeGasVolMed); - gas_gap_vol->Divide("Cell",1,nstrips,-ggdx/2.,0); - gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap - gas_gap_vol->SetTransparency(99); // set transparency for the TOF - + TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.); + TGeoVolume* gas_gap_vol = new TGeoVolume("Gap", gas_gap, activeGasVolMed); + gas_gap_vol->Divide("Cell", 1, nstrips, -ggdx / 2., 0); + gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap + gas_gap_vol->SetTransparency(99); // set transparency for the TOF + // place 8 gas gaps and 9 glas plates in the counter - for( Int_t igap = 0; igap <= ngaps; igap++) { + for (Int_t igap = 0; igap <= ngaps; igap++) { // place (ngaps+1) glass plates - Float_t zpos_glas = startzposglas + igap*dzpos; - TGeoTranslation* glass_plate_trans - = new TGeoTranslation("", 0., 0., zpos_glas); + Float_t zpos_glas = startzposglas + igap * dzpos; + TGeoTranslation* glass_plate_trans = + new TGeoTranslation("", 0., 0., zpos_glas); counter->AddNode(glass_plate_vol, igap, glass_plate_trans); // place ngaps gas gaps - if (igap < ngaps) - { - Float_t zpos_gas = startzposgas + igap*dzpos; - TGeoTranslation* gas_gap_trans - = new TGeoTranslation("", 0., 0., zpos_gas); + if (igap < ngaps) { + Float_t zpos_gas = startzposgas + igap * dzpos; + TGeoTranslation* gas_gap_trans = + new TGeoTranslation("", 0., 0., zpos_gas); counter->AddNode(gas_gap_vol, igap, gas_gap_trans); } -// cout <<"Zpos(Glas): "<< zpos_glas << endl; -// cout <<"Zpos(Gas): "<< zpos_gas << endl; + // cout <<"Zpos(Glas): "<< zpos_glas << endl; + // cout <<"Zpos(Gas): "<< zpos_gas << endl; } - + // create and place the electronics above and below the glas stack - TGeoBBox* pcb = new TGeoBBox("", dxe/2., dye/2., dze/2.); - TGeoVolume* pcb_vol = - new TGeoVolume("pcb", pcb, electronicsVolMed); + TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.); + TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed); pcb_vol->SetLineColor(kYellow); // kCyan); // set line color for electronics - pcb_vol->SetTransparency(10); // set transparency for the TOF - for (Int_t l=0; l<2; l++){ + pcb_vol->SetTransparency(10); // set transparency for the TOF + for (Int_t l = 0; l < 2; l++) { yele *= -1.; - TGeoTranslation* pcb_trans - = new TGeoTranslation("", 0., yele, 0.); + TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.); counter->AddNode(pcb_vol, l, pcb_trans); } - - return counter; + return counter; } -TGeoVolume* create_tof_module(Int_t modType) -{ - Int_t cType = CounterTypeInModule[modType]; - Float_t dx=Module_Size_X[modType]; - Float_t dy=Module_Size_Y[modType]; - Float_t dz=Module_Size_Z[modType]; - Float_t width_aluxl=Module_Thick_Alu_X_left; - Float_t width_aluxr=Module_Thick_Alu_X_right; - Float_t width_aluy=Module_Thick_Alu_Y; - Float_t width_aluz=Module_Thick_Alu_Z; +TGeoVolume* create_tof_module(Int_t modType) { + Int_t cType = CounterTypeInModule[modType]; + Float_t dx = Module_Size_X[modType]; + Float_t dy = Module_Size_Y[modType]; + Float_t dz = Module_Size_Z[modType]; + Float_t width_aluxl = Module_Thick_Alu_X_left; + Float_t width_aluxr = Module_Thick_Alu_X_right; + Float_t width_aluy = Module_Thick_Alu_Y; + Float_t width_aluz = Module_Thick_Alu_Z; - Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left)/2; + Float_t shift_gas_box = + (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; - Float_t dxpos=CounterXDistance[modType]; - Float_t startxpos=CounterXStartPosition[modType]; - Float_t dzoff=CounterZDistance[modType]; - Float_t rotangle=CounterRotationAngle[modType]; + Float_t dxpos = CounterXDistance[modType]; + Float_t startxpos = CounterXStartPosition[modType]; + Float_t dzoff = CounterZDistance[modType]; + Float_t rotangle = CounterRotationAngle[modType]; - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TString moduleName = Form("module_%d", modType); TGeoVolume* module = new TGeoVolumeAssembly(moduleName); - TGeoBBox* alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* alu_box_vol = - new TGeoVolume("alu_box", alu_box, boxVolMed); - alu_box_vol->SetLineColor(kGreen); // set line color for the alu box - alu_box_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* alu_box_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoBBox* alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* alu_box_vol = new TGeoVolume("alu_box", alu_box, boxVolMed); + alu_box_vol->SetLineColor(kGreen); // set line color for the alu box + alu_box_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* alu_box_trans = new TGeoTranslation("", 0., 0., 0.); module->AddNode(alu_box_vol, 0, alu_box_trans); - TGeoBBox* gas_box = new TGeoBBox("", (dx-(width_aluxl+width_aluxr))/2., (dy-2*width_aluy)/2., (dz-2*width_aluz)/2.); - TGeoVolume* gas_box_vol = + TGeoBBox* gas_box = new TGeoBBox("", + (dx - (width_aluxl + width_aluxr)) / 2., + (dy - 2 * width_aluy) / 2., + (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); - gas_box_vol->SetLineColor(kYellow); // set line color for the gas box - gas_box_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* gas_box_trans - = new TGeoTranslation("", shift_gas_box, 0., 0.); + gas_box_vol->SetLineColor(kYellow); // set line color for the gas box + gas_box_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* gas_box_trans = + new TGeoTranslation("", shift_gas_box, 0., 0.); alu_box_vol->AddNode(gas_box_vol, 0, gas_box_trans); - - for (Int_t j=0; j<5; j++){ //loop over counters (modules) + + for (Int_t j = 0; j < 5; j++) { //loop over counters (modules) Float_t zpos; if (0 == modType) { - zpos = dzoff *=-1; + zpos = dzoff *= -1; } else { zpos = 0.; } - //cout << "counter z position " << zpos << endl; - TGeoTranslation* counter_trans - = new TGeoTranslation("", startxpos+ j*dxpos , 0.0 , zpos); + //cout << "counter z position " << zpos << endl; + TGeoTranslation* counter_trans = + new TGeoTranslation("", startxpos + j * dxpos, 0.0, zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = + new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } return module; } -TGeoVolume* create_new_tof_module(Int_t modType) -{ - Int_t cType = CounterTypeInModule[modType]; - Float_t dx=Module_Size_X[modType]; - Float_t dy=Module_Size_Y[modType]; - Float_t dz=Module_Size_Z[modType]; - Float_t width_aluxl=Module_Thick_Alu_X_left; - Float_t width_aluxr=Module_Thick_Alu_X_right; - Float_t width_aluy=Module_Thick_Alu_Y; - Float_t width_aluz=Module_Thick_Alu_Z; - - Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left)/2; - - Float_t dxpos=CounterXDistance[modType]; - Float_t startxpos=CounterXStartPosition[modType]; - Float_t dypos=CounterYDistance[modType]; - Float_t startypos=CounterYStartPosition[modType]; - Float_t dzoff=CounterZDistance[modType]; - Float_t rotangle=CounterRotationAngle[modType]; - - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); +TGeoVolume* create_new_tof_module(Int_t modType) { + Int_t cType = CounterTypeInModule[modType]; + Float_t dx = Module_Size_X[modType]; + Float_t dy = Module_Size_Y[modType]; + Float_t dz = Module_Size_Z[modType]; + Float_t width_aluxl = Module_Thick_Alu_X_left; + Float_t width_aluxr = Module_Thick_Alu_X_right; + Float_t width_aluy = Module_Thick_Alu_Y; + Float_t width_aluz = Module_Thick_Alu_Z; + + Float_t shift_gas_box = + (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2; + + Float_t dxpos = CounterXDistance[modType]; + Float_t startxpos = CounterXStartPosition[modType]; + Float_t dypos = CounterYDistance[modType]; + Float_t startypos = CounterYStartPosition[modType]; + Float_t dzoff = CounterZDistance[modType]; + Float_t rotangle = CounterRotationAngle[modType]; + + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TString moduleName = Form("module_%d", modType); - TGeoBBox* module_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* module = - new TGeoVolume(moduleName, module_box, boxVolMed); - module->SetLineColor(kGreen); // set line color for the alu box - module->SetTransparency(20); // set transparency for the TOF + TGeoBBox* module_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* module = new TGeoVolume(moduleName, module_box, boxVolMed); + module->SetLineColor(kGreen); // set line color for the alu box + module->SetTransparency(20); // set transparency for the TOF - TGeoBBox* gas_box = new TGeoBBox("", (dx-(width_aluxl+width_aluxr))/2., (dy-2*width_aluy)/2., (dz-2*width_aluz)/2.); - TGeoVolume* gas_box_vol = + TGeoBBox* gas_box = new TGeoBBox("", + (dx - (width_aluxl + width_aluxr)) / 2., + (dy - 2 * width_aluy) / 2., + (dz - 2 * width_aluz) / 2.); + TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); - gas_box_vol->SetLineColor(kBlue); // set line color for the alu box - gas_box_vol->SetTransparency(50); // set transparency for the TOF - TGeoTranslation* gas_box_trans - = new TGeoTranslation("", shift_gas_box, 0., 0.); + gas_box_vol->SetLineColor(kBlue); // set line color for the alu box + gas_box_vol->SetTransparency(50); // set transparency for the TOF + TGeoTranslation* gas_box_trans = + new TGeoTranslation("", shift_gas_box, 0., 0.); module->AddNode(gas_box_vol, 0, gas_box_trans); - - for (Int_t j=0; j< NCounterInModule[modType]; j++){ //loop over counters (modules) - //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) - Float_t xpos,ypos,zpos; + + for (Int_t j = 0; j < NCounterInModule[modType]; + j++) { //loop over counters (modules) + //for (Int_t j=0; j< 1; j++){ //loop over counters (modules) + Float_t xpos, ypos, zpos; if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { - zpos = dzoff *=-1; + zpos = dzoff *= -1; } else { - zpos = CounterZStartPosition[modType]+j*dzoff; + zpos = CounterZStartPosition[modType] + j * dzoff; } //cout << "counter z position " << zpos << endl; - xpos=startxpos + j*dxpos; - ypos=startypos + j*dypos; + xpos = startxpos + j * dxpos; + ypos = startypos + j * dypos; - TGeoTranslation* counter_trans - = new TGeoTranslation("", xpos , ypos , zpos); + TGeoTranslation* counter_trans = new TGeoTranslation("", xpos, ypos, zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); - TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); + TGeoCombiTrans* counter_combi_trans = + new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } @@ -751,265 +780,257 @@ TGeoVolume* create_new_tof_module(Int_t modType) } -TGeoVolume* create_tof_pole() -{ +TGeoVolume* create_tof_pole() { // needed materials - TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); - TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); - - Float_t dx=Pole_Size_X; - Float_t dy=Pole_Size_Y; - Float_t dz=Pole_Size_Z; - Float_t width_alux=Pole_Thick_X; - Float_t width_aluy=Pole_Thick_Y; - Float_t width_aluz=Pole_Thick_Z; - - TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); - TGeoBBox* pole_alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* pole_alu_vol = + TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); + TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); + + Float_t dx = Pole_Size_X; + Float_t dy = Pole_Size_Y; + Float_t dz = Pole_Size_Z; + Float_t width_alux = Pole_Thick_X; + Float_t width_aluy = Pole_Thick_Y; + Float_t width_aluz = Pole_Thick_Z; + + TGeoVolume* pole = new TGeoVolumeAssembly("Pole"); + TGeoBBox* pole_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* pole_alu_vol = new TGeoVolume("pole_alu", pole_alu_box, boxVolMed); - pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box - pole_alu_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* pole_alu_trans - = new TGeoTranslation("", 0., 0., 0.); + pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box + pole_alu_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* pole_alu_trans = new TGeoTranslation("", 0., 0., 0.); pole->AddNode(pole_alu_vol, 0, pole_alu_trans); - Float_t air_dx = dx/2. - width_alux; - Float_t air_dy = dy/2. - width_aluy; - Float_t air_dz = dz/2. - width_aluz; + Float_t air_dx = dx / 2. - width_alux; + Float_t air_dy = dy / 2. - width_aluy; + Float_t air_dz = dz / 2. - width_aluz; // cout << "My pole." << endl; if (air_dx <= 0.) - cout << "ERROR - No air volume in pole X, size: "<< air_dx << endl; + cout << "ERROR - No air volume in pole X, size: " << air_dx << endl; if (air_dy <= 0.) - cout << "ERROR - No air volume in pole Y, size: "<< air_dy << endl; + cout << "ERROR - No air volume in pole Y, size: " << air_dy << endl; if (air_dz <= 0.) - cout << "ERROR - No air volume in pole Z, size: "<< air_dz << endl; + cout << "ERROR - No air volume in pole Z, size: " << air_dz << endl; - if ((air_dx > 0.) && (air_dy > 0.) && (air_dz > 0.)) // crate air volume only, if larger than zero + if ((air_dx > 0.) && (air_dy > 0.) + && (air_dz > 0.)) // crate air volume only, if larger than zero { TGeoBBox* pole_air_box = new TGeoBBox("", air_dx, air_dy, air_dz); // TGeoBBox* pole_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz); - TGeoVolume* pole_air_vol = + TGeoVolume* pole_air_vol = new TGeoVolume("pole_air", pole_air_box, airVolMed); - pole_air_vol->SetLineColor(kYellow); // set line color for the alu box - pole_air_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* pole_air_trans - = new TGeoTranslation("", 0., 0., 0.); + pole_air_vol->SetLineColor(kYellow); // set line color for the alu box + pole_air_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* pole_air_trans = new TGeoTranslation("", 0., 0., 0.); pole_alu_vol->AddNode(pole_air_vol, 0, pole_air_trans); - } - else - cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy << " " << air_dz << endl; + } else + cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy + << " " << air_dz << endl; return pole; } -TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) -{ +TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz) { // needed materials TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium); - - Float_t width_alux=Pole_Thick_X; - Float_t width_aluy=Pole_Thick_Y; - Float_t width_aluz=Pole_Thick_Z; - - TGeoVolume* bar = new TGeoVolumeAssembly("Bar"); - TGeoBBox* bar_alu_box = new TGeoBBox("", dx/2., dy/2., dz/2.); - TGeoVolume* bar_alu_vol = - new TGeoVolume("bar_alu", bar_alu_box, boxVolMed); - bar_alu_vol->SetLineColor(kGreen); // set line color for the alu box - bar_alu_vol->SetTransparency(20); // set transparency for the TOF - TGeoTranslation* bar_alu_trans - = new TGeoTranslation("", 0., 0., 0.); + + Float_t width_alux = Pole_Thick_X; + Float_t width_aluy = Pole_Thick_Y; + Float_t width_aluz = Pole_Thick_Z; + + TGeoVolume* bar = new TGeoVolumeAssembly("Bar"); + TGeoBBox* bar_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.); + TGeoVolume* bar_alu_vol = new TGeoVolume("bar_alu", bar_alu_box, boxVolMed); + bar_alu_vol->SetLineColor(kGreen); // set line color for the alu box + bar_alu_vol->SetTransparency(20); // set transparency for the TOF + TGeoTranslation* bar_alu_trans = new TGeoTranslation("", 0., 0., 0.); bar->AddNode(bar_alu_vol, 0, bar_alu_trans); - TGeoBBox* bar_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz); - TGeoVolume* bar_air_vol = - new TGeoVolume("bar_air", bar_air_box, airVolMed); - bar_air_vol->SetLineColor(kYellow); // set line color for the alu box - bar_air_vol->SetTransparency(70); // set transparency for the TOF - TGeoTranslation* bar_air_trans - = new TGeoTranslation("", 0., 0., 0.); + TGeoBBox* bar_air_box = new TGeoBBox( + "", dx / 2. - width_alux, dy / 2. - width_aluy, dz / 2. - width_aluz); + TGeoVolume* bar_air_vol = new TGeoVolume("bar_air", bar_air_box, airVolMed); + bar_air_vol->SetLineColor(kYellow); // set line color for the alu box + bar_air_vol->SetTransparency(70); // set transparency for the TOF + TGeoTranslation* bar_air_trans = new TGeoTranslation("", 0., 0., 0.); bar_alu_vol->AddNode(bar_air_vol, 0, bar_air_trans); return bar; } -void position_tof_poles(Int_t modType) -{ +void position_tof_poles(Int_t modType) { - TGeoTranslation* pole_trans=NULL; - - Int_t numPoles=0; - for (Int_t i=0; i<NumberOfPoles; i++){ - if(i<2) { - pole_trans - = new TGeoTranslation("", -Pole_Offset+2.0, 0., Pole_ZPos[i]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; - }else{ - Float_t xPos=Pole_Offset+Pole_Size_X/2.+Pole_Col[i]*DxColl; - Float_t zPos=Pole_ZPos[i]; - pole_trans - = new TGeoTranslation("", xPos, 0., zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; - - pole_trans - = new TGeoTranslation("", -xPos, 0., zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); - numPoles++; + TGeoTranslation* pole_trans = NULL; + + Int_t numPoles = 0; + for (Int_t i = 0; i < NumberOfPoles; i++) { + if (i < 2) { + pole_trans = + new TGeoTranslation("", -Pole_Offset + 2.0, 0., Pole_ZPos[i]); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; + } else { + Float_t xPos = Pole_Offset + Pole_Size_X / 2. + Pole_Col[i] * DxColl; + Float_t zPos = Pole_ZPos[i]; + pole_trans = new TGeoTranslation("", xPos, 0., zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; + + pole_trans = new TGeoTranslation("", -xPos, 0., zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans); + numPoles++; } - cout << " Position Pole "<< numPoles<<" at z="<< Pole_ZPos[i] << endl; + cout << " Position Pole " << numPoles << " at z=" << Pole_ZPos[i] << endl; } } -void position_tof_bars(Int_t modType) -{ +void position_tof_bars(Int_t modType) { - TGeoTranslation* bar_trans=NULL; + TGeoTranslation* bar_trans = NULL; - Int_t numBars=0; + Int_t numBars = 0; Int_t i; Float_t xPos; Float_t yPos; Float_t zPos; - for (i=0; i<NumberOfBars; i++){ + for (i = 0; i < NumberOfBars; i++) { - xPos=Bar_XPos[i]; - zPos=Bar_ZPos[i]; - yPos=Pole_Size_Y/2.+Bar_Size_Y/2.; + xPos = Bar_XPos[i]; + zPos = Bar_ZPos[i]; + yPos = Pole_Size_Y / 2. + Bar_Size_Y / 2.; - bar_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", xPos,-yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", -xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + bar_trans = new TGeoTranslation("", -xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; - bar_trans = new TGeoTranslation("", -xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; - - } - cout << " Position Bar "<< numBars<<" at z="<< Bar_ZPos[i] << endl; + bar_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; + } + cout << " Position Bar " << numBars << " at z=" << Bar_ZPos[i] << endl; + + // horizontal frame bars + i = NumberOfBars; + NumberOfBars++; + // no bar + // gBar[i]=create_tof_bar(2.*xPos+Pole_Size_X,Bar_Size_Y,Bar_Size_Y); + + zPos = Pole_ZPos[0] + Pole_Size_Z / 2.; + bar_trans = new TGeoTranslation("", 0., yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; + + bar_trans = new TGeoTranslation("", 0., -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); + numBars++; +} - // horizontal frame bars - i = NumberOfBars; - NumberOfBars++; - // no bar - // gBar[i]=create_tof_bar(2.*xPos+Pole_Size_X,Bar_Size_Y,Bar_Size_Y); +void position_inner_tof_modules(Int_t modNType) { + TGeoTranslation* module_trans = NULL; - zPos = Pole_ZPos[0]+Pole_Size_Z/2.; - bar_trans = new TGeoTranslation("", 0., yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = Inner_Module_First_Y_Position; + Int_t ii = 0; + Float_t xPos = Inner_Module_X_Offset; + Float_t zPos = Wall_Z_Position; - bar_trans = new TGeoTranslation("", 0., -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans); - numBars++; + Pole_ZPos[NumberOfPoles] = zPos; + Pole_Col[NumberOfPoles] = 0; + NumberOfPoles++; -} + Float_t DzPos = 0.; + for (Int_t j = 0; j < modNType; j++) { + if (Module_Size_Z[j] > DzPos) { DzPos = Module_Size_Z[j]; } + } + Pole_ZPos[NumberOfPoles] = zPos + DzPos; + Pole_Col[NumberOfPoles] = 0; + NumberOfPoles++; + + // for (Int_t j=0; j<modNType; j++){ + // for (Int_t j=1; j<modNType; j++){ + Int_t modType; + Int_t modNum; + for (Int_t j = 2; j < modNType; + j++) { // place only M4 type modules (modNType == 2) + //DEDE + modType = Inner_Module_Types[j]; + modNum = 0; + // for(Int_t i=0; i<Inner_Module_Number[j]; i++) { + // for(Int_t i=0; i<1; i++) { // place 1x2 modules in the top and same in the bottom + for (Int_t i = 0; i < 2; + i++) { // place 2x2 modules in the top and same in the bottom + ii++; + cout << "Inner ii " << ii << " Last " << Last_Size_Y << ", " + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + // DeltaY = 1.5; + cout << "DeltaY " << DeltaY << endl; + yPos += DeltaY; + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + cout << "Position Inner Module " << i << " of " << Inner_Module_Number[j] + << " Type " << modType << " at Y = " << yPos + << " Ysize = " << Module_Size_Y[modType] << " DeltaY = " << DeltaY + << endl; + + /// module_trans = new TGeoTranslation("", xPos, yPos, zPos); + /// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + /// modNum++; + /// module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + /// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + /// modNum++; + // // if (ii>0) { + // if (ii>1) { + // module_trans + // = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); + // gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + // modNum++; + // module_trans + // = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); + // gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); + // modNum++; + // } + } + } + // module_trans = new TGeoTranslation("", xPos, -49-3, zPos); + + // Mar2019 setup + const Int_t NModules = 5; + xPos = 0.; + yPos = 0.; + zPos = TOF_Z_Front; + const Double_t ModDx[NModules] = {0., 0., 1.5, 49.8, 49.8}; + //const Double_t ModDx[NModules]= { 1.5, 0., -1.5, 49.8, 55.8}; + const Double_t ModDy[NModules] = {0., 0., 0., 0., 0.}; + const Double_t ModDz[NModules] = {0., 16.5, 34., 0., 16.5}; + const Double_t ModAng[NModules] = {-90., -90., -90., -90., -90.0}; + TGeoRotation* module_rot = NULL; + TGeoCombiTrans* module_combi_trans = NULL; -void position_inner_tof_modules(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=Inner_Module_First_Y_Position; - Int_t ii=0; - Float_t xPos = Inner_Module_X_Offset; - Float_t zPos = Wall_Z_Position; - - Pole_ZPos[NumberOfPoles] = zPos; - Pole_Col[NumberOfPoles] = 0; - NumberOfPoles++; - - Float_t DzPos =0.; - for (Int_t j=0; j<modNType; j++){ - if (Module_Size_Z[j]>DzPos){ - DzPos = Module_Size_Z[j]; - } - } - Pole_ZPos[NumberOfPoles]=zPos+DzPos; - Pole_Col[NumberOfPoles] = 0; - NumberOfPoles++; - - // for (Int_t j=0; j<modNType; j++){ - // for (Int_t j=1; j<modNType; j++){ - Int_t modType; - Int_t modNum; - for (Int_t j=2; j<modNType; j++){ // place only M4 type modules (modNType == 2) - //DEDE - modType = Inner_Module_Types[j]; - modNum = 0; - // for(Int_t i=0; i<Inner_Module_Number[j]; i++) { - // for(Int_t i=0; i<1; i++) { // place 1x2 modules in the top and same in the bottom - for(Int_t i=0; i<2; i++) { // place 2x2 modules in the top and same in the bottom - ii++; - cout << "Inner ii "<<ii<<" Last "<<Last_Size_Y<<", "<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - // DeltaY = 1.5; - cout << "DeltaY " << DeltaY << endl; - yPos += DeltaY; - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - cout <<"Position Inner Module "<<i<<" of "<<Inner_Module_Number[j]<<" Type "<<modType - <<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; - -/// module_trans = new TGeoTranslation("", xPos, yPos, zPos); -/// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -/// modNum++; -/// module_trans = new TGeoTranslation("", xPos, -yPos, zPos); -/// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -/// modNum++; -// // if (ii>0) { -// if (ii>1) { -// module_trans -// = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); -// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -// modNum++; -// module_trans -// = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); -// gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); -// modNum++; -// } + for (Int_t iMod = 0; iMod < NModules; iMod++) { + module_trans = new TGeoTranslation( + "", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]); + module_rot = new TGeoRotation(); + module_rot->RotateZ(ModAng[iMod]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; } - } - // module_trans = new TGeoTranslation("", xPos, -49-3, zPos); - - // Mar2019 setup - const Int_t NModules=5; - xPos=0.; - yPos=0.; - zPos=TOF_Z_Front; - const Double_t ModDx[NModules]= { 0., 0., 1.5, 49.8, 49.8}; - //const Double_t ModDx[NModules]= { 1.5, 0., -1.5, 49.8, 55.8}; - const Double_t ModDy[NModules]= { 0., 0., 0., 0., 0. }; - const Double_t ModDz[NModules]= { 0., 16.5, 34., 0., 16.5}; - const Double_t ModAng[NModules]={-90.,-90.,-90., -90.,-90.0}; - TGeoRotation* module_rot = NULL; - TGeoCombiTrans* module_combi_trans = NULL; - - for (Int_t iMod=0; iMod<NModules; iMod++) { - module_trans = new TGeoTranslation("", xPos+ModDx[iMod], yPos+ModDy[iMod], zPos+ModDz[iMod]); - module_rot = new TGeoRotation(); - module_rot->RotateZ(ModAng[iMod]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - } - - - /* + + + /* module_trans = new TGeoTranslation("", xPos, 0, zPos+16.5); gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); modNum++; @@ -1032,417 +1053,419 @@ void position_inner_tof_modules(Int_t modNType) } -void position_Dia(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(Dia_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=Dia_First_Y_Position; - Int_t ii=0; - Float_t xPos = Dia_X_Offset; - Float_t zPos = Dia_Z_Position; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Dia_Types[j]; - for(Int_t i=0; i<Dia_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; +void position_Dia(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(Dia_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; + + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = Dia_First_Y_Position; + Int_t ii = 0; + Float_t xPos = Dia_X_Offset; + Float_t zPos = Dia_Z_Position; + + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Dia_Types[j]; + for (Int_t i = 0; i < Dia_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } } - } } -void position_Star2(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); +void position_Star2(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(Star2_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Star2_First_Y_Position; - Float_t zPos = Star2_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Star2_Types[j]; - Float_t xPos = Star2_X_Offset[j]; - for(Int_t i=0; i<Star2_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Star2_Delta_Y_Position; - zPos += Star2_Delta_Z_Position[modNum]; - } + TGeoCombiTrans* module_combi_trans = NULL; - } -} + Float_t yPos = Star2_First_Y_Position; + Float_t zPos = Star2_First_Z_Position; + Int_t ii = 0; -void position_Buc(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation("Buc2018",Buc_rotate_Z,Buc_rotate_X,0.); - //TGeoRotation* module_rot = new TGeoRotation(); - // module_rot->RotateZ(Buc_rotate_Z); - // module_rot->RotateX(Buc_rotate_X); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Buc_First_Y_Position; - Float_t zPos = Buc_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Buc_Types[j]; - Float_t xPos = Buc_X_Offset[j]; - for(Int_t i=0; i<Buc_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Buc_Delta_Y_Position; - zPos += Buc_Delta_Z_Position; + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Star2_Types[j]; + Float_t xPos = Star2_X_Offset[j]; + for (Int_t i = 0; i < Star2_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Star2_Delta_Y_Position; + zPos += Star2_Delta_Z_Position[modNum]; + } } - } } -void position_cer_modules(Int_t modNType) -{ - Int_t ii=0; - Int_t modNum = 0; - for (Int_t j=1; j<modNType; j++){ - Int_t modType= Cer_Types[j]; - Float_t xPos = Cer_X_Position[j]; - Float_t yPos = Cer_Y_Position[j]; - Float_t zPos = Cer_Z_Position[j]; - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(Form("Cer%d",j),Cer_rotate_Z[j],-MeanTheta,0.); - // module_rot->RotateZ(Cer_rotate_Z[j]); +void position_Buc(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = + new TGeoRotation("Buc2018", Buc_rotate_Z, Buc_rotate_X, 0.); + //TGeoRotation* module_rot = new TGeoRotation(); + // module_rot->RotateZ(Buc_rotate_Z); + // module_rot->RotateX(Buc_rotate_X); TGeoCombiTrans* module_combi_trans = NULL; - for(Int_t i=0; i<Cer_Number[j]; i++) { - ii++; - cout <<"Position Ceramic Module "<<i<<" of "<<Cer_Number[j]<<" Type "<<modType - <<" at X = "<<xPos - <<", Y = "<<yPos - <<", Z = "<<zPos - <<endl; - // Front staggered module (Top if pair), top - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - // modNum++; - } - } -} + Float_t yPos = Buc_First_Y_Position; + Float_t zPos = Buc_First_Z_Position; + Int_t ii = 0; -void position_CERN(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(CERN_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=CERN_First_Y_Position; - Int_t ii=0; - Float_t xPos = CERN_X_Offset; - Float_t zPos = CERN_Z_Position; - - for (Int_t j=0; j<modNType; j++){ - Int_t modType= CERN_Types[j]; Int_t modNum = 0; - for(Int_t i=0; i<CERN_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Buc_Types[j]; + Float_t xPos = Buc_X_Offset[j]; + for (Int_t i = 0; i < Buc_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Buc_Delta_Y_Position; + zPos += Buc_Delta_Z_Position; + } } - } } -void position_Star(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - // TGeoRotation* module_rot = new TGeoRotation("Star",Star_rotate_Z,Star_rotate_Y,0.); - TGeoRotation* module_rot = new TGeoRotation("Star"); - module_rot->RotateY(Star_rotate_Y); - // module_rot->RotateZ(Star_rotate_Z); - TGeoCombiTrans* module_combi_trans = NULL; - - Float_t yPos = Star_First_Y_Position; - Float_t zPos = Star_First_Z_Position; - Int_t ii=0; - - Int_t modNum = 0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= Star_Types[j]; - Float_t xPos = Star_X_Offset[j]; - for(Int_t i=0; i<Star_Number[j]; i++) { - ii++; - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; - yPos += Star_Delta_Y_Position; - zPos += Star_Delta_Z_Position; +void position_cer_modules(Int_t modNType) { + Int_t ii = 0; + Int_t modNum = 0; + for (Int_t j = 1; j < modNType; j++) { + Int_t modType = Cer_Types[j]; + Float_t xPos = Cer_X_Position[j]; + Float_t yPos = Cer_Y_Position[j]; + Float_t zPos = Cer_Z_Position[j]; + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = + new TGeoRotation(Form("Cer%d", j), Cer_rotate_Z[j], -MeanTheta, 0.); + // module_rot->RotateZ(Cer_rotate_Z[j]); + TGeoCombiTrans* module_combi_trans = NULL; + + for (Int_t i = 0; i < Cer_Number[j]; i++) { + ii++; + cout << "Position Ceramic Module " << i << " of " << Cer_Number[j] + << " Type " << modType << " at X = " << xPos << ", Y = " << yPos + << ", Z = " << zPos << endl; + // Front staggered module (Top if pair), top + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + // modNum++; + } } - } } -void position_side_tof_modules(Int_t modNType) -{ - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); - module_rot->RotateZ(180.); - TGeoCombiTrans* module_combi_trans = NULL; - - // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; - Float_t yPos=0.; //Inner_Module_First_Y_Position; - Int_t ii=0; - for (Int_t j=0; j<modNType; j++){ - Int_t modType= InnerSide_Module_Types[j]; - Int_t modNum = 0; - for(Int_t i=0; i<InnerSide_Module_Number[j]; i++) { - ii++; - cout << "InnerSide ii "<<ii<<" Last "<<Last_Size_Y<<","<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - if (ii>1){yPos += DeltaY;} - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - Float_t xPos = InnerSide_Module_X_Offset; - Float_t zPos = Wall_Z_Position; - cout <<"Position InnerSide Module "<<i<<" of "<<InnerSide_Module_Number[j]<<" Type "<<modType - <<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; - - module_trans - = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; +void position_CERN(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(CERN_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", -xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = CERN_First_Y_Position; + Int_t ii = 0; + Float_t xPos = CERN_X_Offset; + Float_t zPos = CERN_Z_Position; + + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = CERN_Types[j]; + Int_t modNum = 0; + for (Int_t i = 0; i < CERN_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } + } +} - if (ii>1) { - module_trans - = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; +void position_Star(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + // TGeoRotation* module_rot = new TGeoRotation("Star",Star_rotate_Z,Star_rotate_Y,0.); + TGeoRotation* module_rot = new TGeoRotation("Star"); + module_rot->RotateY(Star_rotate_Y); + // module_rot->RotateZ(Star_rotate_Z); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", -xPos, -yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + Float_t yPos = Star_First_Y_Position; + Float_t zPos = Star_First_Z_Position; + Int_t ii = 0; - module_trans - = new TGeoTranslation("", xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; + Int_t modNum = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = Star_Types[j]; + Float_t xPos = Star_X_Offset[j]; + for (Int_t i = 0; i < Star_Number[j]; i++) { + ii++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + yPos += Star_Delta_Y_Position; + zPos += Star_Delta_Z_Position; + } + } +} - module_trans - = new TGeoTranslation("", -xPos, yPos-DeltaY/2, zPos+Module_Size_Z[modType]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; +void position_side_tof_modules(Int_t modNType) { + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); + module_rot->RotateZ(180.); + TGeoCombiTrans* module_combi_trans = NULL; - module_trans - = new TGeoTranslation("", xPos, -(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans); - modNum++; + // Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1; + Float_t yPos = 0.; //Inner_Module_First_Y_Position; + Int_t ii = 0; + for (Int_t j = 0; j < modNType; j++) { + Int_t modType = InnerSide_Module_Types[j]; + Int_t modNum = 0; + for (Int_t i = 0; i < InnerSide_Module_Number[j]; i++) { + ii++; + cout << "InnerSide ii " << ii << " Last " << Last_Size_Y << "," + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + if (ii > 1) { yPos += DeltaY; } + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + Float_t xPos = InnerSide_Module_X_Offset; + Float_t zPos = Wall_Z_Position; + cout << "Position InnerSide Module " << i << " of " + << InnerSide_Module_Number[j] << " Type " << modType + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] + << " DeltaY = " << DeltaY << endl; - module_trans - = new TGeoTranslation("", -xPos,-(yPos-DeltaY/2), zPos+Module_Size_Z[modType]); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans); - modNum++; + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + module_trans = new TGeoTranslation("", -xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + if (ii > 1) { + module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", -xPos, yPos - DeltaY / 2, zPos + Module_Size_Z[modType]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_trans); + modNum++; + + module_trans = new TGeoTranslation( + "", -xPos, -(yPos - DeltaY / 2), zPos + Module_Size_Z[modType]); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum, module_combi_trans); + modNum++; + } } } - } } -void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) +void position_outer_tof_modules(Int_t nCol) //modType, Int_t col1, Int_t col2) { - TGeoTranslation* module_trans=NULL; - TGeoRotation* module_rot = new TGeoRotation(); + TGeoTranslation* module_trans = NULL; + TGeoRotation* module_rot = new TGeoRotation(); module_rot->RotateZ(180.); TGeoCombiTrans* module_combi_trans = NULL; // Int_t numModules=(Int_t)( (Outer_Module_Last_Y_Position-Outer_Module_First_Y_Position)/Module_Size_Y[modType])+1; - + Int_t modNum[NofModuleTypes]; - for (Int_t k=0; k<NofModuleTypes; k++){ - modNum[k]=0; + for (Int_t k = 0; k < NofModuleTypes; k++) { + modNum[k] = 0; } Float_t zPos = Wall_Z_Position; - for(Int_t j=0; j<nCol; j++){ - Float_t xPos = Outer_Module_X_Offset + ((j+1)*DxColl); - Last_Size_Y=0.; - Last_Over_Y=0.; - Float_t yPos = 0.; - Int_t ii=0; - Float_t DzPos =0.; - for(Int_t k=0; k<Outer_Module_NTypes; k++){ - Int_t modType= Outer_Module_Types[k][j]; - if(Module_Size_Z[modType]>DzPos){ - if(Outer_Module_Number[k][j]>0){ - DzPos = Module_Size_Z[modType]; + for (Int_t j = 0; j < nCol; j++) { + Float_t xPos = Outer_Module_X_Offset + ((j + 1) * DxColl); + Last_Size_Y = 0.; + Last_Over_Y = 0.; + Float_t yPos = 0.; + Int_t ii = 0; + Float_t DzPos = 0.; + for (Int_t k = 0; k < Outer_Module_NTypes; k++) { + Int_t modType = Outer_Module_Types[k][j]; + if (Module_Size_Z[modType] > DzPos) { + if (Outer_Module_Number[k][j] > 0) { DzPos = Module_Size_Z[modType]; } } - } - } - - zPos -= 2.*DzPos; //((j+1)*2*Module_Size_Z[modType]); - - Pole_ZPos[NumberOfPoles] = zPos; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; - Pole_ZPos[NumberOfPoles] = zPos+DzPos; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; - //if (j+1==nCol) { - if (1) { - Pole_ZPos[NumberOfPoles] = Pole_ZPos[0]; - Pole_Col[NumberOfPoles] = j+1; - NumberOfPoles++; + } - Bar_Size_Z = Pole_ZPos[0] - zPos; - gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); - Bar_ZPos[NumberOfBars] = zPos+Bar_Size_Z/2.-Pole_Size_Z/2.; - Bar_XPos[NumberOfBars] = xPos + Pole_Offset; - NumberOfBars++; - } - - for (Int_t k=0; k<Outer_Module_NTypes; k++) { - Int_t modType = Outer_Module_Types[k][j]; - Int_t numModules = Outer_Module_Number[k][j]; - - cout <<" Outer: position "<<numModules<<" of type "<<modType<<" in col "<<j - <<" at z = "<<zPos<<", DzPos = "<<DzPos<<endl; - for(Int_t i=0; i<numModules; i++) { - ii++; - cout << "Outer ii "<<ii<<" Last "<<Last_Size_Y<<","<<Last_Over_Y<<endl; - Float_t DeltaY=Module_Size_Y[modType]+Last_Size_Y-2.*(Module_Over_Y[modType]+Last_Over_Y); - if (ii>1){yPos += DeltaY;} - Last_Size_Y=Module_Size_Y[modType]; - Last_Over_Y=Module_Over_Y[modType]; - cout <<"Position Outer Module "<<i<<" of "<<Outer_Module_Number[k][j]<<" Type "<<modType - <<"(#"<<modNum[modType]<<") "<<" at Y = "<<yPos<<" Ysize = "<<Module_Size_Y[modType] - <<" DeltaY = "<<DeltaY<<endl; + zPos -= 2. * DzPos; //((j+1)*2*Module_Size_Z[modType]); - module_trans = new TGeoTranslation("", xPos, yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - - module_trans = new TGeoTranslation("", -xPos, yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - if (ii>1) { - module_trans - = new TGeoTranslation("", xPos, -yPos, zPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, -yPos, zPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - // second layer - module_trans - = new TGeoTranslation("", xPos, yPos-DeltaY/2., zPos+DzPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, yPos-DeltaY/2., zPos+DzPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; - - module_trans - = new TGeoTranslation("", xPos, -(yPos-DeltaY/2.), zPos+DzPos); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_trans); - modNum[modType]++; - module_trans - = new TGeoTranslation("", -xPos, -(yPos-DeltaY/2.), zPos+DzPos); - module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); - gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum[modType], module_combi_trans); - modNum[modType]++; + Pole_ZPos[NumberOfPoles] = zPos; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + Pole_ZPos[NumberOfPoles] = zPos + DzPos; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + //if (j+1==nCol) { + if (1) { + Pole_ZPos[NumberOfPoles] = Pole_ZPos[0]; + Pole_Col[NumberOfPoles] = j + 1; + NumberOfPoles++; + + Bar_Size_Z = Pole_ZPos[0] - zPos; + gBar[NumberOfBars] = create_tof_bar(Bar_Size_X, Bar_Size_Y, Bar_Size_Z); + Bar_ZPos[NumberOfBars] = zPos + Bar_Size_Z / 2. - Pole_Size_Z / 2.; + Bar_XPos[NumberOfBars] = xPos + Pole_Offset; + NumberOfBars++; + } + for (Int_t k = 0; k < Outer_Module_NTypes; k++) { + Int_t modType = Outer_Module_Types[k][j]; + Int_t numModules = Outer_Module_Number[k][j]; + + cout << " Outer: position " << numModules << " of type " << modType + << " in col " << j << " at z = " << zPos << ", DzPos = " << DzPos + << endl; + for (Int_t i = 0; i < numModules; i++) { + ii++; + cout << "Outer ii " << ii << " Last " << Last_Size_Y << "," + << Last_Over_Y << endl; + Float_t DeltaY = Module_Size_Y[modType] + Last_Size_Y + - 2. * (Module_Over_Y[modType] + Last_Over_Y); + if (ii > 1) { yPos += DeltaY; } + Last_Size_Y = Module_Size_Y[modType]; + Last_Over_Y = Module_Over_Y[modType]; + cout << "Position Outer Module " << i << " of " + << Outer_Module_Number[k][j] << " Type " << modType << "(#" + << modNum[modType] << ") " + << " at Y = " << yPos << " Ysize = " << Module_Size_Y[modType] + << " DeltaY = " << DeltaY << endl; + + module_trans = new TGeoTranslation("", xPos, yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + + module_trans = new TGeoTranslation("", -xPos, yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + if (ii > 1) { + module_trans = new TGeoTranslation("", xPos, -yPos, zPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = new TGeoTranslation("", -xPos, -yPos, zPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + // second layer + module_trans = + new TGeoTranslation("", xPos, yPos - DeltaY / 2., zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = + new TGeoTranslation("", -xPos, yPos - DeltaY / 2., zPos + DzPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + + module_trans = + new TGeoTranslation("", xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_trans); + modNum[modType]++; + module_trans = + new TGeoTranslation("", -xPos, -(yPos - DeltaY / 2.), zPos + DzPos); + module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot); + gGeoMan->GetVolume(geoVersionStand) + ->AddNode(gModules[modType], modNum[modType], module_combi_trans); + modNum[modType]++; + } } } - } } } -void dump_info_file() -{ - TDatime datetime; // used to get timestamp +void dump_info_file() { + TDatime datetime; // used to get timestamp printf("writing info file: %s\n", FileNameInfo.Data()); - FILE *ifile; - ifile = fopen(FileNameInfo.Data(),"w"); + FILE* ifile; + ifile = fopen(FileNameInfo.Data(), "w"); - if (ifile == NULL) - { - printf("error opening %s\n", FileNameInfo.Data()); - exit(1); - } + if (ifile == NULL) { + printf("error opening %s\n", FileNameInfo.Data()); + exit(1); + } - fprintf(ifile,"#\n## %s information file\n#\n\n", geoVersion.Data()); + fprintf(ifile, "#\n## %s information file\n#\n\n", geoVersion.Data()); - fprintf(ifile,"# created %d\n\n", datetime.GetDate()); + fprintf(ifile, "# created %d\n\n", datetime.GetDate()); - fprintf(ifile,"# TOF setup\n"); - if (TOF_Z_Front == 450) - fprintf(ifile,"SIS 100 hadron setup\n"); - if (TOF_Z_Front == 600) - fprintf(ifile,"SIS 100 electron\n"); - if (TOF_Z_Front == 650) - fprintf(ifile,"SIS 100 muon\n"); - if (TOF_Z_Front == 880) - fprintf(ifile,"SIS 300 electron\n"); - if (TOF_Z_Front == 1020) - fprintf(ifile,"SIS 300 muon\n"); - fprintf(ifile,"\n"); + fprintf(ifile, "# TOF setup\n"); + if (TOF_Z_Front == 450) fprintf(ifile, "SIS 100 hadron setup\n"); + if (TOF_Z_Front == 600) fprintf(ifile, "SIS 100 electron\n"); + if (TOF_Z_Front == 650) fprintf(ifile, "SIS 100 muon\n"); + if (TOF_Z_Front == 880) fprintf(ifile, "SIS 300 electron\n"); + if (TOF_Z_Front == 1020) fprintf(ifile, "SIS 300 muon\n"); + fprintf(ifile, "\n"); - const Float_t TOF_Z_Back = Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall + const Float_t TOF_Z_Back = + Wall_Z_Position + 1.5 * Module_Size_Z[0]; // back of TOF wall - fprintf(ifile,"# envelope\n"); + fprintf(ifile, "# envelope\n"); // Show extension of TRD - fprintf(ifile,"%7.2f cm start of TOF (z)\n", TOF_Z_Front); - fprintf(ifile,"%7.2f cm end of TOF (z)\n", TOF_Z_Back); - fprintf(ifile,"\n"); + fprintf(ifile, "%7.2f cm start of TOF (z)\n", TOF_Z_Front); + fprintf(ifile, "%7.2f cm end of TOF (z)\n", TOF_Z_Back); + fprintf(ifile, "\n"); // Layer thickness - fprintf(ifile,"# central tower position\n"); - fprintf(ifile,"%7.2f cm center of staggered, front RPC cell at x=0\n", Wall_Z_Position); - fprintf(ifile,"\n"); + fprintf(ifile, "# central tower position\n"); + fprintf(ifile, + "%7.2f cm center of staggered, front RPC cell at x=0\n", + Wall_Z_Position); + fprintf(ifile, "\n"); fclose(ifile); } diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C index 55a962a335..0343145ec6 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C @@ -327,7 +327,7 @@ void Create_TOF_Geometry_v20b_mcbm() { // TGeoTranslation* stand_trans = new TGeoTranslation("", 12., 0., TOF_Z_Front_Stand); // TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); TGeoRotation* stand_rot = new TGeoRotation(); - stand_rot->RotateY(-3.5); //-2.7); + stand_rot->RotateY(-3.5); //-2.7); TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot); //tof->AddNode(tofstand, 1, stand_combi_trans); diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21b_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21b_mcbm.C index f5dbc27e9f..6b9af47cd5 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21b_mcbm.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v21b_mcbm.C @@ -136,19 +136,12 @@ const Float_t MeanTheta = 0.; //Type of Counter for module const Int_t NCounterInModule[NofModuleTypes] = {5, 5, 3, 5, 5, 1, 2, 1, 8, 2}; -const Int_t NCounterMax=8; -const Int_t CounterTypeInModule[NofModuleTypes][NCounterMax] = - {0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, - 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, - 0, 7, 0, 0, 0, 0, 0, 0 - }; +const Int_t NCounterMax = 8; +const Int_t CounterTypeInModule[NofModuleTypes][NCounterMax] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 0, 7, 0, 0, 0, 0, 0, 0}; // Placement of the counter inside the module const Float_t CounterXStartPosition[NofModuleTypes] = @@ -616,7 +609,7 @@ TGeoVolume* create_new_counter(Int_t modType) { // define counter volume TGeoBBox* counter_box = new TGeoBBox("", cdx / 2., cdy / 2., cdz / 2.); TGeoVolume* counter = - new TGeoVolume(Form("counter_%d",modType), counter_box, noActiveGasVolMed); + new TGeoVolume(Form("counter_%d", modType), counter_box, noActiveGasVolMed); counter->SetLineColor(kRed); // set line color for the counter counter->SetTransparency(70); // set transparency for the TOF @@ -732,7 +725,7 @@ TGeoVolume* create_tof_module(Int_t modType) { } TGeoVolume* create_new_tof_module(Int_t modType) { - Int_t cType = CounterTypeInModule[modType][0]; //TBC + Int_t cType = CounterTypeInModule[modType][0]; //TBC Float_t dx = Module_Size_X[modType]; Float_t dy = Module_Size_Y[modType]; Float_t dz = Module_Size_Z[modType]; @@ -782,8 +775,9 @@ TGeoVolume* create_new_tof_module(Int_t modType) { } else { zpos = CounterZStartPosition[modType] + j * dzoff; } - cout << "place counter " << j << " of type " << CounterTypeInModule[modType][j] - << " in module of type "<<modType << " at z position " << zpos << endl; + cout << "place counter " << j << " of type " + << CounterTypeInModule[modType][j] << " in module of type " << modType + << " at z position " << zpos << endl; xpos = startxpos + j * dxpos; ypos = startypos + j * dypos; @@ -794,7 +788,8 @@ TGeoVolume* create_new_tof_module(Int_t modType) { TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); //gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); - gas_box_vol->AddNode(gCounter[CounterTypeInModule[modType][j]], j, counter_combi_trans); + gas_box_vol->AddNode( + gCounter[CounterTypeInModule[modType][j]], j, counter_combi_trans); } return module; diff --git a/macro/mcbm/geometry/tof/create_digipar.C b/macro/mcbm/geometry/tof/create_digipar.C old mode 100755 new mode 100644 index 50a38094f2..7b3600be29 --- a/macro/mcbm/geometry/tof/create_digipar.C +++ b/macro/mcbm/geometry/tof/create_digipar.C @@ -12,10 +12,9 @@ // -------------------------------------------------------------------------- -void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) -{ +void create_digipar(TString fileName = "tof_v16a_1e", Int_t nEvents = 0) { - cout<<"fileName: "<<fileName<<endl; + cout << "fileName: " << fileName << endl; // ======================================================================== @@ -34,20 +33,18 @@ void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) TString outFile = "test.esd." + fileName + ".root"; // Digi Parameter Output File -// TString digiFile = fileName + ".digi.par.long"; - TString digiFile = fileName + ".digi.par"; + // TString digiFile = fileName + ".digi.par.long"; + TString digiFile = fileName + ".digi.par"; // In general, the following parts need not be touched // ======================================================================== - // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ - // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); @@ -55,7 +52,7 @@ void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) // ----- Reconstruction run ------------------------------------------- - FairRunAna *run= new FairRunAna(); + FairRunAna* run = new FairRunAna(); //run->SetInputFile(inFile); //run->SetOutputFile(outFile); run->SetGeomFile(geoFile); @@ -66,11 +63,11 @@ void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo2->open(digiFile,"out"); + parIo2->open(digiFile, "out"); rtdb->setOutput(parIo2); - CbmTofCreateDigiPar* tofDigiProducer = new CbmTofCreateDigiPar("TOF Digi Producer", - "TOF task"); + CbmTofCreateDigiPar* tofDigiProducer = + new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task"); run->AddTask(tofDigiProducer); // ------------------------------------------------------------------------- @@ -84,11 +81,10 @@ void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) rtdb->print(); - CbmTofDigiPar* DigiPar = (CbmTofDigiPar*) - rtdb->getContainer("CbmTofDigiPar"); + CbmTofDigiPar* DigiPar = (CbmTofDigiPar*) rtdb->getContainer("CbmTofDigiPar"); DigiPar->setChanged(); - DigiPar->setInputVersion(run->GetRunId(),1); + DigiPar->setInputVersion(run->GetRunId(), 1); rtdb->print(); rtdb->saveOutput(); @@ -99,7 +95,7 @@ void create_digipar(TString fileName="tof_v16a_1e", Int_t nEvents = 0) Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; - cout << "Output file is " << outFile << endl; + cout << "Output file is " << outFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ diff --git a/macro/mcbm/mcbm_Ana.C b/macro/mcbm/mcbm_Ana.C index f4f8421c61..9f35663699 100644 --- a/macro/mcbm/mcbm_Ana.C +++ b/macro/mcbm/mcbm_Ana.C @@ -1,193 +1,290 @@ -void mcbm_Ana(Int_t nEvents = 1000, - TString cSys="lam", - TString cEbeam="2.5gev", - TString cCentr="-", - Int_t iRun=0, - Int_t parSet=0, - const char* setupName = "sis18_mcbm_20deg_long") -{ - const Char_t* setup="sis18_mcbm"; - TString outDir = "data/"; +void mcbm_Ana(Int_t nEvents = 1000, + TString cSys = "lam", + TString cEbeam = "2.5gev", + TString cCentr = "-", + Int_t iRun = 0, + Int_t parSet = 0, + const char* setupName = "sis18_mcbm_20deg_long") { + const Char_t* setup = "sis18_mcbm"; + TString outDir = "data/"; - TString InputFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; - TString RecoFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".eds." + Form("%05d",iRun) + ".root"; - TString ParFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; + TString InputFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".mc." + Form("%05d", iRun) + ".root"; + TString RecoFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".eds." + Form("%05d", iRun) + ".root"; + TString ParFile = outDir + setup + "_" + cSys + "." + cEbeam + "." + cCentr + + ".params." + Form("%05d", iRun) + ".root"; FairLogger::GetLogger()->SetLogScreenLevel("INFO"); //FairLogger::GetLogger()->SetLogScreenLevel("DEBUG"); FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); // ----- Reconstruction run ------------------------------------------- - FairRunAna *fRun= new FairRunAna(); + FairRunAna* fRun = new FairRunAna(); fRun->SetInputFile(InputFile.Data()); fRun->AddFriend(RecoFile.Data()); // ----- Parameter database -------------------------------------------- - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); + FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(ParFile.Data()); rtdb->setFirstInput(parInput1); - //histograms - fRun->SetOutputFile(Form("data/Ana.%s.%s.%s.%s.cut%d.%05d.root",setupName,cSys.Data(),cEbeam.Data(),cCentr.Data(),parSet,iRun)); - TFile *fHist = fRun->GetOutputFile(); + //histograms + fRun->SetOutputFile(Form("data/Ana.%s.%s.%s.%s.cut%d.%05d.root", + setupName, + cSys.Data(), + cEbeam.Data(), + cCentr.Data(), + parSet, + iRun)); + TFile* fHist = fRun->GetOutputFile(); - CbmHadronAnalysis *HadronAna = new CbmHadronAnalysis(); // in hadron - HadronAna->SetBeamMomentum(8.); // beam momentum - //HadronAna->SetBSelMax(8.99); // maximum impact parameter to be analyzed - //HadronAna->SetBSelMin(6.01); // minimum impact parameter to be analyzed - HadronAna->SetDY(0.5); // flow analysis exclusion window - HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction - - switch(parSet){ - case 0: // with background - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + CbmHadronAnalysis* HadronAna = new CbmHadronAnalysis(); // in hadron + HadronAna->SetBeamMomentum(8.); // beam momentum + //HadronAna->SetBSelMax(8.99); // maximum impact parameter to be analyzed + //HadronAna->SetBSelMin(6.01); // minimum impact parameter to be analyzed + HadronAna->SetDY(0.5); // flow analysis exclusion window + HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction + + switch (parSet) { + case 0: // with background + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 1: // for signal with background Ni+Ni - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 1: // for signal with background Ni+Ni + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 2: // for signal with background Au+Au - HadronAna->SetDistPrimLim(1.); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(8.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 2: // for signal with background Au+Au + HadronAna->SetDistPrimLim( + 1.); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 8.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; case 3: // syst study around case 1 - HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with - break; - case 4: // syst study around case 1 - HadronAna->SetDistPrimLim(0.9); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + HadronAna->SetDistPrimLim( + 0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 4: // syst study around case 1 + HadronAna->SetDistPrimLim( + 0.9); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 5: // syst study around case 1 - HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 5: // syst study around case 1 + HadronAna->SetDistPrimLim( + 1.1); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 6: // syst study around case 1 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 6: // syst study around case 1 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 7: // syst study around case 1 - HadronAna->SetDistPrimLim(0.7); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 7: // syst study around case 1 + HadronAna->SetDistPrimLim( + 0.7); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 8: // syst study around case 1 - HadronAna->SetDistPrimLim(0.6); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(0.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 8: // syst study around case 1 + HadronAna->SetDistPrimLim( + 0.6); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 0.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 10: // "0" with TRD Mul 1 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(1.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 10: // "0" with TRD Mul 1 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 1.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; - case 20: // "0" with TRD Mul 2 - HadronAna->SetDistPrimLim(1.2); // Max Tof-Sts trans distance for primaries - HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primaries - HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries - HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton - HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair - HadronAna->SetDCALim(0.1); // Max DCA for accepting pair - HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair - HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair - HadronAna->SetDistTRD(10.); // max accepted distance of Trd Hit from STS-TOF line - HadronAna->SetTRDHmulMin(2.); // min associated Trd Hits to Track candidates - HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + case 20: // "0" with TRD Mul 2 + HadronAna->SetDistPrimLim( + 1.2); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2( + 0.3); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2( + 0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim( + 0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair + HadronAna->SetVLenMin( + 5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax( + 25.); // Max Lambda flight path length for accepting pair + HadronAna->SetDistTRD( + 10.); // max accepted distance of Trd Hit from STS-TOF line + HadronAna->SetTRDHmulMin( + 2.); // min associated Trd Hits to Track candidates + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with break; default: - cout << "Cut value set " <<parSet<<" not existing, stop macro "<< endl; + cout << "Cut value set " << parSet << " not existing, stop macro " + << endl; return; } fRun->AddTask(HadronAna); @@ -198,10 +295,11 @@ void mcbm_Ana(Int_t nEvents = 1000, fRun->Run(0, nEvents); // ------------------------------------------------------------------------ -// save histos to file - fHist->Write(); + // save histos to file + fHist->Write(); - gROOT->LoadMacro("save_hst.C"); - TString FSave=Form("save_hst(\"data/status_%s_%s.%05d.hst.root\")",setup,cSys.Data(),iRun); - //gInterpreter->ProcessLine(FSave.Data()); + gROOT->LoadMacro("save_hst.C"); + TString FSave = Form( + "save_hst(\"data/status_%s_%s.%05d.hst.root\")", setup, cSys.Data(), iRun); + //gInterpreter->ProcessLine(FSave.Data()); } diff --git a/macro/mcbm/mcbm_digi_nh.C b/macro/mcbm/mcbm_digi_nh.C old mode 100755 new mode 100644 index c9d29ec220..bebb600a8f --- a/macro/mcbm/mcbm_digi_nh.C +++ b/macro/mcbm/mcbm_digi_nh.C @@ -28,17 +28,15 @@ **/ -void mcbm_digi_nh( - Int_t nEvents = 100, // Number of events to process - TString RunId = "test", - TString InDir = "./data/", - TString OutDir = "./data/", - TString setup = "mcbm_beam_2021_03", - Bool_t eventMode = kFALSE, // Event-by-event mode - Double_t eventRate = 1.e5, // Interaction rate [1/s] - Double_t timeSliceLength = 1.e4 // Length of time-slice [ns] -) -{ +void mcbm_digi_nh(Int_t nEvents = 100, // Number of events to process + TString RunId = "test", + TString InDir = "./data/", + TString OutDir = "./data/", + TString setup = "mcbm_beam_2021_03", + Bool_t eventMode = kFALSE, // Event-by-event mode + Double_t eventRate = 1.e5, // Interaction rate [1/s] + Double_t timeSliceLength = 1.e4 // Length of time-slice [ns] +) { // --- Logger settings ---------------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel("INFO"); @@ -49,28 +47,29 @@ void mcbm_digi_nh( // ----- Allow overwriting of output file ----------------------------- Bool_t overwrite = kTRUE; // ------------------------------------------------------------------------ - + // ----- File names --------------------------------------------------- - TString inFile = InDir + "/" + RunId + ".tra.root"; + TString inFile = InDir + "/" + RunId + ".tra.root"; TString parFile = OutDir + "/" + RunId + ".par.root"; - TString outFile = OutDir + "/" + RunId + Form(".%2.1e",eventRate) + ".raw.root"; + TString outFile = + OutDir + "/" + RunId + Form(".%2.1e", eventRate) + ".raw.root"; TString monFile = OutDir + "/" + RunId + ".raw.moni.root"; - if ( eventMode ) { + if (eventMode) { outFile = OutDir + "/" + RunId + ".event.raw.root"; monFile = OutDir + "/" + RunId + ".event.raw.moni.root"; } - - - // ----- Timer -------------------------------------------------------- + + + // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ - - + + // ----- Digitization run --------------------------------------------- CbmDigitization run; - + run.AddInput(inFile, eventRate); run.SetOutputFile(outFile, overwrite); run.SetMonitorFile(monFile); @@ -82,7 +81,7 @@ void mcbm_digi_nh( //run.Deactivate(ECbmModuleId::kSts); run.Deactivate(ECbmModuleId::kRich); - run.Deactivate(ECbmModuleId::kTrd); // deactivate for time based mode ! + run.Deactivate(ECbmModuleId::kTrd); // deactivate for time based mode ! run.Deactivate(ECbmModuleId::kMuch); run.Deactivate(ECbmModuleId::kPsd); @@ -98,21 +97,22 @@ void mcbm_digi_nh( std::cout << "Macro finished successfully." << std::endl; std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime - << " s" << std::endl << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" + << std::endl + << std::endl; // ------------------------------------------------------------------------ // ----- CTest resource monitoring ------------------------------------ FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; std::cout << "<DartMeasurement name=\"WallTime\" type=\"numeric/double\">"; std::cout << rtime; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; @@ -125,4 +125,4 @@ void mcbm_digi_nh( // ------------------------------------------------------------------------ -} // End of macro +} // End of macro diff --git a/macro/mcbm/mcbm_display_event.C b/macro/mcbm/mcbm_display_event.C index 12222749b0..37820ba6ff 100644 --- a/macro/mcbm/mcbm_display_event.C +++ b/macro/mcbm/mcbm_display_event.C @@ -13,17 +13,14 @@ // -------------------------------------------------------------------------- -void mcbm_display_event( - Int_t nEvents = 3, - TString dataset ="data/test", - const char* setupName = "sis18_mcbm_25deg_long" -) -{ +void mcbm_display_event(Int_t nEvents = 3, + TString dataset = "data/test", + const char* setupName = "sis18_mcbm_25deg_long") { // ======================================================================== // Adjust this part according to your requirements // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; + TString logLevel = "INFO"; //TString logLevel = "DEBUG"; // TString logVerbosity = "LOW"; TString logVerbosity = "MEDIUM"; @@ -37,20 +34,20 @@ void mcbm_display_event( // ----- File names --------------------------------------------------- - TString inFile = dataset + ".tra.root"; + TString inFile = dataset + ".tra.root"; TString rawFile = dataset + ".event.raw.root"; TString parFile = dataset + ".par.root"; TString recFile = dataset + ".dis.root"; // ------------------------------------------------------------------------ - Int_t iTofCluMode=1; - Int_t iTrackMode=1; + Int_t iTofCluMode = 1; + Int_t iTrackMode = 1; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << myName << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); @@ -62,27 +59,30 @@ void mcbm_display_event( // ----- Parameter files as input to the runtime database ------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList *parFileList = new TList(); + TList* parFileList = new TList(); TString geoTag; // - TRD digitisation parameters - if ( setup->GetGeoTag(kTrd, geoTag) ) { - TObjString* trdFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); + if (setup->GetGeoTag(kTrd, geoTag)) { + TObjString* trdFile = + new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); + parFileList->Add(trdFile); std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; + << trdFile->GetString() << std::endl; } // - TOF digitisation parameters - if ( setup->GetGeoTag(kTof, geoTag) ) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); + if (setup->GetGeoTag(kTof, geoTag)) { + TObjString* tofFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); + parFileList->Add(tofFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofFile->GetString() << std::endl; - TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); + << tofFile->GetString() << std::endl; + TObjString* tofBdfFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); + parFileList->Add(tofBdfFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; + << tofBdfFile->GetString() << std::endl; } // ------------------------------------------------------------------------ @@ -103,17 +103,18 @@ void mcbm_display_event( // ----- Input file --------------------------------------------------- std::cout << std::endl; - std::cout << "-I- " << myName << ": Using input file " << rawFile << std::endl; + std::cout << "-I- " << myName << ": Using input file " << rawFile + << std::endl; // ------------------------------------------------------------------------ // ----- FairRunAna --------------------------------------------------- - FairRunAna *run = new FairRunAna(); + FairRunAna* run = new FairRunAna(); run->SetInputFile(inFile); run->AddFriend(rawFile); run->SetOutputFile(recFile); run->SetGenerateRunInfo(kTRUE); - Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); + Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE); // ------------------------------------------------------------------------ @@ -125,139 +126,138 @@ void mcbm_display_event( // ----- Local reconstruction in MVD ---------------------------------- - if ( setup->IsActive(kMvd) ) { + if (setup->IsActive(kMvd)) { CbmMvdClusterfinder* mvdCluster = - new CbmMvdClusterfinder("MVD Cluster Finder", 0, 0); + new CbmMvdClusterfinder("MVD Cluster Finder", 0, 0); run->AddTask(mvdCluster); - std::cout << "-I- " << myName << ": Added task " - << mvdCluster->GetName() << std::endl; + std::cout << "-I- " << myName << ": Added task " << mvdCluster->GetName() + << std::endl; CbmMvdHitfinder* mvdHit = new CbmMvdHitfinder("MVD Hit Finder", 0, 0); mvdHit->UseClusterfinder(kTRUE); run->AddTask(mvdHit); - std::cout << "-I- " << myName << ": Added task " - << mvdHit->GetName() << std::endl; - + std::cout << "-I- " << myName << ": Added task " << mvdHit->GetName() + << std::endl; } // ------------------------------------------------------------------------ // ----- Local reconstruction in STS ---------------------------------- - if ( setup->IsActive(kSts) ) { + if (setup->IsActive(kSts)) { FairTask* stsReco = new CbmStsReco(); run->AddTask(stsReco); std::cout << "-I- : Added task " << stsReco->GetName() << std::endl; - } // ------------------------------------------------------------------------ // ----- Local reconstruction in MUCH --------------------------------- - if ( 0 ) { // setup->IsActive(kMuch) ) { - - // --- Parameter file name - TString geoTag; - setup->GetGeoTag(kMuch, geoTag); - Int_t muchFlag=0; - if (geoTag.Contains("mcbm")) muchFlag=1; - - TString parFile = gSystem->Getenv("VMCWORKDIR"); - - if (muchFlag) { - std::cout << geoTag << std::endl; - parFile = parFile + "/parameters/much/much_" + geoTag - + "_digi_sector.root"; - std::cout << "Using parameter file " << parFile << std::endl; - } else { - std::cout << geoTag(0,4) << std::endl; - parFile = parFile + "/parameters/much/much_" + geoTag(0,4) - + "_digi_sector.root"; - std::cout << "Using parameter file " << parFile << std::endl; - } - - - // --- Hit finder for GEMs - FairTask* muchHitGem = new CbmMuchFindHitsGem(parFile.Data(),muchFlag); - run->AddTask(muchHitGem); - std::cout << "-I- " << myName << ": Added task " - << muchHitGem->GetName() << FairLogger::endl; + if (0) { // setup->IsActive(kMuch) ) { + + // --- Parameter file name + TString geoTag; + setup->GetGeoTag(kMuch, geoTag); + Int_t muchFlag = 0; + if (geoTag.Contains("mcbm")) muchFlag = 1; + + TString parFile = gSystem->Getenv("VMCWORKDIR"); + + if (muchFlag) { + std::cout << geoTag << std::endl; + parFile = + parFile + "/parameters/much/much_" + geoTag + "_digi_sector.root"; + std::cout << "Using parameter file " << parFile << std::endl; + } else { + std::cout << geoTag(0, 4) << std::endl; + parFile = + parFile + "/parameters/much/much_" + geoTag(0, 4) + "_digi_sector.root"; + std::cout << "Using parameter file " << parFile << std::endl; + } + + // --- Hit finder for GEMs + FairTask* muchHitGem = new CbmMuchFindHitsGem(parFile.Data(), muchFlag); + run->AddTask(muchHitGem); + std::cout << "-I- " << myName << ": Added task " << muchHitGem->GetName() + << FairLogger::endl; } // ------------------------------------------------------------------------ // ----- Local reconstruction in TRD ---------------------------------- - if ( 0 ) { //setup->IsActive(kTrd) ) { + if (0) { //setup->IsActive(kTrd) ) { - Double_t triggerThreshold = 0.5e-6; // SIS100 - Bool_t triangularPads = false; // Bucharest triangular pad-plane layout + Double_t triggerThreshold = 0.5e-6; // SIS100 + Bool_t triangularPads = false; // Bucharest triangular pad-plane layout CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true); trdCluster->SetMinimumChargeTH(triggerThreshold); trdCluster->SetNeighbourEnable(false); trdCluster->SetRowMerger(true); run->AddTask(trdCluster); - std::cout << "-I- " << myName << ": Added task " - << trdCluster->GetName() << std::endl; + std::cout << "-I- " << myName << ": Added task " << trdCluster->GetName() + << std::endl; CbmTrdHitProducer* trdHit = new CbmTrdHitProducer(); run->AddTask(trdHit); - std::cout << "-I- " << myName << ": Added task " - << trdHit->GetName() << std::endl; - + std::cout << "-I- " << myName << ": Added task " << trdHit->GetName() + << std::endl; } // ------------------------------------------------------------------------ // ----- Local reconstruction in TOF ---------------------------------- - if ( setup->IsActive(kTof) ) { - switch(iTofCluMode) { - case 1: - { - CbmTofEventClusterizer* tofCluster = new CbmTofEventClusterizer("TOF Event Clusterizer",0,1); - Int_t calMode=93; - Int_t calSel=0; - Int_t calSm=0; - Int_t RefSel=0; - Double_t dDeadtime=50.; - - tofCluster->SetCalMode(calMode); - tofCluster->SetCalSel(calSel); - tofCluster->SetCaldXdYMax(3.); // geometrical matching window in cm - tofCluster->SetCalCluMulMax(5.); // Max Counter Cluster Multiplicity for filling calib histos - tofCluster->SetCalRpc(calSm); // select detector for calibration update - tofCluster->SetTRefId(RefSel); // reference trigger for offset calculation - tofCluster->SetTotMax(20.); // Tot upper limit for walk corection - tofCluster->SetTotMin(0.01); //(12000.); // Tot lower limit for walk correction - tofCluster->SetTotPreRange(5.); // effective lower Tot limit in ns from peak position - tofCluster->SetTotMean(5.); // Tot calibration target value in ns - tofCluster->SetMaxTimeDist(1.0); // default cluster range in ns - tofCluster->SetDelTofMax(5.); // acceptance range for cluster distance in ns (!) - tofCluster->SetSel2MulMax(3); // limit Multiplicity in 2nd selector - tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - tofCluster->SetEnableAvWalk(kFALSE); - //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target - tofCluster->SetYFitMin(1.E4); - tofCluster->SetToDAv(0.04); - tofCluster->SetIdMode(1); // calibrate on module level - tofCluster->SetTRefDifMax(2.0); // in ns - tofCluster->PosYMaxScal(0.75); //in % of length - run->AddTask(tofCluster); - std::cout << "-I- " << myName << ": Added task " - << tofCluster->GetName() << std::endl; - } - break; - default: - { - CbmTofSimpClusterizer* tofCluster - = new CbmTofSimpClusterizer("TOF Simple Clusterizer", 0); - tofCluster->SetOutputBranchPersistent("TofHit", kTRUE); - tofCluster->SetOutputBranchPersistent("TofDigiMatch", kTRUE); - run->AddTask(tofCluster); - std::cout << "-I- " << myName << ": Added task " - << tofCluster->GetName() << std::endl; + if (setup->IsActive(kTof)) { + switch (iTofCluMode) { + case 1: { + CbmTofEventClusterizer* tofCluster = + new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1); + Int_t calMode = 93; + Int_t calSel = 0; + Int_t calSm = 0; + Int_t RefSel = 0; + Double_t dDeadtime = 50.; + + tofCluster->SetCalMode(calMode); + tofCluster->SetCalSel(calSel); + tofCluster->SetCaldXdYMax(3.); // geometrical matching window in cm + tofCluster->SetCalCluMulMax( + 5.); // Max Counter Cluster Multiplicity for filling calib histos + tofCluster->SetCalRpc(calSm); // select detector for calibration update + tofCluster->SetTRefId( + RefSel); // reference trigger for offset calculation + tofCluster->SetTotMax(20.); // Tot upper limit for walk corection + tofCluster->SetTotMin( + 0.01); //(12000.); // Tot lower limit for walk correction + tofCluster->SetTotPreRange( + 5.); // effective lower Tot limit in ns from peak position + tofCluster->SetTotMean(5.); // Tot calibration target value in ns + tofCluster->SetMaxTimeDist(1.0); // default cluster range in ns + tofCluster->SetDelTofMax( + 5.); // acceptance range for cluster distance in ns (!) + tofCluster->SetSel2MulMax(3); // limit Multiplicity in 2nd selector + tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns + tofCluster->SetEnableAvWalk(kFALSE); + //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target + tofCluster->SetYFitMin(1.E4); + tofCluster->SetToDAv(0.04); + tofCluster->SetIdMode(1); // calibrate on module level + tofCluster->SetTRefDifMax(2.0); // in ns + tofCluster->PosYMaxScal(0.75); //in % of length + run->AddTask(tofCluster); + std::cout << "-I- " << myName << ": Added task " + << tofCluster->GetName() << std::endl; + } break; + default: { + CbmTofSimpClusterizer* tofCluster = + new CbmTofSimpClusterizer("TOF Simple Clusterizer", 0); + tofCluster->SetOutputBranchPersistent("TofHit", kTRUE); + tofCluster->SetOutputBranchPersistent("TofDigiMatch", kTRUE); + run->AddTask(tofCluster); + std::cout << "-I- " << myName << ": Added task " + << tofCluster->GetName() << std::endl; } } } @@ -267,108 +267,111 @@ void mcbm_display_event( // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch(iTrackMode) { - case 1: - { - Int_t iGenCor=1; - Double_t dScalFac=1.; - Double_t dChi2Lim2=3.5; - TString cTrkFile=Form("%s_tofFindTracks.hst.root","MC"); - Int_t iTrackingSetup=1; - - CbmTofTrackFinder* tofTrackFinder= new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + switch (iTrackMode) { + case 1: { + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter= new CbmTofTrackFitterKF(0,211); - TFitter *MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + CbmTofFindTracks* tofFindTracks = + new CbmTofFindTracks("TOF Track Finder"); tofFindTracks->UseFinder(tofTrackFinder); tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCorMode( + iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg( + 0.041); // target value for inverse velocity, > 0.033 ns/cm! //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5,0,0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2*2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits=-1; - Int_t iNStations=0; - Int_t iNReqStations=3; - switch (iTrackingSetup){ - case 0: // bypass mode - iMinNofHits=-1; - iNStations=1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits=3; - iNStations=39; - iNReqStations=3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 0); - tofFindTracks->SetStation(2, 0, 3, 0); - tofFindTracks->SetStation(3, 0, 4, 1); - tofFindTracks->SetStation(4, 0, 3, 1); - tofFindTracks->SetStation(5, 0, 4, 2); - tofFindTracks->SetStation(6, 0, 3, 2); - tofFindTracks->SetStation(7, 0, 4, 3); - tofFindTracks->SetStation(8, 0, 3, 3); - tofFindTracks->SetStation(9, 0, 4, 4); - tofFindTracks->SetStation(10, 0, 3, 4); - tofFindTracks->SetStation(11, 9, 0, 0); - tofFindTracks->SetStation(12, 9, 0, 1); - tofFindTracks->SetStation(13, 7, 0, 0); - tofFindTracks->SetStation(14, 6, 0, 0); - tofFindTracks->SetStation(15, 6, 0, 1); - tofFindTracks->SetStation(16, 8, 0, 0); - tofFindTracks->SetStation(17, 8, 0, 1); - tofFindTracks->SetStation(18, 8, 0, 2); - tofFindTracks->SetStation(19, 8, 0, 3); - tofFindTracks->SetStation(20, 8, 0, 4); - tofFindTracks->SetStation(21, 8, 0, 5); - tofFindTracks->SetStation(22, 8, 0, 6); - tofFindTracks->SetStation(23, 8, 0, 7); - tofFindTracks->SetStation(24, 0, 2, 2); - tofFindTracks->SetStation(25, 0, 1, 2); - tofFindTracks->SetStation(26, 0, 0, 2); - tofFindTracks->SetStation(27, 0, 2, 1); - tofFindTracks->SetStation(28, 0, 1, 1); - tofFindTracks->SetStation(29, 0, 0, 1); - tofFindTracks->SetStation(30, 0, 2, 3); - tofFindTracks->SetStation(31, 0, 1, 3); - tofFindTracks->SetStation(32, 0, 0, 3); - tofFindTracks->SetStation(33, 0, 2, 0); - tofFindTracks->SetStation(34, 0, 1, 0); - tofFindTracks->SetStation(35, 0, 0, 0); - tofFindTracks->SetStation(36, 0, 2, 4); - tofFindTracks->SetStation(37, 0, 1, 4); - tofFindTracks->SetStation(38, 0, 0, 4); - break; + tofFindTracks->SetCalParFileName( + cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul( + 30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib( + kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 + * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + iNStations = 39; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 0); + tofFindTracks->SetStation(2, 0, 3, 0); + tofFindTracks->SetStation(3, 0, 4, 1); + tofFindTracks->SetStation(4, 0, 3, 1); + tofFindTracks->SetStation(5, 0, 4, 2); + tofFindTracks->SetStation(6, 0, 3, 2); + tofFindTracks->SetStation(7, 0, 4, 3); + tofFindTracks->SetStation(8, 0, 3, 3); + tofFindTracks->SetStation(9, 0, 4, 4); + tofFindTracks->SetStation(10, 0, 3, 4); + tofFindTracks->SetStation(11, 9, 0, 0); + tofFindTracks->SetStation(12, 9, 0, 1); + tofFindTracks->SetStation(13, 7, 0, 0); + tofFindTracks->SetStation(14, 6, 0, 0); + tofFindTracks->SetStation(15, 6, 0, 1); + tofFindTracks->SetStation(16, 8, 0, 0); + tofFindTracks->SetStation(17, 8, 0, 1); + tofFindTracks->SetStation(18, 8, 0, 2); + tofFindTracks->SetStation(19, 8, 0, 3); + tofFindTracks->SetStation(20, 8, 0, 4); + tofFindTracks->SetStation(21, 8, 0, 5); + tofFindTracks->SetStation(22, 8, 0, 6); + tofFindTracks->SetStation(23, 8, 0, 7); + tofFindTracks->SetStation(24, 0, 2, 2); + tofFindTracks->SetStation(25, 0, 1, 2); + tofFindTracks->SetStation(26, 0, 0, 2); + tofFindTracks->SetStation(27, 0, 2, 1); + tofFindTracks->SetStation(28, 0, 1, 1); + tofFindTracks->SetStation(29, 0, 0, 1); + tofFindTracks->SetStation(30, 0, 2, 3); + tofFindTracks->SetStation(31, 0, 1, 3); + tofFindTracks->SetStation(32, 0, 0, 3); + tofFindTracks->SetStation(33, 0, 2, 0); + tofFindTracks->SetStation(34, 0, 1, 0); + tofFindTracks->SetStation(35, 0, 0, 0); + tofFindTracks->SetStation(36, 0, 2, 4); + tofFindTracks->SetStation(37, 0, 1, 4); + tofFindTracks->SetStation(38, 0, 0, 4); + break; } tofFindTracks->SetMinNofHits(iMinNofHits); tofFindTracks->SetNStations(iNStations); tofFindTracks->SetNReqStations(iNReqStations); tofFindTracks->PrintSetup(); run->AddTask(tofFindTracks); - } - break; - default: - { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, - beamWidthX, - beamWidthY); + } break; + default: { + CbmBinnedTrackerTask* trackerTask = + new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); trackerTask->SetUse(kTrd, kFALSE); run->AddTask(trackerTask); } @@ -379,8 +382,8 @@ void mcbm_display_event( // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data(), "UPDATE"); parIo2->open(parFileList, "in"); @@ -415,17 +418,25 @@ void mcbm_display_event( */ // ------------------------------------------------------------------------ - FairEventManager *fMan = new FairEventManager(); - FairMCTracks *Track = new FairMCTracks ("Monte-Carlo Tracks"); - - FairMCPointDraw *MvdPoint = new FairMCPointDraw ("MvdPoint", kBlack, kFullSquare); - FairMCPointDraw *StsPoint = new FairMCPointDraw ("StsPoint", kGreen, kFullSquare); - FairMCPointDraw *MuchPoint = new FairMCPointDraw ("MuchPoint", kOrange, kFullSquare); - FairMCPointDraw *RichPoint = new FairMCPointDraw ("RichPoint", kGreen, kFullSquare); - FairMCPointDraw *TrdPoint = new FairMCPointDraw ("TrdPoint", kBlue, kFullSquare); - FairMCPointDraw *TofPoint = new FairMCPointDraw ("TofPoint", kRed, kFullSquare); - FairMCPointDraw *EcalPoint = new FairMCPointDraw ("EcalPoint", kYellow, kFullSquare); - FairMCPointDraw *RefPlanePoint = new FairMCPointDraw ("RefPlanePoint", kPink, kFullSquare); + FairEventManager* fMan = new FairEventManager(); + FairMCTracks* Track = new FairMCTracks("Monte-Carlo Tracks"); + + FairMCPointDraw* MvdPoint = + new FairMCPointDraw("MvdPoint", kBlack, kFullSquare); + FairMCPointDraw* StsPoint = + new FairMCPointDraw("StsPoint", kGreen, kFullSquare); + FairMCPointDraw* MuchPoint = + new FairMCPointDraw("MuchPoint", kOrange, kFullSquare); + FairMCPointDraw* RichPoint = + new FairMCPointDraw("RichPoint", kGreen, kFullSquare); + FairMCPointDraw* TrdPoint = + new FairMCPointDraw("TrdPoint", kBlue, kFullSquare); + FairMCPointDraw* TofPoint = + new FairMCPointDraw("TofPoint", kRed, kFullSquare); + FairMCPointDraw* EcalPoint = + new FairMCPointDraw("EcalPoint", kYellow, kFullSquare); + FairMCPointDraw* RefPlanePoint = + new FairMCPointDraw("RefPlanePoint", kPink, kFullSquare); fMan->AddTask(Track); @@ -434,33 +445,36 @@ void mcbm_display_event( fMan->AddTask(MuchPoint); fMan->AddTask(RichPoint); fMan->AddTask(TrdPoint); - fMan->AddTask(TofPoint); - fMan->AddTask(EcalPoint); + fMan->AddTask(TofPoint); + fMan->AddTask(EcalPoint); fMan->AddTask(RefPlanePoint); - CbmPixelHitSetDraw *StsHits = new CbmPixelHitSetDraw ("StsHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(StsHits); - CbmPixelHitSetDraw *TrdHits = new CbmPixelHitSetDraw ("TrdHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TrdHits); - CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle );// kFullSquare); - fMan->AddTask(TofHits); - CbmPixelHitSetDraw *TofUHits = new CbmPixelHitSetDraw ("TofUHit", kRed, kOpenCross ); - fMan->AddTask(TofUHits); - CbmEvDisTracks *Tracks = new CbmEvDisTracks ("Tof Tracks",1); + CbmPixelHitSetDraw* StsHits = + new CbmPixelHitSetDraw("StsHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(StsHits); + CbmPixelHitSetDraw* TrdHits = + new CbmPixelHitSetDraw("TrdHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TrdHits); + CbmPixelHitSetDraw* TofHits = + new CbmPixelHitSetDraw("TofHit", kRed, kOpenCircle); // kFullSquare); + fMan->AddTask(TofHits); + CbmPixelHitSetDraw* TofUHits = + new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); + fMan->AddTask(TofUHits); + CbmEvDisTracks* Tracks = new CbmEvDisTracks("Tof Tracks", 1); Tracks->SetVerbose(4); fMan->AddTask(Tracks); - fMan->Init(1,7,10000); // make MVD visible by default + fMan->Init(1, 7, 10000); // make MVD visible by default - cout << "gEve "<< gEve << endl; - gEve->GetDefaultGLViewer()->SetClearColor(kYellow-10); - { // from readCurrentCamera(const char* fname) - TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); - const char* fname="Cam.sav"; - TFile* f = TFile::Open(fname, "READ"); - if (!f) - return; + cout << "gEve " << gEve << endl; + gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); + { // from readCurrentCamera(const char* fname) + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + const char* fname = "Cam.sav"; + TFile* f = TFile::Open(fname, "READ"); + if (!f) return; if (f->GetKey(c.ClassName())) { f->GetKey(c.ClassName())->Read(&c); c.IncTimeStamp(); @@ -476,7 +490,7 @@ void mcbm_display_event( std::cout << "Output file is " << recFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; + << std::endl; std::cout << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; @@ -484,16 +498,16 @@ void mcbm_display_event( // ----- Resource monitoring ------------------------------------------ - if ( hasFairMonitor ) { // FairRoot Version >= 15.11 + if (hasFairMonitor) { // FairRoot Version >= 15.11 // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; diff --git a/macro/mcbm/mcbm_mc_nh.C b/macro/mcbm/mcbm_mc_nh.C old mode 100755 new mode 100644 index ddeef14893..159ba0b4bd --- a/macro/mcbm/mcbm_mc_nh.C +++ b/macro/mcbm/mcbm_mc_nh.C @@ -14,20 +14,20 @@ // 2014-06-30 - DE - sis300_muon // // -------------------------------------------------------------------------- -void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, - TString cSys="lam", - TString cEbeam="2.5gev", - TString cCentr="-", - Int_t iRun=0, - const char* setupName = "mcbm_beam_2021_04", - //const char* setupName = "sis18_mcbm_20deg_long", - const char* inputFile = "") -{ +void mcbm_mc_nh(Int_t nEvents = 2, + Int_t iMode = 3, + TString cSys = "lam", + TString cEbeam = "2.5gev", + TString cCentr = "-", + Int_t iRun = 0, + const char* setupName = "mcbm_beam_2021_04", + //const char* setupName = "sis18_mcbm_20deg_long", + const char* inputFile = "") { // ======================================================================== // Adjust this part according to your requirements -// available input files + // available input files TString defaultInputFile = "/input/urqmd.agag.1.65gev.centr.00001.root"; // TString defaultInputFile = "/input/urqmd.agag.1.65gev.mbias.00001.root"; // TString defaultInputFile = "/input/urqmd.auau.1.24gev.mbias.00001.root"; @@ -44,18 +44,22 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // ----- In- and output file names ------------------------------------ //TString inFile = srcDir + "/input/urqmd." + cSys + "." + cEbeam + "." + cCentr + "." + Form("%05d",iRun) + ".root"; - TString outDir = "data/"; + TString outDir = "data/"; //TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; //TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; - TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + Form("%05d",iRun) + ".tra.root"; - TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + Form("%05d",iRun) + ".par.root"; + TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + Form("%05d", iRun) + ".tra.root"; + TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + Form("%05d", iRun) + ".par.root"; TString geoFile = outDir + setupName + "_geofile_full.root"; - if(iRun==0) iRun=1; // for event displays - TString inFile = "/lustre/nyx/cbm/prod/gen/urqmd/" + cSys + "/" + cEbeam + "/" + cCentr + "/urqmd." + cSys + "." + cEbeam + "." + cCentr + "." + Form("%05d",iRun) + ".root"; + if (iRun == 0) iRun = 1; // for event displays + TString inFile = "/lustre/nyx/cbm/prod/gen/urqmd/" + cSys + "/" + cEbeam + "/" + + cCentr + "/urqmd." + cSys + "." + cEbeam + "." + cCentr + + "." + Form("%05d", iRun) + ".root"; // ------------------------------------------------------------------------ // --- Logger settings ---------------------------------------------------- - TString logLevel = "WARNING"; + TString logLevel = "WARNING"; //TString logLevel = "INFO"; //TString logLevel = "DEBUG"; TString logVerbosity = "MEDIUM"; @@ -71,14 +75,15 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // in the responsibility of the user that no overlaps or extrusions are // created by the placement of the target. // - TString targetElement = "Gold"; - Double_t targetThickness = 0.1; // full thickness in cm - Double_t targetDiameter = 0.5; // diameter in cm - Double_t targetPosX = 0.; // target x position in global c.s. [cm] - Double_t targetPosY = 0.; // target y position in global c.s. [cm] - Double_t targetPosZ = 0.; // target z position in global c.s. [cm] - Double_t targetRotY = 0.; // target rotation angle around the y axis [deg] - Double_t beamRotY = 20.; // the primary beam is at 25 degrees to the left of the mCBM setup + TString targetElement = "Gold"; + Double_t targetThickness = 0.1; // full thickness in cm + Double_t targetDiameter = 0.5; // diameter in cm + Double_t targetPosX = 0.; // target x position in global c.s. [cm] + Double_t targetPosY = 0.; // target y position in global c.s. [cm] + Double_t targetPosZ = 0.; // target z position in global c.s. [cm] + Double_t targetRotY = 0.; // target rotation angle around the y axis [deg] + Double_t beamRotY = + 20.; // the primary beam is at 25 degrees to the left of the mCBM setup // Double_t beamRotY = 25.; // the primary beam is at 25 degrees to the left of the mCBM setup // ------------------------------------------------------------------------ @@ -95,7 +100,6 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, Double_t beamWidthX = 0.1; // Gaussian sigma of the beam profile in x [cm] Double_t beamWidthY = 0.1; // Gaussian sigma of the beam profile in y [cm] // ------------------------------------------------------------------------ - // In general, the following parts need not be touched @@ -119,9 +123,9 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // ----- Create simulation run ---------------------------------------- FairRunSim* run = new FairRunSim(); - run->SetName("TGeant3"); // Transport engine - run->SetOutputFile(outFile); // Output file - run->SetGenerateRunInfo(kTRUE); // Create FairRunInfo file + run->SetName("TGeant3"); // Transport engine + run->SetOutputFile(outFile); // Output file + run->SetGenerateRunInfo(kTRUE); // Create FairRunInfo file // ------------------------------------------------------------------------ @@ -133,23 +137,23 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << myName << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); // ------------------------------------------------------------------------ - + // ----- Input file --------------------------------------------------- std::cout << std::endl; TString defaultInput = srcDir + defaultInputFile; - if ( inFile.IsNull() ) { // Not defined in the macro explicitly - if ( strcmp(inputFile, "") == 0 ) { // not given as argument to the macro - inFile = defaultInput; - } - else inFile = inputFile; + if (inFile.IsNull()) { // Not defined in the macro explicitly + if (strcmp(inputFile, "") == 0) { // not given as argument to the macro + inFile = defaultInput; + } else + inFile = inputFile; } std::cout << "-I- " << myName << ": Using input file " << inFile << std::endl; // ------------------------------------------------------------------------ @@ -158,7 +162,7 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // ----- Create media ------------------------------------------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Setting media file" << std::endl; - run->SetMaterials("media.geo"); // Materials + run->SetMaterials("media.geo"); // Materials // ------------------------------------------------------------------------ @@ -176,21 +180,20 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // ----- Create and register the target ------------------------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Registering target" << std::endl; - CbmTarget* target = new CbmTarget(targetElement.Data(), - targetThickness, - targetDiameter); + CbmTarget* target = + new CbmTarget(targetElement.Data(), targetThickness, targetDiameter); target->SetPosition(targetPosX, targetPosY, targetPosZ); target->SetRotation(targetRotY); //target->Print(); run->AddModule(target); // ------------------------------------------------------------------------ - + // ----- Create magnetic field ---------------------------------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Registering magnetic field" << std::endl; CbmFieldMap* magField = CbmSetup::Instance()->CreateFieldMap(); - if ( ! magField ) { + if (!magField) { std::cout << "-E- run_sim_new: No valid field!"; return; } @@ -224,85 +227,81 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // in the FairPrimaryGenerator class. // ------------------------------------------------------------------------ - // choose generator / source - if(iMode>0) - { + // choose generator / source + if (iMode > 0) { switch (iMode) { - case 1: - { // (pdg, mul,px, py, pz, vx,vy,vz) - FairParticleGenerator *fPartGen = new FairParticleGenerator (13, 1,0.0,-0.228, 1.5, 0.,0.,0.); //mu- - primGen->AddGenerator(fPartGen); - } - break; - - case 2: - { //(pdg,mul,px, py, pz, vx,vy,vz) - FairParticleGenerator *fPartGen= new FairParticleGenerator(2212, 1,0.0,-0.228, 1.5, 0.,0.,0.); //proton - primGen->AddGenerator(fPartGen); - } - break; - - case 3: - { //(pdg,mul,px, py, pz, vx,vy,vz) - Double_t pz; - sscanf(cEbeam,"%lfgev",&pz); - cout<<"simulate single lambda with pz = "<<pz<<endl; - FairParticleGenerator *fPartGen= new FairParticleGenerator(3122, 1,0.0,0., pz, 0.,0.,0.); //lambda - primGen->AddGenerator(fPartGen); - } - break; - case 4: - { - FairBoxGenerator *fPartGen= new FairBoxGenerator(3122, 1); - fPartGen->SetPtRange(0.,0.); - fPartGen->SetYRange(0.9,2.); - primGen->AddGenerator(fPartGen); - } - break; - - default: - ; + case 1: { // (pdg, mul,px, py, pz, vx,vy,vz) + FairParticleGenerator* fPartGen = + new FairParticleGenerator(13, 1, 0.0, -0.228, 1.5, 0., 0., 0.); //mu- + primGen->AddGenerator(fPartGen); + } break; + + case 2: { //(pdg,mul,px, py, pz, vx,vy,vz) + FairParticleGenerator* fPartGen = new FairParticleGenerator( + 2212, 1, 0.0, -0.228, 1.5, 0., 0., 0.); //proton + primGen->AddGenerator(fPartGen); + } break; + + case 3: { //(pdg,mul,px, py, pz, vx,vy,vz) + Double_t pz; + sscanf(cEbeam, "%lfgev", &pz); + cout << "simulate single lambda with pz = " << pz << endl; + FairParticleGenerator* fPartGen = + new FairParticleGenerator(3122, 1, 0.0, 0., pz, 0., 0., 0.); //lambda + primGen->AddGenerator(fPartGen); + } break; + case 4: { + FairBoxGenerator* fPartGen = new FairBoxGenerator(3122, 1); + fPartGen->SetPtRange(0., 0.); + fPartGen->SetYRange(0.9, 2.); + primGen->AddGenerator(fPartGen); + } break; + + default:; } } // Use the CbmUrqmdGenrator which calculates a reaction plane and // rotate all particles accordingly - else { //if (iMode>0){ - // Use the CbmUnigenGenrator for the input - CbmUnigenGenerator* uniGen = new CbmUnigenGenerator(inFile); - //uniGen->SetEventPlane(0. , 360.); - primGen->AddGenerator(uniGen); - primGen->SetBeamAngle(beamRotY * TMath::Pi()/180.,0,0,0); // set direction of beam to 30 degrees + else { //if (iMode>0){ + // Use the CbmUnigenGenrator for the input + CbmUnigenGenerator* uniGen = new CbmUnigenGenerator(inFile); + //uniGen->SetEventPlane(0. , 360.); + primGen->AddGenerator(uniGen); + primGen->SetBeamAngle(beamRotY * TMath::Pi() / 180., + 0, + 0, + 0); // set direction of beam to 30 degrees } run->SetGenerator(primGen); // ------------------------------------------------------------------------ - // // ----- Create Electron gun as alternative ----------------------------- - // FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); - // // Use the FairBoxGenerator which generates a soingle electron - // FairBoxGenerator *eminus = new FairBoxGenerator(); - // eminus->SetPDGType(11); - // eminus->SetMultiplicity(1000); - // // eminus->SetBoxXYZ(32.,-32.,32.,-32.,0.); // shoot at corner of diagonal modules - // // eminus->SetBoxXYZ(0., 0., 0., 0., 0.); // shoot at corner of diagonal modules - // // eminus->SetBoxXYZ(57.,-57., 0., 0.,0.); // shoot at corner of diagonal modules - // // eminus->SetBoxXYZ(-57.,-57., 57., 57.,0.); // shoot at corner of diagonal modules - // eminus->SetBoxXYZ(-180.,-15.,-150.,15.,0.); // shoot at corner of diagonal modules - // eminus->SetPRange(2.,2.); - // eminus->SetPhiRange(0.,360.); - // eminus->SetThetaRange(0.,0.); - // primGen->AddGenerator(eminus); - // + // // ----- Create Electron gun as alternative ----------------------------- + // FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); + // // Use the FairBoxGenerator which generates a soingle electron + // FairBoxGenerator *eminus = new FairBoxGenerator(); + // eminus->SetPDGType(11); + // eminus->SetMultiplicity(1000); + // // eminus->SetBoxXYZ(32.,-32.,32.,-32.,0.); // shoot at corner of diagonal modules + // // eminus->SetBoxXYZ(0., 0., 0., 0., 0.); // shoot at corner of diagonal modules + // // eminus->SetBoxXYZ(57.,-57., 0., 0.,0.); // shoot at corner of diagonal modules + // // eminus->SetBoxXYZ(-57.,-57., 57., 57.,0.); // shoot at corner of diagonal modules + // eminus->SetBoxXYZ(-180.,-15.,-150.,15.,0.); // shoot at corner of diagonal modules + // eminus->SetPRange(2.,2.); + // eminus->SetPhiRange(0.,360.); + // eminus->SetThetaRange(0.,0.); + // primGen->AddGenerator(eminus); + // // // primGen->SetBeamAngle(30*TMath::Pi()/180.,0,0,0); // set direction of beam to 30 degrees - // - // fRun->SetGenerator(primGen); - // // ------------------------------------------------------------------------ + // + // fRun->SetGenerator(primGen); + // // ------------------------------------------------------------------------ // Visualisation of trajectories (TGeoManager Only) // Switch this on if you want to visualise tracks in the event display. // This is normally switch off, because of the huge files created // when it is switched on. - + //run->SetStoreTraj(kTRUE); // ----- Run initialisation ------------------------------------------- @@ -311,32 +310,32 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, run->Init(); // ------------------------------------------------------------------------ - -// // Set cuts for storing the trajectories. -// // Switch this on only if trajectories are stored. -// // Choose this cuts according to your needs, but be aware -// // that the file size of the output file depends on these cuts -// -// FairTrajFilter* trajFilter = FairTrajFilter::Instance(); -// if ( trajFilter ) { -// trajFilter->SetStepSizeCut(0.01); // 1 cm -// trajFilter->SetVertexCut(-2000., -2000., 4., 2000., 2000., 100.); -// trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV -// trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV -// trajFilter->SetStorePrimaries(kTRUE); -// trajFilter->SetStoreSecondaries(kTRUE); -// } + + // // Set cuts for storing the trajectories. + // // Switch this on only if trajectories are stored. + // // Choose this cuts according to your needs, but be aware + // // that the file size of the output file depends on these cuts + // + // FairTrajFilter* trajFilter = FairTrajFilter::Instance(); + // if ( trajFilter ) { + // trajFilter->SetStepSizeCut(0.01); // 1 cm + // trajFilter->SetVertexCut(-2000., -2000., 4., 2000., 2000., 100.); + // trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV + // trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV + // trajFilter->SetStorePrimaries(kTRUE); + // trajFilter->SetStoreSecondaries(kTRUE); + // } // ----- Runtime database --------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); CbmFieldPar* fieldPar = (CbmFieldPar*) rtdb->getContainer("CbmFieldPar"); fieldPar->SetParameters(magField); fieldPar->setChanged(); - fieldPar->setInputVersion(run->GetRunId(),1); - Bool_t kParameterMerged = kTRUE; + fieldPar->setInputVersion(run->GetRunId(), 1); + Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); parOut->open(parFile.Data()); rtdb->setOutput(parOut); @@ -344,7 +343,7 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, rtdb->print(); // ------------------------------------------------------------------------ - + // ----- Start run ---------------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Starting run" << std::endl; @@ -358,25 +357,26 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; - std::cout << "Output file is " << outFile << std::endl; + std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Geometry file is " << geoFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime - << "s" << std::endl << std::endl; + std::cout << "Geometry file is " << geoFile << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" + << std::endl + << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ - if ( 0 ) { //Has_Fair_Monitor() ) { // FairRoot Version >= 15.11 + if (0) { //Has_Fair_Monitor() ) { // FairRoot Version >= 15.11 // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; @@ -390,4 +390,3 @@ void mcbm_mc_nh(Int_t nEvents = 2, Int_t iMode=3, // RemoveGeoManager(); // ------------------------------------------------------------------------ } - diff --git a/macro/mcbm/mcbm_reco.C b/macro/mcbm/mcbm_reco.C index 0d0cd49b31..77cddb07c7 100644 --- a/macro/mcbm/mcbm_reco.C +++ b/macro/mcbm/mcbm_reco.C @@ -18,11 +18,11 @@ // -------------------------------------------------------------------------- -void mcbm_reco(Int_t nEvents = 2, - TString cSys="nini", - TString cEbeam="1.93gev", - TString cCentr="mbias", - Int_t iRun=1, +void mcbm_reco(Int_t nEvents = 2, + TString cSys = "nini", + TString cEbeam = "1.93gev", + TString cCentr = "mbias", + Int_t iRun = 1, const char* setupName = "sis18_mcbm_25deg_long") // const char* setupName = "sis18_mcbm_20deg_long") { @@ -42,15 +42,16 @@ void mcbm_reco(Int_t nEvents = 2, // ----- In- and output file names ------------------------------------ - TString outDir = "data/"; + TString outDir = "data/"; - TString inFile = outDir + setupName + "_test.tra.root"; // Input file (MC events) - TString parFile = outDir + setupName + "_test.par.root"; // Parameter file - TString outFile = outDir + setupName + "_test.eds.root"; // Output file + TString inFile = + outDir + setupName + "_test.tra.root"; // Input file (MC events) + TString parFile = outDir + setupName + "_test.par.root"; // Parameter file + TString outFile = outDir + setupName + "_test.eds.root"; // Output file -// TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; // Input file (MC events) -// TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; // Parameter file -// TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".eds." + Form("%05d",iRun) + ".root"; // Output file + // TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; // Input file (MC events) + // TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; // Parameter file + // TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".eds." + Form("%05d",iRun) + ".root"; // Output file // ------------------------------------------------------------------------ @@ -61,9 +62,9 @@ void mcbm_reco(Int_t nEvents = 2, // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << myName << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); @@ -74,27 +75,30 @@ void mcbm_reco(Int_t nEvents = 2, // ----- Parameter files as input to the runtime database ------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList *parFileList = new TList(); + TList* parFileList = new TList(); TString geoTag; // - TRD digitisation parameters - if ( setup->GetGeoTag(kTrd, geoTag) ) { - TObjString* trdFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); + if (setup->GetGeoTag(kTrd, geoTag)) { + TObjString* trdFile = + new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); + parFileList->Add(trdFile); std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; + << trdFile->GetString() << std::endl; } // - TOF digitisation parameters - if ( setup->GetGeoTag(kTof, geoTag) ) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); + if (setup->GetGeoTag(kTof, geoTag)) { + TObjString* tofFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); + parFileList->Add(tofFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofFile->GetString() << std::endl; - TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); + << tofFile->GetString() << std::endl; + TObjString* tofBdfFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); + parFileList->Add(tofBdfFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; + << tofBdfFile->GetString() << std::endl; } // ------------------------------------------------------------------------ @@ -120,12 +124,12 @@ void mcbm_reco(Int_t nEvents = 2, // ----- FairRunAna --------------------------------------------------- - FairRunAna *run = new FairRunAna(); + FairRunAna* run = new FairRunAna(); run->SetInputFile(inFile); run->SetOutputFile(outFile); run->SetGenerateRunInfo(kTRUE); run->SetGenerateRunInfo(kTRUE); - Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); + Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); //if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE); // ------------------------------------------------------------------------ @@ -136,7 +140,7 @@ void mcbm_reco(Int_t nEvents = 2, // ------------------------------------------------------------------------ // ----- Mc Data Manager ------------------------------------------------ - CbmMCDataManager* mcManager=new CbmMCDataManager("MCManager", 1); + CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); mcManager->AddFile(inFile); run->AddTask(mcManager); // ------------------------------------------------------------------------ @@ -157,21 +161,21 @@ void mcbm_reco(Int_t nEvents = 2, std::cout << "Loading macro " << macroName << std::endl; gROOT->LoadMacro(macroName); Bool_t recoSuccess = gROOT->ProcessLine("reconstruct()"); - if ( ! recoSuccess ) { - std::cerr << "-E- " << myName << ": error in executing " << macroName - << std::endl; - return; + if (!recoSuccess) { + std::cerr << "-E- " << myName << ": error in executing " << macroName + << std::endl; + return; } std::cout << "-I- " << myName << ": " << macroName << " executed successfully" - << std::endl; + << std::endl; // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data()); parIo2->open(parFileList, "in"); @@ -206,14 +210,14 @@ void mcbm_reco(Int_t nEvents = 2, std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; + << std::endl; std::cout << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ - if ( hasFairMonitor ) { // FairRoot Version >= 15.11 + if (hasFairMonitor) { // FairRoot Version >= 15.11 // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash /* diff --git a/macro/mcbm/mcbm_reco_event_tb_nh.C b/macro/mcbm/mcbm_reco_event_tb_nh.C old mode 100755 new mode 100644 index 9b01847a6e..5e7b931eb2 --- a/macro/mcbm/mcbm_reco_event_tb_nh.C +++ b/macro/mcbm/mcbm_reco_event_tb_nh.C @@ -13,23 +13,21 @@ // -------------------------------------------------------------------------- void mcbm_reco_event_tb_nh( - Int_t nEvents = 10, - TString RunId = "test", - TString InDir = "./data/", - TString OutDir = "./data/", - TString setupName = "mcbm_beam_2021_03", - bool timebased = kTRUE, - Double_t eventRate = 1.e5, // Interaction rate [1/s] - Double_t timeSliceLength = 1.e4, // Length of time-slice [ns] - Double_t Tint=100., - Double_t ReqTofMul=2. -) -{ + Int_t nEvents = 10, + TString RunId = "test", + TString InDir = "./data/", + TString OutDir = "./data/", + TString setupName = "mcbm_beam_2021_03", + bool timebased = kTRUE, + Double_t eventRate = 1.e5, // Interaction rate [1/s] + Double_t timeSliceLength = 1.e4, // Length of time-slice [ns] + Double_t Tint = 100., + Double_t ReqTofMul = 2.) { // ======================================================================== // Adjust this part according to your requirements // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; + TString logLevel = "INFO"; //TString logVerbosity = "VERYHIGH"; //TString logVerbosity = "HIGH"; //TString logVerbosity = "MEDIUM"; @@ -44,62 +42,67 @@ void mcbm_reco_event_tb_nh( // ----- File names --------------------------------------------------- - //TString TraDir ="../../../../../../uhlig/mcbm_proposal/data"; + //TString TraDir ="../../../../../../uhlig/mcbm_proposal/data"; TString TraDir = InDir; - TString traFile = TraDir + "/" + RunId + ".tra.root"; + TString traFile = TraDir + "/" + RunId + ".tra.root"; TString dataset = InDir + "/" + RunId; TString parFile = dataset + ".par.root"; TString rawFile = dataset + ".event.raw.root"; TString recFile = OutDir + "/" + RunId + ".rec.root"; if (timebased) { - rawFile = dataset + Form(".%2.1e",eventRate) + ".raw.root"; - recFile = OutDir + "/" + RunId + Form(".%2.1e.%d.%d",eventRate,(Int_t)Tint,(Int_t)ReqTofMul) + ".rec.root"; + rawFile = dataset + Form(".%2.1e", eventRate) + ".raw.root"; + recFile = OutDir + "/" + RunId + + Form(".%2.1e.%d.%d", eventRate, (Int_t) Tint, (Int_t) ReqTofMul) + + ".rec.root"; } // ------------------------------------------------------------------------ - Int_t iTofCluMode=1; // 1 - CbmTofEventClusterizer - Int_t iTrackMode=0; + Int_t iTofCluMode = 1; // 1 - CbmTofEventClusterizer + Int_t iTrackMode = 0; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << myName << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); CbmSetup* setup = CbmSetup::Instance(); setup->RemoveModule(ECbmModuleId::kTrd); -// setup->RemoveModule(ECbmModuleId::kTof); -// setup->RemoveModule(ECbmModuleId::kSts); + // setup->RemoveModule(ECbmModuleId::kTof); + // setup->RemoveModule(ECbmModuleId::kSts); // ------------------------------------------------------------------------ // ----- Parameter files as input to the runtime database ------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList *parFileList = new TList(); + TList* parFileList = new TList(); TString geoTag; // - TRD digitisation parameters - if ( setup->GetGeoTag(ECbmModuleId::kTrd, geoTag) ) { - TObjString* trdFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); + if (setup->GetGeoTag(ECbmModuleId::kTrd, geoTag)) { + TObjString* trdFile = + new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); + parFileList->Add(trdFile); std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; + << trdFile->GetString() << std::endl; } // - TOF digitisation parameters - if ( setup->GetGeoTag(ECbmModuleId::kTof, geoTag) ) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); + if (setup->GetGeoTag(ECbmModuleId::kTof, geoTag)) { + TObjString* tofFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); + parFileList->Add(tofFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofFile->GetString() << std::endl; - TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); + << tofFile->GetString() << std::endl; + TObjString* tofBdfFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); + parFileList->Add(tofBdfFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; + << tofBdfFile->GetString() << std::endl; } // ------------------------------------------------------------------------ @@ -120,17 +123,18 @@ void mcbm_reco_event_tb_nh( // ----- Input file --------------------------------------------------- std::cout << std::endl; - std::cout << "-I- " << myName << ": Using input file " << rawFile << std::endl; + std::cout << "-I- " << myName << ": Using input file " << rawFile + << std::endl; // ------------------------------------------------------------------------ // ----- FairRunAna --------------------------------------------------- - FairRunAna *run = new FairRunAna(); + FairRunAna* run = new FairRunAna(); run->SetInputFile(rawFile); run->AddFriend(traFile); run->SetOutputFile(recFile); run->SetGenerateRunInfo(kFALSE); - Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); + Bool_t hasFairMonitor = kFALSE; //Has_Fair_Monitor(); if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE); // ------------------------------------------------------------------------ @@ -144,59 +148,59 @@ void mcbm_reco_event_tb_nh( //CbmMCDataManager* mcManager=new CbmMCDataManager("MCManager", 1); //mcManager->AddFile(rawFile); //run->AddTask(mcManager); - // ------------------------------------------------------------------------ - - CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder(); - // eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap); - // eventBuilder->SetMaximumTimeGap(100.); - eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow); - eventBuilder->SetFixedTimeWindow(200.); - eventBuilder->SetTriggerMinNumberT0(0); - eventBuilder->SetTriggerMinNumberSts(0); - eventBuilder->SetTriggerMinNumberMuch(0); - eventBuilder->SetTriggerMinNumberTof(1); - eventBuilder->SetTriggerMinNumberRich(0); - eventBuilder->SetFillHistos(kTRUE); - if (timebased) run->AddTask(eventBuilder); + // ------------------------------------------------------------------------ + + CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder(); + // eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap); + // eventBuilder->SetMaximumTimeGap(100.); + eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow); + eventBuilder->SetFixedTimeWindow(200.); + eventBuilder->SetTriggerMinNumberT0(0); + eventBuilder->SetTriggerMinNumberSts(0); + eventBuilder->SetTriggerMinNumberMuch(0); + eventBuilder->SetTriggerMinNumberTof(1); + eventBuilder->SetTriggerMinNumberRich(0); + eventBuilder->SetFillHistos(kTRUE); + if (timebased) run->AddTask(eventBuilder); // ----- Local reconstruction in MVD ---------------------------------- - if ( setup->IsActive(ECbmModuleId::kMvd) ) { + if (setup->IsActive(ECbmModuleId::kMvd)) { CbmMvdClusterfinder* mvdCluster = - new CbmMvdClusterfinder("MVD Cluster Finder", 0, 0); + new CbmMvdClusterfinder("MVD Cluster Finder", 0, 0); run->AddTask(mvdCluster); - std::cout << "-I- " << myName << ": Added task " - << mvdCluster->GetName() << std::endl; + std::cout << "-I- " << myName << ": Added task " << mvdCluster->GetName() + << std::endl; CbmMvdHitfinder* mvdHit = new CbmMvdHitfinder("MVD Hit Finder", 0, 0); mvdHit->UseClusterfinder(kTRUE); run->AddTask(mvdHit); - std::cout << "-I- " << myName << ": Added task " - << mvdHit->GetName() << std::endl; - + std::cout << "-I- " << myName << ": Added task " << mvdHit->GetName() + << std::endl; } // ------------------------------------------------------------------------ // ----- Local reconstruction in STS ---------------------------------- - if ( setup->IsActive(ECbmModuleId::kSts) ) { - CbmRecoSts* stsReco=NULL; - if (timebased) { - stsReco = new CbmRecoSts(kCbmRecoEvent,kFALSE,kFALSE); -// stsReco = new CbmRecoSts(); - }else { + if (setup->IsActive(ECbmModuleId::kSts)) { + CbmRecoSts* stsReco = NULL; + if (timebased) { + stsReco = new CbmRecoSts(kCbmRecoEvent, kFALSE, kFALSE); + // stsReco = new CbmRecoSts(); + } else { stsReco = new CbmRecoSts(); } - if(kFALSE && timebased) { + if (kFALSE && timebased) { // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, // noise RMS, zero-threshold crossing rate - auto parAsic = new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); - + auto parAsic = + new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); + // Module params: number of channels, number of channels per ASIC auto parMod = new CbmStsParModule(2048, 128); parMod->SetAllAsics(*parAsic); stsReco->UseModulePar(parMod); - + // Sensor params auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); sensorPar->SetPar(0, 6.2092); // Extension in x @@ -205,12 +209,12 @@ void mcbm_reco_event_tb_nh( sensorPar->SetPar(3, 5.9692); // Active size in y sensorPar->SetPar(4, 1024.); // Number of strips front side sensorPar->SetPar(5, 1024.); // Number of strips back side - sensorPar->SetPar(6, 0.0058); // Strip pitch front side + sensorPar->SetPar(6, 0.0058); // Strip pitch front side sensorPar->SetPar(7, 0.0058); // Strip pitch back side - sensorPar->SetPar(8, 7.5); // Stereo angle front side + sensorPar->SetPar(8, 7.5); // Stereo angle front side sensorPar->SetPar(9, 0.0); // Stereo angle back side stsReco->UseSensorPar(sensorPar); - + // Sensor conditions: full depletion voltage, bias voltage, temperature, // coupling capacitance, inter-strip capacitance auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); @@ -218,14 +222,13 @@ void mcbm_reco_event_tb_nh( } run->AddTask(stsReco); std::cout << "-I- : Added task " << stsReco->GetName() << std::endl; - } // ------------------------------------------------------------------------ // ----- Local reconstruction in MUCH --------------------------------- - if ( setup->IsActive(ECbmModuleId::kMuch) ) { - /* + if (setup->IsActive(ECbmModuleId::kMuch)) { + /* // --- Parameter file name TString geoTag; setup->GetGeoTag(ECbmModuleId::kMuch, geoTag); @@ -258,148 +261,155 @@ void mcbm_reco_event_tb_nh( // ----- Local reconstruction in TRD ---------------------------------- - if ( setup->IsActive(ECbmModuleId::kTrd) && !timebased && kFALSE ) { + if (setup->IsActive(ECbmModuleId::kTrd) && !timebased && kFALSE) { - Double_t triggerThreshold = 0.5e-6; // SIS100 - Bool_t triangularPads = false; // Bucharest triangular pad-plane layout + Double_t triggerThreshold = 0.5e-6; // SIS100 + Bool_t triangularPads = false; // Bucharest triangular pad-plane layout CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); trdCluster->SetNeighbourEnable(true); trdCluster->SetMinimumChargeTH(triggerThreshold); trdCluster->SetNeighbourEnable(false); trdCluster->SetRowMerger(true); run->AddTask(trdCluster); - std::cout << "-I- " << myName << ": Added task " - << trdCluster->GetName() << std::endl; + std::cout << "-I- " << myName << ": Added task " << trdCluster->GetName() + << std::endl; CbmTrdHitProducer* trdHit = new CbmTrdHitProducer(); run->AddTask(trdHit); - std::cout << "-I- " << myName << ": Added task " - << trdHit->GetName() << std::endl; - + std::cout << "-I- " << myName << ": Added task " << trdHit->GetName() + << std::endl; } // ------------------------------------------------------------------------ // TOF defaults - Int_t calMode=93; - Int_t calSel=1; - Int_t calSm=0; - Int_t RefSel=0; - Double_t dDeadtime=50.; - Int_t iCalSet=30040500; - Int_t iSel2=500; - TString cCalId="MCdefault"; + Int_t calMode = 93; + Int_t calSel = 1; + Int_t calSm = 0; + Int_t RefSel = 0; + Double_t dDeadtime = 50.; + Int_t iCalSet = 30040500; + Int_t iSel2 = 500; + TString cCalId = "MCdefault"; // ----- Local reconstruction in TOF ---------------------------------- - if ( setup->IsActive(ECbmModuleId::kTof) ) { - switch(iTofCluMode) { - case 1: - { - CbmTofEventClusterizer* tofCluster = new CbmTofEventClusterizer("TOF Event Clusterizer",0,1); - - tofCluster->SetCalMode(calMode); - tofCluster->SetCalSel(calSel); - tofCluster->SetCaldXdYMax(3.); // geometrical matching window in cm - tofCluster->SetCalCluMulMax(5.); // Max Counter Cluster Multiplicity for filling calib histos - tofCluster->SetCalRpc(calSm); // select detector for calibration update - tofCluster->SetTRefId(RefSel); // reference trigger for offset calculation - tofCluster->SetTotMax(20.); // Tot upper limit for walk corection - tofCluster->SetTotMin(0.01); //(12000.); // Tot lower limit for walk correction - tofCluster->SetTotPreRange(5.); // effective lower Tot limit in ns from peak position - tofCluster->SetTotMean(5.); // Tot calibration target value in ns - tofCluster->SetMaxTimeDist(0.4); // default cluster range in ns - tofCluster->SetDelTofMax(5.); // acceptance range for cluster distance in ns (!) - tofCluster->SetSel2MulMax(3); // limit Multiplicity in 2nd selector - tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - tofCluster->SetEnableAvWalk(kFALSE); - //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target - tofCluster->SetYFitMin(1.E8); - tofCluster->SetToDAv(0.04); - tofCluster->SetIdMode(1); // calibrate on module level - tofCluster->SetTRefDifMax(2.0); // in ns - tofCluster->PosYMaxScal(0.75); //in % of length - TString cOutFname=OutDir + Form("/%s_set%09d_%02d_%01dtofClust.hst.root",RunId.Data(),iCalSet,calMode,calSel); - tofCluster->SetOutHstFileName(cOutFname); - - Int_t iBRef=iCalSet%1000; - Int_t iSet = (iCalSet - iBRef)/1000; - Int_t iRSel=0; - Int_t iRSelTyp=0; - Int_t iRSelSm=0; - Int_t iRSelRpc=0; - - iRSel=iBRef; // use diamond - if(iSel2==0){ - // iSel2=iBRef; - }else{ - if(iSel2<0) iSel2=-iSel2; - } - - Int_t iRSelin=iRSel; - iRSelRpc=iRSel%10; - iRSelTyp = (iRSel-iRSelRpc)/10; - iRSelSm=iRSelTyp%10; - iRSelTyp = (iRSelTyp-iRSelSm)/10; - - tofCluster->SetBeamRefId(iRSelTyp); // define Beam reference counter - tofCluster->SetBeamRefSm(iRSelSm); - tofCluster->SetBeamRefDet(iRSelRpc); - tofCluster->SetBeamAddRefMul(-1); - tofCluster->SetBeamRefMulMax(3); - - Int_t iSel2in=iSel2; - Int_t iSel2Rpc= iSel2%10; - iSel2=(iSel2-iSel2Rpc)/10; - Int_t iSel2Sm=iSel2%10; - iSel2=(iSel2-iSel2Sm)/10; - if(iSel2 > -1) { - tofCluster->SetSel2Id(iSel2); - tofCluster->SetSel2Sm(iSel2Sm); - tofCluster->SetSel2Rpc(iSel2Rpc); - } - - Int_t iRef = iSet %1000; - Int_t iDut = (iSet - iRef)/1000; - Int_t iDutRpc = iDut%10; - iDut = (iDut - iDutRpc)/10; - Int_t iDutSm = iDut%10; - iDut = (iDut - iDutSm)/10; - - tofCluster->SetDutId(iDut); - tofCluster->SetDutSm(iDutSm); - tofCluster->SetDutRpc(iDutRpc); - - Int_t iRefRpc = iRef%10; - iRef = (iRef - iRefRpc)/10; - Int_t iRefSm = iRef%10; - iRef = (iRef - iRefSm)/10; - - tofCluster->SetSelId(iRef); - tofCluster->SetSelSm(iRefSm); - tofCluster->SetSelRpc(iRefRpc); - - run->AddTask(tofCluster); - std::cout << "-I- " << myName << ": Added task " - << tofCluster->GetName() << std::endl; - } - break; - default: - { - CbmTofSimpClusterizer* tofCluster - = new CbmTofSimpClusterizer("TOF Simple Clusterizer", 0); - tofCluster->SetOutputBranchPersistent("TofHit", kTRUE); - tofCluster->SetOutputBranchPersistent("TofDigiMatch", kTRUE); - run->AddTask(tofCluster); - std::cout << "-I- " << myName << ": Added task " - << tofCluster->GetName() << std::endl; + if (setup->IsActive(ECbmModuleId::kTof)) { + switch (iTofCluMode) { + case 1: { + CbmTofEventClusterizer* tofCluster = + new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1); + + tofCluster->SetCalMode(calMode); + tofCluster->SetCalSel(calSel); + tofCluster->SetCaldXdYMax(3.); // geometrical matching window in cm + tofCluster->SetCalCluMulMax( + 5.); // Max Counter Cluster Multiplicity for filling calib histos + tofCluster->SetCalRpc(calSm); // select detector for calibration update + tofCluster->SetTRefId( + RefSel); // reference trigger for offset calculation + tofCluster->SetTotMax(20.); // Tot upper limit for walk corection + tofCluster->SetTotMin( + 0.01); //(12000.); // Tot lower limit for walk correction + tofCluster->SetTotPreRange( + 5.); // effective lower Tot limit in ns from peak position + tofCluster->SetTotMean(5.); // Tot calibration target value in ns + tofCluster->SetMaxTimeDist(0.4); // default cluster range in ns + tofCluster->SetDelTofMax( + 5.); // acceptance range for cluster distance in ns (!) + tofCluster->SetSel2MulMax(3); // limit Multiplicity in 2nd selector + tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns + tofCluster->SetEnableAvWalk(kFALSE); + //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target + tofCluster->SetYFitMin(1.E8); + tofCluster->SetToDAv(0.04); + tofCluster->SetIdMode(1); // calibrate on module level + tofCluster->SetTRefDifMax(2.0); // in ns + tofCluster->PosYMaxScal(0.75); //in % of length + TString cOutFname = OutDir + + Form("/%s_set%09d_%02d_%01dtofClust.hst.root", + RunId.Data(), + iCalSet, + calMode, + calSel); + tofCluster->SetOutHstFileName(cOutFname); + + Int_t iBRef = iCalSet % 1000; + Int_t iSet = (iCalSet - iBRef) / 1000; + Int_t iRSel = 0; + Int_t iRSelTyp = 0; + Int_t iRSelSm = 0; + Int_t iRSelRpc = 0; + + iRSel = iBRef; // use diamond + if (iSel2 == 0) { + // iSel2=iBRef; + } else { + if (iSel2 < 0) iSel2 = -iSel2; + } + + Int_t iRSelin = iRSel; + iRSelRpc = iRSel % 10; + iRSelTyp = (iRSel - iRSelRpc) / 10; + iRSelSm = iRSelTyp % 10; + iRSelTyp = (iRSelTyp - iRSelSm) / 10; + + tofCluster->SetBeamRefId(iRSelTyp); // define Beam reference counter + tofCluster->SetBeamRefSm(iRSelSm); + tofCluster->SetBeamRefDet(iRSelRpc); + tofCluster->SetBeamAddRefMul(-1); + tofCluster->SetBeamRefMulMax(3); + + Int_t iSel2in = iSel2; + Int_t iSel2Rpc = iSel2 % 10; + iSel2 = (iSel2 - iSel2Rpc) / 10; + Int_t iSel2Sm = iSel2 % 10; + iSel2 = (iSel2 - iSel2Sm) / 10; + if (iSel2 > -1) { + tofCluster->SetSel2Id(iSel2); + tofCluster->SetSel2Sm(iSel2Sm); + tofCluster->SetSel2Rpc(iSel2Rpc); + } + + Int_t iRef = iSet % 1000; + Int_t iDut = (iSet - iRef) / 1000; + Int_t iDutRpc = iDut % 10; + iDut = (iDut - iDutRpc) / 10; + Int_t iDutSm = iDut % 10; + iDut = (iDut - iDutSm) / 10; + + tofCluster->SetDutId(iDut); + tofCluster->SetDutSm(iDutSm); + tofCluster->SetDutRpc(iDutRpc); + + Int_t iRefRpc = iRef % 10; + iRef = (iRef - iRefRpc) / 10; + Int_t iRefSm = iRef % 10; + iRef = (iRef - iRefSm) / 10; + + tofCluster->SetSelId(iRef); + tofCluster->SetSelSm(iRefSm); + tofCluster->SetSelRpc(iRefRpc); + + run->AddTask(tofCluster); + std::cout << "-I- " << myName << ": Added task " + << tofCluster->GetName() << std::endl; + } break; + default: { + CbmTofSimpClusterizer* tofCluster = + new CbmTofSimpClusterizer("TOF Simple Clusterizer", 0); + tofCluster->SetOutputBranchPersistent("TofHit", kTRUE); + tofCluster->SetOutputBranchPersistent("TofDigiMatch", kTRUE); + run->AddTask(tofCluster); + std::cout << "-I- " << myName << ": Added task " + << tofCluster->GetName() << std::endl; } } } // ------------------------------------------------------------------------- - + // ----- Local reconstruction in RICH ---------------------------------- - if ( setup->IsActive(ECbmModuleId::kRich) ) { - /* + if (setup->IsActive(ECbmModuleId::kRich)) { + /* CbmRichMCbmHitProducer *richHitProd = new CbmRichMCbmHitProducer(); //richHitProd->setToTLimits(23.7,30.0); //richHitProd->applyToTCut(); @@ -414,131 +424,132 @@ void mcbm_reco_event_tb_nh( */ } // ------------------------------------------------------------------------- - - + + // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch(iTrackMode) { - case 2: - { - Int_t iGenCor=1; - Double_t dScalFac=1.; - Double_t dChi2Lim2=3.5; - TString cTrkFile=Form("%s_tofFindTracks.hst.root","MC"); - Int_t iTrackingSetup=1; - - CbmTofTrackFinder* tofTrackFinder= new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + switch (iTrackMode) { + case 2: { + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter= new CbmTofTrackFitterKF(0,211); - TFitter *MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + CbmTofFindTracks* tofFindTracks = + new CbmTofFindTracks("TOF Track Finder"); tofFindTracks->UseFinder(tofTrackFinder); tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCorMode( + iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg( + 0.041); // target value for inverse velocity, > 0.033 ns/cm! //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5,0,0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2*2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits=-1; - Int_t iNStations=0; - Int_t iNReqStations=3; - switch (iTrackingSetup){ - case 0: // bypass mode - iMinNofHits=-1; - iNStations=1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits=3; - iNStations=26; - iNReqStations=3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - break; + tofFindTracks->SetCalParFileName( + cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul( + 30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib( + kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 + * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + iNStations = 26; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + break; } tofFindTracks->SetMinNofHits(iMinNofHits); tofFindTracks->SetNStations(iNStations); tofFindTracks->SetNReqStations(iNReqStations); tofFindTracks->PrintSetup(); run->AddTask(tofFindTracks); - } - break; - case 1: - { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, - beamWidthX, - beamWidthY); + } break; + case 1: { + CbmBinnedTrackerTask* trackerTask = + new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); trackerTask->SetUse(ECbmModuleId::kTrd, kFALSE); run->AddTask(trackerTask); } - case 0: - default: - ; + case 0: + default:; } // ------------------------------------------------------------------------ - - + + // ========================================================================= // === Your QA === // ========================================================================= - - //CbmRichMCbmQaReal* mRichQa = new CbmRichMCbmQaReal(); - //mRichQa->SetOutputDir(string(resultDir)); - //run->AddTask(mRichQa); + + //CbmRichMCbmQaReal* mRichQa = new CbmRichMCbmQaReal(); + //mRichQa->SetOutputDir(string(resultDir)); + //run->AddTask(mRichQa); // ========================================================================= - - - + + // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); -// FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); + // FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data(), "UPDATE"); -// parIo2->open(parFileList, "in"); + // parIo2->open(parFileList, "in"); rtdb->setFirstInput(parIo1); -// rtdb->setSecondInput(parIo2); + // rtdb->setSecondInput(parIo2); // ------------------------------------------------------------------------ @@ -572,26 +583,26 @@ void mcbm_reco_event_tb_nh( std::cout << "Output file is " << recFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; + << std::endl; std::cout << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; // ------------------------------------------------------------------------ - // save all historgrams + // save all historgrams gROOT->LoadMacro("save_hst.C"); - TString FSave=Form("save_hst(\"%s.reco_hst.root\")",dataset.Data()); + TString FSave = Form("save_hst(\"%s.reco_hst.root\")", dataset.Data()); gInterpreter->ProcessLine(FSave.Data()); // ----- Resource monitoring ------------------------------------------ - if ( hasFairMonitor /*Has_Fair_Monitor()*/ ) { // FairRoot Version >= 15.11 + if (hasFairMonitor /*Has_Fair_Monitor()*/) { // FairRoot Version >= 15.11 // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; @@ -600,5 +611,5 @@ void mcbm_reco_event_tb_nh( tempMon->Print(); } - // RemoveGeoManager(); + // RemoveGeoManager(); } diff --git a/macro/mcbm/mcbm_reco_nh.C b/macro/mcbm/mcbm_reco_nh.C index a003d6d89f..aa0f72f654 100644 --- a/macro/mcbm/mcbm_reco_nh.C +++ b/macro/mcbm/mcbm_reco_nh.C @@ -16,13 +16,12 @@ // Version 24/04/2007 (V. Friese) // // -------------------------------------------------------------------------- -void mcbm_reco_nh(Int_t nEvents = 1000, - TString cSys="lam", - TString cEbeam="2.5gev", - TString cCentr="-", - Int_t iRun=0, - const char* setupName = "sis18_mcbm") -{ +void mcbm_reco_nh(Int_t nEvents = 1000, + TString cSys = "lam", + TString cEbeam = "2.5gev", + TString cCentr = "-", + Int_t iRun = 0, + const char* setupName = "sis18_mcbm") { // ======================================================================== // Adjust this part according to your requirements @@ -33,13 +32,19 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ----- In- and output file names ------------------------------------ - TString outDir = "data/"; - TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".mc." + Form("%05d",iRun) + ".root"; // Input file (MC events) - TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".params." + Form("%05d",iRun) + ".root"; // Parameter file - TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + ".eds." + Form("%05d",iRun) + ".root"; // Output file + TString outDir = "data/"; + TString inFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + cCentr + + ".mc." + Form("%05d", iRun) + + ".root"; // Input file (MC events) + TString parFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + ".params." + Form("%05d", iRun) + + ".root"; // Parameter file + TString outFile = outDir + setupName + "_" + cSys + "." + cEbeam + "." + + cCentr + ".eds." + Form("%05d", iRun) + + ".root"; // Output file // ----- Remove old CTest runtime dependency file ---------------------- - TString depFile = Remove_CTest_Dependency_File(outDir, "run_reco" , setupName); + TString depFile = Remove_CTest_Dependency_File(outDir, "run_reco", setupName); FairLogger::GetLogger()->SetLogScreenLevel("WARNING"); //FairLogger::GetLogger()->SetLogScreenLevel("INFO"); @@ -49,9 +54,9 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; - TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; + TString setupFile = srcDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; - setupFunct = setupFunct + setupName + "()"; + setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << myName << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); @@ -62,27 +67,30 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ----- Parameter files as input to the runtime database ------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList *parFileList = new TList(); + TList* parFileList = new TList(); TString geoTag; // - TRD digitisation parameters - if ( setup->GetGeoTag(kTrd, geoTag) ) { - TObjString* trdFile = new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); + if (setup->GetGeoTag(kTrd, geoTag)) { + TObjString* trdFile = + new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); + parFileList->Add(trdFile); std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; + << trdFile->GetString() << std::endl; } // - TOF digitisation parameters - if ( setup->GetGeoTag(kTof, geoTag) ) { - TObjString* tofFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); - parFileList->Add(tofFile); + if (setup->GetGeoTag(kTof, geoTag)) { + TObjString* tofFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digi.par"); + parFileList->Add(tofFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofFile->GetString() << std::endl; - TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); + << tofFile->GetString() << std::endl; + TObjString* tofBdfFile = + new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); + parFileList->Add(tofBdfFile); std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; + << tofBdfFile->GetString() << std::endl; } // ------------------------------------------------------------------------ @@ -108,7 +116,7 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ----- FairRunAna --------------------------------------------------- - FairRunAna *run = new FairRunAna(); + FairRunAna* run = new FairRunAna(); run->SetInputFile(inFile); run->SetOutputFile(outFile); run->SetGenerateRunInfo(kTRUE); @@ -118,7 +126,7 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ------------------------------------------------------------------------ // ----- Mc Data Manager ------------------------------------------------ - CbmMCDataManager* mcManager=new CbmMCDataManager("MCManager", 1); + CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); mcManager->AddFile(inFile); run->AddTask(mcManager); // ------------------------------------------------------------------------ @@ -139,13 +147,13 @@ void mcbm_reco_nh(Int_t nEvents = 1000, std::cout << "Loading macro " << macroName << std::endl; gROOT->LoadMacro(macroName); Bool_t recoSuccess = gROOT->ProcessLine("reconstruct()"); - if ( ! recoSuccess ) { - std::cerr << "-E-" << myName << ": error in executing " << macroName - << std::endl; - return; + if (!recoSuccess) { + std::cerr << "-E-" << myName << ": error in executing " << macroName + << std::endl; + return; } std::cout << "-I-" << myName << ": " << macroName << " excuted successfully" - << std::endl; + << std::endl; // ------------------------------------------------------------------------ // ========================================================================= // === Matching to Monte-carlo === @@ -161,8 +169,8 @@ void mcbm_reco_nh(Int_t nEvents = 1000, // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data()); parIo2->open(parFileList, "in"); @@ -195,23 +203,23 @@ void mcbm_reco_nh(Int_t nEvents = 1000, std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; + << std::endl; std::cout << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ - if ( Has_Fair_Monitor() ) { // FairRoot Version >= 15.11 + if (Has_Fair_Monitor()) { // FairRoot Version >= 15.11 // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; diff --git a/macro/mcbm/mcbm_transport.C b/macro/mcbm/mcbm_transport.C index ea6107fd13..7c2a731590 100644 --- a/macro/mcbm/mcbm_transport.C +++ b/macro/mcbm/mcbm_transport.C @@ -14,18 +14,18 @@ void SetTrack(CbmTransport*, Double_t, Int_t, Double_t, Double_t, Double_t); -void mcbm_transport(Int_t nEvents = 10, - const char* setupName = "mcbm_beam_2020_03", -// const char* setupName = "mcbm_beam_2019_11", -// const char* setupName = "mcbm_beam_2019_03", -// const char* setupName = "sis18_mcbm_25deg_long", - const char* output = "test", - const char* inputFile = "") -{ - // --- Define the beam angle ---------------------------------------------- +void mcbm_transport( + Int_t nEvents = 10, + const char* setupName = "mcbm_beam_2020_03", + // const char* setupName = "mcbm_beam_2019_11", + // const char* setupName = "mcbm_beam_2019_03", + // const char* setupName = "sis18_mcbm_25deg_long", + const char* output = "test", + const char* inputFile = "") { + // --- Define the beam angle ---------------------------------------------- Double_t beamRotY = 25.; - // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ + // --- Define the target geometry ----------------------------------------- // // The target is not part of the setup, since one and the same setup can @@ -36,19 +36,21 @@ void mcbm_transport(Int_t nEvents = 10, // in the responsibility of the user that no overlaps or extrusions are // created by the placement of the target. // - TString targetElement = "Gold"; - Double_t targetPosX = 0.; // target x position in global c.s. [cm] - Double_t targetPosY = 0.; // target y position in global c.s. [cm] - Double_t targetPosZ = 0.; // target z position in global c.s. [cm] - -// Double_t targetThickness = 0.1; // full thickness in cm -// Double_t targetDiameter = 0.5; // diameter in cm -// Double_t targetRotY = 25.; // target rotation angle around the y axis [deg] - - Double_t targetThickness = 0.025; // mCBM thin gold target 0.25 mm = 0.025 cm thickness - Double_t targetDiameter = 1.5; // mCBM target width 15 mm = 1.5 cm -// Double_t targetDiameter = 0.1; // set small target for window acceptance plots - Double_t targetRotY = beamRotY; // target rotation angle around the y axis [deg] + TString targetElement = "Gold"; + Double_t targetPosX = 0.; // target x position in global c.s. [cm] + Double_t targetPosY = 0.; // target y position in global c.s. [cm] + Double_t targetPosZ = 0.; // target z position in global c.s. [cm] + + // Double_t targetThickness = 0.1; // full thickness in cm + // Double_t targetDiameter = 0.5; // diameter in cm + // Double_t targetRotY = 25.; // target rotation angle around the y axis [deg] + + Double_t targetThickness = + 0.025; // mCBM thin gold target 0.25 mm = 0.025 cm thickness + Double_t targetDiameter = 1.5; // mCBM target width 15 mm = 1.5 cm + // Double_t targetDiameter = 0.1; // set small target for window acceptance plots + Double_t targetRotY = + beamRotY; // target rotation angle around the y axis [deg] // ------------------------------------------------------------------------ // --- Logger settings ---------------------------------------------------- @@ -69,21 +71,22 @@ void mcbm_transport(Int_t nEvents = 10, TString parFile = dataset + ".par.root"; TString geoFile = dataset + ".geo.root"; std::cout << std::endl; - TString defaultInputFile = srcDir + "/input/urqmd.agag.1.65gev.centr.00001.root"; + TString defaultInputFile = + srcDir + "/input/urqmd.agag.1.65gev.centr.00001.root"; TString inFile; - if( dataset.Contains("lam") ) { - std::cout << "-I- " << myName << ": Generate Lambda " - << std::endl; + if (dataset.Contains("lam")) { + std::cout << "-I- " << myName << ": Generate Lambda " << std::endl; } else { - if ( strcmp(inputFile, "") == 0 ) inFile = defaultInputFile; - else inFile = inputFile; + if (strcmp(inputFile, "") == 0) + inFile = defaultInputFile; + else + inFile = inputFile; std::cout << "-I- " << myName << ": Using input file " << inFile - << std::endl; + << std::endl; } // ------------------------------------------------------------------------ - // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); @@ -93,101 +96,106 @@ void mcbm_transport(Int_t nEvents = 10, // --- Transport run ---------------------------------------------------- CbmTransport run; -// DE run.AddInput(new FairParticleGenerator(2212, 1, 0., 0., 1.)); // single proton along beam axis + // DE run.AddInput(new FairParticleGenerator(2212, 1, 0., 0., 1.)); // single proton along beam axis -// ACC // geometrical acceptance -// -// ACC // mSTS station 0 -// ACC SetTrack(&run, beamRotY,-13, -5.9, +5.8, 28.5); -// ACC SetTrack(&run, beamRotY,-13, -5.9, 0.0, 28.5); -// ACC SetTrack(&run, beamRotY,-13, -5.9, -5.8, 28.5); -// ACC // -// ACC SetTrack(&run, beamRotY, 11, 0.0, +5.8, 28.5); -// ACC SetTrack(&run, beamRotY, 11, 0.0, 0.0, 28.5); -// ACC SetTrack(&run, beamRotY, 11, 0.0, -5.8, 28.5); -// ACC // -// ACC SetTrack(&run, beamRotY,-11, +5.9, +5.8, 28.5); -// ACC SetTrack(&run, beamRotY,-11, +5.9, 0.0, 28.5); -// ACC SetTrack(&run, beamRotY,-11, +5.9, -5.8, 28.5); -// -// WIN // x : cos(25.*acos(-1.)/180.) * -4.25 : x = -3.852 cm -// WIN // z : sin(25.*acos(-1.)/180.) * -4.25 + 15.2 + 0.3 : z = 13.704 cm -// WIN // SetTrack(&run, 0, 13, -3.852, 0.0, 13.704); -// WIN SetTrack(&run, 0, 13, -8.0, +5.9, 27.5); -// WIN SetTrack(&run, 0, 13, -8.0, 0.0, 27.5); -// WIN SetTrack(&run, 0, 13, -8.0, -5.9, 27.5); -// WIN // -// WIN // x : cos(25.*acos(-1.)/180.) * -15.75 : x = -14.274 cm -// WIN // z : sin(25.*acos(-1.)/180.) * -15.75 + 15.2 + 0.3 : z = 8.843 cm -// WIN // SetTrack(&run, 0,-13, -14.274, 0.0, 8.843); -// WIN SetTrack(&run, 0, 13, -41.5, +5.9, 27.5); -// WIN SetTrack(&run, 0, 13, -41.5, 0.0, 27.5); -// WIN SetTrack(&run, 0, 13, -41.5, -5.9, 27.5); -// -// ACC // mSTS station 1 -// ACC SetTrack(&run, beamRotY,-13, -8.9, +8.7, 42.5); -// ACC SetTrack(&run, beamRotY,-13, -8.9, 0.0, 42.5); -// ACC SetTrack(&run, beamRotY,-13, -8.9, -8.7, 42.5); -// ACC // -// ACC SetTrack(&run, beamRotY, 11, 0.0, +8.7, 42.5); -// ACC SetTrack(&run, beamRotY, 11, 0.0, 0.0, 42.5); -// ACC SetTrack(&run, beamRotY, 11, 0.0, -8.7, 42.5); -// ACC // -// ACC SetTrack(&run, beamRotY,-11, +8.9, +8.7, 42.5); -// ACC SetTrack(&run, beamRotY,-11, +8.9, 0.0, 42.5); -// ACC SetTrack(&run, beamRotY,-11, +8.9, -8.7, 42.5); -// -// STS // mSTS 201903 active area -// STS SetTrack(&run, beamRotY,-11, -2.1, -5.9, 27.5); -// STS SetTrack(&run, beamRotY,-11, -2.5, -3.0, 27.5); -// STS SetTrack(&run, beamRotY,-11, -2.9, -0.1, 27.5); -// STS SetTrack(&run, beamRotY,-11, -2.9, -3.0, 27.5); -// STS SetTrack(&run, beamRotY,-11, -2.9, -5.9, 27.5); -// STS -// STS SetTrack(&run, beamRotY, 11, -5.1, -5.9, 27.5); -// STS SetTrack(&run, beamRotY, 11, -5.5, -3.0, 27.5); -// STS SetTrack(&run, beamRotY, 11, -5.9, -0.1, 27.5); -// STS SetTrack(&run, beamRotY, 11, -5.9, -3.0, 27.5); -// STS SetTrack(&run, beamRotY, 11, -5.9, -5.9, 27.5); - -// comment the following line to remove target interaction + // ACC // geometrical acceptance + // + // ACC // mSTS station 0 + // ACC SetTrack(&run, beamRotY,-13, -5.9, +5.8, 28.5); + // ACC SetTrack(&run, beamRotY,-13, -5.9, 0.0, 28.5); + // ACC SetTrack(&run, beamRotY,-13, -5.9, -5.8, 28.5); + // ACC // + // ACC SetTrack(&run, beamRotY, 11, 0.0, +5.8, 28.5); + // ACC SetTrack(&run, beamRotY, 11, 0.0, 0.0, 28.5); + // ACC SetTrack(&run, beamRotY, 11, 0.0, -5.8, 28.5); + // ACC // + // ACC SetTrack(&run, beamRotY,-11, +5.9, +5.8, 28.5); + // ACC SetTrack(&run, beamRotY,-11, +5.9, 0.0, 28.5); + // ACC SetTrack(&run, beamRotY,-11, +5.9, -5.8, 28.5); + // + // WIN // x : cos(25.*acos(-1.)/180.) * -4.25 : x = -3.852 cm + // WIN // z : sin(25.*acos(-1.)/180.) * -4.25 + 15.2 + 0.3 : z = 13.704 cm + // WIN // SetTrack(&run, 0, 13, -3.852, 0.0, 13.704); + // WIN SetTrack(&run, 0, 13, -8.0, +5.9, 27.5); + // WIN SetTrack(&run, 0, 13, -8.0, 0.0, 27.5); + // WIN SetTrack(&run, 0, 13, -8.0, -5.9, 27.5); + // WIN // + // WIN // x : cos(25.*acos(-1.)/180.) * -15.75 : x = -14.274 cm + // WIN // z : sin(25.*acos(-1.)/180.) * -15.75 + 15.2 + 0.3 : z = 8.843 cm + // WIN // SetTrack(&run, 0,-13, -14.274, 0.0, 8.843); + // WIN SetTrack(&run, 0, 13, -41.5, +5.9, 27.5); + // WIN SetTrack(&run, 0, 13, -41.5, 0.0, 27.5); + // WIN SetTrack(&run, 0, 13, -41.5, -5.9, 27.5); + // + // ACC // mSTS station 1 + // ACC SetTrack(&run, beamRotY,-13, -8.9, +8.7, 42.5); + // ACC SetTrack(&run, beamRotY,-13, -8.9, 0.0, 42.5); + // ACC SetTrack(&run, beamRotY,-13, -8.9, -8.7, 42.5); + // ACC // + // ACC SetTrack(&run, beamRotY, 11, 0.0, +8.7, 42.5); + // ACC SetTrack(&run, beamRotY, 11, 0.0, 0.0, 42.5); + // ACC SetTrack(&run, beamRotY, 11, 0.0, -8.7, 42.5); + // ACC // + // ACC SetTrack(&run, beamRotY,-11, +8.9, +8.7, 42.5); + // ACC SetTrack(&run, beamRotY,-11, +8.9, 0.0, 42.5); + // ACC SetTrack(&run, beamRotY,-11, +8.9, -8.7, 42.5); + // + // STS // mSTS 201903 active area + // STS SetTrack(&run, beamRotY,-11, -2.1, -5.9, 27.5); + // STS SetTrack(&run, beamRotY,-11, -2.5, -3.0, 27.5); + // STS SetTrack(&run, beamRotY,-11, -2.9, -0.1, 27.5); + // STS SetTrack(&run, beamRotY,-11, -2.9, -3.0, 27.5); + // STS SetTrack(&run, beamRotY,-11, -2.9, -5.9, 27.5); + // STS + // STS SetTrack(&run, beamRotY, 11, -5.1, -5.9, 27.5); + // STS SetTrack(&run, beamRotY, 11, -5.5, -3.0, 27.5); + // STS SetTrack(&run, beamRotY, 11, -5.9, -0.1, 27.5); + // STS SetTrack(&run, beamRotY, 11, -5.9, -3.0, 27.5); + // STS SetTrack(&run, beamRotY, 11, -5.9, -5.9, 27.5); + + // comment the following line to remove target interaction run.AddInput(inFile); run.SetOutFileName(outFile); run.SetParFileName(parFile); run.SetGeoFileName(geoFile); run.LoadSetup(setupName); run.SetField(new CbmFieldConst()); - run.SetTarget(targetElement, targetThickness, targetDiameter, - targetPosX, targetPosY, targetPosZ, - targetRotY*TMath::DegToRad()); - run.SetBeamPosition(0., 0., 0.1, 0.1); // Beam width 1 mm is assumed + run.SetTarget(targetElement, + targetThickness, + targetDiameter, + targetPosX, + targetPosY, + targetPosZ, + targetRotY * TMath::DegToRad()); + run.SetBeamPosition(0., 0., 0.1, 0.1); // Beam width 1 mm is assumed run.SetBeamAngle(beamRotY * TMath::DegToRad(), 0.); //run.StoreTrajectories(); run.Run(nEvents); // ------------------------------------------------------------------------ - + // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; - std::cout << "Output file is " << outFile << std::endl; + std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime - << "s" << std::endl << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" + << std::endl + << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; @@ -199,12 +207,17 @@ void mcbm_transport(Int_t nEvents = 10, } -void SetTrack(CbmTransport* run, Double_t beamRotY, Int_t pdgid, Double_t x, Double_t y, Double_t z) -{ +void SetTrack(CbmTransport* run, + Double_t beamRotY, + Int_t pdgid, + Double_t x, + Double_t y, + Double_t z) { TVector3 v; - v.SetXYZ( x, y, z ); + v.SetXYZ(x, y, z); v.RotateY(-beamRotY * acos(-1.) / 180.); cout << "X " << v.X() << " Y " << v.Y() << " Z " << v.Z() << endl; - run->AddInput(new FairParticleGenerator( pdgid, 1, v.X(), v.Y(), v.Z() )); // single electron along beam axis + run->AddInput(new FairParticleGenerator( + pdgid, 1, v.X(), v.Y(), v.Z())); // single electron along beam axis } diff --git a/macro/mcbm/mcbm_transport_nh.C b/macro/mcbm/mcbm_transport_nh.C index 0e89f19854..4ea635e803 100644 --- a/macro/mcbm/mcbm_transport_nh.C +++ b/macro/mcbm/mcbm_transport_nh.C @@ -13,21 +13,21 @@ // -------------------------------------------------------------------------- // Includes needed for IDE #if !defined(__CLING__) -#include "TStopwatch.h" -#include "FairSystemInfo.h" #include "CbmTransport.h" +#include "FairSystemInfo.h" +#include "TStopwatch.h" #endif void SetTrack(CbmTransport*, Double_t, Int_t, Double_t, Double_t, Double_t); -void mcbm_transport_nh(Int_t nEvents = 10, - const char* setupName = "mcbm_beam_2021_03", -// const char* setupName = "mcbm_beam_2019_11", -// const char* setupName = "mcbm_beam_2019_03", -// const char* setupName = "sis18_mcbm_25deg_long", - const char* output = "data/test", - const char* inputFile = "") -{ +void mcbm_transport_nh( + Int_t nEvents = 10, + const char* setupName = "mcbm_beam_2021_03", + // const char* setupName = "mcbm_beam_2019_11", + // const char* setupName = "mcbm_beam_2019_03", + // const char* setupName = "sis18_mcbm_25deg_long", + const char* output = "data/test", + const char* inputFile = "") { // --- Logger settings ---------------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel("WARN"); FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH"); @@ -38,10 +38,10 @@ void mcbm_transport_nh(Int_t nEvents = 10, TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory // ------------------------------------------------------------------------ - // --- Define the beam angle ---------------------------------------------- + // --- Define the beam angle ---------------------------------------------- Double_t beamRotY = 25.; - // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ + // --- Define the target geometry ----------------------------------------- // // The target is not part of the setup, since one and the same setup can @@ -52,20 +52,21 @@ void mcbm_transport_nh(Int_t nEvents = 10, // in the responsibility of the user that no overlaps or extrusions are // created by the placement of the target. // - TString targetElement = "Gold"; - TString Output (output); - if ( ! Output.Contains("auau") ) { - if ( Output.Contains("nini") ) - targetElement = "Nickel"; - else { - if( Output.Contains("lam") ) { - std::cout << "Lambda signal simulation " << std::endl; - } else { - std::cout << "Collision system " << Output << " not known." << std::endl; - exit(1); + TString targetElement = "Gold"; + TString Output(output); + if (!Output.Contains("auau")) { + if (Output.Contains("nini")) + targetElement = "Nickel"; + else { + if (Output.Contains("lam")) { + std::cout << "Lambda signal simulation " << std::endl; + } else { + std::cout << "Collision system " << Output << " not known." + << std::endl; + exit(1); + } } } -} /* if ( system.CompareTo("auau") ) { if ( ! system.CompareTo("nini") ) { @@ -76,19 +77,21 @@ void mcbm_transport_nh(Int_t nEvents = 10, } } */ - - Double_t targetPosX = 0.; // target x position in global c.s. [cm] - Double_t targetPosY = 0.; // target y position in global c.s. [cm] - Double_t targetPosZ = 0.; // target z position in global c.s. [cm] - -// Double_t targetThickness = 0.1; // full thickness in cm -// Double_t targetDiameter = 0.5; // diameter in cm -// Double_t targetRotY = 25.; // target rotation angle around the y axis [deg] - - Double_t targetThickness = 0.025; // mCBM thin gold target 0.25 mm = 0.025 cm thickness - Double_t targetDiameter = 1.5; // mCBM target width 15 mm = 1.5 cm -// Double_t targetDiameter = 0.1; // set small target for window acceptance plots - Double_t targetRotY = beamRotY; // target rotation angle around the y axis [deg] + + Double_t targetPosX = 0.; // target x position in global c.s. [cm] + Double_t targetPosY = 0.; // target y position in global c.s. [cm] + Double_t targetPosZ = 0.; // target z position in global c.s. [cm] + + // Double_t targetThickness = 0.1; // full thickness in cm + // Double_t targetDiameter = 0.5; // diameter in cm + // Double_t targetRotY = 25.; // target rotation angle around the y axis [deg] + + Double_t targetThickness = + 0.025; // mCBM thin gold target 0.25 mm = 0.025 cm thickness + Double_t targetDiameter = 1.5; // mCBM target width 15 mm = 1.5 cm + // Double_t targetDiameter = 0.1; // set small target for window acceptance plots + Double_t targetRotY = + beamRotY; // target rotation angle around the y axis [deg] // ------------------------------------------------------------------------ // ----- In- and output file names ------------------------------------ @@ -97,38 +100,42 @@ void mcbm_transport_nh(Int_t nEvents = 10, TString parFile = dataset + ".par.root"; TString geoFile = dataset + ".geo.root"; std::cout << " dataset: " << dataset << std::endl; - + // cleanup TString shcmd = "rm -v " + parFile + " " + outFile + " " + geoFile; - gSystem->Exec( shcmd.Data() ); - - TString defaultInputFile = srcDir + "/input/urqmd.agag.1.65gev.centr.00001.root"; + gSystem->Exec(shcmd.Data()); + + TString defaultInputFile = + srcDir + "/input/urqmd.agag.1.65gev.centr.00001.root"; TString inFile; - + CbmTransport run; - - if( dataset.Contains("lam") ) { - //(pdg,mul,px, py, pz, vx,vy,vz) - Double_t pz=2.; - Int_t iL=dataset.Index("gev"); - TString cp=dataset(iL-3,3); // 2 characters only - pz=cp.Atof(); + + if (dataset.Contains("lam")) { + //(pdg,mul,px, py, pz, vx,vy,vz) + Double_t pz = 2.; + Int_t iL = dataset.Index("gev"); + TString cp = dataset(iL - 3, 3); // 2 characters only + pz = cp.Atof(); //std::cout<<"iL = "<<iL<<" "<<cp<<" "<<pz<<std::endl; //sscanf(cEbeam,"%lfgev",&pz); - std::cout<<"simulate single lambda with pz = "<<pz<<" from " << dataset << std::endl; + std::cout << "simulate single lambda with pz = " << pz << " from " + << dataset << std::endl; //FairParticleGenerator *fPartGen= new FairParticleGenerator(3122, 1,0.0,0., pz, 0.,0.,0.); //lambda // primGen->AddGenerator(fPartGen); - - SetTrack(&run, beamRotY, 3122, 0.0, 0.0, pz); + + SetTrack(&run, beamRotY, 3122, 0.0, 0.0, pz); std::cout << "-I- " << myName << ": Generate Lambda " << std::endl; } else { - if ( strcmp(inputFile, "") == 0 ) inFile = defaultInputFile; - else inFile = inputFile; + if (strcmp(inputFile, "") == 0) + inFile = defaultInputFile; + else + inFile = inputFile; std::cout << "-I- " << myName << ": Using input file " << inFile - << std::endl; + << std::endl; run.AddInput(inFile); } - + std::cout << "-I- " << myName << ": Using output file " << outFile << std::endl; std::cout << "-I- " << myName << ": Using parameter file " << parFile @@ -150,38 +157,43 @@ void mcbm_transport_nh(Int_t nEvents = 10, run.SetGeoFileName(geoFile); run.LoadSetup(setupName); run.SetField(new CbmFieldConst()); - run.SetTarget(targetElement, targetThickness, targetDiameter, - targetPosX, targetPosY, targetPosZ, - targetRotY*TMath::DegToRad()); - run.SetBeamPosition(0., 0., 0.1, 0.1); // Beam width 1 mm is assumed - run.SetBeamAngle(beamRotY * TMath::DegToRad(), 0.,0.,0.); + run.SetTarget(targetElement, + targetThickness, + targetDiameter, + targetPosX, + targetPosY, + targetPosZ, + targetRotY * TMath::DegToRad()); + run.SetBeamPosition(0., 0., 0.1, 0.1); // Beam width 1 mm is assumed + run.SetBeamAngle(beamRotY * TMath::DegToRad(), 0., 0., 0.); run.SetRandomEventPlane(); //run.StoreTrajectories(); run.Run(nEvents); // ------------------------------------------------------------------------ - + // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; - std::cout << "Output file is " << outFile << std::endl; + std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime - << "s" << std::endl << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" + << std::endl + << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ FairSystemInfo sysInfo; - Float_t maxMemory=sysInfo.GetMaxMemory(); + Float_t maxMemory = sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; - Float_t cpuUsage=ctime/rtime; + Float_t cpuUsage = ctime / rtime; std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; std::cout << cpuUsage; std::cout << "</DartMeasurement>" << std::endl; @@ -193,12 +205,17 @@ void mcbm_transport_nh(Int_t nEvents = 10, } -void SetTrack(CbmTransport* run, Double_t beamRotY, Int_t pdgid, Double_t x, Double_t y, Double_t z) -{ +void SetTrack(CbmTransport* run, + Double_t beamRotY, + Int_t pdgid, + Double_t x, + Double_t y, + Double_t z) { TVector3 v; - v.SetXYZ( x, y, z ); + v.SetXYZ(x, y, z); v.RotateY(-beamRotY * acos(-1.) / 180.); cout << "X " << v.X() << " Y " << v.Y() << " Z " << v.Z() << endl; - run->AddInput(new FairParticleGenerator( pdgid, 1, v.X(), v.Y(), v.Z() )); // single electron along beam axis + run->AddInput(new FairParticleGenerator( + pdgid, 1, v.X(), v.Y(), v.Z())); // single electron along beam axis } diff --git a/macro/mcbm/pl_lambda.C b/macro/mcbm/pl_lambda.C old mode 100755 new mode 100644 index 207f856d8d..b93f533aa0 --- a/macro/mcbm/pl_lambda.C +++ b/macro/mcbm/pl_lambda.C @@ -1,264 +1,285 @@ -void pl_lambda(Double_t sf=0.){ +void pl_lambda(Double_t sf = 0.) { // TCanvas *can = new TCanvas("can22","can22"); - // can->Divide(2,2); - TCanvas *can = new TCanvas("can","can",50,0,900,900); - can->Divide(3,4); + // can->Divide(2,2); + TCanvas* can = new TCanvas("can", "can", 50, 0, 900, 900); + can->Divide(3, 4); -gPad->SetFillColor(0); -gStyle->SetPalette(1); -gStyle->SetOptStat(kTRUE); -gStyle->SetOptFit(1111); + gPad->SetFillColor(0); + gStyle->SetPalette(1); + gStyle->SetOptStat(kTRUE); + gStyle->SetOptFit(1111); - gROOT->cd(); - gROOT->SetDirLevel(1); + gROOT->cd(); + gROOT->SetDirLevel(1); - TH1 *h; - TH1 *h1; - TH2 *h2; - TH1 *hMinvall; + TH1* h; + TH1* h1; + TH2* h2; + TH1* hMinvall; - // if (h!=NULL) h->Delete(); + // if (h!=NULL) h->Delete(); -can->cd(1); - gROOT->cd(); - TString hname1=Form("hDperp"); - h1=(TH1 *)gROOT->FindObjectAny(hname1); - if (h1!=NULL) { - h1->Draw(); - //gPad->SetLogz(); - }else { cout << hname1 << " not found -> return" << endl; return;} - -can->cd(2); - gROOT->cd(); - - TString hname2=Form("hDperp2"); - h1=(TH1 *)gROOT->FindObjectAny(hname2); - if (h1!=NULL) { - h1->Draw(); - //gPad->SetLogz(); - } - -can->cd(3); - gROOT->cd(); - TString hname3=Form("hDperpS"); - h1=(TH1 *)gROOT->FindObjectAny(hname3); - if (h1!=NULL) { - h1->Draw(); - //gPad->SetLogz(); - }else { cout << hname3 << " not found" << endl; } + can->cd(1); + gROOT->cd(); + TString hname1 = Form("hDperp"); + h1 = (TH1*) gROOT->FindObjectAny(hname1); + if (h1 != NULL) { + h1->Draw(); + //gPad->SetLogz(); + } else { + cout << hname1 << " not found -> return" << endl; + return; + } -can->cd(4); - gROOT->cd(); - TString hname4=Form("hD0prim"); - h1=(TH1 *)gROOT->FindObjectAny(hname4); - if (h1!=NULL) { - h1->Draw(); - //gPad->SetLogz(); - }else { cout << hname4 << " not found" << endl; } + can->cd(2); + gROOT->cd(); -can->cd(7); - gROOT->cd(); - TString hname7=Form("hMinv"); - h1=(TH1 *)gROOT->FindObjectAny(hname7); - if (h1!=NULL) { - h1->Draw(); - h1->SetLineColor(4); - hname7="hMinvall"; - hMinvall=(TH1 *)gROOT->FindObjectAny(hname7); - if(NULL != hMinvall) hMinvall->Delete(); - hMinvall=(TH1 *)h1->Clone(); - hMinvall->SetName("hMinvall"); - hMinvall->SetTitle("hMinvall"); + TString hname2 = Form("hDperp2"); + h1 = (TH1*) gROOT->FindObjectAny(hname2); + if (h1 != NULL) { + h1->Draw(); + //gPad->SetLogz(); + } - hname7="hMIXMinv"; - h=(TH1 *)gROOT->FindObjectAny(hname7); - if(sf==0) { // find proper MIX scaling factor - Double_t NML=1.090; - Double_t NMH=1.097; - Double_t dComb=h1->Integral(h1->FindBin(NML),h1->FindBin(NMH)); - Double_t dMix =h->Integral(h->FindBin(NML),h->FindBin(NMH)); - sf=dComb/dMix; - cout<<"Normalization factor sf = "<<sf<<endl; + can->cd(3); + gROOT->cd(); + TString hname3 = Form("hDperpS"); + h1 = (TH1*) gROOT->FindObjectAny(hname3); + if (h1 != NULL) { + h1->Draw(); + //gPad->SetLogz(); + } else { + cout << hname3 << " not found" << endl; } - h->Scale(sf); - h->Draw("same"); - h->SetLineColor(7); - hname7="hMinvdif"; - TH1 *hMinvdif=(TH1 *)gROOT->FindObjectAny(hname7); - if(NULL != hMinvdif) hMinvdif->Delete(); - hMinvdif=(TH1 *)h1->Clone(); - hMinvdif->Add(h1,h,1.,-1.); - hMinvdif->SetName("hMinvdif"); - hMinvdif->SetTitle("hMinvdif"); - hMinvdif->Draw("same"); - hMinvdif->SetLineColor(3); - //gPad->SetLogz(); + can->cd(4); + gROOT->cd(); + TString hname4 = Form("hD0prim"); + h1 = (TH1*) gROOT->FindObjectAny(hname4); + if (h1 != NULL) { + h1->Draw(); + //gPad->SetLogz(); + } else { + cout << hname4 << " not found" << endl; + } - }else { cout << hname7 << " not found" << endl; } + can->cd(7); + gROOT->cd(); + TString hname7 = Form("hMinv"); + h1 = (TH1*) gROOT->FindObjectAny(hname7); + if (h1 != NULL) { + h1->Draw(); + h1->SetLineColor(4); + hname7 = "hMinvall"; + hMinvall = (TH1*) gROOT->FindObjectAny(hname7); + if (NULL != hMinvall) hMinvall->Delete(); + hMinvall = (TH1*) h1->Clone(); + hMinvall->SetName("hMinvall"); + hMinvall->SetTitle("hMinvall"); -can->cd(5); - gROOT->cd(); - TString hname5=Form("hOpAng"); - h1=(TH1 *)gROOT->FindObjectAny(hname5); - if (h1!=NULL) { - h1->Draw(); - gPad->SetLogy(); - hname5="hMIXOpAng"; - h=(TH1 *)gROOT->FindObjectAny(hname5); - h->Draw("same"); - h->Scale(sf); - h->SetLineColor(7); - }else { cout << hname5 << " not found" << endl; } + hname7 = "hMIXMinv"; + h = (TH1*) gROOT->FindObjectAny(hname7); + if (sf == 0) { // find proper MIX scaling factor + Double_t NML = 1.090; + Double_t NMH = 1.097; + Double_t dComb = h1->Integral(h1->FindBin(NML), h1->FindBin(NMH)); + Double_t dMix = h->Integral(h->FindBin(NML), h->FindBin(NMH)); + sf = dComb / dMix; + cout << "Normalization factor sf = " << sf << endl; + } + h->Scale(sf); + h->Draw("same"); + h->SetLineColor(7); -can->cd(6); - gROOT->cd(); - TString hname6=Form("hDCA"); - h1=(TH1 *)gROOT->FindObjectAny(hname6); - if (h1!=NULL) { - h1->Draw(); - hname6="hMIXDCA"; - h=(TH1 *)gROOT->FindObjectAny(hname6); - h->Scale(sf); - h->Draw("same"); - h->SetLineColor(7); - gPad->SetLogy(); - }else { cout << hname6 << " not found" << endl; } + hname7 = "hMinvdif"; + TH1* hMinvdif = (TH1*) gROOT->FindObjectAny(hname7); + if (NULL != hMinvdif) hMinvdif->Delete(); + hMinvdif = (TH1*) h1->Clone(); + hMinvdif->Add(h1, h, 1., -1.); + hMinvdif->SetName("hMinvdif"); + hMinvdif->SetTitle("hMinvdif"); + hMinvdif->Draw("same"); + hMinvdif->SetLineColor(3); + //gPad->SetLogz(); -can->cd(8); - gROOT->cd(); - TString hname8=Form("hPathLen"); - h1=(TH1 *)gROOT->FindObjectAny(hname8); - if (h1!=NULL) { - h1->Draw(); - hname8="hMIXPathLen"; - h=(TH1 *)gROOT->FindObjectAny(hname8); - h->Scale(sf); - h->Draw("same"); - h->SetLineColor(7); - hname8="hMCPathLen"; - TH1 *hMC=(TH1 *)gROOT->FindObjectAny(hname8); - hMC->Draw("same"); - hMC->SetLineColor(2); + } else { + cout << hname7 << " not found" << endl; + } - hname8="hLdif"; - TH1 *hLdif=(TH1 *)gROOT->FindObjectAny(hname8); - if(NULL != hLdif) hLdif->Delete(); - hLdif=(TH1 *)h1->Clone(); - hLdif->Add(h1,h,1.,-1.); - hLdif->SetName("hLdif"); - hLdif->SetTitle("hLdif"); - hLdif->Draw("same"); - hLdif->SetLineColor(3); - //gPad->SetLogz(); - }else { cout << hname8 << " not found" << endl; } + can->cd(5); + gROOT->cd(); + TString hname5 = Form("hOpAng"); + h1 = (TH1*) gROOT->FindObjectAny(hname5); + if (h1 != NULL) { + h1->Draw(); + gPad->SetLogy(); + hname5 = "hMIXOpAng"; + h = (TH1*) gROOT->FindObjectAny(hname5); + h->Draw("same"); + h->Scale(sf); + h->SetLineColor(7); + } else { + cout << hname5 << " not found" << endl; + } -can->cd(9); - gROOT->cd(); - TString hname9=Form("hMMom"); - h1=(TH1 *)gROOT->FindObjectAny(hname9); - Double_t dNLamPrim=0; - if (h1!=NULL) { + can->cd(6); + gROOT->cd(); + TString hname6 = Form("hDCA"); + h1 = (TH1*) gROOT->FindObjectAny(hname6); + if (h1 != NULL) { + h1->Draw(); + hname6 = "hMIXDCA"; + h = (TH1*) gROOT->FindObjectAny(hname6); + h->Scale(sf); + h->Draw("same"); + h->SetLineColor(7); + gPad->SetLogy(); + } else { + cout << hname6 << " not found" << endl; + } - hname9="hMCLamMom"; - TH1 *h=(TH1 *)gROOT->FindObjectAny(hname9); - dNLamPrim=h->GetEntries(); - if(h->GetEntries()>0) { - h->SetMinimum(0.1); - h->Draw(); - h1->Draw("same"); - h->SetLineColor(kRed); - }else{ + can->cd(8); + gROOT->cd(); + TString hname8 = Form("hPathLen"); + h1 = (TH1*) gROOT->FindObjectAny(hname8); + if (h1 != NULL) { h1->Draw(); + hname8 = "hMIXPathLen"; + h = (TH1*) gROOT->FindObjectAny(hname8); + h->Scale(sf); + h->Draw("same"); + h->SetLineColor(7); + hname8 = "hMCPathLen"; + TH1* hMC = (TH1*) gROOT->FindObjectAny(hname8); + hMC->Draw("same"); + hMC->SetLineColor(2); + + hname8 = "hLdif"; + TH1* hLdif = (TH1*) gROOT->FindObjectAny(hname8); + if (NULL != hLdif) hLdif->Delete(); + hLdif = (TH1*) h1->Clone(); + hLdif->Add(h1, h, 1., -1.); + hLdif->SetName("hLdif"); + hLdif->SetTitle("hLdif"); + hLdif->Draw("same"); + hLdif->SetLineColor(3); + //gPad->SetLogz(); + } else { + cout << hname8 << " not found" << endl; } - hname9="hMIXMMom"; - h=(TH1 *)gROOT->FindObjectAny(hname9); - h->Draw("same"); - h->Scale(sf); - h->SetLineColor(7); - hname9="hMomdif"; - TH1 *hMomdif=(TH1 *)gROOT->FindObjectAny(hname9); - if(NULL != hMomdif) hMomdif->Delete(); - hMomdif=(TH1 *)h1->Clone(); - hMomdif->Add(h1,h,1.,-1.); - hMomdif->SetName("hMomdif"); - hMomdif->SetTitle("hMomdif"); - hMomdif->Draw("same"); - hMomdif->SetLineColor(3); + can->cd(9); + gROOT->cd(); + TString hname9 = Form("hMMom"); + h1 = (TH1*) gROOT->FindObjectAny(hname9); + Double_t dNLamPrim = 0; + if (h1 != NULL) { - gPad->SetLogy(); + hname9 = "hMCLamMom"; + TH1* h = (TH1*) gROOT->FindObjectAny(hname9); + dNLamPrim = h->GetEntries(); + if (h->GetEntries() > 0) { + h->SetMinimum(0.1); + h->Draw(); + h1->Draw("same"); + h->SetLineColor(kRed); + } else { + h1->Draw(); + } + hname9 = "hMIXMMom"; + h = (TH1*) gROOT->FindObjectAny(hname9); + h->Draw("same"); + h->Scale(sf); + h->SetLineColor(7); - }else { cout << hname9 << " not found" << endl; } + hname9 = "hMomdif"; + TH1* hMomdif = (TH1*) gROOT->FindObjectAny(hname9); + if (NULL != hMomdif) hMomdif->Delete(); + hMomdif = (TH1*) h1->Clone(); + hMomdif->Add(h1, h, 1., -1.); + hMomdif->SetName("hMomdif"); + hMomdif->SetTitle("hMomdif"); + hMomdif->Draw("same"); + hMomdif->SetLineColor(3); -can->cd(10); - TString hname10=Form("hMinvdif"); - h1=(TH1 *)gROOT->FindObjectAny(hname10); - if (h1!=NULL) { - TF1 *fSignal=(TF1 *)gROOT->FindObjectAny("fSignal"); - if(NULL != fSignal) fSignal->Delete(); - fSignal=new TF1("fSignal","gaus",1.090,1.140); - //h1->Fit("gaus","","H",1.1,1.2); - Double_t MMin=1.1; - Double_t MMax=1.14; - Double_t param[3]; - param[0]=h1->GetMaximum()*0.5; - param[1]=1.1156; - param[2]=0.01; - fSignal->SetParameters(param); - h1->Fit("fSignal","","",MMin,MMax); - gPad->SetGrid(); - fSignal->GetParameters(param); - Double_t MMEAN=param[1]; - Double_t MSIG =param[2]; - Double_t dFRange=2.5; - MMin=MMEAN-dFRange*MSIG; - MMax=MMEAN+dFRange*MSIG; - cout<<" 1. fit results: "<<MMEAN<<", "<<MSIG<<", new range: "<<MMin<<" - "<<MMax<<endl; - param[0]=h1->GetMaximum(); - param[1]=1.1156; - fSignal->SetParameters(param); - h1->Fit("fSignal","","",MMin,MMax); - fSignal->GetParameters(param); - MMEAN=param[1]; - MSIG =param[2]; - cout<<" Fit results: "<<MMEAN<<", "<<MSIG<<endl; - Double_t dSignal=h1->Integral(h1->FindBin(MMin),h1->FindBin(MMax)); - Double_t dAll=hMinvall->Integral(hMinvall->FindBin(MMin),hMinvall->FindBin(MMax)); - Double_t dBckgd=dAll-dSignal; - Double_t SoB=dSignal/dBckgd; - Double_t Signif=dSignal/TMath::Sqrt(dAll); - cout << "Integral counts in Signal ["<<MMin<<","<<MMax<<"] "<<h1->Integral(h1->FindBin(MMin),h1->FindBin(MMax))<<endl; - cout << "Integral counts in Signal + Bckgrd[] "<<hMinvall->Integral(hMinvall->FindBin(MMin),hMinvall->FindBin(MMax))<<endl; - cout << "Signal over background: "<<SoB<<endl; - cout << "Significance: "<<Signif<<endl; - cout << "Acc * eff = "<< dSignal/dNLamPrim << endl; - TH2 *h2=(TH2 *)gROOT->FindObjectAny("mul_b_gen"); - if(h2 != NULL) - cout << "Total number of events "<<h2->GetEntries()<<endl; - else - cout << "Total number of input events not available"<<endl; - } + gPad->SetLogy(); -can->cd(11); - TString hname11=Form("hLdif"); - h1=(TH1 *)gROOT->FindObjectAny(hname11); - if (h1!=NULL) { - h1->Draw(); - // h1->Fit("gaus","","H",1.1,1.2); - } + } else { + cout << hname9 << " not found" << endl; + } -can->cd(12); - TString hname12=Form("hMomdif"); - h1=(TH1 *)gROOT->FindObjectAny(hname12); - if (h1!=NULL) { - h1->Draw(); - //h1->Fit("gaus","","H",1.1,1.2); - } - // gStyle->SetOptStat(0); - //can->Update(); + can->cd(10); + TString hname10 = Form("hMinvdif"); + h1 = (TH1*) gROOT->FindObjectAny(hname10); + if (h1 != NULL) { + TF1* fSignal = (TF1*) gROOT->FindObjectAny("fSignal"); + if (NULL != fSignal) fSignal->Delete(); + fSignal = new TF1("fSignal", "gaus", 1.090, 1.140); + //h1->Fit("gaus","","H",1.1,1.2); + Double_t MMin = 1.1; + Double_t MMax = 1.14; + Double_t param[3]; + param[0] = h1->GetMaximum() * 0.5; + param[1] = 1.1156; + param[2] = 0.01; + fSignal->SetParameters(param); + h1->Fit("fSignal", "", "", MMin, MMax); + gPad->SetGrid(); + fSignal->GetParameters(param); + Double_t MMEAN = param[1]; + Double_t MSIG = param[2]; + Double_t dFRange = 2.5; + MMin = MMEAN - dFRange * MSIG; + MMax = MMEAN + dFRange * MSIG; + cout << " 1. fit results: " << MMEAN << ", " << MSIG + << ", new range: " << MMin << " - " << MMax << endl; + param[0] = h1->GetMaximum(); + param[1] = 1.1156; + fSignal->SetParameters(param); + h1->Fit("fSignal", "", "", MMin, MMax); + fSignal->GetParameters(param); + MMEAN = param[1]; + MSIG = param[2]; + cout << " Fit results: " << MMEAN << ", " << MSIG << endl; + Double_t dSignal = h1->Integral(h1->FindBin(MMin), h1->FindBin(MMax)); + Double_t dAll = + hMinvall->Integral(hMinvall->FindBin(MMin), hMinvall->FindBin(MMax)); + Double_t dBckgd = dAll - dSignal; + Double_t SoB = dSignal / dBckgd; + Double_t Signif = dSignal / TMath::Sqrt(dAll); + cout << "Integral counts in Signal [" << MMin << "," << MMax << "] " + << h1->Integral(h1->FindBin(MMin), h1->FindBin(MMax)) << endl; + cout << "Integral counts in Signal + Bckgrd[] " + << hMinvall->Integral(hMinvall->FindBin(MMin), hMinvall->FindBin(MMax)) + << endl; + cout << "Signal over background: " << SoB << endl; + cout << "Significance: " << Signif << endl; + cout << "Acc * eff = " << dSignal / dNLamPrim << endl; + TH2* h2 = (TH2*) gROOT->FindObjectAny("mul_b_gen"); + if (h2 != NULL) + cout << "Total number of events " << h2->GetEntries() << endl; + else + cout << "Total number of input events not available" << endl; + } + can->cd(11); + TString hname11 = Form("hLdif"); + h1 = (TH1*) gROOT->FindObjectAny(hname11); + if (h1 != NULL) { + h1->Draw(); + // h1->Fit("gaus","","H",1.1,1.2); + } + + can->cd(12); + TString hname12 = Form("hMomdif"); + h1 = (TH1*) gROOT->FindObjectAny(hname12); + if (h1 != NULL) { + h1->Draw(); + //h1->Fit("gaus","","H",1.1,1.2); + } + // gStyle->SetOptStat(0); + //can->Update(); - can->SaveAs(Form("pl_lambda.pdf")); + can->SaveAs(Form("pl_lambda.pdf")); } diff --git a/macro/mcbm/save_hst.C b/macro/mcbm/save_hst.C old mode 100755 new mode 100644 index 34e1d111de..4bbe299c33 --- a/macro/mcbm/save_hst.C +++ b/macro/mcbm/save_hst.C @@ -1,23 +1,24 @@ -void save_hst(TString cstr="status.hst.root"){ +void save_hst(TString cstr = "status.hst.root") { - gROOT->cd(); + gROOT->cd(); - cout << "Save all histos from directory "<<gDirectory->GetName()<<" to file "<<cstr.Data()<<endl; + cout << "Save all histos from directory " << gDirectory->GetName() + << " to file " << cstr.Data() << endl; - TIter next(gDirectory->GetList()); - // Write histogramms to the file - TFile *fHist = new TFile(cstr,"RECREATE"); - { - TH1 *h; - TObject* obj; - while( (obj= (TObject*)next()) ){ - if(obj->InheritsFrom(TH1::Class())){ - h = (TH1*)obj; - //cout << "Write histo " << h->GetTitle() << endl; - h->Write(); + TIter next(gDirectory->GetList()); + // Write histogramms to the file + TFile* fHist = new TFile(cstr, "RECREATE"); + { + TH1* h; + TObject* obj; + while ((obj = (TObject*) next())) { + if (obj->InheritsFrom(TH1::Class())) { + h = (TH1*) obj; + //cout << "Write histo " << h->GetTitle() << endl; + h->Write(); } + } } - } - //fHist->ls(); - fHist->Close(); + //fHist->ls(); + fHist->Close(); } diff --git a/reco/detectors/tof/CbmTofCalibrator.cxx b/reco/detectors/tof/CbmTofCalibrator.cxx index 3174ac1f8d..913e764fce 100644 --- a/reco/detectors/tof/CbmTofCalibrator.cxx +++ b/reco/detectors/tof/CbmTofCalibrator.cxx @@ -200,12 +200,24 @@ Bool_t CbmTofCalibrator::CreateCalHist() { for (Int_t iSide = 0; iSide < 2; iSide++) { fhCalWalk[iDetIndx][iCh][iSide] = new TH2D(Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk", - iSmType, iSmId, iRpcId, iCh, iSide), + iSmType, + iSmId, + iRpcId, + iCh, + iSide), Form("Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk; Tot " "[a.u.]; #DeltaT [ns]", - iSmType, iSmId, iRpcId, iCh, iSide), - nbClWalkBinX, 0., TotMax, - nbClWalkBinY, -TSumMax, TSumMax); + iSmType, + iSmId, + iRpcId, + iCh, + iSide), + nbClWalkBinX, + 0., + TotMax, + nbClWalkBinY, + -TSumMax, + TSumMax); } } } @@ -216,11 +228,14 @@ Bool_t CbmTofCalibrator::CreateCalHist() { void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk) { // fill deviation histograms on walk level if (pTrk->GetTt() < 0) return; // take tracks with positive velocity only - if (fbBeam && !pTrk->ContainsAddr(CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, 5))) + if (fbBeam + && !pTrk->ContainsAddr(CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, 5))) return; // request beam counter hit for calibration - if (fbBeam && fdR0Lim - > 0.) // consider only tracks originating from nominal interaction point + if ( + fbBeam + && fdR0Lim + > 0.) // consider only tracks originating from nominal interaction point if (pTrk->GetR0() > fdR0Lim) return; for (Int_t iHit = 0; iHit < pTrk->GetNofHits(); iHit++) { @@ -313,17 +328,20 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk) { } if (iCh0 != iCh1 || iSide0 == iSide1) { - LOG(fatal) <<"Invalid digi pair for TSR "<< iSmType << iSm << iRpc - << " Ch " << iCh0 << " " << iCh1 << ", Side " << iSide0 << " " << iSide1; + LOG(fatal) << "Invalid digi pair for TSR " << iSmType << iSm << iRpc + << " Ch " << iCh0 << " " << iCh1 << ", Side " << iSide0 + << " " << iSide1; } - hlocal_d[1]=-0.5*((1.-2.*tDigi0->GetSide())*tDigi0->GetTime() + (1.-2.*tDigi1->GetSide())*tDigi1->GetTime()) - * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + hlocal_d[1] = -0.5 + * ((1. - 2. * tDigi0->GetSide()) * tDigi0->GetTime() + + (1. - 2. * tDigi1->GetSide()) * tDigi1->GetTime()) + * fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); - if ( TMath::Abs(hlocal_d[1]-hlocal_p[1])>10.) { - LOG(warn)<<"CMPY for TSRC "<< iSmType << iSm << iRpc << iCh0 - <<": "<<hlocal_f[1]<<", "<<hlocal_p[1]<<", "<<hlocal_d[1] - <<", TOT: " << tDigi0->GetTot() << " " << tDigi1->GetTot(); + if (TMath::Abs(hlocal_d[1] - hlocal_p[1]) > 10.) { + LOG(warn) << "CMPY for TSRC " << iSmType << iSm << iRpc << iCh0 << ": " + << hlocal_f[1] << ", " << hlocal_p[1] << ", " << hlocal_d[1] + << ", TOT: " << tDigi0->GetTot() << " " << tDigi1->GetTot(); } fhCalWalk[iDetIndx][iCh0][iSide0]->Fill( @@ -383,16 +401,17 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { Int_t iUniqueId = fDigiBdfPar->GetDetUId(iDetIndx); // Int_t iSmAddr = iUniqueId & DetMask; Int_t iSmType = CbmTofAddress::GetSmType(iUniqueId); - Int_t iSm = CbmTofAddress::GetSmId( iUniqueId ); - Int_t iRpc = CbmTofAddress::GetRpcId(iUniqueId); + Int_t iSm = CbmTofAddress::GetSmId(iUniqueId); + Int_t iRpc = CbmTofAddress::GetRpcId(iUniqueId); switch (iOpt) { case 0: // none break; case 1: // update channel mean { - LOG(info) << "Update Offsets for TSR "<<iSmType<<iSm<<iRpc; - if(NULL == fhCorTOff[iDetIndx]) { - LOG(warn) << "hCorTOff for TSR "<<iSmType<<iSm<<iRpc<<" not available"; + LOG(info) << "Update Offsets for TSR " << iSmType << iSm << iRpc; + if (NULL == fhCorTOff[iDetIndx]) { + LOG(warn) << "hCorTOff for TSR " << iSmType << iSm << iRpc + << " not available"; continue; } @@ -424,8 +443,7 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { fhCorPos[iDetIndx]->SetBinContent(iBin + 1, dCorP + dDp); } } - } - break; + } break; case 2: // update individual channel walks const Double_t MinCounts = 10.; Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc); @@ -438,13 +456,16 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { ->ProjectionX(); // contributing counts Double_t dCorT = 0; - for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { + for (Int_t iBin = 0; + iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); + iBin++) { Double_t dCts = hCW->GetBinContent(iBin + 1); Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent( iBin + 1); // current value - if (iBin>0 && dCts==0) - fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent(iBin + 1, - fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin) ); + if (iBin > 0 && dCts == 0) + fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( + iBin + 1, + fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin)); if (dCts > MinCounts) { dCorT = hpW->GetBinContent(iBin + 1); } fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( iBin + 1, dWOff + dCorT); //set new value @@ -452,12 +473,15 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { // determine effective/count rate weighted mean Double_t dMean = 0; Double_t dCtsAll = 0.; - for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { - Double_t dCts = hCW->GetBinContent(iBin + 1); - Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); + for (Int_t iBin = 0; + iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); + iBin++) { + Double_t dCts = hCW->GetBinContent(iBin + 1); + Double_t dWOff = + fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); if (dCts > MinCounts) { dCtsAll += dCts; - dMean += dCts * dWOff; + dMean += dCts * dWOff; } } if (dCtsAll > 0.) dMean /= dCtsAll; @@ -466,14 +490,20 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) { <<": "<<dMean; */ // keep mean value at 0 - for (Int_t iBin = 0; iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); iBin++) { - Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + 1); // current value - fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent(iBin + 1, dWOff - dMean); //set new value - if(iCh==5 && iBin==10) // debugging - LOG(info) << "New Walk for "<<fhCorWalk[iDetIndx][iCh][iSide]->GetName() - << " bin " << iBin - << ": "<<fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin+1) - << ", Mean " << dMean<<", WOff "<<dWOff; + for (Int_t iBin = 0; + iBin < fhCorWalk[iDetIndx][iCh][iSide]->GetNbinsX(); + iBin++) { + Double_t dWOff = fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent( + iBin + 1); // current value + fhCorWalk[iDetIndx][iCh][iSide]->SetBinContent( + iBin + 1, dWOff - dMean); //set new value + if (iCh == 5 && iBin == 10) // debugging + LOG(info) << "New Walk for " + << fhCorWalk[iDetIndx][iCh][iSide]->GetName() + << " bin " << iBin << ": " + << fhCorWalk[iDetIndx][iCh][iSide]->GetBinContent(iBin + + 1) + << ", Mean " << dMean << ", WOff " << dWOff; } } } @@ -513,7 +543,7 @@ void CbmTofCalibrator::ReadHist(TFile* fHist) { fhCorPos[iDetIndx] = (TH1*) gDirectory->FindObjectAny( Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc)); if (NULL == fhCorPos[iDetIndx]) { - LOG(error) << "hCorPos not found for TSR "<<iSmType<<iSm<<iRpc; + LOG(error) << "hCorPos not found for TSR " << iSmType << iSm << iRpc; continue; } fhCorTOff[iDetIndx] = (TH1*) gDirectory->FindObjectAny( @@ -529,11 +559,16 @@ void CbmTofCalibrator::ReadHist(TFile* fHist) { fhCorWalk[iDetIndx][iCh].resize(2); for (Int_t iSide = 0; iSide < 2; iSide++) { //LOG(info) << "Get walk histo pointer for TSRCS " << iSmType<<iSm<<iRpc<<iCh<<iSide; - fhCorWalk[iDetIndx][iCh][iSide] = (TH1*) gDirectory->FindObjectAny( + fhCorWalk[iDetIndx][iCh][iSide] = (TH1*) gDirectory->FindObjectAny( Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_Walk_px", - iSmType, iSm, iRpc, iCh, iSide)); - if( NULL == fhCorWalk[iDetIndx][iCh][iSide] ) - LOG(warn)<<"No Walk histo for TSRCS "<<iSmType<<iSm<<iRpc<<iCh<<iSide; + iSmType, + iSm, + iRpc, + iCh, + iSide)); + if (NULL == fhCorWalk[iDetIndx][iCh][iSide]) + LOG(warn) << "No Walk histo for TSRCS " << iSmType << iSm << iRpc + << iCh << iSide; } } } @@ -544,7 +579,7 @@ void CbmTofCalibrator::WriteHist(TFile* fHist) { TDirectory* oldir = gDirectory; fHist->cd(); for (Int_t iDetIndx = 0; iDetIndx < fDigiBdfPar->GetNbDet(); iDetIndx++) { - if(NULL == fhCorPos[iDetIndx]) continue; + if (NULL == fhCorPos[iDetIndx]) continue; fhCorPos[iDetIndx]->Write(); fhCorTOff[iDetIndx]->Write(); fhCorTot[iDetIndx]->Write(); diff --git a/reco/detectors/tof/CbmTofCalibrator.h b/reco/detectors/tof/CbmTofCalibrator.h index 7955152cb1..90764c2bdf 100644 --- a/reco/detectors/tof/CbmTofCalibrator.h +++ b/reco/detectors/tof/CbmTofCalibrator.h @@ -88,7 +88,7 @@ private: std::map<UInt_t, UInt_t> fDetIdIndexMap; Double_t fdR0Lim = 0.; - Bool_t fbBeam = kFALSE; + Bool_t fbBeam = kFALSE; CbmTofCalibrator(const CbmTofCalibrator&) = delete; CbmTofCalibrator operator=(const CbmTofCalibrator&) = delete; diff --git a/reco/detectors/tof/CbmTofClusterizersDef.h b/reco/detectors/tof/CbmTofClusterizersDef.h index 83f5c96923..185cb933e4 100644 --- a/reco/detectors/tof/CbmTofClusterizersDef.h +++ b/reco/detectors/tof/CbmTofClusterizersDef.h @@ -38,8 +38,8 @@ const Double_t dDoubleMax = 1.E300; const Int_t DetMask = 0x003FFFFF; // geo v14a const Int_t ModMask = 0x0000FFFF; // geo v14a */ -const Int_t DetMask = 0x001FFFFF; // geo v21a -const Int_t ModMask = 0x0000FFFF; // geo v21a +const Int_t DetMask = 0x001FFFFF; // geo v21a +const Int_t ModMask = 0x0000FFFF; // geo v21a /* Int_t iNevtBuild=0; // Should be class member! diff --git a/reco/detectors/tof/CbmTofEventClusterizer.cxx b/reco/detectors/tof/CbmTofEventClusterizer.cxx index a6068e1c0c..739602b26b 100644 --- a/reco/detectors/tof/CbmTofEventClusterizer.cxx +++ b/reco/detectors/tof/CbmTofEventClusterizer.cxx @@ -79,7 +79,7 @@ const Double_t fdSpillDuration = 4.; // in seconds const Double_t fdSpillBreak = 0.9; // in seconds static Bool_t bAddBeamCounterSideDigi = kTRUE; -static TRandom3 *fRndm = new TRandom3(); +static TRandom3* fRndm = new TRandom3(); // std::vector< CbmTofPoint* > vPtsRef; @@ -251,7 +251,7 @@ CbmTofEventClusterizer::CbmTofEventClusterizer(const char* name, , fTotMax(0.) , fTotMin(0.) , fTotOff(0.) - , fTotMean(0.) + , fTotMean(0.) , fdDelTofMax(60.) , fTotPreRange(0.) , fMaxTimeDist(0.) @@ -310,7 +310,7 @@ InitStatus CbmTofEventClusterizer::Init() { if (fSel2Id > -1) fSel2Addr = CbmTofAddress::GetUniqueAddress(fSel2Sm, fSel2Rpc, 0, 0, fSel2Id); - fiBeamRefAddr = CbmTofAddress::GetUniqueAddress( + fiBeamRefAddr = CbmTofAddress::GetUniqueAddress( fiBeamRefSm, fiBeamRefDet, 0, 0, fiBeamRefType); break; case 1: @@ -564,7 +564,7 @@ Bool_t CbmTofEventClusterizer::RegisterOutputs() { if (NULL == fEventsColl) { // Flag check to control whether digis are written in output root file //rootMgr->Register( "TofCalDigi","Tof", fTofCalDigisColl, fbWriteDigisInOut); - rootMgr->RegisterAny("TofCalDigi", fTofCalDigiVec, fbWriteDigisInOut); + rootMgr->RegisterAny("TofCalDigi", fTofCalDigiVec, fbWriteDigisInOut); // Flag check to control whether digis are written in output root file rootMgr->Register(tHitBranchName, "Tof", fTofHitsColl, fbWriteHitsInOut); @@ -862,15 +862,24 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny( Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", - iSmType,iSm,iRpc,iCh)); + iSmType, + iSm, + iRpc, + iCh)); TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny( Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", - iSmType,iSm,iRpc,iCh)); + iSmType, + iSm, + iRpc, + iCh)); if (NULL != htempWalk0 && NULL != htempWalk1) { // reinitialize Walk array LOG(debug) << "Initialize Walk correction for " << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d", - iSmType,iSm,iRpc,iCh); + iSmType, + iSm, + iRpc, + iCh); if (htempWalk0->GetNbinsX() != nbClWalkBinX) LOG(error) << "CbmTofEventClusterizer::InitCalibParameter: " "Inconsistent Walk histograms"; @@ -879,18 +888,23 @@ Bool_t CbmTofEventClusterizer::InitCalibParameter() { htempWalk0->GetBinContent(iBin + 1); fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = htempWalk1->GetBinContent(iBin + 1); - if(iCh==5 && iBin==10) // debugging - LOG(info) << Form( - "Read New SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ", - iSmType,iSm,iRpc,iCh,iBin, - fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]); + if (iCh == 5 && iBin == 10) // debugging + LOG(info) << Form( + "Read New SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ", + iSmType, + iSm, + iRpc, + iCh, + iBin, + fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]); if (5 == iSmType || 8 == iSmType) { // Pad structure fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]; } } } else { - LOG(info) << "No Walk histograms for TSRC " <<iSmType<<iSm<<iRpc<<iCh; + LOG(info) << "No Walk histograms for TSRC " << iSmType << iSm + << iRpc << iCh; } } } else { @@ -1026,8 +1040,8 @@ Bool_t CbmTofEventClusterizer::LoadGeometry() { fvTimeFirstDigi[iDetIndx].resize(iNbChan * 2); fvMulDigi[iDetIndx].resize(iNbChan * 2); for (Int_t iCh = 0; iCh < iNbChan * 2; iCh++) { - fvTimeFirstDigi[iDetIndx][iCh] = 0.; - fvMulDigi[iDetIndx][iCh] = 0.; + fvTimeFirstDigi[iDetIndx][iCh] = 0.; + fvMulDigi[iDetIndx][iCh] = 0.; } Int_t iCell = -1; @@ -1396,7 +1410,9 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTLD", iSmType, iSmId, iRpcId), Form("Time distance to last digi of Rpc #%03d in Sm %03d of type %d; " "channel; t_{digi} - t_{previous digi} (s)", - iRpcId,iSmId,iSmType), + iRpcId, + iSmId, + iSmType), fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, @@ -1408,7 +1424,9 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iSmType, iSmId, iRpcId), Form("Time distance to first digi of Rpc #%03d in Sm %03d of type %d; " "channel; t_{digi} - t_{first digi} (ns)", - iRpcId,iSmId,iSmType), + iRpcId, + iSmId, + iSmType), fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, @@ -1420,7 +1438,9 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iSmType, iSmId, iRpcId), Form("Multiplicity of digi of Rpc #%03d in Sm %03d of type %d; " "channel; Multiplicity", - iRpcId,iSmId,iSmType), + iRpcId, + iSmId, + iSmType), fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, 0, fDigiBdfPar->GetNbChan(iSmType, iRpcId) * 2, @@ -2067,26 +2087,27 @@ Bool_t CbmTofEventClusterizer::CreateHistos() { -dXdYMax, dXdYMax); - fhTRpcCluWalk2[iDetIndx][iSel] = - new TH3F(Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2", - iSmType, - iSmId, - iRpcId, - iSel), - Form("SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2; Tot_1; Tot_2; #Delta t[ns]", - iSmType, - iSmId, - iRpcId, - iSel), - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinX, - fdTOTMin, - fdTOTMax, - nbClWalkBinY, - -TSumMax, - TSumMax); + fhTRpcCluWalk2[iDetIndx][iSel] = new TH3F( + Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2", + iSmType, + iSmId, + iRpcId, + iSel), + Form( + "SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2; Tot_1; Tot_2; #Delta t[ns]", + iSmType, + iSmId, + iRpcId, + iSel), + nbClWalkBinX, + fdTOTMin, + fdTOTMax, + nbClWalkBinX, + fdTOTMin, + fdTOTMax, + nbClWalkBinY, + -TSumMax, + TSumMax); fhTRpcCluWalk[iDetIndx][iSel].resize( fDigiBdfPar->GetNbChan(iSmType, iRpcId)); @@ -2760,9 +2781,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { || (TMath::Sqrt( TMath::Power( pHit->GetX() - dzscal * pTrig[iSel]->GetX(), 2.) - + TMath::Power(pHit->GetY() - - dzscal * pTrig[iSel]->GetY(), - 2.)) + + TMath::Power( + pHit->GetY() - dzscal * pTrig[iSel]->GetY(), 2.)) < fdCaldXdYMax)) { BSel[iSel] = kTRUE; Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz @@ -3011,8 +3031,8 @@ Bool_t CbmTofEventClusterizer::FillHistos() { //LOG(debug1)<<" " << iDigInd0<<", "<<iDigInd1; // if (iDigInd0 < fTofCalDigisColl->GetEntries() && iDigInd1 < fTofCalDigisColl->GetEntries()){ - if (iDigInd0 < fTofCalDigiVec->size() - && iDigInd1 < fTofCalDigiVec->size()) { + if (iDigInd0 < fTofCalDigiVec->size() + && iDigInd1 < fTofCalDigiVec->size()) { // CbmTofDigi *pDig0 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd0)); // CbmTofDigi *pDig1 = (CbmTofDigi*) (fTofCalDigisColl->At(iDigInd1)); CbmTofDigi* pDig0 = &(fTofCalDigiVec->at(iDigInd0)); @@ -3051,7 +3071,7 @@ Bool_t CbmTofEventClusterizer::FillHistos() { iHitInd, iDetIndx, iCh, - fdEvent) + fdEvent) << Form(" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ", iDigInd0, iCh0, @@ -3205,11 +3225,11 @@ Bool_t CbmTofEventClusterizer::FillHistos() { * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), 2.) + TMath::Power( - pHit->GetY() - - (pTrig[iSel]->GetY() - + ddYdZ[iSel] - * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), - 2.)) + pHit->GetY() + - (pTrig[iSel]->GetY() + + ddYdZ[iSel] + * (pHit->GetZ() - (pTrig[iSel]->GetZ()))), + 2.)) > 0.5 * fdCaldXdYMax) continue; // refine position selection cut in cosmic measurement dTcor[iSel] = 0.; // precaution @@ -3624,7 +3644,9 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { //htempPos = fhTRpcCluPosition[iDetIndx][fCalSel]; //htempPos_pfx = fhTRpcCluPosition[iDetIndx][fCalSel]->ProfileX("_pfx",1,fhTRpcCluPosition[iDetIndx][fCalSel]->GetNbinsY()); htempTOff = fhTRpcCluTOff[iDetIndx][fCalSel]; - if (fIdMode==1) htempTOff = fhTRpcCluTofOff[iDetIndx][fCalSel]; //DEV! for init_calib_all + if (fIdMode == 1) + htempTOff = + fhTRpcCluTofOff[iDetIndx][fCalSel]; //DEV! for init_calib_all htempTOff_pfx = htempTOff->ProfileX( "_pfx", 1, fhTRpcCluTOff[iDetIndx][fCalSel]->GetNbinsY()); htempTOff_px = htempTOff->ProjectionX( @@ -4343,10 +4365,10 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { || (fCalSmAddr != iSmAddr)) { // select detectors for updating offsets LOG(info) << "WriteHistos (calMode==3): update Offsets and Gains, " - "keep Walk and DelTof for " - << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " - << iRpc << " with " << iNbCh << " channels " - << " using selector " << fCalSel; + "keep Walk and DelTof for " + << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc + << " with " << iNbCh << " channels " + << " using selector " << fCalSel; /* Double_t dTRefMean=0.; if (5 == iSmType && fTRefMode%10 == iSm){ // reference counter @@ -4604,52 +4626,54 @@ Bool_t CbmTofEventClusterizer::WriteHistos() { fvCPTotGain[iSmType][iSm*iNbRpc+iRpc][iCh][1] *= fdTTotMean / TotMean; } */ - if(fCalMode < 90) // keep digi TOT calibration in last step - for (Int_t iSide = 0; iSide < 2; iSide++) { - Int_t ib = iCh * 2 + 1 + iSide; - TH1* hbin = htempTot->ProjectionY(Form("bin%d", ib), ib, ib); - if (100 > hbin->GetEntries()) - continue; //request min number of entries - /* Double_t Ymax=hbin->GetMaximum();*/ - Int_t iBmax = hbin->GetMaximumBin(); - TAxis* xaxis = hbin->GetXaxis(); - Double_t Xmax = - xaxis->GetBinCenter(iBmax) - / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; - Double_t XOff = Xmax - fTotPreRange; - if ( - 0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ - LOG(warning) - << "XOff changed for " - << Form("SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", - iSmType, - iSm, - iRpc, - iSide, - XOff, - fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); - } - // Double_t TotMean=htempTot_Mean->GetBinContent(ib); - Double_t TotMean = hbin->GetMean(); - if (15 == iSmType) { - LOG(warning) - << "Gain for " - << Form("SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " - "gain %f, modg %f ", - iSmType, - iSm, - iRpc, - iSide, - TotMean, - htempTot_Mean->GetBinContent(ib), - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], - fdTTotMean / TotMean); - } - if (0.001 < TotMean) { - fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= - fdTTotMean / TotMean; + if (fCalMode < 90) // keep digi TOT calibration in last step + for (Int_t iSide = 0; iSide < 2; iSide++) { + Int_t ib = iCh * 2 + 1 + iSide; + TH1* hbin = htempTot->ProjectionY(Form("bin%d", ib), ib, ib); + if (100 > hbin->GetEntries()) + continue; //request min number of entries + /* Double_t Ymax=hbin->GetMaximum();*/ + Int_t iBmax = hbin->GetMaximumBin(); + TAxis* xaxis = hbin->GetXaxis(); + Double_t Xmax = + xaxis->GetBinCenter(iBmax) + / fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]; + Double_t XOff = Xmax - fTotPreRange; + if ( + 0) { //TMath::Abs(XOff - fvCPTotOff[iSmType][iSm*iNbRpc+iRpc][iCh][iSide])>100){ + LOG(warning) + << "XOff changed for " + << Form( + "SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f", + iSmType, + iSm, + iRpc, + iSide, + XOff, + fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]); + } + // Double_t TotMean=htempTot_Mean->GetBinContent(ib); + Double_t TotMean = hbin->GetMean(); + if (15 == iSmType) { + LOG(warning) + << "Gain for " + << Form( + "SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, " + "gain %f, modg %f ", + iSmType, + iSm, + iRpc, + iSide, + TotMean, + htempTot_Mean->GetBinContent(ib), + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide], + fdTTotMean / TotMean); + } + if (0.001 < TotMean) { + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= + fdTTotMean / TotMean; + } } - } if (5 == iSmType && fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] != fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh] @@ -5379,7 +5403,8 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { pDigi->GetChannel(), (0 == pDigi->GetSide()) ? 1 : 0, pDigi->GetType()); - LOG(debug) << "Duplicated digi at address 0x" << std::hex << pDigiN->GetAddress(); + LOG(debug) << "Duplicated digi at address 0x" << std::hex + << pDigiN->GetAddress(); } } iNbTofDigi = fTofDigiVec.size(); @@ -5387,24 +5412,23 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { } if (kTRUE) { - for(UInt_t iDetIndx=0; iDetIndx<fvTimeFirstDigi.size(); iDetIndx++) - for (UInt_t iCh = 0; iCh < fvTimeFirstDigi[iDetIndx].size(); iCh++) { - fvTimeFirstDigi[iDetIndx][iCh] = 0.; - fvMulDigi[iDetIndx][iCh] = 0.; - } + for (UInt_t iDetIndx = 0; iDetIndx < fvTimeFirstDigi.size(); iDetIndx++) + for (UInt_t iCh = 0; iCh < fvTimeFirstDigi[iDetIndx].size(); iCh++) { + fvTimeFirstDigi[iDetIndx][iCh] = 0.; + fvMulDigi[iDetIndx][iCh] = 0.; + } for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) { //CbmTofDigi *pDigi = (CbmTofDigi*) fTofDigisColl->At( iDigInd ); CbmTofDigi* pDigi = &(fTofDigiVec.at(iDigInd)); - Int_t iDetIndx = fDigiBdfPar->GetDetInd(pDigi->GetAddress()); + Int_t iDetIndx = fDigiBdfPar->GetDetInd(pDigi->GetAddress()); LOG(debug) << iDigInd << " " << pDigi << Form(" Address : 0x%08x ", pDigi->GetAddress()) << " SmT " << pDigi->GetType() << " Sm " << pDigi->GetSm() << " Rpc " << pDigi->GetRpc() << " Ch " << pDigi->GetChannel() << " S " - << pDigi->GetSide() - << ", DetIndx " << iDetIndx - << " : " << pDigi->ToString() + << pDigi->GetSide() << ", DetIndx " << iDetIndx << " : " + << pDigi->ToString() // <<" Time "<<pDigi->GetTime() // <<" Tot " <<pDigi->GetTot() ; @@ -5433,21 +5457,21 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { if (fdStartAna10s > 0.) { Double_t dTimeAna10s = (pDigi->GetTime() - fdStartAna10s) / 1.E9; if (dTimeAna10s < fdSpillDuration) - fhRpcDigiDTLD[iDetIndx]->Fill(iDigiCh, + fhRpcDigiDTLD[iDetIndx]->Fill( + iDigiCh, (pDigi->GetTime() - fvTimeLastDigi[iDetIndx][iDigiCh]) / 1.E9); } } fvTimeLastDigi[iDetIndx][iDigiCh] = pDigi->GetTime(); if (fvTimeFirstDigi[iDetIndx][iDigiCh] != 0.) { - fhRpcDigiDTFD[iDetIndx]->Fill(iDigiCh, - (pDigi->GetTime() - fvTimeFirstDigi[iDetIndx][iDigiCh]) ); + fhRpcDigiDTFD[iDetIndx]->Fill( + iDigiCh, (pDigi->GetTime() - fvTimeFirstDigi[iDetIndx][iDigiCh])); fvMulDigi[iDetIndx][iDigiCh]++; } else { fvTimeFirstDigi[iDetIndx][iDigiCh] = pDigi->GetTime(); fvMulDigi[iDetIndx][iDigiCh]++; } - } Double_t dTDifMin = dDoubleMax; @@ -5586,7 +5610,8 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { if (fiMsgCnt-- > 0) { LOG(warning) << " BuildClusters: Inconsistent duplicated digis in event " - << fiNevtBuild << ", Ind: " << iDigInd; // << "CTyp: " << pDigi->GetCounterType; + << fiNevtBuild << ", Ind: " + << iDigInd; // << "CTyp: " << pDigi->GetCounterType; LOG(warning) << " " << pDigi->ToString(); LOG(warning) << " " << pDigi2Min->ToString(); } @@ -5607,12 +5632,12 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { } } } - for(UInt_t iDetIndx=0; iDetIndx<fvTimeFirstDigi.size(); iDetIndx++) - for (UInt_t iCh = 0; iCh < fvTimeFirstDigi[iDetIndx].size(); iCh++) { - if(fvTimeFirstDigi[iDetIndx][iCh] !=0.) - fhRpcDigiDTMul[iDetIndx]->Fill(iCh,fvMulDigi[iDetIndx][iCh]); - } - } // kTRUE end + for (UInt_t iDetIndx = 0; iDetIndx < fvTimeFirstDigi.size(); iDetIndx++) + for (UInt_t iCh = 0; iCh < fvTimeFirstDigi[iDetIndx].size(); iCh++) { + if (fvTimeFirstDigi[iDetIndx][iCh] != 0.) + fhRpcDigiDTMul[iDetIndx]->Fill(iCh, fvMulDigi[iDetIndx][iCh]); + } + } // kTRUE end // Calibrate RawDigis @@ -5643,9 +5668,9 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { && fDigiBdfPar->GetNbChan(pDigi->GetType(), pDigi->GetRpc()) > pDigi->GetChannel()) { fStorDigi[pDigi->GetType()] - [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) - + pDigi->GetRpc()][pDigi->GetChannel()] - .push_back(pDigi); + [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + + pDigi->GetRpc()][pDigi->GetChannel()] + .push_back(pDigi); fStorDigiInd[pDigi->GetType()] [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()][pDigi->GetChannel()] @@ -5671,10 +5696,9 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { Int_t iRpc = CbmTofAddress::GetRpcId(iDetId); Int_t iNbStrips = fDigiBdfPar->GetNbChan(iSmType, iRpc); for (Int_t iStrip = 0; iStrip < iNbStrips; iStrip++) { - Int_t iDigiMul = - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + iRpc] - [iStrip] - .size(); + Int_t iDigiMul = fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + + iRpc][iStrip] + .size(); //LOG(info)<<"Inspect TSRC "<<iSmType<<iSm<<iRpc<<iStrip<<" with "<<iNbStrips<<" strips: Mul "<<iDigiMul; if (iDigiMul > 0) { fhRpcDigiMul[iDetIndx]->Fill(iStrip, iDigiMul); @@ -5682,35 +5706,33 @@ Bool_t CbmTofEventClusterizer::BuildClusters() { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 0); if (iStrip > 0) if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip - 1] + + iRpc][iStrip - 1] .size() > 1) { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 1); if (TMath::Abs( fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip][0] + + iRpc][iStrip][0] ->GetTime() - - fStorDigi[iSmType] - [iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip - 1][0] - ->GetTime()) + - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + + iRpc][iStrip - 1][0] + ->GetTime()) < fMaxTimeDist) fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 3); } if (iStrip < iNbStrips - 2) { if (fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip + 1] + + iRpc][iStrip + 1] .size() > 1) { fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 2); if (TMath::Abs( fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip][0] + + iRpc][iStrip][0] ->GetTime() - - fStorDigi[iSmType] - [iSm * fDigiBdfPar->GetNbRpc(iSmType) - + iRpc][iStrip + 1][0] - ->GetTime()) + - fStorDigi[iSmType][iSm * fDigiBdfPar->GetNbRpc(iSmType) + + iRpc][iStrip + 1][0] + ->GetTime()) < fMaxTimeDist) fhRpcDigiStatus[iDetIndx]->Fill(iStrip, 4); } @@ -6107,11 +6129,9 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, dLastPosY) << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (iCh == iNbCh) return kFALSE; - if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - return kFALSE; + if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) return kFALSE; if (0 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) - fhNbDigiPerChan->Fill( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + fhNbDigiPerChan->Fill(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); if (1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { Bool_t AddedHit = kFALSE; for (size_t i1 = 0; @@ -6125,17 +6145,14 @@ Bool_t CbmTofEventClusterizer::AddNextChan(Int_t iSmType, << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1])->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]) - ->GetSide()) { + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2])->GetSide()) { i2++; continue; } // endif same side // 2 Digis, both sides present - CbmTofDigi* xDigiA = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; - CbmTofDigi* xDigiB = - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; - Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); + CbmTofDigi* xDigiA = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1]; + CbmTofDigi* xDigiB = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2]; + Double_t dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); if (TMath::Abs(dTime - dLastTime) < fdMaxTimeDist) { CbmTofDetectorInfo xDetInfo( ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh); @@ -6444,13 +6461,12 @@ Bool_t CbmTofEventClusterizer::BuildHits() { for (Int_t iCh = 0; iCh < iNbCh; iCh++) { LOG(debug3) << "VDigisize " - << Form( - " T %3d Sm %3d R %3d Ch %3d Size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + << Form(" T %3d Sm %3d R %3d Ch %3d Size %3lu ", + iSmType, + iSm, + iRpc, + iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); if (0 == fStorDigi[iSmType][iSm * iNbRpc + iRpc].size()) continue; if (fvDeadStrips[iDetIndx] & (1 << iCh)) @@ -6459,13 +6475,13 @@ Bool_t CbmTofEventClusterizer::BuildHits() { fhNbDigiPerChan->Fill( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); - while ( - 1 < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { + while (1 + < fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { - while ((fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) - ->GetSide() - == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) - ->GetSide()) { + while ( + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide() + == (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + ->GetSide()) { // Not one Digi of each end! fiNbSameSide++; if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() @@ -6473,24 +6489,22 @@ Bool_t CbmTofEventClusterizer::BuildHits() { LOG(debug) << "SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " - << Form("%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) - ->GetTime()) + << Form( + "%f", + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) + ->GetTime()) << ", " - << Form("%f", - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) - ->GetTime()) + << Form( + "%f", + (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) + ->GetTime()) << ", DeltaT " << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) ->GetTime() << ", array size: " - << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size(); + << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size(); if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetSide() == fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] @@ -6498,40 +6512,35 @@ Bool_t CbmTofEventClusterizer::BuildHits() { LOG(debug) << "3 consecutive SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh << ", Times: " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]) ->GetTime() << ", " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() << ", DeltaT " - << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [1]) + << (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]) ->GetTime() - - (fStorDigi[iSmType][iSm * iNbRpc + iRpc] - [iCh][0]) + - (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] + [0]) ->GetTime() << ", array size: " << fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] .size(); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } else { if (fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - [0] - ->GetTime() + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] + ->GetTime() > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2] ->GetTime() - - fStorDigi[iSmType][iSm * iNbRpc + iRpc] - [iCh][1] - ->GetTime()) { + - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] + [1] + ->GetTime()) { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -6551,8 +6560,7 @@ Bool_t CbmTofEventClusterizer::BuildHits() { fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0] ->GetSide()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] @@ -6565,29 +6573,26 @@ Bool_t CbmTofEventClusterizer::BuildHits() { << "SameSide Erase fStor entries(d) " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()) + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) break; continue; } // same condition side end LOG(debug2) << "digis processing for " - << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()); - if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .size()) { + << Form( + " SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", + iSmType, + iSm, + iRpc, + iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()); + if (2 > fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) { LOG(debug) << Form( "Leaving digi processing for TSRC %d%d%d%d, size %3lu", iSmType, @@ -6606,18 +6611,18 @@ Bool_t CbmTofEventClusterizer::BuildHits() { Int_t iUCellId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); LOG(debug1) - << Form( - " TSRC %d%d%d%d size %3lu ", - iSmType, - iSm, - iRpc, - iCh, - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) + << Form(" TSRC %d%d%d%d size %3lu ", + iSmType, + iSm, + iRpc, + iCh, + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size()) << Form(" ChId: 0x%08x 0x%08x ", iChId, iUCellId); fChannelInfo = fDigiPar->GetCell(iChId); if (NULL == fChannelInfo) { - LOG(error) << "CbmTofEventClusterizer::BuildClusters: no geometry info! " + LOG(error) << "CbmTofEventClusterizer::BuildClusters: no " + "geometry info! " << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ", iSmType, iSm, @@ -6667,10 +6672,10 @@ Bool_t CbmTofEventClusterizer::BuildHits() { dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; - while ( - TMath::Abs(dPosY) > fChannelInfo->GetSizey() * fPosYMaxScal - && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - > 2) { + while (TMath::Abs(dPosY) + > fChannelInfo->GetSizey() * fPosYMaxScal + && fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() + > 2) { LOG(debug) << "Hit candidate outside correlation window, check for " "better possible digis, " @@ -6702,17 +6707,15 @@ Bool_t CbmTofEventClusterizer::BuildHits() { if (xDigiC->GetSide() == xDigiA->GetSide()) { xDigiA = xDigiC; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); } else { xDigiB = xDigiC; - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - ++(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin() - + 1)); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(++( + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + + 1)); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( ++(fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin() @@ -6804,11 +6807,9 @@ Bool_t CbmTofEventClusterizer::BuildHits() { << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -7022,11 +7023,9 @@ Bool_t CbmTofEventClusterizer::BuildHits() { << " Erase fStor entries(b) " << iSmType << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh; fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase( - fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh] - .begin()); + fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()); fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase( fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh] .begin()); @@ -7348,9 +7347,9 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { > mChannelDeadTime[iAddr] + fdChannelDeadtime))) { // pCalDigi = new((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi( *pDigi ); - fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); - pCalDigi = &(fTofCalDigiVec->back()); - iDigIndCal++; + fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); + pCalDigi = &(fTofCalDigiVec->back()); + iDigIndCal++; } } else { fTofCalDigiVec->push_back(CbmTofDigi(*pDigi)); @@ -7392,7 +7391,7 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() { LOG(debug2) << " CluCal-TOff: " << pCalDigi->ToString(); Double_t dTot = - pCalDigi->GetTot()+fRndm->Uniform(0,1) - // subtract Offset + pCalDigi->GetTot() + fRndm->Uniform(0, 1) - // subtract Offset fvCPTotOff[pDigi->GetType()] [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType()) + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]; diff --git a/reco/detectors/tof/CbmTofEventClusterizer.h b/reco/detectors/tof/CbmTofEventClusterizer.h index 9cc6e6a178..b8712466e9 100644 --- a/reco/detectors/tof/CbmTofEventClusterizer.h +++ b/reco/detectors/tof/CbmTofEventClusterizer.h @@ -332,7 +332,7 @@ private: std::vector<TH2*> fhRpcDigiStatus; //[nbDet] std::vector<TH2*> fhRpcDigiDTLD; //[nbDet] std::vector<TH2*> fhRpcDigiDTFD; //[nbDet] - std::vector<TH2*> fhRpcDigiDTMul; //[nbDet] + std::vector<TH2*> fhRpcDigiDTMul; //[nbDet] std::vector<TH1*> fhRpcCluMul; //[nbDet] std::vector<TH1*> fhRpcCluRate; //[nbDet] std::vector<TH1*> fhRpcCluRate10s; //[nbDet] @@ -396,9 +396,9 @@ private: std::vector<std::vector<std::vector<std::vector<std::list<CbmTofHit*>>>>> fvLastHits; //[nSMT[nSm][nRpc][nCh][NHits] std::vector<Int_t> fvDeadStrips; //[nbDet] - std::vector<std::vector<Double_t>> fvTimeLastDigi; //[nbDet][nChannel*2] - std::vector<std::vector<Double_t>> fvTimeFirstDigi; //[nbDet][nChannel*2] - std::vector<std::vector<Double_t>> fvMulDigi; //[nbDet][nChannel*2] + std::vector<std::vector<Double_t>> fvTimeLastDigi; //[nbDet][nChannel*2] + std::vector<std::vector<Double_t>> fvTimeFirstDigi; //[nbDet][nChannel*2] + std::vector<std::vector<Double_t>> fvMulDigi; //[nbDet][nChannel*2] // Digis quality Int_t fiNbSameSide; diff --git a/reco/detectors/tof/CbmTofFindTracks.cxx b/reco/detectors/tof/CbmTofFindTracks.cxx index 2274d9f2df..a0b55eacbc 100644 --- a/reco/detectors/tof/CbmTofFindTracks.cxx +++ b/reco/detectors/tof/CbmTofFindTracks.cxx @@ -295,8 +295,8 @@ InitStatus CbmTofFindTracks::Init() { fTofId->GetSModule(iCellId), fTofId->GetCounter(iCellId)); if (fTofId->GetSMType(iCellId) == 5) { - bBeamCounter = kTRUE; - LOG(info) << "Found beam counter in setup!"; + bBeamCounter = kTRUE; + LOG(info) << "Found beam counter in setup!"; } fMapRpcIdParInd[iCellId] = iRpc; fRpcAddr.resize(fRpcAddr.size() + 1); @@ -316,7 +316,8 @@ InitStatus CbmTofFindTracks::Init() { if (fTofCalibrator->Init() != kSUCCESS) return kFATAL; if (bBeamCounter) { fTofCalibrator->SetBeam(bBeamCounter); - fTofCalibrator->SetR0Lim(10.); // FIXME, hardwired parameter for debugging + fTofCalibrator->SetR0Lim( + 10.); // FIXME, hardwired parameter for debugging LOG(info) << "Set CbmTofCalibrator::R0Lim to 10."; } } @@ -435,9 +436,11 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { Int_t iUniqueId = it->first; CbmTofCell* fChannelInfo = fDigiPar->GetCell(iUniqueId); if (NULL != fChannelInfo) { - Double_t dVal = 0.; // FIXME numeric constant in code, default for cosmic + Double_t dVal = + 0.; // FIXME numeric constant in code, default for cosmic if (fiBeamCounter != iUniqueId) - dVal = fChannelInfo->GetZ() * fTtTarg; // use calibration target value + dVal = + fChannelInfo->GetZ() * fTtTarg; // use calibration target value fhPullT_Smt_Off->SetBinContent(iDet + 1, dVal); LOG(info) << Form("Initialize det 0x%08x at %d, z=%f with TOff %6.2f", iUniqueId, @@ -1715,9 +1718,7 @@ void CbmTofFindTracks::FindVertex() { w, fMinNofHits); - if ( - w - > (Double_t) + if (w > (Double_t) fMinNofHits) { // for further analysis request minimum number of hits fVTXNorm += w; fVTX_T += w * pTrk->GetFitT(0.); @@ -1861,13 +1862,13 @@ void CbmTofFindTracks::FillHistograms() { Double_t dDX = pHit->GetX() - pTrk->GetFitX( - pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; + pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; Double_t dDT = pHit->GetTime() - pTrk->GetFitT( - pHit->GetZ()); // pTrk->GetTdif(fMapStationRpcId[iSt]); + pHit->GetZ()); // pTrk->GetTdif(fMapStationRpcId[iSt]); Double_t dDTB = fTrackletTools->GetTdif(pTrk, fMapStationRpcId[iSt], @@ -1875,21 +1876,20 @@ void CbmTofFindTracks::FillHistograms() { Double_t dTOT = pHit->GetCh() / 10.; // misuse of channel field Double_t dZZ = pHit->GetZ() - tPar->GetZy(pHit->GetY()); - LOG(debug) - << Form(" St %d Id 0x%08x Hit %2d, Z %6.2f - DX %6.2f, DY %6.2f, " - "Z %6.2f, DT %6.2f, %6.2f, ZZ %6.2f, Tt %6.4f ", - iSt, - fMapStationRpcId[iSt], - iH, - pHit->GetZ(), - dDX, - dDY, - dDZ, - dDT, - dDTB, - dZZ, - dTt) - << tPar->ToString(); + LOG(debug) << Form( + " St %d Id 0x%08x Hit %2d, Z %6.2f - DX %6.2f, DY %6.2f, " + "Z %6.2f, DT %6.2f, %6.2f, ZZ %6.2f, Tt %6.4f ", + iSt, + fMapStationRpcId[iSt], + iH, + pHit->GetZ(), + dDX, + dDY, + dDZ, + dDT, + dDTB, + dZZ, + dTt) << tPar->ToString(); vhPullX[iSt]->Fill(dDX); vhPullY[iSt]->Fill(dDY); @@ -1998,7 +1998,7 @@ void CbmTofFindTracks::FillHistograms() { Double_t dDX = pHit->GetX() - pTrk->GetFitX( - pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; + pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ; Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ; //Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetR()); //pTrk->GetTdif(fMapStationRpcId[iSt]); diff --git a/sim/detectors/tof/CbmTofDigitize.cxx b/sim/detectors/tof/CbmTofDigitize.cxx index 247aa5fd2b..ba24f1cef1 100644 --- a/sim/detectors/tof/CbmTofDigitize.cxx +++ b/sim/detectors/tof/CbmTofDigitize.cxx @@ -2361,7 +2361,7 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() { Double_t dChargeCentral = dClustCharge * ComputeClusterAreaOnChannel( - iChanId, dClusterSize, poipos_local[0], poipos_local[1]); + iChanId, dClusterSize, poipos_local[0], poipos_local[1]); LOG(debug2) << "CbmTofDigitize::DigitizeFlatDisc: ChargeCentral " << dChargeCentral << ", " << dClustCharge << Form(", 0x%08x", iChanId) << ", " << dClusterSize << ", " @@ -2720,7 +2720,7 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() { Double_t dChargeSideCh = dClustCharge * ComputeClusterAreaOnChannel( - iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); + iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); dChargeSideCh /= dClustArea; if (dClustCharge + 0.0000001 < dChargeSideCh) { LOG(error) << "CbmTofDigitize::DigitizeFlatDisc => Side Charge " @@ -2969,7 +2969,7 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() { Double_t dChargeSideCh = dClustCharge * ComputeClusterAreaOnChannel( - iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); + iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); dChargeSideCh /= dClustArea; // Fee Threshold on charge @@ -3046,7 +3046,7 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() { Double_t dChargeSideCh = dClustCharge * ComputeClusterAreaOnChannel( - iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); + iSideChId, dClusterSize, poipos_local[0], poipos_local[1]); // Fee Threshold on charge if (dChargeSideCh @@ -4133,16 +4133,16 @@ Bool_t CbmTofDigitize::DigitizeGaussCharge() { dClustToReadout = TMath::Sqrt( TMath::Power(poipos_local[1], 2) + TMath::Power( - poipos_local[0] - - (+(1 - 2 * iRow) * fChannelInfo->GetSizex() / 2.0), - 2)); + poipos_local[0] + - (+(1 - 2 * iRow) * fChannelInfo->GetSizex() / 2.0), + 2)); else // Horizontal => base = bottom/upper edge dClustToReadout = TMath::Sqrt( TMath::Power(poipos_local[0], 2) + TMath::Power( - poipos_local[1] - - (-(1 - 2 * iRow) * fChannelInfo->GetSizey() / 2.0), - 2)); + poipos_local[1] + - (-(1 - 2 * iRow) * fChannelInfo->GetSizey() / 2.0), + 2)); dPadTime += gRandom->Gaus(0.0, fdTimeResElec) -- GitLab