HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hdst.cc
Go to the documentation of this file.
1 
2 #include "hdst.h"
3 #include "htrbnetdef.h"
4 
5 //------- detectors -------------------
6 #include "hspectrometer.h"
7 #include "hrichdetector.h"
8 #include "hmdcdetector.h"
9 #include "htofdetector.h"
10 #include "hrpcdetector.h"
11 #include "hshowerdetector.h"
12 #include "hemcdetector.h"
13 #include "htboxdetector.h"
14 #include "hstart2detector.h"
15 #include "hwalldetector.h"
16 #include "hpiontrackerdetector.h"
17 //-------------------------------------
18 
19 //--------- data source ---------------
20 #include "hldsource.h"
21 #include "hldfilesource.h"
22 #include "hldgrepfilesource.h"
23 #include "hldremotesource.h"
24 #include "hldstacksource.h"
25 #include "hrootsource.h"
26 #include "hgeantmergesource.h"
27 //-------------------------------------
28 
29 //-------- unpackers -----------------
30 #include "hmdcunpacker.h"
31 #include "hshowerunpacker.h"
32 #include "hrichunpacker.h"
33 #include "hrich700trb3unpacker.h"
34 #include "hwalltrb2unpacker.h"
35 #include "hrpctrb2unpacker.h"
36 #include "htoftrb2unpacker.h"
37 #include "hstart2trb2unpacker.h"
38 #include "hstart2trb3unpacker.h"
39 #include "hlatchunpacker.h"
40 #include "htboxunpacker.h"
42 #include "hemctrb3unpacker.h"
43 //-------------------------------------
44 
45 
46 //-------- parameters -----------------
47 #include "hades.h"
48 #include "hruntimedb.h"
49 #ifdef ORACLE_SUPPORT
50  #include "hparora2io.h"
51 #endif
52 #include "hparasciifileio.h"
53 #include "hparrootfileio.h"
54 //-------------------------------------
55 
56 #include "TObjString.h"
57 
58 
59 #include <iostream>
60 #include <vector>
61 using namespace std;
62 
63 
65 
66 void HDst::setupSpectrometer(TString beamtime,Int_t mdcsetup[6][4],TString detectors)
67 {
68  // beamtime aug11, aug11_3sec ,apr12,jul14,aug14,aug18,mar19
69  // Int_t mdcset[6][4] setup mdc. If not used put NULL (default).
70  // if not NULL it will overwrite settings given by beamtime
71  // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,start
72 
73  beamtime.ToLower();
74  detectors.ToLower();
75  ::Info("setupSpectrometer()", "\n----------- setting up HADES spectrometer ----------------");
76 
77  if(beamtime.CompareTo("may14")==0) beamtime = "jul14";
78  if(beamtime.CompareTo("aug14")==0) beamtime = "jul14";
79 
80  if (beamtime.CompareTo("aug11") ==0);
81  else if(beamtime.CompareTo("aug11_3sec")==0);
82  else if(beamtime.CompareTo("apr12") ==0);
83  else if(beamtime.CompareTo("jul14") ==0);
84  else if(beamtime.CompareTo("aug18") ==0);
85  else if(beamtime.CompareTo("mar19") ==0);
86  else {
87  ::Error("","Beam time = '%s' not supported !",beamtime.Data());
88  exit(1);
89  }
90  ::Info("setupSpectrometer()", "Using %s setup",beamtime.Data());
91 
92  Int_t mdcMods_aug11[6][4]={
93  {1,1,1,1},
94  {1,1,0,1},
95  {1,1,1,1},
96  {1,1,1,1},
97  {1,1,1,1},
98  {1,1,1,1} };
99 
100  Int_t mdcMods_aug11_3sec[6][4]={
101  {0,0,0,0},
102  {0,0,0,0},
103  {1,1,1,1},
104  {0,0,0,0},
105  {1,1,1,1},
106  {1,1,1,1} };
107 
108  Int_t mdcMods_apr12[6][4]={
109  {1,1,1,1},
110  {1,1,1,1},
111  {1,1,1,1},
112  {1,1,1,1},
113  {1,1,1,1},
114  {1,1,1,1} };
115 
116 
117  Int_t mdcMods[6][4];
118 
119  ::Info("", "setting up MDC modules");
120  if(mdcsetup) ::Info("", "settings will be taken by input array");
121  else ::Info("", "settings will be taken by %s",beamtime.Data());
122  for(Int_t s=0;s<6;s++){
123  cout<<" sec "<<s;
124  for(Int_t m=0;m<4;m++){
125  if(mdcsetup == NULL){
126  if (beamtime.CompareTo("aug11") ==0) mdcMods[s][m] = mdcMods_aug11[s][m];
127  else if(beamtime.CompareTo("aug11_3sec")==0) mdcMods[s][m] = mdcMods_aug11_3sec[s][m];
128  else if(beamtime.CompareTo("apr12") ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
129  else if(beamtime.CompareTo("jul14") ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
130  else if(beamtime.CompareTo("aug18") ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
131  else if(beamtime.CompareTo("mar19") ==0) mdcMods[s][m] = mdcMods_apr12[s][m];
132  else {
133  ::Error("","Beam time = %s not supported !",beamtime.Data());
134  exit(1);
135  }
136  } else {
137  mdcMods[s][m] = mdcsetup[s][m];
138  }
139  cout<<" "<<mdcMods[s][m];
140  }
141  cout<<endl;
142  }
143 
144 
145 
146  Int_t tofMods [22] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
147  Int_t rpcMods [1] = {1};
148  Int_t showerMods[3] = {1,2,3};
149  Int_t emcMods [1] = {1};
150  Int_t nStartMods[10] = {1,1,1,1,0,0,0,0,0,0}; // before apr12
151  Int_t nStartModsApr12[10] = {1,1,1,1,1,0,0,0,0,0}; // apr12
152  Int_t nStartModsJul14[10] = {1,0,0,0,1,0,0,0,0,0}; // jul14 (+may14) start+hodo
153  Int_t nStartModsAug18[10] = {1,1,1,1,0,0,0,0,0,0}; // aug18 start+veto
154  Int_t nStartModsMar19[10] = {1,1,0,1,0,0,0,0,0,0}; // aug18 start+veto
155  Int_t pionTrackerMods[10] = {1,1,1,1,0,0,0,0,0,0}; // jul14
156  Int_t wallMods [1] = {1};
157  Int_t nTrigMods [1] = {1};
158  Int_t richMods [1] = {1};
159 
160  HSpectrometer* spec = gHades->getSetup();
161 
162  if(detectors.Contains("tbox")){
163  ::Info("","Adding TBox");
164  spec->addDetector(new HTBoxDetector);
165  spec->getDetector("TBox")->setModules(-1,nTrigMods);
166  }
167  if(detectors.Contains("start")) {
168  ::Info("","Adding START");
169  spec->addDetector(new HStart2Detector);
170  if( beamtime.CompareTo("aug11") ==0 ||
171  beamtime.CompareTo("aug11_3sec") ==0
172  ) {
173  spec->getDetector("Start")->setModules(-1,nStartMods);
174  } else if (beamtime.CompareTo("apr12") ==0) {
175  spec->getDetector("Start")->setModules(-1,nStartModsApr12);
176  } else if (beamtime.CompareTo("jul14") ==0) {
177  spec->getDetector("Start")->setModules(-1,nStartModsJul14);
178  } else if (beamtime.CompareTo("aug18") ==0) {
179  spec->getDetector("Start")->setModules(-1,nStartModsAug18);
180  } else if (beamtime.CompareTo("mar19") ==0) {
181  spec->getDetector("Start")->setModules(-1,nStartModsMar19);
182  }
183 
184  }
185  if(detectors.Contains("wall")) {
186  ::Info("","Adding WALL");
187  spec->addDetector(new HWallDetector);
188  spec->getDetector("Wall")->setModules(-1,wallMods);
189  }
190  if(detectors.Contains("piontracker")) {
191  ::Info("","Adding PionTracker");
193  spec->getDetector("PionTracker")->setModules(-1,pionTrackerMods);
194  }
195 
196  if(detectors.Contains("rich")) {spec->addDetector(new HRichDetector); ::Info("","Adding RICH"); }
197  if(detectors.Contains("mdc")) {spec->addDetector(new HMdcDetector); ::Info("","Adding MDC"); }
198  if(detectors.Contains("tof")) {spec->addDetector(new HTofDetector); ::Info("","Adding TOF"); }
199  if(detectors.Contains("rpc")) {spec->addDetector(new HRpcDetector); ::Info("","Adding RPC"); }
200  if(detectors.Contains("shower")){spec->addDetector(new HShowerDetector); ::Info("","Adding SHOWER");}
201  if(detectors.Contains("emc")) {spec->addDetector(new HEmcDetector); ::Info("","Adding EMC");}
202 
203  for (Int_t is=0; is<6; is++) {
204  if(detectors.Contains("rich")) spec->getDetector("Rich") ->setModules(is,richMods);
205  if(detectors.Contains("mdc")) spec->getDetector("Mdc") ->setModules(is,mdcMods[is]);
206  if(detectors.Contains("tof")) spec->getDetector("Tof") ->setModules(is,tofMods);
207  if(detectors.Contains("rpc")) spec->getDetector("Rpc") ->setModules(is,rpcMods);
208  if(detectors.Contains("shower"))spec->getDetector("Shower")->setModules(is,showerMods);
209  if(detectors.Contains("emc")) spec->getDetector("Emc") ->setModules(is,emcMods);
210  }
211 }
212 void HDst::setupParameterSources(TString parsource,TString asciiParFile,TString rootParFile,TString histDate)
213 {
214  // parsource = oracle,ascii,root (order matters)
215  // if source is "ascii" a ascii param file has to provided
216  // if source is "root" a root param file has to provided
217  // The histDate paramter (default "now") is used wit the oracle source
218  parsource.ToLower();
219  parsource.ReplaceAll(" ","");
220 
221  ::Info("setupParameterSources()", "\n----------- setting up parameter sources ----------------");
222 
223  Bool_t useOra = kFALSE;
224  Bool_t useAscii = kFALSE;
225  Bool_t useRoot = kFALSE;
226 
227  if(parsource.Contains("oracle")) useOra = kTRUE;
228  if(parsource.Contains("ascii")) useAscii = kTRUE;
229  if(parsource.Contains("root")) useRoot = kTRUE;
230 
231 
232  if(useAscii && asciiParFile == "") {
233  ::Error( "","Ascii source selected, but ascii file empty!");
234  exit(1);
235 
236  }
237  if(useRoot && rootParFile == "") {
238  ::Error( "","Root source selected, but root file empty!");
239  exit(1);
240  }
241  if(useOra && useRoot && useAscii) {
242 
243  ::Error( "","Root , Ascii and Ora cannot be active at the same time (only 2 of them)!");
244  exit(1);
245  }
246 
247  TObjArray* ar = parsource.Tokenize(",");
248 
249  if(ar){
250 
251  Int_t n = ar->GetEntries();
252 
253  if(n > 2 || n == 0){
254 
255  ::Error( "","To many ( > 2) or no param source specified !");
256  exit(1);
257  }
258  HRuntimeDb *rtdb = gHades->getRuntimeDb();
259 
260  for(Int_t i = 0; i < n; i ++){
261  TString parsrc = ((TObjString*)ar->At(i))->GetString();
262  if(parsrc == "ascii"){
263 
264  ::Info("", "Add ASCII as source %i reading from : %s",i+1,asciiParFile.Data());
265 
267  input->open((Text_t*)asciiParFile.Data(),"in");
268  if(i == 0) rtdb->setFirstInput(input);
269  else rtdb->setSecondInput(input);
270  }
271  else if(parsrc == "root"){
272 
273  ::Info("", "Add ROOT as source %i reading from : %s",i+1,rootParFile.Data());
274 
276  input->open((Text_t*)rootParFile.Data(),"READ");
277  if(i == 0) rtdb->setFirstInput(input);
278  else rtdb->setSecondInput(input);
279  }
280  else if(parsrc == "oracle"){
281 #ifdef ORACLE_SUPPORT
282  ::Info("", "Add ORACLE as source %i histdate = %s",i+1,histDate.Data());
283 
284  HParOra2Io *ora=new HParOra2Io() ;
285  ora->open();
286 
287  if(histDate.CompareTo("now")==0 || histDate.Contains("-")){
288  ora->setHistoryDate(histDate.Data());
289  } else {
290  ora->setParamRelease(histDate.Data());
291  }
292  if(i == 0) rtdb->setFirstInput(ora);
293  else rtdb->setSecondInput(ora);
294 #else
295  ::Error( "","ORCALE source specified but not supported !");
296  exit(1);
297 #endif
298  }
299  }
300 
301  ar->Delete();
302  delete ar;
303 
304  }
305 
306 }
307 
308 void HDst::setDataSource(Int_t sourceType,
309  TString inDir,
310  TString inFile,
311  Int_t refId,
312  TString eventbuilder
313  )
314 {
315 
316  // datasource 0 = hld, 1 = hldgrep 2 = hldremote, 3 root 4 geantmerge 5 hldstack(Processor task)
317  // like "lxhadeb02.gsi.de" needed by dataosoure = 2
318  // inputDir needed by dataosoure = 1,2
319  // inputFile needed by dataosoure = 1,3,4
320  // inputDir should be empty if not used (dataosoure = 0,3)
321  // inputFile can contain path if inputDir is empty
322  // for datasource 4 inputFile is a comma seprated list
323  // "file1_with_path,file2_with_path,file3_with_path"
324 
325  ::Info("setDataSource()","\n----------- setting up data sources ---------------------");
326 
327  if( sourceType == 0 ){
328  ::Info("", "Add HldFileSource");
329 
330  HldFileSource* source = new HldFileSource;
331  if(inDir !="") source->setDirectory((Text_t*) inDir.Data());
332 
333  if(inFile.Contains(",")) { // multiple file input
334  TObjArray* ar = 0;
335  if(inFile.Contains(",")){
336  ar = inFile.Tokenize(",");
337  if(ar) {
338  for(Int_t i=0;i<ar->GetEntries();i++){
339  TString file = ((TObjString*)ar->At(i))->GetString();
340  ::Info("", "%i : Add file %s",i,file.Data());
341  source->addFile((Text_t*) file.Data(),refId);
342  }
343  ar->Delete();
344  delete ar;
345  }
346  }
347  } else {
348  source->addFile((Text_t*) inFile.Data(),refId);
349  }
350 
351  gHades->setDataSource(source);
352  } else if ( sourceType == 1 ){
353  ::Info("", "Add HldGrepFileSource");
354  Int_t GrepInterval = 5 ; // look for new file each n seconds
355  Int_t GrepTimeOffset = 10; // at least n seconds old
356  Int_t GrepFileOffset = 0; // latest - GrepFileOffset file (minimum 0)
357  HldGrepFileSource* source = new HldGrepFileSource(inDir,"Grep",GrepInterval,refId,GrepTimeOffset,GrepFileOffset);
358  gHades->setDataSource(source);
359  } else if ( sourceType == 2 ){
360  ::Info("", "Add HldRemoteSource");
361  HldRemoteSource* source = new HldRemoteSource(eventbuilder.Data());
362  source->setRefId(refId);
363  gHades->setDataSource(source);
364  } else if ( sourceType == 3 ){
365  ::Info("", "Add HRootSource");
366  HRootSource* source = new HRootSource();
367  if(inDir !="") source->setDirectory((Text_t*) inDir.Data());
368 
369  if(inFile.Contains(",")) { // multiple file input
370  TObjArray* ar = 0;
371  if(inFile.Contains(",")){
372  ar = inFile.Tokenize(",");
373  if(ar) {
374  for(Int_t i=0;i<ar->GetEntries();i++){
375  TString file = ((TObjString*)ar->At(i))->GetString();
376  ::Info("", "%i : Add file %s",i,file.Data());
377  source->addFile((Text_t*) file.Data());
378  }
379  ar->Delete();
380  delete ar;
381  }
382  }
383  } else {
384  source->addFile((Text_t*) inFile.Data());
385  }
386  source->setGlobalRefId(refId);
387  gHades->setDataSource(source);
388  } else if ( sourceType == 4 ){
389  ::Info("", "Add HGeantMergeSource");
390  HGeantMergeSource* source = new HGeantMergeSource();
391  source->addMultFiles(inFile);
392  source->setGlobalRefId(refId);
393  gHades->setDataSource(source);
394  } else if( sourceType == 5 ){
395  ::Info("", "Add HldStackSource");
396 
397  HldStackSource* source = new HldStackSource;
398  gHades->setDataSource(source);
399  } else {
400  ::Error("","Unknown source type = %i !",sourceType);
401  exit(1);
402  }
403 }
404 
405 void HDst::setSecondDataSource(TString inDir,
406  TString inFile,
407  Int_t refId
408  )
409 {
410 
411  // second datasource is a root source (used for embedding)
412  // inputDir should be empty if not used
413  // inputFile can contain path if inputDir is empty
414 
415  ::Info("setDataSource()","\n----------- setting up data sources ---------------------");
416 
417  ::Info("", "Add second DataSource");
418 
419  HRootSource* source = new HRootSource(kTRUE,kTRUE);
420  if(inDir !="") source->setDirectory((Text_t*) inDir.Data());
421  source->addFile((Text_t*) inFile.Data());
422  source->setGlobalRefId(refId);
423  gHades->setSecondDataSource(source);
424 }
425 
426 void HDst::setupUnpackers(TString beamtime,TString detectors,Bool_t correctINL)
427 {
428  // beamtime aug11 apr12 jul14 aug14 aug18 mar19
429  // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,latch,start
430  // The data source has to be set before!
431  ::Info("setupUnpackers()", "\n----------- setting up unpackers ---------------------");
432 
433  beamtime.ToLower();
434  detectors.ToLower();
435 
436  if(beamtime.CompareTo("may14")==0) beamtime = "jul14";
437  if(beamtime.CompareTo("aug14")==0) beamtime = "jul14";
438 
439  if (beamtime.CompareTo("aug11") ==0);
440  else if(beamtime.CompareTo("apr12") ==0);
441  else if(beamtime.CompareTo("jul14") ==0);
442  else if(beamtime.CompareTo("aug18") ==0);
443  else if(beamtime.CompareTo("mar19") ==0);
444  else {
445  ::Error("","Beam time = %s not supported !",beamtime.Data());
446  exit(1);
447  }
448 
449 
450  //Data source
451  HldSource *source = (HldSource *)gHades->getDataSource();
452 
453 
454  if(source == NULL) {
455  ::Error( "","Datasource source not set !");
456  exit(1);
457  }
458 
459  TString classname = source->ClassName();
460 
461  if(classname == "HRootSource") {
462  ::Error( "","Datasource is HRootSource , not compatibel with unpackers !");
463  exit(1);
464  }
465 
466 
467  if(beamtime == "aug11")
468  {
469  ::Info("", "Using aug11 setup");
470 
471  Int_t mdcUnpackers [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
472  Int_t rpcUnpackers [2] = {0x8400,0x8410}; //
473  Int_t startUnpackers [1] = {0x8800}; //
474  Int_t tofUnpackers [1] = {0x8600}; //
475  Int_t wallUnpackers [1] = {0x8700}; //
476  Int_t showerUnpackers[6] = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
477  Int_t richUnpackers [3] = {0x8300,0x8310,0x8320};
478 
479 
480  if(detectors.Contains("wall")) {
481  ::Info("", "Adding WALL unpackers");
482 
483  for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
484  {
485  cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
486  HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
487  wallUnpacker->setQuietMode();
488  wallUnpacker->removeTimeRef();
489  source->addUnpacker( wallUnpacker);
490  }
491  cout<<endl;
492  }
493 
494  if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
495  if(detectors.Contains("tbox")) {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) ); ::Info("", "Adding TBOX unpacker");}
496 
497  if(detectors.Contains("rich")){
498  ::Info("", "Adding RICH unpackers");
499 
500  for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
501  cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
502  source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
503  }
504  cout<<endl;
505  }
506 
507  if(detectors.Contains("mdc")){
508  ::Info("", "Adding MDC unpackers");
509 
510  for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
511  cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
512  HMdcUnpacker* mdc_unpacker = new HMdcUnpacker( mdcUnpackers[i], kFALSE );
513  mdc_unpacker->setQuietMode(kTRUE,kFALSE);
514 
515  mdc_unpacker->setFillDataWord(kFALSE);
516  //mdc_unpacker->setFillOepStatus(kTRUE);
517  mdc_unpacker->setPersistencyDataword(kTRUE);
518  mdc_unpacker->setPersistencyOepStatusData(kFALSE);
519  source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
520  }
521  cout<<endl;
522  }
523 
524  if(detectors.Contains("shower")){
525  ::Info("", "Adding SHOWER unpackers");
526 
527  for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
528  cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
529  source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
530  }
531  cout<<endl;
532  }
533 
534  if(detectors.Contains("tof")){
535  ::Info("", "Adding TOF unpackers");
536 
537  for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
538  cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
539  HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
540  tofUnp->setDebugFlag(0);
541  //tofUnp->setQuietMode();
542  if(correctINL)tofUnp->setcorrectINL();
543  tofUnp->removeTimeRef();
544  source->addUnpacker( tofUnp );
545  }
546  cout<<endl;
547  }
548 
549  if(detectors.Contains("start")){
550  ::Info("", "Adding START unpackers");
551 
552  for(UInt_t i=0; i<(sizeof(startUnpackers)/sizeof(Int_t)); i++){
553  cout<<hex<<startUnpackers[i]<<", "<<dec<<flush;
554  HStart2Trb2Unpacker *startUnp = new HStart2Trb2Unpacker(startUnpackers[i]);
555  startUnp->setDebugFlag(0);
556  if(correctINL)startUnp->setcorrectINL();
557  //startUnp->setQuietMode();
558 
559  source->addUnpacker( startUnp );
560  }
561  cout<<endl;
562  }
563 
564  if(detectors.Contains("rpc")){
565  ::Info("", "Adding RPC unpackers");
566  for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){
567 
568  cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
569  HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
570  //rpcTrb2Unpacker->setQuietMode();
571  rpcTrb2Unpacker->setDebugFlag(0);
572  if(correctINL)rpcTrb2Unpacker->setcorrectINL();
573  source->addUnpacker(rpcTrb2Unpacker);
574  }
575  }
576  cout<<endl;
577 
578  } else if(beamtime == "apr12") {
579  ::Info("", "Using apr12 setup");
580 
581  Int_t mdcUnpackers [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
582  Int_t rpcUnpackers [2] = {0x8400,0x8410}; //
583  Int_t startUnpackers [1] = {0x8800}; //
584  Int_t tofUnpackers [1] = {0x8600}; //
585  Int_t wallUnpackers [1] = {0x8700}; //
586  Int_t showerUnpackers[6] = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
587  Int_t richUnpackers [3] = {0x8300,0x8310,0x8320};
588 
589 
590  if(detectors.Contains("wall")) {
591  ::Info("", "Adding WALL unpackers");
592 
593  for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
594  {
595  cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
596  HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
597  wallUnpacker->setQuietMode();
598  wallUnpacker->removeTimeRef();
599  source->addUnpacker( wallUnpacker);
600  }
601  cout<<endl;
602  }
603 
604  if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
605  if(detectors.Contains("tbox")) {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) ); ::Info("", "Adding TBOX unpacker");}
606 
607  if(detectors.Contains("rich")){
608  ::Info("", "Adding RICH unpackers");
609 
610  for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
611  cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
612  source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
613  }
614  cout<<endl;
615  }
616 
617  if(detectors.Contains("mdc")){
618  ::Info("", "Adding MDC unpackers");
619 
620  for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
621  cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
622  HMdcUnpacker* mdc_unpacker = new HMdcUnpacker( mdcUnpackers[i], kFALSE );
623  mdc_unpacker->setQuietMode(kTRUE,kFALSE);
624 
625  mdc_unpacker->setFillDataWord(kFALSE);
626  mdc_unpacker->setFillOepStatus(kTRUE);
627  mdc_unpacker->setPersistencyDataword(kTRUE);
628  mdc_unpacker->setPersistencyOepStatusData(kTRUE);
629  source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
630  }
631  cout<<endl;
632  }
633 
634  if(detectors.Contains("shower")){
635  ::Info("", "Adding SHOWER unpackers");
636 
637  for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
638  cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
639  source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
640  }
641  cout<<endl;
642  }
643 
644  if(detectors.Contains("tof")){
645  ::Info("", "Adding TOF unpackers");
646 
647  for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
648  cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
649  HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
650  tofUnp->setDebugFlag(0);
651  //tofUnp->setQuietMode();
652  if(correctINL)tofUnp->setcorrectINL();
653  tofUnp->removeTimeRef();
654  source->addUnpacker( tofUnp );
655  }
656  cout<<endl;
657  }
658 
659  if(detectors.Contains("start")){
660  ::Info("", "Adding START unpackers");
661 
662  for(UInt_t i=0; i<(sizeof(startUnpackers)/sizeof(Int_t)); i++){
663  cout<<hex<<startUnpackers[i]<<", "<<dec<<flush;
664  HStart2Trb2Unpacker *startUnp = new HStart2Trb2Unpacker(startUnpackers[i]);
665  startUnp->setDebugFlag(0);
666  if(correctINL)startUnp->setcorrectINL();
667  //startUnp->setQuietMode();
668  //startUnp->disableTimeRef(); // new since apr12 , only for cosmics
669  source->addUnpacker( startUnp );
670  }
671  cout<<endl;
672  }
673 
674  if(detectors.Contains("rpc")){
675  ::Info("", "Adding RPC unpackers");
676  for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){
677 
678  cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
679  HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
680  //rpcTrb2Unpacker->setQuietMode();
681  rpcTrb2Unpacker->setDebugFlag(0);
682  if(correctINL)rpcTrb2Unpacker->setcorrectINL();
683  source->addUnpacker(rpcTrb2Unpacker);
684  }
685  }
686  cout<<endl;
687 
688  } else if(beamtime == "jul14") {
689  ::Info("", "Using jul14 setup");
690 
691  Int_t mdcUnpackers [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
692  Int_t rpcUnpackers [3] = {0x8400,0x8410,0x8420};
693  Int_t startUnpackers [1] = {0x8800}; // CTS-Hub
694  Int_t startUnpackersTrb3 [2] = {0x8880,0x8890}; // start+hodo
695  Int_t pionTrackerUnpackers[2] = {0x8900,0x8910};
696  Int_t tofUnpackers [1] = {0x8600}; //
697  Int_t wallUnpackers [1] = {0x8700}; //
698  Int_t showerUnpackers[6] = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
699  Int_t richUnpackers [3] = {0x8300,0x8310,0x8320};
700 
701 
702  if(detectors.Contains("wall")) {
703  ::Info("", "Adding WALL unpackers");
704 
705  for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
706  {
707  cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
708  HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
709  wallUnpacker->setQuietMode();
710  wallUnpacker->removeTimeRef();
711  source->addUnpacker( wallUnpacker);
712  }
713  cout<<endl;
714  }
715 
716  if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
717  if(detectors.Contains("tbox")) {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) ); ::Info("", "Adding TBOX unpacker");}
718 
719  if(detectors.Contains("rich")){
720  ::Info("", "Adding RICH unpackers");
721 
722  for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
723  cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
724  source->addUnpacker( new HRichUnpacker(richUnpackers[i]) );
725  }
726  cout<<endl;
727  }
728 
729  if(detectors.Contains("mdc")){
730  ::Info("", "Adding MDC unpackers");
731 
732  for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
733  cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
734  HMdcUnpacker* mdc_unpacker = new HMdcUnpacker( mdcUnpackers[i], kFALSE );
735  mdc_unpacker->setQuietMode(kTRUE,kFALSE);
736 
737  mdc_unpacker->setFillDataWord(kFALSE);
738  mdc_unpacker->setFillOepStatus(kTRUE);
739  mdc_unpacker->setPersistencyDataword(kTRUE);
740  mdc_unpacker->setPersistencyOepStatusData(kFALSE);
741  source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
742  }
743  cout<<endl;
744  }
745 
746  if(detectors.Contains("shower")){
747  ::Info("", "Adding SHOWER unpackers");
748 
749  for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
750  cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
751  source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
752  }
753  cout<<endl;
754  }
755 
756  if(detectors.Contains("tof")){
757  ::Info("", "Adding TOF unpackers");
758 
759  for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
760  cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
761  HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
762  tofUnp->setDebugFlag(0);
763  //tofUnp->setQuietMode();
764  if(correctINL)tofUnp->setcorrectINL();
765  tofUnp->removeTimeRef();
766  source->addUnpacker( tofUnp );
767  }
768  cout<<endl;
769  }
770 
771  if(detectors.Contains("start")){
772  ::Info("", "Adding START unpackers");
773 
774  vector<UInt_t>ids;
775  for(UInt_t i=0; i<(sizeof(startUnpackersTrb3)/sizeof(Int_t)); i++){
776  cout<<hex<<startUnpackersTrb3[i]<<", "<<dec<<flush;
777  ids.push_back(startUnpackersTrb3[i]);
778  }
779  cout<<endl;
780 
781  HStart2Trb3Unpacker *startUnp = new HStart2Trb3Unpacker(ids);
782  startUnp->setDebugFlag(0);
783  startUnp->setQuietMode();
784  startUnp->setCTSId(0x8000);
785  source->addUnpacker( startUnp );
786 
787  }
788 
789  if(detectors.Contains("piontracker")){
790  ::Info("", "Adding PionTracker unpackers");
791 
792  for(UInt_t i=0; i<(sizeof(pionTrackerUnpackers)/sizeof(Int_t)); i++){
793  cout<<hex<<pionTrackerUnpackers[i]<<", "<<dec<<flush;
794  HPionTrackerTrb3Unpacker *pionTrackerUnp = new HPionTrackerTrb3Unpacker(pionTrackerUnpackers[i]);
795  pionTrackerUnp->setDebugFlag(0);
796  pionTrackerUnp->setQuietMode();
797  source->addUnpacker( pionTrackerUnp );
798  }
799  cout<<endl;
800  }
801 
802  if(detectors.Contains("rpc")){
803  ::Info("", "Adding RPC unpackers");
804  for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){
805 
806  cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
807  HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
808  //rpcTrb2Unpacker->setQuietMode();
809  rpcTrb2Unpacker->setDebugFlag(0);
810  if(correctINL)rpcTrb2Unpacker->setcorrectINL();
811  source->addUnpacker(rpcTrb2Unpacker);
812  }
813  }
814  cout<<endl;
815  }
816  else if(beamtime == "aug18" || beamtime == "mar19") {
817 
818  if(beamtime == "aug18")::Info("", "Using aug18 setup");
819  else ::Info("", "Using mar19 setup");
820 
821  Int_t mdcUnpackers [12] = {0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050};
822  Int_t rpcUnpackers [3] = {0x8400,0x8410,0x8420};
823  Int_t startUnpackers [1] = {0x8800}; // CTS-Hub
824  Int_t startUnpackersTrb3 [1] = {0x8880}; //start
825  Int_t pionTrackerUnpackers[2] = {0x8900,0x8910};
826  Int_t tofUnpackers [1] = {0x8600}; //
827  Int_t wallUnpackers [1] = {0x8700}; //
828  Int_t showerUnpackers[6] = {0x3200,0x3210,0x3220,0x3230,0x3240,0x3250}; //
829  Int_t richUnpackers [12] = {0x83c0,0x83c1,0x83c2,0x83c3,0x83c4,0x83c5,0x83c6,0x83c7,0x83c8,0x83c9,0x83ca,0x83cb};
830  Int_t emcUnpackers [6] = {0x8A00,0x8A01,0x8A02,0x8A03,0x8A04,0x8A05};
831 
832  if(detectors.Contains("wall")) {
833  ::Info("", "Adding WALL unpackers");
834 
835  for(UInt_t i=0; i<(sizeof(wallUnpackers)/sizeof(Int_t)); i++)
836  {
837  cout<<hex<<wallUnpackers[i]<<", "<<dec<<flush;
838  HWallTrb2Unpacker* wallUnpacker=new HWallTrb2Unpacker(wallUnpackers[i]);
839  wallUnpacker->setQuietMode();
840  wallUnpacker->removeTimeRef();
841  source->addUnpacker( wallUnpacker);
842  }
843  cout<<endl;
844  }
845 
846  if(detectors.Contains("latch")) {source->addUnpacker( new HLatchUnpacker(startUnpackers[0]) ); ::Info("", "Adding LATCH unpacker");}
847  if(detectors.Contains("tbox")) {source->addUnpacker( new HTBoxUnpacker(startUnpackers[0]) ); ::Info("", "Adding TBOX unpacker");}
848 
849  if(detectors.Contains("rich")){
850  ::Info("", "Adding RICH unpackers");
851  vector<UInt_t>ids;
852  for(UInt_t i=0; i<(sizeof(richUnpackers)/sizeof(Int_t)); i++){
853  cout<<hex<<richUnpackers[i]<<", "<<dec<<flush;
854  ids.push_back(richUnpackers[i]);
855  }
856  cout<<endl;
857 
859  //unp->setMinAddress(Trbnet::kRICHTrb3MinTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
860  //unp->setMaxAddress(Trbnet::kRICHTrb3MaxTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
861  unp->setDebugFlag(0);
862  unp->setQuietMode();
863  source->addUnpacker( unp );
864 
865  }
866 
867  if(detectors.Contains("mdc")){
868  ::Info("", "Adding MDC unpackers");
869 
870  for(UInt_t i=0; i<(sizeof(mdcUnpackers)/sizeof(Int_t)); i++) {
871  cout<<hex<<mdcUnpackers[i]<<", "<<dec<<flush;
872  HMdcUnpacker* mdc_unpacker = new HMdcUnpacker( mdcUnpackers[i], kFALSE );
873  mdc_unpacker->setQuietMode(kTRUE,kFALSE);
874 
875  mdc_unpacker->setFillDataWord(kFALSE);
876  mdc_unpacker->setFillOepStatus(kTRUE);
877  mdc_unpacker->setPersistencyDataword(kTRUE);
878  mdc_unpacker->setPersistencyOepStatusData(kFALSE);
879  source->addUnpacker( (HMdcUnpacker*)mdc_unpacker );
880  }
881  cout<<endl;
882  }
883 
884  if(detectors.Contains("shower")){
885  ::Info("", "Adding SHOWER unpackers");
886 
887  for(UInt_t i=0; i<(sizeof(showerUnpackers)/sizeof(Int_t)); i++) {
888  cout<<hex<<showerUnpackers[i]<<", "<<dec<<flush;
889  source->addUnpacker( new HShowerUnpacker(showerUnpackers[i]) );
890  }
891  cout<<endl;
892  }
893 
894  if(detectors.Contains("tof")){
895  ::Info("", "Adding TOF unpackers");
896 
897  for(UInt_t i=0; i<(sizeof(tofUnpackers)/sizeof(Int_t)); i++){
898  cout<<hex<<tofUnpackers[i]<<", "<<dec<<flush;
899  HTofTrb2Unpacker *tofUnp = new HTofTrb2Unpacker(tofUnpackers[i]);
900  tofUnp->setDebugFlag(0);
901  //tofUnp->setQuietMode();
902  if(correctINL)tofUnp->setcorrectINL();
903  tofUnp->removeTimeRef();
904  source->addUnpacker( tofUnp );
905  }
906  cout<<endl;
907  }
908 
909  if(detectors.Contains("start")){
910  ::Info("", "Adding START unpackers");
911  vector<UInt_t>ids;
912  for(UInt_t i=0; i<(sizeof(startUnpackersTrb3)/sizeof(Int_t)); i++){
913  cout<<hex<<startUnpackersTrb3[i]<<", "<<dec<<flush;
914  ids.push_back(startUnpackersTrb3[i]);
915  }
916  cout<<endl;
917  HStart2Trb3Unpacker *startUnp = new HStart2Trb3Unpacker(ids);
918  startUnp->setDebugFlag(0);
919  startUnp->setQuietMode();
920  startUnp->setCTSId(0x8000);
921  //startUnp->setMinAddress(Trbnet::kStartTrb3MinTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
922  //startUnp->setMaxAddress(Trbnet::kStartTrb3MaxTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
923  source->addUnpacker( startUnp );
924  }
925 
926  if(detectors.Contains("piontracker")){
927  ::Info("", "Adding PionTracker unpackers");
928 
929  for(UInt_t i=0; i<(sizeof(pionTrackerUnpackers)/sizeof(Int_t)); i++){
930  cout<<hex<<pionTrackerUnpackers[i]<<", "<<dec<<flush;
931  HPionTrackerTrb3Unpacker *pionTrackerUnp = new HPionTrackerTrb3Unpacker(pionTrackerUnpackers[i]);
932  pionTrackerUnp->setDebugFlag(0);
933  pionTrackerUnp->setQuietMode();
934  source->addUnpacker( pionTrackerUnp );
935  }
936  cout<<endl;
937 
938  }
939 
940  if(detectors.Contains("rpc")){
941  ::Info("", "Adding RPC unpackers");
942  for(UInt_t i=0; i<(sizeof(rpcUnpackers)/sizeof(Int_t)); i++){
943 
944  cout<<hex<<rpcUnpackers[i]<<", "<<dec<<flush;
945  HRpcTrb2Unpacker *rpcTrb2Unpacker = new HRpcTrb2Unpacker(rpcUnpackers[i]);
946  //rpcTrb2Unpacker->setQuietMode();
947  rpcTrb2Unpacker->setDebugFlag(0);
948  if(correctINL)rpcTrb2Unpacker->setcorrectINL();
949  source->addUnpacker(rpcTrb2Unpacker);
950  }
951  cout<<endl;
952  }
953 
954  if(detectors.Contains("emc"))
955  {
956  ::Info("", "Adding Emc unpackers");
957  vector<UInt_t>ids;
958  for(UInt_t i=0; i<(sizeof(emcUnpackers)/sizeof(Int_t)); i++){
959  cout<<hex<<emcUnpackers[i]<<", "<<dec<<flush;
960  ids.push_back(emcUnpackers[i]);
961  }
962  cout << endl;
963  HEmcTrb3Unpacker * emcUnp = new HEmcTrb3Unpacker(ids);
964  //emcUnp->setMinAddress(Trbnet::kEmcTrb3MinTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
965  //emcUnp->setMaxAddress(Trbnet::kEmcTrb3MaxTrbnetAddress); // set this for auto registering TDCs, otherwise tdc list will be used from lookup table
966  emcUnp->setDebugFlag(0);
967  emcUnp->setQuietMode();
968  source->addUnpacker( emcUnp );
969  }
970  }
971 
972  else {
973 
974  ::Error( "setupUnpackers()","unknown beamtime = %s!",beamtime.Data());
975  exit(1);
976  }
977 }
virtual void setModules(Int_t sec, Int_t *modules)
Definition: hdetector.cc:69
TString asciiParFile
Definition: mdcEfficiency.C:27
void setFillDataWord(Bool_t b)
Definition: hmdcunpacker.h:89
TString rootParFile
Definition: mdcEfficiency.C:28
static void setupParameterSources(TString parsource="oracle", TString asciiParFile="", TString rootParFile="", TString histDate="now")
Definition: hdst.cc:212
void removeTimeRef(void)
HDataSource * getDataSource(void) const
Definition: hades.h:124
Bool_t open(const Text_t *fname, const Option_t *option="READ", const Text_t *ftitle="", Int_t compress=1)
HRuntimeDb * getRuntimeDb(void)
Definition: hades.h:111
static void setDataSource(Int_t sourceType=-1, TString inDir="", TString inFile="", Int_t refId=-1, TString eventbuilder="lxhadeb02.gsi.de")
Definition: hdst.cc:308
Int_t n
void addDetector(HDetector *det)
Bool_t open(const Text_t *fname, const Text_t *status="in")
TString beamtime
Definition: mdcEfficiency.C:9
Bool_t setFirstInput(HParIo *)
Definition: hruntimedb.cc:593
Bool_t setSecondInput(HParIo *)
Definition: hruntimedb.cc:607
void setPersistencyDataword(Bool_t b=kTRUE)
Definition: hmdcunpacker.h:91
void setQuietMode(Bool_t quiet=kTRUE, Bool_t warn=kTRUE)
TString input
Definition: GarReader.C:5
HSpectrometer * getSetup(void)
Definition: hades.h:112
HDetector * getDetector(const Char_t *name)
static void setupUnpackers(TString beamtime="aug11", TString detectors="rich,mdc,tof,rpc,shower,wall,tbox,latch,start", Bool_t correctINL=kTRUE)
Definition: hdst.cc:426
Definition: hdst.h:8
void setFillOepStatus(Bool_t b)
Definition: hmdcunpacker.h:90
Hades * gHades
Definition: hades.cc:1213
ClassImp(HDst) void HDst
Definition: hdst.cc:64
Int_t mdcMods[6][4]
Definition: mdcEfficiency.C:31
void removeTimeRef(void)
static void setSecondDataSource(TString inDir="", TString inFile="", Int_t refId=-1)
Definition: hdst.cc:405
void setPersistencyOepStatusData(Bool_t b=kTRUE)
Definition: hmdcunpacker.h:92
void setDataSource(HDataSource *dataS)
Definition: hades.cc:441
void setSecondDataSource(HDataSource *dataS)
Definition: hades.cc:452