Diana Software
MRootFileWriter.cc
Go to the documentation of this file.
1 #include "MRootFileWriter.hh"
2 #include <iostream>
3 #include <sstream>
4 #include <inttypes.h>
5 #include <TFile.h>
6 #include <TDirectory.h>
7 #include "QEvent.hh"
8 #include "QTree.hh"
9 #include "QRawEvent.hh"
10 #include "QAliases.hh"
11 #include "QBaseType.hh"
12 #include "QGlobalRWFactory.hh"
13 #include "QGlobalWriter.hh"
14 #include "QEventInspector.hh"
15 #include "QString.hh"
16 #include "QOptions.hh"
17 #include "QBool.hh"
18 #include "TKey.h"
19 #include "TLeaf.h"
20 #include "TRegexp.h"
21 
22 
24 
25 using namespace Diana;
26 
27 
29 
30  fReaderWriterFiles.clear();
31  fAppendToInput = GetBool("AppendToInput",false,false) ;
32  fSkipGenerated = false;
33  if(fAppendToInput) {
34  if(fRWCommon->fEventGeneratorOn)
35  fSkipGenerated = GetBool("SkipGeneratedEvents",false,false);
36  if(!GetBool("SetListForReader",true,false)) {
37  Panic("AppendToInput option complains about: SetListForReader parameter"
38  " is not applicable (true is mandatory). Remove this parameter "
39  "from the config file");
40  }
41  if(!GetBool("SyncWithReader",true,false)) {
42  Panic("AppendToInput option complains about: SyncWithReader parameter "
43  "is not applicable (true is mandatory). Remove this parameter "
44  "from the config file");
45  }
46  if(GetBool("SkipEvents",false,false)) {
47  Panic("AppendToInput option complains about: SkipEvents parameter is "
48  "not applicable (false is mandatory). Remove this parameter from"
49  " the config file");
50  }
51  if(fRWCommon->fEventGeneratorOn && !fSkipGenerated) {
52  Panic("AppendToInput option complains about: reader parameter "
53  "\"EventGeneratorOn\" is not compatible (false is mandatory or "
54  "SkipGenerated is true)");
55  }
56  if(fRWCommon->fDeleteInputFiles) {
57  Panic("AppendToInput option complains about: reader parameter "
58  "\"DeleteInputFiles\" is not compatible (false is mandatory)");
59  }
60  if(fRWCommon->fReaderModuleName != "RootFileReader") {
61  Panic("AppendToInput option complains about: reader %s is not "
62  "compatible (use RootFileReader)",
63  fRWCommon->fReaderModuleName.c_str());
64  }
65  if(fRWCommon->fInclusiveMode == true) {
66  Warn("AppendToInput suggests: set the reader parameter InclusiveMode "
67  "to false, it is much more efficient!");
68  }
69  }
70  QFileWriter::Init(evi);
71 
72  if(fSyncWithReader && fRWCommon->fParallelRW)
73  Panic("Cannot use serial file writer with parallel file reader and "
74  "SyncWithReader! Try ParaRootFileWriter!");
75 
76  if(!fAppendToInput) {
77  /* MV FIXME
78  if(GetBool("SetListForReader",true) && fRWCommon->fReaderModuleName != "RootFileReader") {
79  Panic("SetListForReader option complains about: reader %s is not compatible (use RootFileReader)",fRWCommon->fReaderModuleName.c_str());
80  }
81  */
82  }
83  fGlobalWriter = 0;
84 }
85 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
Root File writer.
void Init(Diana::QEventInspector &evi)
Initialization class called by the Sequence.
Visitor class to inspect the QEvent content.
virtual void Init(QEventInspector &evi)
Init method called by the framework.
Definition: QFileWriter.cc:34
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...