Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JEventProcessor_CCAL_online.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: JEventProcessor_CCAL_online.cc
4 // Created: Fri Nov 9 11:58:09 EST 2012
5 // Creator: wolin (on Linux stan.jlab.org 2.6.32-279.11.1.el6.x86_64 x86_64)
6 //
7 
8 #include <stdint.h>
9 #include <vector>
10 #include <iostream>
12 #include <JANA/JApplication.h>
13 
14 #include <CCAL/DCCALDigiHit.h>
15 #include <CCAL/DCCALHit.h>
16 #include <CCAL/DCCALGeometry.h>
17 #include <CCAL/DCCALShower.h>
18 
19 #include <FCAL/DFCALShower.h>
20 
21 #include <PID/DBeamPhoton.h>
22 
23 #include <DAQ/Df250PulseIntegral.h>
24 #include <DAQ/Df250PulsePedestal.h>
25 #include <DAQ/Df250PulseData.h>
26 
27 #include "units.h"
28 #include "DLorentzVector.h"
29 #include "DVector3.h"
30 #include "HDGEOMETRY/DGeometry.h"
31 #include "DANA/DApplication.h"
32 #include "DANA/DStatusBits.h"
33 #include "TRIGGER/DL1Trigger.h"
34 #include "TRIGGER/DTrigger.h"
35 
36 #include <TDirectory.h>
37 #include <TH2F.h>
38 #include <TH1I.h>
39 #include <TH2I.h>
40 #include <TProfile.h>
41 #include <TProfile2D.h>
42 
43 using namespace std;
44 using namespace jana;
45 
46 
47 //----------------------------------------------------------------------------------
48 
49 
50 // Routine used to create our JEventProcessor
51 extern "C"{
52  void InitPlugin(JApplication *app){
53  InitJANAPlugin(app);
54  app->AddProcessor(new JEventProcessor_CCAL_online());
55  }
56 }
57 
58 
59 //----------------------------------------------------------------------------------
60 
61 
63 }
64 
65 
66 //----------------------------------------------------------------------------------
67 
68 
70 }
71 
72 
73 //----------------------------------------------------------------------------------
74 
76 
77  // create root folder for fcal and cd to it, store main dir
78  TDirectory *main = gDirectory;
79  gDirectory->mkdir("ccal")->cd();
80 
81  ccal_num_events = new TH1D("ccal_num_events","CCAL Number of Events",1,0.5,1.5);
82 
83  // CCALDigiHit Plots
84 
85  hdigN = new TH1I("digN", "CCAL Number of DigiHits; Number of DigiHits; Events", 144, 0, 144 );
86  hdigOcc2D = new TH2F("digOcc2D", "CCAL DigiHit Occupancy; column; row", 12, -0.5, 11.5, 12, -0.5, 11.5 );
87  hdigInt = new TH1I("digInt", "CCAL Pulse Integral", 300, 0, 30000);
88  hdigPeak = new TH1I("digPeak", "CCAL Pulse Peak", 300, 0, 5000);
89  hdigT = new TH1I("digT", "CCAL Pulse Time; Time [4 ns]; Pulses / ns", 4096, 0, 4096);
90  hdigPed = new TH1I("digPed", "CCAL Pedestal (All Channels); ADC Counts; Pulses / 10 Counts", 100, 0, 1000);
91  hdigPedChan = new TProfile("digPedChan", "CCAL Pedestal vs. Channel; ccal id; Average Pedestal [ADC Counts]", 144, -0.5, 143.5);
92  hdigPed2D = new TH2F("digPed2D", "CCAL Pedestals [ADC Counts]; column; row",12, -0.5, 11.5, 12, -0.5, 11.5);
93  hdigPedSq2D = new TH2F("digPedSq2D", "CCAL Pedestals Squared [ADC Counts]; column; row", 12, -0.5, 11.5, 12, -0.5, 11.5);
94  hdigIntVsPeak = new TH2I("digIntVsPeak", "CCAL Pulse Integral vs. Peak Sample; Peak Sample [ADC Units]; Integral [ADC Units]", 200, 0, 4000, 200, 0, 40000 );
95  hdigQF = new TH1I("digQual", "CCAL Hit Quality; Quality Factor Index; Number of Pulses", 16, -0.5, 15.5 );
96 
97 
98 
99  // CCALHit Plots
100 
101  hhitN = new TH1I("hitN", "CCAL Number of Hits; Number of Hits; Events", 144, 0, 144 );
102  hhitE = new TH1I("hitE", "CCAL Hit Energy; Energy [MeV]; Hits / 100 MeV", 100, 0, 10000 );
103  hhitETot = new TH1I("hitETot", "CCAL Hit Total Energy; Energy [MeV]; Events / 100 MeV", 120, 0, 12000 );
104  hhitiop = new TH1I("hitiop", "CCAL Pulse Integral over Peak", 300, 0, 300);
105  hhitT = new TH1I("hitT", "CCAL Hit Time; t [ns]; Hits / 4 ns", 100, -100, 300 );
106  hhitE2D = new TH2F("hitE2D", "CCAL Hit Average Energy [MeV]; column; row", 12, -0.5, 11.5, 12, -0.5, 11.5 );
107  hhitOcc2D = new TH2F("hitOcc2D", "CCAL Hit Occupancy; column; row", 12, -0.5, 11.5, 12, -0.5, 11.5 );
108 
109 
110 
111  // CCALShower Plots
112 
113  hclusN = new TH1I("clusN", "CCAL Number of Clusters; Number of Clusters; Events", 10, -0.5, 9.5 );
114  hclusE = new TH1I("clusE", "CCAL Cluster Energy; Energy [MeV]; Clusters / 50 MeV", 100, 0, 15000 );
115  hclusETot = new TH1I("clusETot", "CCAL Cluster Total Energy; Energy [MeV]; Events / 100 MeV", 100, 0, 15000 );
116  hclusT = new TH1I("clusT", "CCAL Cluster Time; t [ns]; Clusters / 4 ns", 100, -100, 300 );
117  hclusDime = new TH1I("clusDime", "CCAL Cluster Dimension; Modules in Cluster", 50, -0.5, 49.5);
118  hclusXYHigh = new TH2I("clusXYHigh", "CCAL Cluster Positions (E > 200 MeV); x [cm]; y [cm]", 100, -12.5, 12.5, 100, -12.5, 12.5 );
119  hclusXYLow = new TH2I("clusXYLow", "CCAL Cluster Positions (E < 200 MeV); x [cm]; y [cm]", 100, -12.5, 12.5, 100, -12.5, 12.5 );
120  hclusPhi = new TH1I("clusPhi", "CCAL Cluster #phi; #phi [rad]; Clusters / 62.8 mrad", 100, -3.14, 3.14 );
121  hclusPhi->SetMinimum( 0 );
122  hclus2GMass = new TH1I( "clus2GMass", "CCAL 2 Cluster Invariant Mass E > 1 GeV; Invariant Mass [GeV]", 500, 0.0, 0.6 );
123  hclus2GMass_fcal = new TH1I("clus2GMass_fcal", "Invariant Mass, 1 CCAL & 1 FCAL Cluster E > 1 GeV; Invariant Mass [GeV]", 500, 0.0, 0.6 );
124  hclusOccEmax = new TH2I("clusOccEmax","Occupancy when E_{max} > 3 GeV and E_{cl}-E_{max} < 1.0 GeV; column; row", 12, -0.5, 11.5, 12, -0.5, 11.5);
125 
126  // Compton Plots
127 
128  hcomp_bfdt = new TH1F("comp_bfdt","FCAL Shower Time - Beam Time; t_{fcal}-t_{beam} [ns]; Counts / 0.5 ns", 400, -100., 100.);
129  hcomp_fcdt = new TH1F("comp_fcdt","CCAL Time - FCAL Time; t_{fcal}-t_{ccal} [ns]; Counts / 0.5 ns", 400, -100., 100.);
130  hcomp_bcdt_full = new TH1F("comp_bcdt_full","CCAL Shower Time - Beam Time (No Cuts); t_{ccal}-t_{beam} [ns]; Counts / 0.5 ns", 400, -100., 100.);
131 
132  hcomp_cratio = new TH1F("comp_cratio", "CCAL Energy over Calculated Compton Energy; #frac{E_{ccal}}{E_{comp}}", 200, 0., 2.);
133  hcomp_cfbratio = new TH1F("comp_cfbratio", "Energy Conservation; #frac{E_{ccal}+E_{fcal}-E_{beam}}{E_{beam}}", 200, -1., 1.);
134  hcomp_cfb2d = new TH2F("comp_cfb2d", "Reconstructed Energy vs. Calculated Compton Energy; #frac{E_{ccal,comp}+E_{fcal,comp}}{E_{beam}}; #frac{E_{ccal}+E_{fcal}}{E_{beam}}", 200, 0., 1.5, 200, 0., 1.5);
135  hcomp_pfpc = new TH1F("comp_pfpc", "FCAL - CCAL Azimuthal Angle; #phi_{fcal}-#phi_{ccal} [deg]; Counts / 0.5 degrees", 1440, -360., 360.);
136  hcomp_cxy = new TH2F("comp_cxy","Reconstructed Compton Positions in CCAL; x_{ccal} [cm]; y_{ccal} [cm]", 200, -12.5, 12.5, 200, -12.5, 12.5);
137  hcomp_fxy = new TH2F("comp_fxy","Reconstructed Compton Positions in FCAL; x_{fcal} [cm]; y_{fcal} [cm]", 200, -30., 30., 200, -30., 30.);
138  hcomp_bcdt = new TH1F("comp_bcdt","CCAL Shower Time - Beam Time; t_{ccal}-t_{beam} [ns]; Counts / 0.5 ns", 400, -100., 100.);
139 
140  hcomp_cratio_bkgd = new TH1F("comp_cratio_bkgd", "CCAL Energy over Calculated Compton Energy (Accidentals); #frac{E_{ccal}}{E_{comp}}", 200, 0., 2.);
141  hcomp_cfbratio_bkgd = new TH1F("comp_cfbratio_bkgd", "Energy Conservation (Accidentals); #frac{E_{ccal}+E_{fcal}-E_{beam}}{E_{beam}}", 200, -1., 1.);
142  hcomp_cfb2d_bkgd = new TH2F("comp_cfb2d_bkgd", "Reconstructed Energy vs. Calculated Compton Energy (Accidentals); #frac{E_{ccal,comp}+E_{fcal,comp}}{E_{beam}}; #frac{E_{ccal}+E_{fcal}}{E_{beam}}", 200, 0., 1.5, 200, 0., 1.5);
143  hcomp_pfpc_bkgd = new TH1F("comp_pfpc_bkgd", "FCAL - CCAL Azimuthal Angle (Accidentals); #phi_{fcal}-#phi_{ccal} [deg]; Counts / 0.5 degrees", 1440, -360., 360.);
144  hcomp_cxy_bkgd = new TH2F("comp_cxy_bkgd","Reconstructed Compton Positions in CCAL (Accidentals); x_{ccal} [cm]; y_{ccal} [cm]", 200, -12.5, 12.5, 200, -12.5, 12.5);
145  hcomp_fxy_bkgd = new TH2F("comp_fxy_bkgd","Reconstructed Compton Positions in FCAL (Accidentals); x_{fcal} [cm]; y_{fcal} [cm]", 200, -30., 30., 200, -30., 30.);
146  hcomp_bcdt_bkgd = new TH1F("comp_bcdt_bkgd","CCAL Shower Time - Beam Time (Accidentals); t_{ccal}-t_{beam} [ns]; Counts / 0.5 ns", 400, -100., 100.);
147 
148  hfcalOcc = new TH2F("fcalOcc","FCAL Occupancy for events > 0.5 GeV; x_{fcal} [cm]; y_{fcal} [cm]", 200, -30., 30., 200, -30., 30.);
149 
150  hNPhotons = new TH1I("NPhotons","Number of Beam Photons per Event",80,-0.5,79.5);
151 
152  // back to main dir
153  main->cd();
154 
155  return NOERROR;
156 }
157 
158 
159 //----------------------------------------------------------------------------------
160 
161 
162 jerror_t JEventProcessor_CCAL_online::brun(JEventLoop *eventLoop, int32_t runnumber) {
163  // This is called whenever the run number changes
164 
165  DGeometry *dgeom = NULL;
166  DApplication *dapp = dynamic_cast< DApplication* >( eventLoop->GetJApplication() );
167  if( dapp ) dgeom = dapp->GetDGeometry( runnumber );
168 
169  if( dgeom ){
170 
171  dgeom->GetTargetZ( m_targetZ );
172 
173  }
174  else{
175 
176  cerr << "No geometry accessbile to CCAL_online monitoring plugin." << endl;
177  return RESOURCE_UNAVAILABLE;
178  }
179 
180  vector< double > ccal_gains_ch;
181  eventLoop->GetCalib("/CCAL/gains",ccal_gains_ch);
182  for(unsigned int ii=0; ii<ccal_gains_ch.size(); ii++) {
183  cout << ii << " " << ccal_gains_ch[ii] << endl;
184  }
185 
186  return NOERROR;
187 }
188 
189 
190 //----------------------------------------------------------------------------------
191 
192 
193 jerror_t JEventProcessor_CCAL_online::evnt(JEventLoop *eventLoop, uint64_t eventnumber) {
194 
195 
196  vector< const DCCALGeometry* > geomVec;
197  vector< const DCCALDigiHit* > digiHits;
198  vector< const DCCALHit* > hits;
199  vector< const DCCALShower* > CCALshowerVec;
200  vector< const DFCALShower* > FCALshowerVec;
201  vector< const DBeamPhoton* > beam_photons;
202 
203 
204  //------------------------------------------------------------------
205  // First check that this is not a front panel trigger or no trigger
206 
207  bool goodtrigger=1;
208 
209  const DL1Trigger *trig = NULL;
210  const DTrigger *dtrig = NULL;
211  try {
212  eventLoop->GetSingle(trig);
213  eventLoop->GetSingle(dtrig);
214  } catch (...) {}
215  if (trig) {
216  if (trig->fp_trig_mask){
217  goodtrigger=0;
218  }
219  else if(!(dtrig->Get_IsPhysicsEvent())){
220  goodtrigger=0;
221  }
222  } else {
223  // HDDM files are from simulation, so keep them even though they have no trigger
224  bool locIsHDDMEvent = eventLoop->GetJEvent().GetStatusBit(kSTATUS_HDDM);
225  if (!locIsHDDMEvent) goodtrigger=0;
226  }
227 
228  if (!goodtrigger) {
229  return NOERROR;
230  }
231 
232  //------------------------------------------------------------------
233  // Get data objects
234 
235  eventLoop->Get( geomVec );
236  eventLoop->Get( digiHits );
237  eventLoop->Get( hits );
238  if( hits.size() <= 50 ) {
239  eventLoop->Get( CCALshowerVec );
240  eventLoop->Get( FCALshowerVec );
241  eventLoop->Get( beam_photons );
242  }
243  const DCCALGeometry& ccalGeom = *(geomVec[0]);
244 
245 
246 
247  float hitETot = 0., showETot = 0.;
248  for( vector< const DCCALHit*>::const_iterator hitItr = hits.begin();
249  hitItr != hits.end(); ++hitItr ) { hitETot += (**hitItr).E; }
250  for( vector< const DCCALShower*>::const_iterator showItr = CCALshowerVec.begin();
251  showItr != CCALshowerVec.end(); ++showItr ) { showETot += (**showItr).E; }
252 
253 
254 
255  // FILL HISTOGRAMS
256  // Since we are filling histograms local to this plugin, it will not interfere with other ROOT operations: can use plugin-wide ROOT fill lock
257  japp->RootFillLock(this); //ACQUIRE ROOT FILL LOCK
258 
259  //----------------------------------------------------------------------------------
260  // Fill DigiHit-Level plots
261 
262 
263  if( digiHits.size() > 0 )
264  ccal_num_events->Fill(1);
265 
266  hdigN->Fill( digiHits.size() );
267 
268  for( vector< const DCCALDigiHit* >::const_iterator dHitItr = digiHits.begin();
269  dHitItr != digiHits.end(); ++dHitItr ) {
270 
271  const DCCALDigiHit& dHit = (**dHitItr);
272  int chan = ccalGeom.channel( dHit.row, dHit.column );
273 
274  hdigOcc2D->Fill( dHit.column, dHit.row );
275  hdigInt->Fill( dHit.pulse_integral );
276  hdigPeak->Fill( dHit.pulse_peak );
277  hdigT->Fill( dHit.pulse_time );
278  hdigPed->Fill( dHit.pedestal );
279  hdigPedChan->Fill( chan, dHit.pedestal );
280  hdigPed2D->Fill( dHit.column, dHit.row, dHit.pedestal );
281  hdigPedSq2D->Fill( dHit.column, dHit.row, dHit.pedestal*dHit.pedestal );
282  hdigQF->Fill( dHit.QF );
283  hdigIntVsPeak->Fill( dHit.pulse_peak, dHit.pulse_integral );
284 
285  }
286 
287 
288  //----------------------------------------------------------------------------------
289  // Fill Hit-Level plots
290 
291 
292  hhitETot->Fill( hitETot );
293  hhitN->Fill( hits.size() );
294 
295  for( vector< const DCCALHit* >::const_iterator hit_itr = hits.begin();
296  hit_itr != hits.end(); ++hit_itr ){
297 
298  const DCCALHit& hit = (**hit_itr);
299 
300  hhitE->Fill( hit.E );
301  hhitT->Fill( hit.t*k_to_nsec );
302  hhitOcc2D->Fill( hit.column, hit.row );
303  hhitiop->Fill( hit.intOverPeak );
304  hhitE2D->Fill( hit.column, hit.row, hit.E );
305 
306  }
307 
308 
309 
310  // for events with a lot of hits -- stop now
311 
312  if( hits.size() > 50 ){
313  japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK
314  return NOERROR;
315  }
316 
317  //
318  // if there are a small number of hits go ahead
319  // and run the clusterizer and make a few plots
320  // utilizing the list of clusters and showers
321  //
322 
323 
324 
325  //----------------------------------------------------------------------------------
326  // Fill Shower-Level plots
327 
328  hclusN->Fill( CCALshowerVec.size() );
329 
330  if( CCALshowerVec.size() > 0 )
331  hclusETot->Fill( showETot * k_to_MeV );
332 
333  for( vector< const DCCALShower*>::const_iterator showItr = CCALshowerVec.begin();
334  showItr != CCALshowerVec.end(); ++showItr ){
335 
336  const DCCALShower& shower = (**showItr);
337 
338  double showX = shower.x1;
339  double showY = shower.y1;
340  double showR = sqrt( showX*showX + showY*showY );
341  double showE = shower.E;
342  double showEmax = shower.Emax;
343  int idmax = shower.idmax;
344  int ccal_col = idmax%12;
345  int ccal_row = idmax/12;
346 
347  DVector3 show1Mom;
348  show1Mom.SetX( showX );
349  show1Mom.SetY( showY );
350  show1Mom.SetZ( ZCCAL );
351  show1Mom.SetMag( showE );
352 
353  hclusPhi->Fill( show1Mom.Phi() );
354  hclusE->Fill( showE * k_to_MeV );
355  hclusT->Fill( shower.time );
356  hclusDime->Fill( shower.dime );
357 
358  if( showE > 200*k_MeV )
359  hclusXYHigh->Fill( showX, showY );
360  else
361  hclusXYLow->Fill( showX, showY );
362 
363  if( (showEmax > 3.0) && (showE - showEmax < 1.0) )
364  hclusOccEmax->Fill( ccal_col, ccal_row );
365 
366  if( ( showE < 1*k_GeV ) ||
367  ( showR < 8*k_cm ) ||
368  ( shower.dime < 2 )
369  ) continue;
370 
371  for( vector< const DCCALShower*>::const_iterator show2Itr = showItr + 1;
372  show2Itr != CCALshowerVec.end(); ++show2Itr ){
373 
374  const DCCALShower& shower2 = (**show2Itr);
375 
376  double show2X = shower2.x;
377  double show2Y = shower2.y;
378 
379  double show2R = sqrt( show2X * show2X + show2Y * show2Y );
380 
381  if( ( shower2.E < 1*k_GeV ) ||
382  ( show2R < 8*k_cm ) ||
383  ( shower2.dime < 2 )
384  ) continue;
385 
386  DVector3 show2Mom;
387  show2Mom.SetX( show2X );
388  show2Mom.SetY( show2Y );
389  show2Mom.SetZ( ZCCAL );
390  show2Mom.SetMag( shower2.E );
391 
392  DLorentzVector gam1( show1Mom, show1Mom.Mag() );
393  DLorentzVector gam2( show2Mom, show2Mom.Mag() );
394 
395  hclus2GMass->Fill( ( gam1 + gam2 ).M() );
396  }
397  }
398 
399 
400  //----------------------------------------------------------------------------------
401  // FCAL + CCAL Invariant mass:
402 
403  for( vector< const DFCALShower*>::const_iterator showFItr = FCALshowerVec.begin();
404  showFItr != FCALshowerVec.end(); ++showFItr ){
405 
406  const DFCALShower& showF = (**showFItr);
407 
408  DVector3 showFMom = showF.getPosition();
409  showFMom.SetZ( showFMom.Z() - m_targetZ );
410  showFMom.SetMag( showF.getEnergy() );
411 
412  if( ( showF.getEnergy() < 1*k_GeV ) ||
413  ( showF.getPosition().Pt() < 10*k_cm ) ) continue;
414 
415  for( vector< const DCCALShower*>::const_iterator showCItr = CCALshowerVec.begin();
416  showCItr != CCALshowerVec.end(); ++showCItr ){
417 
418  const DCCALShower& showC = (**showCItr);
419 
420  double showCX = showC.x1;
421  double showCY = showC.y1;
422  double showCR = sqrt( showCX*showCX + showCY*showCY );
423 
424  DVector3 showCMom;
425  showCMom.SetX( showCX );
426  showCMom.SetY( showCY );
427  showCMom.SetZ( ZCCAL );
428  showCMom.SetMag( showC.E );
429 
430  if( ( showC.E < 1*k_GeV ) ||
431  ( showCR < 5*k_cm ) ||
432  ( showC.dime < 2 )
433  ) continue;
434 
435  DLorentzVector gam1( showFMom, showFMom.Mag() );
436  DLorentzVector gam2( showCMom, showCMom.Mag() );
437 
438  hclus2GMass->Fill( ( gam1 + gam2 ).M() );
439  }
440  }
441 
442 
443  //----------------------------------------------------------------------------------
444  // compton analysis:
445 
446  hNPhotons->Fill( beam_photons.size() );
447  for(unsigned int ib = 0; ib < beam_photons.size(); ++ib) {
448  const DBeamPhoton *beam_photon = beam_photons[ib];
449  double beam_e = beam_photon->lorentzMomentum().E();
450  double beam_t = beam_photon->time();
451 
452  for(unsigned int ih = 0; ih < FCALshowerVec.size(); ++ih) {
453  const DFCALShower *fcal_shower = FCALshowerVec[ih];
454  double fcal_e = fcal_shower->getEnergy();
455  double fcal_x = fcal_shower->getPosition().X();
456  double fcal_y = fcal_shower->getPosition().Y();
457  double fcal_z = fcal_shower->getPosition().Z();
458  double fcal_t = fcal_shower->getTime();
459 
460  if(fcal_e<0.5) continue;
461 
462  hfcalOcc->Fill( fcal_x, fcal_y );
463 
464  double dt_fcal_bm = fcal_t - beam_t;
465  hcomp_bfdt->Fill(dt_fcal_bm);
466 
467  double phif = atan2(fcal_y,fcal_x);
468  double rf = hypot(fcal_x,fcal_y);
469  double zf = fcal_z - m_targetZ;
470  double ecompf = 1. / ( 1./beam_e + (1.-cos(rf/zf)) / me);
471 
472  for(unsigned int ic = 0; ic < CCALshowerVec.size(); ++ic) {
473  const DCCALShower *ccal_shower = CCALshowerVec[ic];
474  double ccal_e = ccal_shower->E;
475  double ccal_x = ccal_shower->x1;
476  double ccal_y = ccal_shower->y1;
477  double ccal_t = ccal_shower->time;
478 
479  if(ccal_e<1.5) continue;
480 
481  double dt_cc_bm = ccal_t - beam_t;
482  double dt_fc_cc = ccal_t - fcal_t;
483  hcomp_fcdt->Fill( dt_fc_cc );
484  hcomp_bcdt_full->Fill( dt_cc_bm );
485 
486  double phic = atan2(ccal_y,ccal_x);
487  double rc = hypot(ccal_x,ccal_y);
488  double zc = ZCCAL - m_targetZ;
489  double ecompc = 1. / (1./beam_e + (1.-cos(rc/zc)) / me);
490 
491  if(dt_fc_cc < 15. || dt_fc_cc > 30.) continue;
492 
493  if(dt_fcal_bm > 15. && dt_fcal_bm < 23.) {
494 
495  hcomp_cratio->Fill( ccal_e/ecompc );
496  hcomp_cfbratio->Fill( (ccal_e+fcal_e-beam_e)/beam_e );
497  hcomp_cxy->Fill( ccal_x, ccal_y );
498  hcomp_fxy->Fill( fcal_x, fcal_y );
499  hcomp_cfb2d->Fill( (ecompc+ecompf)/beam_e, (ccal_e+fcal_e)/beam_e );
500  hcomp_pfpc->Fill( (phif-phic)*180./pi );
501 
502  hcomp_bcdt->Fill(dt_cc_bm);
503 
504  } else if( (dt_fcal_bm > -15. && dt_fcal_bm < 1.) || (dt_fcal_bm > 37. && dt_fcal_bm < 53.) ) {
505 
506  hcomp_cratio_bkgd->Fill( ccal_e/ecompc );
507  hcomp_cfbratio_bkgd->Fill( (ccal_e+fcal_e-beam_e)/beam_e );
508  hcomp_cxy_bkgd->Fill( ccal_x, ccal_y );
509  hcomp_fxy_bkgd->Fill( fcal_x, fcal_y );
510  hcomp_cfb2d_bkgd->Fill( (ecompc+ecompf)/beam_e, (ccal_e+fcal_e)/beam_e );
511  hcomp_pfpc_bkgd->Fill( (phif-phic)*180./pi );
512 
513  hcomp_bcdt_bkgd->Fill(dt_cc_bm);
514 
515  }
516 
517  }
518  }
519  }
520 
521  japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK
522  return NOERROR;
523 }
524 
525 
526 //----------------------------------------------------------------------------------
527 
528 
530  // This is called whenever the run number changes, before it is
531  // changed to give you a chance to clean up before processing
532  // events from the next run number.
533  return NOERROR;
534 }
535 
536 
537 //----------------------------------------------------------------------------------
538 
539 
541  // Called before program exit after event processing is finished.
542  return NOERROR;
543 }
544 
545 
546 //----------------------------------------------------------------------------------
547 //----------------------------------------------------------------------------------
float t
Definition: DCCALHit.h:27
double getEnergy() const
Definition: DFCALShower.h:156
DApplication * dapp
int row
Definition: DCCALHit.h:22
const double k_MeV
Definition: units.h:44
int channel(int row, int column) const
int column
Definition: DCCALHit.h:23
TVector3 DVector3
Definition: DVector3.h:14
uint32_t pulse_integral
identified pulse integral as returned by FPGA algorithm
Definition: DCCALDigiHit.h:20
uint32_t fp_trig_mask
Definition: DL1Trigger.h:19
double getTime() const
Definition: DFCALShower.h:161
double Emax
Definition: DCCALShower.h:46
double x
Definition: DCCALShower.h:39
double y1
Definition: DCCALShower.h:43
TLorentzVector DLorentzVector
trig[33-1]
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
JApplication * japp
const double k_to_MeV
Definition: units.h:48
jerror_t init(void)
Called once at program start.
bool Get_IsPhysicsEvent(void) const
Definition: fcal_t.h:19
double time(void) const
uint32_t pedestal
pedestal info used by FPGA (if any)
Definition: DCCALDigiHit.h:22
double y
Definition: DCCALShower.h:40
const double k_cm
Definition: units.h:14
const double k_GeV
Definition: units.h:43
InitPlugin_t InitPlugin
static evioFileChannel * chan
DGeometry * GetDGeometry(unsigned int run_number)
double x1
Definition: DCCALShower.h:42
jerror_t fini(void)
Called after last event of last event source has been processed.
double E
Definition: DCCALShower.h:38
DLorentzVector lorentzMomentum(void) const
double sqrt(double)
float E
Definition: DCCALHit.h:26
const double k_to_nsec
Definition: units.h:72
uint32_t QF
Quality Factor from FPGA algorithms.
Definition: DCCALDigiHit.h:23
double time
Definition: DCCALShower.h:47
uint32_t pulse_peak
maximum sample in pulse
Definition: DCCALDigiHit.h:26
DVector3 getPosition() const
Definition: DFCALShower.h:151
uint32_t pulse_time
identified pulse time as returned by FPGA algorithm
Definition: DCCALDigiHit.h:21
bool GetTargetZ(double &z_target) const
z-location of center of target
Definition: DGeometry.cc:1933
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
int main(int argc, char *argv[])
Definition: gendoc.cc:6
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
float intOverPeak
Definition: DCCALHit.h:28