StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StuJitterBug.hh
1 /***********************************************************************
2  *
3  * $Id: StuJitterBug.hh,v 1.2 2002/05/30 11:31:08 jones Exp $
4  *
5  * Author: Peter G. Jones, University of Birmingham, Aug 2000
6  *
7  * Description:
8  * This function checks the timing of the CTB event signal with
9  * respect to the preceding pre-sample. If the pre-sample is
10  * greater than 1% of the event sample, or the event sample is
11  * zero, the function return kTRUE and the event should be aborted.
12  * Otherwise the function returns kFALSE.
13  *
14  * $Log: StuJitterBug.hh,v $
15  * Revision 1.2 2002/05/30 11:31:08 jones
16  * Changed tray and slat to UInt_t
17  *
18  * Revision 1.1 2000/09/28 20:12:54 jones
19  * Adding StuJitterBug abort function
20  *
21  **********************************************************************/
22 #ifndef StuJitterBug_hh
23 #define StuJitterBug_hh
24 
25 #include "StEvent/StEvent.h"
26 #include "StEvent/StTriggerDetectorCollection.h"
27 #include "StEvent/StCtbTriggerDetector.h"
28 #include "StMessMgr.h"
29 
30 Bool_t t0JitterAbort(StEvent* event) {
31 
32  // Get the Trigger data
33 
34  StTriggerDetectorCollection *theTriggers =
35  event->triggerDetectorCollection();
36  if( !theTriggers ) {
37  gMessMgr->Error() << "t0JitterAbort finds no trigger data" << endl;
38  return kFALSE;
39  }
40  StCtbTriggerDetector &ctb = theTriggers->ctb();
41  Float_t ctb_evt = 0.;
42  Float_t ctb_pre = 0.;
43 
44  // Loop over slats/trays and calc event and pre samples
45 
46  for( UInt_t slat=0; slat<ctb.numberOfSlats(); slat++ ) {
47  for( UInt_t tray=0; tray<ctb.numberOfTrays(); tray++) {
48  ctb_evt += ctb.mips( tray, slat, 0 );
49  ctb_pre += ctb.mips( tray, slat, ctb.numberOfPreSamples() );
50  }
51  }
52 
53  Float_t ratio = (ctb_evt > 0.) ? ctb_pre/ctb_evt : 0.;
54 
55  if( ctb_evt <= 0. )
56  gMessMgr->Warning() << "t0JitterAbort ctb_evt = " << ctb_evt
57  << " ctb_pre = " << ctb_pre << endl;
58 
59  // Return kTRUE if the presample is > 1% of the event sample
60  // If the event sample is zero, the event is accepted
61 
62  return( (Bool_t) (ratio > 0.01) );
63 }
64 
65 #endif