1 |
paus |
1.3 |
// $Id: runSimpleFileCataloger.C,v 1.2 2012/03/29 23:41:59 paus Exp $
|
2 |
paus |
1.1 |
|
3 |
|
|
#if !defined(__CINT__) || defined(__MAKECINT__)
|
4 |
|
|
#include <TROOT.h>
|
5 |
|
|
#include <TSystem.h>
|
6 |
|
|
#endif
|
7 |
|
|
|
8 |
|
|
const TString slash = "/";
|
9 |
|
|
const TString dCacheDoor = "dcap://t2srv0012.cmsaf.mit.edu/";
|
10 |
|
|
//const TString dCacheDoor = "dcap://t2srv0005.cmsaf.mit.edu/";
|
11 |
|
|
const TString hadoopDoor = "root://xrootd.cmsaf.mit.edu/";
|
12 |
|
|
|
13 |
|
|
void catalogFile(const char *dir, const char *file);
|
14 |
|
|
void reset();
|
15 |
|
|
|
16 |
|
|
//--------------------------------------------------------------------------------------------------
|
17 |
|
|
void runSimpleFileCataloger(const char *dir = "/mnt/hadoop/cms/store/user/paus/fabstoec/Summer11Private/TTH_HToGG_M-120_TuneZ2_7TeV-pythia6/Summer11-PU32_8CM_START42_V13C-v4/GEN-SIM-RECO",
|
18 |
|
|
const char *file = "")
|
19 |
|
|
{
|
20 |
|
|
// -----------------------------------------------------------------------------------------------
|
21 |
|
|
// This script runs a full cataloging action on the given directory
|
22 |
|
|
// -----------------------------------------------------------------------------------------------
|
23 |
|
|
reset();
|
24 |
|
|
catalogFile(dir,file);
|
25 |
|
|
return;
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
//--------------------------------------------------------------------------------------------------
|
29 |
|
|
void catalogFile(const char *dir, const char *file)
|
30 |
|
|
{
|
31 |
|
|
TString fileName = TString(dir) + slash + + TString(file);
|
32 |
|
|
//printf("Index: %d\n",fileName.Index("castor/cern.ch"));
|
33 |
|
|
if (fileName.Index("castor/cern.ch") != -1)
|
34 |
|
|
fileName = TString("castor:") + fileName;
|
35 |
|
|
if (fileName.Index("pnfs/cmsaf.mit.edu") != -1) {
|
36 |
|
|
fileName = dCacheDoor + fileName;
|
37 |
|
|
}
|
38 |
|
|
if (fileName.Index("mnt/hadoop/cms/store") != -1) {
|
39 |
|
|
fileName.Remove(0,15);
|
40 |
|
|
fileName = hadoopDoor + fileName;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
paus |
1.3 |
printf("\n Opening: %s\n\n",fileName.Data());
|
44 |
paus |
1.2 |
TFile* f = TFile::Open(fileName.Data());
|
45 |
paus |
1.3 |
|
46 |
|
|
TTree* tree = (TTree*) f->FindObjectAny("Delphes");
|
47 |
|
|
if (tree) {
|
48 |
|
|
printf("0000 %s %d %d\n",fileName.Data(),tree->GetEntries(),tree->GetEntries());
|
49 |
|
|
return;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
paus |
1.2 |
TTree* tree = (TTree*) f->FindObjectAny("Events");
|
53 |
paus |
1.3 |
if (tree)
|
54 |
|
|
printf("XX-CATALOG-XX %s %d\n",fileName.Data(),tree->GetEntries());
|
55 |
paus |
1.2 |
|
56 |
|
|
TTree* allTree = (TTree*) f->FindObjectAny("AllEvents");
|
57 |
paus |
1.3 |
if (tree && allTree)
|
58 |
|
|
printf("XX-CATALOG-XX %s %d %d\n",fileName.Data(),tree->GetEntries(),allTree->GetEntries());
|
59 |
paus |
1.1 |
}
|
60 |
|
|
|
61 |
|
|
//--------------------------------------------------------------------------------------------------
|
62 |
|
|
void reset()
|
63 |
|
|
{
|
64 |
|
|
}
|
65 |
|
|
|
66 |
paus |
1.2 |
//// file from F.
|
67 |
|
|
//void runSimpleFileCataloger(TString dir = "root://xroot.cmsaf.mit.edu/store/user/paus/fabstoec/Summer11Private//TTH_HToGG_M-120_TuneZ2_7TeV-pythia6/Summer11-PU32_8CM_START42_V13C-v4/GEN-SIM-RECO",
|
68 |
|
|
// TString fileName="SUM11-HGGPRIV-0540-4890-0018.root") {
|
69 |
|
|
//
|
70 |
|
|
// TString fullName = dir+TString("/") +fileName;
|
71 |
|
|
// TFile* file = TFile::Open(fullName.Data());
|
72 |
|
|
// TTree* tree = (TTree*) file->FindObjectAny("Events");
|
73 |
|
|
// std::cout << tree->GetEntries() << std::endl;
|
74 |
|
|
//}
|