13 InitJANAPlugin(locApplication);
37 TDirectory* locOriginalDir = gDirectory;
38 gDirectory->mkdir(
"SC_Eff")->cd();
41 dHist_HitFound =
new TH2I(
"HitFound",
"Hit Found;Projected Hit-Z (cm);Sector", 120, 40.0, 100.0, 30, 0.5, 30.5);
42 dHist_HitTotal =
new TH2I(
"HitTotal",
"Hit Total;Projected Hit-Z (cm);Sector", 120, 40.0, 100.0, 30, 0.5, 30.5);
106 locEventLoop->GetSingle(locTrigger);
112 if(locTriggerBits >= 32)
116 locEventLoop->GetSingle(locEventRFBunch);
120 vector<const DChargedTrack*> locChargedTracks;
121 locEventLoop->Get(locChargedTracks);
123 vector<const DSCHit*> locSCHits;
124 locEventLoop->Get(locSCHits);
127 locEventLoop->GetSingle(locParticleID);
130 locEventLoop->GetSingle(locDetectorMatches);
133 set<const DChargedTrackHypothesis*> locBestTracks;
134 for(
auto& locChargedTrack : locChargedTracks)
138 double locBestTrackingFOM = -1.0;
139 for(
auto& locChargedTrackHypothesis : locChargedTrack->dChargedTrackHypotheses)
141 if((locChargedTrackHypothesis->PID() ==
Electron) || (locChargedTrackHypothesis->PID() ==
Positron))
144 if(locChargedTrackHypothesis->position().Perp() >
dMaxVertexR)
158 unsigned int locNumTrackHits = locTrackTimeBased->
Ndof + 5;
162 if(locTrackTimeBased->FOM < locBestTrackingFOM)
165 locBestTrackingFOM = locTrackTimeBased->FOM;
166 locBestChargedTrackHypothesis = locChargedTrackHypothesis;
170 if(locBestChargedTrackHypothesis !=
nullptr)
171 locBestTracks.insert(locBestChargedTrackHypothesis);
176 vector<pair<int, double> > locHitMap_HitFound, locHitMap_HitTotal;
179 for(
auto& locChargedTrackHypothesis : locBestTracks)
181 auto locTrackTimeBased = locChargedTrackHypothesis->Get_TrackTimeBased();
184 DVector3 locPredictedSurfacePosition;
185 bool locProjBarrelRegion =
false;
186 vector<DTrackFitter::Extrapolation_t>extrapolations=locTrackTimeBased->extrapolations.at(
SYS_START);
187 unsigned int locPredictedSCSector = locParticleID->
PredictSCSector(extrapolations, &locPredictedSurfacePosition, &locProjBarrelRegion);
190 pair<int, double> locHitPair(locPredictedSCSector, locPredictedSurfacePosition.Z());
191 locHitMap_HitTotal.push_back(locHitPair);
193 locHitMap_HitFound.push_back(locHitPair);
200 DVector3 locDP3 = locChargedTrackHypothesis->momentum();
201 TVector3 locP3(locDP3.X(), locDP3.Y(), locDP3.Z());
209 vector<shared_ptr<const DSCHitMatchParams>> locAllSCMatchParams;
213 set<const DSCHit*> locMatchedSCHits;
214 for(
auto locSCMatchParams : locAllSCMatchParams)
215 locMatchedSCHits.insert(locSCMatchParams->dSCHit);
218 size_t locArrayIndex = 0;
219 for(
size_t loc_i = 0; loc_i < locSCHits.size(); ++loc_i)
221 const DSCHit* locSCHit = locSCHits[loc_i];
223 shared_ptr<DSCHitMatchParams> locSCHitMatchParams;
224 if(!locParticleID->
Distance_ToTrack(extrapolations, locSCHit, locTrackTimeBased->t0(), locSCHitMatchParams))
227 double locDeltaT = locSCHitMatchParams->dHitTime - locSCHitMatchParams->dFlightTime - locChargedTrackHypothesis->time();
228 bool locIsMatchedToTrack = (locMatchedSCHits.find(locSCHit) != locMatchedSCHits.end());
247 japp->RootFillLock(
this);
250 for(
auto& locHitPair : locHitMap_HitFound)
254 for(
auto& locHitPair : locHitMap_HitTotal)
257 japp->RootFillUnLock(
this);
268 double locDeltaT = locChargedTrackHypothesis->
time() - locChargedTrackHypothesis->
t0();
unsigned int dMinNumTrackHits
unsigned int PredictSCSector(const DReferenceTrajectory *rt, DVector3 *locOutputProjPos=nullptr, bool *locProjBarrelRegion=nullptr, double *locMinDPhi=nullptr) const
jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)
Called every time a new run number is detected.
jerror_t erun(void)
Called every time run number changes, provided brun has been called.
bool Get_SCMatchParams(const DTrackingData *locTrack, vector< shared_ptr< const DSCHitMatchParams > > &locMatchParams) const
jerror_t init(void)
Called once at program start.
uint32_t Get_L1TriggerBits(void) const
jerror_t fini(void)
Called after last event of last event source has been processed.
void Register_Single(string locBranchName)
void Fill_Array(string locBranchName, const DType &locData, size_t locArrayIndex)
const DTrackTimeBased * Get_TrackTimeBased(void) const
bool Create_Branches(const DTreeBranchRegister &locTreeBranchRegister)
int dMinHitPlanesPerFDCPackage
uint32_t Get_L1FrontPanelTriggerBits(void) const
int dMinHitRingsPerCDCSuperlayer
static int PDGtype(Particle_t p)
void Fill(DTreeFillData &locTreeFillData)
static DTreeInterface * Create_DTreeInterface(string locTreeName, string locFileName)
static thread_local DTreeFillData dTreeFillData
DCutAction_TrackHitPattern * dCutAction_TrackHitPattern
void Register_FundamentalArray(string locBranchName, string locArraySizeName, size_t locInitialArraySize=10)
int Ndof
Number of degrees of freedom in the fit.
bool Cut_TrackHitPattern(const DParticleID *locParticleID, const DKinematicData *locTrack) const
bool Cut_PIDDeltaT(const DChargedTrackHypothesis *locChargedTrackHypothesis)
unsigned int dNumParticleVotes
bool Distance_ToTrack(const DReferenceTrajectory *rt, const DFCALShower *locFCALShower, double locInputStartTime, shared_ptr< DFCALShowerMatchParams > &locShowerMatchParams, DVector3 *locOutputProjPos=nullptr, DVector3 *locOutputProjMom=nullptr) const
DetectorSystem_t t1_detector(void) const
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t locEventNumber)
Called every event.
DTreeInterface * dTreeInterface
map< DetectorSystem_t, double > dMaxPIDDeltaTMap
bool Get_IsMatchedToDetector(const DTrackingData *locTrack, DetectorSystem_t locDetectorSystem) const
void Fill_Single(string locBranchName, const DType &locData)