Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DCustomAction_p2gamma_unusedHists.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCustomAction_p2gamma_unusedHists.cc
4 // Created: Thu Jan 22 08:06:18 EST 2015
5 // Creator: jrsteven (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64)
6 //
7 
9 
10 void DCustomAction_p2gamma_unusedHists::Initialize(JEventLoop* locEventLoop)
11 {
12 
13  // get PID algos
14  const DParticleID* locParticleID = NULL;
15  locEventLoop->GetSingle(locParticleID);
16  dParticleID = locParticleID;
17 
18  //CREATE THE HISTOGRAMS
19  //Since we are creating histograms, the contents of gDirectory will be modified: must use JANA-wide ROOT lock
20  japp->RootWriteLock(); //ACQUIRE ROOT LOCK!!
21  {
22  //Required: Create a folder in the ROOT output file that will contain all of the output ROOT objects (if any) for this action.
23  //If another thread has already created the folder, it just changes to it.
25 
26  dNShowerBCAL_FCAL = GetOrCreate_Histogram<TH2I>("NShowerBCAL_FCAL", "Number of non-matched showers; FCAL; BCAL", 10, 0, 10, 10, 0, 10);
27 
28  TString locHistName;
29  TString locHistTitle;
30  TString match[2] = {"Match",""};
31  map<int, TString> charge;
32  charge[-1] = "Neg"; charge[+1] = "Pos";
33 
34  for(int locDummy = 0; locDummy < 2; locDummy++) {
35  bool locMatch = (locDummy == 0);
36 
37  for(int locCharge = -1; locCharge < 2; locCharge+=2) {
38  locHistName = "TrackNhits_Theta" + match[locDummy] + charge[locCharge];
39  locHistTitle = "Number of hits on track vs #theta: " + match[locDummy] + charge[locCharge];
40  locHistTitle += "; #theta; # DOF";
41  dHistMap_TrackNhits_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 50, 0, 50);
42 
43  locHistName = "TrackChiSq_Theta" + match[locDummy] + charge[locCharge];
44  locHistTitle = "FOM for track #chi^{2} vs #theta: " + match[locDummy] + charge[locCharge];
45  locHistTitle += "; #theta; #chi^{2}";
46  dHistMap_TrackChiSq_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 500, 0., 100.);
47 
48  locHistName = "TrackFOM_Theta" + match[locDummy] + charge[locCharge];
49  locHistTitle = "FOM for track fit vs #theta: " + match[locDummy] + charge[locCharge];
50  locHistTitle += "; #theta; FOM";
51  dHistMap_TrackFOM_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 1000, 0., 1.);
52 
53  locHistName = "TrackP_Theta" + match[locDummy] + charge[locCharge];
54  locHistTitle = "P vs #theta: " + match[locDummy] + charge[locCharge];
55  locHistTitle += "; #theta; momentum";
56  dHistMap_TrackP_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 120, 0., 6.);
57 
58  locHistName = "TrackPOCAXY" + match[locDummy] + charge[locCharge];
59  locHistTitle = "POCA to beamline Y vs X: " + match[locDummy] + charge[locCharge];
60  locHistTitle += "; POCA X; POCAY";
61  dHistMap_TrackPOCAXY[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 200, -20., 20., 200, -20., 20.);
62 
63  locHistName = "TrackPOCAZ" + match[locDummy] + charge[locCharge];
64  locHistTitle = "POCA to beamline Z: " + match[locDummy] + charge[locCharge];
65  locHistTitle += "; POCA Z";
66  dHistMap_TrackPOCAZ[locMatch][locCharge] = GetOrCreate_Histogram<TH1I>(locHistName.Data(), locHistTitle.Data(), 500, 0., 250.);
67 
68  /*
69  locHistName = "TrackNposs" + match[locDummy] + charge[locCharge];
70  locHistTitle = "Number possible hits on track vs #theta: " + match[locDummy] + charge[locCharge];
71  locHistTitle += "; #theta; # possible hits";
72  dHistMap_TrackNposs_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 50, 0, 50);
73 
74  locHistName = "TrackHitFrac" + match[locDummy] + charge[locCharge];
75  locHistTitle = "Fraction of possible hits used in track fit vs #theta: " + match[locDummy] + charge[locCharge];
76  locHistTitle += "; #theta; # hits fit / # hits possible";
77  dHistMap_TrackHitFrac_Theta[locMatch][locCharge] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., 150., 100, 0., 1.);
78  */
79  }
80 
81  vector<DetectorSystem_t> locDetectorSystems;
82  locDetectorSystems.push_back(SYS_FCAL); locDetectorSystems.push_back(SYS_BCAL);
83  for(size_t loc_i = 0; loc_i < locDetectorSystems.size(); ++loc_i)
84  {
85  DetectorSystem_t locSystem = locDetectorSystems[loc_i];
86  TString locSystemName = (locSystem == SYS_FCAL) ? "FCAL" : "BCAL";
87  double thetaMax = (locSystem == SYS_FCAL) ? 15. : 150.;
88 
89  locHistName = "ShowerEnergy_Theta" + match[locDummy] + locSystemName;
90  locHistTitle = "Shower Energy vs #theta: " + match[locDummy] + locSystemName;
91  locHistTitle += ";#theta; Energy";
92  dHistMap_ShowerEnergy_Theta[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 100., 0., 5.);
93 
94  locHistName = "ShowerPhi_Theta" + match[locDummy] + locSystemName;
95  locHistTitle = "Shower #phi vs #theta: " + match[locDummy] + locSystemName;
96  locHistTitle += ";#theta; #phi";
97  dHistMap_ShowerPhi_Theta[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 360., -180., 180.);
98 
99  locHistName = "ShowerNClusters" + match[locDummy] + locSystemName;
100  locHistTitle = "Number of clusters in shower: " + match[locDummy] + locSystemName;
101  dHistMap_ShowerNclusters[locMatch][locSystem] = GetOrCreate_Histogram<TH1I>(locHistName.Data(), locHistTitle.Data(), 15, 0, 15);
102 
103 
104  locHistName = "ShowerNHits" + match[locDummy] + locSystemName;
105  locHistTitle = "Number of hits in shower: " + match[locDummy] + locSystemName;
106  dHistMap_ShowerNhits[locMatch][locSystem] = GetOrCreate_Histogram<TH1I>(locHistName.Data(), locHistTitle.Data(), 15, 0, 15);
107 
108  locHistName = "ShowerMaxEnergy_NHits" + match[locDummy] + locSystemName;
109  locHistTitle = "E_{max}/E_{tot} vs number of hits in shower: " + match[locDummy] + locSystemName;
110  dHistMap_ShowerMaxEnergy_Nhits[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 15, 0, 15, 500, 0., 1.);
111 
112  locHistName = "ShowerDeltaT_NHits" + match[locDummy] + locSystemName;
113  locHistTitle = "t_{shower} - t_{#gamma} vs number of hits in shower: " + match[locDummy] + locSystemName;
114  dHistMap_ShowerDeltaT_Nhits[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 15, 0, 15, 200, -100., 100.);
115 
116  locHistName = "ShowerDeltaT_E" + match[locDummy] + locSystemName;
117  locHistTitle = "t_{shower} - t_{#gamma} vs shower energy: " + match[locDummy] + locSystemName;
118  dHistMap_ShowerDeltaT_E[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 100., 0., 5., 200, -100., 100.);
119 
120  locHistName = "ShowerE_Theta" + match[locDummy] + locSystemName;
121  locHistTitle = "t_{shower} - t_{#gamma} vs shower #theta: " + match[locDummy] + locSystemName;
122  dHistMap_ShowerE_Theta[locMatch][locSystem] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 120., 0., 6.);
123 
124  if(locSystem == SYS_BCAL){
125  locHistName = "ShowerNcell" + match[locDummy] + locSystemName;
126  locHistTitle = "Number of points in shower: " + match[locDummy] + locSystemName;
127  dHistMap_BCALShowerNcell[locMatch] = GetOrCreate_Histogram<TH1I>(locHistName.Data(), locHistTitle.Data(), 15, 0, 15);
128 
129  locHistName = "Layer1Energy_Theta" + match[locDummy] + locSystemName;
130  locHistTitle = "Shower Layer 1 Energy vs #theta: " + match[locDummy] + locSystemName;
131  locHistTitle += ";#theta; Energy Layer 1";
132  dHistMap_Layer1Energy_Theta[locMatch] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 500., 0., 1.);
133 
134  locHistName = "Layer2Energy_Theta" + match[locDummy] + locSystemName;
135  locHistTitle = "Shower Layer 2 Energy vs #theta: " + match[locDummy] + locSystemName;
136  locHistTitle += ";#theta; Energy Layer 2";
137  dHistMap_Layer2Energy_Theta[locMatch] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 500., 0., 1.);
138 
139  locHistName = "Layer3Energy_Theta" + match[locDummy] + locSystemName;
140  locHistTitle = "Shower Layer 3 Energy vs #theta: " + match[locDummy] + locSystemName;
141  locHistTitle += ";#theta; Energy Layer 3";
142  dHistMap_Layer3Energy_Theta[locMatch] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 500., 0., 1.);
143 
144  locHistName = "Layer4Energy_Theta" + match[locDummy] + locSystemName;
145  locHistTitle = "Shower Layer 4 Energy vs #theta: " + match[locDummy] + locSystemName;
146  locHistTitle += ";#theta; Energy Layer 4";
147  dHistMap_Layer4Energy_Theta[locMatch] = GetOrCreate_Histogram<TH2I>(locHistName.Data(), locHistTitle.Data(), 150, 0., thetaMax, 500., 0., 1.);
148  }
149  }
150  }
151 
152  //Return to the base directory
154  }
155  japp->RootUnLock(); //RELEASE ROOT LOCK!!
156 }
157 
158 bool DCustomAction_p2gamma_unusedHists::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo)
159 {
160 
161  // should only have one reaction step
162  const DParticleComboStep* locParticleComboStep = locParticleCombo->Get_ParticleComboStep(0);
163 
164  // get beam photon energy and final state particles
165  auto locBeamPhoton = Get_UseKinFitResultsFlag() ? locParticleComboStep->Get_InitialParticle() : locParticleComboStep->Get_InitialParticle_Measured();
166  auto locParticles = Get_UseKinFitResultsFlag() ? locParticleComboStep->Get_FinalParticles() : locParticleComboStep->Get_FinalParticles_Measured();
167  double locBeamPhotonTime = locBeamPhoton->time();
168 
169  // detector matches for charged track -to- shower matching
170  const DDetectorMatches* locDetectorMatches = NULL;
171  locEventLoop->GetSingle(locDetectorMatches);
172 
173  // get all charged tracks and showers for comparison to combo (no "pre-select" cut here)
174  vector<const DChargedTrack*> locChargedTracks;
175  locEventLoop->Get(locChargedTracks); //, "PreSelect");
176  vector<const DNeutralShower*> locNeutralShowers;
177  locEventLoop->Get(locNeutralShowers); //, "PreSelect");
178 
179  // loop over charged tracks to make list of unused
180  for(size_t loc_j = 0; loc_j < locChargedTracks.size(); ++loc_j) {
181  int nMatched = 0;
182 
183  // add tracks not in combo to vector of unused tracks
184  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i) {
185  if(locParticles[loc_i]->PID() != Proton) continue;
186 
187  const DChargedTrack* locChargedTrack = static_cast<const DChargedTrack*>(locParticleComboStep->Get_FinalParticle_SourceObject(loc_i));
188  if(locChargedTrack == NULL) continue; // should never happen
189  if(locChargedTracks[loc_j]->candidateid == locChargedTrack->candidateid) {
190  nMatched++;
191  FillTrack(locChargedTracks[loc_j], true);
192  }
193  }
194 
195  // plot properties of unused charged tracks
196  if(nMatched==0) {
197  FillTrack(locChargedTracks[loc_j], false);
198  }
199  }
200 
201  int nUnmatchedFCAL = 0;
202  int nUnmatchedBCAL = 0;
203 
204  /////////////////////////////////////////////////////////////////////////////////////////
205  // loop over neutral showers which should all be unused (unless bad matching criteria) //
206  /////////////////////////////////////////////////////////////////////////////////////////
207  for(size_t loc_j = 0; loc_j < locNeutralShowers.size(); ++loc_j) {
208  int nMatched = 0;
209 
210  // compare shower to pi+pi- in DReaction
211  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i) {
212  if(locParticles[loc_i]->PID() == Proton) continue;
213 
214  const DNeutralShower* locNeutralShower = static_cast<const DNeutralShower*>(locParticleComboStep->Get_FinalParticle_SourceObject(loc_i));
215  if(locNeutralShower == locNeutralShowers[loc_j]){
216  nMatched++;
217  double locFlightTime = locNeutralShowers[loc_j]->dSpacetimeVertex.Vect().Mag()/SPEED_OF_LIGHT;
218  FillShower(locNeutralShowers[loc_j], true, locBeamPhotonTime, locFlightTime);
219  }
220  }
221 
222  if(nMatched==0) {
223  double locFlightTime = locNeutralShowers[loc_j]->dSpacetimeVertex.Vect().Mag()/SPEED_OF_LIGHT;
224  FillShower(locNeutralShowers[loc_j], false, locBeamPhotonTime, locFlightTime);
225  if(locNeutralShowers[loc_j]->dDetectorSystem == SYS_FCAL) nUnmatchedFCAL++;
226  if(locNeutralShowers[loc_j]->dDetectorSystem == SYS_BCAL) nUnmatchedBCAL++;
227  }
228  }
229 
230  //FILL HISTOGRAMS
231  //Since we are filling histograms local to this action, it will not interfere with other ROOT operations: can use action-wide ROOT lock
232  //Note, the mutex is unique to this DReaction + action_string combo: actions of same class with different hists will have a different mutex
233  Lock_Action(); //ACQUIRE ROOT LOCK!!
234  {
235  dNShowerBCAL_FCAL->Fill(nUnmatchedFCAL, nUnmatchedBCAL);
236  }
237  Unlock_Action(); //RELEASE ROOT LOCK!!
238 
239  return true; //return false if you want to use this action to apply a cut (and it fails the cut!)
240 }
241 
242 
243 void DCustomAction_p2gamma_unusedHists::FillTrack(const DChargedTrack* locChargedTrack, bool locMatch)
244 {
245 
246  const DChargedTrackHypothesis* locChargedTrackHypothesis = locChargedTrack->Get_BestFOM();
247  int locCharge = locChargedTrackHypothesis->charge();
248 
249  auto locTrackTimeBased = locChargedTrackHypothesis->Get_TrackTimeBased();
250 
251  float nHits = locTrackTimeBased->Ndof + 5.;
252 
253  /* Number of possible hits not implemented yet? Always returns 0
254  float nPoss = locTrackTimeBased->cdc_hit_usage.total_hits + locTrackTimeBased->fdc_hit_usage.total_hits;
255  float fitFrac = 0;
256  if(nPoss > 0.) fitFrac = nHits/nPoss;
257  else cout<<nPoss<<" "<<nHits<<endl;
258  */
259 
260  //FILL HISTOGRAMS
261  //Since we are filling histograms local to this action, it will not interfere with other ROOT operations: can use action-wide ROOT lock
262  //Note, the mutex is unique to this DReaction + action_string combo: actions of same class with different hists will have a different mutex
263  Lock_Action(); //ACQUIRE ROOT LOCK!!
264  {
265  dHistMap_TrackNhits_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), nHits);
266  dHistMap_TrackChiSq_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), locTrackTimeBased->chisq);
267  dHistMap_TrackFOM_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), locTrackTimeBased->FOM);
268  dHistMap_TrackP_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), locTrackTimeBased->momentum().Mag());
269  dHistMap_TrackPOCAXY[locMatch][locCharge]->Fill(locTrackTimeBased->position().X(), locTrackTimeBased->position().Y());
270  dHistMap_TrackPOCAZ[locMatch][locCharge]->Fill(locTrackTimeBased->position().Z());
271 
272  //dHistMap_TrackNposs_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), nPoss);
273  //dHistMap_TrackHitFrac_Theta[locMatch][locCharge]->Fill(locTrackTimeBased->momentum().Theta()*180/TMath::Pi(), fitFrac);
274  }
275  Unlock_Action(); //RELEASE ROOT LOCK!!
276 
277  return;
278 }
279 
280 
281 void DCustomAction_p2gamma_unusedHists::FillShower(const DNeutralShower* locNeutralShower, bool locMatch, double locBeamPhotonTime, double locFlightTime)
282 {
283 
284  int nClusters = 0;
285  int nHits = 0;
286 
287  double layerE[4] = {0., 0., 0., 0.};
288 
289  double locEnergy = locNeutralShower->dEnergy;
290  DVector3 locPosition = locNeutralShower->dSpacetimeVertex.Vect();
291  double locDeltaT = locNeutralShower->dSpacetimeVertex.T() - locFlightTime - locBeamPhotonTime;
292 
293  double locEnergyCluster = 0.;
294  double locMaxEnergyCluster = 0.;
295 
296  DetectorSystem_t locSystem = locNeutralShower->dDetectorSystem;
297  if(locSystem == SYS_FCAL) {
298 
299  const DFCALShower* locFCALShower = NULL;
300  locNeutralShower->GetSingleT(locFCALShower);
301 
302  vector<const DFCALCluster*> locFCALClusters;
303  locFCALShower->Get(locFCALClusters);
304  nClusters = locFCALClusters.size();
305 
306  // get hits in FCAL shower
307  for(unsigned int i=0; i<locFCALClusters.size(); i++){
308  const vector<DFCALCluster::DFCALClusterHit_t> locFCALHits = locFCALClusters[i]->GetHits();
309 
310  locEnergyCluster = locFCALClusters[i]->getEnergy();
311  locMaxEnergyCluster = locFCALClusters[i]->getEmax();
312 
313  for(unsigned int j=0; j<locFCALHits.size(); j++){
314 // const DFCALCluster::DFCALClusterHit_t hit = locFCALHits[j];
315  nHits++;
316  }
317  }
318  }
319  if(locSystem == SYS_BCAL) {
320 
321  const DBCALShower* locBCALShower = NULL;
322  locNeutralShower->GetSingleT(locBCALShower);
323 
324  //FILL HISTOGRAMS
325  //Since we are filling histograms local to this action, it will not interfere with other ROOT operations: can use action-wide ROOT lock
326  //Note, the mutex is unique to this DReaction + action_string combo: actions of same class with different hists will have a different mutex
327  Lock_Action(); //ACQUIRE ROOT LOCK!!
328  {
329  dHistMap_BCALShowerNcell[locMatch]->Fill(locBCALShower->N_cell);
330  }
331  Unlock_Action(); //RELEASE ROOT LOCK!!
332 
333  vector<const DBCALCluster*> locBCALClusters;
334  locBCALShower->Get(locBCALClusters);
335  nClusters = locBCALClusters.size();
336 
337  // get points in BCAL shower
338  for(unsigned int i=0; i<locBCALClusters.size(); i++){
339  vector<const DBCALPoint*> locBCALPoints;
340  locBCALClusters[i]->Get(locBCALPoints);
341 
342  locEnergyCluster = locBCALClusters[i]->E();
343  if(locBCALPoints.size() == 1) locMaxEnergyCluster = locBCALClusters[i]->E();
344 
345  for(unsigned int j=0; j<locBCALPoints.size(); j++){
346  const DBCALPoint *point = locBCALPoints[j];
347  nHits++;
348 
349  if(point->E() > locMaxEnergyCluster)
350  locMaxEnergyCluster = point->E();
351 
352  layerE[point->layer()-1] += point->E();
353  }
354  }
355  }
356 
357  //FILL HISTOGRAMS
358  //Since we are filling histograms local to this action, it will not interfere with other ROOT operations: can use action-wide ROOT lock
359  //Note, the mutex is unique to this DReaction + action_string combo: actions of same class with different hists will have a different mutex
360  Lock_Action(); //ACQUIRE ROOT LOCK!!
361  {
362  dHistMap_ShowerEnergy_Theta[locMatch][locSystem]->Fill(locPosition.Theta()*180./TMath::Pi(), locEnergy);
363  dHistMap_ShowerPhi_Theta[locMatch][locSystem]->Fill(locPosition.Theta()*180./TMath::Pi(), locPosition.Phi()*180./TMath::Pi());
364  dHistMap_ShowerNclusters[locMatch][locSystem]->Fill(nClusters);
365  dHistMap_ShowerNhits[locMatch][locSystem]->Fill(nHits);
366 
367  dHistMap_ShowerMaxEnergy_Nhits[locMatch][locSystem]->Fill(nHits, locMaxEnergyCluster/locEnergyCluster);
368  dHistMap_ShowerDeltaT_Nhits[locMatch][locSystem]->Fill(nHits, locDeltaT);
369  dHistMap_ShowerDeltaT_E[locMatch][locSystem]->Fill(locEnergy, locDeltaT);
370  if(locDeltaT > -5. && locDeltaT < 5. && locSystem == SYS_FCAL)
371  dHistMap_ShowerE_Theta[locMatch][locSystem]->Fill(locPosition.Theta()*180./TMath::Pi(), locEnergy);
372  if(locDeltaT > -5. && locDeltaT < 5. && locSystem == SYS_BCAL)
373  dHistMap_ShowerE_Theta[locMatch][locSystem]->Fill(locPosition.Theta()*180./TMath::Pi(), locEnergy);
374 
375  if(locSystem == SYS_BCAL) {
376  dHistMap_Layer1Energy_Theta[locMatch]->Fill(locPosition.Theta()*180./TMath::Pi(), layerE[0]/locEnergy);
377  dHistMap_Layer2Energy_Theta[locMatch]->Fill(locPosition.Theta()*180./TMath::Pi(), layerE[1]/locEnergy);
378  dHistMap_Layer3Energy_Theta[locMatch]->Fill(locPosition.Theta()*180./TMath::Pi(), layerE[2]/locEnergy);
379  dHistMap_Layer4Energy_Theta[locMatch]->Fill(locPosition.Theta()*180./TMath::Pi(), layerE[3]/locEnergy);
380  }
381 
382  }
383  Unlock_Action(); //RELEASE ROOT LOCK!!
384 
385  return;
386 }
387 
388 
389 /*
390 
391  // loop over neutral showers to make list of unused showers
392  for(size_t loc_j = 0; loc_j < locNeutralShowers.size(); ++loc_j) {
393  int nMatched = 0;
394 
395  // add showers not matched to tracks in combo to vector of unused showers
396  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i) {
397 
398  const DChargedTrack* locChargedTrack = static_cast<const DChargedTrack*>(locParticleComboStep->Get_FinalParticle_SourceObject(loc_i));
399  if(locChargedTrack == NULL) continue; // should never happen
400 
401  const DChargedTrackHypothesis* locChargedTrackHypothesis = locChargedTrack->Get_BestFOM();
402  auto locTrackTimeBased = locChargedTrackHypothesis->Get_TrackTimeBased();
403 
404  if(locNeutralShowers[loc_j]->dDetectorSystem == SYS_FCAL) {
405  DFCALShowerMatchParams locFCALShowerMatchParams;
406  bool foundFCAL = dParticleID->Get_BestFCALMatchParams(locTrackTimeBased, locDetectorMatches, locFCALShowerMatchParams);
407  if(foundFCAL){
408  const DFCALShower *locFCALShower = NULL;
409  locNeutralShowers[loc_j]->GetSingleT(locFCALShower);
410 
411  if(locFCALShowerMatchParams.dFCALShower == locFCALShower) {
412  nMatched++;
413  FillShower(locNeutralShowers[loc_j], true, locBeamPhotonTime);
414  }
415  }
416  }
417  if(locNeutralShowers[loc_j]->dDetectorSystem == SYS_BCAL) {
418  DBCALShowerMatchParams locBCALShowerMatchParams;
419  bool foundBCAL = dParticleID->Get_BestBCALMatchParams(locTrackTimeBased, locDetectorMatches, locBCALShowerMatchParams);
420  if(foundBCAL){
421  const DBCALShower *locBCALShower = NULL;
422  locNeutralShowers[loc_j]->GetSingleT(locBCALShower);
423 
424  if(locBCALShowerMatchParams.dBCALShower == locBCALShower) {
425  nMatched++;
426  FillShower(locNeutralShowers[loc_j], true, locBeamPhotonTime);
427  }
428  }
429  }
430  }
431 
432 
433  // plot properties of unused showers
434  if(nMatched==0) {
435 
436  }
437 */
vector< const DKinematicData * > Get_FinalParticles_Measured(void) const
TDirectoryFile * ChangeTo_BaseDirectory(void)
void FillShower(const DNeutralShower *locNeutralShower, bool locMatch, double locBeamPhotonTime, double locFlightTime)
#define SPEED_OF_LIGHT
TVector3 DVector3
Definition: DVector3.h:14
map< bool, map< DetectorSystem_t, TH1I * > > dHistMap_ShowerNhits
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerDeltaT_Nhits
const DTrackTimeBased * Get_TrackTimeBased(void) const
TDirectoryFile * CreateAndChangeTo_ActionDirectory(void)
DetectorSystem_t
Definition: GlueX.h:15
const DKinematicData * Get_InitialParticle_Measured(void) const
int layer() const
Definition: DBCALPoint.h:65
bool Get_UseKinFitResultsFlag(void) const
Definition: GlueX.h:19
JApplication * japp
DetectorSystem_t dDetectorSystem
DLorentzVector dSpacetimeVertex
map< bool, map< DetectorSystem_t, TH1I * > > dHistMap_ShowerNclusters
map< bool, map< int, TH2I * > > dHistMap_TrackChiSq_Theta
map< bool, map< int, TH1I * > > dHistMap_TrackPOCAZ
float E() const
Definition: DBCALPoint.h:38
bool Perform_Action(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo)
void FillTrack(const DChargedTrack *locChargedTrack, bool locMatch)
Definition: GlueX.h:22
vector< const DKinematicData * > Get_FinalParticles(void) const
int Ndof
Number of degrees of freedom in the fit.
double charge(void) const
map< bool, map< int, TH2I * > > dHistMap_TrackFOM_Theta
const JObject * Get_FinalParticle_SourceObject(size_t locFinalParticleIndex) const
const DKinematicData * Get_InitialParticle(void) const
map< bool, map< int, TH2I * > > dHistMap_TrackNhits_Theta
map< bool, map< int, TH2I * > > dHistMap_TrackP_Theta
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerE_Theta
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerDeltaT_E
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerEnergy_Theta
map< bool, map< int, TH2I * > > dHistMap_TrackPOCAXY
const DChargedTrackHypothesis * Get_BestFOM(void) const
Definition: DChargedTrack.h:69
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerMaxEnergy_Nhits
const DParticleComboStep * Get_ParticleComboStep(size_t locStepIndex) const
map< bool, map< DetectorSystem_t, TH2I * > > dHistMap_ShowerPhi_Theta