ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/root/runSimpleFileCataloger.C
Revision: 1.1
Committed: Tue Feb 28 11:54:37 2012 UTC (13 years, 2 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025d
Log Message:
Last updates.

File Contents

# User Rev Content
1 paus 1.1 // $Id: runFileCataloger.C,v 1.4 2011/10/19 10:43:12 paus Exp $
2    
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     TFile* f = TFile::Open(fileName.Data());
44     TTree* tree = (TTree*) f->FindObjectAny("Events");
45     printf("XX-CATALOG-XX %s %d\n",fileName.Data(),tree->GetEntries());
46     }
47    
48     //--------------------------------------------------------------------------------------------------
49     void reset()
50     {
51     }
52    
53    
54    
55     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",
56     TString fileName="SUM11-HGGPRIV-0540-4890-0018.root") {
57    
58     TString fullName = dir+TString("/") +fileName;
59     TFile* file = TFile::Open(fullName.Data());
60     TTree* tree = (TTree*) file->FindObjectAny("Events");
61     std::cout << tree->GetEntries() << std::endl;
62     }