StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2jetResults2006.h
1 #ifndef L2JETRESULTS2006_H
2 #define L2JETRESULTS2006_H
3 
4 /*********************************************************************
5  * $Id: L2jetResults2006.h,v 1.3 2009/11/19 15:48:45 balewski Exp $
6  * \author Jan Balewski, IUCF, 2006
7  *********************************************************************
8  * Descripion:
9  * Output container for di-jets reco in L2
10  * stored in the trigger data
11  *********************************************************************
12  */
13 
14 
15 #define L2JET_RESULTS_VERSION 2
16 
17 struct L2jetOutInt0 { // 4 bytes
18  unsigned char version; // to tag format of the L2Result
19  unsigned char decision; /* meaning of bits:
20  0-2 : useBtowEast, useBtowWest, useEtow,
21  3,4 : seenBtow, seenEtow data block
22  5: accepted at random
23  6: accepted by one-jet cuts
24  7: accept by di-jet cuts
25  */
26  unsigned char cutTag; /* passed from input */
27  unsigned char kTick; /* CPU ticks used for this event in kTicks,
28  255=overflow, */
29 };
30 
31 struct L2jetOutInt1 { // 4 bytes
32  unsigned short iTotEne; // total transverse energy Et/GeV=iEne/100.
33  unsigned char checkSum; // to monitor if I get what I wrote
34  unsigned char free;
35 };
36 struct L2jetOutInt2 { // 4 bytes
37  unsigned short nBtowTw; // # of working towers above ADC thres
38  unsigned short nEtowTw; // --//--
39 };
40 
41 struct L2jetOutJet { // first & second jet
42  unsigned char jPhi; // phi index, [0:180], phi/deg=jPhi*2;
43  unsigned char jEta; // eta index, [0:149], etaValue=jEta/50.-1.
44  unsigned short iEne; // transverse energy Et/GeV=iEne/100.
45 };
46 
47 struct L2jetResults2006{ // all output bits lump together
48  struct L2jetOutInt0 int0;
49  struct L2jetOutInt1 int1;
50  struct L2jetOutInt2 int2;
51  struct L2jetOutJet jet1, jet2;
52 };
53 
54 
55 //====================================
56 //====================================
57 // get value of n-th bit
58 #define GET_OB(x,n) ( (x & 1 << n)!=0 )
59 
60 inline void
61 L2jetResults2006_print(L2jetResults2006 *p) {
62  if(p==0) {printf("print L2jetResults2006 - NULL pointer ????\n"); return;}
63 
64  unsigned int x=p->int0.decision;
65  printf("L2jetResults2006:\n Accept: rnd=%d oneJet=%d diJet=%d cutTag=%d\n useBtowEast=%d useBtowWest=%d useEndcap=%d bemcIn=%d eemcIn=%d\n", GET_OB(x,5), GET_OB(x,6), GET_OB(x,7),p->int0.cutTag, GET_OB(x,0), GET_OB(x,1), GET_OB(x,2), GET_OB(x,3), GET_OB(x,4));
66 
67  printf(" Jet1: Et/GeV=%.2f phi/deg=%3d eta=%.2f\n", p->jet1.iEne/100.,p->jet1.jPhi*2,p->jet1.jEta/50.-1. );
68  printf(" Jet2: Et/GeV=%.2f phi/deg=%3d eta=%.2f\n", p->jet2.iEne/100.,p->jet2.jPhi*2,p->jet2.jEta/50.-1. );
69 
70  printf(" totEne/GeV=%.2f nBtowTw=%d nEtwTw=%d, \n CPU kTicks=%d format=%d checkSum=%d\n", p->int1.iTotEne/100., p->int2.nBtowTw, p->int2.nEtowTw, p->int0.kTick,p->int0.version, p->int1.checkSum);
71 
72 
73 };
74 
75 #undef GET_OB
76 
77 //====================================
78 //====================================
79 inline unsigned char
80 L2jetResults2006_doCheckSum(L2jetResults2006 *p) {
81  if(p==0) {printf("print L2jetResults2006 - NULL pointer ????\n"); return (unsigned char)0xffff;}
82  unsigned char* buf=(unsigned char*) p;
83  int len=sizeof( L2jetResults2006);
84  unsigned char sum=0;
85  int i;
86  for(i=0;i<len;i++) sum+=buf[i];
87  return sum;
88 }
89 #endif
90 
91 /**********************************************************************
92  $Log: L2jetResults2006.h,v $
93  Revision 1.3 2009/11/19 15:48:45 balewski
94  add (char*) to many strings to make SL5 happ, few other adjustments
95 
96  Revision 1.2 2008/01/17 01:57:25 kocolosk
97  inline printing and checksum functions
98 
99  Revision 1.1 2007/10/11 00:33:20 balewski
100  L2algo added
101 
102  Revision 1.6 2006/03/28 19:46:49 balewski
103  ver16b, in l2new
104 
105  Revision 1.5 2006/03/11 17:08:34 balewski
106  now CVS comments should work
107 
108 */
109