Go to the documentation of this file.00001
00002
00003 #include "TRootConverterParam.h"
00004 #include "TGo4Version.h"
00005 #if __GO4BUILDVERSION__ > 40502
00006 #include "go4iostream.h"
00007 #else
00008 #include "Riostream.h"
00009 #endif
00010
00011
00012 #define OUTPUT_FILE_ENABLE 0
00013 #define OUTPUT_FILENAME "testTree.root"
00014 #define ROOT_TREE_DISPLAY 0
00015 #define GET4_DATA_IN_TREE 0
00016 #define PMT_TDC -1;
00017 #define PMT_QDC -1;
00018 #define RPC_TDC_LEADING -1;
00019 #define RPC_TDC_LEADING -1;
00020 #define TDC_REFERENCE -1;
00021 #define CHANNEL_TDC_REFERENCE -1;
00022 #define TRIGLOG_DATA_IN_TREE 0;
00023 #define HODOSCOPE_DATA_IN_TREE 0;
00024 #define HODOSCOPE_DEBUG_HISTO 0;
00025 #define SLOW_CONTROL_IN_TREE 0;
00026 #define NB_SLOW_CONTROL_CH 0;
00027
00028
00029
00030 TRootConverterParam::TRootConverterParam() : TGo4Parameter()
00031 {
00032 uRootDisplay = 0;
00033 uCleanOuputEnable = 0;
00034 sOutputFilename = "";
00035 uAddGet4DataInTree = 0;
00036 iPmtTdc = -1;
00037 iPmtQdc = -1;
00038 iRpcTdcLeading = -1;
00039 iRpcTdcTrailing = -1;
00040 iReferenceTdc = -1;
00041 iReferenceChannel1 = -1;
00042 iReferenceChannel2 = -1;
00043 uTriglogInputInTree = 0;
00044 uHodoInputInTree = 0;
00045 uHodoDebugHisto = 0;
00046 uSlowControlInTree = 0;
00047 uNbSlowControlChan = 0;
00048 }
00049
00050
00051
00052 TRootConverterParam::TRootConverterParam(const char* name) : TGo4Parameter(name)
00053 {
00054 uRootDisplay = 0;
00055 uCleanOuputEnable = 0;
00056 sOutputFilename = "";
00057 uAddGet4DataInTree = 0;
00058 iPmtTdc = -1;
00059 iPmtQdc = -1;
00060 iRpcTdcLeading = -1;
00061 iRpcTdcTrailing = -1;
00062 iReferenceTdc = -1;
00063 iReferenceChannel1 = -1;
00064 iReferenceChannel2 = -1;
00065 uTriglogInputInTree = 0;
00066 uHodoInputInTree = 0;
00067 uHodoDebugHisto = 0;
00068 uSlowControlInTree = 0;
00069 uNbSlowControlChan = 0;
00070
00071 ReadOptions();
00072 this->PrintOptions();
00073 }
00074
00075
00076 TRootConverterParam::~TRootConverterParam()
00077 {
00078 }
00079
00080 Bool_t TRootConverterParam::UpdateFrom(TGo4Parameter *pp)
00081 {
00082 if(pp->InheritsFrom("TRootConverterParam")) {
00083 TRootConverterParam * from = (TRootConverterParam *) pp;
00084 cout << "**** TRootConverterParam " << GetName() << " updated from source parameter" << endl;
00085 } else
00086 cout << "Wrong parameter object: " << pp->ClassName() << endl;
00087 return kTRUE;
00088 }
00089
00090 Bool_t TRootConverterParam::ReadOptions()
00091 {
00092 uRootDisplay = ROOT_TREE_DISPLAY;
00093 uCleanOuputEnable = OUTPUT_FILE_ENABLE;
00094 sOutputFilename = OUTPUT_FILENAME;
00095 uAddGet4DataInTree = GET4_DATA_IN_TREE;
00096 iPmtTdc = PMT_TDC;
00097 iPmtQdc = PMT_QDC;
00098 iRpcTdcLeading = RPC_TDC_LEADING;
00099 iRpcTdcTrailing = RPC_TDC_LEADING;
00100 iReferenceTdc = TDC_REFERENCE;
00101 iReferenceChannel1 = CHANNEL_TDC_REFERENCE;
00102 iReferenceChannel2 = CHANNEL_TDC_REFERENCE;
00103 uTriglogInputInTree = TRIGLOG_DATA_IN_TREE;
00104 uHodoInputInTree = HODOSCOPE_DATA_IN_TREE;
00105 uHodoDebugHisto = HODOSCOPE_DEBUG_HISTO;
00106 uSlowControlInTree = SLOW_CONTROL_IN_TREE;
00107 uNbSlowControlChan = NB_SLOW_CONTROL_CH;
00108 for(UInt_t temp_index = 0; temp_index < MAX_HV_CHAN_SC; temp_index++)
00109 {
00110 sScInputNamePosI[temp_index] = "";
00111 sScOutputNamePosI[temp_index]= "";
00112 sScInputNamePosU[temp_index] = "";
00113 sScOutputNamePosU[temp_index]= "";
00114 sScInputNameNegI[temp_index] = "";
00115 sScOutputNameNegI[temp_index]= "";
00116 sScInputNameNegU[temp_index] = "";
00117 sScOutputNameNegU[temp_index]= "";
00118 }
00119
00120
00121 fstream setupFile("./ROOTFORMAT/rootconv_options.txt", ios::in);
00122 if( setupFile.fail() == true)
00123 {
00124 cout<<"Error opening setup file rocget4_options.txt"<<endl;
00125 cout<<"=> Using default values!"<<endl;
00126 }
00127 else
00128 {
00129 TString line;
00130 line.ReadLine(setupFile, kFALSE);
00131 while( !setupFile.eof() )
00132 {
00133 if(line(0) == '#' || line(0) == '*')
00134 {
00135
00136 ;
00137 }
00138 else if(line.Contains("disproot")==kTRUE)
00139 {
00140 uRootDisplay = ((TString)line(8,10)).Atoi();
00141 }
00142 else if(line.Contains("cleanoutp")==kTRUE)
00143 {
00144 uCleanOuputEnable = ((TString)line(10,10)).Atoi();
00145 }
00146 else if(line.Contains("cleanfile")==kTRUE)
00147 {
00148 sOutputFilename = line(10,120);
00149 }
00150 else if(line.Contains("get4intree")==kTRUE)
00151 {
00152 uAddGet4DataInTree = ((TString)line(11,10)).Atoi();
00153 }
00154 else if(line.Contains("pmttdcind")==kTRUE)
00155 {
00156 iPmtTdc = ((TString)line(10,10)).Atoi();
00157 }
00158 else if(line.Contains("pmtqdcind")==kTRUE)
00159 {
00160 iPmtQdc = ((TString)line(10,10)).Atoi();
00161 }
00162 else if(line.Contains("rpctdclei")==kTRUE)
00163 {
00164 iRpcTdcLeading = ((TString)line(10,10)).Atoi();
00165 }
00166 else if(line.Contains("rpctdcfai")==kTRUE)
00167 {
00168 iRpcTdcTrailing = ((TString)line(10,10)).Atoi();
00169 }
00170 else if(line.Contains("indreftdc")==kTRUE)
00171 {
00172 iReferenceTdc = ((TString)line(10,10)).Atoi();
00173 }
00174 else if(line.Contains("charefone")==kTRUE)
00175 {
00176 iReferenceChannel1 = ((TString)line(10,10)).Atoi();
00177 }
00178 else if(line.Contains("chareftwo")==kTRUE)
00179 {
00180 iReferenceChannel2 = ((TString)line(10,10)).Atoi();
00181 }
00182 else if(line.Contains("trigintree")==kTRUE)
00183 {
00184 uTriglogInputInTree = ((TString)line(11,10)).Atoi();
00185 }
00186 else if(line.Contains("hodointree")==kTRUE)
00187 {
00188 uHodoInputInTree = ((TString)line(11,10)).Atoi();
00189 }
00190 else if(line.Contains("hodohisdeb")==kTRUE)
00191 {
00192 uHodoDebugHisto = ((TString)line(11,10)).Atoi();
00193 }
00194 else if(line.Contains("slcointree")==kTRUE)
00195 {
00196 uSlowControlInTree = ((TString)line(11,10)).Atoi();
00197 }
00198 else if(line.Contains("nbslowcoch")==kTRUE)
00199 {
00200 uNbSlowControlChan = ((TString)line(11,10)).Atoi();
00201 if( MAX_HV_CHAN_SC < uNbSlowControlChan)
00202 uNbSlowControlChan = MAX_HV_CHAN_SC;
00203 }
00204 else if(line.Contains("slowcontch")==kTRUE)
00205 {
00206 line = line(12,36);
00207 if( 0 != uNbSlowControlChan && 0 != line.Sizeof() )
00208 {
00209 UInt_t uChannelIndex = 0;
00210 for(UInt_t temp_index = 0; temp_index < uNbSlowControlChan && 0 != line.Sizeof(); temp_index++)
00211 {
00212 uChannelIndex = ((TString)line(0,3)).Atoi();
00213
00214 uSlowControlChans[temp_index]= uChannelIndex;
00215 sScInputNamePosI[temp_index] = Form("CBM:HV:A1526P:CH%d:imon", uChannelIndex);
00216 sScOutputNamePosI[temp_index]= Form("I_PosHv_ch%d", uChannelIndex);
00217 sScInputNamePosU[temp_index] = Form("CBM:HV:A1526P:CH%d:vmon", uChannelIndex);
00218 sScOutputNamePosU[temp_index]= Form("U_PosHv_ch%d", uChannelIndex);
00219 sScInputNameNegI[temp_index] = Form("CBM:HV:A1526N:CH%d:imon", uChannelIndex);
00220 sScOutputNameNegI[temp_index]= Form("I_NegHv_ch%d", uChannelIndex);
00221 sScInputNameNegU[temp_index] = Form("CBM:HV:A1526N:CH%d:vmon", uChannelIndex);
00222 sScOutputNameNegU[temp_index]= Form("U_NegHv_ch%d", uChannelIndex);
00223
00224 line = line(3,36);
00225 }
00226 }
00227 else if( 0 == line.Sizeof() )
00228 cout<<"Error: Some HV channel expected and empty string for exact indexes!"<<endl;
00229 }
00230
00231 line.ReadLine(setupFile, kFALSE);
00232 }
00233 }
00234
00235 setupFile.close();
00236
00237 return kTRUE;
00238 }
00239 Int_t TRootConverterParam::PrintOptions()
00240 {
00241 cout<<"*************************************************"<<endl;
00242 cout<<" Option values Root Converter Param"<<endl;
00243 if( uRootDisplay )
00244 cout<<"Clean data tree display in Go4: ON "<<endl;
00245 else cout<<"Clean data tree display in Go4: OFF"<<endl;
00246 if( uCleanOuputEnable )
00247 {
00248 cout<<"Output file for clean data tree: ON "<<endl;
00249 cout<<"Output filename: "<<sOutputFilename<<endl;
00250 }
00251 else cout<<"Output file for clean data tree: OFF"<<endl;
00252 if(1 == uRootDisplay || 1 == uCleanOuputEnable )
00253 {
00254 if( uAddGet4DataInTree )
00255 cout<<"GET4 data added to the TTree: ON "<<endl;
00256 else cout<<"GET4 data added to the TTree: OFF"<<endl;
00257 if( -1 != iPmtTdc || -1 != iPmtQdc )
00258 {
00259 cout<<"Caen TDC for PMT data: "<<iPmtTdc<<endl;
00260 cout<<"Lecroy for PMT data: "<<iPmtQdc<<endl;
00261 }
00262 if( -1 != iRpcTdcLeading || -1 != iRpcTdcTrailing )
00263 {
00264 cout<<"Caen TDC for RPC leading edge: "<<iRpcTdcLeading<<endl;
00265 cout<<"Caen TDC for RPC trailing edge: "<<iRpcTdcTrailing<<endl;
00266 }
00267 if( -1 != iReferenceTdc || -1 != iReferenceChannel1 || -1 != iReferenceChannel2)
00268 {
00269 cout<<"Caen TDC for t0 reference: "<<iReferenceTdc<<endl;
00270 cout<<"1st Caen TDC Channel for t0 ref: "<<iReferenceChannel1<<endl;
00271 cout<<"2nd Caen TDC Channel for t0 ref: "<<iReferenceChannel2<<endl;
00272 }
00273 if( uTriglogInputInTree )
00274 cout<<"TrigLog data added to the TTree: ON "<<endl;
00275 else cout<<"TrigLog data added to the TTree: OFF"<<endl;
00276 if( uHodoInputInTree )
00277 cout<<"Hodoscope data added to the TTree:ON "<<endl;
00278 else cout<<"Hodoscope data added to the TTree:OFF"<<endl;
00279 if( uHodoDebugHisto )
00280 cout<<"Hodoscope debug histograms: ON "<<endl;
00281 else cout<<"Hodoscope debug histograms: OFF"<<endl;
00282 if( uSlowControlInTree )
00283 {
00284 cout<<"HDRPC HV value added to the TTree:ON "<<endl;
00285 cout<<"Nb slow control HV channels saved: "<<uNbSlowControlChan<<endl;
00286 cout<<"Index slow control HV channels: ";
00287 for(UInt_t temp_index = 0; temp_index < uNbSlowControlChan; temp_index++)
00288 cout<<uSlowControlChans[temp_index]<<" ";
00289 cout<<endl;
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302 }
00303 else cout<<"HDRPC HV value added to the TTree:OFF"<<endl;
00304 }
00305 cout<<"*************************************************"<<endl;
00306
00307 return 0;
00308 }