ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/root/runSimpleFileCataloger.C
Revision: 1.2
Committed: Thu Mar 29 23:41:59 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e
Changes since 1.1: +15 -13 lines
Log Message:
Version with working skimming and last 4.4 tag.

File Contents

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