9 #include "ERNDTrackFinder.h" 11 #include "FairLogger.h" 13 #include "ERBeamDetTrack.h" 16 ERNDTrackFinder::ERNDTrackFinder()
17 :
ERTask(
"ER ND track finder")
19 fAvailibleRunManagers.push_back(
"ERRunAna");
20 fAvailibleRunManagers.push_back(
"FairRunAna");
26 FairRootManager* ioman = FairRootManager::Instance();
27 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
28 fNDDigis = (TClonesArray*) ioman->GetObject(
"NDDigi");
29 if (!fNDDigis) Fatal(
"Init",
"Can`t find collection NDDigi!");
30 fNDTracks =
new TClonesArray(
"ERNDTrack",1000);
31 ioman->Register(
"NDTrack",
"ND track", fNDTracks, kTRUE);
32 fSetup = ERNDSetup::Instance();
33 if (!fUserTargetVertexIsSet) {
34 fBeamDetTrack = (TClonesArray*) ioman->GetObject(
"BeamDetTrack");
36 LOG(DEBUG) <<
"ERNDTrackFinder: target point not initialized by user " 37 <<
"(by means of SetTargetVertex()) and there is no ERBeamDetTrack branch" 42 fSetup->ReadGeoParamsFromParContainer();
46 void ERNDTrackFinder::Exec(Option_t* opt) {
48 if (!fUserTargetVertexIsSet) {
54 fTargetVertex = TVector3(trackFromMWPC->GetTargetX(), trackFromMWPC->GetTargetY(),
55 trackFromMWPC->GetTargetZ());
57 for (Int_t iDigi(0); iDigi < fNDDigis->GetEntriesFast(); iDigi++) {
58 const auto* digi =
static_cast<ERNDDigi*
>(fNDDigis->At(iDigi));
59 AddTrack(fSetup->Pos(digi->Channel()), fTargetVertex, digi->Edep(), digi->Time(), digi->TAC());
67 void ERNDTrackFinder::SetTargetVertex(
const TVector3& vertex) {
68 fTargetVertex = vertex;
69 fUserTargetVertexIsSet =
true;
72 ERNDTrack* ERNDTrackFinder::AddTrack(
const TVector3& detectorVertex,
73 const TVector3& targetVertex,
74 float edep,
float time,
float tac) {
75 return new((*fNDTracks)[fNDTracks->GetEntriesFast()])
76 ERNDTrack(detectorVertex, targetVertex, edep, time, tac);
virtual InitStatus Init()
virtual InitStatus Init()
Base abstract class for all tasks in er.