11 '''add pck files in directories idirs to a directory outdir.
12 All dirs in idirs must have the same subdirectory structure.
13 Each pickle file will be opened, and the corresponding objects added to a destination pickle in odir.
17 fileName = file.replace( idirs[0], dir )
18 pckfile = open(fileName)
19 obj = pickle.load(pckfile)
29 oFileName = file.replace( idirs[0], odir )
30 pckfile = open(oFileName,
'w')
31 pickle.dump(sum, pckfile)
32 txtFileName = oFileName.replace(
'.pck',
'.txt')
33 txtFile = open(txtFileName,
'w')
34 txtFile.write( str(sum) )
39 def hadd(file, odir, idirs):
40 if file.endswith(
'.pck'):
46 elif not file.endswith(
'.root'):
49 haddCmd.append( file.replace( idirs[0], odir ) )
51 haddCmd.append( file.replace( idirs[0], dir ) )
53 cmd =
' '.
join(haddCmd)
62 cmd =
' '.
join( [
'mkdir', odir])
69 print 'ERROR: directory in the way. Maybe you ran hadd already in this directory? Remove it and try again'
72 for root,dirs,files
in os.walk( idirs[0] ):
75 dir =
'/'.
join([root, dir])
76 dir = dir.replace(idirs[0], odir)
82 hadd(
'/'.
join([root, file]), odir, idirs)
84 def haddChunks(idir, removeDestDir, cleanUp=False, odir_cmd='./'):
86 for file
in sorted(os.listdir(idir)):
87 filepath =
'/'.
join( [idir, file] )
89 if os.path.isdir(filepath):
92 prefix,num = compdir.split(
'_Chunk')
97 chunks.setdefault( prefix,
list() ).
append(filepath)
99 print 'warning: no chunk found.'
101 for comp, cchunks
in chunks.iteritems():
102 odir = odir_cmd+
'/'+
'/'.
join( [idir, comp] )
105 if os.path.isdir( odir ):
110 if os.path.isdir(
'Chunks'):
111 shutil.rmtree(chunkDir)
114 for comp, chunks
in chunks.iteritems():
116 shutil.move(chunk, chunkDir)
119 if __name__ ==
'__main__':
123 from optparse
import OptionParser
125 parser = OptionParser()
128 Find chunks in dir, and run recursive hadd to group all chunks.
130 DYJets_Chunk0/, DYJets_Chunk1/ ... -> hadd -> DYJets/
131 WJets_Chunk0/, WJets_Chunk1/ ... -> hadd -> WJets/
133 parser.add_option(
"-r",
"--remove", dest=
"remove",
134 default=
False,action=
"store_true",
135 help=
"remove existing destination directories.")
136 parser.add_option(
"-c",
"--clean", dest=
"clean",
137 default=
False,action=
"store_true",
138 help=
"move chunks to Chunks/ after processing.")
140 (options,args) = parser.parse_args()
143 print 'provide at most 2 directory as arguments: first the source, then the destination (optional)'
152 haddChunks(dir, options.remove, options.clean, odir)
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
static std::string join(char **cmd)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run