StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
listStrangeCuts.C
1 //=========================================================
2 // owner: Gene Van Buren, BNL
3 // what it does: read and list StrangeCuts in a micro DST
4 //=========================================================
5 
6 TFile* filePtr;
7 TTree* treePtr;
8 TClonesArray* cutsArray;
9 TOrdCollection* cutsColl;
10 
11 void listStrangeCuts(const char* fileName="evMuDst.root");
12 
13 void listStrangeCuts(const char* fileName) {
14  filePtr = new TFile(fileName);
15  if (!filePtr) return;
16  cout << "_______________________________________________" << endl;
17  cout << "Opened file: " << fileName << endl;
18  cout << "_______________________________________________" << endl;
19 
20  cutsColl = (TOrdCollection*) filePtr->Get("StrangeCuts");
21  if (cutsColl) {
22  cout << "Found cuts collection with " << cutsColl->GetSize()
23  << " cuts." << endl;
24  cout << "_______________________________________________" << endl;
25  cutsColl->Print();
26  cout << "_______________________________________________" << endl;
27  return;
28  }
29 
30  treePtr = (TTree*) filePtr->Get("StrangeMuDst");
31  if (!treePtr) treePtr = (TTree*) filePtr->Get("MuDst");
32  if (!treePtr) return;
33  if (!(treePtr->GetBranch("StrangeCuts"))) return;
34 
35  cutArray = new TClonesArray("TCut",0);
36  treePtr->SetBranchStatus("*",0);
37  treePtr->SetBranchStatus("StrangeCuts.*",1);
38  treePtr->SetBranchAddress("StrangeCuts",&cutArray);
39  int ncuts=0;
40  for (int i=0; i<treePtr->GetEntries(); i++) {
41  treePtr->GetEvent(i);
42  ncuts = cutArray->GetEntriesFast();
43  if (ncuts) {
44  cout << "Found cuts branch with " << ncuts << " cuts." << endl;
45  cout << "_______________________________________________" << endl;
46  cutArray->Print();
47  break;
48  }
49  }
50  if (!ncuts) cout << "Found cuts branch, but NO entries!!!" << endl;
51  cout << "_______________________________________________" << endl;
52 }
53 
54 //_____________________________________________________________
55 // $Id: listStrangeCuts.C,v 3.3 2002/05/23 02:58:36 genevb Exp $
56 // $Log: listStrangeCuts.C,v $
57 // Revision 3.3 2002/05/23 02:58:36 genevb
58 // Better search for cuts
59 //
60 // Revision 3.2 2002/05/10 20:59:31 genevb
61 // Fixed bug with branch status and changed cuts split level
62 //
63 // Revision 3.1 2002/04/30 01:29:17 genevb
64 // Updated macros for common micro DST
65 //
66 //