diff --git a/sim/detectors/trd/CbmTrdDigitizer.cxx b/sim/detectors/trd/CbmTrdDigitizer.cxx index c80773c4026797216254cc8322db2a6fc87d6df8..ac2177256accf157e7b281c940fae9ce409e88e2 100644 --- a/sim/detectors/trd/CbmTrdDigitizer.cxx +++ b/sim/detectors/trd/CbmTrdDigitizer.cxx @@ -93,6 +93,7 @@ CbmTrdDigitizer::~CbmTrdDigitizer() delete imod->second; fModuleMap.clear(); + if (fRadiator2D) delete fRadiator2D; delete fConverter; delete fQA; } @@ -302,7 +303,40 @@ CbmTrdModuleSim* CbmTrdDigitizer::AddModule(Int_t detId) << "] ly[" << lyId << "] det[" << detId << "]"; CbmTrdModuleSim* module(NULL); if (moduleType >= 9) { + // temporary fix for TRD-2Dh @ mCBM 2021 + if (moduleType == 10) SetUseFASP(kFALSE); + else + SetUseFASP(); module = fModuleMap[moduleAddress] = new CbmTrdModuleSimT(moduleAddress, lyId, orientation, UseFASP()); + Int_t rType(-1); + if ( (rType = geoHandler.GetRadiatorType(path)) >= 0 ) { + if (!fRadiator2D) { // strong TRD-2D entrance window + // const Char_t *ewin = "Al;C;Air;C;Al"; + const Char_t* ewin = "Al;C;HC;C;Al"; + Float_t widths[] = { + 1.2e-3, // 12 µm aluminized polyester foil + 0.02, // carbon laminate sheets of 0.2 mm thickness + 0.9, // 9mm Nomex honeycom + 0.02, // carbon laminate sheets of 0.2 mm thickness + 1.2e-3, // 12 µm aluminized polyester foil + }; + + // // light TRD-2D entrance window + // const Char_t *ewin = "Al;C;HC;Po;Al"; + // Float_t widths[] = { + // 1.2e-3, // 12 µm aluminized polyester foil + // 0.02, // carbon laminate sheets of 0.2 mm thickness + // 0.9, // 9mm Nomex honeycom + // 0.0025, // polyethylen sheets of 50 µm thickness + // 1.2e-3, // 12 µm aluminized polyester foil + // }; pwidth = widths; + fRadiator2D = new CbmTrdRadiator(kTRUE, "tdr18", ewin); + fRadiator2D->SetEWwidths(5, widths); + fRadiator2D->Init(); + } + module->SetRadiator(fRadiator2D); + } + //((CbmTrdModuleSimT*)module)->SetLabMeasurement(); } else { module = fModuleMap[moduleAddress] = new CbmTrdModuleSimR(moduleAddress, lyId, orientation); diff --git a/sim/detectors/trd/CbmTrdDigitizer.h b/sim/detectors/trd/CbmTrdDigitizer.h index 5b79949ff4442e16406cba97e4a13daabb96a3e0..642eee285e54fdac4421e38706d5e6f7c29770ac 100644 --- a/sim/detectors/trd/CbmTrdDigitizer.h +++ b/sim/detectors/trd/CbmTrdDigitizer.h @@ -138,6 +138,7 @@ private: CbmTrdParSetGain* fGainPar; ///< parameter list for keV->ADC gain conversion CbmTrdParSetGeo* fGeoPar; ///< parameter list for geometry definitions CbmTrdRadiator* fRadiator; ///< parametrization of radiator TR yield + CbmTrdRadiator* fRadiator2D; ///< parametrization of 2D radiator TR yield CbmTrdRawToDigiR* fConverter; CbmTrdCheckUtil* fQA; diff --git a/sim/detectors/trd/CbmTrdModuleSimT.cxx b/sim/detectors/trd/CbmTrdModuleSimT.cxx index b21a000f0121e18fdd24f5b5ff86cff2bb0fc9ae..9de8a685e4be815e7f7f8594ef462ac69e6e3c86 100644 --- a/sim/detectors/trd/CbmTrdModuleSimT.cxx +++ b/sim/detectors/trd/CbmTrdModuleSimT.cxx @@ -43,13 +43,14 @@ using namespace std; //_________________________________________________________________________________ CbmTrdModuleSimT::CbmTrdModuleSimT(Int_t mod, Int_t ly, Int_t rot, Bool_t FASP) : CbmTrdModuleSim(mod, ly, rot) + , fConfig( 0 ) , fTriangleBinning(NULL) , fFASP(NULL) , fTimeSlice(NULL) , fTimeOld(0) { SetNameTitle(Form("TrdSimT%d", mod), "Simulator for triangular read-out."); - SetAsic(FASP); + SetFasp(FASP); } //_________________________________________________________________________________ @@ -567,10 +568,16 @@ Int_t CbmTrdModuleSimT::FlushBuffer(ULong64_t time) * are produced by 2 particle close by. Also take into account FASP dead time and mark such digits correspondingly */ - if (!fFASP) { // Build & configure FASP simulator - fFASP = new CbmTrdFASP(1000); - fFASP->SetNeighbourTrigger(1); - fFASP->SetLGminLength(31); + if (UseFasp()) { + if (!fFASP) { // Build & configure FASP simulator + fFASP = new CbmTrdFASP(1000); + fFASP->SetNeighbourTrigger(1); + fFASP->SetLGminLength(31); + } + } + else { + LOG(warn) << GetName() << "::FlushBuffer: Module operated with SPADIC. Development in progress."; + return 0; } if (!fTimeSlice) { FairRootManager* ioman = FairRootManager::Instance(); @@ -615,12 +622,16 @@ Int_t CbmTrdModuleSimT::FlushBuffer(ULong64_t time) // get ASIC channel calibration Int_t asicAddress = fAsicPar->GetAsicAddress(localAddress << 1); if (asicAddress < 0) { - LOG(warn) << GetName() << "::FlushBuffer: FASP Calibration for ro_ch " << localAddress << " in module " - << fModAddress << " missing."; + LOG(debug) << GetName() << "::FlushBuffer: FASP Calibration for ro_ch " << localAddress << " in module " + << fModAddress << " missing."; + // clear physical digi for which there is no ASIC model available + for (auto iv = fBuffer[localAddress].begin(); iv != fBuffer[localAddress].end(); iv++) + delete (*iv).first; + fBuffer[localAddress].clear(); } else { - LOG(debug) << GetName() << "::FlushBuffer: Found FASP " << asicAddress % 1000 << " for ro_ch " << localAddress - << " in module " << fModAddress; + LOG(debug2) << GetName() << "::FlushBuffer: Found FASP " << asicAddress % 1000 << " for ro_ch " << localAddress + << " in module " << fModAddress; // fasp = (CbmTrdParFasp*)fAsicPar->GetAsicPar(asicAddress); (VF) not used //fasp->Print(); // chFasp[0] = fasp->GetChannel(localAddress, 0); @@ -659,7 +670,10 @@ Int_t CbmTrdModuleSimT::FlushBuffer(ULong64_t time) std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>::iterator iv; while (it != fBuffer.end()) { localAddress = it->first; - if (!fBuffer[localAddress].size()) continue; + if (!fBuffer[localAddress].size()) { + it++; + continue; + } digiMatch = NULL; Int_t col(-1), row(-1), srow, sec; diff --git a/sim/detectors/trd/CbmTrdModuleSimT.h b/sim/detectors/trd/CbmTrdModuleSimT.h index dd4a581c725d5b34b26cd364bb90afcc17670b77..1308429d84bdd4b1387a2bc9647f8aa621e27ffd 100644 --- a/sim/detectors/trd/CbmTrdModuleSimT.h +++ b/sim/detectors/trd/CbmTrdModuleSimT.h @@ -17,9 +17,19 @@ class CbmTrdParSetAsic; **/ class CbmTrdModuleSimT : public CbmTrdModuleSim { public: + enum ECbmTrdModuleSimT + { + kMeasurement = 0 ///< default simulate setup interactions, if set simulate laboratory measurement, see kLab + , + kLab ///< default simulate 55Fe, if set X-rays, see X-rays spectrum generator + , + kFEE ///< FEE simulator. Default FASP otherwise SPADIC + }; CbmTrdModuleSimT(Int_t mod, Int_t ly, Int_t rot, Bool_t FASP = kTRUE); virtual ~CbmTrdModuleSimT(); + Bool_t IsLabMeasurement() const { return TESTBIT(fConfig, kMeasurement); } + Bool_t IsFeCalib() const { return TESTBIT(fConfig, kLab); } /** * \brief Flush local buffer of digits which can no longer interact with current event * \param time current event time or 0 for all @@ -41,9 +51,19 @@ public: void SetGamma(Double_t /*gamma*/) { ; } void SetMessageConverter(CbmTrdRawToDigiR* conv = NULL) { (void) conv; } void SetQA(CbmTrdCheckUtil* qa = NULL) { (void) qa; } + void SetLabMeasurement(Bool_t set=kTRUE) { + set ? SETBIT(fConfig, kMeasurement) : CLRBIT(fConfig, kMeasurement); + SetFeCalib(set); + } + void SetFeCalib(Bool_t set = kTRUE) { set ? SETBIT(fConfig, kLab) : CLRBIT(fConfig, kLab);} - void SetAsic(Bool_t /*set*/) { ; } + /** + * \brief Set the FEE type operating on the chamber + * \param[in] set default use FASP/GETS via CbmTrdFASP class. If set to false use SPADIC TODO + **/ + void SetFasp(Bool_t set = kTRUE) { set ? SETBIT(fConfig, kFEE) : CLRBIT(fConfig, kFEE); } void SetAsicPar(CbmTrdParSetAsic* p = NULL); + Bool_t UseFasp() const { return TESTBIT(fConfig, kFEE); } private: CbmTrdModuleSimT(const CbmTrdModuleSimT& ref); @@ -75,6 +95,7 @@ private: **/ void DumpBuffer() const; + UChar_t fConfig; ///< bit map for configuration. See class documentation CbmTrdTrianglePRF* fTriangleBinning; ///< Integration of PRF on triangular pad-plane geometry CbmTrdFASP* fFASP; ///< FASP simulator CbmTimeSlice* fTimeSlice; ///< link to CBM time slice