ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/root/runFileCataloger.C
Revision: 1.2
Committed: Sat Jun 5 02:36:28 2010 UTC (14 years, 11 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a
Changes since 1.1: +76 -0 lines
Log Message:
Wow I forgot all about my cvs.

File Contents

# User Rev Content
1 paus 1.2 // $Id: runFileCataloger.C,v 1.1.2.1 2010/06/05 01:49:22 paus Exp $
2    
3     #if !defined(__CINT__) || defined(__MAKECINT__)
4     #include <TROOT.h>
5     #include <TSystem.h>
6     #include "MitAna/DataUtil/interface/Debug.h"
7     #include "MitAna/Catalog/interface/Catalog.h"
8     #include "MitAna/Catalog/interface/Dataset.h"
9     #include "MitAna/TreeMod/interface/CatalogingMod.h"
10     #include "MitAna/TreeMod/interface/Analysis.h"
11     #endif
12    
13     using namespace mithep;
14     const TString slash = "/";
15    
16     void catalogFile(const char *dir, const char *file);
17     void reset();
18    
19     Analysis *gAna(0);
20     CatalogingMod *gMod(0);
21    
22     //--------------------------------------------------------------------------------------------------
23     void runFileCataloger(const char *dir = "/castor/cern.ch/user/p/paus/filler/004/s8-qcddj_15_20-id9",
24     const char *file = "s8-qcddj_15_20-id9_000_1.root")
25     {
26     // -----------------------------------------------------------------------------------------------
27     // This script runs a full cataloging action on the given directory
28     // -----------------------------------------------------------------------------------------------
29     gDebugMask = Debug::kNone;
30     gDebugLevel = 0;
31     gErrorIgnoreLevel = kWarning;
32    
33     reset();
34     catalogFile(dir,file);
35     return;
36     }
37    
38     //--------------------------------------------------------------------------------------------------
39     void catalogFile(const char *dir, const char *file)
40     {
41     // set up the modules
42     gMod->SetMetaDataString((TString(dir)+slash+TString(file)).Data());
43     gMod->SetNFileSet (0);
44    
45     // set up analysis
46     gAna->SetSuperModule(gMod);
47    
48     TString fileName = TString(dir) + slash + + TString(file);
49     printf("Index: %d\n",fileName.Index("castor/cern.ch"));
50     if (fileName.Index("castor/cern.ch") != -1)
51     fileName = TString("castor:") + fileName;
52     if (fileName.Index("pnfs/cmsaf.mit.edu") != -1) {
53     fileName = TString("dcap://t2srv0005.cmsaf.mit.edu/") + fileName;
54     gMod->SetMetaDataString(fileName.Data());
55     }
56    
57     printf(" Adding: %s\n",fileName.Data());
58     gAna->AddFile(fileName);
59     gAna->SetUseHLT(0);
60    
61     // run the analysis after successful initialisation
62     gAna->Run(false);
63     }
64    
65     //--------------------------------------------------------------------------------------------------
66     void reset()
67     {
68     // reset pointers
69     if (gAna)
70     delete gAna;
71     gAna = new Analysis();
72    
73     if (gMod)
74     delete gMod;
75     gMod = new CatalogingMod();
76     }