Go to the documentation of this file.
25 #include "FairGeoNode.h"
26 #include "FairMCPoint.h"
27 #include "FairRootManager.h"
29 #include "TClonesArray.h"
30 #include "TDatabasePDG.h"
31 #include "TGeoManager.h"
90 std::map<std::pair<Int_t, Int_t>,
CbmLitMCTrack>::iterator it;
93 it->second.CalculateNofConsecutivePoints();
104 FairRootManager* ioman = FairRootManager::Instance();
111 <<
"CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
120 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
128 if (array == NULL)
return;
130 Int_t nofPoints = array->
Size(0, iEvent);
132 for (Int_t iPoint = 0; iPoint < nofPoints; ++iPoint) {
133 FairMCPoint* fairPoint =
134 static_cast<FairMCPoint*
>(array->
Get(0, iEvent, iPoint));
135 if (NULL == fairPoint)
continue;
137 Int_t stationId = -1;
161 if (stationId < 0)
continue;
164 fLitMCTracks[make_pair(iEvent, fairPoint->GetTrackID())].AddPoint(
177 map<pair<Int_t, Int_t>, Int_t> nofHitsInRing;
178 Int_t nofRichHits =
fRichHits->GetEntriesFast();
179 for (Int_t iHit = 0; iHit < nofRichHits; iHit++) {
181 if (NULL == hit)
continue;
182 vector<pair<Int_t, Int_t>> motherIds =
185 for (Int_t
i = 0;
i < motherIds.size();
i++) {
186 nofHitsInRing[motherIds[
i]]++;
190 map<pair<Int_t, Int_t>, Int_t>::const_iterator it;
191 for (it = nofHitsInRing.begin(); it != nofHitsInRing.end(); it++) {
202 for (
int iPoint = 0; iPoint < nofRichPoints; iPoint++) {
205 if (NULL == richPoint)
continue;
206 Int_t trackId = richPoint->GetTrackID();
207 if (trackId < 0)
continue;
209 if (NULL == mcTrackRich)
continue;
211 if (motherIdRich == -1)
continue;
213 richPoint->Position(posPoint);
218 mapRings[make_pair(iEvent, motherIdRich)].AddHit(hit);
224 for (it = mapRings.begin(); it != mapRings.end(); it++) {
241 if (fairPoint == NULL || litPoint == NULL)
return;
246 if (mcTrack == NULL)
return;
247 TParticlePDG* pdgParticle =
248 TDatabasePDG::Instance()->GetParticle(mcTrack->
GetPdgCode());
249 double charge = (pdgParticle != NULL) ? pdgParticle->Charge() : 0.;
250 Double_t q = (charge > 0) ? 1. : -1.;
255 const FairMCPoint* fairPoint,
257 if (fairPoint == NULL || litPoint == NULL)
return;
258 litPoint->
SetXIn(fairPoint->GetX());
259 litPoint->
SetYIn(fairPoint->GetY());
260 litPoint->
SetZIn(fairPoint->GetZ());
261 litPoint->
SetPxIn(fairPoint->GetPx());
262 litPoint->
SetPyIn(fairPoint->GetPy());
263 litPoint->
SetPzIn(fairPoint->GetPz());
264 litPoint->
SetXOut(fairPoint->GetX());
265 litPoint->
SetYOut(fairPoint->GetY());
266 litPoint->
SetZOut(fairPoint->GetZ());
267 litPoint->
SetPxOut(fairPoint->GetPx());
268 litPoint->
SetPyOut(fairPoint->GetPy());
269 litPoint->
SetPzOut(fairPoint->GetPz());
275 if (mvdPoint == NULL || litPoint == NULL)
return;
276 litPoint->
SetXIn(mvdPoint->GetX());
277 litPoint->
SetYIn(mvdPoint->GetY());
278 litPoint->
SetZIn(mvdPoint->GetZ());
279 litPoint->
SetPxIn(mvdPoint->GetPx());
280 litPoint->
SetPyIn(mvdPoint->GetPy());
281 litPoint->
SetPzIn(mvdPoint->GetPz());
293 if (stsPoint == NULL || litPoint == NULL)
return;
297 litPoint->
SetPxIn(stsPoint->GetPx());
298 litPoint->
SetPyIn(stsPoint->GetPy());
299 litPoint->
SetPzIn(stsPoint->GetPz());
311 if (trdPoint == NULL || litPoint == NULL)
return;
329 if (muchPoint == NULL || litPoint == NULL)
return;
333 litPoint->
SetPxIn(muchPoint->GetPx());
334 litPoint->
SetPyIn(muchPoint->GetPy());
335 litPoint->
SetPzIn(muchPoint->GetPz());
354 for (Int_t iPoint = 0; iPoint < nofMvdPoints; iPoint++) {
357 if (NULL == point)
continue;
366 for (Int_t iPoint = 0; iPoint < nofStsPoints; iPoint++) {
369 if (NULL == point)
continue;
370 UInt_t address = point->GetDetectorID();
380 for (Int_t iPoint = 0; iPoint < nofMuchPoints; iPoint++) {
381 const FairMCPoint* point =
382 static_cast<const FairMCPoint*
>(
fMuchPoints->
Get(0, iEvent, iPoint));
383 if (NULL == point)
continue;
397 for (Int_t iPoint = 0; iPoint < nofTrdPoints; iPoint++) {
398 const FairMCPoint* point =
399 static_cast<const FairMCPoint*
>(
fTrdPoints->
Get(0, iEvent, iPoint));
400 if (NULL == point)
continue;
Int_t GetMotherId() const
CbmMCDataObject * GetObject(const char *name)
CbmMCDataArray * fTrdPoints
virtual ~CbmLitMCTrackCreator()
Destructor.
CbmDigiManager * fDigiMan
Helper class to convert unique channel ID back and forth.
static CbmRichGeoManager & GetInstance()
Int_t GetStationNr() const
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
void AddRichHits(Int_t iEvent)
Calculate and set number of RICH hits for MC track.
CbmMCDataArray * fRichPoints
Int_t Size(Int_t fileNumber, Int_t eventNumber)
void TrdPointCoordinatesAndMomentumToLitMCPoint(const CbmTrdPoint *trdPoint, CbmLitMCPoint *litPoint)
InitStatus Init()
Initialisation.
Creates CbmLitMCTrack objects.
Double_t GetPyOut() const
static CbmLitMCTrackCreator * Instance()
Singleton instance.
CbmMCDataArray * InitBranch(const char *name)
void SetPzOut(Double_t pz)
static CbmStsSetup * Instance()
Double_t GetPxOut() const
@ kMvd
Micro-Vertex Detector.
static UInt_t GetLayerId(UInt_t address)
Return layer ID from address.
Access to a MC data branch for time-based analysis.
CbmMCDataArray * fStsPoints
@ kTof
Time-of-flight Detector.
std::map< std::pair< int, int >, int > fTrdStationsMap
FairTask for matching RECO data to MC.
void StsPointCoordinatesAndMomentumToLitMCPoint(const CbmStsPoint *stsPoint, CbmLitMCPoint *litPoint)
void SetPxOut(Double_t px)
CbmRichRingFitterEllipseTau * fTauFit
static CbmDigiManager * Instance()
Static instance.
void SetRefId(Int_t refId)
static Int_t GetLayerSideIndex(Int_t address)
CbmMCDataArray * fTofPoints
void MuchPointCoordinatesAndMomentumToLitMCPoint(const CbmMuchPoint *muchPoint, CbmLitMCPoint *litPoint)
static Int_t GetLayerIndex(Int_t address)
void AddRingParameters(Int_t iEvent)
Fit Rich MC points using ellipse fitter and fill ellipse parameters.
static Int_t GetStationIndex(Int_t address)
Double_t GetPyOut() const
Int_t GetStationNumber(Int_t address)
TObject * Get(const CbmLink *lnk)
static std::vector< std::pair< Int_t, Int_t > > GetMcTrackMotherIdsForRichHit(CbmDigiManager *digiMan, const CbmRichHit *hit, CbmMCDataArray *richPoints, CbmMCDataArray *mcTracks, Int_t eventNumber)
Return McTrack Ids for RICH hit C++11 efficient way to return vector.
Double_t GetPxOut() const
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
Double_t GetPyOut() const
@ kRich
Ring-Imaging Cherenkov Detector.
Creates CbmLitMCTrack objects.
Double_t GetPzOut() const
CbmDigiManager * fDigiMan
void SetPxIn(Double_t px)
void MvdPointCoordinatesAndMomentumToLitMCPoint(const CbmMvdPoint *mvdPoint, CbmLitMCPoint *litPoint)
Double_t GetPxOut() const
void SetPyIn(Double_t py)
Task class creating and managing CbmMCDataArray objects.
@ kTrd
Transition Radiation Detector.
Double_t GetPzOut() const
void AddPoints(ECbmModuleId detId, CbmMCDataArray *array, Int_t iEvent)
Add MC points from a certain detector.
Double_t GetPzOut() const
std::map< std::pair< int, int >, int > fMuchStationsMap
Double_t GetPyOut() const
Class for producing RICH hits directly from MCPoints.
std::map< std::pair< int, int >, int > fMvdStationsMap
void FairMCPointToLitMCPoint(const FairMCPoint *fairPoint, CbmLitMCPoint *litPoint, int eventId, int refId, int stationId)
Convert FairMCPoint to CbmLitMCPoint.
void ReadDataBranches()
Read data branches.
Double_t GetPzOut() const
CbmMCDataArray * fMCTracks
@ kMuch
Muon detection system.
void SetPzIn(Double_t pz)
std::map< std::pair< int, int >, CbmLitMCTrack > fLitMCTracks
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
Double_t GetPxOut() const
CbmMCDataArray * fMvdPoints
CbmMCDataArray * fMuchPoints
@ kSts
Silicon Tracking System.
void Create(Int_t eventNum)
Creates array of CbmLitMCTracks for current event.
CbmLitMCTrackCreator()
Constructor.
void FillStationMaps(Int_t iEvent)
Fill maps for MC points to station id.
std::map< std::pair< int, int >, int > fStsStationsMap
void FairMCPointCoordinatesAndMomentumToLitMCPoint(const FairMCPoint *fairPoint, CbmLitMCPoint *litPoint)
void SetPyOut(Double_t py)
void SetStationId(Int_t stationId)