1 |
paus |
1.5 |
// $Id: runFileCataloger.C,v 1.4 2011/10/19 10:43:12 paus Exp $
|
2 |
paus |
1.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 |
paus |
1.3 |
const TString slash = "/";
|
15 |
|
|
const TString dCacheDoor = "dcap://t2srv0012.cmsaf.mit.edu/";
|
16 |
paus |
1.4 |
//const TString dCacheDoor = "dcap://t2srv0005.cmsaf.mit.edu/";
|
17 |
paus |
1.5 |
const TString hadoopDoor = "root://xrootd.cmsaf.mit.edu/";
|
18 |
paus |
1.2 |
|
19 |
|
|
void catalogFile(const char *dir, const char *file);
|
20 |
|
|
void reset();
|
21 |
|
|
|
22 |
|
|
Analysis *gAna(0);
|
23 |
|
|
CatalogingMod *gMod(0);
|
24 |
|
|
|
25 |
|
|
//--------------------------------------------------------------------------------------------------
|
26 |
|
|
void runFileCataloger(const char *dir = "/castor/cern.ch/user/p/paus/filler/004/s8-qcddj_15_20-id9",
|
27 |
|
|
const char *file = "s8-qcddj_15_20-id9_000_1.root")
|
28 |
|
|
{
|
29 |
|
|
// -----------------------------------------------------------------------------------------------
|
30 |
|
|
// This script runs a full cataloging action on the given directory
|
31 |
|
|
// -----------------------------------------------------------------------------------------------
|
32 |
|
|
gDebugMask = Debug::kNone;
|
33 |
|
|
gDebugLevel = 0;
|
34 |
|
|
gErrorIgnoreLevel = kWarning;
|
35 |
|
|
|
36 |
|
|
reset();
|
37 |
|
|
catalogFile(dir,file);
|
38 |
|
|
return;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
//--------------------------------------------------------------------------------------------------
|
42 |
|
|
void catalogFile(const char *dir, const char *file)
|
43 |
|
|
{
|
44 |
|
|
// set up the modules
|
45 |
|
|
gMod->SetMetaDataString((TString(dir)+slash+TString(file)).Data());
|
46 |
|
|
gMod->SetNFileSet (0);
|
47 |
|
|
|
48 |
|
|
// set up analysis
|
49 |
|
|
gAna->SetSuperModule(gMod);
|
50 |
|
|
|
51 |
|
|
TString fileName = TString(dir) + slash + + TString(file);
|
52 |
|
|
printf("Index: %d\n",fileName.Index("castor/cern.ch"));
|
53 |
|
|
if (fileName.Index("castor/cern.ch") != -1)
|
54 |
|
|
fileName = TString("castor:") + fileName;
|
55 |
|
|
if (fileName.Index("pnfs/cmsaf.mit.edu") != -1) {
|
56 |
paus |
1.3 |
fileName = dCacheDoor + fileName;
|
57 |
paus |
1.2 |
gMod->SetMetaDataString(fileName.Data());
|
58 |
|
|
}
|
59 |
paus |
1.4 |
if (fileName.Index("mnt/hadoop/cms/store") != -1) {
|
60 |
|
|
fileName.Remove(0,15);
|
61 |
|
|
fileName = hadoopDoor + fileName;
|
62 |
|
|
gMod->SetMetaDataString(fileName.Data());
|
63 |
|
|
}
|
64 |
paus |
1.2 |
|
65 |
|
|
printf(" Adding: %s\n",fileName.Data());
|
66 |
|
|
gAna->AddFile(fileName);
|
67 |
|
|
gAna->SetUseHLT(0);
|
68 |
|
|
|
69 |
|
|
// run the analysis after successful initialisation
|
70 |
|
|
gAna->Run(false);
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
//--------------------------------------------------------------------------------------------------
|
74 |
|
|
void reset()
|
75 |
|
|
{
|
76 |
|
|
// reset pointers
|
77 |
|
|
if (gAna)
|
78 |
|
|
delete gAna;
|
79 |
|
|
gAna = new Analysis();
|
80 |
|
|
|
81 |
|
|
if (gMod)
|
82 |
|
|
delete gMod;
|
83 |
|
|
gMod = new CatalogingMod();
|
84 |
|
|
}
|