ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/scripts/print_data.C
Revision: 1.1
Committed: Wed May 26 23:58:25 2010 UTC (14 years, 11 months ago) by jengbou
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Add file to print bunch crossing in events

File Contents

# Content
1 #if !defined(__CINT__) && !defined(__MAKECINT__)
2 #include "DataFormats/FWLite/interface/Handle.h"
3 #include "DataFormats/FWLite/interface/Event.h"
4 #include "DataFormats/FWLite/interface/Run.h"
5 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
6
7 #endif
8
9 #include "TFile.h"
10
11 void print_data() {
12 TFile file("/tmp/jengbou/5442F815-4A67-DF11-AA2D-001D09F24DDF.root");
13 int nEvtToProc = -1;
14 int nEvts = 0;
15 fwlite::Event ev(&file);
16 std::vector<int> BXStore;
17 bool fbit[64];
18
19 for(ev.toBegin(); !ev.atEnd(); ++ev,++nEvts) {
20 if (nEvts > nEvtToProc && nEvtToProc != -1) continue;
21 fwlite::Handle<L1GlobalTriggerReadoutRecord> L1GTRR;
22 L1GTRR.getByLabel(ev,"gtDigis");
23 for (int i=0;i<64;i++) fbit[i]=L1GTRR->technicalTriggerWord().at(i);
24 if (fbit[0] && (fbit[40]||fbit[41]))
25 std::cout << "Pass L1" << std::endl;
26 else {
27 std::cout << "Does not pass L1" << std::endl;
28 continue;
29 }
30 int currentBx = ev.bunchCrossing();
31 std::cout << "Bx Crossing: " << currentBx << std::endl;
32 bool newrcd = true;
33
34 for (std::vector<int>::iterator nbx = BXStore.begin();
35 nbx != BXStore.end(); nbx++) {
36 if (*nbx == currentBx) {
37 newrcd = false;
38 }
39 }
40 if (newrcd) BXStore.push_back(currentBx);
41 }
42
43 sort(BXStore.begin(),BXStore.end());
44 // Print all crossing bunches:
45 std::cout << "\nAll crossing bunches : " ;
46 for (std::vector<int>::const_iterator bx = BXStore.begin();
47 bx != BXStore.end();bx++) {
48 std::cout << *bx << " ";
49 }
50 std::cout << std::endl;
51
52 }