StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2jetResults2012.h
1 #ifndef L2JETRESULTS2012_H
2 #define L2JETRESULTS2012_H
3 
4 /*********************************************************************
5  * $Id: L2jetResults2012.h,v 1.2 2012/03/21 18:18:03 jml 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 #include <fakeRtsLog.h>
15 
16 #define L2JET_RESULTS_VERSION 4
17 
18 struct L2jetOutInt0 { // 4 bytes
19  unsigned char version; // to tag format of the L2Result
20  unsigned char decision; /* meaning of bits:
21  0-2 : useBtowEast, useBtowWest, useEtow,
22  3,4 : seenBtow, seenEtow data block
23  5: accepted at random
24  6: accepted by one-jet cuts
25  7: accept by di-jet cuts
26  */
27  unsigned char dumm; /* free */
28  unsigned char kTick; /* CPU ticks used for this event in kTicks,
29  255=overflow, */
30 };
31 
32 struct L2jetOutInt1 { // 4 bytes
33  unsigned short iTotEne; // total transverse energy Et/GeV=iEne/100.
34  unsigned char checkSum; // to monitor if I get what I wrote
35  unsigned char free;
36 };
37 struct L2jetOutInt2 { // 4 bytes
38  unsigned short nBtowTw; // # of working towers above ADC thres
39  unsigned short nEtowTw; // --//--
40 };
41 
42 struct L2jetOutJet { // 8 bytes, first & second jet
43  unsigned char jPhi; // phi index, [0:180], phi/deg=jPhi*2;
44  unsigned char jEta; // eta index, [0:149], etaValue=jEta/50.-1.
45  unsigned short iEne; // transverse energy Et/GeV=iEne/100.
46  unsigned short rmsEta; // units ???
47  unsigned short rmsPhi;// units ???
48 };
49 
50 struct L2jetResults2012{ // all output bits lump together
51  struct L2jetOutInt0 int0; //4
52  struct L2jetOutInt1 int1; //4
53  struct L2jetOutInt2 int2; //4
54  struct L2jetOutJet jet1, jet2; //8+8
55 };
56 
57 
58 //====================================
59 //====================================
60 // get value of n-th bit
61 #define GET_OB(x,n) ( (x & 1 << n)!=0 )
62 
63 inline void
64 L2jetResults2012_print(L2jetResults2012 *p) {
65  if(p==0) {LOG(ERR,"print L2jetResults2012 - NULL pointer ????\n"); return;}
66 
67  unsigned int x=p->int0.decision;
68  LOG(DBG,"L2jetResults2012:\n Accept: rnd=%d oneJet=%d diJet=%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), GET_OB(x,0), GET_OB(x,1), GET_OB(x,2), GET_OB(x,3), GET_OB(x,4));
69 
70  LOG(NOTE," Jet1: Et/GeV=%.2f phi/deg=%3d eta=%.2f RMS: phi/deg=%.1f eta=%.2f\n", p->jet1.iEne/100.,p->jet1.jPhi*2,p->jet1.jEta/50.-1., p->jet1.rmsPhi/10.,p->jet1.rmsEta/100.);
71 
72  LOG(NOTE," Jet2: Et/GeV=%.2f phi/deg=%3d eta=%.2f RMS: phi/deg=%.1f eta=%.2f\n", p->jet2.iEne/100.,p->jet2.jPhi*2,p->jet2.jEta/50.-1., p->jet2.rmsPhi/10.,p->jet2.rmsEta/100.);
73 
74  LOG(NOTE," 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);
75 
76 
77 };
78 
79 #undef GET_OB
80 
81 //====================================
82 //====================================
83 inline unsigned char
84 L2jetResults2012_doCheckSum(L2jetResults2012 *p) {
85  if(p==0) {LOG(ERR,"print L2jetResults2012 - NULL pointer ????\n"); return 0xff;}
86  unsigned char* buf=(unsigned char*) p;
87  int len=sizeof( L2jetResults2012);
88  unsigned char sum=0;
89  int i;
90  for(i=0;i<len;i++) sum+=buf[i];
91  return sum;
92 }
93 #endif
94 
95 /**********************************************************************
96  $Log: L2jetResults2012.h,v $
97  Revision 1.2 2012/03/21 18:18:03 jml
98  got rid of printfs from 2012 files
99 
100  Revision 1.1 2011/10/18 15:11:43 jml
101  adding 2012 algorithms
102 
103  Revision 1.2 2010/04/18 06:05:39 pibero
104  Address compiler warnings.
105 
106  Revision 1.1 2010/04/17 05:04:13 pibero
107  Updates for Run 9 jet tree production
108 
109  Revision 1.2 2008/01/17 01:57:25 kocolosk
110  inline printing and checksum functions
111 
112  Revision 1.1 2007/10/11 00:33:20 balewski
113  L2algo added
114 
115  Revision 1.6 2006/03/28 19:46:49 balewski
116  ver16b, in l2new
117 
118  Revision 1.5 2006/03/11 17:08:34 balewski
119  now CVS comments should work
120 
121 */
122