From 1dc77a6c8e62c09dc2582a1c6bbd9decf3115935 Mon Sep 17 00:00:00 2001 From: Alexandru Bercuci <abercuci@niham.nipne.ro> Date: Fri, 21 Jan 2022 10:05:30 +0200 Subject: [PATCH] update reco frame for the 2 chamber x 2 FEE operation mode --- reco/detectors/trd/CbmTrdClusterFinder.cxx | 4 +-- reco/detectors/trd/CbmTrdClusterFinder.h | 4 ++- reco/detectors/trd/CbmTrdHitProducer.cxx | 24 ++++++++++-------- reco/detectors/trd/CbmTrdHitProducer.h | 29 +++++++++++++++++++++- reco/detectors/trd/CbmTrdModuleRec2D.cxx | 21 ++++++++++------ 5 files changed, 59 insertions(+), 23 deletions(-) diff --git a/reco/detectors/trd/CbmTrdClusterFinder.cxx b/reco/detectors/trd/CbmTrdClusterFinder.cxx index b9872fe91a..6ccfa6e230 100644 --- a/reco/detectors/trd/CbmTrdClusterFinder.cxx +++ b/reco/detectors/trd/CbmTrdClusterFinder.cxx @@ -370,7 +370,7 @@ Int_t CbmTrdClusterFinder::AddClusters(TClonesArray* clusters, CbmEvent* event, for (Int_t ic(0); ic < clusters->GetEntriesFast(); ic++) { if (!(cls = (CbmTrdCluster*) (*clusters)[ic])) continue; - if (!cls->HasTrianglePads()) { // only for rectangular clusters + if (!cls->HasFaspDigis()) { // only for rectangular/SPADIC clusters if (!ncols) { digiPar = (CbmTrdParModDigi*) fDigiPar->GetModulePar(cls->GetAddress()); if (!digiPar) { @@ -401,7 +401,7 @@ Int_t CbmTrdClusterFinder::AddClusters(TClonesArray* clusters, CbmEvent* event, // In case we have an event branch and we did only use digis from within the event, add the cluster to the event. This allows the hit producer to identify wether or not to add the corresponding hit to the event. if (event) event->AddData(ECbmDataType::kTrdCluster, ncl); ncl++; - clsSave->SetTrianglePads(cls->HasTrianglePads()); + clsSave->SetFaspDigis(cls->HasFaspDigis()); if (cls->GetMatch() != NULL) delete cls; //only the matches have pointers to allocated memory, so otherwise the clear does the trick mcl++; diff --git a/reco/detectors/trd/CbmTrdClusterFinder.h b/reco/detectors/trd/CbmTrdClusterFinder.h index 6ec7c0ed12..46ed7a1b4f 100644 --- a/reco/detectors/trd/CbmTrdClusterFinder.h +++ b/reco/detectors/trd/CbmTrdClusterFinder.h @@ -55,7 +55,7 @@ class TGeoPhysicalNode; **/ class CbmTrdClusterFinder : public FairTask { friend class CbmTrdModuleRecR; - friend class CbmTrdModuleRecT; + friend class CbmTrdModuleRec2D; public: enum CbmTrdRecDef @@ -83,6 +83,7 @@ public: static Float_t GetMinimumChargeTH() { return fgMinimumChargeTH; } static Bool_t HasDumpClusters() { return TESTBIT(fgConfig, kDumpClusters); } + static Bool_t HasFaspBranch() { return TESTBIT(fgConfig, kFASP); } static Bool_t HasMultiHit() { return TESTBIT(fgConfig, kMultiHit); } static Bool_t HasNeighbourCol() { return TESTBIT(fgConfig, kNeighbourCol); } static Bool_t HasNeighbourRow() { return TESTBIT(fgConfig, kNeighbourRow); } @@ -115,6 +116,7 @@ public: { set ? SETBIT(fgConfig, kDumpClusters) : CLRBIT(fgConfig, kDumpClusters); } + static void SetFaspBranch(Bool_t set = kTRUE) { set ? SETBIT(fgConfig, kFASP) : CLRBIT(fgConfig, kFASP); } static void SetRowMerger(Bool_t set = kTRUE) { set ? SETBIT(fgConfig, kRowMerger) : CLRBIT(fgConfig, kRowMerger); } static void SetMultiHit(Bool_t set = kTRUE) { set ? SETBIT(fgConfig, kMultiHit) : CLRBIT(fgConfig, kMultiHit); } static void SetNeighbourEnable(Bool_t col = kTRUE, Bool_t row = kFALSE) diff --git a/reco/detectors/trd/CbmTrdHitProducer.cxx b/reco/detectors/trd/CbmTrdHitProducer.cxx index 94a5eb519d..16544de8eb 100644 --- a/reco/detectors/trd/CbmTrdHitProducer.cxx +++ b/reco/detectors/trd/CbmTrdHitProducer.cxx @@ -94,15 +94,7 @@ CbmTrdModuleRec* CbmTrdHitProducer::AddModule(Int_t address, TGeoPhysicalNode* n << moduleAddress << "] ly[" << lyId << "] det[" << moduleAddress << "]"; CbmTrdModuleRec* module(nullptr); - if (moduleType >= 9) { - // special care for hybrid TRD-2Dh installed at mCBM21 - if (moduleType == 10) { - LOG(warn) << "CbmTrdHitProducer::AddModule: Module ID " << address - << " is of hybrid FEE type. Skipped for the moment."; - return module; - } - module = fModules[address] = new CbmTrdModuleRec2D(address); - } + if (moduleType >= 9) { module = fModules[address] = new CbmTrdModuleRec2D(address); } else { module = fModules[address] = new CbmTrdModuleRecR(address); } @@ -203,16 +195,20 @@ void CbmTrdHitProducer::processCluster(const Int_t clusterIdx) // get/build module for current cluster auto imod = fModules.find(cluster->GetAddress()); auto mod = imod->second; - + if (HasFaspBranch()) { + if (cluster->HasFaspDigis()) CbmTrdDigi::SetSystem(ECbmModuleId::kTrd2d); + else + CbmTrdDigi::SetSystem(ECbmModuleId::kTrd); + } std::vector<const CbmTrdDigi*> digivec = {}; // get digis for current cluster for (Int_t iDigi = 0; iDigi < cluster->GetNofDigis(); iDigi++) { const CbmTrdDigi* digi = CbmDigiManager::Instance()->Get<CbmTrdDigi>(cluster->GetDigi(iDigi)); - if (digi->GetType() == CbmTrdDigi::eCbmTrdAsicType::kSPADIC && digi->GetCharge() <= 0) continue; digivec.emplace_back(digi); } + mod->MakeHit(clusterIdx, cluster, &digivec); fNrClusters++; @@ -248,6 +244,12 @@ InitStatus CbmTrdHitProducer::Init() CbmDigiManager::Instance()->Init(); if (!CbmDigiManager::Instance()->IsPresent(ECbmModuleId::kTrd)) LOG(fatal); + if (CbmDigiManager::Instance()->IsPresent(ECbmModuleId::kTrd2d)) { + LOG(info) << GetName() << "::Init : Trd2d digis found in a separate branch"; + SetFaspBranch(true); + } + else + LOG(info) << GetName() << "::Init : All Trd digis in a common branch"; fClusters = (TClonesArray*) ioman->GetObject("TrdCluster"); if (!fClusters) { diff --git a/reco/detectors/trd/CbmTrdHitProducer.h b/reco/detectors/trd/CbmTrdHitProducer.h index 5e529f3ec4..a965557bcf 100644 --- a/reco/detectors/trd/CbmTrdHitProducer.h +++ b/reco/detectors/trd/CbmTrdHitProducer.h @@ -35,6 +35,10 @@ class CbmTrdParSetGeo; class CbmTrdModuleRec; class CbmTrdHitProducer : public FairTask { public: + enum eCbmTrdHitProducerDef + { + kFasp = 0 ///< marker for FASP digi saved separately + }; /** * \brief Constructor. */ @@ -44,7 +48,10 @@ public: * \brief Destructor. */ virtual ~CbmTrdHitProducer(); - + /** \brief Inquire if Fasp digi are saved in a separate branch + * \return true when the "TrdFaspDigi" branch is present in the digi tree + */ + bool HasFaspBranch() const { return TESTBIT(fTaskConfig, eCbmTrdHitProducerDef::kFasp); } /** * \brief Inherited form FairTask. */ @@ -59,6 +66,14 @@ public: * \brief Inherited from FairTask. */ virtual void Finish(); + + /** \brief Mark that Fasp digi are saved in a separate digi branch + * \param[in] set true for FASP and false [default] for common digi branch + */ + void SetFaspBranch(bool set = true) + { + set ? SETBIT(fTaskConfig, eCbmTrdHitProducerDef::kFasp) : CLRBIT(fTaskConfig, eCbmTrdHitProducerDef::kFasp); + } virtual void SetParContainers(); private: @@ -121,6 +136,18 @@ private: CbmTrdParSetGain* fGainPar = nullptr; ///< parameter list for keV->ADC gain conversion CbmTrdParSetGeo* fGeoPar = nullptr; ///< parameter list for modules geometry + /** 8 bits bit map for task configuration + * [0] - separate branch for FASP digis \see SetFaspBranch + * [1] - + * [2] - + * [3] - + * [4] - + * [5] - + * [6] - + * [7] - + */ + uint8_t fTaskConfig; + /** @brief Number of processed time slices */ UInt_t fNrTs = 0; diff --git a/reco/detectors/trd/CbmTrdModuleRec2D.cxx b/reco/detectors/trd/CbmTrdModuleRec2D.cxx index fb72d08319..f127b8bda2 100644 --- a/reco/detectors/trd/CbmTrdModuleRec2D.cxx +++ b/reco/detectors/trd/CbmTrdModuleRec2D.cxx @@ -68,7 +68,7 @@ CbmTrdModuleRec2D::CbmTrdModuleRec2D(Int_t mod, Int_t ly, Int_t rot) , vx() , vxe() { - // printf("AddModuleT @ %d\n", mod); Config(1,0); + //printf("AddModuleT @ %d\n", mod); Config(1,0); SetNameTitle(Form("Trd2dReco%d", mod), "Reconstructor for triangular read-out."); } @@ -83,7 +83,7 @@ Bool_t CbmTrdModuleRec2D::AddDigi(const CbmTrdDigi* d, Int_t id) * chunk is to have abs(dt)<5 wrt cluster t0 */ - if (CWRITE()) cout << "add @" << id << " " << d->ToString(); + if (CWRITE()) cout << "\nadd @" << id << " " << d->ToString(); Int_t ch = d->GetAddressChannel(), col, row = GetPadRowCol(ch, col), dtime; Double_t t, r = d->GetCharge(t, dtime); @@ -103,7 +103,7 @@ Bool_t CbmTrdModuleRec2D::AddDigi(const CbmTrdDigi* d, Int_t id) Bool_t kINSERT(kFALSE); std::list<CbmTrdCluster*>::iterator itc = fBuffer[row].begin(); for (; itc != fBuffer[row].end(); itc++) { - if (CWRITE()) cout << (*itc)->ToString(); + //if (CWRITE()) cout << (*itc)->ToString(); UShort_t tc = (*itc)->GetStartTime(); Int_t dt = tc - tm; @@ -134,7 +134,7 @@ Bool_t CbmTrdModuleRec2D::AddDigi(const CbmTrdDigi* d, Int_t id) fBuffer[row].push_back(cl = new CbmTrdCluster(fModAddress, id, ch, row, tm)); if (CWRITE()) cout << " => Cl (Pb) " << cl->ToString(); } - cl->SetTrianglePads(); + cl->SetFaspDigis((d->GetType() == CbmTrdDigi::eCbmTrdAsicType::kFASP)); if (terminator < 0) cl->SetProfileStart(); else if (terminator > 0) cl->SetProfileStop(); @@ -142,7 +142,7 @@ Bool_t CbmTrdModuleRec2D::AddDigi(const CbmTrdDigi* d, Int_t id) } else { fBuffer[row].push_back(cl = new CbmTrdCluster(fModAddress, id, ch, row, tm)); - cl->SetTrianglePads(); + cl->SetFaspDigis((d->GetType() == CbmTrdDigi::eCbmTrdAsicType::kFASP)); if (terminator < 0) cl->SetProfileStart(); else if (terminator > 0) cl->SetProfileStop(); @@ -196,14 +196,14 @@ Int_t CbmTrdModuleRec2D::FindClusters() for (itc0 = (*ir).second.begin(); itc0 != (*ir).second.end(); itc0++) { cl = (*itc0); cl = new ((*fClusters)[ncl++]) CbmTrdCluster(*cl); - cl->SetTrianglePads(); + cl->SetFaspDigis((*itc0)->HasFaspDigis()); delete (*itc0); } } fBuffer.clear(); - //printf("fClusters[%p] nCl[%d]\n", (void*)fClusters, fClusters->GetEntriesFast()); - //LOG(info) << GetName() << "::FindClusters : " << ncl; + // printf("fClusters[%p] nCl[%d]\n", (void*)fClusters, fClusters->GetEntriesFast()); + // LOG(info) << GetName() << "::FindClusters : " << ncl; return ncl; } @@ -770,6 +770,11 @@ Bool_t CbmTrdModuleRec2D::BuildHit(CbmTrdHit* h) //_______________________________________________________________________________ CbmTrdHit* CbmTrdModuleRec2D::MakeHit(Int_t ic, const CbmTrdCluster* cl, std::vector<const CbmTrdDigi*>* digis) { + if (!cl->HasFaspDigis()) { + LOG(debug) << GetName() << "::MakeHit: Hybrid cluster SPADIC/Trd2d. Skipped for the moment."; + // std::cout << cl->ToString(); + return nullptr; + } if (!fgEdep) { // first use initialization of PRF helppers LOG(info) << GetName() << "::MakeHit: Init static helpers. "; fgEdep = new TGraphErrors; -- GitLab