13 InitJANAPlugin(locApplication);
37 TDirectory* locOriginalDir = gDirectory;
38 gDirectory->mkdir(
"FCAL_Hadronic_Eff")->cd();
41 string locHistName, locHistTitle;
43 locHistName =
"TrackFCALYVsX_HasHit";
44 locHistTitle =
"FCAL Has Hit;Projected FCAL Hit X (cm);Projected FCAL Hit Y (cm)";
47 locHistName =
"TrackFCALYVsX_NoHit";
48 locHistTitle =
"FCAL Total Hit;Projected FCAL Hit X (cm);Projected FCAL Hit Y (cm)";
51 locHistName =
"TrackFCALRowVsColumn_HasHit";
52 locHistTitle =
"FCAL Has Hit;Projected FCAL Hit Column;Projected FCAL Hit Row";
55 locHistName =
"TrackFCALRowVsColumn_NoHit";
56 locHistTitle =
"FCAL Total Hit;Projected FCAL Hit Column;Projected FCAL Hit Row";
125 locEventLoop->GetSingle(locTrigger);
131 if(((locTriggerBits & 4) != 4) && ((locTriggerBits & 64) != 64))
135 locEventLoop->GetSingle(locEventRFBunch);
139 vector<const DChargedTrack*> locChargedTracks;
140 locEventLoop->Get(locChargedTracks);
143 locEventLoop->GetSingle(locParticleID);
145 vector<const DFCALShower*> locFCALShowers;
146 locEventLoop->Get(locFCALShowers);
149 locEventLoop->GetSingle(locDetectorMatches);
152 set<const DChargedTrackHypothesis*> locBestTracks;
153 for(
auto& locChargedTrack : locChargedTracks)
157 double locBestTrackingFOM = -1.0;
158 for(
auto& locChargedTrackHypothesis : locChargedTrack->dChargedTrackHypotheses)
160 if((locChargedTrackHypothesis->PID() ==
Electron) || (locChargedTrackHypothesis->PID() ==
Positron))
163 if(locChargedTrackHypothesis->position().Perp() >
dMaxVertexR)
177 unsigned int locNumTrackHits = locTrackTimeBased->
Ndof + 5;
181 if(locTrackTimeBased->FOM < locBestTrackingFOM)
184 locBestTrackingFOM = locTrackTimeBased->FOM;
185 locBestChargedTrackHypothesis = locChargedTrackHypothesis;
189 if(locBestChargedTrackHypothesis !=
nullptr)
190 locBestTracks.insert(locBestChargedTrackHypothesis);
194 for(
auto& locChargedTrackHypothesis : locBestTracks)
196 auto locTrackTimeBased = locChargedTrackHypothesis->Get_TrackTimeBased();
199 DVector3 locProjectedFCALIntersection;
200 unsigned int locProjectedFCALRow = 0, locProjectedFCALColumn = 0;
201 vector<DTrackFitter::Extrapolation_t>extrapolations=locTrackTimeBased->extrapolations.at(
SYS_FCAL);
202 if(!locParticleID->
PredictFCALHit(extrapolations, locProjectedFCALRow, locProjectedFCALColumn, &locProjectedFCALIntersection))
204 if(locTrackTimeBased->momentum().Theta()*180.0/TMath::Pi() >
dMaxFCALThetaCut)
210 shared_ptr<const DFCALShowerMatchParams> locClosestMatchParams;
211 double locStartTime = locTrackTimeBased->t0();
212 if(locParticleID->
Get_ClosestToTrack(extrapolations, locFCALShowers,
false, locStartTime, locClosestMatchParams))
213 locFCALShower = locClosestMatchParams->dFCALShower;
216 auto locFCALShowerMatchParams = locChargedTrackHypothesis->Get_FCALShowerMatchParams();
217 bool locIsMatchedToTrack = (locFCALShowerMatchParams !=
nullptr);
220 double locFCALDeltaT = 0.0;
221 double locFCALTimeFOM =
Calc_FCALTiming(locChargedTrackHypothesis, locParticleID, locEventRFBunch, locFCALDeltaT);
225 japp->RootFillLock(
this);
232 if(locIsMatchedToTrack)
238 japp->RootFillUnLock(
this);
241 Particle_t locPID = (locChargedTrackHypothesis->t1_detector() ==
SYS_TOF) ? locChargedTrackHypothesis->PID() :
Unknown;
246 DVector3 locDP3 = locChargedTrackHypothesis->momentum();
247 TVector3 locP3(locDP3.X(), locDP3.Y(), locDP3.Z());
257 if(locFCALShower != NULL)
285 if(locFCALShowerMatchParams == NULL)
288 double locStartTime = locParticleID->
Calc_PropagatedRFTime(locChargedTrackHypothesis, locEventRFBunch);
289 const DFCALShower* locFCALShower = locFCALShowerMatchParams->dFCALShower;
290 locDeltaT = locFCALShower->
getTime() - locFCALShowerMatchParams->dFlightTime - locStartTime;
292 double locPIDFOM = -1.0;
301 double locDeltaT = locChargedTrackHypothesis->
time() - locChargedTrackHypothesis->
t0();
int dMinHitPlanesPerFDCPackage
uint32_t Get_L1TriggerBits(void) const
jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)
Called every time a new run number is detected.
void Register_Single(string locBranchName)
const DTrackTimeBased * Get_TrackTimeBased(void) const
bool Create_Branches(const DTreeBranchRegister &locTreeBranchRegister)
uint32_t Get_L1FrontPanelTriggerBits(void) const
double Calc_FCALTiming(const DChargedTrackHypothesis *locChargedTrackHypothesis, const DParticleID *locParticleID, const DEventRFBunch *locEventRFBunch, double &locDeltaT)
double Calc_PropagatedRFTime(const DKinematicData *locKinematicData, const DEventRFBunch *locEventRFBunch) const
unsigned int dMinNumTrackHits
static int PDGtype(Particle_t p)
bool PredictFCALHit(const DReferenceTrajectory *rt, unsigned int &row, unsigned int &col, DVector3 *intersection=nullptr) const
DTreeInterface * dTreeInterface
jerror_t fini(void)
Called after last event of last event source has been processed.
bool Cut_TOFTiming(const DChargedTrackHypothesis *locChargedTrackHypothesis)
void Fill(DTreeFillData &locTreeFillData)
static DTreeInterface * Create_DTreeInterface(string locTreeName, string locFileName)
TH2I * dHist_TrackFCALYVsX_HasHit
bool Get_ClosestToTrack(const DReferenceTrajectory *rt, const vector< const DBCALShower * > &locBCALShowers, bool locCutFlag, double &locStartTime, shared_ptr< const DBCALShowerMatchParams > &locBestMatchParams, double *locStartTimeVariance=nullptr, DVector3 *locBestProjPos=nullptr, DVector3 *locBestProjMom=nullptr) const
int Ndof
Number of degrees of freedom in the fit.
TH2I * dHist_TrackFCALRowVsColumn_TotalHit
shared_ptr< const DFCALShowerMatchParams > Get_FCALShowerMatchParams(void) const
static thread_local DTreeFillData dTreeFillData
bool Cut_TrackHitPattern(const DParticleID *locParticleID, const DKinematicData *locTrack) const
TH2I * dHist_TrackFCALRowVsColumn_HasHit
unsigned int dNumParticleVotes
int dMinHitRingsPerCDCSuperlayer
DCutAction_TrackHitPattern * dCutAction_TrackHitPattern
DetectorSystem_t t1_detector(void) const
DVector3 getPosition() const
jerror_t erun(void)
Called every time run number changes, provided brun has been called.
jerror_t init(void)
Called once at program start.
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t locEventNumber)
Called every event.
TH2I * dHist_TrackFCALYVsX_TotalHit
void Fill_Single(string locBranchName, const DType &locData)