30#include "FairGeoNode.h"
31#include "FairMCPoint.h"
32#include "FairRootManager.h"
33#include "TClonesArray.h"
34#include "TDatabasePDG.h"
35#include "TGeoManager.h"
97 std::map<std::pair<Int_t, Int_t>,
CbmLitMCTrack>::iterator it;
99 it->second.CalculateNofConsecutivePoints();
111 FairRootManager* ioman = FairRootManager::Instance();
115 if (0 == mcManager) LOG(fatal) <<
"CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
124 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
131 if (array == NULL)
return;
133 Int_t nofPoints = array->
Size(0, iEvent);
135 for (Int_t iPoint = 0; iPoint < nofPoints; ++iPoint) {
136 FairMCPoint* fairPoint =
static_cast<FairMCPoint*
>(array->
Get(0, iEvent, iPoint));
137 if (NULL == fairPoint)
continue;
139 Int_t stationId = -1;
164 if (stationId < 0)
continue;
167 fLitMCTracks[make_pair(iEvent, fairPoint->GetTrackID())].AddPoint(detId, litPoint);
179 map<pair<Int_t, Int_t>, Int_t> nofHitsInRing;
180 Int_t nofRichHits =
fRichHits->GetEntriesFast();
181 for (Int_t iHit = 0; iHit < nofRichHits; iHit++) {
183 if (NULL == hit)
continue;
185 for (UInt_t i = 0; i < motherIds.size(); i++) {
186 auto motherId = std::make_pair<Int_t, Int_t>(motherIds[i].GetEntry(), motherIds[i].GetIndex());
187 nofHitsInRing[motherId]++;
191 map<pair<Int_t, Int_t>, Int_t>::const_iterator it;
192 for (it = nofHitsInRing.begin(); it != nofHitsInRing.end(); it++) {
204 for (
int iPoint = 0; iPoint < nofRichPoints; iPoint++) {
206 if (NULL == richPoint)
continue;
207 Int_t trackId = richPoint->GetTrackID();
208 if (trackId < 0)
continue;
210 if (NULL == mcTrackRich)
continue;
212 if (motherIdRich == -1)
continue;
214 richPoint->Position(posPoint);
219 mapRings[make_pair(iEvent, motherIdRich)].AddHit(hit);
224 for (it = mapRings.begin(); it != mapRings.end(); it++) {
236 Int_t refId, Int_t stationId)
238 if (fairPoint == NULL || litPoint == NULL)
return;
242 if (mcTrack == NULL)
return;
243 TParticlePDG* pdgParticle = TDatabasePDG::Instance()->GetParticle(mcTrack->
GetPdgCode());
244 double charge = (pdgParticle != NULL) ? pdgParticle->Charge() : 0.;
245 Double_t q = (charge > 0) ? 1. : -1.;
252 if (fairPoint == NULL || litPoint == NULL)
return;
253 litPoint->
SetXIn(fairPoint->GetX());
254 litPoint->
SetYIn(fairPoint->GetY());
255 litPoint->
SetZIn(fairPoint->GetZ());
256 litPoint->
SetPxIn(fairPoint->GetPx());
257 litPoint->
SetPyIn(fairPoint->GetPy());
258 litPoint->
SetPzIn(fairPoint->GetPz());
259 litPoint->
SetXOut(fairPoint->GetX());
260 litPoint->
SetYOut(fairPoint->GetY());
261 litPoint->
SetZOut(fairPoint->GetZ());
262 litPoint->
SetPxOut(fairPoint->GetPx());
263 litPoint->
SetPyOut(fairPoint->GetPy());
264 litPoint->
SetPzOut(fairPoint->GetPz());
270 if (mvdPoint == NULL || litPoint == NULL)
return;
271 litPoint->
SetXIn(mvdPoint->GetX());
272 litPoint->
SetYIn(mvdPoint->GetY());
273 litPoint->
SetZIn(mvdPoint->GetZ());
274 litPoint->
SetPxIn(mvdPoint->GetPx());
275 litPoint->
SetPyIn(mvdPoint->GetPy());
276 litPoint->
SetPzIn(mvdPoint->GetPz());
288 if (stsPoint == NULL || litPoint == NULL)
return;
292 litPoint->
SetPxIn(stsPoint->GetPx());
293 litPoint->
SetPyIn(stsPoint->GetPy());
294 litPoint->
SetPzIn(stsPoint->GetPz());
306 if (trdPoint == NULL || litPoint == NULL)
return;
324 if (muchPoint == NULL || litPoint == NULL)
return;
328 litPoint->
SetPxIn(muchPoint->GetPx());
329 litPoint->
SetPyIn(muchPoint->GetPy());
330 litPoint->
SetPzIn(muchPoint->GetPz());
350 for (Int_t iPoint = 0; iPoint < nofMvdPoints; iPoint++) {
352 if (NULL == point)
continue;
361 for (Int_t iPoint = 0; iPoint < nofStsPoints; iPoint++) {
363 if (NULL == point)
continue;
364 UInt_t address = point->GetDetectorID();
374 for (Int_t iPoint = 0; iPoint < nofMuchPoints; iPoint++) {
375 const FairMCPoint* point =
static_cast<const FairMCPoint*
>(
fMuchPoints->
Get(0, iEvent, iPoint));
376 if (NULL == point)
continue;
389 for (Int_t iPoint = 0; iPoint < nofTrdPoints; iPoint++) {
390 const FairMCPoint* point =
static_cast<const FairMCPoint*
>(
fTrdPoints->
Get(0, iEvent, iPoint));
391 if (NULL == point)
continue;
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
Creates CbmLitMCTrack objects.
FairTask for matching RECO data to MC.
Class for producing RICH hits directly from MCPoints.
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
CbmDigiManager * fDigiMan
Helper class to convert unique channel ID back and forth.
InitStatus Init()
Initialisation.
static CbmDigiManager * Instance()
Static instance.
void SetRefId(Int_t refId)
void SetPxOut(Double_t px)
void SetPyIn(Double_t py)
void SetPzIn(Double_t pz)
void SetPzOut(Double_t pz)
void SetPyOut(Double_t py)
void SetStationId(Int_t stationId)
void SetPxIn(Double_t px)
Creates CbmLitMCTrack objects.
CbmMCDataArray * fTrdPoints
void FillStationMaps(Int_t iEvent)
Fill maps for MC points to station id.
std::map< std::pair< int, int >, int > fTrdStationsMap
void StsPointCoordinatesAndMomentumToLitMCPoint(const CbmStsPoint *stsPoint, CbmLitMCPoint *litPoint)
void FairMCPointCoordinatesAndMomentumToLitMCPoint(const FairMCPoint *fairPoint, CbmLitMCPoint *litPoint)
void MuchPointCoordinatesAndMomentumToLitMCPoint(const CbmMuchPoint *muchPoint, CbmLitMCPoint *litPoint)
void FairMCPointToLitMCPoint(const FairMCPoint *fairPoint, CbmLitMCPoint *litPoint, int eventId, int refId, int stationId)
Convert FairMCPoint to CbmLitMCPoint.
virtual ~CbmLitMCTrackCreator()
Destructor.
CbmMCDataArray * fMvdPoints
CbmMCDataArray * fTofPoints
void AddPoints(ECbmModuleId detId, CbmMCDataArray *array, Int_t iEvent)
Add MC points from a certain detector.
CbmDigiManager * fDigiMan
std::map< std::pair< int, int >, int > fMvdStationsMap
std::map< std::pair< int, int >, CbmLitMCTrack > fLitMCTracks
void AddRichHits(Int_t iEvent)
Calculate and set number of RICH hits for MC track.
std::map< std::pair< int, int >, int > fMuchStationsMap
void Create(Int_t eventNum)
Creates array of CbmLitMCTracks for current event.
CbmRichRingFitterEllipseTau * fTauFit
CbmMCDataArray * fMCTracks
std::map< std::pair< int, int >, int > fStsStationsMap
CbmMCDataArray * fMuchPoints
void AddRingParameters(Int_t iEvent)
Fit Rich MC points using ellipse fitter and fill ellipse parameters.
void MvdPointCoordinatesAndMomentumToLitMCPoint(const CbmMvdPoint *mvdPoint, CbmLitMCPoint *litPoint)
CbmMCDataArray * fStsPoints
void ReadDataBranches()
Read data branches.
void TrdPointCoordinatesAndMomentumToLitMCPoint(const CbmTrdPoint *trdPoint, CbmLitMCPoint *litPoint)
CbmLitMCTrackCreator()
Constructor.
static CbmLitMCTrackCreator * Instance()
Singleton instance.
CbmMCDataArray * fRichPoints
Access to a MC data branch for time-based analysis.
TObject * Get(const CbmLink *lnk)
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Task class creating and managing CbmMCDataArray objects.
CbmMCDataObject * GetObject(const char *name)
CbmMCDataArray * InitBranch(const char *name)
int32_t GetMotherId() const
int32_t GetPdgCode() const
static std::vector< CbmLink > GetMcTrackMotherIdsForRichHit(CbmDigiManager *digiMan, const CbmRichHit *hit, CbmMCDataArray *richPoints, CbmMCDataArray *mcTracks)
Get CbmLinks of Mother MC Tracks for RICH hit.
static Int_t GetLayerSideIndex(Int_t address)
static Int_t GetStationIndex(Int_t address)
static Int_t GetLayerIndex(Int_t address)
int32_t GetStationNr() const
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
static CbmRichGeoManager & GetInstance()
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
static CbmStsSetup * Instance()
Int_t GetStationNumber(Int_t address)
static uint32_t GetLayerId(uint32_t address)
Return layer ID from address.