HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mdcEfficiency.C
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////
2 //Using:
3 // root [0] .x mdcTrackD.C();
4 // or
5 // root [0] .x mdcTrackD.C("file_name"); (inDir will used !!!)
6 ////////////////////////////////////////////////////////////////////
7 gROOT->Reset();
8 
9 TString beamtime = "aug18";
10 
11 //=Input and Output files and directory=============================
12 Char_t *default_indir = "/lustre/hebe/hades/raw/jul18/default/tsm";
13 Int_t refrunID = 208536802; //-1; //1; // run number used to initialize rtdb
14 TString paramrelease = "now"; // now, APR12_gen2_dst
15 
16 Char_t* inFiles[] = {
17  "co1835219073101.hld","co1835221005501.hld","co1835302574401.hld","co1835303201901.hld"
18 // "co1831101000201.hld","co1831105232801.hld","co1831105392501.hld","co1831106032501.hld"
19 };
20 
21 Int_t trBits = -1; //8192; //-1; //2048+8192; // select events with setted bits
22 Bool_t doStartCorrection = kFALSE; // kTRUE (default)= use run by run start corrections
23 Bool_t makeTree = kFALSE; //kTRUE; // do tree or not, if=kTRUE the HMdcClusterToHit task will added to tasks list
24 
25 // Parameters sources:
26 TString paramSource = "ascii,root"; // root, ascii, oracle
27 TString asciiParFile = "./all_params_ver1.txt";
28 TString rootParFile = "./allParam_AUG18_gen0_09072018_170916.root";
29 
30 // List of modules:
31 Int_t mdcMods[6][4] = { {1,1,1,1},
32  {1,1,1,1},
33  {1,1,1,1},
34  {1,1,1,1},
35  {1,1,1,1},
36  {1,1,1,1} };
37 Int_t nLayers[6][4] = { {6,6,6,6},
38  {6,6,6,6},
39  {6,6,6,6},
40  {6,6,6,6},
41  {6,6,6,6},
42  {6,6,6,6} };
43 
44 
45 //===Mdc time cuts=======================================================
46 // cutStatus=0 - HMdcCalibrater1, HMdcTrackFinder
47 // and HMdcEfficiency will not do time cuts.
48 // cutStatus=1 - HMdcCalibrater1 will not do time cuts,
49 // HMdcTrackFinder and HMdcEfficiency will do time cuts.
50 // cutStatus=2 - HMdcCalibrater1 will do time cuts.
51 // sourceCutPar=0 - using param. of time cuts from parameters files
52 // sourceCutPar=1 - seting of cut parameters in this macro.
53 //
54 // For selecting and checking cuts look on the time distributions
55 // with out any cuts (cutStatus=0;).
56 // Attention! The cuts in this example of macros seted for non calibreted
57 // data (HMdcCalibrater1("MdcCali1","MdcCali1",3,0)). If you use
58 // the calibrated data you need to change of cut.
59 //
60 // calibrater1Ver = 1 - No Start and Cal
61 // = 2 - Start and Cal
62 // = 3 - No Start and no Cal
63 
64 Int_t calibrater1Ver = 1; //2; //3; //1; // see class HMdcCalibrater1
65 Int_t cutStatus = 1; //2; //1; //0;
66 Int_t sourceCutPar = 0; //1; //0;
67 
68 Float_t cutTime1L[4] = { -80., -90., -90., -100.};
69 Float_t cutTime1R[4] = { 1100., 1200., 1700., 1700.};
70 Float_t cutTime2L[4] = {-2000.,-2000.,-2000.,-2000.};
71 Float_t cutTime2R[4] = { 2000., 2000., 2000., 2000.};
72 Float_t cutLeft [4] = { 22., 24., 26., 38.};
73 Float_t cutRight [4] = { 500., 500., 600., 700.};
74 Float_t cutReplace[4] = { 0., 0., 0., 0.};
75 
76 Bool_t setGlobOffset = kFALSE; //kTRUE;
77 Float_t glOffs[6][4] = { //MDC I, II, III, IV
78  {-30., -30., -40., -40.},
79  {-30., -30., -40., -40.},
80  {-30., -30., -40., -40.},
81  {-30., -30., -40., -40.},
82  {-30., -30., -40., -40.},
83  {-30., -30., -40., -40.} };
84 
85 //=Parameters of track finder and efficiency tasks:=====================
86 // Type of working of Dubna cluster finder:
87 // isCoilOff=kTRUE(kFULSE) - The current in coil is switched off(on).
88 // typeClustFinder=1(0)
89 // isCoilOff=kTRUE, typeClustFinder=1:
90 // The tracks will searched in each MDC (1-4) independent
91 // isCoilOff=kTRUE, typeClustFinder=0:
92 // The tracks will searched in all MDC of sector together
93 // (needs in a alignment of MDC's)
94 // isCoilOff=kFALSE, typeClustFinder=1:
95 // The tracks will searched in MDC1, MDC2 (segment 1) independent,
96 // in MDC3, MDC4 (segment 2) together, but information about
97 // hits in segment 2 will not used for estimation of efficiency
98 // (it will be done in the future).
99 // isCoilOff=kFALSE, typeClustFinder=0:
100 // The tracks will searched in MDC1, MDC2 (segment 1) together
101 // (needs in a alignment of MDC's) and
102 // in MDC3, MDC4 (segment 2) alsow together, but information about
103 // hits in segment 2 will not used for estimation of efficiency
104 // (it will be done in the future).
105 // For isCoilOff=kFALSE the program needs in HKickPlane parameters
106 Bool_t isCoilOff = kTRUE;
107 Int_t typeClustFinder = 1; // =1,0 1-independent,
108 
109 // HMdcClus persistency:
110 Bool_t persistency = kFALSE; // write or not the HMdcClus data in output file
111 
112 // Parameters for cluster finder for estimatin of efficiency:
113 Int_t level4s1 = 4;
114 Int_t level5s1 = 100000;
115 Int_t level4s2 = 4;
116 Int_t level5s2 = 100000;
117 
118 
119 //======================================================================
122 //======================================================================
123 
124 void mdcEfficiency(Char_t* fileI=0, Char_t* inDir2=0)
125 {
126  TString inDir(inDir2==NULL ? default_indir : inDir2);
127 
128  new Hades();
129  gHades->setQuietMode();
130  HRuntimeDb* rtdb = gHades->getRuntimeDb();
131 
132 
133  HDst::setupSpectrometer(beamtime,mdcMods,"mdc,start,tbox");
134  // Int_t mdcset[6][4] setup mdc. If not used put NULL (default).
135  // if not NULL it will overwrite settings given by beamtime
136  // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,start
137 
138  HDst::setupParameterSources(paramSource,asciiParFile,rootParFile,paramrelease); // now, APR12_gen2_dst
139  //HDst::setupParameterSources("oracle",asciiParFile,rootParFile,"now"); // use to create param file
140  // parsource = oracle,ascii,root (order matters)
141  // if source is "ascii" a ascii param file has to provided
142  // if source is "root" a root param file has to provided
143  // The histDate paramter (default "now") is used wit the oracle source
144 
145  // Data source settings:
146  if(fileI) {
147  HDst::setDataSource(0,inDir,fileI,refrunID); // Int_t sourceType,TString inDir,TString inFile,Int_t refId, TString eventbuilder"
148  } else {
149  Int_t numInFiles = sizeof(inFiles)/sizeof(*inFiles);
150  HDst::setDataSource(0,inDir,inFiles[0],refrunID);
151  for(Int_t n=1;n<numInFiles; n++) ((HldFileSource*)gHades->getDataSource())->addFile(inFiles[n],refrunID);
152  }
153 
154  // Unpackers:
155  HDst::setupUnpackers(beamtime,"mdc,tbox,latch,start"); // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,latch,start
156 
157  // Time cuts settings:
158  if(cutStatus==1 || (cutStatus==2 && sourceCutPar==1)) {
159  HMdcTimeCut* fcut=new HMdcTimeCut();
160  rtdb->addContainer(fcut);
161  if(sourceCutPar==1) {
162  fcut->setCut(cutTime1L, cutTime1R, cutTime2L,cutTime2R, cutLeft,cutRight,cutReplace,cutReplace,cutReplace,cutReplace);
163  fcut->setStatic(kTRUE);
164  }
165  if(cutStatus==1) fcut->setIsUsed(kFALSE);
166  }
167 
168  // Tasks:-------------------------------------------------
169  HMdcTrackFinder* trackFinder;
170  HStartTaskSet *startTaskSet = new HStartTaskSet();
171  HTaskSet *tasks = new HTaskSet("MDC","Mdc Track Finding Display");
172 
173  startTasks = startTaskSet ->make("real");
174 
175  HTrbnetAddressMapping* trbnetmap = (HTrbnetAddressMapping*)rtdb->getContainer("TrbnetAddressMapping");
176  rtdb->initContainers(refrunID);
177  trbnetmap->setStatic();
178 
179  HMdcCalibrater1* cal1;
180  tasks->add((cal1=new HMdcCalibrater1("MdcCali1","MdcCali1",calibrater1Ver,(cutStatus<=1)?0:1)));
181  tasks->add((trackFinder=new HMdcTrackFinder("MdcTrackD","MdcTrackD",isCoilOff,typeClustFinder)));
182  tasks->add((mdcEff=new HMdcEfficiency("MdcEff","MdcEff")));
183  if(trBits != -1) mdcEff->selectEventWithTBits(trBits);
184  if(makeTree) tasks->add((new HMdcClusterToHit("ClToHit","ClToHit")));
185 
186  if(setGlobOffset) {
187  for(Int_t s=0;s<6;s++) cal1->setSecGlobalOffset(s, glOffs[s][0], glOffs[s][1], glOffs[s][2], glOffs[s][3]);
188  }
189 
190  gHades->getTaskSet("real")->connect(startTasks);
191  gHades->getTaskSet("real")->add(tasks);
192  gHades->getTaskSet("real")->print();
193 
194 
195  //====Seting of parameters of mdcTrackFinder===============
196  trackFinder->setPersistency(persistency);
197  trackFinder->setLevel(level4s1, level5s1, level4s2, level5s2);
198  trackFinder->setNLayers(&nLayers[0][0]);
199 
200  //==== Start Calibrater: ==================================
201  HStart2Calibrater::setCorrection(doStartCorrection);
202 
203  //=====Init ===============================================
204  if (!gHades->init()) {
205  Error("init()","Hades did not initialize ...");
206  exit(1);
207  }
208  cout << "init finished" << endl;
209 
210  if(makeTree) gHades->makeTree();
211 
212  gHades->eventLoop(1);
213  // ((HMdcOepAddrCorrPar*)(rtdb->getContainer("MdcOepAddrCorrPar")))->printParam();
214 
215  // Start EffMenu: =========================================
216  effMenu=HMdcEffMenu::makeMenu(mdcEff);
217  // delete gHades;
218 }
Int_t refrunID
Definition: mdcEfficiency.C:13
TString asciiParFile
Definition: mdcEfficiency.C:27
Float_t cutTime1R[4]
Definition: mdcEfficiency.C:69
void setIsUsed(Bool_t flag)
Definition: hmdctimecut.h:150
TString rootParFile
Definition: mdcEfficiency.C:28
void setQuietMode(UChar_t mode=1)
Definition: hades.h:94
static void setupParameterSources(TString parsource="oracle", TString asciiParFile="", TString rootParFile="", TString histDate="now")
Definition: hdst.cc:212
HMdcEfficiency * mdcEff
HDataSource * getDataSource(void) const
Definition: hades.h:124
HTaskSet * getTaskSet(Int_t nEvtId)
Definition: hades.cc:400
Int_t typeClustFinder
Float_t cutReplace[4]
Definition: mdcEfficiency.C:74
HRuntimeDb * getRuntimeDb(void)
Definition: hades.h:111
Int_t nLayers[6][4]
Definition: mdcEfficiency.C:37
static void setDataSource(Int_t sourceType=-1, TString inDir="", TString inFile="", Int_t refId=-1, TString eventbuilder="lxhadeb02.gsi.de")
Definition: hdst.cc:308
Float_t cutTime1L[4]
Definition: mdcEfficiency.C:68
Int_t trBits
Definition: mdcEfficiency.C:21
Float_t cutLeft[4]
Definition: mdcEfficiency.C:72
Int_t n
Bool_t makeTree(void)
Definition: hades.cc:591
Bool_t connect(HTask *)
Definition: htaskset.cc:99
Bool_t addContainer(HParSet *)
Definition: hruntimedb.cc:103
void mdcEfficiency(Char_t *fileI=0, Char_t *inDir2=0)
TString paramSource
Definition: mdcEfficiency.C:26
void print()
Definition: htaskset.cc:207
TString beamtime
Definition: mdcEfficiency.C:9
static void setCorrection(Bool_t corr)
Bool_t initContainers(Int_t runId, Int_t refId=-1, const Text_t *fileName="")
Definition: hruntimedb.cc:347
Int_t calibrater1Ver
Definition: mdcEfficiency.C:64
Bool_t setGlobOffset
Definition: mdcEfficiency.C:76
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
Int_t level5s2
void setLevel(Int_t l4s1, Int_t l5s1, Int_t l4s2, Int_t l5s2)
Int_t level4s2
Bool_t isCoilOff
Float_t glOffs[6][4]
Definition: mdcEfficiency.C:77
Bool_t init(Bool_t externInit=kFALSE)
Definition: hades.cc:239
Int_t level4s1
Int_t eventLoop(Int_t nEvents=kMaxInt, Int_t firstEvent=0, Double_t timeQuota=1.e+20)
Definition: hades.cc:631
Bool_t persistency
Hades * gHades
Definition: hades.cc:1213
static HMdcEffMenu * makeMenu(HMdcEfficiency *feff)
Definition: hmdceffmenu.cc:22
Bool_t doStartCorrection
Definition: mdcEfficiency.C:22
void setSecGlobalOffset(Int_t s, Float_t o0, Float_t o1, Float_t o2, Float_t o3)
HParSet * getContainer(const Text_t *)
Definition: hruntimedb.cc:124
Int_t cutStatus
Definition: mdcEfficiency.C:65
Float_t cutTime2L[4]
Definition: mdcEfficiency.C:70
Bool_t add(HTask *)
Definition: htaskset.cc:82
void setStatic(Bool_t flag=kTRUE)
Definition: hparset.h:38
Int_t mdcMods[6][4]
Definition: mdcEfficiency.C:31
Definition: hades.h:37
Bool_t makeTree
Definition: mdcEfficiency.C:23
Char_t * default_indir
Definition: mdcEfficiency.C:12
TString paramrelease
Definition: mdcEfficiency.C:14
Char_t * inFiles[]
Definition: mdcEfficiency.C:16
void setNLayers(Int_t *lst)
void setPersistency(Bool_t perCl)
Float_t cutTime2R[4]
Definition: mdcEfficiency.C:71
Int_t level5s1
static void setupSpectrometer(TString beamtime, Int_t mdcsetup[6][4], TString detectors="rich,mdc,tof,rpc,shower,wall,tbox,start")
Float_t cutRight[4]
Definition: mdcEfficiency.C:73
void selectEventWithTBits(Int_t tb)
Int_t sourceCutPar
Definition: mdcEfficiency.C:66
HTask * make(const Char_t *select="real", const Option_t *option="")
HMdcEffMenu * effMenu
void setCut(Float_t cT1L, Float_t cT1R, Float_t cT2L, Float_t cT2R, Float_t cLeft, Float_t cRight, Float_t cBumpT1L, Float_t cBumpT1R, Float_t cBumpTotL, Float_t cBumpTotR)
Definition: hmdctimecut.cc:95