diff --git a/core/eventdisplay/CMakeLists.txt b/core/eventdisplay/CMakeLists.txt index 7efa64413eaaf1de68ea168640f95440ef9eb86e..eda6b9c199f09e81aacf28458b613cc2c6309e2c 100644 --- a/core/eventdisplay/CMakeLists.txt +++ b/core/eventdisplay/CMakeLists.txt @@ -16,6 +16,8 @@ set(SRCS CbmTimesliceRecoTracks.cxx CbmTsEveAnimationControl.cxx CbmTsEveTransparencyControl.cxx + CbmTsDisTracks.cxx + CbmTsPointSetArrayDraw.cxx ) diff --git a/core/eventdisplay/CbmDisplayLinkDef.h b/core/eventdisplay/CbmDisplayLinkDef.h index 2503c538eea67d3adf1bab55a23482f3ad37872e..9c9351724530828787feb47339518ab0f2b53f86 100644 --- a/core/eventdisplay/CbmDisplayLinkDef.h +++ b/core/eventdisplay/CbmDisplayLinkDef.h @@ -11,6 +11,10 @@ #pragma link C++ class CbmTrdDigiDraw; #pragma link C++ class CbmPixelHitSetDraw; #pragma link C++ class CbmEvDisTracks + ; +#pragma link C++ class CbmEvManager + ; +#pragma link C++ class CbmEvManagerEditor + ; +#pragma link C++ class CbmEveAnimationControl + ; +#pragma link C++ class CbmTsDisTracks + ; #pragma link C++ class CbmRecoTracks; #pragma link C++ class CbmPointSetArray; #pragma link C++ class CbmPointSetArrayDraw; @@ -21,4 +25,5 @@ #pragma link C++ class CbmTimesliceRecoTracks; #pragma link C++ class CbmTsEveAnimationControl; #pragma link C++ class CbmTsEveTransparencyControl; +#pragma link C++ class CbmTsPointSetArrayDraw; #endif diff --git a/core/eventdisplay/CbmTimesliceManager.cxx b/core/eventdisplay/CbmTimesliceManager.cxx index 1cff1d083e903a50cc1810cf5a6de5a2adb3708d..2a80ec2e1f1e94d14b0d74129582c69cd838a8d0 100644 --- a/core/eventdisplay/CbmTimesliceManager.cxx +++ b/core/eventdisplay/CbmTimesliceManager.cxx @@ -7,6 +7,8 @@ #include "CbmEvent.h" // For CbmEvent #include "CbmTimeslicePixelHitSetDraw.h" // For CbmTimeslicePixelHitSetDraw #include "CbmTimesliceRecoTracks.h" // For CbmTimesliceRecoTracks +#include "CbmTsDisTracks.h" // for CbmTofTracklets +#include "CbmTsPointSetArrayDraw.h" // For CbmTsPointSetArrayDraw #include "FairRootManager.h" // for FairRootManager #include "FairTask.h" // for FairTask @@ -59,7 +61,7 @@ void CbmTimesliceManager::SetDisplayCbmElectron() CbmTimeslicePixelHitSetDraw* drawStsHit = new CbmTimeslicePixelHitSetDraw("StsHit", kBlue, kFullSquare); CbmTimeslicePixelHitSetDraw* drawRichHit = new CbmTimeslicePixelHitSetDraw("RichHit", kCyan, kFullSquare); CbmTimeslicePixelHitSetDraw* drawTrdHit = new CbmTimeslicePixelHitSetDraw("TrdHit", kYellow, kFullSquare); - CbmTimeslicePixelHitSetDraw* drawTofHit = new CbmTimeslicePixelHitSetDraw("TofHit", kRed, kFullSquare); + CbmTimeslicePixelHitSetDraw* drawTofHit = new CbmTimeslicePixelHitSetDraw("TofHit", kRed, kFullCircle); CbmTimeslicePixelHitSetDraw* drawPsdHit = new CbmTimeslicePixelHitSetDraw("PsdHit", kOrange, kFullSquare); CbmTimesliceRecoTracks* drawTrack = new CbmTimesliceRecoTracks(); @@ -98,18 +100,46 @@ void CbmTimesliceManager::SetDisplayMcbm() CbmTimeslicePixelHitSetDraw* drawStsHit = new CbmTimeslicePixelHitSetDraw("StsHit", kBlue, kFullSquare); // CbmTimeslicePixelHitSetDraw* drawMuchHit = new CbmTimeslicePixelHitSetDraw("MuchHit", kCyan, kFullSquare); CbmTimeslicePixelHitSetDraw* drawTrdHit = new CbmTimeslicePixelHitSetDraw("TrdHit", kYellow, kFullSquare); - CbmTimeslicePixelHitSetDraw* drawTofHit = new CbmTimeslicePixelHitSetDraw("TofHit", kRed, kFullSquare); + CbmTimeslicePixelHitSetDraw* drawTofHit = new CbmTimeslicePixelHitSetDraw("TofHit", kRed, kFullCircle); CbmTimeslicePixelHitSetDraw* drawRichHit = new CbmTimeslicePixelHitSetDraw("RichHit", kOrange, kFullSquare); AddTask(drawStsHit); //AddTask(drawMuchHit); AddTask(drawTrdHit); AddTask(drawTofHit); - AddTask(drawRichHit); + //AddTask(drawRichHit); CbmTimesliceRecoTracks* drawTrack = new CbmTimesliceRecoTracks(); AddTask(drawTrack); + CbmTsDisTracks* TofTracks = + new CbmTsDisTracks("TofTracks", 1, kFALSE, kTRUE); //name, verbosity, RnrChildren points, RnrChildren track + AddTask(TofTracks); + + CbmTsPointSetArrayDraw* drawTofUHit = new CbmTsPointSetArrayDraw( + "TofUHit", kBlue, kCross, 1, kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren + //CbmTimeslicePixelHitSetDraw* drawTofUHit = new CbmTimeslicePixelHitSetDraw("TofUHit", kBlue, kCross); + AddTask(drawTofUHit); + + fbMcbmViewersEna = true; +} + +void CbmTimesliceManager::SetDisplayTofCosmicsHd() +{ + CbmTimeslicePixelHitSetDraw* drawTofHit = new CbmTimeslicePixelHitSetDraw("TofHit", kRed, kFullSquare); + AddTask(drawTofHit); + + CbmTsDisTracks* TofTracks = + new CbmTsDisTracks("TofTracks", 1, kFALSE, kTRUE); //name, verbosity, RnrChildren points, RnrChildren track + AddTask(TofTracks); + + //CbmTsPointSetArrayDraw* drawTofUHit = new CbmTsPointSetArrayDraw("TofUHit", kBlue, kCross, 1, kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren + //AddTask(drawTofUHit); + + // Display L1 tracks + //CbmTimesliceRecoTracks* drawTrack = new CbmTimesliceRecoTracks(); + //AddTask(drawTrack); + fbMcbmViewersEna = true; } @@ -193,7 +223,17 @@ void CbmTimesliceManager::NextTimeslice() /// Check if possible (min/max) /// Re-use main method - GotoTimeslice(GetCurrentTimeslice() + 1); + int NbEventsInTs = 0; + while (NbEventsInTs == 0) { + GotoTimeslice(GetCurrentTimeslice() + 1); + TClonesArray* pCbmEvents = dynamic_cast<TClonesArray*>(fRootManager->GetObject("CbmEvent")); + NbEventsInTs = fCbmEvents->GetEntriesFast(); + } + LOG(debug) << "Display TS " << GetCurrentTimeslice() << " with " << NbEventsInTs << " events"; + SetTsTimeText(GetTimesliceTime()); + SetTsNumberText(GetCurrentTimeslice()); + SetEvtTimeText(GetEventTime()); + SetEvtNumberText(GetCurrentEvent()); } void CbmTimesliceManager::PrevTimeslice() @@ -207,6 +247,11 @@ void CbmTimesliceManager::PrevTimeslice() void CbmTimesliceManager::GotoEvent(Int_t event) { fEventIdx = event; + + CbmEvent* pEvent = dynamic_cast<CbmEvent*>(fCbmEvents->At(fEventIdx)); + Int_t nofTofTracks = pEvent->GetNofData(ECbmDataType::kTofTracklet); + LOG(debug) << GetName() << " : Ts_nofTofTracks " << nofTofTracks << " in event " << fEventIdx; + /// Get List of tasks from FairRunAna TList* taskList = FairRunAna::Instance()->GetMainTask()->GetListOfTasks(); @@ -216,8 +261,17 @@ void CbmTimesliceManager::GotoEvent(Int_t event) dynamic_cast<CbmTimesliceRecoTracks*>(task)->GotoEvent(event); } else if (nullptr != dynamic_cast<CbmTimeslicePixelHitSetDraw*>(task)) { + LOG(debug) << GetName() << ": call " << task->GetName(); dynamic_cast<CbmTimeslicePixelHitSetDraw*>(task)->GotoEvent(event); } + else if (nullptr != dynamic_cast<CbmTsPointSetArrayDraw*>(task)) { + LOG(debug) << GetName() << ": call " << task->GetName(); + //dynamic_cast<CbmTsPointSetArrayDraw*>(task)->GotoEvent(event); // FIXME: does not work yet + } + else if (nullptr != dynamic_cast<CbmTsDisTracks*>(task)) { + LOG(debug) << GetName() << ": call " << task->GetName(); + dynamic_cast<CbmTsDisTracks*>(task)->GotoEvent(event); + } } } @@ -426,6 +480,7 @@ void CbmTimesliceManager::LoadXMLDetector(TGeoNode* node, FairXMLNode* xml, Int_ } if (!visibility.EqualTo("")) { bool bVisVal = (0 < visibility.Atoi()); + node->SetVisibility(bVisVal); // Declared as deprecated in the ROOT documentation, but needed for real invisibility node->GetVolume()->SetVisibility(bVisVal); if (!recursive) { // LOG(info) << "Setting " << node_name << (bVisVal ? " Visible" : " Invisible") // diff --git a/core/eventdisplay/CbmTimesliceManager.h b/core/eventdisplay/CbmTimesliceManager.h index 893988a4d9630528b7ea6e106abb5d573be7450a..8cc9c8f810d2b3ad17dfd49a5b0b9372f48ce816 100644 --- a/core/eventdisplay/CbmTimesliceManager.h +++ b/core/eventdisplay/CbmTimesliceManager.h @@ -62,6 +62,10 @@ public: ** @brief Select/add default set of views and some Hit and Tracks drawing classes for the mCBM 2022+ setups. **/ void SetDisplayMcbm(); + /** + ** @brief Select/add default set of views and some Hit and Tracks drawing classes for the HD 2023+ cosmics setups. + **/ + void SetDisplayTofCosmicsHd(); /** * set detector's transparency, typically called during processing of XML config file * @param use_xml use xml colors if available diff --git a/core/eventdisplay/CbmTimesliceRecoTracks.cxx b/core/eventdisplay/CbmTimesliceRecoTracks.cxx index c7e4356ce2da72785c41379188f71ff6369c7d5c..5dd3be018a714c741df7289fd3e43730597083a4 100644 --- a/core/eventdisplay/CbmTimesliceRecoTracks.cxx +++ b/core/eventdisplay/CbmTimesliceRecoTracks.cxx @@ -52,6 +52,8 @@ InitStatus CbmTimesliceRecoTracks::Init() fTofHits = dynamic_cast<TClonesArray*>(fManager->GetObject("TofHit")); fTofTracks = dynamic_cast<TClonesArray*>(fManager->GetObject("TofTrack")); + if (nullptr == fTofTracks) { LOG(warn) << "TofTracks not found"; } + if (nullptr == fCbmEvents) { LOG(fatal) << "CbmTimesliceRecoTracks::Init() => CbmEvents branch not found! Task will be deactivated"; SetActive(kFALSE); @@ -90,6 +92,7 @@ void CbmTimesliceRecoTracks::HandleTrack(TEveTrack* eveTrack, Int_t& n, const Cb HitType hitType = recoTrack->GetHitType(i); Int_t hitIndex = recoTrack->GetHitIndex(i); const CbmPixelHit* pixelHit = 0; + LOG(debug4) << "HandleTrack: hit " << i << ", type " << hitType << ", ind " << hitIndex; switch (hitType) { case kRICHHIT: pixelHit = static_cast<const CbmPixelHit*>(fRichHits->At(hitIndex)); break; @@ -160,6 +163,7 @@ void CbmTimesliceRecoTracks::GotoEvent(uint32_t uEventIdx) CbmEvent* event = dynamic_cast<CbmEvent*>(fCbmEvents->At(uEventIdx)); Int_t nofGlobalTracks = event->GetNofData(ECbmDataType::kGlobalTrack); + LOG(debug3) << "CbmTimesliceRecoTracks for nofGlobalTracks=" << nofGlobalTracks; for (Int_t iGloTrk = 0; iGloTrk < nofGlobalTracks; ++iGloTrk) { LOG(debug3) << "CbmTimesliceRecoTracks::GotoEvent " << iGloTrk; @@ -171,21 +175,35 @@ void CbmTimesliceRecoTracks::GotoEvent(uint32_t uEventIdx) Int_t trdId = globalTrack->GetTrdTrackIndex(); Int_t tofId = globalTrack->GetTofTrackIndex(); Int_t tofHitId = globalTrack->GetTofHitIndex(); - - if (0 > stsId) continue; - - const CbmStsTrack* stsTrack = dynamic_cast<const CbmStsTrack*>(fStsTracks->At(stsId)); - - if (0 == stsTrack) continue; - - Int_t pdg = stsTrack->GetPidHypo(); + LOG(debug4) << "GloTrk " << iGloTrk << " trkId " << trkId << " stsId " << stsId << " trdId " << trdId << " tofId " + << tofId << ", " << tofHitId; + + // Global Track fit display + /* + FIXME: Not working yet, just printout + globalTrack->Print(); + const FairTrackParam* tParF = globalTrack->GetParamFirst(); + tParF->Print(); + */ + + CbmStsTrack* stsTrack = nullptr; + if (stsId > -1) { stsTrack = dynamic_cast<CbmStsTrack*>(fStsTracks->At(stsId)); } + + Int_t n = 0; + Int_t pdg = 0; + if (nullptr != stsTrack) { pdg = stsTrack->GetPidHypo(); } TParticle P; P.SetPdgCode(pdg); fTrList = GetTrGroup(&P); TEveTrack* eveTrack = new TEveTrack(&P, pdg, fTrPr); - eveTrack->SetLineColor(fEventManager->Color(pdg)); - Int_t n = 0; - HandleStsTrack(eveTrack, n, stsTrack); + eveTrack->SetLineColor(kRed); //fEventManager->Color(pdg)); + if (nullptr != stsTrack) { + LOG(debug3) << "HandleStsTrack " << stsId; + HandleStsTrack(eveTrack, n, stsTrack); + } + else { + LOG(debug3) << "No Sts track"; + } if (-1 < richId) { const CbmRichRing* r = dynamic_cast<const CbmRichRing*>(fRichRings->At(richId)); @@ -199,9 +217,24 @@ void CbmTimesliceRecoTracks::GotoEvent(uint32_t uEventIdx) HandleTrack(eveTrack, n, dynamic_cast<const CbmTrack*>(fMuchTracks->At(muchId))); } - if (-1 < trdId) HandleTrack(eveTrack, n, dynamic_cast<const CbmTrack*>(fTrdTracks->At(trdId))); + LOG(debug3) << "HandleTrdTrack " << trdId; + if (-1 < trdId) { + if (nullptr == fTrdTracks) { LOG(error) << GetName() << ": No TrdTrack array, return"; } + else { + const CbmTrack* recoTrack = dynamic_cast<const CbmTrack*>(fTrdTracks->At(trdId)); + LOG(debug3) << "HandleTrdTrack " << trdId << ", " << recoTrack; + if (nullptr != recoTrack) HandleTrack(eveTrack, n, recoTrack); + } + } - if (-1 < tofId) HandleTrack(eveTrack, n, dynamic_cast<const CbmTrack*>(fTofTracks->At(tofId))); + if (-1 < tofId) { + if (nullptr == fTofTracks) { LOG(error) << GetName() << ": No TofTrack array, return"; } + else { + const CbmTrack* recoTrack = dynamic_cast<const CbmTrack*>(fTofTracks->At(tofId)); + LOG(debug3) << "HandleTofTrack " << tofId << ", " << recoTrack; + if (nullptr != recoTrack) HandleTrack(eveTrack, n, recoTrack); + } + } else if (-1 < tofHitId) HandlePixelHit(eveTrack, n, dynamic_cast<const CbmPixelHit*>(fTofHits->At(tofHitId))); @@ -219,6 +252,7 @@ void CbmTimesliceRecoTracks::Reset() { for (Int_t i = 0; i < fEveTrList->GetEntriesFast(); i++) { TEveTrackList* ele = (TEveTrackList*) fEveTrList->At(i); + LOG(debug3) << GetName() << ": remove elements from " << ele->GetName(); gEve->RemoveElement(ele, fEventManager); } fEveTrList->Clear(); diff --git a/core/eventdisplay/CbmTsDisTracks.cxx b/core/eventdisplay/CbmTsDisTracks.cxx new file mode 100644 index 0000000000000000000000000000000000000000..37c2a754f020898a696e440d4d2cb04e7e5d9cf4 --- /dev/null +++ b/core/eventdisplay/CbmTsDisTracks.cxx @@ -0,0 +1,434 @@ +/* Copyright (C) 2007-2021 PI-UHd, GSI + SPDX-License-Identifier: GPL-3.0-only + Authors: Mohammad Al-Turany, Norbert Herrmann [committer], Florian Uhlig */ + +#// ------------------------------------------------------------------------- +// ----- following FairMCTracks source file ----- +// ----- Created 10/12/07 by M. Al-Turany ----- +// ------------------------------------------------------------------------- +#define TOFDisplay 1 // =1 means active, other: without Label and not relying on TEvePointSet +#define TOFTtErr 1 // =1 means active, other: not relying on VelocityError of CbmTofTracklet + +#include "CbmTsDisTracks.h" + +#include "CbmEvent.h" // For CbmEvent +#include "CbmTimesliceManager.h" // for CbmTimesliceManager +#include "CbmTofHit.h" // for CbmTofHit +#include "CbmTofTracklet.h" // for CbmTofTracklet + +#include <FairEventManager.h> // for FairEventManager +#include <FairRootManager.h> // for FairRootManager +#include <FairTask.h> // for FairTask, InitStatus, kERROR, kSUCCESS +#include <Logger.h> // for LOG, Logger + +#include <Rtypes.h> // for ClassImp +#include <TClonesArray.h> // for TClonesArray +#include <TEveElement.h> // for TEveElementList +#include <TEveManager.h> // for TEveManager, gEve +#include <TEvePathMark.h> // for TEvePathMark +#include <TEvePointSet.h> // for TEvePointSetArray, TEvePointSet +#include <TEveTrack.h> // for TEveTrack, TEveTrackList +#include <TEveTrackPropagator.h> // for TEveTrackPropagator +#include <TEveVSDStructs.h> // for TEveRecTrack +#include <TEveVector.h> // for TEveVector, TEveVectorT +#include <TGLAnnotation.h> +#include <TGLViewer.h> +#include <TGenericClassInfo.h> // for TGenericClassInfo +#include <TObjArray.h> // for TObjArray +#include <TParticle.h> // for TParticle +#include <TString.h> // for Form, TString + +#include <string.h> // for strcmp + +ClassImp(CbmTsDisTracks); +CbmTsDisTracks* CbmTsDisTracks::fInstance = 0; + +//static TGLAnnotation* anne; +static TGLAnnotation* annt; +static CbmTimesliceManager* fTsManager = NULL; +static FairEventManager* fEventManager = NULL; + +// ----- Default constructor ------------------------------------------- +CbmTsDisTracks::CbmTsDisTracks() + : FairTask("CbmTsDisTracks", 0) + , fTrackList(nullptr) + , fTrPr(nullptr) + , fTimesliceManager(nullptr) + , fEveTrList(nullptr) + , fEvent("") + , fTrList(nullptr) + , fEvePSList(nullptr) + , fPSList(nullptr) + , fRenderP(kFALSE) + , fRenderT(kTRUE) + , MinEnergyLimit(-1.) + , MaxEnergyLimit(-1.) + , PEnergy(-1.) +{ + if (!fInstance) fInstance = this; +} +// ------------------------------------------------------------------------- + + +// ----- Standard constructor ------------------------------------------ +CbmTsDisTracks::CbmTsDisTracks(const char* name, Int_t iVerbose, Bool_t renderP, Bool_t renderT) + : FairTask(name, iVerbose) + , fTrackList(nullptr) + , fTrPr(nullptr) + , fTimesliceManager(nullptr) + , fEveTrList(new TObjArray(16)) + , fEvent("") + , fTrList(nullptr) + , fEvePSList(new TObjArray(8)) + , fPSList(nullptr) + , fRenderP(renderP) + , fRenderT(renderT) + , MinEnergyLimit(-1.) + , MaxEnergyLimit(-1.) + , PEnergy(-1.) +{ + if (!fInstance) fInstance = this; +} +// ------------------------------------------------------------------------- +InitStatus CbmTsDisTracks::Init() +{ + LOG(info) << "CbmTsDisTracks::Init()"; + FairRootManager* fManager = FairRootManager::Instance(); + fCbmEvents = dynamic_cast<TClonesArray*>(fManager->GetObject("CbmEvent")); + fTrackList = dynamic_cast<TClonesArray*>(fManager->GetObject("TofTracklets")); + if (fTrackList == 0) { + LOG(warn) << "CbmTsDisTracks::Init() branch " << GetName() << " Not found! Task will be deactivated "; + SetActive(kFALSE); + } + LOG(debug1) << "CbmTsDisTracks::Init() get track list" << fTrackList; + /* + LOG(debug1) << "CbmTsDisTracks::Init() create propagator"; + fEventManager = FairEventManager::Instance(); + fEventManager = CbmTimesliceManager::Instance(); + LOG(debug1) << "CbmTsDisTracks::Init() get instance of FairEventManager "; + fEvent = "Current Event"; + MinEnergyLimit = fEventManager->GetEvtMinEnergy(); + MaxEnergyLimit = fEventManager->GetEvtMaxEnergy(); + PEnergy = 0; + */ + fTsManager = CbmTimesliceManager::Instance(); + fEventManager = FairEventManager::Instance(); + + if (NULL == fEventManager) { LOG(warn) << GetName() << ": no FairEventManager found, use TsManager "; } + else + LOG(info) << "CbmTsDisTracks::Init() got instance of FairEventManager "; + + if (IsActive()) { return kSUCCESS; } + else { + return kERROR; + } +} +// ------------------------------------------------------------------------- +void CbmTsDisTracks::Exec(Option_t* option) +{ + LOG(debug2) << " CbmTsDisTracks::Exec starting with verbosity " << fVerbose << " and option " << option; + if (0 < fCbmEvents->GetEntriesFast()) { + /// When loading a new TS, load the first event if possible + GotoEvent(0); + } +} +void CbmTsDisTracks::GotoEvent(uint32_t uEventIdx) +{ + if (IsActive()) { + + fEventIdx = uEventIdx; + + if (CbmTimesliceManager::Instance()->GetClearHandler()) { // + Reset(); + } + + CbmEvent* event = dynamic_cast<CbmEvent*>(fCbmEvents->At(uEventIdx)); + + Int_t nofTofTracks = event->GetNofData(ECbmDataType::kTofTracklet); + LOG(debug3) << GetName() << " : nofTofTracks " << nofTofTracks << " in event " << uEventIdx; + + Reset(); + + CbmTofTracklet* tr; + const Double_t* point; + CbmTofHit* hit; + Int_t TMul[10] = {10 * 0}; //FIXME - don't use constants in code + + for (Int_t iOpt = 0; iOpt < 2; iOpt++) + for (Int_t iTrk = 0; iTrk < nofTofTracks; ++iTrk) { + Int_t trkId = event->GetIndex(ECbmDataType::kTofTracklet, iTrk); + tr = dynamic_cast<CbmTofTracklet*>(fTrackList->At(trkId)); + int i = iTrk; + // for (Int_t i = 0; i < fTrackList->GetEntriesFast(); i++) { + // LOG(debug4) << "CbmTsDisTracks::Exec " << i; + // tr = (CbmTofTracklet*) fTrackList->At(i); + if (nullptr == tr) continue; + Int_t Np = tr->GetNofHits(); + +#if TOFDisplay == 1 //List for TEvePointSets + if (iOpt == 0) TMul[Np]++; + fPSList = GetPSGroup(Np, iOpt); +#endif + + fTrList = GetTrGroup(tr->GetNofHits(), iOpt); + TParticle* P = new TParticle(); + TEveTrack* track = new TEveTrack(P, tr->GetPidHypo(), fTrPr); + Int_t iCol = Np; + if (iCol > 4) iCol++; + track->SetAttLineAttMarker(fTrList); //set defaults + track->SetLineColor(iCol); + track->SetMarkerColor(iCol); + track->SetMarkerSize(2.); + //track->SetMarkerDraw(kTRUE); + + track->SetPoint(0, tr->GetFitX(0.), tr->GetFitY(0.), 0.); //insert starting point + TEveVector pos0 = TEveVector(tr->GetFitX(0.), tr->GetFitY(0.), 0.); + TEvePathMark* path0 = new TEvePathMark(); + path0->fV = pos0; + track->AddPathMark(*path0); + + Double_t pbuf[3], vbuf[3]; + TEveRecTrack rt; + rt.fIndex = i; + pbuf[0] = 0.; + pbuf[1] = 0.; + pbuf[2] = 1. / tr->GetTt(); // velocity + rt.fP.Set(pbuf); + vbuf[0] = tr->GetFitX(0.); + vbuf[1] = tr->GetFitY(0.); + vbuf[2] = 0.; + rt.fV.Set(vbuf); + track->SetName(Form("TEveTrack %d", rt.fIndex)); + + //track->SetStdTitle(); + // Double_t beta, beta_err, res_x, res_y, res_z, res_t; + Double_t beta, beta_err, res_x, res_y, res_t; + switch (iOpt) { + case 0: track->SetStdTitle(); break; + case 1: +#if TOFDisplay == 1 //setting content of label depending on available information + beta = (1 / tr->GetTt()) / 29.98; +#if TOFTtErr == 1 + beta_err = beta * (tr->GetTtErr() / tr->GetTt()); + track->SetTitle( + Form("%s\nChiSqDoF = %2.2f\nbeta = %1.3f +/- %1.3f", track->GetName(), tr->GetChiSq(), beta, beta_err)); +#else + track->SetTitle(Form("%s\nChiSqDoF = %2.2f\nbeta = %1.3f", track->GetName(), tr->GetChiSq(), beta)); +#endif +#else + track->SetStdTitle(); +#endif + break; + } + +#if TOFDisplay == 1 + // initialize TEvePointSet to show Datapoints belonging to track + TEvePointSetArray* psa = new TEvePointSetArray(Form("TEveTrack Points %d", i), ""); + psa->SetMarkerColor(iCol); + psa->SetMarkerSize(1.6); + if (iOpt == 0) psa->SetMarkerStyle(4); + else + psa->SetMarkerStyle(5); + psa->InitBins("Hits", Np, 0.5, Np + 0.5); +#endif + + for (Int_t n = 0; n < Np; n++) { + switch (iOpt) { + case 0: point = tr->GetPoint(n); //pointer to member variable so GetFitPoint() would also change GetPoint() +#if TOFDisplay == 1 + // following belongs to filling and labeling of PointSetArray + psa->Fill(point[0], point[1], point[2], n + 1); + hit = tr->GetTofHitPointer(n); + res_x = (point[0] - tr->GetFitX(point[2])) / hit->GetDx(); + res_y = (point[1] - tr->GetFitY(point[2])) / hit->GetDy(); + res_t = (point[3] - tr->GetFitT(point[2])) / hit->GetTimeError(); + // res_z=0; + psa->GetBin(n + 1)->SetTitle(Form("%s\nPointId = %d\nResiduals:\nX = %1.3f\nY = %1.3f\nT = %1.3f", + track->GetName(), tr->GetHitIndex(n), res_x, res_y, res_t)); +#endif + break; + case 1: // represent fit + point = tr->GetFitPoint(n); + psa->Fill(point[0], point[1], point[2], n + 1); + break; + } + track->SetPoint(n + 1, point[0], point[1], point[2]); + /* + LOG(info) << Form(" CbmTsDisTracks::SetPoint Opt %d, n %d, %6.2f, %6.2f, %6.2f, %6.2f ", iOpt, n, point[0], point[1], + point[2], point[3]); + */ + TEveVector pos = TEveVector(point[0], point[1], point[2]); + TEvePathMark* path = new TEvePathMark(); + path->fV = pos; + path->fTime = point[3]; + if (n == 0) { + TEveVector Mom = TEveVector(P->Px(), P->Py(), P->Pz()); + path->fP = Mom; + } + + track->AddPathMark(*path); + if (iOpt == 1 && n == Np - 1) { + //LOG(info) << "Add extrapolation by 20%, TBD "; + Double_t pointL[3]; + pointL[2] = point[2] * 1.2; + pointL[0] = tr->GetFitX(pointL[2]); + pointL[1] = tr->GetFitY(pointL[2]); + track->SetPoint(n + 2, pointL[0], pointL[1], pointL[2]); + TEveVector posL = TEveVector(pointL[0], pointL[1], pointL[2]); + TEvePathMark* pathL = new TEvePathMark(); + pathL->fV = posL; + track->AddPathMark(*pathL); + } + + LOG(debug4) << "Path marker added " << path; + } +#if TOFDisplay == 1 + if (iOpt >= 0) { fPSList->AddElement(psa); } +#endif + track->SortPathMarksByTime(); + fTrList->AddElement(track); + LOG(debug3) << i << ". track added: " << track->GetName(); + } + for (Int_t i = 0; i < fEveTrList->GetEntriesFast(); i++) { + // TEveTrackList *TrListIn=( TEveTrackList *) fEveTrList->At(i); + //TrListIn->FindMomentumLimits(TrListIn, kFALSE); + } + + //fEventManager->SetEvtMaxEnergy(MaxEnergyLimit); + //fEventManager->SetEvtMinEnergy(MinEnergyLimit); + TString cEventInfo; + if (NULL == fTsManager) cEventInfo = Form("ev# %d ", fEventManager->GetCurrentEvent()); + else + cEventInfo = Form("ev# %d ", fTsManager->GetCurrentEvent()); + + TString cTrackInfo = "TrklMul: "; // to be completed while building the display + for (Int_t i = 9; i > 0; i--) + if (TMul[i] > 0) cTrackInfo += Form("M%d %d/", i, TMul[i]); + + TGLViewer* v = gEve->GetDefaultGLViewer(); + /* + if (NULL != anne) anne->SetText(cEventInfo); + else + anne = new TGLAnnotation(v, cEventInfo, 0.01, 0.95); + */ + if (NULL != annt) annt->SetText(cTrackInfo); + else + annt = new TGLAnnotation(v, cTrackInfo, 0.01, 0.78); + //anne->SetTextSize(0.03); // % of window diagonal + //anne->SetTextColor(4); + annt->SetTextSize(0.03); // % of window diagonal + annt->SetTextColor(4); + + gEve->Redraw3D(kFALSE); + //gEve->DoRedraw3D(); + //gEve->Redraw3D(kTRUE); + } +} +// ----- Destructor ---------------------------------------------------- +CbmTsDisTracks::~CbmTsDisTracks() {} +// ------------------------------------------------------------------------- +void CbmTsDisTracks::SetParContainers() {} + +// ------------------------------------------------------------------------- +void CbmTsDisTracks::Finish() {} +// ------------------------------------------------------------------------- +void CbmTsDisTracks::Reset() +{ + for (Int_t i = 0; i < fEveTrList->GetEntriesFast(); i++) { + TEveTrackList* ele = (TEveTrackList*) fEveTrList->At(i); + //gEve->RemoveElement(ele, fEventManager); + LOG(debug3) << GetName() << ": remove Tr elements from " << ele->GetName(); + ele->Clear(); + gEve->RemoveElement(ele, fTsManager); + } + fEveTrList->Clear(); +#if TOFDisplay == 1 + for (Int_t i = 0; i < fEvePSList->GetEntriesFast(); i++) { + TEveElementList* ele = (TEveElementList*) fEvePSList->At(i); + //gEve->RemoveElement(ele, fEventManager); + LOG(debug3) << GetName() << ": remove PS elements from " << ele->GetName(); + ele->Clear(); + gEve->RemoveElement(ele, fTsManager); + } + fEvePSList->Clear(); +#endif +} + +Char_t* gs; +TEveTrackList* CbmTsDisTracks::GetTrGroup(Int_t ihmul, Int_t iOpt) +{ + switch (iOpt) { + case 0: gs = Form("Trkl_hmul%d", ihmul); break; + case 1: gs = Form("FTrkl_hmul%d", ihmul); break; + } + fTrList = 0; + for (Int_t i = 0; i < fEveTrList->GetEntriesFast(); i++) { + TEveTrackList* TrListIn = (TEveTrackList*) fEveTrList->At(i); + if (strcmp(TrListIn->GetName(), gs) == 0) { + fTrList = TrListIn; + break; + } + } + if (fTrList == 0) { + fTrPr = new TEveTrackPropagator(); + fTrList = new TEveTrackList(gs, fTrPr); + Int_t iCol = ihmul; + if (iCol > 4) iCol++; + fTrList->SetMainColor(iCol); + fEveTrList->Add(fTrList); +#if TOFDisplay == 1 + if (iOpt == 1) { // delete if-condition to return to old code + //gEve->AddElement(fTrList, fEventManager); + gEve->AddElement(fTrList, fTsManager); + } +#else + //gEve->AddElement(fTrList, fEventManager); + gEve->AddElement(fTrList, fTsManager); +#endif + fTrList->SetRecurse(kTRUE); + switch (iOpt) { + case 0: // display points + fTrList->SetRnrPoints(kTRUE); + fTrList->SetRnrLine(kFALSE); + fTrList->SetMarkerSize(2.); + fTrList->SetRnrChildren(fRenderP); // default not shown + break; + case 1: //display fit line + fTrList->SetRnrLine(kTRUE); + fTrList->SetLineWidth(2.); + fTrList->SetRnrChildren(fRenderT); // default not shown + break; + default:; + } + } + return fTrList; +} +#if TOFDisplay == 1 +TEveElementList* CbmTsDisTracks::GetPSGroup(Int_t ihmul, Int_t iOpt) +{ + if (iOpt == 0) gs = Form("PTrkl_hmul%d", ihmul); + else + gs = Form("FTrkl_hmul%d", ihmul); + fPSList = 0; + for (Int_t i = 0; i < fEvePSList->GetEntriesFast(); i++) { + TEveElementList* l = (TEveElementList*) fEvePSList->At(i); + if (strcmp(l->GetName(), gs) == 0) { + fPSList = l; + break; + } + } + if (fPSList == 0) { + fPSList = new TEveElementList(gs); + Int_t iCol = ihmul; + if (iCol > 4) iCol++; + fPSList->SetMainColor(iCol); + fEvePSList->Add(fPSList); + //gEve->AddElement(fPSList, fEventManager); + gEve->AddElement(fPSList, fTsManager); + fPSList->SetRnrChildren(fRenderP); + } + return fPSList; +} +#endif + +ClassImp(CbmTsDisTracks) diff --git a/core/eventdisplay/CbmTsDisTracks.h b/core/eventdisplay/CbmTsDisTracks.h new file mode 100644 index 0000000000000000000000000000000000000000..ac1f6f74d97df87aeea077c209416637e0302c47 --- /dev/null +++ b/core/eventdisplay/CbmTsDisTracks.h @@ -0,0 +1,100 @@ +/* Copyright (C) 2015-2020 PI-UHd, GSI + SPDX-License-Identifier: GPL-3.0-only + Authors: Mohammad Al-Turany, Norbert Herrmann [committer], Florian Uhlig */ + +// ------------------------------------------------------------------------- +// ----- FairMCTracks header file ----- +// ----- Created 10/12/07 by M. Al-Turany ----- +// ------------------------------------------------------------------------- + + +/** from FairMCTracks + * @author M. Al-Turany + * @since 10.12.07 + * MVD event display object + ** + **/ +#define TOFDisplay 1 // =1 means active, other: without Label and not relying on TEvePointSet + +#ifndef CBMTSDISTRACKS_H +#define CBMTSDISTRACKS_H + +#include <CbmTimesliceManager.h> // IWYU pragma: keep needed by cling + +#include <FairTask.h> // for FairTask, InitStatus + +#include <Rtypes.h> // for THashConsistencyHolder, ClassDef +#include <RtypesCore.h> // for Bool_t, Int_t, Double_t, kFALSE, kTRUE, Opti... +#include <TEveTrackPropagator.h> // IWYU pragma: keep needed by cling +#include <TString.h> // for TString + +class TClonesArray; +class TEveElementList; +class TEveTrackList; +class TObjArray; + +class CbmTsDisTracks : public FairTask { + +public: + /** Default constructor **/ + CbmTsDisTracks(); + + + /** Standard constructor + *@param name Name of task + *@param iVerbose Verbosity level + **/ + CbmTsDisTracks(const char* name, Int_t iVerbose = 1, Bool_t renderP = kFALSE, Bool_t renderT = kTRUE); + + /** Destructor **/ + virtual ~CbmTsDisTracks(); + + inline static CbmTsDisTracks* Instance() { return fInstance; } + + /** Set verbosity level. For this task and all of the subtasks. **/ + void SetVerbose(Int_t iVerbose) { fVerbose = iVerbose; } + void SetRenderP(Bool_t render) { fRenderP = render; } + void SetRenderT(Bool_t render) { fRenderT = render; } + /** Executed task **/ + virtual void Exec(Option_t* option); + virtual InitStatus Init(); + virtual void SetParContainers(); + + /** Action after each event**/ + virtual void Finish(); + void GotoEvent(uint32_t uEventIdx); + void Reset(); + TEveTrackList* GetTrGroup(Int_t ihmul, Int_t iOpt); +#if TOFDisplay == 1 //List for TEvePointSets + TEveElementList* GetPSGroup(Int_t ihuml, Int_t iOpt); +#endif + +protected: + TClonesArray* fCbmEvents = nullptr; //! + TClonesArray* fTrackList = nullptr; //! + TEveTrackPropagator* fTrPr = nullptr; //! + CbmTimesliceManager* fTimesliceManager = nullptr; //! + TObjArray* fEveTrList = nullptr; //! + TString fEvent; //! + TEveTrackList* fTrList = nullptr; //! + TObjArray* fEvePSList = nullptr; //! + TEveElementList* fPSList = nullptr; //! + //TEveElementList *fTrackCont; + + Bool_t fRenderP; + Bool_t fRenderT; + Double_t MinEnergyLimit; + Double_t MaxEnergyLimit; + Double_t PEnergy; + uint32_t fEventIdx = 0; //! + +private: + static CbmTsDisTracks* fInstance; + CbmTsDisTracks(const CbmTsDisTracks&); + CbmTsDisTracks& operator=(const CbmTsDisTracks&); + + ClassDef(CbmTsDisTracks, 1); +}; + + +#endif diff --git a/core/eventdisplay/CbmTsPointSetArrayDraw.cxx b/core/eventdisplay/CbmTsPointSetArrayDraw.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0040c34838adce53d5196e985d7a641a7c63650a --- /dev/null +++ b/core/eventdisplay/CbmTsPointSetArrayDraw.cxx @@ -0,0 +1,245 @@ +/* Copyright (C) 2019-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: J. Brandt, Florian Uhlig [committer] */ + +// ------------------------------------------------------------------------- +// ----- CbmTsPointSetArrayDraw source file ----- +// ----- Created 18/06/22 by J. Brandt ----- +// ----- Following class FairPointSetDraw ----- +// ------------------------------------------------------------------------- +#include "CbmTsPointSetArrayDraw.h" + +#include "CbmEvent.h" // for CbmEvent +#include "CbmPixelHit.h" // for CbmPixelHit +#include "CbmPointSetArray.h" // for CbmPointSetArray +#include "CbmTofHit.h" // for CbmTofHit +#include <CbmTimesliceManager.h> // for CbmTimesliceManager + +#include <FairRootManager.h> // for FairRootManager +#include <FairTask.h> // for FairTask, InitStatus, kSUCCESS +#include <Logger.h> // for LOG, Logger + +#include <Rtypes.h> // for kRed, ClassImp +#include <TClonesArray.h> // for TClonesArray +#include <TEveManager.h> // for TEveManager, gEve +#include <TEveTreeTools.h> // for TEvePointSelectorConsumer, TEvePointS... +#include <TGenericClassInfo.h> // for TGenericClassInfo +#include <TVector3.h> // for TVector3 + +#include <iomanip> // for operator<<, setprecision + +// ----- Default constructor ------------------------------------------- +CbmTsPointSetArrayDraw::CbmTsPointSetArrayDraw() + : FairTask("CbmTsPointSetArrayDraw", 0) + , fVerbose(0) + , fPointList(nullptr) + , fTsManager(nullptr) + , fl(nullptr) + , fColor(0) + , fStyle(0) + , fTimeOffset(0) + , fTimeMax(0) + , fColorMode(1) + , fMarkerMode(1) + , fRender(kTRUE) +{ +} +// ------------------------------------------------------------------------- + + +// ----- Standard constructor ------------------------------------------ +CbmTsPointSetArrayDraw::CbmTsPointSetArrayDraw(const char* name, Int_t colorMode, Int_t markerMode, Int_t iVerbose, + Bool_t render) + : FairTask(name, iVerbose) + , fVerbose(iVerbose) + , fPointList(nullptr) + , fTsManager(nullptr) + , fl(nullptr) + , fColor(kRed) + , fStyle(4) + , fTimeOffset(0) + , fTimeMax(0) + , fColorMode(colorMode) + , fMarkerMode(markerMode) + , fRender(render) +{ +} + +static TString cTofHit = "TofUHit"; +// ------------------------------------------------------------------------- +InitStatus CbmTsPointSetArrayDraw::Init() +{ + LOG(debug) << "CbmTsPointSetArrayDraw::Init() for " << cTofHit; + FairRootManager* fManager = FairRootManager::Instance(); + fCbmEvents = dynamic_cast<TClonesArray*>(fManager->GetObject("CbmEvent")); + fTsPointList = static_cast<TClonesArray*>(fManager->GetObject(cTofHit.Data())); + if (fTsPointList == NULL) { + LOG(warn) << "CbmTsPointSetArrayDraw::Init() branch " << cTofHit.Data() << " not found! Task will be deactivated "; + SetActive(kFALSE); + } + //LOG(info) << "CbmTsPointSetArrayDraw::Init() get track list" << fTsPointList->GetName(); + fPointList = new TClonesArray("CbmTofHit", 100); // allocate memory + fTsManager = CbmTimesliceManager::Instance(); + LOG(debug1) << "CbmTsPointSetArrayDraw::Init() get instance of CbmTimesliceManager "; + fl = 0; + + return kSUCCESS; +} +// ------------------------------------------------------------------------- +void CbmTsPointSetArrayDraw::Exec(Option_t* /*option*/) +{ + if (0 < fCbmEvents->GetEntriesFast()) { + /// When loading a new TS, load the first event if possible + GotoEvent(0); + } +} + +void CbmTsPointSetArrayDraw::GotoEvent(uint32_t uEventIdx) +{ + if (IsActive()) { + + if (CbmTimesliceManager::Instance()->GetClearHandler()) { // + Reset(); + } + + CbmEvent* event = dynamic_cast<CbmEvent*>(fCbmEvents->At(uEventIdx)); + if (NULL == fTsPointList) { + fTsPointList = static_cast<TClonesArray*>(FairRootManager::Instance()->GetObject(cTofHit.Data())); + if (NULL == fTsPointList) { + LOG(warn) << " No " << cTofHit.Data(); + return; + } + } + if (NULL != fPointList) fPointList->Clear(); + int nofPoints = fTsPointList->GetEntriesFast(); + int nPoints = 0; + LOG(debug3) << " Fill TofUhit from " << nofPoints << " hits in Ts."; + for (Int_t iP = 0; iP < event->GetNofData(ECbmDataType::kTofUHit); ++iP) { + Int_t iPId = event->GetIndex(ECbmDataType::kTofUHit, iP); // make this generic!! + CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTsPointList->At(iPId)); + LOG(debug3) << "Add Hit " << iP << ", " << iPId << ", " << tHit << " at " << nPoints; + if (NULL != tHit && iPId > -1) new ((*fPointList)[nPoints++]) CbmTofHit(*tHit); + } + nPoints = fPointList->GetEntriesFast(); + + //Reset(); + + // initialize CbmPointSetArray to display set of hits + CbmPointSetArray* l = new CbmPointSetArray("TofUHit", ""); + l->SetColorMode(fColorMode); + l->SetMarkerMode(fMarkerMode); + l->SetSourceCS(TEvePointSelectorConsumer::kTVT_XYZ); + l->SetMarkerColor(kRed); + l->SetMarkerStyle(22); + l->SetMarkerSize(2.0); + + DetermineTimeOffset(); + l->InitBins("Hits", nPoints, 0.5, nPoints + 0.5); + l->InitValues(nPoints); + + for (Int_t i = 1; i <= nPoints; i++) { //loop over all hits in event + TObject* p = static_cast<TObject*>(fPointList->At(i - 1)); + if (p != 0) { + TVector3 vec(GetVector(p)); + l->Fill(vec.X(), vec.Y(), vec.Z(), i); // fill 3D position + l->FillValues(GetPointId(p), GetTime(p), GetTot(p), GetClusterSize(p), + i); // fill physical information used for color and markersize + } + } + + //l->ApplyColorMode(); // apply colorMode and calculate color of each bin + //l->ApplyMarkerMode(); // apply markerMode and calculate markersize of each bin + //l->ApplyTitles(); // set BBox-title of each bin and computeBBox + + l->SetRnrChildren(fRender); + gEve->AddElement(l); + gEve->Redraw3D(kFALSE); + fl = l; + } +} +// -------------------------------------------------------------------------------- +// returns 3D-vector with position data of hit +TVector3 CbmTsPointSetArrayDraw::GetVector(TObject* obj) +{ + CbmPixelHit* p = (CbmPixelHit*) obj; + LOG(debug2) << "-I- CbmTsPointSetArrayDraw::GetVector(): " << p->GetX() << " " << p->GetY() << " " << p->GetZ() + << " "; + return TVector3(p->GetX(), p->GetY(), p->GetZ()); +} +// -------------------------------------------------------------------------------- +// returns hit-time against first hit +Double_t CbmTsPointSetArrayDraw::GetTime(TObject* obj) +{ + CbmPixelHit* p = (CbmPixelHit*) obj; + LOG(debug2) << "-I- CbmTsPointSetArrayDraw::GetTime(): " << p->GetTime() - fTimeOffset; + return p->GetTime() - fTimeOffset; +} +// -------------------------------------------------------------------------------- +// returns ClusterSize of Hit +Int_t CbmTsPointSetArrayDraw::GetClusterSize(TObject* obj) +{ + //CluSize of TofHit is stored in Flag-Variable (set in Clusterizer) + CbmTofHit* p = (CbmTofHit*) obj; + Double_t cluSize = p->GetFlag(); + //Flag= #digis = 2*cluSize +100 if used for track + cluSize = ((int) cluSize % 100) / 2; + LOG(debug3) << "-I- CbmTsPointSetArrayDraw::GetClusterSize(): " << cluSize; + return cluSize; +} +// -------------------------------------------------------------------------------- +// returns ToT of hit +Double_t CbmTsPointSetArrayDraw::GetTot(TObject* obj) +{ + // ToT of TofHit is stored in Channel-Variable (set in Clusterizer) + CbmTofHit* p = (CbmTofHit*) obj; + Double_t tot = Double_t(p->GetCh()) / (20 * GetClusterSize(p)); + LOG(debug3) << "-I- CbmTsPointSetArrayDraw::GetTot(): " << tot; + return tot; +} +// -------------------------------------------------------------------------------- +// returns Id of hit +Int_t CbmTsPointSetArrayDraw::GetPointId(TObject* obj) +{ + CbmPixelHit* p = (CbmPixelHit*) obj; + return p->GetRefId(); +} +// --------------------------------------------------------------------------------- +// Determine time of first hit in event to use as offset +void CbmTsPointSetArrayDraw::DetermineTimeOffset() +{ + Int_t nPoints = fPointList->GetEntriesFast(); + fTimeOffset = 115200000000000; //32hours in ns as maximum of clock + fTimeMax = 0; + Double_t currtime; + CbmPixelHit* hit; + for (Int_t i = 0; i < nPoints; i++) { //loop over all hits in event + hit = static_cast<CbmPixelHit*>(fPointList->At(i)); + currtime = hit->GetTime(); + if (currtime < fTimeOffset) { fTimeOffset = currtime; } + else if (currtime > fTimeMax) { + fTimeMax = currtime; + } + } + fTimeMax -= fTimeOffset; //time of latest hit in event + LOG(debug3) << std::setprecision(15) << "-I- CbmTsPointSetArrayDraw::DetermineTimeBins: fTimeOffset " << fTimeOffset; +} + +// ----- Destructor ---------------------------------------------------- +CbmTsPointSetArrayDraw::~CbmTsPointSetArrayDraw() {} +// ------------------------------------------------------------------------- +void CbmTsPointSetArrayDraw::SetParContainers() {} +// ------------------------------------------------------------------------- +/** Action after each event**/ +void CbmTsPointSetArrayDraw::Finish() {} +// ------------------------------------------------------------------------- +void CbmTsPointSetArrayDraw::Reset() +{ + if (fl != 0) { + LOG(debug3) << GetName() << ": Remove Element " << fl->GetName() << ", Man " << fTsManager->GetName(); + //fl->RemoveElementsLocal(); + gEve->RemoveElement(fl, fTsManager); + } +} + + +ClassImp(CbmTsPointSetArrayDraw); diff --git a/core/eventdisplay/CbmTsPointSetArrayDraw.h b/core/eventdisplay/CbmTsPointSetArrayDraw.h new file mode 100644 index 0000000000000000000000000000000000000000..7421e730e34e03dcd9f92c68ec88457f37ebacf1 --- /dev/null +++ b/core/eventdisplay/CbmTsPointSetArrayDraw.h @@ -0,0 +1,106 @@ +/* Copyright (C) 2019-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: J. Brandt, Florian Uhlig [committer] */ + +// ------------------------------------------------------------------------- +// ----- CbmPointSetArrayDraw header file ----- +// ----- Created 18/06/22 by J. Brandt ----- +// ----- Following class FairPointSetDraw ----- +// ------------------------------------------------------------------------- + + +/** CbmPointSetArrayDraw + * @author J. Brandt + * @since 22.06.18 + * Task to display pointsets in array + ** + **/ + +#ifndef CBMTSPOINTSETARRAYDRAW_H +#define CBMTSPOINTSETARRAYDRAW_H + +#include <FairTask.h> // for FairTask, InitStatus + +#include <Rtypes.h> // for THashConsistencyHolder, ClassDef +#include <RtypesCore.h> // for Int_t, Double_t, Bool_t, kTRUE, Color_t, Opt... + +class CbmPointSetArray; +class CbmTimesliceManager; +class TClonesArray; +class TObject; +class TVector3; + +class CbmTsPointSetArrayDraw : public FairTask { + +public: + /** Default constructor **/ + CbmTsPointSetArrayDraw(); + + + /** Standard constructor + *@param name Name of task + *@param colorMode coloring of points + *@param markerMode how to mark points + *@param iVerbose Verbosity level + **/ + CbmTsPointSetArrayDraw(const char* name, Int_t colorMode, Int_t markerMode, Int_t iVerbose = 1, + Bool_t render = kTRUE); + + /** Destructor **/ + virtual ~CbmTsPointSetArrayDraw(); + + // Setters + /** Set verbosity level. For this task and all of the subtasks. **/ + void SetVerbose(Int_t iVerbose) { fVerbose = iVerbose; } + void SetColorMode(Int_t colorMode) { fColorMode = colorMode; } + void SetMarkerMode(Int_t markerMode) { fMarkerMode = markerMode; } + void SetRender(Bool_t render) { fRender = render; } + // Accessors + Int_t GetColorMode() const { return fColorMode; } + Int_t GetMarkerMode() const { return fMarkerMode; } + + /** Executed task **/ + virtual void Exec(Option_t* option); + /** Reset task **/ + void Reset(); + void GotoEvent(uint32_t uEventIdx); + +protected: + TVector3 GetVector(TObject* obj); //Get 3D Vector of Hit + Double_t GetTime(TObject* obj); //Get Time of Hit + Int_t GetClusterSize(TObject* obj); //Get ClusterSize of TofHit + Double_t GetTot(TObject* obj); //Get ToT of TofHit + Int_t GetPointId(TObject* obj); //Get RefId of Hit + + void DetermineTimeOffset(); //Determine TimeOffset and time of latest hit + + virtual void SetParContainers(); + /** Initialise taks **/ + virtual InitStatus Init(); + /** Action after each event **/ + virtual void Finish(); + + Int_t fVerbose; //Verbosity level + TClonesArray* fCbmEvents = nullptr; //! + TClonesArray* fTsPointList; //Array containing list of hits + TClonesArray* fPointList; //Array containing list of hits + CbmTimesliceManager* fTsManager; //Pointer to Event Manager + CbmPointSetArray* + fl; //Pointer to CbmPointSetArray -> Cbm class for displaying array of Hit-sets -> TEvePointSetArray + Color_t fColor; //Color of Hit-Markers + Style_t fStyle; //Style of Hit-Markers + Double_t fTimeOffset; //Time Offset on Hits to scale first hit to 0 + Double_t fTimeMax; //Max Time of Hits in TofHit + Int_t fColorMode; //Int determining how points get color-coded + Int_t fMarkerMode; //Int determining how marker-size of points gets coded + Bool_t fRender; //Boolean whether points shown on default + +private: + CbmTsPointSetArrayDraw(const CbmTsPointSetArrayDraw&); + CbmTsPointSetArrayDraw& operator=(const CbmTsPointSetArrayDraw&); + + ClassDef(CbmTsPointSetArrayDraw, 1); +}; + + +#endif diff --git a/macro/beamtime/mcbm2022/mcbm_digievent_display.C b/macro/beamtime/mcbm2022/mcbm_digievent_display.C new file mode 100644 index 0000000000000000000000000000000000000000..d7c0ada5e182a0fcd90d7476084924e70815ac76 --- /dev/null +++ b/macro/beamtime/mcbm2022/mcbm_digievent_display.C @@ -0,0 +1,1366 @@ +/* Copyright (C) 2023 Facility for Antiproton and Ion Research in Europe, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Norbert Herrmann [committer] */ + +// -------------------------------------------------------------------------- +// +// Macro for reconstruction of mcbm data (2022) +// Combined reconstruction (cluster + hit finder) for different subsystems. +// +// -------------------------------------------------------------------------- + +#include <math.h> +#include <stdio.h> +#include <string.h> + +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t mcbm_digievent_display(UInt_t uRunId = 2391, + Int_t nTimeslices = 10, + Int_t iFirstTimeslice = 0, + Int_t iACut = 0, + TString cFId = "4.0000", + TString sInpDir = "./data/", + TString sOutDir = "./rec/", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ + + // --- Logger settings ---------------------------------------------------- + TString logLevel = "info"; + TString logVerbosity = "low"; + // ------------------------------------------------------------------------ + + + // ----- Environment -------------------------------------------------- + TString myName = "mcbm_digievent_display"; // this macro's name for screen output + TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory + // ------------------------------------------------------------------------ + + + // ----- In- and output file names ------------------------------------ + /// Standardized RUN ID + TString sRunId = TString::Format("%04u", uRunId); + /// Organize output into subdirectories + sOutDir = sOutDir + sRunId + "/"; + + /// Initial pattern + TString cFileId = sRunId + "." + cFId; + TString inFile = sInpDir + "/" + cFileId + ".digievents"; + + Int_t parSetHadAna = iACut; + //TString parFileIn = sInpDir + "/unp_mcbm_params_" + sRunId; + TString cAnaOpt = Form("_%d_%d_%s_A%d", iFirstTimeslice, nTimeslices, cFId.Data(), parSetHadAna); + TString parFileOut = sOutDir + "display_event_mcbm_params_" + sRunId + cAnaOpt; + TString outFile = sOutDir + "display_event_mcbm_" + sRunId + cAnaOpt; + TString cHstFile = sOutDir + "display_digievent_" + cFileId + cAnaOpt + ".hst.root"; + + // Your folder with the Tof Calibration files; + TString TofFileFolder = srcDir + "/macro/beamtime/mcbm2022/"; + + /// Add index of splitting at unpacking level if needed + if (false && 0 <= iUnpFileIndex) { + inFile += TString::Format("_%02u", iUnpFileIndex); + // the input par file is not split during unpacking! + parFileOut += TString::Format("_%02u", iUnpFileIndex); + outFile += TString::Format("_%02u", iUnpFileIndex); + } // if ( 0 <= uUnpFileIndex ) + /// Add ROOT file suffix + // inFile += ".root"; + // parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; + // ------------------------------------------------------------------------------ + // TString cFileName=cFileId + ".digievents.root"; + //gSystem->Exec(Form("./LocalCopy.sh %s %s", sInpDir.Data(), cFileName.Data() )); + //inFile="/tmp/" + cFileName; + // ------------------------------------------------------------------------------ + + // ----- TOF Calibration Settings --------------------------------------- + TString cCalId = "490.100.5.0"; + if (uRunId >= 759) cCalId = "759.100.4.0"; + if (uRunId >= 812) cCalId = "831.100.4.0"; + if (uRunId >= 1588) cCalId = "1588.50.6.0"; + if (uRunId >= 2160) cCalId = "2160.50.4.0"; + if (uRunId >= 2352) cCalId = "2365.5.lxbk0600"; + if (uRunId >= 2389) cCalId = "2389.5.0000"; + if (uRunId >= 2390) cCalId = "2391.4.0000"; + //if (uRunId >= 2393) cCalId = "2393.5.0000"; + //if (uRunId >= 2400) cCalId = "2474.4.0000"; + if (uRunId >= 2400) cCalId = "2488.4.0000"; + if (uRunId >= 2500) cCalId = "2554.4.0000"; + + Int_t iCalSet = 22002500; // calibration settings + if (uRunId >= 759) iCalSet = 10020500; + if (uRunId >= 812) iCalSet = 10020500; + if (uRunId >= 1588) iCalSet = 12002002; + if (uRunId >= 2160) iCalSet = 700900500; + if (uRunId >= 2352) iCalSet = 22002500; + + Double_t Tint = 100.; // coincidence time interval + Int_t iTrackMode = 2; // 2 for TofTracker + const Int_t iTofCluMode = 1; + // ------------------------------------------------------------------------ + + // --- Load the geometry setup ---- + // This is currently only required by the TRD (parameters) + TString geoSetupTag = "mcbm_beam_2021_07_surveyed"; + if (2060 <= uRunId) { + /// Setup changed multiple times between the 2022 carbon and uranium runs + if (uRunId <= 2065) { + /// Carbon runs: 2060 - 2065 = 10/03/2022 + geoSetupTag = "mcbm_beam_2022_03_09_carbon"; + } + else if (2150 <= uRunId && uRunId <= 2160) { + /// Iron runs: 2150 - 2160 = 24-25/03/2022 + geoSetupTag = "mcbm_beam_2022_03_22_iron"; + } + else if (2176 <= uRunId && uRunId <= 2310) { + /// Uranium runs: 2176 - 2310 = 30/03/2022 - 01/04/2022 + geoSetupTag = "mcbm_beam_2022_03_28_uranium"; + } + else if (2352 <= uRunId && uRunId < 2400) { + /// Uranium runs: 2176 - 2310 = 30/03/2022 - 01/04/2022 + ///geoSetupTag = "mcbm_beam_2022_05_20_nickel"; + geoSetupTag = "mcbm_beam_2022_05_23_nickel"; + } + else if (2400 <= uRunId) { + /// Uranium runs: 2176 - 2310 = 30/03/2022 - 01/04/2022 + geoSetupTag = "mcbm_beam_2022_06_16_gold"; + } + } + TString geoFile = srcDir + "/macro/mcbm/data/" + geoSetupTag + ".geo.root"; + CbmSetup* geoSetup = CbmSetup::Instance(); + geoSetup->LoadSetup(geoSetupTag); + + // You can modify the pre-defined setup by using + geoSetup->SetActive(ECbmModuleId::kMvd, kFALSE); + geoSetup->SetActive(ECbmModuleId::kSts, kTRUE); + geoSetup->SetActive(ECbmModuleId::kMuch, kFALSE); + geoSetup->SetActive(ECbmModuleId::kRich, kFALSE); + geoSetup->SetActive(ECbmModuleId::kTrd, kTRUE); + geoSetup->SetActive(ECbmModuleId::kTrd2d, kTRUE); + geoSetup->SetActive(ECbmModuleId::kTof, kTRUE); + geoSetup->SetActive(ECbmModuleId::kPsd, kFALSE); + + //----- Load Parameters -------------------------------------------------- + TList* parFileList = new TList(); + TofFileFolder = Form("%s/%s", TofFileFolder.Data(), cCalId.Data()); + + // ----- TRD digitisation parameters ------------------------------------- + TString geoTagTrd; + if (geoSetup->IsActive(ECbmModuleId::kTrd)) { + if (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) { + TString paramFilesTrd(Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); + std::vector<TString> paramFilesVecTrd = {"asic", "digi", "gas", "gain"}; + for (auto parIt : paramFilesVecTrd) { + parFileList->Add(new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.Data()))); + } + } + for (auto parFileVecIt : *parFileList) { + LOG(debug) << Form("TrdParams - %s - added to parameter file list\n", parFileVecIt->GetName()); + } + } + // ----- TOF digitisation parameters ------------------------------------- + TString geoTag; + if (geoSetup->IsActive(ECbmModuleId::kTof)) { + geoSetup->GetGeoTag(ECbmModuleId::kTof, geoTag); + 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; + + // TFile* fgeo = new TFile(geoFile); + // TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); + // if (NULL == geoMan) { + // cout << "<E> FAIRGeom not found in geoFile " << geoFile.Data() << endl; + // return 1; + // } + } + // ------------------------------------------------------------------------ + + // ----- Timer -------------------------------------------------------- + TStopwatch timer; + timer.Start(); + // ------------------------------------------------------------------------ + + + // ----- FairRunAna --------------------------------------------------- + FairRunAna* run = new FairRunAna(); + FairFileSource* inputSource; + if (iUnpFileIndex == -1) { inputSource = new FairFileSource(inFile + ".root"); } + else { + inputSource = new FairFileSource(inFile + "-0.root"); + for (int i = 1; i < iUnpFileIndex; i++) { + //inputSource ->Add(inFile+Form("-%d.root",i)); //wrong syntax + } + } + run->SetSource(inputSource); + + FairRootFileSink* outputSink = new FairRootFileSink(outFile); + run->SetSink(outputSink); + run->SetGeomFile(geoFile); + + // Define output file for FairMonitor histograms + TString monitorFile {outFile}; + monitorFile.ReplaceAll("dis", "dis.monitor"); + FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); + // ------------------------------------------------------------------------ + + + // ----- Logger settings ---------------------------------------------- + FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); + FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); + //FairLogger::GetLogger()->SetLogScreenLevel("DEBUG"); + // ------------------------------------------------------------------------ + + + // ========================================================================= + // === Alignment Correction === + // ========================================================================= + // (Fairsoft Apr21p2 or newer is needed) + + + TString alignmentMatrixFileName = "AlignmentMatrices_" + geoSetupTag + ".root"; + if (alignmentMatrixFileName.Length() != 0) { + std::cout << "-I- " << myName << ": Applying alignment for file " << alignmentMatrixFileName << std::endl; + + // Define the basic structure which needs to be filled with information + // This structure is stored in the output file and later passed to the + // FairRoot framework to do the (miss)alignment + std::map<std::string, TGeoHMatrix>* matrices {nullptr}; + + // read matrices from disk + LOG(info) << "Filename: " << alignmentMatrixFileName; + TFile* misalignmentMatrixRootfile = new TFile(alignmentMatrixFileName, "READ"); + if (misalignmentMatrixRootfile->IsOpen()) { + gDirectory->GetObject("MisalignMatrices", matrices); + misalignmentMatrixRootfile->Close(); + } + else { + LOG(error) << "Could not open file " << alignmentMatrixFileName << "\n Exiting"; + exit(1); + } + + if (matrices) { run->AddAlignmentMatrices(*matrices); } + else { + LOG(error) << "Alignment required but no matrices found." + << "\n Exiting"; + exit(1); + } + } + // ------------------------------------------------------------------------ + + // ---- Make Reco Events ---------------------------------------------- + // ---- This is required if the input is in DigiEvent format + auto makeEvents = std::make_unique<CbmTaskMakeRecoEvents>(); + makeEvents->SetOutputBranchPersistent("CbmEvent", false); + makeEvents->SetOutputBranchPersistent("EventHeader", false); + //LOG(info) << "-I- Adding task " << makeEvents->GetName(); + run->AddTask(makeEvents.release()); + // ------------------------------------------------------------------------ + + // ----- Reconstruction tasks ----------------------------------------- + + + // ========================================================================= + // === local STS Reconstruction === + // ========================================================================= + + if (geoSetup->IsActive(ECbmModuleId::kSts)) { + CbmRecoSts* recoSts = new CbmRecoSts(); + recoSts->SetEventMode(kTRUE); + recoSts->SetOutputBranchPersistent("StsCluster", false); + recoSts->SetOutputBranchPersistent("StsHit", false); + + recoSts->SetTimeCutDigisAbs(20.0); // cluster finder: time cut in ns + recoSts->SetTimeCutClustersAbs(20.0); // hit finder: time cut in ns + + // Sensor params + CbmStsParSensor sensor6cm(CbmStsSensorClass::kDssdStereo); + sensor6cm.SetPar(0, 6.2092); // Extension in x + sensor6cm.SetPar(1, 6.2); // Extension in y + sensor6cm.SetPar(2, 0.03); // Extension in z + sensor6cm.SetPar(3, 5.9692); // Active size in y + sensor6cm.SetPar(4, 1024.); // Number of strips front side + sensor6cm.SetPar(5, 1024.); // Number of strips back side + sensor6cm.SetPar(6, 0.0058); // Strip pitch front side + sensor6cm.SetPar(7, 0.0058); // Strip pitch back side + sensor6cm.SetPar(8, 0.0); // Stereo angle front side + sensor6cm.SetPar(9, 7.5); // Stereo angle back side + + CbmStsParSensor sensor12cm(sensor6cm); // copy all parameters, change then only the y size + sensor12cm.SetPar(1, 12.4); // Extension in y + sensor12cm.SetPar(3, 12.1692); // Active size in y + + // --- Addresses for sensors + // --- They are defined in each station as sensor 1, module 1, halfladderD (2), ladder 1 + // Int_t GetAddress(UInt_t unit = 0, UInt_t ladder = 0, UInt_t halfladder = 0, UInt_t module = 0, UInt_t sensor = 0, + // UInt_t side = 0, UInt_t version = kCurrentVersion); + + Int_t stsAddress01 = CbmStsAddress::GetAddress(0, 0, 1, 0, 0, 0); // U0 L0 M0 6 cm + Int_t stsAddress02 = CbmStsAddress::GetAddress(0, 0, 1, 1, 0, 0); // U0 L0 M1 6 cm + Int_t stsAddress03 = CbmStsAddress::GetAddress(0, 1, 1, 0, 0, 0); // U0 L1 M0 6 cm + Int_t stsAddress04 = CbmStsAddress::GetAddress(0, 1, 1, 1, 0, 0); // U0 L1 M1 6 cm + Int_t stsAddress05 = CbmStsAddress::GetAddress(1, 0, 1, 0, 0, 0); // U1 L0 M0 6 cm + Int_t stsAddress06 = CbmStsAddress::GetAddress(1, 0, 1, 1, 0, 0); // U1 L0 M1 12 cm + Int_t stsAddress07 = CbmStsAddress::GetAddress(1, 1, 1, 0, 0, 0); // U1 L1 M0 6 cm + Int_t stsAddress08 = CbmStsAddress::GetAddress(1, 1, 1, 1, 0, 0); // U1 L1 M1 12 cm + Int_t stsAddress09 = CbmStsAddress::GetAddress(1, 2, 1, 0, 0, 0); // U1 L2 M0 6 cm + Int_t stsAddress10 = CbmStsAddress::GetAddress(1, 2, 1, 1, 0, 0); // U1 L2 M1 6 cm + Int_t stsAddress11 = CbmStsAddress::GetAddress(1, 2, 1, 2, 0, 0); // U1 L2 M2 6 cm + + + std::cout << "STS address01 " << std::dec << stsAddress01 << " " << std::hex << stsAddress01 << std::endl; + std::cout << "STS address02 " << std::dec << stsAddress02 << " " << std::hex << stsAddress02 << std::endl; + std::cout << "STS address03 " << std::dec << stsAddress03 << " " << std::hex << stsAddress03 << std::endl; + std::cout << "STS address04 " << std::dec << stsAddress04 << " " << std::hex << stsAddress04 << std::endl; + std::cout << "STS address05 " << std::dec << stsAddress05 << " " << std::hex << stsAddress05 << std::endl; + std::cout << "STS address06 " << std::dec << stsAddress06 << " " << std::hex << stsAddress06 << std::endl; + std::cout << "STS address07 " << std::dec << stsAddress07 << " " << std::hex << stsAddress07 << std::endl; + std::cout << "STS address08 " << std::dec << stsAddress08 << " " << std::hex << stsAddress08 << std::endl; + std::cout << "STS address09 " << std::dec << stsAddress09 << " " << std::hex << stsAddress09 << std::endl; + std::cout << "STS address10 " << std::dec << stsAddress10 << " " << std::hex << stsAddress10 << std::endl; + std::cout << "STS address11 " << std::dec << stsAddress11 << " " << std::hex << stsAddress11 << std::endl; + + // --- Now we can define the sensor parameter set and tell recoSts to use it + auto sensorParSet = new CbmStsParSetSensor("CbmStsParSetSensor", "STS sensor parameters" + "mcbm2021"); + sensorParSet->SetParSensor(stsAddress01, sensor6cm); + sensorParSet->SetParSensor(stsAddress02, sensor6cm); + sensorParSet->SetParSensor(stsAddress03, sensor6cm); + sensorParSet->SetParSensor(stsAddress04, sensor6cm); + sensorParSet->SetParSensor(stsAddress05, sensor6cm); + sensorParSet->SetParSensor(stsAddress06, sensor12cm); + sensorParSet->SetParSensor(stsAddress07, sensor6cm); + sensorParSet->SetParSensor(stsAddress08, sensor12cm); + sensorParSet->SetParSensor(stsAddress09, sensor6cm); + sensorParSet->SetParSensor(stsAddress10, sensor6cm); + sensorParSet->SetParSensor(stsAddress11, sensor6cm); + + recoSts->UseSensorParSet(sensorParSet); + + // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, + // noise RMS, zero-threshold crossing rate + auto parAsic = new CbmStsParAsic(128, 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); + recoSts->UseModulePar(parMod); + + // Sensor conditions: full depletion voltage, bias voltage, temperature, + // coupling capacitance, inter-strip capacitance + auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); + recoSts->UseSensorCond(sensorCond); + + run->AddTask(recoSts); + std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; + // ------------------------------------------------------------------------ + } + + // ========================================================================= + // === local TRD Reconstruction === + // ========================================================================= + + CbmTrdClusterFinder* trdCluster; + if (geoSetup->IsActive(ECbmModuleId::kTrd)) { + Double_t triggerThreshold = 0.5e-6; // SIS100 + + trdCluster = new CbmTrdClusterFinder(); + trdCluster->SetNeighbourEnable(true, false); + trdCluster->SetMinimumChargeTH(triggerThreshold); + trdCluster->SetRowMerger(true); + trdCluster->SetOutputBranchPersistent("TrdCluster", false); + + run->AddTask(trdCluster); + std::cout << "-I- : Added task " << trdCluster->GetName() << std::endl; + + CbmTrdHitProducer* trdHit = new CbmTrdHitProducer(); + trdHit->SetOutputBranchPersistent("TrdHit", false); + run->AddTask(trdHit); + std::cout << "-I- : Added task " << trdHit->GetName() << std::endl; + } + + + // ========================================================================= + // === RICH Reconstruction === + // ========================================================================= + + if (geoSetup->IsActive(ECbmModuleId::kRich)) { + // ----- Local reconstruction of RICH Hits ------------------------------ + CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer(); + hitProd->SetMappingFile("mRICH_Mapping_vert_20190318_elView.geo"); + hitProd->setToTLimits(23.7, 30.0); + hitProd->applyToTCut(); + hitProd->applyICDCorrection(); + //run->AddTask(hitProd); + // ------------------------------------------------------------------------ + + + // ----- Local reconstruction in RICh -> Finding of Rings --------------- + CbmRichReconstruction* richReco = new CbmRichReconstruction(); + richReco->UseMCbmSetup(); + //run->AddTask(richReco); + // ------------------------------------------------------------------------ + } + + // ========================================================================= + // === TOF Hitfinding === + // ========================================================================= + + if (geoSetup->IsActive(ECbmModuleId::kTof)) { + TString cFname; + switch (iTofCluMode) { + case 1: { + // ----- TOF defaults ------------------------ + Int_t calMode = 93; + Int_t calSel = 1; + Int_t calSm = 2; + Int_t RefSel = 11; + Double_t dDeadtime = 50.; + Int_t iSel2 = -1; + Bool_t bOut = kFALSE; + + // ------------------------------------------------------------------------ + gROOT->LoadMacro("ini_Clusterizer.C"); + Char_t* cCmd = Form("ini_Clusterizer(%d,%d,%d,%d,\"%s\",%d,%d,%d,%f,\"%s\")", calMode, calSel, calSm, RefSel, + cFileId.Data(), iCalSet, (Int_t) bOut, iSel2, dDeadtime, cCalId.Data()); + cout << "<I> " << cCmd << endl; + gInterpreter->ProcessLine(cCmd); + // disable histogramming + CbmTofEventClusterizer* tofClust = CbmTofEventClusterizer::Instance(); + tofClust->SetOutputBranchPersistent("EventHeader", false); + tofClust->SetDutId(-1); // to disable histogramming + } break; + + default: { + ; + } + } + // ------------------------------------------------------------------------- + + // ========================================================================= + // === Tof Tracking === + // ========================================================================= + if (true) { + cout << "<I> Initialize Tof tracker by ini_trks" << endl; + TString cTrkFile = Form("%s/%s_tofFindTracks.hst.root", TofFileFolder.Data(), cCalId.Data()); + + // ----- Local selection variables -------------------------------------- + // Tracking + Int_t iSel = 22002; //500;//910041; + Int_t iTrackingSetup = 1; // 2 for checking without beam counter; + Int_t iGenCor = 1; + Double_t dScalFac = 2.5; + Double_t dChi2Lim2 = 4.; + Bool_t bUseSigCalib = kFALSE; + Int_t iCalOpt = 110; // 0=do not call CbmTofCalibrator + Int_t iTrkPar = 0; // 4 for check without beam counter + Double_t dTOffScal = 1.; + gROOT->LoadMacro("ini_trks.C"); + Char_t* cCmd = Form("ini_trks(%d,%d,%d,%6.2f,%8.1f,\"%s\",%d,%d,%d,%f)", iSel, iTrackingSetup, iGenCor, dScalFac, + dChi2Lim2, cCalId.Data(), (Int_t) bUseSigCalib, iCalOpt, iTrkPar, dTOffScal); + cout << "<I> " << cCmd << endl; + gInterpreter->ProcessLine(cCmd); + + CbmTofFindTracks* tofFindTracks = CbmTofFindTracks::Instance(); + Int_t iNStations = tofFindTracks->GetNStations(); + //tofFindTracks->SetMinNofHits(10000); // bypass tracker, get recalibrated hits + } + } + + // ========================================================================= + // === L1 === + // ========================================================================= + if (kTRUE) { + run->AddTask(new CbmTrackingDetectorInterfaceInit()); + + CbmKF* kalman = new CbmKF(); + run->AddTask(kalman); + CbmL1* l1 = new CbmL1(); + l1->SetMcbmMode(); + run->AddTask(l1); + + CbmL1GlobalTrackFinder* globalTrackFinder = new CbmL1GlobalTrackFinder(); + FairTask* globalFindTracks = new CbmL1GlobalFindTracksEvents(globalTrackFinder); + run->AddTask(globalFindTracks); + } + // ========================================================================= + // === QA === + // ========================================================================= + + // e.g for RICH: + CbmRichMCbmQaReal* qaTask = new CbmRichMCbmQaReal(); + Int_t taskId = 1; + if (taskId < 0) { qaTask->SetOutputDir(Form("result_run%d", uRunId)); } + else { + qaTask->SetOutputDir(Form("result_run%d_%05d", uRunId, taskId)); + } + //qaTask->XOffsetHistos(+25.0); + qaTask->XOffsetHistos(-4.1); + if (uRunId > 2351) qaTask->XOffsetHistos(0.0); + qaTask->SetMaxNofDrawnEvents(0); + qaTask->SetTotRich(23.7, 30.0); + //qaTask->SetTriggerRichHits(eb_TriggerMinNumberRich); + //qaTask->SetTriggerTofHits(eb_TriggerMinNumberTof); + //qaTask->SetSEDisplayRingOnly(); + //run->AddTask(qaTask); + // ------------------------------------------------------------------------ + // --- Analysis by TOF track extension + // + CbmTofExtendTracks* tofExtendTracks = new CbmTofExtendTracks("TofExtAna"); + tofExtendTracks->SetCalParFileName("TofExtTracksPar.root"); + tofExtendTracks->SetCalOutFileName("TofExtTracksOut.root"); + tofExtendTracks->SetStationUT(2); // + //iLev: 0 update alignment with deviation from original tracklet + //iLev: 1 update alignment with deviation from extended and refitted tracklet + tofExtendTracks->SetCorSrc(1); // [iLev]0 - all hits, [ilev]1 - pulls, + tofExtendTracks->SetCorMode(210); // 2 - Y coordinate, 1 - X coordinat, 0 Time offset + tofExtendTracks->SetTrkHitsMin(4); + tofExtendTracks->SetAddStations(1); + tofExtendTracks->SetReqStations(1); + tofExtendTracks->SetCutDX(10.); + tofExtendTracks->SetCutDY(10.); + tofExtendTracks->SetCutDT(50.); + tofExtendTracks->SetChi2Max(10.); + tofExtendTracks->SetCutStationMaxHitMul(100.); + tofExtendTracks->SetNTrkTofMax(50); + //run->AddTask(tofExtendTracks); + + // ------------------------------------------------------------------------ + // Hadron analysis, lambda search + // + CbmHadronAnalysis* HadronAna = new CbmHadronAnalysis(); // in hadron + HadronAna->SetBeamMomentum(2.7); // momentum in GeV/c for Ekin=19.3 AGeV + HadronAna->SetDY(0.5); // flow analysis exclusion window + HadronAna->SetRecSec(kTRUE); // enable lambda reconstruction + //HadronAna->SetAlignOnly(); // just fill algnment histos + //HadronAna->SetNHitMin(2); // request merged Tof hits + HadronAna->SetVelMin1(15.); // request minimum velocity for proton + HadronAna->SetVelMax1(27.); // request maximum velocity for proton + HadronAna->SetVelMin2(25.); // request minimum velocity for pion + HadronAna->SetVelMax2(29.5); // request maximum velocity for pion + HadronAna->SetCalibDt(0.); // systematic time shift with respect to calibration method in ns + if (uRunId < 2400) { // ni runs: 2391,2394,2395 + HadronAna->SetCalibDt( + 0.055); //-0.38 // systematic time shift with respect to calibration method in ns + HadronAna->SetTofHitMulMax(80.); // configures mixing + } + else { // Au runs + //HadronAna->SetCalibDt(-0.33); + HadronAna->SetTofHitMulMax(150.); + } + HadronAna->SetDistTRD(3.); // transvers matching distance to TRD hits + + switch (parSetHadAna) { + case 0: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 1: // signal only, debugging + HadronAna->SetDistPrimLim(0.5); // 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.2); // 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->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 2: // for calibration + HadronAna->SetDistPrimLim(1.5); // 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->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 3: // check case 0 + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.2); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 31: // check case 0 + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 32: // check case 0 + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 33: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(10.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(30.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 34: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.12); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 35: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 36: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetVelMax2(29.); // request maximum velocity for pion + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 37: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.09); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetVelMax2(29.); // request maximum velocity for pion + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 4: // with background + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(20.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 5: // with background + 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.15); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(20.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 6: // with background + 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.15); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(12.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 7: // with background + 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.15); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.3); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(12.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 8: // with background + 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.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.3); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(12.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 9: // with background + 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.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.02); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.3); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(12.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(16.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 10: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.5); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.8); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.001); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 11: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.5); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.7); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 12: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.6); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.8); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 13: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.5); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.8); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 14: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.5); // Max Sts-Sts trans distance for primaries + HadronAna->SetDistSecLim2(0.3); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.9); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.15); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(10); // Number of events to be mixed with + break; + case 15: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 16: // with background + HadronAna->SetDistPrimLim(1.0); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 17: // with background + HadronAna->SetDistPrimLim(1.0); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 18: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries & sec protons + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 19: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries & sec protons + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.48); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 20: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries & sec protons + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.52); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.1); // Min opening angle for accepting pair + HadronAna->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 100: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 101: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + HadronAna->SetVelMin1(15.); // request minimum velocity for proton + HadronAna->SetVelMax1(27.); // request maximum velocity for proton + HadronAna->SetVelMin2(26.); // request minimum velocity for pion + HadronAna->SetVelMax2(29.5); + break; + case 102: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + HadronAna->SetVelMin1(15.); // request minimum velocity for proton + HadronAna->SetVelMax1(27.); // request maximum velocity for proton + HadronAna->SetVelMin2(27.); // request minimum velocity for pion + HadronAna->SetVelMax2(29.5); + break; + case 103: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + HadronAna->SetVelMin1(15.); // request minimum velocity for proton + HadronAna->SetVelMax1(27.); // request maximum velocity for proton + HadronAna->SetVelMin2(27.); // request minimum velocity for pion + HadronAna->SetVelMax2(29.); + break; + case 104: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + HadronAna->SetVelMin1(15.); // request minimum velocity for proton + HadronAna->SetVelMax1(27.); // request maximum velocity for proton + HadronAna->SetVelMin2(24.); // request minimum velocity for pion + HadronAna->SetVelMax2(29.5); // request maximum velocity for pion + break; + case 105: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.5); // transvers matching distance to TRD hits + break; + case 110: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.4); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 111: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.6); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 120: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + HadronAna->SetMulPrimMin(2); // min number of primary candidates + break; + case 130: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetPoiAngMax(0.05); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 200: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.01); // Min opening angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(2); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 300: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(2.); // transvers matching distance to TRD hits + break; + case 301: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 302: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.52); // 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, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 303: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.05); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 304: // with background + HadronAna->SetDistPrimLim(0.8); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 305: // with background + HadronAna->SetDistPrimLim(0.7); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 306: // with background + HadronAna->SetDistPrimLim(0.9); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 307: // with background + HadronAna->SetDistPrimLim(1.0); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 308: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.04); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 309: // with background + HadronAna->SetDistPrimLim(1.0); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.02); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 310: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 311: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + HadronAna->SetVelMax1(28.); // request maximum velocity for proton + break; + case 312: // with background + HadronAna->SetDistPrimLim(1.1); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + HadronAna->SetVelMin1(14.); // request minimum velocity for proton + HadronAna->SetVelMax1(28.); // request maximum velocity for proton + break; + case 313: // with background + HadronAna->SetDistPrimLim(1.0); // Max Tof-Sts trans distance for primaries + HadronAna->SetDistPrimLim2(0.3); // Max Sts-Sts trans distance for primariesS + HadronAna->SetDistSecLim2(0.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.15); // Min opening angle for accepting pair + HadronAna->SetPoiAngMax(0.02); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(25.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + HadronAna->SetTRDHmulMin(1); // Number of matched TRD hits per track + HadronAna->SetDistTRD(1.7); // transvers matching distance to TRD hits + break; + case 400: + 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.2); // 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->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + case 401: + 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.2); // Max Sts-Sts trans distance from TOF direction for secondaries + HadronAna->SetD0ProtLim(0.5); // Min impact parameter for secondary proton + HadronAna->SetOpAngMin(0.15); // Min opening angle for accepting pair + HadronAna->SetPoiAngMax(0.03); // Max pointing angle for accepting pair + HadronAna->SetDCALim(0.1); // Max DCA for accepting pair, was 0.1 + HadronAna->SetVLenMin(5.); // Min Lambda flight path length for accepting pair + HadronAna->SetVLenMax(28.); // Max Lambda flight path length for accepting pair + HadronAna->SetNMixedEvents(20); // Number of events to be mixed with + break; + default: std::cout << "-I- " << myName << ": Analysis cuts not available! Stop here." << std::endl; return kFALSE; + } + + //run->AddTask(HadronAna); // causes crash due to global track vertex fit + + // ----- 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(); + FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); + FairParRootFileIo* parIo3 = new FairParRootFileIo(); + //parIo1->open(parFileIn.Data(), "READ"); + //rtdb->setFirstInput(parIo1); + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); + // ------------------------------------------------------------------------ + rtdb->setOutput(parIo3); + rtdb->saveOutput(); + rtdb->print(); + + // ----- Event display ---------------------------------------------------------------------------------------- // + std::string sXmlGeoConfig = "evt_disp_conf_mcbm_beam_2022_05_23_nickel.xml"; + + CbmTimesliceManager* fMan = new CbmTimesliceManager(); + fMan->SetXMLConfig(sXmlGeoConfig); + fMan->SetDisplayMcbm(); + // ---------------------------------------------------------------------------------------------------------------- // + /* + CbmEvDisTracks* Tracks = new CbmEvDisTracks("TofTracks", 1, kFALSE, + kTRUE); //name, verbosity, RnrChildren points, RnrChildren track + fMan->AddTask(Tracks); + CbmPixelHitSetDraw* TofUHits = new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); + fMan->AddTask(TofUHits); + + CbmPointSetArrayDraw* TofHits = + new CbmPointSetArrayDraw("TofHit", 1, 1, 1, kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren + // CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare); + fMan->AddTask(TofHits); + + CbmPixelHitSetDraw* StsHits = new CbmPixelHitSetDraw("StsHit", kCyan, kOpenSquare); + fMan->AddTask(StsHits); + */ + /* + CbmPixelHitSetDraw* TrdHits = new CbmPixelHitSetDraw("TrdHit", kYellow, kOpenSquare); + fMan->AddTask(TrdHits); + + CbmPixelHitSetDraw* RichHits = new CbmPixelHitSetDraw("RichHit", kGreen, kOpenSquare); + fMan->AddTask(RichHits); + */ + fMan->Init(1, 7); // Make all sensors visible, finer tuning needs to be done in XML file + // fMan->Init(1, 4); + // fMan->Init(1, 5); //make TPF and TRD visible by default + // fMan->Init(1, 6); // make STS sensors visible by default + // fMan->Init(1, 7); // make RICH sensors visible by default + + //-------------- NH display macro --------------------------------------------------------------------------------- // + cout << "customize TEveManager gEve " << gEve << endl; + gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); + TGLViewer* v = gEve->GetDefaultGLViewer(); + TGLAnnotation* ann = new TGLAnnotation(v, Form("%u", uRunId), 0.01, 0.98); + ann->SetTextSize(0.03); // % of window diagonal + ann->SetTextColor(4); + // ---------------------------------------------------------------------------------------------------------------- // + + if (kFALSE) { + gROOT->LoadMacro("save_hst.C"); + TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")"; + gInterpreter->ProcessLine(SaveToHstFile); + + // ----- Finish ------------------------------------------------------- + timer.Stop(); + FairMonitor::GetMonitor()->Print(); + 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 << "Parameter file is " << parFileOut << std::endl; + std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; + std::cout << std::endl; + // ------------------------------------------------------------------------ + + + // ----- Resource monitoring ------------------------------------------ + // 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(); + std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; + std::cout << maxMemory; + std::cout << "</DartMeasurement>" << std::endl; + + Float_t cpuUsage = ctime / rtime; + std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; + std::cout << cpuUsage; + std::cout << "</DartMeasurement>" << std::endl; + // ------------------------------------------------------------------------ + + + // ----- Function needed for CTest runtime dependency ----------------- + RemoveGeoManager(); + // ------------------------------------------------------------------------ + + //gSystem->Exec(Form("./RmLocalCopy.sh %s %s", sInpDir.Data(), cFileName.Data() )); + + /// --- Screen output for automatic tests + std::cout << " Test passed" << std::endl; + std::cout << " All ok " << std::endl; + } + return kTRUE; +}